@sfxcode/formkit-primevue 1.8.6 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +16 -5
  2. package/dist/components/PrimeAutoComplete.vue +38 -12
  3. package/dist/components/PrimeCalendar.vue +110 -17
  4. package/dist/components/PrimeCascadeSelect.vue +41 -10
  5. package/dist/components/PrimeCheckbox.vue +40 -14
  6. package/dist/components/PrimeChips.vue +36 -12
  7. package/dist/components/PrimeColorPicker.vue +32 -12
  8. package/dist/components/PrimeDropdown.vue +90 -16
  9. package/dist/components/PrimeEditor.vue +32 -14
  10. package/dist/components/PrimeInputMask.vue +69 -18
  11. package/dist/components/PrimeInputNumber.vue +55 -13
  12. package/dist/components/PrimeInputSwitch.vue +40 -14
  13. package/dist/components/PrimeInputText.vue +45 -20
  14. package/dist/components/PrimeKnob.vue +47 -13
  15. package/dist/components/PrimeListbox.vue +52 -12
  16. package/dist/components/PrimeMultiSelect.vue +96 -11
  17. package/dist/components/PrimePassword.vue +48 -13
  18. package/dist/components/PrimeRadioButton.vue +33 -15
  19. package/dist/components/PrimeRating.vue +40 -14
  20. package/dist/components/PrimeSelectButton.vue +44 -11
  21. package/dist/components/PrimeSlider.vue +42 -12
  22. package/dist/components/PrimeTextarea.vue +32 -13
  23. package/dist/components/PrimeToggleButton.vue +39 -11
  24. package/dist/components/PrimeTreeSelect.vue +50 -11
  25. package/dist/components/PrimeTriStateCheckbox.vue +36 -13
  26. package/dist/composables/useFormKitSchema.d.ts +1 -1
  27. package/dist/composables/useFormKitSchema.js +6 -4
  28. package/dist/composables/useFormKitSchema.mjs +4 -4
  29. package/dist/index.d.ts +55 -56
  30. package/dist/index.js +24 -24
  31. package/dist/index.mjs +343 -24
  32. package/dist/sass/formkit-primevue.scss +4 -0
  33. package/dist/style.css +1 -1
  34. package/package.json +14 -13
package/README.md CHANGED
@@ -15,7 +15,6 @@ Helper classes for using [Formkit](https://formkit.com/) with the [PrimeVue UI F
15
15
  import { defaultConfig, plugin } from '@formkit/vue'
16
16
  import { primeInputs } from '@sfxcode/formkit-primevue'
17
17
 
18
-
19
18
  app.use(plugin, defaultConfig({
20
19
  locales: { de, en },
21
20
  // Define the active locale
@@ -24,6 +23,11 @@ import { primeInputs } from '@sfxcode/formkit-primevue'
24
23
  }))
25
24
  ```
26
25
 
26
+ ### Schema Helper Functions
27
+
28
+ [useFormKitSchema](https://github.com/sfxcode/formkit-primevue/blob/main/src/composables/useFormKitSchema.ts) provide functions to simplify the usage of elements, components, lists, ...
29
+
30
+
27
31
  ### Basic Styling
28
32
 
29
33
  Basic styling is provided with the **formkit-primevue.scss** file.
@@ -41,7 +45,14 @@ You can use it or take it as base for your own styling.
41
45
  - All inputs are wrapped in a div with a **p-formkit** class
42
46
  - Most Prime Components have access to class / styles attributes
43
47
  - PT and PTOptions are available ([https://primevue.org/passthrough/](https://primevue.org/passthrough/))
44
- - [Styling](https://formkit-primevue.netlify.app/demo/styling), [Grid](https://formkit-primevue.netlify.app/demo/grid) and [PT](https://formkit-primevue.netlify.app/demo/passThrough) demo available
48
+ - [Styling](https://formkit-primevue.netlify.app/demo/styling) and [PT](https://formkit-primevue.netlify.app/demo/passThrough) demo available
49
+
50
+ ### Samples
51
+
52
+ Some samples for common tasks are available
53
+
54
+ - Repeater (with the help of the useFormKitSchema compsable)
55
+ - Grid
45
56
 
46
57
  ## Showcases
47
58
 
@@ -51,9 +62,11 @@ You can use it or take it as base for your own styling.
51
62
 
52
63
  ## Supported Inputs
53
64
 
65
+ - AutoComplete
54
66
  - Calendar
55
67
  - CascadeSelect
56
68
  - Checkbox
69
+ - Chips
57
70
  - Dropdown
58
71
  - Editor (HTML Editor)
59
72
  - InputMask
@@ -64,7 +77,6 @@ You can use it or take it as base for your own styling.
64
77
  - MultiSelect
65
78
  - Password
66
79
  - Ranking
67
- - Chips
68
80
  - Knob
69
81
  - ColorPicker
70
82
  - Listbox
@@ -74,8 +86,7 @@ You can use it or take it as base for your own styling.
74
86
  - RadioButton
75
87
  - TreeSelect
76
88
 
77
- ## Demo
89
+ ## Demo
78
90
  [Demo/Playground](https://formkit-primevue.netlify.app/)
79
91
 
80
92
  ![](formkit-primevue.png)
81
-
@@ -1,24 +1,41 @@
1
1
  <script setup lang='ts'>
2
- import { computed } from 'vue'
2
+ import { type PropType, computed, ref } from 'vue'
3
+ import type { FormKitFrameworkContext } from '@formkit/core'
4
+ import type {
5
+ AutoCompleteCompleteEvent,
6
+ AutoCompleteProps,
7
+ } from 'primevue/autocomplete'
8
+
9
+ export interface FormKitPrimeAutoCompleteProps {
10
+ pt?: AutoCompleteProps['pt']
11
+ ptOptions?: AutoCompleteProps['ptOptions']
12
+ unstyled?: AutoCompleteProps['unstyled']
13
+ dropdown?: AutoCompleteProps['dropdown']
14
+ multiple?: AutoCompleteProps['multiple']
15
+ }
3
16
 
4
17
  const props = defineProps({
5
- context: Object,
18
+ context: {
19
+ type: Object as PropType<FormKitFrameworkContext & FormKitPrimeAutoCompleteProps>,
20
+ required: true,
21
+ },
6
22
  })
7
23
 
8
- const context = props.context
9
- const attrs = computed(() => context?.attrs)
10
-
11
24
  const suggestions = ref([])
12
25
 
13
- function search(event) {
14
- suggestions.value = attrs.value.complete(event.query)
26
+ function search(event: AutoCompleteCompleteEvent) {
27
+ suggestions.value = props.context?.attrs.complete(event.query)
28
+ }
29
+
30
+ function handleInput(_: any) {
31
+ props.context?.node.input(props.context?._value)
15
32
  }
16
33
 
17
- function handleInput(e: any) {
18
- context?.node.input(props.context?._value)
34
+ function handleBlur(event: Event) {
35
+ props.context?.handlers.blur(event)
19
36
  }
20
37
 
21
- const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
38
+ const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
22
39
  </script>
23
40
 
24
41
  <template>
@@ -26,12 +43,21 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
26
43
  <AutoComplete
27
44
  :id="context.id"
28
45
  v-model="context._value"
29
- v-bind="attrs"
30
- :disabled="attrs._disabled ?? !!context?.disabled"
46
+ v-bind="context?.attrs"
47
+ :disabled="!!context?.disabled"
31
48
  :class="styleClass"
49
+ :tabindex="context?.attrs.tabindex"
50
+ :aria-label="context?.attrs.ariaLabel"
51
+ :aria-labelledby="context?.attrs.ariaLabelledby"
32
52
  :suggestions="suggestions"
53
+ :dropdown="context?.dropdown ?? false"
54
+ :multiple="context?.multiple ?? false"
55
+ :pt="context?.pt"
56
+ :pt-options="context?.ptOptions"
57
+ :unstyled="context?.unstyled ?? false"
33
58
  @complete="search"
34
59
  @change="handleInput"
60
+ @blur="handleBlur"
35
61
  />
36
62
  </div>
37
63
  </template>
@@ -1,45 +1,138 @@
1
1
  <script setup lang='ts'>
2
- import { computed } from 'vue'
2
+ import type { CalendarBlurEvent, CalendarProps } from 'primevue/calendar'
3
+ import { type PropType, computed } from 'vue'
4
+ import type { FormKitFrameworkContext } from '@formkit/core'
3
5
 
4
- import type { CalendarBlurEvent } from 'primevue/calendar'
6
+ export interface FormKitPrimeCalendarProps {
7
+ dateFormat?: CalendarProps['dateFormat']
8
+ placeholder?: CalendarProps['placeholder']
9
+ selectionMode?: CalendarProps['selectionMode']
10
+ inline?: CalendarProps['inline']
11
+ icon?: CalendarProps['icon']
12
+ showOtherMonths?: CalendarProps['showOtherMonths']
13
+ selectOtherMonths?: CalendarProps['selectOtherMonths']
14
+ showIcon?: CalendarProps['showIcon']
15
+ previousIcon?: CalendarProps['previousIcon']
16
+ nextIcon?: CalendarProps['nextIcon']
17
+ incrementIcon?: CalendarProps['incrementIcon']
18
+ decrementIcon?: CalendarProps['decrementIcon']
19
+ numberOfMonths?: CalendarProps['numberOfMonths']
20
+ responsiveOptions?: CalendarProps['responsiveOptions']
21
+ view?: CalendarProps['view']
22
+ touchUI?: CalendarProps['touchUI']
23
+ minDate?: CalendarProps['minDate']
24
+ maxDate?: CalendarProps['maxDate']
25
+ disabledDates?: CalendarProps['disabledDates']
26
+ disabledDays?: CalendarProps['disabledDays']
27
+ maxDateCount?: CalendarProps['maxDateCount']
28
+ showOnFocus?: CalendarProps['showOnFocus']
29
+ autoZIndex?: CalendarProps['autoZIndex']
30
+ baseZIndex?: CalendarProps['baseZIndex']
31
+ showButtonBar?: CalendarProps['showButtonBar']
32
+ showTime?: CalendarProps['showTime']
33
+ timeOnly?: CalendarProps['timeOnly']
34
+ shortYearCutoff?: CalendarProps['shortYearCutoff']
35
+ hourFormat?: CalendarProps['hourFormat']
36
+ stepHour?: CalendarProps['stepHour']
37
+ stepMinute?: CalendarProps['stepMinute']
38
+ stepSecond?: CalendarProps['stepSecond']
39
+ showSeconds?: CalendarProps['showSeconds']
40
+ hideOnDateTimeSelect?: CalendarProps['hideOnDateTimeSelect']
41
+ hideOnRangeSelection?: CalendarProps['hideOnRangeSelection']
42
+ timeSeparator?: CalendarProps['timeSeparator']
43
+ showWeek?: CalendarProps['showWeek']
44
+ manualInput?: CalendarProps['manualInput']
45
+ appendTo?: CalendarProps['appendTo']
46
+ panelStyle?: CalendarProps['panelStyle']
47
+ panelClass?: CalendarProps['panelClass']
48
+ pt?: CalendarProps['pt']
49
+ ptOptions?: CalendarProps['ptOptions']
50
+ unstyled?: CalendarProps['unstyled']
51
+ }
5
52
 
6
53
  const props = defineProps({
7
- context: Object,
54
+ context: {
55
+ type: Object as PropType<FormKitFrameworkContext & FormKitPrimeCalendarProps>,
56
+ required: true,
57
+ },
8
58
  })
9
59
 
10
- const context = props.context
11
- const attrs = computed(() => context?.attrs)
12
-
13
- function handleInput(e: any) {
14
- context?.node.input(context?._value)
60
+ function handleInput(_: any) {
61
+ props.context?.node.input(props.context?._value)
15
62
  }
16
63
 
17
64
  function handleSelect(e: any) {
18
- context?.node.input(e)
65
+ props.context?.node.input(e)
19
66
  }
20
67
 
21
68
  function handleBlur(e: CalendarBlurEvent) {
22
- context?.handlers.blur(e.value)
69
+ props.context?.handlers.blur(e.originalEvent)
23
70
  }
24
71
 
25
72
  function handleClearClick() {
26
- context?.node.input(null)
73
+ props.context?.node.input(null)
27
74
  }
28
75
 
29
- const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
76
+ const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
30
77
  </script>
31
78
 
32
79
  <template>
33
80
  <div class="p-formkit">
34
81
  <Calendar
35
82
  v-model="context._value"
36
- v-bind="attrs"
37
- :input-id="props.context.id"
38
- :disabled="attrs._disabled ?? !!context?.disabled"
39
- :readonly="attrs._readonly ?? false"
40
- :input-style="attrs.style"
83
+ v-bind="context?.attrs"
84
+ :input-id="context.id"
85
+ :disabled="!!context?.disabled"
86
+ :readonly="context?.attrs._readonly ?? false"
87
+ :input-style="context?.attrs.style"
41
88
  :input-class="styleClass"
89
+ :tabindex="context?.attrs.tabindex"
90
+ :aria-label="context?.attrs.ariaLabel"
91
+ :aria-labelledby="context?.attrs.ariaLabelledby"
92
+ :date-format="context?.dateFormat"
93
+ :placeholder="context?.placeholder"
94
+ :selection-mode="context?.selectionMode ?? 'single'"
95
+ :inline="context?.inline ?? false"
96
+ :show-other-months="context?.showOtherMonths ?? true"
97
+ :select-other-months="context?.selectOtherMonths ?? false"
98
+ :icon="context?.icon"
42
99
  :show-icon="context.showIcon"
100
+ :previous-icon="context?.previousIcon ?? 'pi pi-chevron-left'"
101
+ :next-icon="context?.nextIcon ?? 'pi pi-chevron-right'"
102
+ :increment-icon="context?.incrementIcon ?? 'pi pi-chevron-up'"
103
+ :decrement-icon="context?.decrementIcon ?? 'pi pi-chevron-down'"
104
+ :number-of-months="context?.numberOfMonths ?? 1"
105
+ :responsive-options="context?.responsiveOptions"
106
+ :view="context?.view ?? 'date'"
107
+ :touch-u-i="context?.touchUI ?? false"
108
+ :min-date="context?.minDate"
109
+ :max-date="context?.maxDate"
110
+ :disabled-dates="context?.disabledDates"
111
+ :disabled-days="context?.disabledDays"
112
+ :max-date-count="context?.maxDateCount"
113
+ :show-on-focus="context?.showOnFocus ?? true"
114
+ :auto-z-index="context?.autoZIndex ?? true"
115
+ :base-z-index="context?.baseZIndex ?? 0"
116
+ :show-button-bar="context?.showButtonBar ?? false"
117
+ :show-time="context?.showTime ?? false"
118
+ :time-only="context?.timeOnly ?? false"
119
+ :short-year-cutoff="context?.shortYearCutoff ?? '+10'"
120
+ :hour-format="context?.hourFormat ?? '24'"
121
+ :step-hour="context?.stepHour ?? 1"
122
+ :step-minute="context?.stepMinute ?? 1"
123
+ :step-second="context?.stepSecond ?? 1"
124
+ :show-seconds="context?.showSeconds ?? false"
125
+ :hide-on-date-time-select="context?.hideOnDateTimeSelect ?? false"
126
+ :hide-on-range-selection="context?.hideOnRangeSelection ?? false"
127
+ :time-separator="context?.timeSeparator ?? ':'"
128
+ :show-week="context?.showWeek ?? false"
129
+ :manual-input="context?.manualInput ?? true"
130
+ :append-to="context?.appendTo ?? 'body'"
131
+ :panel-style="context?.panelStyle"
132
+ :panel-class="context?.panelClass"
133
+ :pt="context?.pt"
134
+ :pt-options="context?.ptOptions"
135
+ :unstyled="context?.unstyled ?? false"
43
136
  @date-select="handleSelect"
44
137
  @input="handleInput"
45
138
  @blur="handleBlur"
@@ -1,18 +1,36 @@
1
1
  <script setup lang='ts'>
2
- import { computed } from 'vue'
2
+ import { type PropType, computed } from 'vue'
3
+ import type { FormKitFrameworkContext } from '@formkit/core'
4
+ import type { CascadeSelectProps } from 'primevue/cascadeselect'
5
+
6
+ export interface FormKitPrimeCascadeSelectProps {
7
+ options?: CascadeSelectProps['options']
8
+ optionLabel?: CascadeSelectProps['optionLabel']
9
+ optionValue?: CascadeSelectProps['optionValue']
10
+ optionGroupLabel?: CascadeSelectProps['optionGroupLabel']
11
+ optionGroupChildren?: CascadeSelectProps['optionGroupChildren']
12
+ placeholder?: CascadeSelectProps['placeholder']
13
+ pt?: CascadeSelectProps['pt']
14
+ ptOptions?: CascadeSelectProps['ptOptions']
15
+ unstyled?: CascadeSelectProps['unstyled']
16
+ }
3
17
 
4
18
  const props = defineProps({
5
- context: Object,
19
+ context: {
20
+ type: Object as PropType<FormKitFrameworkContext & FormKitPrimeCascadeSelectProps>,
21
+ required: true,
22
+ },
6
23
  })
7
24
 
8
- const context = props.context
9
- const attrs = computed(() => context?.attrs)
25
+ function handleInput(_: any) {
26
+ props.context?.node.input(props.context?._value)
27
+ }
10
28
 
11
- function handleInput(e: any) {
12
- context?.node.input(props.context?._value)
29
+ function handleBlur(e: Event) {
30
+ props.context?.handlers.blur(e)
13
31
  }
14
32
 
15
- const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
33
+ const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
16
34
  </script>
17
35
 
18
36
  <template>
@@ -20,11 +38,24 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
20
38
  <CascadeSelect
21
39
  :id="context.id"
22
40
  v-model="context._value"
23
- v-bind="attrs"
24
- :disabled="attrs._disabled ?? !!context?.disabled"
25
- :readonly="attrs._readonly ?? false"
41
+ v-bind="context?.attrs"
42
+ :disabled="!!context?.disabled"
43
+ :readonly="context?.attrs._readonly ?? false"
26
44
  :class="styleClass"
45
+ :tabindex="context?.attrs.tabindex"
46
+ :aria-label="context?.attrs.ariaLabel"
47
+ :aria-labelledby="context?.attrs.ariaLabelledby"
48
+ :options="context?.options"
49
+ :option-label="context?.optionLabel"
50
+ :option-value="context.optionValue"
51
+ :option-group-label="context.optionGroupLabel"
52
+ :option-group-children="context.optionGroupChildren"
53
+ :placeholder="context.placeholder"
54
+ :pt="context.pt"
55
+ :pt-options="context.ptOptions"
56
+ :unstyled="context.unstyled ?? false"
27
57
  @change="handleInput"
58
+ @blur="handleBlur"
28
59
  />
29
60
  </div>
30
61
  </template>
@@ -1,34 +1,60 @@
1
1
  <script setup lang='ts'>
2
- import { computed } from 'vue'
2
+ import { type PropType, computed } from 'vue'
3
+ import type { FormKitFrameworkContext } from '@formkit/core'
4
+ import type { CheckboxProps } from 'primevue/checkbox'
5
+
6
+ export interface FormKitPrimeCheckboxProps {
7
+ binary?: CheckboxProps['binary']
8
+ trueValue?: CheckboxProps['trueValue']
9
+ falseValue?: CheckboxProps['falseValue']
10
+ pt?: CheckboxProps['pt']
11
+ ptOptions?: CheckboxProps['ptOptions']
12
+ unstyled?: CheckboxProps['unstyled']
13
+ labelLeft?: string
14
+ labelRight?: string
15
+ }
3
16
 
4
17
  const props = defineProps({
5
- context: Object,
18
+ context: {
19
+ type: Object as PropType<FormKitFrameworkContext & FormKitPrimeCheckboxProps>,
20
+ required: true,
21
+ },
6
22
  })
7
23
 
8
- const context = props.context
9
- const attrs = computed(() => context?.attrs)
24
+ function handleInput(_: any) {
25
+ props.context?.node.input(props.context?._value)
26
+ }
10
27
 
11
- function handleInput(e: any) {
12
- context?.node.input(props.context?._value)
28
+ function handleBlur(e: Event) {
29
+ props.context?.handlers.blur(e)
13
30
  }
14
31
 
15
- const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
32
+ const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
16
33
  </script>
17
34
 
18
35
  <template>
19
36
  <div class="p-formkit">
20
- <span v-if="context.attrs.labelLeft" class="formkit-prime-left">{{ context.attrs.labelLeft }}</span>
37
+ <span v-if="context.labelLeft" class="formkit-prime-left">{{ context.labelLeft }}</span>
21
38
  <Checkbox
22
39
  v-model="context._value"
23
- v-bind="attrs"
40
+ v-bind="context?.attrs"
24
41
  :input-id="context.id"
25
- :disabled="attrs._disabled ?? !!context?.disabled"
26
- :readonly="attrs._readonly ?? false"
27
- :input-style="attrs.style"
42
+ :disabled="!!context?.disabled"
43
+ :readonly="context?.attrs._readonly ?? false"
44
+ :input-style="context?.attrs.style"
28
45
  :input-class="styleClass"
29
- :binary="attrs.binary ?? true"
46
+ :tabindex="context?.attrs.tabindex"
47
+ :aria-label="context?.attrs.ariaLabel"
48
+ :aria-labelledby="context?.attrs.ariaLabelledby"
49
+ :binary="context.binary ?? true"
50
+ :true-value="context.trueValue ?? undefined"
51
+ :false-value="context.falseValue ?? undefined"
52
+ :pt="context.pt"
53
+ :pt-options="context.ptOptions"
54
+ :unstyled="context.unstyled ?? false"
30
55
  @change="handleInput"
56
+ @blur="handleBlur"
31
57
  />
32
- <span v-if="context.attrs.labelRight" class="formkit-prime-right">{{ context.attrs.labelRight }}</span>
58
+ <span v-if="context.labelRight" class="formkit-prime-right">{{ context.labelRight }}</span>
33
59
  </div>
34
60
  </template>
@@ -1,29 +1,53 @@
1
1
  <script setup lang='ts'>
2
- import { computed } from 'vue'
2
+ import { type PropType, computed } from 'vue'
3
+ import type { FormKitFrameworkContext } from '@formkit/core'
4
+ import type { ChipsProps } from 'primevue/chips'
5
+
6
+ export interface FormKitPrimeChipsProps {
7
+ allowDuplicate?: ChipsProps['allowDuplicate']
8
+ addOnBlur?: ChipsProps['addOnBlur']
9
+ max?: ChipsProps['max']
10
+ placeholder?: ChipsProps['placeholder']
11
+ separator?: ChipsProps['separator']
12
+ pt?: ChipsProps['pt']
13
+ ptOptions?: ChipsProps['ptOptions']
14
+ unstyled?: ChipsProps['unstyled']
15
+ }
3
16
 
4
17
  const props = defineProps({
5
- context: Object,
18
+ context: {
19
+ type: Object as PropType<FormKitFrameworkContext & FormKitPrimeChipsProps>,
20
+ required: true,
21
+ },
6
22
  })
7
23
 
8
- const context = props.context
9
- const attrs = computed(() => context?.attrs)
10
-
11
- function handleInput(e: any) {
12
- context?.node.input(props.context?._value)
24
+ function handleInput(_: any) {
25
+ props.context?.node.input(props.context?._value)
13
26
  }
14
- const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${attrs.value?.class} p-invalid` : attrs.value?.class)
27
+ const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
15
28
  </script>
16
29
 
17
30
  <template>
18
31
  <div class="p-formkit">
19
32
  <Chips
20
33
  v-model="context._value"
21
- v-bind="attrs"
34
+ v-bind="context?.attrs"
22
35
  :input-id="context.id"
23
- :disabled="attrs._disabled ?? !!context?.disabled"
24
- :readonly="attrs._readonly ?? false"
25
- :input-style="attrs.style"
36
+ :disabled="!!context?.disabled"
37
+ :readonly="context?.attrs._readonly ?? false"
38
+ :input-style="context?.attrs.style"
26
39
  :input-class="styleClass"
40
+ :tabindex="context?.attrs.tabindex"
41
+ :aria-label="context?.attrs.ariaLabel"
42
+ :aria-labelledby="context?.attrs.ariaLabelledby"
43
+ :allow-duplicate="context.allowDuplicate ?? true"
44
+ :add-on-blur="context.addOnBlur ?? false"
45
+ :max="context.max ?? undefined"
46
+ :placeholder="context.placeholder"
47
+ :separator="context.separator"
48
+ :pt="context.pt"
49
+ :pt-options="context.ptOptions"
50
+ :unstyled="context.unstyled ?? false"
27
51
  @add="handleInput"
28
52
  @remove="handleInput"
29
53
  />
@@ -1,15 +1,26 @@
1
1
  <script setup lang='ts'>
2
- import { computed } from 'vue'
2
+ import type { PropType } from 'vue'
3
+ import type { FormKitFrameworkContext } from '@formkit/core'
4
+ import type { ColorPickerProps } from 'primevue/colorpicker'
5
+
6
+ export interface FormKitPrimeColorPickerProps {
7
+ defaultColor?: ColorPickerProps['defaultColor']
8
+ inline?: ColorPickerProps['inline']
9
+ format?: ColorPickerProps['format']
10
+ pt?: ColorPickerProps['pt']
11
+ ptOptions?: ColorPickerProps['ptOptions']
12
+ unstyled?: ColorPickerProps['unstyled']
13
+ }
3
14
 
4
15
  const props = defineProps({
5
- context: Object,
16
+ context: {
17
+ type: Object as PropType<FormKitFrameworkContext & FormKitPrimeColorPickerProps>,
18
+ required: true,
19
+ },
6
20
  })
7
21
 
8
- const context = props.context
9
- const attrs = computed(() => context?.attrs)
10
-
11
- function handleChange(e: any) {
12
- context?.node.input(props.context?._value)
22
+ function handleChange(_: any) {
23
+ props.context?.node.input(props.context?._value)
13
24
  }
14
25
  </script>
15
26
 
@@ -17,11 +28,20 @@ function handleChange(e: any) {
17
28
  <div class="p-formkit">
18
29
  <ColorPicker
19
30
  v-model="context._value"
20
- v-bind="attrs"
21
- :disabled="attrs._disabled ?? !!context?.disabled"
22
- :readonly="attrs._readonly ?? false"
23
- :style="attrs.style"
24
- :panel-class="attrs.class"
31
+ v-bind="context?.attrs"
32
+ :disabled="!!context?.disabled"
33
+ :readonly="context?.attrs._readonly ?? false"
34
+ :style="context?.attrs.style"
35
+ :panel-class="context?.attrs.class"
36
+ :tabindex="context?.attrs.tabindex"
37
+ :aria-label="context?.attrs.ariaLabel"
38
+ :aria-labelledby="context?.attrs.ariaLabelledby"
39
+ :default-color="context.defaultColor ?? 'ff0000'"
40
+ :inline="context.inline ?? false"
41
+ :format="context.format"
42
+ :pt="context.pt"
43
+ :pt-options="context.ptOptions"
44
+ :unstyled="context.unstyled ?? false"
25
45
  @change="handleChange"
26
46
  />
27
47
  </div>