aural-ui 2.1.20 → 2.1.22

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.
@@ -16,8 +16,8 @@ export const buttonVariants = cva(
16
16
  "before:absolute before:inset-0 rounded-full before:border-[length:var(--stroke-fm-xsm)] before:border-transparent bg-fm-surface-secondary text-fm-primary",
17
17
  outline: "text-fm-primary",
18
18
  text: "bg-transparent text-fm-secondary-800",
19
- chip: "text-fm-neutral-800 font-fm-text",
20
- chipActive: "text-fm-neutral-1100 font-fm-text",
19
+ chip: "text-fm-secondary font-fm-text",
20
+ chipActive: "font-fm-text text-fm-neutral-1100",
21
21
  default: "",
22
22
  },
23
23
  noise: {
@@ -50,9 +50,9 @@ export const innerButtonVariants = cva(
50
50
  outline:
51
51
  "border-[length:var(--stroke-fm-sm)] border-fm-divider-contrast !translate-y-0",
52
52
  text: "",
53
- chip: "border border-fm-neutral-300 rounded-md relative overflow-hidden before:absolute before:inset-0 before:rounded-md before:[background-image:var(--button-fm-chip-hover)] before:bg-cover before:bg-no-repeat before:opacity-0 before:transition-opacity before:duration-300 before:-z-10 group-hover:before:opacity-100 after:absolute after:inset-0 after:rounded-md after:bg-cover after:bg-no-repeat after:transition-opacity after:duration-300 after:-z-10 group-hover:after:opacity-0 !translate-y-0",
53
+ chip: "border border-fm-neutral-300 rounded-md relative overflow-hidden before:absolute before:inset-0 before:rounded-md before:[background-image:var(--button-fm-chip-hover)] before:bg-[size:100%_100%] before:bg-center before:bg-no-repeat before:opacity-0 before:transition-opacity before:duration-300 before:-z-10 group-hover:before:opacity-100 !translate-y-0",
54
54
  chipActive:
55
- "group-active:translate-y-0 chip-active-bg border-none rounded-md bg-contain bg-center bg-no-repeat duration-300",
55
+ "group-active:translate-y-0 chip-active-bg border-none rounded-md bg-[size:100%_100%] bg-center bg-no-repeat duration-300 !translate-y-0",
56
56
  },
57
57
  noise: {
58
58
  none: "",
@@ -71,7 +71,7 @@ export const innerButtonVariants = cva(
71
71
  text: "bg-fm-divider-tertiary [color:var(--color-fm-inactive)] border-[length:var(--stroke-fm-sm)] border-fm-divider-tertiary",
72
72
  chip: "bg-fm-surface-secondary border border-fm-neutral-300 rounded-md !translate-y-0 [color:var(--color-fm-inactive)] font-fm-text",
73
73
  chipActive:
74
- "chip-active-bg border-none rounded-md bg-contain bg-center bg-no-repeat opacity-90 [color:var(--color-fm-inactive)] font-fm-text",
74
+ "chip-active-bg border-none rounded-md bg-[size:100%_100%] bg-center bg-no-repeat opacity-90 [color:var(--color-fm-inactive)] font-fm-text",
75
75
  },
76
76
  size: {
77
77
  sm: "py-fm-lg px-fm-2xl text-fm-sm -translate-y-1",
@@ -113,21 +113,6 @@ export const innerButtonVariants = cva(
113
113
  noise: "strong",
114
114
  className: "[background-image:var(--button-fm-noise-strong)]",
115
115
  },
116
- {
117
- variant: "chip",
118
- noise: "low",
119
- className: "after:[background-image:var(--button-fm-noise-low)]",
120
- },
121
- {
122
- variant: "chip",
123
- noise: "medium",
124
- className: "after:[background-image:var(--button-fm-noise)]",
125
- },
126
- {
127
- variant: "chip",
128
- noise: "strong",
129
- className: "after:[background-image:var(--button-fm-noise-strong)]",
130
- },
131
116
  {
132
117
  variant: "chipActive",
133
118
  noise: "low",
@@ -126,7 +126,7 @@ const DrawerContent = React.forwardRef<
126
126
  "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg",
127
127
  "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg",
128
128
  "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-lg data-[vaul-drawer-direction=right]:sm:max-w-sm",
129
- "overflow-auto [scrollbar-width:none] data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-lg data-[vaul-drawer-direction=left]:sm:max-w-sm",
129
+ "overflow-hidden data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-lg data-[vaul-drawer-direction=left]:sm:max-w-sm",
130
130
  className,
131
131
  classes?.content
132
132
  )}
@@ -135,7 +135,9 @@ const DrawerContent = React.forwardRef<
135
135
  {showSwipeButton && (
136
136
  <div className="bg-fm-surface-primary mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
137
137
  )}
138
- {children}
138
+ <div className="scrollbar-hide flex min-h-0 flex-1 flex-col overflow-auto">
139
+ {children}
140
+ </div>
139
141
  </DrawerPrimitive.Content>
140
142
  </DrawerPortal>
141
143
  )
@@ -44,6 +44,14 @@ const meta: Meta<typeof Switch> = {
44
44
  control: { type: "text" },
45
45
  description: "Custom icon to display when switch is OFF",
46
46
  },
47
+ switchOnText: {
48
+ control: { type: "text" },
49
+ description: "Custom text to display when switch is ON",
50
+ },
51
+ switchOffText: {
52
+ control: { type: "text" },
53
+ description: "Custom text to display when switch is OFF",
54
+ },
47
55
  classNames: {
48
56
  control: { type: "object" },
49
57
  description: "Custom classNames for different parts of the switch",
@@ -158,6 +166,83 @@ export const CheckedWithIcons: Story = {
158
166
  },
159
167
  }
160
168
 
169
+ export const WithCustomText: Story = {
170
+ args: {
171
+ checked: false,
172
+ switchOnText: "YES",
173
+ switchOffText: "NO",
174
+ },
175
+ }
176
+
177
+ export const CheckedWithCustomText: Story = {
178
+ args: {
179
+ checked: true,
180
+ switchOnText: "YES",
181
+ switchOffText: "NO",
182
+ },
183
+ }
184
+
185
+ export const WithCustomTextVariants: Story = {
186
+ render: () => (
187
+ <div className="flex flex-col items-center space-y-4">
188
+ <div className="flex items-center space-x-4">
189
+ <Switch checked={false} switchOnText="ON" switchOffText="OFF" />
190
+ <span className="text-sm text-gray-400">Default (ON/OFF)</span>
191
+ </div>
192
+ <div className="flex items-center space-x-4">
193
+ <Switch checked={false} switchOnText="YES" switchOffText="NO" />
194
+ <span className="text-sm text-gray-400">Yes/No</span>
195
+ </div>
196
+ <div className="flex items-center space-x-4">
197
+ <Switch checked={false} switchOnText="1" switchOffText="0" />
198
+ <span className="text-sm text-gray-400">Binary (1/0)</span>
199
+ </div>
200
+ <div className="flex items-center space-x-4">
201
+ <Switch checked={false} switchOnText="✓" switchOffText="✗" />
202
+ <span className="text-sm text-gray-400">Symbols (✓/✗)</span>
203
+ </div>
204
+ <div className="flex items-center space-x-4">
205
+ <Switch checked={false} switchOnText="EN" switchOffText="DIS" />
206
+ <span className="text-sm text-gray-400">Enable/Disable</span>
207
+ </div>
208
+ </div>
209
+ ),
210
+ }
211
+
212
+ export const CustomTextWithSizes: Story = {
213
+ render: () => (
214
+ <div className="flex flex-col items-center space-y-4">
215
+ <div className="flex items-center space-x-4">
216
+ <Switch
217
+ size="sm"
218
+ checked={true}
219
+ switchOnText="ON"
220
+ switchOffText="OFF"
221
+ />
222
+ <span className="text-sm text-gray-400">Small</span>
223
+ </div>
224
+ <div className="flex items-center space-x-4">
225
+ <Switch
226
+ size="md"
227
+ checked={true}
228
+ switchOnText="ON"
229
+ switchOffText="OFF"
230
+ />
231
+ <span className="text-sm text-gray-400">Medium</span>
232
+ </div>
233
+ <div className="flex items-center space-x-4">
234
+ <Switch
235
+ size="lg"
236
+ checked={true}
237
+ switchOnText="ON"
238
+ switchOffText="OFF"
239
+ />
240
+ <span className="text-sm text-gray-400">Large</span>
241
+ </div>
242
+ </div>
243
+ ),
244
+ }
245
+
161
246
  export const AllVariants: Story = {
162
247
  render: () => (
163
248
  <div className="grid grid-cols-2 gap-6">
@@ -19,6 +19,8 @@ type SwitchWithIconsProps = React.ComponentPropsWithoutRef<
19
19
  onIcon?: React.ReactNode
20
20
  size?: SwitchSize
21
21
  classNames?: SwitchClassNames
22
+ switchOnText?: string
23
+ switchOffText?: string
22
24
  }
23
25
 
24
26
  const switchVariants = {
@@ -60,6 +62,8 @@ const Switch = React.forwardRef<
60
62
  disabled,
61
63
  size = "md",
62
64
  classNames,
65
+ switchOnText,
66
+ switchOffText,
63
67
  ...props
64
68
  },
65
69
  ref
@@ -98,7 +102,7 @@ const Switch = React.forwardRef<
98
102
  data-state={checked ? "checked" : "unchecked"}
99
103
  data-disabled={disabled || undefined}
100
104
  >
101
- {onIcon ?? "ON"}
105
+ {onIcon ?? switchOnText ?? "ON"}
102
106
  </span>
103
107
 
104
108
  <span
@@ -110,7 +114,7 @@ const Switch = React.forwardRef<
110
114
  data-state={checked ? "checked" : "unchecked"}
111
115
  data-disabled={disabled || undefined}
112
116
  >
113
- {offIcon ?? "OFF"}
117
+ {offIcon ?? switchOffText ?? "OFF"}
114
118
  </span>
115
119
 
116
120
  <SwitchPrimitives.Thumb
@@ -5,6 +5,7 @@ import React, {
5
5
  RefAttributes,
6
6
  useCallback,
7
7
  useEffect,
8
+ useId,
8
9
  useRef,
9
10
  useState,
10
11
  } from "react"
@@ -30,7 +31,7 @@ interface TextAreaBaseProps {
30
31
  onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void
31
32
  onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void
32
33
  onFocus?: (e: React.FocusEvent<HTMLTextAreaElement>) => void
33
- onInput?: (e: React.FocusEvent<HTMLTextAreaElement>) => void
34
+ onInput?: (e: React.InputEvent<HTMLTextAreaElement>) => void
34
35
  onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void
35
36
  id?: string
36
37
  name?: string
@@ -361,8 +362,8 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
361
362
  const [textareaValue, setTextareaValue] = useState(value || "")
362
363
 
363
364
  // Generate unique IDs for accessibility
364
- const textareaId =
365
- id || `textarea-${Math.random().toString(36).substr(2, 9)}`
365
+ const reactId = useId()
366
+ const textareaId = id || `textarea-${reactId}`
366
367
  const helperTextId = helperText ? `${textareaId}-helper` : undefined
367
368
  const charCountId = showCharCount ? `${textareaId}-char-count` : undefined
368
369
 
@@ -410,7 +411,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
410
411
  currentLength={currentLength}
411
412
  maxLength={maxLength}
412
413
  id={charCountId}
413
- className={cn("ml-auto", classes?.charCount)}
414
+ className="ml-auto"
414
415
  />
415
416
  )}
416
417
  </div>