@saasmakers/ui 2.0.18 → 2.0.19

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.
@@ -18,6 +18,23 @@ withDefaults(defineProps<Omit<FieldCheckbox, 'modelValue'>>(), {
18
18
 
19
19
  const id = useId()
20
20
  const modelValue = defineModel<FieldCheckbox['modelValue']>({ default: false })
21
+ const isAnimatingCheck = ref(false)
22
+
23
+ watch(modelValue, (value) => {
24
+ if (!value) {
25
+ isAnimatingCheck.value = false
26
+ }
27
+ })
28
+
29
+ function onChange(event: Event) {
30
+ isAnimatingCheck.value = (event.target as HTMLInputElement).checked
31
+ }
32
+
33
+ function onCheckAnimationEnd(event: AnimationEvent) {
34
+ if (event.animationName.startsWith('pop-in')) {
35
+ isAnimatingCheck.value = false
36
+ }
37
+ }
21
38
  </script>
22
39
 
23
40
  <template>
@@ -42,27 +59,31 @@ const modelValue = defineModel<FieldCheckbox['modelValue']>({ default: false })
42
59
  :class="{ 'field-disabled': disabled }"
43
60
  :disabled="disabled"
44
61
  type="checkbox"
62
+ @change="onChange"
45
63
  >
46
64
 
47
65
  <span
48
66
  aria-hidden="true"
49
- class="flex items-center justify-center border-2 rounded-full transition-colors"
67
+ class="flex items-center justify-center border-2 rounded-full transition-[background-color,border-color] duration-200 ease-out"
50
68
  :class="{
51
- 'border-indigo-600 dark:border-indigo-400': modelValue,
69
+ 'animate-pop-in motion-reduce:animate-none': isAnimatingCheck,
70
+ 'border-transparent bg-indigo-600 dark:bg-indigo-400': modelValue,
52
71
  'border-gray-300 dark:border-gray-600': !modelValue,
53
72
  'group-hover:border-gray-400 dark:group-hover:border-gray-500': !disabled && !modelValue,
54
- 'group-hover:border-indigo-700 dark:group-hover:border-indigo-300': !disabled && modelValue,
73
+ 'group-hover:bg-indigo-700 dark:group-hover:bg-indigo-300': !disabled && modelValue,
55
74
  'h-4 w-4': size === 'sm',
56
75
  'h-4.5 w-4.5': size === 'base',
57
76
  'h-5 w-5': size === 'lg',
58
77
  'peer-focus-visible:ring-2 peer-focus-visible:ring-indigo-500/40 peer-focus-visible:ring-offset-2 peer-focus-visible:outline-none': !disabled,
59
78
  }"
79
+ @animationend="onCheckAnimationEnd"
60
80
  >
61
81
  <Icon
62
82
  v-if="modelValue"
63
83
  :name="getLayerIcon('check')"
64
- class="shrink-0 text-gray-900 dark:text-white"
84
+ class="shrink-0 text-white"
65
85
  :class="{
86
+ 'animate-fade-in': isAnimatingCheck,
66
87
  'size-2.5': size === 'sm',
67
88
  'size-3': size === 'base',
68
89
  'size-3.5': size === 'lg',
@@ -74,6 +95,7 @@ const modelValue = defineModel<FieldCheckbox['modelValue']>({ default: false })
74
95
  <BaseSpinner
75
96
  v-else
76
97
  class="flex-initial"
98
+ color="indigo"
77
99
  :size="size"
78
100
  />
79
101
 
@@ -63,6 +63,12 @@ function onHeaderPointerDown(event: PointerEvent) {
63
63
  handle.setPointerCapture(event.pointerId)
64
64
  }
65
65
 
66
+ function onPanelAfterEnter(element: Element) {
67
+ // Drop the identity transform after the open animation so nested SortableJS
68
+ // fallbacks on iOS resolve viewport coordinates instead of a transformed ancestor.
69
+ element.classList.remove('translate-y-0')
70
+ }
71
+
66
72
  function onPanelTransitionEnd(event: TransitionEvent) {
67
73
  if (event.propertyName !== 'transform' || !drag.closing) {
68
74
  return
@@ -209,6 +215,7 @@ watch(visible, (isVisible) => {
209
215
  leave-active-class="transition-transform duration-300 ease motion-reduce:transition-none motion-reduce:duration-0"
210
216
  leave-from-class="translate-y-0"
211
217
  leave-to-class="translate-y-full motion-reduce:translate-y-0"
218
+ @after-enter="onPanelAfterEnter"
212
219
  @after-leave="onAfterLeave"
213
220
  >
214
221
  <div
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",
package/uno.config.ts CHANGED
@@ -33,22 +33,30 @@ export const shortcuts: Record<string, string> = {
33
33
  export const theme = {
34
34
  animation: {
35
35
  keyframes: {
36
+ 'fade-in': '{0%,25%{opacity:0}100%{opacity:1}}',
36
37
  'fade-pulse': '{0%,100%{opacity:0.25}50%{opacity:1}}',
38
+ 'pop-in': '{from{transform:scale(0.8)}to{transform:scale(1)}}',
37
39
  'scale-pulse': '{0%,100%{transform:scale(0)}50%{transform:scale(1)}}',
38
40
  },
39
41
 
40
42
  durations: {
43
+ 'fade-in': '200ms',
41
44
  'fade-pulse': '1s',
45
+ 'pop-in': '250ms',
42
46
  'scale-pulse': '2s',
43
47
  },
44
48
 
45
49
  timingFns: {
50
+ 'fade-in': 'ease-out',
46
51
  'fade-pulse': 'ease-in-out',
52
+ 'pop-in': 'cubic-bezier(0.34,1.56,0.64,1)',
47
53
  'scale-pulse': 'linear',
48
54
  },
49
55
 
50
56
  counts: {
57
+ 'fade-in': '1',
51
58
  'fade-pulse': 'infinite',
59
+ 'pop-in': '1',
52
60
  'scale-pulse': 'infinite',
53
61
  },
54
62
  },