@particle-network/ui-react 0.4.5-beta.19 → 0.4.5-beta.20

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.
@@ -1,4 +1,5 @@
1
- import React from 'react';
2
- import ExtendedSlider from './slider.extend';
3
- export type UXSliderProps = React.ComponentPropsWithRef<typeof ExtendedSlider>;
4
- export declare const UXSlider: React.ForwardRefExoticComponent<UXSliderProps>;
1
+ import UXSlider from './slider';
2
+ export type { SliderProps as UXSliderProps } from './slider';
3
+ export type { SliderRenderThumbProps, SliderStepMark, SliderValue } from './use-slider';
4
+ export { useSlider } from './use-slider';
5
+ export { UXSlider };
@@ -1,29 +1,3 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import "react";
3
- import { forwardRef } from "@heroui/system";
4
- import slider_extend from "./slider.extend.js";
5
- const UXSlider = forwardRef((props, ref)=>{
6
- const { onChangeEnd, color, ...restProps } = props;
7
- return /*#__PURE__*/ jsx(slider_extend, {
8
- ref: ref,
9
- tooltipProps: {
10
- closeDelay: 100,
11
- classNames: {
12
- content: [
13
- `bg-${color}`,
14
- 'foreground' === color ? 'text-background' : `text-${color}-foreground`
15
- ]
16
- }
17
- },
18
- color: color,
19
- onChangeEnd: (value)=>{
20
- onChangeEnd?.(value);
21
- setTimeout(()=>{
22
- if (document.activeElement) document.activeElement.blur();
23
- }, 200);
24
- },
25
- ...restProps
26
- });
27
- });
28
- UXSlider.displayName = 'UX.Slider';
29
- export { UXSlider };
1
+ import slider from "./slider.js";
2
+ import { useSlider } from "./use-slider.js";
3
+ export { slider as UXSlider, useSlider };
@@ -0,0 +1,518 @@
1
+ import type { VariantProps } from 'tailwind-variants';
2
+ /**
3
+ * Slider wrapper **Tailwind Variants** component
4
+ *
5
+ * @example
6
+ *
7
+ * const slots = slider()
8
+ *
9
+ * <div className={slots.base()}>
10
+ * <div className={slots.labelWrapper()}>
11
+ * <label className={slots.label()}>Label</label>
12
+ * <output className={slots.value()} />
13
+ * </div>
14
+ * <div className={slots.trackWrapper()}>
15
+ * <div className={slots.startContent()}>Start Content</div>
16
+ * <div className={slots.track()}>
17
+ * <div className={slots.filler()} />
18
+ * <div className={slots.step()} />
19
+ * <div className={slots.thumb()} />
20
+ * <div className={slots.mark()}>Mark</div>
21
+ * </div>
22
+ * <div className={slots.endContent()}>End Content</div>
23
+ * </div>
24
+ * </div>
25
+ */
26
+ declare const slider: import("tailwind-variants").TVReturnType<{
27
+ size: {
28
+ sm: {
29
+ label: string;
30
+ value: string;
31
+ thumb: string;
32
+ step: string;
33
+ mark: string;
34
+ };
35
+ md: {
36
+ thumb: string;
37
+ label: string;
38
+ value: string;
39
+ };
40
+ lg: {
41
+ thumb: string;
42
+ step: string;
43
+ label: string;
44
+ value: string;
45
+ mark: string;
46
+ };
47
+ };
48
+ radius: {
49
+ none: {
50
+ thumb: string;
51
+ };
52
+ sm: {
53
+ thumb: string;
54
+ };
55
+ md: {
56
+ thumb: string;
57
+ };
58
+ lg: {
59
+ thumb: string;
60
+ };
61
+ full: {
62
+ thumb: string;
63
+ };
64
+ };
65
+ color: {
66
+ foreground: {
67
+ filler: string;
68
+ thumb: string;
69
+ };
70
+ primary: {
71
+ filler: string;
72
+ thumb: string;
73
+ };
74
+ secondary: {
75
+ filler: string;
76
+ thumb: string;
77
+ };
78
+ success: {
79
+ filler: string;
80
+ thumb: string;
81
+ };
82
+ warning: {
83
+ filler: string;
84
+ thumb: string;
85
+ };
86
+ danger: {
87
+ filler: string;
88
+ thumb: string;
89
+ };
90
+ alert: {
91
+ filler: string;
92
+ thumb: string;
93
+ };
94
+ bullish: {
95
+ filler: string;
96
+ thumb: string;
97
+ };
98
+ bearish: {
99
+ filler: string;
100
+ thumb: string;
101
+ };
102
+ };
103
+ isVertical: {
104
+ true: {
105
+ base: string;
106
+ trackWrapper: string;
107
+ filler: string;
108
+ thumb: string;
109
+ track: string;
110
+ labelWrapper: string;
111
+ step: string[];
112
+ mark: string[];
113
+ };
114
+ false: {
115
+ thumb: string;
116
+ trackWrapper: string;
117
+ track: string;
118
+ step: string[];
119
+ mark: string[];
120
+ };
121
+ };
122
+ isDisabled: {
123
+ false: {
124
+ thumb: string[];
125
+ };
126
+ true: {
127
+ base: string;
128
+ thumb: string;
129
+ };
130
+ };
131
+ hasMarks: {
132
+ true: {
133
+ base: string;
134
+ mark: string;
135
+ };
136
+ false: {};
137
+ };
138
+ showOutline: {
139
+ true: {
140
+ thumb: string;
141
+ };
142
+ false: {
143
+ thumb: string;
144
+ };
145
+ };
146
+ hideValue: {
147
+ true: {
148
+ value: string;
149
+ };
150
+ };
151
+ hideThumb: {
152
+ true: {
153
+ thumb: string;
154
+ track: string;
155
+ };
156
+ };
157
+ hasSingleThumb: {
158
+ true: {};
159
+ false: {};
160
+ };
161
+ disableAnimation: {
162
+ true: {
163
+ thumb: string;
164
+ };
165
+ false: {
166
+ thumb: string;
167
+ mark: string;
168
+ };
169
+ };
170
+ disableThumbScale: {
171
+ true: {};
172
+ false: {
173
+ thumb: string;
174
+ };
175
+ };
176
+ }, {
177
+ base: string;
178
+ labelWrapper: string;
179
+ label: string;
180
+ value: string;
181
+ step: string[];
182
+ mark: string[];
183
+ trackWrapper: string;
184
+ track: string[];
185
+ filler: string;
186
+ thumb: (string | string[])[];
187
+ startContent: never[];
188
+ endContent: never[];
189
+ }, undefined, {
190
+ size: {
191
+ sm: {
192
+ label: string;
193
+ value: string;
194
+ thumb: string;
195
+ step: string;
196
+ mark: string;
197
+ };
198
+ md: {
199
+ thumb: string;
200
+ label: string;
201
+ value: string;
202
+ };
203
+ lg: {
204
+ thumb: string;
205
+ step: string;
206
+ label: string;
207
+ value: string;
208
+ mark: string;
209
+ };
210
+ };
211
+ radius: {
212
+ none: {
213
+ thumb: string;
214
+ };
215
+ sm: {
216
+ thumb: string;
217
+ };
218
+ md: {
219
+ thumb: string;
220
+ };
221
+ lg: {
222
+ thumb: string;
223
+ };
224
+ full: {
225
+ thumb: string;
226
+ };
227
+ };
228
+ color: {
229
+ foreground: {
230
+ filler: string;
231
+ thumb: string;
232
+ };
233
+ primary: {
234
+ filler: string;
235
+ thumb: string;
236
+ };
237
+ secondary: {
238
+ filler: string;
239
+ thumb: string;
240
+ };
241
+ success: {
242
+ filler: string;
243
+ thumb: string;
244
+ };
245
+ warning: {
246
+ filler: string;
247
+ thumb: string;
248
+ };
249
+ danger: {
250
+ filler: string;
251
+ thumb: string;
252
+ };
253
+ alert: {
254
+ filler: string;
255
+ thumb: string;
256
+ };
257
+ bullish: {
258
+ filler: string;
259
+ thumb: string;
260
+ };
261
+ bearish: {
262
+ filler: string;
263
+ thumb: string;
264
+ };
265
+ };
266
+ isVertical: {
267
+ true: {
268
+ base: string;
269
+ trackWrapper: string;
270
+ filler: string;
271
+ thumb: string;
272
+ track: string;
273
+ labelWrapper: string;
274
+ step: string[];
275
+ mark: string[];
276
+ };
277
+ false: {
278
+ thumb: string;
279
+ trackWrapper: string;
280
+ track: string;
281
+ step: string[];
282
+ mark: string[];
283
+ };
284
+ };
285
+ isDisabled: {
286
+ false: {
287
+ thumb: string[];
288
+ };
289
+ true: {
290
+ base: string;
291
+ thumb: string;
292
+ };
293
+ };
294
+ hasMarks: {
295
+ true: {
296
+ base: string;
297
+ mark: string;
298
+ };
299
+ false: {};
300
+ };
301
+ showOutline: {
302
+ true: {
303
+ thumb: string;
304
+ };
305
+ false: {
306
+ thumb: string;
307
+ };
308
+ };
309
+ hideValue: {
310
+ true: {
311
+ value: string;
312
+ };
313
+ };
314
+ hideThumb: {
315
+ true: {
316
+ thumb: string;
317
+ track: string;
318
+ };
319
+ };
320
+ hasSingleThumb: {
321
+ true: {};
322
+ false: {};
323
+ };
324
+ disableAnimation: {
325
+ true: {
326
+ thumb: string;
327
+ };
328
+ false: {
329
+ thumb: string;
330
+ mark: string;
331
+ };
332
+ };
333
+ disableThumbScale: {
334
+ true: {};
335
+ false: {
336
+ thumb: string;
337
+ };
338
+ };
339
+ }, {
340
+ base: string;
341
+ labelWrapper: string;
342
+ label: string;
343
+ value: string;
344
+ step: string[];
345
+ mark: string[];
346
+ trackWrapper: string;
347
+ track: string[];
348
+ filler: string;
349
+ thumb: (string | string[])[];
350
+ startContent: never[];
351
+ endContent: never[];
352
+ }, import("tailwind-variants").TVReturnType<{
353
+ size: {
354
+ sm: {
355
+ label: string;
356
+ value: string;
357
+ thumb: string;
358
+ step: string;
359
+ mark: string;
360
+ };
361
+ md: {
362
+ thumb: string;
363
+ label: string;
364
+ value: string;
365
+ };
366
+ lg: {
367
+ thumb: string;
368
+ step: string;
369
+ label: string;
370
+ value: string;
371
+ mark: string;
372
+ };
373
+ };
374
+ radius: {
375
+ none: {
376
+ thumb: string;
377
+ };
378
+ sm: {
379
+ thumb: string;
380
+ };
381
+ md: {
382
+ thumb: string;
383
+ };
384
+ lg: {
385
+ thumb: string;
386
+ };
387
+ full: {
388
+ thumb: string;
389
+ };
390
+ };
391
+ color: {
392
+ foreground: {
393
+ filler: string;
394
+ thumb: string;
395
+ };
396
+ primary: {
397
+ filler: string;
398
+ thumb: string;
399
+ };
400
+ secondary: {
401
+ filler: string;
402
+ thumb: string;
403
+ };
404
+ success: {
405
+ filler: string;
406
+ thumb: string;
407
+ };
408
+ warning: {
409
+ filler: string;
410
+ thumb: string;
411
+ };
412
+ danger: {
413
+ filler: string;
414
+ thumb: string;
415
+ };
416
+ alert: {
417
+ filler: string;
418
+ thumb: string;
419
+ };
420
+ bullish: {
421
+ filler: string;
422
+ thumb: string;
423
+ };
424
+ bearish: {
425
+ filler: string;
426
+ thumb: string;
427
+ };
428
+ };
429
+ isVertical: {
430
+ true: {
431
+ base: string;
432
+ trackWrapper: string;
433
+ filler: string;
434
+ thumb: string;
435
+ track: string;
436
+ labelWrapper: string;
437
+ step: string[];
438
+ mark: string[];
439
+ };
440
+ false: {
441
+ thumb: string;
442
+ trackWrapper: string;
443
+ track: string;
444
+ step: string[];
445
+ mark: string[];
446
+ };
447
+ };
448
+ isDisabled: {
449
+ false: {
450
+ thumb: string[];
451
+ };
452
+ true: {
453
+ base: string;
454
+ thumb: string;
455
+ };
456
+ };
457
+ hasMarks: {
458
+ true: {
459
+ base: string;
460
+ mark: string;
461
+ };
462
+ false: {};
463
+ };
464
+ showOutline: {
465
+ true: {
466
+ thumb: string;
467
+ };
468
+ false: {
469
+ thumb: string;
470
+ };
471
+ };
472
+ hideValue: {
473
+ true: {
474
+ value: string;
475
+ };
476
+ };
477
+ hideThumb: {
478
+ true: {
479
+ thumb: string;
480
+ track: string;
481
+ };
482
+ };
483
+ hasSingleThumb: {
484
+ true: {};
485
+ false: {};
486
+ };
487
+ disableAnimation: {
488
+ true: {
489
+ thumb: string;
490
+ };
491
+ false: {
492
+ thumb: string;
493
+ mark: string;
494
+ };
495
+ };
496
+ disableThumbScale: {
497
+ true: {};
498
+ false: {
499
+ thumb: string;
500
+ };
501
+ };
502
+ }, {
503
+ base: string;
504
+ labelWrapper: string;
505
+ label: string;
506
+ value: string;
507
+ step: string[];
508
+ mark: string[];
509
+ trackWrapper: string;
510
+ track: string[];
511
+ filler: string;
512
+ thumb: (string | string[])[];
513
+ startContent: never[];
514
+ endContent: never[];
515
+ }, undefined, unknown, unknown, undefined>>;
516
+ export type SliderVariantProps = VariantProps<typeof slider>;
517
+ export type SliderSlots = keyof ReturnType<typeof slider>;
518
+ export { slider };
@@ -1,28 +1,71 @@
1
- const sliderClasses = {
1
+ import { tv } from "@heroui/theme";
2
+ import { dataFocusVisibleClasses } from "../../utils/index.js";
3
+ const slider = tv({
4
+ slots: {
5
+ base: 'flex flex-col w-full gap-1',
6
+ labelWrapper: 'w-full flex justify-between items-center',
7
+ label: '',
8
+ value: '',
9
+ step: [
10
+ 'h-1.5',
11
+ 'w-1.5',
12
+ 'absolute',
13
+ 'rounded-full',
14
+ 'bg-default-300/50',
15
+ 'data-[in-range=true]:bg-background/50'
16
+ ],
17
+ mark: [
18
+ 'absolute',
19
+ 'text-small',
20
+ 'cursor-default',
21
+ 'opacity-50',
22
+ 'data-[in-range=true]:opacity-100'
23
+ ],
24
+ trackWrapper: 'relative flex gap-2',
25
+ track: [
26
+ 'flex',
27
+ 'w-full',
28
+ 'relative',
29
+ 'rounded-full',
30
+ 'bg-background-200'
31
+ ],
32
+ filler: 'h-full absolute',
33
+ thumb: [
34
+ 'flex',
35
+ 'justify-center',
36
+ 'items-center',
37
+ 'before:absolute',
38
+ 'before:w-11',
39
+ 'before:h-11',
40
+ 'before:rounded-full',
41
+ 'after:bg-background',
42
+ 'data-[focused=true]:z-10',
43
+ 'shadow-none',
44
+ dataFocusVisibleClasses
45
+ ],
46
+ startContent: [],
47
+ endContent: []
48
+ },
2
49
  variants: {
3
50
  size: {
4
51
  sm: {
5
- label: '!text-xxs',
6
- value: '!text-xxs',
52
+ label: 'text-small',
53
+ value: 'text-small',
7
54
  thumb: 'w-4 h-4 after:w-3 after:h-3',
8
55
  step: 'data-[in-range=false]:bg-default-200',
9
- mark: '!text-xxs mt-1',
10
- track: 'bg-background-200'
56
+ mark: 'text-[10px]'
11
57
  },
12
58
  md: {
13
- thumb: 'w-4 h-4 after:w-3 after:h-3',
14
- label: 'text-xs',
15
- value: 'text-xs',
16
- mark: 'text-xs mt-1',
17
- track: 'bg-background-200'
59
+ thumb: 'w-6 h-6 after:w-5 after:h-5',
60
+ label: 'text-small',
61
+ value: 'text-small'
18
62
  },
19
63
  lg: {
20
64
  thumb: 'h-7 w-7 after:w-5 after:h-5',
21
65
  step: 'w-2 h-2',
22
- label: 'text-sm',
23
- value: 'text-sm',
24
- mark: 'text-sm mt-2',
25
- track: 'bg-background-200'
66
+ label: 'text-medium',
67
+ value: 'text-medium',
68
+ mark: 'mt-2'
26
69
  }
27
70
  },
28
71
  radius: {
@@ -30,13 +73,13 @@ const sliderClasses = {
30
73
  thumb: 'rounded-none after:rounded-none'
31
74
  },
32
75
  sm: {
33
- thumb: 'rounded-[calc(theme(borderRadius.small)/2)] after:rounded-[calc(theme(borderRadius.small)/3)]'
76
+ thumb: 'rounded-[calc(var(--heroui-radius-small)/2)] after:rounded-[calc(var(--heroui-radius-small)/3)]'
34
77
  },
35
78
  md: {
36
- thumb: 'rounded-[calc(theme(borderRadius.medium)/2)] after:rounded-[calc(theme(borderRadius.medium)/3)]'
79
+ thumb: 'rounded-[calc(var(--heroui-radius-medium)/2)] after:rounded-[calc(var(--heroui-radius-medium)/3)]'
37
80
  },
38
81
  lg: {
39
- thumb: 'rounded-[calc(theme(borderRadius.large)/1.5)] after:rounded-[calc(theme(borderRadius.large)/2)]'
82
+ thumb: 'rounded-[calc(var(--heroui-radius-large)/1.5)] after:rounded-[calc(var(--heroui-radius-large)/2)]'
40
83
  },
41
84
  full: {
42
85
  thumb: 'rounded-full after:rounded-full'
@@ -176,17 +219,6 @@ const sliderClasses = {
176
219
  }
177
220
  },
178
221
  compoundVariants: [
179
- {
180
- size: [
181
- 'sm',
182
- 'md',
183
- 'lg'
184
- ],
185
- showOutline: false,
186
- class: {
187
- thumb: 'shadow-none'
188
- }
189
- },
190
222
  {
191
223
  size: 'sm',
192
224
  color: 'foreground',
@@ -429,5 +461,5 @@ const sliderClasses = {
429
461
  disableThumbScale: false,
430
462
  showOutline: false
431
463
  }
432
- };
433
- export { sliderClasses };
464
+ });
465
+ export { slider };
@@ -0,0 +1,4 @@
1
+ import type { UseSliderThumbProps } from './use-slider-thumb';
2
+ export type SliderThumbProps = UseSliderThumbProps;
3
+ declare const SliderThumb: import("@heroui/system-rsc").InternalForwardRefRenderFunction<"div", UseSliderThumbProps, never>;
4
+ export default SliderThumb;