@saasmakers/ui 0.1.101 → 0.1.103

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.
@@ -17,9 +17,9 @@ withDefaults(defineProps<Omit<FieldCheckbox, 'modelValue'>>(), {
17
17
  validation: undefined,
18
18
  })
19
19
 
20
- const modelValue = defineModel<FieldCheckbox['modelValue']>({ default: false })
20
+ const id = useId()
21
21
 
22
- const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
22
+ const modelValue = defineModel<FieldCheckbox['modelValue']>({ default: false })
23
23
  </script>
24
24
 
25
25
  <template>
@@ -31,7 +31,7 @@ const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
31
31
  <div class="flex flex-1 items-center">
32
32
  <input
33
33
  v-if="!loading"
34
- :id="uuid"
34
+ :id="id"
35
35
  v-model="modelValue"
36
36
  class="border border-gray-300 rounded-lg accent-indigo-700 transition-shadow flex-initial dark:border-gray-700"
37
37
  :class="{
@@ -56,7 +56,7 @@ const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
56
56
  v-if="label"
57
57
  class="flex-1"
58
58
  :disabled="disabled"
59
- :for-field="uuid"
59
+ :for-field="id"
60
60
  has-margin-left
61
61
  :icon="labelIcon"
62
62
  :label="label"
@@ -39,10 +39,11 @@ defineSlots<{
39
39
  label?: () => VNode[]
40
40
  }>()
41
41
 
42
+ const id = useId()
43
+
42
44
  const modelValue = defineModel<FieldInput['modelValue']>({ default: '' })
43
45
 
44
46
  const input = ref<HTMLInputElement>()
45
- const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
46
47
 
47
48
  const { isDesktopBrowser } = useDevice()
48
49
 
@@ -125,7 +126,7 @@ defineExpose({ focus })
125
126
  >
126
127
  <FieldLabel
127
128
  :disabled="disabled"
128
- :for-field="uuid"
129
+ :for-field="id"
129
130
  has-margin-bottom
130
131
  :icon="labelIcon"
131
132
  :label="label"
@@ -148,7 +149,7 @@ defineExpose({ focus })
148
149
  <slot name="inputLeft" />
149
150
 
150
151
  <input
151
- :id="uuid"
152
+ :id="id"
152
153
  ref="input"
153
154
  :autocomplete="autocomplete ? 'on' : 'off'"
154
155
  class="h-full w-full flex-1 appearance-none items-center rounded-lg outline-none placeholder-gray-600 dark:placeholder-gray-400"
@@ -30,11 +30,11 @@ const emit = defineEmits<{
30
30
 
31
31
  const { getIcon } = useLayerIcons()
32
32
  const { fadeIn } = useMotion()
33
+ const id = useId()
33
34
 
34
35
  const modelValue = defineModel<FieldSelect['modelValue']>({ default: '' })
35
36
 
36
37
  const opened = ref(false)
37
- const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
38
38
 
39
39
  const computedColumns = computed(() => {
40
40
  if (props.columns.length) {
@@ -139,7 +139,7 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
139
139
  <FieldLabel
140
140
  v-if="label"
141
141
  :disabled="disabled"
142
- :for-field="uuid"
142
+ :for-field="id"
143
143
  has-margin-bottom
144
144
  :icon="labelIcon"
145
145
  :label="label"
@@ -185,6 +185,7 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
185
185
  <BaseIcon
186
186
  v-if="selectedOption.icon"
187
187
  class="pointer-events-none mr-2"
188
+ :color="selectedOption.iconColor"
188
189
  :icon="selectedOption.icon"
189
190
  />
190
191
 
@@ -262,6 +263,7 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
262
263
  <BaseIcon
263
264
  v-if="option.text"
264
265
  class="pointer-events-none mr-2 flex-initial"
266
+ :color="option.iconColor"
265
267
  :icon="option.icon"
266
268
  :size="size"
267
269
  :text="option.text"
@@ -26,10 +26,11 @@ const emit = defineEmits<{
26
26
  click: [event: MouseEvent, value: string]
27
27
  }>()
28
28
 
29
+ const id = useId()
30
+
29
31
  const modelValue = defineModel<FieldTextarea['modelValue']>({ default: '' })
30
32
 
31
33
  const textarea = ref<HTMLTextAreaElement>()
32
- const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
33
34
 
34
35
  const { isDesktopBrowser } = useDevice()
35
36
 
@@ -56,7 +57,7 @@ function onFieldClick(event: MouseEvent) {
56
57
  <FieldLabel
57
58
  v-if="label"
58
59
  :disabled="disabled"
59
- :for-field="uuid"
60
+ :for-field="id"
60
61
  has-margin-bottom
61
62
  :icon="labelIcon"
62
63
  :label="label"
@@ -65,7 +66,7 @@ function onFieldClick(event: MouseEvent) {
65
66
  />
66
67
 
67
68
  <textarea
68
- :id="uuid"
69
+ :id="id"
69
70
  ref="textarea"
70
71
  v-model="modelValue"
71
72
  v-bind="{ 'data-enable-grammarly': 'false' }"
@@ -13,7 +13,6 @@ export default {
13
13
  disabled: { control: 'boolean' },
14
14
  hideError: { control: 'boolean' },
15
15
  icon: { control: 'text' },
16
- id: { control: 'text' },
17
16
  label: { control: 'text' },
18
17
  labelIcon: { control: 'text' },
19
18
  name: { control: 'text' },
@@ -32,7 +31,6 @@ export default {
32
31
 
33
32
  export const Default: StoryObj<typeof FieldTime> = {
34
33
  args: {
35
- id: 'time-1',
36
34
  label: 'Time Label',
37
35
  modelValue: '',
38
36
  } satisfies Partial<FieldTime>,
@@ -20,11 +20,11 @@ const emit = defineEmits<{
20
20
  }>()
21
21
 
22
22
  const { getIcon } = useLayerIcons()
23
+ const id = useId()
23
24
 
24
25
  const modelValue = defineModel<FieldTime['modelValue']>({ default: '' })
25
26
 
26
27
  const inputRef = ref<HTMLInputElement>()
27
- const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
28
28
 
29
29
  function onFieldBlur(event: FocusEvent) {
30
30
  emit('blur', event, modelValue.value, props.name)
@@ -43,7 +43,7 @@ function onContainerClick() {
43
43
  <FieldLabel
44
44
  v-if="label"
45
45
  :disabled="disabled"
46
- :for-field="uuid"
46
+ :for-field="id"
47
47
  has-margin-bottom
48
48
  :icon="labelIcon"
49
49
  :label="label"
@@ -71,7 +71,7 @@ function onContainerClick() {
71
71
  />
72
72
 
73
73
  <input
74
- :id="uuid"
74
+ :id="id"
75
75
  ref="inputRef"
76
76
  v-model="modelValue"
77
77
  class="cursor-pointer text-sm outline-none [&::-webkit-calendar-picker-indicator]:hidden"
@@ -129,6 +129,7 @@ export interface FieldSelectColumn {
129
129
 
130
130
  export interface FieldSelectOption {
131
131
  icon?: string
132
+ iconColor?: BaseColor
132
133
  text: string
133
134
  value: string
134
135
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
3
  "type": "module",
4
- "version": "0.1.101",
4
+ "version": "0.1.103",
5
5
  "private": false,
6
6
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
7
7
  "license": "MIT",