@plastic-js/tsumiki 0.1.46 → 0.1.48
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.
|
@@ -5,15 +5,29 @@ import { mergeProps as mergeProps$2, splitProps } from "@plastic-js/plastic";
|
|
|
5
5
|
//#region src/components/NumberInput.jsx
|
|
6
6
|
var _tmpl2 = template("<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" width=\"12\" height=\"12\"><path d=\"M12 5v14M5 12h14\"></path></svg>");
|
|
7
7
|
var _tmpl = template("<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" width=\"12\" height=\"12\"><path d=\"M5 12h14\"></path></svg>");
|
|
8
|
-
var
|
|
8
|
+
var rootBaseClass = css({
|
|
9
9
|
display: "inline-flex",
|
|
10
10
|
alignItems: "center",
|
|
11
|
-
border: "1px solid var(--tsu-accent-8)",
|
|
12
11
|
borderRadius: "var(--tsu-radius-l1-md)",
|
|
13
|
-
|
|
14
|
-
overflow: "hidden",
|
|
15
|
-
"&:focus-within": { borderColor: "var(--tsu-focus-border)" }
|
|
12
|
+
overflow: "hidden"
|
|
16
13
|
});
|
|
14
|
+
var variantClasses = {
|
|
15
|
+
solid: css({
|
|
16
|
+
backgroundColor: "var(--tsu-surface)",
|
|
17
|
+
border: "1px solid transparent",
|
|
18
|
+
"&:focus-within": {
|
|
19
|
+
backgroundColor: "var(--tsu-focus-bg)",
|
|
20
|
+
borderColor: "var(--tsu-focus-border)"
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
outline: css({
|
|
24
|
+
border: "1px solid var(--tsu-accent-8)",
|
|
25
|
+
"&:focus-within": {
|
|
26
|
+
backgroundColor: "var(--tsu-focus-bg)",
|
|
27
|
+
borderColor: "var(--tsu-focus-border)"
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
};
|
|
17
31
|
var disabledClass = css({
|
|
18
32
|
borderColor: "var(--tsu-disabled-border)",
|
|
19
33
|
"& *": { color: "var(--tsu-disabled-fg)" }
|
|
@@ -75,21 +89,25 @@ var read = (v) => typeof v === "function" ? v() : v;
|
|
|
75
89
|
var NumberInput$1 = (props = {}) => {
|
|
76
90
|
const [local, rest] = splitProps(mergeProps$2({
|
|
77
91
|
size: "md",
|
|
92
|
+
solid: false,
|
|
78
93
|
disabled: false
|
|
79
94
|
}, props), [
|
|
80
95
|
"size",
|
|
96
|
+
"solid",
|
|
81
97
|
"disabled",
|
|
82
98
|
"className",
|
|
83
99
|
"children"
|
|
84
100
|
]);
|
|
85
101
|
return () => {
|
|
86
102
|
const size = read(local.size);
|
|
103
|
+
const solid = read(local.solid);
|
|
87
104
|
const disabled = read(local.disabled);
|
|
88
105
|
return jsx(NumberInput.Root, mergeProps(rest, {
|
|
89
106
|
disabled,
|
|
90
107
|
get className() {
|
|
91
108
|
return [
|
|
92
|
-
|
|
109
|
+
rootBaseClass,
|
|
110
|
+
variantClasses[solid ? "solid" : "outline"],
|
|
93
111
|
sizeClasses[size],
|
|
94
112
|
disabled && disabledClass,
|
|
95
113
|
local.className
|
|
@@ -16,15 +16,13 @@ var chevronDownSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" hei
|
|
|
16
16
|
var checkSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>";
|
|
17
17
|
var searchSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"M21 21l-4.35-4.35\"/></svg>";
|
|
18
18
|
var xSvg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>";
|
|
19
|
-
var
|
|
19
|
+
var triggerBaseClass = css({
|
|
20
20
|
flexShrink: 0,
|
|
21
21
|
width: "100%",
|
|
22
22
|
display: "flex",
|
|
23
23
|
alignItems: "center",
|
|
24
24
|
justifyContent: "space-between",
|
|
25
25
|
gap: "4px",
|
|
26
|
-
background: "var(--tsu-surface)",
|
|
27
|
-
border: "1px solid var(--tsu-accent-8)",
|
|
28
26
|
color: "var(--tsu-fg)",
|
|
29
27
|
fontFamily: "inherit",
|
|
30
28
|
textAlign: "left",
|
|
@@ -39,6 +37,13 @@ var triggerClass = css({
|
|
|
39
37
|
cursor: "not-allowed"
|
|
40
38
|
}
|
|
41
39
|
});
|
|
40
|
+
var triggerVariants = {
|
|
41
|
+
solid: css({
|
|
42
|
+
backgroundColor: "var(--tsu-surface)",
|
|
43
|
+
border: "1px solid transparent"
|
|
44
|
+
}),
|
|
45
|
+
outline: css({ border: "1px solid var(--tsu-accent-8)" })
|
|
46
|
+
};
|
|
42
47
|
var sizeClasses = {
|
|
43
48
|
xs: css({
|
|
44
49
|
height: "var(--tsu-comp-height-xs)",
|
|
@@ -192,7 +197,10 @@ var read = (source) => {
|
|
|
192
197
|
return typeof source === "function" ? source() : source;
|
|
193
198
|
};
|
|
194
199
|
var Select = (props) => {
|
|
195
|
-
const [local, rest] = splitProps(mergeProps$1({
|
|
200
|
+
const [local, rest] = splitProps(mergeProps$1({
|
|
201
|
+
size: "md",
|
|
202
|
+
solid: false
|
|
203
|
+
}, props), [
|
|
196
204
|
"value",
|
|
197
205
|
"onValueChange",
|
|
198
206
|
"items",
|
|
@@ -205,7 +213,8 @@ var Select = (props) => {
|
|
|
205
213
|
"size",
|
|
206
214
|
"backdropClassName",
|
|
207
215
|
"backdropStyle",
|
|
208
|
-
"filter"
|
|
216
|
+
"filter",
|
|
217
|
+
"solid"
|
|
209
218
|
]);
|
|
210
219
|
const open = (v) => {
|
|
211
220
|
if (v === void 0) return read(local.open);
|
|
@@ -258,6 +267,7 @@ var Select = (props) => {
|
|
|
258
267
|
setValue,
|
|
259
268
|
disabled: () => local.disabled ?? false,
|
|
260
269
|
size: () => read(local.size),
|
|
270
|
+
solid: () => read(local.solid),
|
|
261
271
|
backdropClassName: local.backdropClassName,
|
|
262
272
|
backdropStyle: local.backdropStyle,
|
|
263
273
|
filter: local.filter,
|
|
@@ -278,7 +288,7 @@ var SelectTrigger = (props) => {
|
|
|
278
288
|
]);
|
|
279
289
|
return jsx("div", mergeProps(() => part("trigger"), {
|
|
280
290
|
get className() {
|
|
281
|
-
return `${
|
|
291
|
+
return `${triggerBaseClass} ${triggerVariants[ctx.solid() ? "solid" : "outline"]} ${sizeClasses[ctx.size()] || ""} ${local.className || ""}`;
|
|
282
292
|
},
|
|
283
293
|
"data-disabled": () => ctx.disabled() ? "" : void 0,
|
|
284
294
|
onClick: () => {
|
package/docs/api.md
CHANGED
|
@@ -137,6 +137,7 @@ Currency-formatted numeric input.
|
|
|
137
137
|
| Prop | Type | Default | Description |
|
|
138
138
|
|---|---|---|---|
|
|
139
139
|
| `size` | `string` | `md` | See size values. |
|
|
140
|
+
| `solid` | `boolean` | `false` | Filled background instead of outlined. |
|
|
140
141
|
| `disabled` | `boolean` | `false` | Disabled. |
|
|
141
142
|
| `children` | `node` | — | Custom triggers, if any. |
|
|
142
143
|
|
|
@@ -329,6 +330,7 @@ Mobile-optimized bottom-sheet select (draggable sheet overlay).
|
|
|
329
330
|
| `open` | `(() => boolean)` | — | **Required** controlled open state. |
|
|
330
331
|
| `onOpenChange` | `(open) => void` | — | Open/close callback. |
|
|
331
332
|
| `disabled` | `boolean` | `false` | Disabled. |
|
|
333
|
+
| `solid` | `boolean` | `false` | Filled trigger variant instead of outline. |
|
|
332
334
|
| `filter` | `(item, query, itemToLabel) => boolean` | — | Custom filter for the search box. |
|
|
333
335
|
| `placeholder` | `string` | — | Trigger placeholder. |
|
|
334
336
|
| `backdropClassName` | `string` | — | Backdrop class. |
|