aural-ui 2.1.19 → 2.1.21

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.
@@ -251,7 +251,9 @@ export const AllVariants: Story = {
251
251
  <Button variant="text" noise="none">
252
252
  Text
253
253
  </Button>
254
- <Button variant="chip">Chip Active Button</Button>
254
+ <Button variant="chip" noise="low">
255
+ Chip Active Button
256
+ </Button>
255
257
  <Button variant="chipActive">Chip Active Button</Button>
256
258
  </div>
257
259
  <div className="flex gap-4">
@@ -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 group-hover:[background-image:var(--button-fm-chip-hover)] bg-cover bg-no-repeat !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: "[background-image:var(--button-fm-noise-low)]",
120
- },
121
- {
122
- variant: "chip",
123
- noise: "medium",
124
- className: "[background-image:var(--button-fm-noise)]",
125
- },
126
- {
127
- variant: "chip",
128
- noise: "strong",
129
- className: "[background-image:var(--button-fm-noise-strong)]",
130
- },
131
116
  {
132
117
  variant: "chipActive",
133
118
  noise: "low",
@@ -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