@cdx-ui/components 0.0.1-beta.114 → 0.0.1-beta.116

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.
Files changed (30) hide show
  1. package/README.md +3 -1
  2. package/lib/commonjs/components/Slider/getSliderPopupPosition.js +43 -0
  3. package/lib/commonjs/components/Slider/getSliderPopupPosition.js.map +1 -0
  4. package/lib/commonjs/components/Slider/index.js +363 -0
  5. package/lib/commonjs/components/Slider/index.js.map +1 -0
  6. package/lib/commonjs/components/Slider/styles.js +112 -0
  7. package/lib/commonjs/components/Slider/styles.js.map +1 -0
  8. package/lib/commonjs/components/index.js +12 -0
  9. package/lib/commonjs/components/index.js.map +1 -1
  10. package/lib/module/components/Slider/getSliderPopupPosition.js +38 -0
  11. package/lib/module/components/Slider/getSliderPopupPosition.js.map +1 -0
  12. package/lib/module/components/Slider/index.js +359 -0
  13. package/lib/module/components/Slider/index.js.map +1 -0
  14. package/lib/module/components/Slider/styles.js +108 -0
  15. package/lib/module/components/Slider/styles.js.map +1 -0
  16. package/lib/module/components/index.js +1 -0
  17. package/lib/module/components/index.js.map +1 -1
  18. package/lib/typescript/components/Slider/getSliderPopupPosition.d.ts +10 -0
  19. package/lib/typescript/components/Slider/getSliderPopupPosition.d.ts.map +1 -0
  20. package/lib/typescript/components/Slider/index.d.ts +61 -0
  21. package/lib/typescript/components/Slider/index.d.ts.map +1 -0
  22. package/lib/typescript/components/Slider/styles.d.ts +30 -0
  23. package/lib/typescript/components/Slider/styles.d.ts.map +1 -0
  24. package/lib/typescript/components/index.d.ts +1 -0
  25. package/lib/typescript/components/index.d.ts.map +1 -1
  26. package/package.json +4 -4
  27. package/src/components/Slider/getSliderPopupPosition.ts +37 -0
  28. package/src/components/Slider/index.tsx +456 -0
  29. package/src/components/Slider/styles.ts +147 -0
  30. package/src/components/index.ts +1 -0
@@ -0,0 +1,147 @@
1
+ import { Platform } from 'react-native';
2
+ import { cva, type VariantProps } from 'class-variance-authority';
3
+ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/constants';
4
+
5
+ export const sliderColorOptions = ['action', 'danger', 'warning', 'success', 'info'] as const;
6
+ export type SliderColor = (typeof sliderColorOptions)[number];
7
+
8
+ export const sliderRootVariants = cva(
9
+ [
10
+ 'relative w-full touch-none select-none',
11
+ 'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
12
+ DISABLED_CURSOR,
13
+ 'web:outline-none',
14
+ ],
15
+ {
16
+ variants: {
17
+ orientation: {
18
+ horizontal: 'h-5 overflow-visible',
19
+ vertical: 'flex h-48 w-8 items-center justify-center overflow-visible',
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ orientation: 'horizontal',
24
+ },
25
+ },
26
+ );
27
+
28
+ export const sliderRailVariants = cva(
29
+ ['relative w-full overflow-hidden rounded-full', TRANSITION_COLORS],
30
+ {
31
+ variants: {
32
+ orientation: {
33
+ horizontal: 'h-1.5',
34
+ vertical: 'h-full w-1.5',
35
+ },
36
+ },
37
+ defaultVariants: {
38
+ orientation: 'horizontal',
39
+ },
40
+ },
41
+ );
42
+
43
+ export const sliderRailColorVariants = cva([], {
44
+ variants: {
45
+ color: {
46
+ action: 'bg-surface-action-subtle',
47
+ danger: 'bg-surface-danger-subtle',
48
+ warning: 'bg-surface-warning-subtle',
49
+ success: 'bg-surface-success-subtle',
50
+ info: 'bg-surface-info-subtle',
51
+ },
52
+ },
53
+ defaultVariants: {
54
+ color: 'action',
55
+ },
56
+ });
57
+
58
+ export const sliderTrackVariants = cva(['rounded-full transition-none'], {
59
+ variants: {
60
+ orientation: {
61
+ horizontal: '',
62
+ vertical: '',
63
+ },
64
+ },
65
+ defaultVariants: {
66
+ orientation: 'horizontal',
67
+ },
68
+ });
69
+
70
+ export const sliderTrackColorVariants = cva([], {
71
+ variants: {
72
+ color: {
73
+ action: 'bg-surface-action-strong',
74
+ danger: 'bg-surface-danger-strong',
75
+ warning: 'bg-surface-warning-strong',
76
+ success: 'bg-surface-success-strong',
77
+ info: 'bg-surface-info-strong',
78
+ },
79
+ },
80
+ defaultVariants: {
81
+ color: 'action',
82
+ },
83
+ });
84
+
85
+ export const sliderThumbVariants = cva(
86
+ [
87
+ 'box-border size-5 z-2 overflow-visible rounded-full bg-white border-3 border-solid shadow-md',
88
+ 'web:cursor-grab web:active:cursor-grabbing',
89
+ 'transition-[transform,box-shadow,opacity] duration-150',
90
+ 'data-[dragging=true]:transition-none',
91
+ Platform.select({
92
+ default: 'data-[active=true]:scale-105',
93
+ web: 'data-[hover=true]:scale-110 data-[dragging=true]:scale-110 data-[hover=true]:shadow-lg web:data-[focus-visible=true]:ring-4 web:data-[focus-visible=true]:ring-stroke-focus',
94
+ }),
95
+ ],
96
+ {
97
+ variants: {
98
+ color: {
99
+ action: 'border-surface-action-strong',
100
+ danger: 'border-surface-danger-strong',
101
+ warning: 'border-surface-warning-strong',
102
+ success: 'border-surface-success-strong',
103
+ info: 'border-surface-info-strong',
104
+ },
105
+ },
106
+ defaultVariants: {
107
+ color: 'action',
108
+ },
109
+ },
110
+ );
111
+
112
+ export const sliderThumbHaloVariants = cva(['hidden'], {
113
+ variants: {
114
+ visible: {
115
+ true: '',
116
+ false: '',
117
+ },
118
+ },
119
+ defaultVariants: { visible: false },
120
+ });
121
+
122
+ export const sliderPopupBaseVariants = cva([
123
+ 'rounded-md bg-white px-2 py-1',
124
+ 'text-content-primary text-xs font-medium shadow-md select-none pointer-events-none',
125
+ ]);
126
+
127
+ export const sliderMarkerVariants = cva(
128
+ ['rounded-full size-0.5 shrink-0', 'data-[value=0]:hidden data-[value=100]:hidden'],
129
+ {
130
+ variants: {
131
+ filled: {
132
+ true: 'bg-surface-action-subtle',
133
+ false: 'bg-content-action',
134
+ },
135
+ },
136
+ defaultVariants: {
137
+ filled: false,
138
+ },
139
+ },
140
+ );
141
+
142
+ export type SliderVariantProps = VariantProps<typeof sliderRootVariants> &
143
+ VariantProps<typeof sliderRailVariants> &
144
+ VariantProps<typeof sliderRailColorVariants> &
145
+ VariantProps<typeof sliderTrackVariants> &
146
+ VariantProps<typeof sliderTrackColorVariants> &
147
+ VariantProps<typeof sliderThumbVariants>;
@@ -26,6 +26,7 @@ export * from './ProgressSegmented';
26
26
  export * from './Radio';
27
27
  export * from './ScopedTheme';
28
28
  export * from './Select';
29
+ export * from './Slider';
29
30
  export * from './VirtualizedList';
30
31
  export * from './Switch';
31
32
  export * from './Textarea';