diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 1ca2a4c..b0a1b71 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -29,7 +29,10 @@ jobs: uses: actions/checkout@v4 - name: Run Trivy vulnerability scanner in repo mode - uses: aquasecurity/trivy-action@d9cd5b1c23aaf8cb31bb09141028215828364bbb + uses: aquasecurity/trivy-action@a20de5420d57c4102486cdd9578b45609c99d7eb + env: + TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db + TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db with: scan-type: "fs" format: "sarif" diff --git a/src/primevue/index.ts b/src/primevue/index.ts index fbf1d48..fee88bb 100644 --- a/src/primevue/index.ts +++ b/src/primevue/index.ts @@ -16,6 +16,7 @@ import autocomplete from "./autocomplete/autocomplete"; import textarea from "./textarea/textarea"; import toast from "./toast/toast"; import select from "./select/select"; +import inputMask from "./inputMask/inputMask"; import { deDE } from "@/config/locale"; @@ -36,6 +37,7 @@ export const RisUiTheme = { toast, autocomplete, select, + inputMask, }; export const RisUiLocale = { diff --git a/src/primevue/inputMask/inputMask.stories.ts b/src/primevue/inputMask/inputMask.stories.ts new file mode 100644 index 0000000..22cc5e5 --- /dev/null +++ b/src/primevue/inputMask/inputMask.stories.ts @@ -0,0 +1,201 @@ +import { Meta, StoryObj } from "@storybook/vue3"; +import InputMask from "primevue/inputmask"; +import { html } from "@/lib/tags"; +import Fluid from "primevue/fluid"; +import { ref } from "vue"; +import ErrorOutline from "~icons/material-symbols/error-outline"; + +const meta: Meta = { + component: InputMask, + + tags: ["autodocs"], + + args: { + disabled: false, + fluid: false, + placeholder: "TT.MM.JJJJ", + mask: "99.99.9999", + readOnly: false, + invalid: false, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: StoryObj = { + args: { + modelValue: "12.12.2023", + }, + render: (args) => ({ + components: { InputMask }, + setup() { + return { args }; + }, + template: html` `, + }), +}; + +export const WithLabelAndHint: StoryObj = { + render: (args) => ({ + components: { InputMask }, + setup() { + return { args }; + }, + template: html`
+ + + Additional hint text +
`, + }), +}; + +export const WithHorizontalLabel: StoryObj = { + render: (args) => ({ + components: { InputMask }, + setup() { + return { args }; + }, + template: html`
+ + +
`, + }), +}; + +export const Disabled: StoryObj = { + args: { + disabled: true, + }, + + render: (args) => ({ + components: { InputMask }, + setup() { + return { args }; + }, + template: html``, + }), +}; + +export const Readonly: StoryObj = { + args: { + readonly: true, + }, + + render: (args) => ({ + components: { InputMask }, + setup() { + return { args }; + }, + template: html``, + }), +}; + +export const Invalid: StoryObj = { + args: { + invalid: true, + }, + + render: (args) => ({ + components: { InputMask, ErrorOutline }, + setup() { + return { args }; + }, + template: html`
+ + Invalid date +
`, + }), +}; + +export const StartWithEndDate: Story = { + render: () => ({ + components: { InputMask }, + setup() { + const startDate = ref(""); + const endDate = ref(""); + return { startDate, endDate }; + }, + template: html` +
+
+ +
+ +
+ +
+
+ `, + }), +}; + +export const ThreeFields: StoryObj = { + render: () => ({ + components: { InputMask }, + setup() { + const day = ref(""); + const month = ref(""); + const year = ref(""); + + return { day, month, year }; + }, + template: html` +
+ +
+
+ +
+
+ +
+ +
+ +
+
+
+ `, + }), +}; +export const FluidProp: StoryObj = { + args: { + fluid: true, + }, + + render: (args) => ({ + components: { InputMask, Fluid }, + setup() { + return { args }; + }, + template: html``, + }), +}; diff --git a/src/primevue/inputMask/inputMask.ts b/src/primevue/inputMask/inputMask.ts new file mode 100644 index 0000000..6f754ac --- /dev/null +++ b/src/primevue/inputMask/inputMask.ts @@ -0,0 +1,18 @@ +import { InputMaskPassThroughOptions } from "primevue/inputmask"; +import { base, small } from "../inputText/inputText"; + +const inputMask: InputMaskPassThroughOptions = { + pcInputText: { + root: ({ props }) => { + return { + class: { + [base]: true, + [small]: true, + "w-full": !!props.fluid, + }, + }; + }, + }, +}; + +export default inputMask; diff --git a/src/primevue/inputText/inputText.ts b/src/primevue/inputText/inputText.ts index 695751d..bf867ac 100644 --- a/src/primevue/inputText/inputText.ts +++ b/src/primevue/inputText/inputText.ts @@ -2,7 +2,7 @@ import { tw } from "@/lib/tags"; import { InputTextPassThroughOptions } from "primevue/inputtext"; import "./inputText.css"; // Base -export const base = tw`border-2 border-blue-800 bg-white outline-4 -outline-offset-4 outline-blue-800 placeholder:text-gray-900 read-only:cursor-not-allowed read-only:border-blue-300 read-only:bg-blue-300 hover:outline focus:outline disabled:border-blue-500 disabled:bg-white disabled:text-blue-500 disabled:outline-none aria-[invalid]:border-red-800 aria-[invalid]:bg-red-200 aria-[invalid]:outline-red-800 aria-[invalid]:disabled:outline-none`; +export const base = tw`border-2 border-blue-800 bg-white outline-4 -outline-offset-4 outline-blue-800 placeholder:text-gray-800 read-only:cursor-not-allowed read-only:border-blue-300 read-only:bg-blue-300 hover:outline focus:outline disabled:border-blue-500 disabled:bg-white disabled:text-blue-500 disabled:outline-none aria-[invalid]:border-red-800 aria-[invalid]:bg-red-200 aria-[invalid]:outline-red-800 aria-[invalid]:disabled:outline-none`; // Sizes export const small = tw`ris-body2-regular h-48 px-16 py-4`;