@pathscale/ui 0.0.10 → 0.0.12

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 (175) hide show
  1. package/README.md +53 -0
  2. package/dist/Avatar-Dkd_kPlV.d.ts +40 -0
  3. package/dist/CollapseTitle-BNxog3is.d.ts +12 -0
  4. package/dist/{Field-DfUn85_1.d.ts → Field-DI2PA30N.d.ts} +1 -1
  5. package/dist/Mask-CPb596Mg.d.ts +16 -0
  6. package/dist/Menu-DgO4SHmA.d.ts +45 -0
  7. package/dist/{Progress-gN0xqhAF.d.ts → Progress-ChF4ior8.d.ts} +2 -2
  8. package/dist/Steps-Dk-UPL6r.d.ts +38 -0
  9. package/dist/{Tabs-BEnRV6GG.d.ts → Tabs-WiUU0xsM.d.ts} +1 -1
  10. package/dist/chunk/2OJYONJ3.js +40 -0
  11. package/dist/chunk/2VQ2762Z.js +80 -0
  12. package/dist/chunk/2XPPNBYK.js +164 -0
  13. package/dist/chunk/3I23P4TJ.js +33 -0
  14. package/dist/chunk/5HG7XWVC.jsx +2956 -0
  15. package/dist/chunk/5IJ7WEIF.js +43 -0
  16. package/dist/chunk/5O6WC3OB.jsx +67 -0
  17. package/dist/chunk/6P5JIKPF.jsx +51 -0
  18. package/dist/chunk/BHLLVOVR.js +46 -0
  19. package/dist/chunk/DJI5XKAV.js +31 -0
  20. package/dist/chunk/DN3P54J2.jsx +43 -0
  21. package/dist/chunk/DVFQAAZR.js +43 -0
  22. package/dist/chunk/EDDBK4J6.js +42 -0
  23. package/dist/chunk/FZRQDGPD.jsx +54 -0
  24. package/dist/chunk/G5UEZ2VC.js +49 -0
  25. package/dist/chunk/GL7JG772.js +114 -0
  26. package/dist/chunk/HEOKGP5U.js +55 -0
  27. package/dist/chunk/HUHXQCKK.js +16 -0
  28. package/dist/chunk/I36LHZUY.jsx +31 -0
  29. package/dist/chunk/IG323YKF.jsx +50 -0
  30. package/dist/chunk/JQ4HSRDP.js +142 -0
  31. package/dist/chunk/JSQBKK7L.jsx +50 -0
  32. package/dist/chunk/K3WO7SRD.js +1 -0
  33. package/dist/chunk/KQ3RAWCE.jsx +57 -0
  34. package/dist/chunk/KXJZKDJX.jsx +0 -0
  35. package/dist/chunk/L4A67X7S.js +7 -0
  36. package/dist/chunk/LGDDR242.jsx +159 -0
  37. package/dist/chunk/MM2DZQL3.js +46 -0
  38. package/dist/chunk/MZWBWFDD.js +151 -0
  39. package/dist/chunk/O7LDJCQS.jsx +18 -0
  40. package/dist/chunk/Q4442PU4.js +42 -0
  41. package/dist/chunk/R5G3PODL.jsx +11 -0
  42. package/dist/chunk/R6ZBT7CY.jsx +55 -0
  43. package/dist/chunk/RHEFVSMJ.jsx +52 -0
  44. package/dist/chunk/{G6RG4LR7.js → SPEY5RMB.js} +2 -5
  45. package/dist/chunk/STFCLC5R.js +2954 -0
  46. package/dist/chunk/SVJIYMYJ.jsx +156 -0
  47. package/dist/chunk/SYWB4UN3.jsx +64 -0
  48. package/dist/chunk/{KACNXPUM.jsx → T2LDLYWV.jsx} +2 -4
  49. package/dist/chunk/UNKDNDT3.js +62 -0
  50. package/dist/chunk/XM3KF5LV.jsx +179 -0
  51. package/dist/chunk/XQCSYRVP.jsx +168 -0
  52. package/dist/chunk/YWIT2MRI.jsx +43 -0
  53. package/dist/chunk/ZYEP35R3.jsx +60 -0
  54. package/dist/components/{progress → Progress}/index.d.ts +1 -1
  55. package/dist/components/accordion/index.d.ts +17 -5
  56. package/dist/components/accordion/index.js +1 -1
  57. package/dist/components/accordion/index.jsx +6 -4
  58. package/dist/components/avatar/index.d.ts +4 -4
  59. package/dist/components/avatar/index.js +1 -1
  60. package/dist/components/avatar/index.jsx +3 -2
  61. package/dist/components/badge/index.d.ts +17 -0
  62. package/dist/components/badge/index.js +1 -0
  63. package/dist/components/badge/index.jsx +8 -0
  64. package/dist/components/breadcrumbs/index.d.ts +9 -0
  65. package/dist/components/breadcrumbs/index.js +1 -0
  66. package/dist/components/breadcrumbs/index.jsx +7 -0
  67. package/dist/components/button/index.d.ts +28 -6
  68. package/dist/components/button/index.js +1 -1
  69. package/dist/components/button/index.jsx +5 -5
  70. package/dist/components/checkbox/index.d.ts +13 -5
  71. package/dist/components/checkbox/index.js +1 -1
  72. package/dist/components/checkbox/index.jsx +5 -4
  73. package/dist/components/collapse/index.d.ts +15 -0
  74. package/dist/components/collapse/index.js +1 -0
  75. package/dist/components/collapse/index.jsx +14 -0
  76. package/dist/components/field/index.d.ts +1 -1
  77. package/dist/components/fileinput/index.d.ts +16 -0
  78. package/dist/components/fileinput/index.js +1 -0
  79. package/dist/components/fileinput/index.jsx +8 -0
  80. package/dist/components/input/index.d.ts +13 -8
  81. package/dist/components/input/index.js +1 -1
  82. package/dist/components/input/index.jsx +5 -6
  83. package/dist/components/join/index.d.ts +11 -0
  84. package/dist/components/join/index.js +1 -0
  85. package/dist/components/join/index.jsx +9 -0
  86. package/dist/components/mask/index.d.ts +7 -0
  87. package/dist/components/mask/index.js +1 -0
  88. package/dist/components/mask/index.jsx +8 -0
  89. package/dist/components/menu/index.d.ts +6 -64
  90. package/dist/components/menu/index.js +1 -1
  91. package/dist/components/menu/index.jsx +4 -7
  92. package/dist/components/pagination/index.d.ts +6 -6
  93. package/dist/components/pagination/index.js +1 -1
  94. package/dist/components/pagination/index.jsx +6 -4
  95. package/dist/components/polymorphic/index.d.ts +1 -2
  96. package/dist/components/polymorphic/index.js +1 -1
  97. package/dist/components/polymorphic/index.jsx +1 -1
  98. package/dist/components/select/index.d.ts +12 -5
  99. package/dist/components/select/index.js +1 -1
  100. package/dist/components/select/index.jsx +5 -4
  101. package/dist/components/steps/index.d.ts +3 -4
  102. package/dist/components/steps/index.js +1 -1
  103. package/dist/components/steps/index.jsx +3 -2
  104. package/dist/components/tabs/index.d.ts +2 -2
  105. package/dist/components/textarea/index.d.ts +12 -5
  106. package/dist/components/textarea/index.js +1 -1
  107. package/dist/components/textarea/index.jsx +5 -4
  108. package/dist/components/toggle/index.d.ts +15 -0
  109. package/dist/components/toggle/index.js +1 -0
  110. package/dist/components/toggle/index.jsx +8 -0
  111. package/dist/components/tooltip/index.d.ts +14 -5
  112. package/dist/components/tooltip/index.js +1 -1
  113. package/dist/components/tooltip/index.jsx +5 -4
  114. package/dist/index.d.ts +23 -18
  115. package/dist/index.js +23 -20
  116. package/dist/index.jsx +80 -65
  117. package/dist/types-CUG9pToa.d.ts +15 -0
  118. package/package.json +4 -2
  119. package/dist/Accordion-JZGWxBMK.d.ts +0 -27
  120. package/dist/Avatar-CzIirpVq.d.ts +0 -33
  121. package/dist/Button-B50OLXuV.d.ts +0 -63
  122. package/dist/Checkbox-CzeDsQLA.d.ts +0 -32
  123. package/dist/Input-BGHHmBBR.d.ts +0 -42
  124. package/dist/Pagination-CJtlFMHy.d.ts +0 -43
  125. package/dist/Select-CWCDBvec.d.ts +0 -44
  126. package/dist/Steps-1miUeyCD.d.ts +0 -34
  127. package/dist/Switch-CW6QtO1Y.d.ts +0 -76
  128. package/dist/Tag-BPrhn-Ne.d.ts +0 -42
  129. package/dist/Textarea-Cpdk7m6S.d.ts +0 -37
  130. package/dist/Tooltip-BfPongoz.d.ts +0 -53
  131. package/dist/Upload-CRljD5jf.d.ts +0 -39
  132. package/dist/chunk/3VOILEMN.js +0 -187
  133. package/dist/chunk/C4745OZS.jsx +0 -101
  134. package/dist/chunk/CJZGTNJZ.js +0 -115
  135. package/dist/chunk/DBQ7IOPU.js +0 -189
  136. package/dist/chunk/EB7KXR65.js +0 -102
  137. package/dist/chunk/EE4HXMKA.js +0 -165
  138. package/dist/chunk/ELRAUORW.jsx +0 -179
  139. package/dist/chunk/F33TSIEQ.jsx +0 -181
  140. package/dist/chunk/GA2HCFRS.jsx +0 -228
  141. package/dist/chunk/GWFGP2JQ.jsx +0 -179
  142. package/dist/chunk/LAQPAV5I.jsx +0 -187
  143. package/dist/chunk/LI3HCFL7.jsx +0 -132
  144. package/dist/chunk/MI773TMC.js +0 -107
  145. package/dist/chunk/MMTAND25.jsx +0 -126
  146. package/dist/chunk/NZKPDBTE.js +0 -118
  147. package/dist/chunk/NZZRKP74.js +0 -214
  148. package/dist/chunk/O2IMHWMY.js +0 -159
  149. package/dist/chunk/OMRJVDZV.js +0 -173
  150. package/dist/chunk/OYAKKETQ.js +0 -111
  151. package/dist/chunk/PNPC2OI3.jsx +0 -156
  152. package/dist/chunk/QHJOIUYT.jsx +0 -117
  153. package/dist/chunk/QONDPQ2I.jsx +0 -105
  154. package/dist/chunk/R6COBCN7.jsx +0 -100
  155. package/dist/chunk/T7IZ26YC.jsx +0 -194
  156. package/dist/chunk/TT2JYGLU.js +0 -218
  157. package/dist/chunk/V6Y5E7BL.js +0 -133
  158. package/dist/chunk/WB6NEEQV.jsx +0 -107
  159. package/dist/chunk/WYHYWDOM.js +0 -164
  160. package/dist/chunk/XD34JKSU.jsx +0 -201
  161. package/dist/chunk/YDEDUOFM.js +0 -102
  162. package/dist/components/breadcrumb/index.d.ts +0 -47
  163. package/dist/components/breadcrumb/index.js +0 -1
  164. package/dist/components/breadcrumb/index.jsx +0 -9
  165. package/dist/components/switch/index.d.ts +0 -8
  166. package/dist/components/switch/index.js +0 -1
  167. package/dist/components/switch/index.jsx +0 -7
  168. package/dist/components/tag/index.d.ts +0 -8
  169. package/dist/components/tag/index.js +0 -1
  170. package/dist/components/tag/index.jsx +0 -7
  171. package/dist/components/upload/index.d.ts +0 -8
  172. package/dist/components/upload/index.js +0 -1
  173. package/dist/components/upload/index.jsx +0 -7
  174. /package/dist/components/{progress → Progress}/index.js +0 -0
  175. /package/dist/components/{progress → Progress}/index.jsx +0 -0
@@ -1,228 +0,0 @@
1
- import {
2
- PolymorphicButton_default
3
- } from "./KACNXPUM.jsx";
4
- import {
5
- cva
6
- } from "./P7WPLZNA.jsx";
7
-
8
- // src/components/button/Button.tsx
9
- import {
10
- mergeProps,
11
- splitProps,
12
- createMemo
13
- } from "solid-js";
14
-
15
- // src/components/button/Button.styles.ts
16
- var buttonVariants = cva(
17
- [
18
- "inline-flex items-center font-medium outline-none select-none",
19
- "not-disabled:cursor-pointer",
20
- "disabled:cursor-not-allowed disabled:opacity-25",
21
- "aria-busy:cursor-wait",
22
- "transition active:transition-none"
23
- ],
24
- {
25
- variants: {
26
- size: {
27
- sm: "text-sm leading-tight",
28
- md: "text-base leading-tight",
29
- lg: "text-lg leading-tight"
30
- },
31
- color: {
32
- inverse: "",
33
- primary: "",
34
- secondary: "",
35
- tertiary: "",
36
- accent: "",
37
- positive: "",
38
- destructive: ""
39
- },
40
- align: {
41
- start: "justify-start",
42
- center: "justify-center",
43
- end: "justify-end"
44
- },
45
- shape: {
46
- circle: "rounded-full",
47
- rounded: "rounded-lg"
48
- },
49
- spacing: {
50
- 0: "gap-0 p-0",
51
- xs: "gap-1.5 px-1.5 py-1.5",
52
- sm: "gap-1.5 px-2 py-2",
53
- md: "gap-1.5 px-3 py-2",
54
- lg: "gap-1.5 px-3.5 py-2.5"
55
- },
56
- loading: {
57
- true: "",
58
- false: ""
59
- },
60
- stretched: {
61
- true: "w-full",
62
- false: "w-fit"
63
- },
64
- variant: {
65
- fill: [
66
- "not-disabled:hover:opacity-75 not-disabled:active:opacity-50",
67
- "aria-[current]:opacity-75 data-expanded:opacity-75 data-open:opacity-75",
68
- "focus-visible:opacity-75"
69
- ],
70
- gray: [
71
- "bg-bg-primary not-disabled:hover:bg-bg-secondary not-disabled:active:bg-bg-secondary not-disabled:active:opacity-75",
72
- "aria-[current]:bg-bg-secondary data-expanded:bg-bg-secondary data-open:bg-bg-secondary",
73
- "focus-visible:bg-bg-secondary"
74
- ],
75
- ghost: [
76
- "not-disabled:hover:bg-bg-primary not-disabled:active:bg-bg-primary not-disabled:active:opacity-75",
77
- "aria-[current]:bg-bg-primary data-expanded:bg-bg-primary data-open:bg-bg-primary",
78
- "focus-visible:bg-bg-primary"
79
- ]
80
- }
81
- },
82
- compoundVariants: [
83
- {
84
- variant: "fill",
85
- color: "inverse",
86
- class: "bg-bg-inverse text-fg-inverse"
87
- },
88
- {
89
- variant: "fill",
90
- color: "primary",
91
- class: "bg-bg-primary text-fg-body"
92
- },
93
- {
94
- variant: "fill",
95
- color: "secondary",
96
- class: "bg-bg-secondary text-fg-body"
97
- },
98
- {
99
- variant: "fill",
100
- color: "tertiary",
101
- class: "bg-bg-tertiary text-fg-body"
102
- },
103
- {
104
- variant: "fill",
105
- color: "accent",
106
- class: "bg-bg-accent text-light"
107
- },
108
- {
109
- variant: "fill",
110
- color: "positive",
111
- class: "bg-bg-positive text-light"
112
- },
113
- {
114
- variant: "fill",
115
- color: "destructive",
116
- class: "bg-bg-destructive text-light"
117
- },
118
- {
119
- variant: "gray",
120
- color: "inverse",
121
- class: "text-fg-inverse"
122
- },
123
- {
124
- variant: "gray",
125
- color: "primary",
126
- class: "text-fg-primary"
127
- },
128
- {
129
- variant: "gray",
130
- color: "secondary",
131
- class: "text-fg-secondary"
132
- },
133
- {
134
- variant: "gray",
135
- color: "tertiary",
136
- class: "text-fg-tertiary"
137
- },
138
- {
139
- variant: "gray",
140
- color: "accent",
141
- class: "text-fg-accent"
142
- },
143
- {
144
- variant: "gray",
145
- color: "positive",
146
- class: "text-fg-positive"
147
- },
148
- {
149
- variant: "gray",
150
- color: "destructive",
151
- class: "text-fg-destructive"
152
- },
153
- {
154
- variant: "ghost",
155
- color: "inverse",
156
- class: "text-fg-inverse"
157
- },
158
- {
159
- variant: "ghost",
160
- color: "primary",
161
- class: "text-fg-primary"
162
- },
163
- {
164
- variant: "ghost",
165
- color: "secondary",
166
- class: "text-fg-secondary"
167
- },
168
- {
169
- variant: "ghost",
170
- color: "tertiary",
171
- class: "text-fg-tertiary"
172
- },
173
- {
174
- variant: "ghost",
175
- color: "accent",
176
- class: "text-fg-accent"
177
- },
178
- {
179
- variant: "ghost",
180
- color: "positive",
181
- class: "text-fg-positive"
182
- },
183
- {
184
- variant: "ghost",
185
- color: "destructive",
186
- class: "text-fg-destructive"
187
- }
188
- ],
189
- defaultVariants: {
190
- size: "md",
191
- color: "primary",
192
- align: "center",
193
- shape: "rounded",
194
- spacing: "md",
195
- variant: "fill",
196
- loading: false,
197
- stretched: false
198
- }
199
- }
200
- );
201
-
202
- // src/components/button/Button.tsx
203
- var Button = (props) => {
204
- const defaultedProps = mergeProps(
205
- {
206
- color: "primary"
207
- },
208
- props
209
- );
210
- const [variantProps, otherProps] = splitProps(defaultedProps, [
211
- "class",
212
- ...buttonVariants.variantKeys
213
- ]);
214
- const classes = createMemo(() => buttonVariants(variantProps));
215
- return <PolymorphicButton_default
216
- class={classes()}
217
- aria-busy={variantProps.loading ? "true" : void 0}
218
- {...otherProps}
219
- />;
220
- };
221
- var Button_default = Button;
222
-
223
- // src/components/button/index.ts
224
- var button_default = Button_default;
225
-
226
- export {
227
- button_default
228
- };
@@ -1,179 +0,0 @@
1
- import {
2
- cva
3
- } from "./P7WPLZNA.jsx";
4
-
5
- // src/components/switch/Switch.tsx
6
- import {
7
- createSignal,
8
- splitProps,
9
- createMemo,
10
- untrack
11
- } from "solid-js";
12
-
13
- // src/components/switch/Switch.styles.ts
14
- var switchVariants = cva(
15
- "switch inline-flex items-center gap-2 select-none",
16
- {
17
- variants: {
18
- size: {
19
- sm: "text-sm",
20
- md: "text-base",
21
- lg: "text-lg"
22
- },
23
- disabled: {
24
- true: "opacity-50",
25
- false: ""
26
- },
27
- rounded: {
28
- true: "",
29
- false: ""
30
- },
31
- outlined: {
32
- true: "",
33
- false: ""
34
- }
35
- },
36
- defaultVariants: {
37
- size: "md",
38
- disabled: false,
39
- rounded: true,
40
- outlined: false
41
- }
42
- }
43
- );
44
- var checkVariants = cva(
45
- [
46
- "relative transition-colors duration-200",
47
- "after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out after:shadow-sm"
48
- ].join(" "),
49
- {
50
- variants: {
51
- size: {
52
- sm: "w-8 h-4 after:w-3 after:h-3 after:left-0.5 after:top-0.5 peer-checked:after:translate-x-4",
53
- md: "w-10 h-6 after:w-4 after:h-4 after:left-1 after:top-1 peer-checked:after:translate-x-4",
54
- lg: "w-12 h-7 after:w-5 after:h-5 after:left-1 after:top-1 peer-checked:after:translate-x-5"
55
- },
56
- color: {
57
- primary: "peer-checked:bg-blue-500",
58
- success: "peer-checked:bg-green-500",
59
- danger: "peer-checked:bg-red-500",
60
- warning: "peer-checked:bg-yellow-400",
61
- gray: "peer-checked:bg-gray-400"
62
- },
63
- passiveColor: {
64
- primary: "bg-blue-200",
65
- success: "bg-green-200",
66
- danger: "bg-red-200",
67
- warning: "bg-yellow-200",
68
- gray: "bg-gray-200"
69
- },
70
- rounded: {
71
- true: "rounded-full after:rounded-full",
72
- false: "rounded-md after:rounded-sm"
73
- },
74
- outlined: {
75
- true: "bg-transparent ring border-current",
76
- false: ""
77
- },
78
- disabled: {
79
- true: "bg-gray-200 border border-gray-300 after:bg-gray-100",
80
- false: ""
81
- }
82
- },
83
- defaultVariants: {
84
- size: "md",
85
- color: "primary",
86
- passiveColor: "gray",
87
- rounded: true,
88
- outlined: false
89
- }
90
- }
91
- );
92
- var switchLabelClass = cva("control-label", {
93
- variants: {
94
- disabled: {
95
- true: "text-gray-400 dark:text-gray-500",
96
- false: "text-gray-800 dark:text-gray-200"
97
- }
98
- },
99
- defaultVariants: {
100
- disabled: false
101
- }
102
- });
103
-
104
- // src/components/switch/Switch.tsx
105
- var Switch = (props) => {
106
- const [localProps, variantProps, otherProps] = splitProps(
107
- props,
108
- [
109
- "children",
110
- "checked",
111
- "defaultChecked",
112
- "onChange",
113
- "name",
114
- "required",
115
- "disabled",
116
- "aria-label",
117
- "aria-describedby"
118
- ],
119
- ["size", "rounded", "outlined", "color", "passiveColor", "disabled"]
120
- );
121
- const isControlled = localProps.checked !== void 0;
122
- const [internalChecked, setInternalChecked] = createSignal(
123
- localProps.defaultChecked ?? false
124
- );
125
- const checkedValue = createMemo(
126
- () => untrack(() => isControlled ? localProps.checked : internalChecked())
127
- );
128
- const switchClasses = createMemo(() => switchVariants(variantProps));
129
- const checkClasses = createMemo(
130
- () => checkVariants({
131
- size: variantProps.size,
132
- color: variantProps.color,
133
- passiveColor: variantProps.passiveColor,
134
- rounded: variantProps.rounded,
135
- outlined: variantProps.outlined,
136
- disabled: localProps.disabled
137
- })
138
- );
139
- const handleChange = (e) => {
140
- if (localProps.disabled) return;
141
- const next = e.currentTarget.checked;
142
- untrack(() => {
143
- if (!isControlled) setInternalChecked(next);
144
- localProps.onChange?.(next);
145
- });
146
- };
147
- return <label
148
- class={switchClasses()}
149
- role="switch"
150
- aria-checked={checkedValue()}
151
- aria-label={localProps["aria-label"]}
152
- aria-describedby={localProps["aria-describedby"]}
153
- >
154
- <input
155
- type="checkbox"
156
- class="sr-only peer"
157
- checked={checkedValue()}
158
- onChange={handleChange}
159
- name={localProps.name}
160
- required={localProps.required}
161
- disabled={localProps.disabled}
162
- aria-hidden="true"
163
- {...otherProps}
164
- />
165
-
166
- <span class={checkClasses()} />
167
- <span class={switchLabelClass({ disabled: localProps.disabled })}>
168
- {localProps.children}
169
- </span>
170
- </label>;
171
- };
172
- var Switch_default = Switch;
173
-
174
- // src/components/switch/index.ts
175
- var switch_default = Switch_default;
176
-
177
- export {
178
- switch_default
179
- };
@@ -1,187 +0,0 @@
1
- import {
2
- classes,
3
- cva
4
- } from "./P7WPLZNA.jsx";
5
-
6
- // src/components/steps/Steps.tsx
7
- import {
8
- createSignal,
9
- splitProps,
10
- For,
11
- Show,
12
- createMemo
13
- } from "solid-js";
14
-
15
- // src/components/steps/Steps.styles.ts
16
- var stepsContainer = cva("flex flex-col", {
17
- variants: {
18
- animated: {
19
- true: "transition-all duration-300 ease-in-out",
20
- false: ""
21
- }
22
- },
23
- defaultVariants: { animated: false }
24
- });
25
- var navBar = cva("flex items-center justify-between mb-6");
26
- var navItem = cva(
27
- "relative flex-1 flex flex-col items-center",
28
- {
29
- variants: {
30
- clickable: {
31
- true: "cursor-pointer",
32
- false: "pointer-events-none"
33
- },
34
- disabled: {
35
- true: "opacity-50 pointer-events-none",
36
- false: ""
37
- }
38
- },
39
- defaultVariants: { clickable: false, disabled: false }
40
- }
41
- );
42
- var marker = cva(
43
- "w-8 h-8 flex items-center justify-center rounded-full border-2",
44
- {
45
- variants: {
46
- active: {
47
- true: "bg-blue-500 border-blue-500 text-white",
48
- false: "bg-white border-gray-300 text-gray-600"
49
- }
50
- },
51
- defaultVariants: { active: false }
52
- }
53
- );
54
- var line = cva("absolute top-1/2 left-full w-full h-0.5", {
55
- variants: {
56
- active: {
57
- true: "bg-blue-500",
58
- false: "bg-gray-300"
59
- }
60
- },
61
- defaultVariants: { active: false }
62
- });
63
- var title = cva("mt-2 text-sm", {
64
- variants: {
65
- active: {
66
- true: "text-blue-600 font-medium",
67
- false: "text-gray-600"
68
- }
69
- },
70
- defaultVariants: { active: false }
71
- });
72
- var subtitle = cva("text-xs mt-1", {
73
- variants: {
74
- color: {
75
- default: "text-blue-500",
76
- muted: "text-gray-500",
77
- accent: "text-green-500"
78
- }
79
- },
80
- defaultVariants: { color: "default" }
81
- });
82
- var buttonSteps = cva("px-4 py-2 bg-blue-600 text-white rounded");
83
-
84
- // src/components/steps/Steps.tsx
85
- var Steps = (props) => {
86
- const [local, variantProps, otherProps] = splitProps(
87
- props,
88
- ["steps", "animated", "initial", "value", "onStepChange", "className"],
89
- ["animated"]
90
- );
91
- const isControlled = () => local.value !== void 0;
92
- const [internalIndex, setInternalIndex] = createSignal(local.initial ?? 0);
93
- const activeIndex = createMemo(
94
- () => isControlled() ? local.value : internalIndex()
95
- );
96
- const clamp = (i) => Math.max(0, Math.min(i, local.steps.length - 1));
97
- const changeIndex = (i) => {
98
- const idx = clamp(i);
99
- if (isControlled()) local.onStepChange?.(idx);
100
- else setInternalIndex(idx);
101
- };
102
- const next = () => changeIndex(activeIndex() + 1);
103
- const back = () => changeIndex(activeIndex() - 1);
104
- const isActive = (i) => i === activeIndex();
105
- const isPast = (i) => i < activeIndex();
106
- return <div
107
- class={classes(
108
- stepsContainer({ animated: local.animated }),
109
- local.className
110
- )}
111
- {...otherProps}
112
- >
113
- <nav class={navBar()}>
114
- <For each={local.steps}>
115
- {(step, idx) => {
116
- const i = idx();
117
- return <div
118
- class={navItem({ clickable: !!step.clickable })}
119
- onClick={() => step.clickable && changeIndex(i)}
120
- >
121
- <div class={marker({ active: isActive(i) || isPast(i) })}>
122
- {step.marker ?? String(i + 1)}
123
- </div>
124
- <Show when={i < local.steps.length - 1}>
125
- <div class={line({ active: isPast(i) })} />
126
- </Show>
127
- <div class={title({ active: isActive(i) || isPast(i) })}>
128
- {step.title}
129
- </div>
130
- <Show when={step.subtitle}>
131
- <div class={subtitle()}>{step.subtitle}</div>
132
- </Show>
133
- </div>;
134
- }}
135
- </For>
136
- </nav>
137
- <div>
138
- <For each={local.steps}>
139
- {(step, idx) => {
140
- const i = idx();
141
- return <Show when={isActive(i)}>
142
- <div>
143
- {step.content}
144
- <div class="flex justify-end gap-2 mt-6">
145
- <Show when={i > 0}>
146
- <button
147
- type="button"
148
- class="px-4 py-2 border rounded"
149
- onClick={back}
150
- >
151
- Back
152
- </button>
153
- </Show>
154
- <Show when={i < local.steps.length - 1}>
155
- <button
156
- type="button"
157
- class={buttonSteps()}
158
- onClick={next}
159
- >
160
- Next
161
- </button>
162
- </Show>
163
- <Show when={i === local.steps.length - 1}>
164
- <button
165
- type="button"
166
- class="px-4 py-2 bg-green-600 text-white rounded"
167
- onClick={() => changeIndex(0)}
168
- >
169
- Restart
170
- </button>
171
- </Show>
172
- </div>
173
- </div>
174
- </Show>;
175
- }}
176
- </For>
177
- </div>
178
- </div>;
179
- };
180
- var Steps_default = Steps;
181
-
182
- // src/components/steps/index.ts
183
- var steps_default = Steps_default;
184
-
185
- export {
186
- steps_default
187
- };