@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,165 +0,0 @@
1
- import { cva } from './HKS7ET6T.js';
2
- import { template, spread, mergeProps, insert, effect, className, setAttribute } from 'solid-js/web';
3
- import { splitProps, createSignal, createMemo, untrack } from 'solid-js';
4
-
5
- // src/components/switch/Switch.styles.ts
6
- var switchVariants = cva(
7
- "switch inline-flex items-center gap-2 select-none",
8
- {
9
- variants: {
10
- size: {
11
- sm: "text-sm",
12
- md: "text-base",
13
- lg: "text-lg"
14
- },
15
- disabled: {
16
- true: "opacity-50",
17
- false: ""
18
- },
19
- rounded: {
20
- true: "",
21
- false: ""
22
- },
23
- outlined: {
24
- true: "",
25
- false: ""
26
- }
27
- },
28
- defaultVariants: {
29
- size: "md",
30
- disabled: false,
31
- rounded: true,
32
- outlined: false
33
- }
34
- }
35
- );
36
- var checkVariants = cva(
37
- [
38
- "relative transition-colors duration-200",
39
- "after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out after:shadow-sm"
40
- ].join(" "),
41
- {
42
- variants: {
43
- size: {
44
- 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",
45
- md: "w-10 h-6 after:w-4 after:h-4 after:left-1 after:top-1 peer-checked:after:translate-x-4",
46
- lg: "w-12 h-7 after:w-5 after:h-5 after:left-1 after:top-1 peer-checked:after:translate-x-5"
47
- },
48
- color: {
49
- primary: "peer-checked:bg-blue-500",
50
- success: "peer-checked:bg-green-500",
51
- danger: "peer-checked:bg-red-500",
52
- warning: "peer-checked:bg-yellow-400",
53
- gray: "peer-checked:bg-gray-400"
54
- },
55
- passiveColor: {
56
- primary: "bg-blue-200",
57
- success: "bg-green-200",
58
- danger: "bg-red-200",
59
- warning: "bg-yellow-200",
60
- gray: "bg-gray-200"
61
- },
62
- rounded: {
63
- true: "rounded-full after:rounded-full",
64
- false: "rounded-md after:rounded-sm"
65
- },
66
- outlined: {
67
- true: "bg-transparent ring border-current",
68
- false: ""
69
- },
70
- disabled: {
71
- true: "bg-gray-200 border border-gray-300 after:bg-gray-100",
72
- false: ""
73
- }
74
- },
75
- defaultVariants: {
76
- size: "md",
77
- color: "primary",
78
- passiveColor: "gray",
79
- rounded: true,
80
- outlined: false
81
- }
82
- }
83
- );
84
- var switchLabelClass = cva("control-label", {
85
- variants: {
86
- disabled: {
87
- true: "text-gray-400 dark:text-gray-500",
88
- false: "text-gray-800 dark:text-gray-200"
89
- }
90
- },
91
- defaultVariants: {
92
- disabled: false
93
- }
94
- });
95
-
96
- // src/components/switch/Switch.tsx
97
- var _tmpl$ = /* @__PURE__ */ template(`<label role=switch><input type=checkbox class="sr-only peer"aria-hidden=true><span></span><span>`);
98
- var Switch = (props) => {
99
- const [localProps, variantProps, otherProps] = splitProps(props, ["children", "checked", "defaultChecked", "onChange", "name", "required", "disabled", "aria-label", "aria-describedby"], ["size", "rounded", "outlined", "color", "passiveColor", "disabled"]);
100
- const isControlled = localProps.checked !== void 0;
101
- const [internalChecked, setInternalChecked] = createSignal(localProps.defaultChecked ?? false);
102
- const checkedValue = createMemo(() => untrack(() => isControlled ? localProps.checked : internalChecked()));
103
- const switchClasses = createMemo(() => switchVariants(variantProps));
104
- const checkClasses = createMemo(() => checkVariants({
105
- size: variantProps.size,
106
- color: variantProps.color,
107
- passiveColor: variantProps.passiveColor,
108
- rounded: variantProps.rounded,
109
- outlined: variantProps.outlined,
110
- disabled: localProps.disabled
111
- }));
112
- const handleChange = (e) => {
113
- if (localProps.disabled) return;
114
- const next = e.currentTarget.checked;
115
- untrack(() => {
116
- if (!isControlled) setInternalChecked(next);
117
- localProps.onChange?.(next);
118
- });
119
- };
120
- return (() => {
121
- var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.nextSibling;
122
- _el$2.addEventListener("change", handleChange);
123
- spread(_el$2, mergeProps({
124
- get checked() {
125
- return checkedValue();
126
- },
127
- get name() {
128
- return localProps.name;
129
- },
130
- get required() {
131
- return localProps.required;
132
- },
133
- get disabled() {
134
- return localProps.disabled;
135
- }
136
- }, otherProps), false, false);
137
- insert(_el$4, () => localProps.children);
138
- effect((_p$) => {
139
- var _v$ = switchClasses(), _v$2 = checkedValue(), _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = checkClasses(), _v$6 = switchLabelClass({
140
- disabled: localProps.disabled
141
- });
142
- _v$ !== _p$.e && className(_el$, _p$.e = _v$);
143
- _v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
144
- _v$3 !== _p$.a && setAttribute(_el$, "aria-label", _p$.a = _v$3);
145
- _v$4 !== _p$.o && setAttribute(_el$, "aria-describedby", _p$.o = _v$4);
146
- _v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
147
- _v$6 !== _p$.n && className(_el$4, _p$.n = _v$6);
148
- return _p$;
149
- }, {
150
- e: void 0,
151
- t: void 0,
152
- a: void 0,
153
- o: void 0,
154
- i: void 0,
155
- n: void 0
156
- });
157
- return _el$;
158
- })();
159
- };
160
- var Switch_default = Switch;
161
-
162
- // src/components/switch/index.ts
163
- var switch_default = Switch_default;
164
-
165
- export { switch_default };
@@ -1,179 +0,0 @@
1
- import {
2
- cva
3
- } from "./P7WPLZNA.jsx";
4
-
5
- // src/components/pagination/Pagination.tsx
6
- import {
7
- splitProps,
8
- createMemo,
9
- Show,
10
- For
11
- } from "solid-js";
12
-
13
- // src/components/pagination/Pagination.styles.ts
14
- var paginationItemVariants = cva(
15
- [
16
- "inline-flex items-center justify-center font-medium transition-colors",
17
- "select-none border border-transparent",
18
- // border shown only when needed
19
- "disabled:opacity-50 disabled:pointer-events-none"
20
- ],
21
- {
22
- variants: {
23
- active: {
24
- true: "bg-blue-500 text-white hover:bg-blue-600",
25
- false: "bg-transparent text-gray-700 hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700"
26
- },
27
- rounded: {
28
- true: "rounded-full",
29
- false: "rounded"
30
- },
31
- simple: {
32
- true: "border-none bg-transparent hover:bg-transparent text-gray-700 dark:text-gray-300",
33
- false: ""
34
- },
35
- size: {
36
- sm: "text-xs px-2 py-1",
37
- md: "text-sm px-3 py-1.5",
38
- lg: "text-base px-4 py-2"
39
- },
40
- disabled: {
41
- true: "opacity-50 pointer-events-none",
42
- false: ""
43
- }
44
- },
45
- defaultVariants: {
46
- active: false,
47
- rounded: false,
48
- simple: false,
49
- size: "md",
50
- disabled: false
51
- }
52
- }
53
- );
54
- var paginationInfoVariants = cva(
55
- "inline-block font-medium transition-colors",
56
- {
57
- variants: {
58
- simple: {
59
- true: "text-sm text-gray-600 dark:text-gray-300 px-2",
60
- false: "text-sm text-gray-700 dark:text-gray-200 px-2"
61
- }
62
- },
63
- defaultVariants: {
64
- simple: false
65
- }
66
- }
67
- );
68
- var paginationContainerVariants = cva(
69
- "flex items-center gap-1 flex-wrap",
70
- {
71
- variants: {
72
- align: {
73
- start: "justify-start",
74
- center: "justify-center",
75
- end: "justify-end"
76
- },
77
- wrap: {
78
- true: "flex-wrap",
79
- false: "flex-nowrap"
80
- }
81
- },
82
- defaultVariants: {
83
- align: "start",
84
- wrap: true
85
- }
86
- }
87
- );
88
-
89
- // src/components/pagination/Pagination.tsx
90
- var Pagination = (props) => {
91
- const [local, variantProps, otherProps] = splitProps(
92
- props,
93
- [
94
- "total",
95
- "perPage",
96
- "current",
97
- "onChange",
98
- "rangeBefore",
99
- "rangeAfter",
100
- "simple",
101
- "children"
102
- ],
103
- ["rounded", "size", "disabled", "active", "simple"]
104
- );
105
- const perPage = () => local.perPage ?? 20;
106
- const pageCount = createMemo(() => Math.ceil(local.total / perPage()));
107
- const hasPrev = createMemo(() => local.current > 1);
108
- const hasNext = createMemo(() => local.current < pageCount());
109
- const pagesInRange = createMemo(() => {
110
- const before = local.rangeBefore ?? 1;
111
- const after = local.rangeAfter ?? 1;
112
- const start = Math.max(1, local.current - before);
113
- const end = Math.min(local.current + after, pageCount());
114
- return Array.from({ length: end - start + 1 }, (_, i) => start + i);
115
- });
116
- const changePage = (page) => {
117
- if (page >= 1 && page <= pageCount() && page !== local.current) {
118
- local.onChange(page);
119
- }
120
- };
121
- return <nav
122
- class={paginationContainerVariants({ align: "start", wrap: true })}
123
- {...otherProps}
124
- >
125
- <button
126
- class={paginationItemVariants({
127
- ...variantProps,
128
- disabled: !hasPrev()
129
- })}
130
- onClick={() => changePage(local.current - 1)}
131
- disabled={!hasPrev()}
132
- >
133
- &laquo;
134
- </button>
135
-
136
- <Show when={pageCount() > 1}>
137
- <Show when={local.simple}>
138
- <span class={paginationInfoVariants({ simple: true })}>
139
- {perPage() === 1 ? `${(local.current - 1) * perPage() + 1} / ${local.total}` : `${(local.current - 1) * perPage() + 1}-${Math.min(
140
- local.current * perPage(),
141
- local.total
142
- )} / ${local.total}`}
143
- </span>
144
- </Show>
145
-
146
- <Show when={!local.simple}>
147
- <For each={pagesInRange()}>
148
- {(page) => <button
149
- class={paginationItemVariants({
150
- ...variantProps,
151
- active: page === local.current
152
- })}
153
- onClick={() => changePage(page)}
154
- >
155
- {page}
156
- </button>}
157
- </For>
158
- </Show>
159
- </Show>
160
- <button
161
- class={paginationItemVariants({
162
- ...variantProps,
163
- disabled: !hasNext()
164
- })}
165
- onClick={() => changePage(local.current + 1)}
166
- disabled={!hasNext()}
167
- >
168
- &raquo;
169
- </button>
170
- </nav>;
171
- };
172
- var Pagination_default = Pagination;
173
-
174
- // src/components/pagination/index.ts
175
- var pagination_default = Pagination_default;
176
-
177
- export {
178
- pagination_default
179
- };
@@ -1,181 +0,0 @@
1
- import {
2
- classes,
3
- cva
4
- } from "./P7WPLZNA.jsx";
5
-
6
- // src/components/select/Select.tsx
7
- import {
8
- splitProps,
9
- Show,
10
- createMemo,
11
- untrack
12
- } from "solid-js";
13
-
14
- // src/components/select/Select.styles.ts
15
- var selectVariants = cva(
16
- [
17
- "flex items-center appearance-none",
18
- "border outline-none",
19
- "transition bg-white text-gray-700",
20
- "disabled:opacity-50 disabled:cursor-not-allowed",
21
- "pl-3"
22
- // margen izquierdo por defecto
23
- ],
24
- {
25
- variants: {
26
- size: {
27
- sm: "text-sm py-1 px-2",
28
- md: "text-base py-2 px-3",
29
- lg: "text-lg py-2 px-4"
30
- },
31
- color: {
32
- primary: "border border-gray-300 focus:border-primary",
33
- info: "border border-blue-500 focus:border-blue-600",
34
- success: "border border-green-500 focus:border-green-600",
35
- warning: "border border-yellow-500 focus:border-yellow-600",
36
- danger: "border border-red-500 focus:border-red-600"
37
- },
38
- loading: {
39
- true: "cursor-wait opacity-75",
40
- false: ""
41
- },
42
- expanded: {
43
- true: "w-full",
44
- false: "w-fit"
45
- },
46
- rounded: {
47
- true: "rounded",
48
- false: "rounded-none"
49
- }
50
- },
51
- defaultVariants: {
52
- size: "md",
53
- color: "primary",
54
- loading: false,
55
- expanded: false,
56
- rounded: false
57
- }
58
- }
59
- );
60
- var wrapperClass = "relative w-full group cursor-pointer";
61
- var selectPaddingClass = "w-full pr-8";
62
- var caretIconBaseClass = "absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors";
63
- var spinnerIconBaseClass = "absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 animate-spin pointer-events-none";
64
- var getIconColor = (color) => {
65
- switch (color) {
66
- case "success":
67
- return "text-green-500 group-hover:text-green-600";
68
- case "danger":
69
- return "text-red-500 group-hover:text-red-600";
70
- case "warning":
71
- return "text-yellow-500 group-hover:text-yellow-600";
72
- case "info":
73
- return "text-blue-500 group-hover:text-blue-600";
74
- case "primary":
75
- default:
76
- return "text-gray-500 group-hover:text-gray-700";
77
- }
78
- };
79
- var getSpinnerColor = (color) => {
80
- switch (color) {
81
- case "success":
82
- return "text-green-500";
83
- case "danger":
84
- return "text-red-500";
85
- case "warning":
86
- return "text-yellow-500";
87
- case "info":
88
- return "text-blue-500";
89
- case "primary":
90
- default:
91
- return "text-gray-500";
92
- }
93
- };
94
-
95
- // src/components/select/CaretDownIcon.tsx
96
- var CaretDownIcon = (props) => <svg
97
- class={`${caretIconBaseClass} ${props.class ?? ""}`}
98
- fill="none"
99
- stroke="currentColor"
100
- stroke-width="2"
101
- viewBox="0 0 24 24"
102
- >
103
- <path d="M6 9l6 6 6-6" />
104
- </svg>;
105
- var CaretDownIcon_default = CaretDownIcon;
106
-
107
- // src/components/select/SpinnerIcon.tsx
108
- var SpinnerIcon = (props) => <svg
109
- class={`${spinnerIconBaseClass} ${props.class ?? ""}`}
110
- xmlns="http://www.w3.org/2000/svg"
111
- fill="none"
112
- viewBox="0 0 24 24"
113
- stroke-width="2"
114
- >
115
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" />
116
- <path
117
- class="opacity-75"
118
- fill="currentColor"
119
- d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"
120
- />
121
- </svg>;
122
- var SpinnerIcon_default = SpinnerIcon;
123
-
124
- // src/components/select/Select.tsx
125
- var Select = (props) => {
126
- const [localProps, variantProps, otherProps] = splitProps(
127
- props,
128
- ["placeholder", "value", "nativeSize", "onChange", "onFocus", "onBlur"],
129
- ["class", ...selectVariants.variantKeys]
130
- );
131
- const empty = createMemo(
132
- () => untrack(() => localProps.value === null || localProps.value === void 0)
133
- );
134
- const selectClass = createMemo(
135
- () => classes(
136
- selectVariants(variantProps),
137
- variantProps.class,
138
- selectPaddingClass
139
- )
140
- );
141
- return <div class={wrapperClass}>
142
- <select
143
- class={selectClass()}
144
- size={localProps.nativeSize}
145
- value={localProps.value}
146
- onChange={localProps.onChange}
147
- onFocus={localProps.onFocus}
148
- onBlur={localProps.onBlur}
149
- {...otherProps}
150
- >
151
- <Show when={localProps.placeholder && empty()}>
152
- <option value="" disabled hidden>
153
- {localProps.placeholder}
154
- </option>
155
- </Show>
156
- {props.children}
157
- </select>
158
-
159
- <Show when={variantProps.loading}>
160
- <SpinnerIcon_default
161
- class={`${spinnerIconBaseClass} ${getSpinnerColor(
162
- variantProps.color
163
- )}`}
164
- />
165
- </Show>
166
-
167
- <Show when={!variantProps.loading}>
168
- <CaretDownIcon_default
169
- class={`${caretIconBaseClass} ${getIconColor(variantProps.color)}`}
170
- />
171
- </Show>
172
- </div>;
173
- };
174
- var Select_default = Select;
175
-
176
- // src/components/select/index.ts
177
- var select_default = Select_default;
178
-
179
- export {
180
- select_default
181
- };