@plastic-js/tsumiki 0.1.47 → 0.1.49

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.
package/README.md CHANGED
@@ -487,6 +487,11 @@ const intentClasses = {
487
487
  '--_btn-solid-active': 'var(--tsu-accent-8)',
488
488
  '--_btn-border': 'var(--tsu-accent-9)',
489
489
  }),
490
+ neutral: css({
491
+ '--_btn-solid': 'var(--tsu-neutral-9)',
492
+ '--_btn-solid-active': 'var(--tsu-neutral-8)',
493
+ '--_btn-border': 'var(--tsu-neutral-9)',
494
+ }),
490
495
  danger: css({
491
496
  '--_btn-solid': 'var(--tsu-danger-9)',
492
497
  '--_btn-solid-active': 'var(--tsu-danger-8)',
@@ -495,6 +500,8 @@ const intentClasses = {
495
500
  }
496
501
  ```
497
502
 
503
+ `intent` takes one of `'default' | 'neutral' | 'danger'` (selected via a single prop, not booleans). `neutral` is only valid on the outline variant — when combined with `solid` it is ignored and falls back to `default`.
504
+
498
505
  ### 5.5 Class Name Composition (Reactive)
499
506
 
500
507
  ```js
@@ -89,6 +89,13 @@ var intentClasses = {
89
89
  "--_btn-border-active": "var(--tsu-accent-10)",
90
90
  "--_btn-tint-bg": "var(--tsu-accent-3)"
91
91
  }),
92
+ neutral: css({
93
+ "--_btn-solid": "var(--tsu-neutral-9)",
94
+ "--_btn-solid-active": "var(--tsu-neutral-8)",
95
+ "--_btn-border": "var(--tsu-neutral-6)",
96
+ "--_btn-border-active": "var(--tsu-neutral-7)",
97
+ "--_btn-tint-bg": "var(--tsu-neutral-3)"
98
+ }),
92
99
  danger: css({
93
100
  "--_btn-solid": "var(--tsu-danger-9)",
94
101
  "--_btn-solid-active": "var(--tsu-danger-8)",
@@ -124,14 +131,14 @@ var loadingClass = css({ pointerEvents: "none" });
124
131
  var read = (v) => typeof v === "function" ? v() : v;
125
132
  var Button = (props = {}) => {
126
133
  const [local, rest] = splitProps(mergeProps$1({
134
+ intent: "default",
127
135
  solid: false,
128
- danger: false,
129
136
  size: "md",
130
137
  disabled: false,
131
138
  loading: false
132
139
  }, props), [
140
+ "intent",
133
141
  "solid",
134
- "danger",
135
142
  "size",
136
143
  "loading",
137
144
  "disabled",
@@ -148,10 +155,10 @@ var Button = (props = {}) => {
148
155
  className: () => {
149
156
  const size = read(local.size);
150
157
  const solid = read(local.solid);
151
- const danger = read(local.danger);
152
158
  const loading = read(local.loading);
153
159
  const variant = solid ? "solid" : "outline";
154
- const intent = danger ? "danger" : "default";
160
+ let intent = read(local.intent);
161
+ if (intent === "neutral" && solid) intent = "default";
155
162
  return [
156
163
  baseClass,
157
164
  sizeClasses[size],
@@ -27,8 +27,6 @@ var CardNumberInput = (props) => {
27
27
  "placeholder"
28
28
  ]);
29
29
  return jsx(Input, mergeProps({
30
- size: "lg",
31
- solid: true,
32
30
  get invalid() {
33
31
  return local.invalid;
34
32
  },
@@ -14,7 +14,7 @@ var messageBodyClass = css({
14
14
  var DEFAULT_PROPS = {
15
15
  confirmText: "Confirm",
16
16
  cancelText: "Cancel",
17
- danger: false,
17
+ intent: "default",
18
18
  loading: false,
19
19
  title: "Confirm"
20
20
  };
@@ -30,7 +30,7 @@ function ConfirmDialog(props) {
30
30
  "message",
31
31
  "confirmText",
32
32
  "cancelText",
33
- "danger"
33
+ "intent"
34
34
  ]);
35
35
  const handleConfirm = () => {
36
36
  local.onConfirm?.();
@@ -42,8 +42,8 @@ function ConfirmDialog(props) {
42
42
  get confirmText() {
43
43
  return local.confirmText;
44
44
  },
45
- get danger() {
46
- return local.danger;
45
+ get intent() {
46
+ return local.intent;
47
47
  },
48
48
  get loading() {
49
49
  return local.loading;
@@ -124,8 +124,8 @@ function ensureInit() {
124
124
  get cancelText() {
125
125
  return s.cancelText || "Cancel";
126
126
  },
127
- get danger() {
128
- return s.danger || false;
127
+ get intent() {
128
+ return s.intent || "default";
129
129
  },
130
130
  get title() {
131
131
  return s.title || "Confirm";
@@ -152,7 +152,7 @@ function ensureInit() {
152
152
  * title: 'Delete Item',
153
153
  * message: 'This action cannot be undone.',
154
154
  * confirmText: 'Delete',
155
- * danger: true,
155
+ * intent: 'danger',
156
156
  * })
157
157
  * } catch (err) {
158
158
  * if (err.code === 'CANCEL') { ... }
@@ -164,7 +164,7 @@ function ensureInit() {
164
164
  * message?: string,
165
165
  * confirmText?: string,
166
166
  * cancelText?: string,
167
- * danger?: boolean,
167
+ * intent?: 'default' | 'neutral' | 'danger',
168
168
  * noCancel?: boolean
169
169
  * }} options
170
170
  * @returns {Promise<void>}
@@ -172,7 +172,7 @@ var Dialog$1 = (props) => {
172
172
  cancelText: "Cancel",
173
173
  confirmText: "Confirm",
174
174
  loading: false,
175
- danger: false,
175
+ intent: "default",
176
176
  closeable: true,
177
177
  lazyMount: true,
178
178
  unmountOnExit: true,
@@ -192,7 +192,7 @@ var Dialog$1 = (props) => {
192
192
  "onCancel",
193
193
  "onConfirm",
194
194
  "loading",
195
- "danger",
195
+ "intent",
196
196
  "closeable",
197
197
  "lazyMount",
198
198
  "unmountOnExit",
@@ -241,8 +241,8 @@ var Dialog$1 = (props) => {
241
241
  insert(_el0, () => local.showConfirm && jsx(Button, mergeProps({
242
242
  className: positiveBtnClass,
243
243
  "data-part": "positive-trigger",
244
- get danger() {
245
- return local.danger;
244
+ get intent() {
245
+ return local.intent;
246
246
  },
247
247
  get loading() {
248
248
  return read(local.loading);
@@ -65,7 +65,7 @@ var variantClasses = {
65
65
  }
66
66
  }),
67
67
  outline: css({
68
- border: "1px solid var(--tsu-accent-8)",
68
+ border: "1px solid var(--_input-border, var(--tsu-accent-8))",
69
69
  color: "var(--tsu-fg)",
70
70
  "&:focus-within": {
71
71
  backgroundColor: "var(--tsu-focus-bg)",
@@ -73,6 +73,11 @@ var variantClasses = {
73
73
  }
74
74
  })
75
75
  };
76
+ var intentClasses = {
77
+ default: css({ "--_input-border": "var(--tsu-accent-8)" }),
78
+ neutral: css({ "--_input-border": "var(--tsu-neutral-6)" }),
79
+ danger: css({ "--_input-border": "var(--tsu-danger-9)" })
80
+ };
76
81
  var errorClass = css({
77
82
  borderColor: "var(--tsu-danger-9) !important",
78
83
  "&:focus-within": { borderColor: "var(--tsu-danger-9) !important" }
@@ -136,11 +141,13 @@ var eyeButtonClass = css({
136
141
  var read = (v) => typeof v === "function" ? v() : v;
137
142
  var Input = (props = {}) => {
138
143
  const [local, rest] = splitProps(mergeProps$2({
144
+ intent: "default",
139
145
  solid: false,
140
146
  size: "md",
141
147
  disabled: false,
142
148
  invalid: false
143
149
  }, props), [
150
+ "intent",
144
151
  "solid",
145
152
  "size",
146
153
  "disabled",
@@ -161,16 +168,22 @@ var Input = (props = {}) => {
161
168
  const fieldDisabled = () => field?.disabled?.() ?? false;
162
169
  const effectiveInvalid = () => read(local.invalid) || fieldInvalid();
163
170
  const effectiveDisabled = () => read(local.disabled) || fieldDisabled();
164
- const wrapperClassName = () => [
165
- wrapperClass,
166
- sizeClasses[read(local.size)],
167
- read(local.solid) ? variantClasses.solid : variantClasses.outline,
168
- effectiveInvalid() && errorClass,
169
- effectiveDisabled() && disabledClass,
170
- hasPrefix() && hasPrefixClass,
171
- hasSuffix() && hasSuffixClass,
172
- read(local.className)
173
- ].filter(Boolean).join(" ");
171
+ const wrapperClassName = () => {
172
+ const solid = read(local.solid);
173
+ let intent = read(local.intent);
174
+ if (intent === "neutral" && solid) intent = "default";
175
+ return [
176
+ wrapperClass,
177
+ sizeClasses[read(local.size)],
178
+ solid ? variantClasses.solid : variantClasses.outline,
179
+ intentClasses[intent],
180
+ effectiveInvalid() && errorClass,
181
+ effectiveDisabled() && disabledClass,
182
+ hasPrefix() && hasPrefixClass,
183
+ hasSuffix() && hasSuffixClass,
184
+ read(local.className)
185
+ ].filter(Boolean).join(" ");
186
+ };
174
187
  const inputType = () => {
175
188
  if (!isPassword) return read(local.type);
176
189
  return showPassword() ? "text" : "password";
@@ -29,8 +29,6 @@ var MoneyInput = (props) => {
29
29
  "disabled"
30
30
  ]);
31
31
  return jsx(Input, mergeProps({
32
- size: "lg",
33
- solid: true,
34
32
  get invalid() {
35
33
  return local.invalid;
36
34
  },
@@ -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 rootClass = css({
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
- backgroundColor: "var(--tsu-surface)",
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
- rootClass,
109
+ rootBaseClass,
110
+ variantClasses[solid ? "solid" : "outline"],
93
111
  sizeClasses[size],
94
112
  disabled && disabledClass,
95
113
  local.className
@@ -49,8 +49,6 @@ var SearchInput = (props) => {
49
49
  inputEl = el;
50
50
  },
51
51
  type: "search",
52
- size: "lg",
53
- solid: true,
54
52
  get placeholder() {
55
53
  return local.placeholder ?? "Search...";
56
54
  },
package/docs/api.md CHANGED
@@ -91,6 +91,7 @@ Passthrough: Ark `Fieldset.Root` props (`disabled`, `invalid`, …).
91
91
  | Prop | Type | Default | Description |
92
92
  |---|---|---|---|
93
93
  | `solid` | `boolean` | `false` | Filled background instead of outlined. |
94
+ | `intent` | `string` | `'default'` | Border intent (`'default'`, `'neutral'`, `'danger'`). `neutral` applies only to the outline variant (ignored when `solid`). |
94
95
  | `size` | `string` | `md` | See size values. |
95
96
  | `disabled` | `boolean` | `false` | Disables the input. |
96
97
  | `invalid` | `boolean` | `false` | Renders the error/invalid style. |
@@ -137,6 +138,7 @@ Currency-formatted numeric input.
137
138
  | Prop | Type | Default | Description |
138
139
  |---|---|---|---|
139
140
  | `size` | `string` | `md` | See size values. |
141
+ | `solid` | `boolean` | `false` | Filled background instead of outlined. |
140
142
  | `disabled` | `boolean` | `false` | Disabled. |
141
143
  | `children` | `node` | — | Custom triggers, if any. |
142
144
 
@@ -218,7 +220,7 @@ Passthrough: Ark `Root` props (`value`, `onValueChange`, …).
218
220
  | Prop | Type | Default | Description |
219
221
  |---|---|---|---|
220
222
  | `solid` | `boolean` | `false` | Filled (solid) variant instead of outline. |
221
- | `danger` | `boolean` | `false` | Destructive (red) variant. |
223
+ | `intent` | `string` | `'default'` | `'default'`, `'neutral'`, or `'danger'`. `neutral` applies only to the outline variant (ignored when `solid`). |
222
224
  | `size` | `string` | `md` | See size values. |
223
225
  | `disabled` | `boolean` | `false` | Disabled. |
224
226
  | `loading` | `boolean` | `false` | Shows a spinner and blocks interaction. |
@@ -663,7 +665,7 @@ Passthrough: Ark `Root` props (`value`, `min`, `max`, …).
663
665
  | `onCancel` | `() => void` | — | Cancel callback. |
664
666
  | `onConfirm` | `() => void` | — | Confirm callback. |
665
667
  | `loading` | `boolean` | `false` | Confirm button shows a spinner. |
666
- | `danger` | `boolean` | `false` | Confirm button uses the danger style. |
668
+ | `intent` | `string` | `'default'` | Confirm button intent (`'default'`, `'neutral'`, `'danger'`). |
667
669
  | `closeable` | `boolean` | `true` | Show the close (✕) trigger. |
668
670
  | `lazyMount` | `boolean` | `true` | Mount content lazily. |
669
671
  | `unmountOnExit` | `boolean` | `true` | Unmount content when closed. |
@@ -703,12 +705,12 @@ Imperative + declarative confirm dialog built on `Dialog`.
703
705
  | `message` | `string` | — | Body message. |
704
706
  | `confirmText` | `string` | — | Confirm button label. |
705
707
  | `cancelText` | `string` | — | Cancel button label. |
706
- | `danger` | `boolean` | `false` | Danger-styled confirm button. |
708
+ | `intent` | `string` | `'default'` | Confirm button intent (`'default'`, `'neutral'`, `'danger'`). |
707
709
 
708
710
  Imperative API:
709
711
 
710
712
  ```js
711
- await confirm({ title, message, danger, confirmText })
713
+ await confirm({ title, message, intent, confirmText })
712
714
  // resolves true/false
713
715
  ```
714
716
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plastic-js/tsumiki",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "A UI component library for Plastic JS.",
5
5
  "license": "MIT",
6
6
  "author": "tigre",