@saasmakers/ui 0.1.96 → 0.1.98

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.
@@ -35,7 +35,7 @@ const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
35
35
  v-model="modelValue"
36
36
  class="cursor-pointer border border-gray-300 rounded-lg accent-indigo-700 transition-shadow flex-initial dark:border-gray-700 focus:border-gray-500 hover:border-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-indigo-500/40 dark:focus:border-gray-500 dark:hover:border-gray-600"
37
37
  :class="{
38
- 'disabled:opacity-50 disabled:cursor-not-allowed': disabled,
38
+ 'field-disabled': disabled,
39
39
  'h-3.5 w-3.5': size === 'xs',
40
40
  'h-4 w-4': size === 'sm',
41
41
  'h-4.5 w-4.5': size === 'base',
@@ -68,6 +68,7 @@ const uuid = ref(`${Math.floor((1 + Math.random()) * 0x100000)}`)
68
68
 
69
69
  <FieldMessage
70
70
  :description="description"
71
+ :disabled="disabled"
71
72
  :hide-error="hideError"
72
73
  :size="size"
73
74
  :validation="validation"
@@ -1,6 +1,8 @@
1
1
  <script lang="ts" setup>
2
2
  import type { FieldDays } from '../../types/fields'
3
3
 
4
+ withDefaults(defineProps<Omit<FieldDays, 'modelValue'>>(), { disabled: false })
5
+
4
6
  const emit = defineEmits<{
5
7
  change: [event: MouseEvent, value: number[]]
6
8
  }>()
@@ -54,7 +56,10 @@ function onUpdateDays(event: MouseEvent, day: number) {
54
56
  </script>
55
57
 
56
58
  <template>
57
- <div class="flex items-center">
59
+ <div
60
+ class="flex items-center"
61
+ :class="{ 'field-disabled': disabled }"
62
+ >
58
63
  <BaseText
59
64
  v-for="day in daysToDisplay"
60
65
  :key="day.value"
@@ -3,6 +3,8 @@ import type { FieldEmojis } from '../../types/fields'
3
3
  import { emojis } from '@saasmakers/shared'
4
4
  import { refDebounced } from '@vueuse/core'
5
5
 
6
+ withDefaults(defineProps<Omit<FieldEmojis, 'modelValue'>>(), { disabled: false })
7
+
6
8
  const emit = defineEmits<{
7
9
  click: [event: MouseEvent, emoji: string]
8
10
  }>()
@@ -47,7 +49,10 @@ function onEmojiClick(event: MouseEvent, emoji?: string) {
47
49
  </script>
48
50
 
49
51
  <template>
50
- <div class="border border-gray-200 rounded-lg p-4 shadow-sm dark:border-gray-800">
52
+ <div
53
+ class="border border-gray-200 rounded-lg p-4 shadow-sm dark:border-gray-800"
54
+ :class="{ 'field-disabled': disabled }"
55
+ >
51
56
  <FieldInput
52
57
  v-model="searchRaw"
53
58
  autofocus
@@ -153,6 +153,7 @@ defineExpose({ focus })
153
153
  :autocomplete="autocomplete ? 'on' : 'off'"
154
154
  class="h-full w-full flex-1 appearance-none items-center rounded-lg outline-none placeholder-gray-600 dark:placeholder-gray-400 focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100"
155
155
  :class="{
156
+ 'field-disabled': disabled,
156
157
  'text-gray-900 dark:text-gray-100': !lineThrough,
157
158
  'text-gray-500 dark:text-gray-500 line-through': lineThrough,
158
159
  'font-medium tracking-tight uppercase': uppercase,
@@ -170,6 +171,7 @@ defineExpose({ focus })
170
171
  'text-base': size === 'base',
171
172
  'text-lg': size === 'lg',
172
173
  }"
174
+ :disabled="disabled"
173
175
  :max="max"
174
176
  :min="min"
175
177
  :placeholder="placeholder"
@@ -193,6 +195,7 @@ defineExpose({ focus })
193
195
 
194
196
  <FieldMessage
195
197
  :description="description"
198
+ :disabled="disabled"
196
199
  :hide-error="hideError"
197
200
  :size="size"
198
201
  :validation="validation"
@@ -28,8 +28,8 @@ function onClick(event: MouseEvent) {
28
28
  <label
29
29
  class="flex select-none items-center font-semibold tracking-tight"
30
30
  :class="{
31
+ 'field-disabled': disabled,
31
32
  'cursor-pointer': !loading && !disabled,
32
- 'cursor-not-allowed': disabled,
33
33
  'cursor-wait': loading,
34
34
  'text-gray-900 dark:text-gray-100': !lineThrough,
35
35
  'text-gray-500 dark:text-gray-500 line-through': lineThrough,
@@ -3,6 +3,7 @@ import type { FieldMessage } from '../../types/fields'
3
3
 
4
4
  const props = withDefaults(defineProps<FieldMessage>(), {
5
5
  description: '',
6
+ disabled: false,
6
7
  hideError: true,
7
8
  size: 'base',
8
9
  validation: undefined,
@@ -131,7 +132,7 @@ const text = computed<BaseTextText>(() => {
131
132
  <template>
132
133
  <BaseIcon
133
134
  v-if="text"
134
- class="text-left tracking-tighter"
135
+ class="field-disabled text-left tracking-tighter"
135
136
  :class="{
136
137
  'text-red-700 dark:text-red-300': status === 'error',
137
138
  'text-gray-700 dark:text-gray-300': status === 'default',
@@ -149,7 +149,7 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
149
149
  v-on-click-outside="onClose"
150
150
  class="text-left"
151
151
  :class="{
152
- 'cursor-not-allowed': disabled,
152
+ 'field-disabled': disabled,
153
153
  'cursor-pointer': !disabled,
154
154
  }"
155
155
  @mouseenter="onMouseEnter"
@@ -272,6 +272,7 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
272
272
 
273
273
  <FieldMessage
274
274
  :description="description"
275
+ :disabled="disabled"
275
276
  :hide-error="hideError"
276
277
  :size="size"
277
278
  :validation="validation"
@@ -3,6 +3,7 @@ import type { FieldTabs, FieldTabsAction } from '../../types/fields'
3
3
  import { NuxtLinkLocale } from '#components'
4
4
 
5
5
  const _props = withDefaults(defineProps<Omit<FieldTabs, 'modelValue'>>(), {
6
+ disabled: false,
6
7
  minimizeOnMobile: false,
7
8
  size: 'base',
8
9
  tabs: undefined,
@@ -35,6 +36,7 @@ function onTabClick(event: MouseEvent, tabValue: string) {
35
36
  <div
36
37
  class="flex items-center border border-gray-300 shadow-inner dark:border-gray-700"
37
38
  :class="{
39
+ 'field-disabled': disabled,
38
40
  'gap-0 border-b border-gray-300 dark:border-gray-700 bg-gray-100 dark:bg-gray-900': theme === 'border',
39
41
  'gap-2 rounded-lg bg-gray-200 dark:bg-gray-800 p-0.5 sm:p-1': theme === 'rounded',
40
42
  }"
@@ -71,6 +71,7 @@ function onFieldClick(event: MouseEvent) {
71
71
  v-bind="{ 'data-enable-grammarly': 'false' }"
72
72
  class="w-full flex-1 appearance-none rounded-lg text-gray-900 font-medium tracking-tight uppercase outline-none dark:text-gray-100 placeholder-gray-600 dark:placeholder-gray-400 focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100"
73
73
  :class="{
74
+ 'field-disabled': disabled,
74
75
  'p-2.5': padding,
75
76
  'p-0': !padding,
76
77
  'resize-none': !resize,
@@ -83,6 +84,7 @@ function onFieldClick(event: MouseEvent) {
83
84
  'text-base': size === 'base',
84
85
  'text-lg': size === 'lg',
85
86
  }"
87
+ :disabled="disabled"
86
88
  :placeholder="placeholder"
87
89
  :rows="rows"
88
90
  spellcheck="false"
@@ -92,6 +94,7 @@ function onFieldClick(event: MouseEvent) {
92
94
 
93
95
  <FieldMessage
94
96
  :description="description"
97
+ :disabled="disabled"
95
98
  :hide-error="hideError"
96
99
  :size="size"
97
100
  :validation="validation"
@@ -47,6 +47,7 @@ function onFieldBlur(event: FocusEvent) {
47
47
  <div
48
48
  class="flex cursor-pointer items-center gap-2 overflow-hidden border border-gray-200 rounded-lg px-3 font-normal dark:border-gray-800 focus-within:border-gray-400 hover:border-gray-300 dark:focus-within:border-gray-600 dark:hover:border-gray-700"
49
49
  :class="{
50
+ 'field-disabled': disabled,
50
51
  'bg-gray-100 dark:bg-gray-900': background === 'gray',
51
52
  'bg-white dark:bg-gray-900': background === 'white',
52
53
  'text-2xs h-8': size === 'xs',
@@ -68,6 +69,7 @@ function onFieldBlur(event: FocusEvent) {
68
69
  'bg-gray-100 dark:bg-gray-900': background === 'gray',
69
70
  'bg-white dark:bg-gray-900': background === 'white',
70
71
  }"
72
+ :disabled="disabled"
71
73
  type="time"
72
74
  @blur="onFieldBlur"
73
75
  >
@@ -75,6 +77,7 @@ function onFieldBlur(event: FocusEvent) {
75
77
 
76
78
  <FieldMessage
77
79
  :description="description"
80
+ :disabled="disabled"
78
81
  :hide-error="hideError"
79
82
  :size="size"
80
83
  :validation="validation"
@@ -27,10 +27,12 @@ export interface FieldCheckbox {
27
27
  }
28
28
 
29
29
  export interface FieldDays {
30
+ disabled?: boolean
30
31
  modelValue: number[]
31
32
  }
32
33
 
33
34
  export interface FieldEmojis {
35
+ disabled?: boolean
34
36
  modelValue: string
35
37
  }
36
38
 
@@ -93,6 +95,7 @@ export interface FieldLabel {
93
95
 
94
96
  export interface FieldMessage {
95
97
  description?: BaseTextText
98
+ disabled?: boolean
96
99
  hideError?: boolean
97
100
  size?: FieldSize
98
101
  validation?: VuelidateValidation
@@ -137,6 +140,7 @@ export type FieldSelectDirection = 'bottom' | 'top'
137
140
  export type FieldSelectMaxHeight = 'lg' | 'md' | 'sm' | 'xs'
138
141
 
139
142
  export interface FieldTabs {
143
+ disabled?: boolean
140
144
  minimizeOnMobile?: boolean
141
145
  modelValue: string
142
146
  size?: FieldSize
package/nuxt.config.ts CHANGED
@@ -120,6 +120,7 @@ export default defineNuxtConfig({
120
120
  nuxtLayers: true,
121
121
  presets: uno.presets,
122
122
  rules: uno.rules,
123
+ shortcuts: uno.shortcuts,
123
124
  theme: uno.theme,
124
125
  },
125
126
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
3
  "type": "module",
4
- "version": "0.1.96",
4
+ "version": "0.1.98",
5
5
  "private": false,
6
6
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
7
7
  "license": "MIT",
package/uno.config.ts CHANGED
@@ -21,6 +21,8 @@ export const rules: Array<[string, Record<string, string>]> = [
21
21
  ['safe-bottom', { 'padding-bottom': 'env(safe-area-inset-bottom)' }],
22
22
  ]
23
23
 
24
+ export const shortcuts: Record<string, string> = { 'field-disabled': 'opacity-50 cursor-not-allowed' }
25
+
24
26
  export const theme = {
25
27
  /* eslint-disable perfectionist/sort-objects */
26
28
  container: {
@@ -188,5 +190,6 @@ export const theme = {
188
190
  export default defineConfig({
189
191
  presets,
190
192
  rules,
193
+ shortcuts,
191
194
  theme,
192
195
  })