@rockshin/tao-ui 0.0.42 → 0.0.43

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 (97) hide show
  1. package/README.md +7 -1
  2. package/component-manifest.json +34 -17
  3. package/dist/components/alert/alert.css +1 -0
  4. package/dist/components/avatar/avatar.js +1 -1
  5. package/dist/components/calendar/calendar.css +10 -60
  6. package/dist/components/calendar/calendar.js +46 -43
  7. package/dist/components/card/card.css +1 -1
  8. package/dist/components/carousel/carousel.css +1 -0
  9. package/dist/components/carousel/carousel.js +62 -7
  10. package/dist/components/collapse/collapse-panels.d.ts +4 -0
  11. package/dist/components/collapse/collapse-panels.js +413 -0
  12. package/dist/components/collapse/collapse.css +199 -0
  13. package/dist/components/collapse/collapse.d.ts +77 -0
  14. package/dist/components/{collapsible/collapsible.js → collapse/collapse.js} +26 -10
  15. package/dist/components/color-picker/color-picker.css +8 -42
  16. package/dist/components/color-picker/color-picker.js +220 -145
  17. package/dist/components/date-picker/date-picker.css +18 -56
  18. package/dist/components/date-picker/date-picker.d.ts +2 -0
  19. package/dist/components/date-picker/date-picker.js +11 -6
  20. package/dist/components/date-picker/presets.js +5 -2
  21. package/dist/components/date-picker/range-picker.d.ts +2 -0
  22. package/dist/components/date-picker/range-picker.js +3 -1
  23. package/dist/components/form/form-item.js +1 -0
  24. package/dist/components/form/form.css +15 -0
  25. package/dist/components/form/form.js +1 -0
  26. package/dist/components/form-field/form-field-view.d.ts +3 -1
  27. package/dist/components/form-field/form-field-view.js +109 -84
  28. package/dist/components/input/base-input.d.ts +25 -0
  29. package/dist/components/input/base-input.js +104 -0
  30. package/dist/components/input/input-shared.css +75 -0
  31. package/dist/components/input/input-shared.d.ts +59 -0
  32. package/dist/components/input/input-shared.js +152 -0
  33. package/dist/components/input/input.css +99 -4
  34. package/dist/components/input/input.d.ts +12 -16
  35. package/dist/components/input/input.js +11 -154
  36. package/dist/components/input/otp.d.ts +29 -0
  37. package/dist/components/input/otp.js +335 -0
  38. package/dist/components/input/password.d.ts +12 -0
  39. package/dist/components/input/password.js +117 -0
  40. package/dist/components/input/search.d.ts +16 -0
  41. package/dist/components/input/search.js +99 -0
  42. package/dist/components/input-number/input-number.d.ts +2 -2
  43. package/dist/components/input-number/input-number.js +2 -2
  44. package/dist/components/list/list-pagination.css +5 -5
  45. package/dist/components/list/list-pagination.js +1 -0
  46. package/dist/components/mentions/mentions.css +7 -0
  47. package/dist/components/modal/modal.css +1 -0
  48. package/dist/components/radio/radio.d.ts +1 -1
  49. package/dist/components/radio/radio.js +78 -73
  50. package/dist/components/select/mobile-select.css +1 -16
  51. package/dist/components/select/mobile-select.d.ts +2 -1
  52. package/dist/components/select/mobile-select.js +68 -63
  53. package/dist/components/select/select-types.d.ts +2 -0
  54. package/dist/components/select/select.css +19 -0
  55. package/dist/components/select/select.js +31 -17
  56. package/dist/components/spinner/spinner.css +1 -1
  57. package/dist/components/steps/steps.css +53 -3
  58. package/dist/components/table/table.css +0 -5
  59. package/dist/components/table/table.js +21 -22
  60. package/dist/components/textarea/textarea.css +20 -0
  61. package/dist/components/textarea/textarea.d.ts +12 -6
  62. package/dist/components/textarea/textarea.js +120 -219
  63. package/dist/components/time-picker/time-picker.css +7 -0
  64. package/dist/components/tree/tree-check.d.ts +1 -0
  65. package/dist/components/tree/tree-check.js +36 -0
  66. package/dist/components/tree/tree.css +13 -18
  67. package/dist/components/tree/tree.js +2 -3
  68. package/dist/components/tree-select/select-engine.css +7 -0
  69. package/dist/components/tree-select/tree-select.js +2 -3
  70. package/dist/components/upload/upload.css +0 -11
  71. package/dist/components/upload/upload.js +13 -3
  72. package/dist/docs/component-docs.js +2 -2
  73. package/dist/docs/components/{collapsible.doc.d.ts → collapse.doc.d.ts} +1 -1
  74. package/dist/docs/components/collapse.doc.js +47 -0
  75. package/dist/docs/components/input.doc.js +11 -4
  76. package/dist/docs/components/textarea.doc.js +4 -2
  77. package/dist/entries/collapse.d.ts +3 -0
  78. package/dist/entries/{collapsible.js → collapse.js} +1 -1
  79. package/dist/entries/input.d.ts +1 -1
  80. package/dist/entries/textarea.d.ts +1 -1
  81. package/dist/index.d.ts +3 -3
  82. package/dist/index.js +1 -1
  83. package/dist/provider/locale.d.ts +6 -0
  84. package/dist/provider/locale.js +10 -0
  85. package/dist/provider/tao-provider.js +1 -0
  86. package/dist/theme/control.css +2 -2
  87. package/dist/theme/theme.css +3 -1
  88. package/dist/theme/tokens.d.ts +2 -2
  89. package/dist/theme/tokens.js +1 -0
  90. package/dist/utils/field-label.d.ts +4 -0
  91. package/dist/utils/field-label.js +7 -0
  92. package/llms.txt +18 -15
  93. package/package.json +7 -4
  94. package/dist/components/collapsible/collapsible.css +0 -49
  95. package/dist/components/collapsible/collapsible.d.ts +0 -39
  96. package/dist/docs/components/collapsible.doc.js +0 -39
  97. package/dist/entries/collapsible.d.ts +0 -3
@@ -3,10 +3,26 @@ import { c } from "react-compiler-runtime";
3
3
  import { createContext, useContext, useState } from "react";
4
4
  import { useTaoConfig } from "../../provider/tao-provider.js";
5
5
  import { cx } from "../../utils/semantic.js";
6
- import "./collapsible.css";
6
+ import { CollapsePanels } from "./collapse-panels.js";
7
+ import "./collapse.css";
7
8
  import * as __rspack_external__radix_ui_react_collapsible_4aef300f from "@radix-ui/react-collapsible";
8
9
  const Ctx = /*#__PURE__*/ createContext({});
9
- function Collapsible(props) {
10
+ function Collapse(props) {
11
+ const $ = c(2);
12
+ let t0;
13
+ if ($[0] !== props) {
14
+ t0 = props.items ? /*#__PURE__*/ jsx(CollapsePanels, {
15
+ ...props,
16
+ items: props.items
17
+ }) : /*#__PURE__*/ jsx(CollapseRoot, {
18
+ ...props
19
+ });
20
+ $[0] = props;
21
+ $[1] = t0;
22
+ } else t0 = $[1];
23
+ return t0;
24
+ }
25
+ function CollapseRoot(props) {
10
26
  const $ = c(22);
11
27
  const { open, defaultOpen, onOpenChange, disabled, children, className, style, classNames, styles } = props;
12
28
  const { disabled: ctxDisabled } = useTaoConfig();
@@ -60,7 +76,7 @@ function Collapsible(props) {
60
76
  open: realOpen,
61
77
  onOpenChange: setOpen,
62
78
  disabled: resolvedDisabled,
63
- "data-tao-collapsible": "",
79
+ "data-tao-collapse": "",
64
80
  className: t3,
65
81
  style: t5,
66
82
  children: children
@@ -85,7 +101,7 @@ function Collapsible(props) {
85
101
  } else t7 = $[21];
86
102
  return t7;
87
103
  }
88
- function CollapsibleTrigger(props) {
104
+ function CollapseTrigger(props) {
89
105
  const $ = c(11);
90
106
  const { children, asChild, className, style } = props;
91
107
  const { classNames, styles } = useContext(Ctx);
@@ -112,7 +128,7 @@ function CollapsibleTrigger(props) {
112
128
  if ($[6] !== asChild || $[7] !== children || $[8] !== t1 || $[9] !== t3) {
113
129
  t4 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_collapsible_4aef300f.Trigger, {
114
130
  asChild: asChild,
115
- "data-tao-collapsible-trigger": "",
131
+ "data-tao-collapse-trigger": "",
116
132
  className: t1,
117
133
  style: t3,
118
134
  children: children
@@ -125,7 +141,7 @@ function CollapsibleTrigger(props) {
125
141
  } else t4 = $[10];
126
142
  return t4;
127
143
  }
128
- function CollapsibleContent(props) {
144
+ function CollapseContent(props) {
129
145
  const $ = c(10);
130
146
  const { children, className, style } = props;
131
147
  const { classNames, styles } = useContext(Ctx);
@@ -151,7 +167,7 @@ function CollapsibleContent(props) {
151
167
  let t4;
152
168
  if ($[6] !== children || $[7] !== t1 || $[8] !== t3) {
153
169
  t4 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_collapsible_4aef300f.Content, {
154
- "data-tao-collapsible-content": "",
170
+ "data-tao-collapse-content": "",
155
171
  className: t1,
156
172
  style: t3,
157
173
  children: children
@@ -163,6 +179,6 @@ function CollapsibleContent(props) {
163
179
  } else t4 = $[9];
164
180
  return t4;
165
181
  }
166
- Collapsible.Trigger = CollapsibleTrigger;
167
- Collapsible.Content = CollapsibleContent;
168
- export { Collapsible };
182
+ Collapse.Trigger = CollapseTrigger;
183
+ Collapse.Content = CollapseContent;
184
+ export { Collapse };
@@ -87,23 +87,6 @@
87
87
  display: flex;
88
88
  }
89
89
 
90
- [data-tao-color-picker-controls] :is(input, select) {
91
- box-sizing: border-box;
92
- min-width: 0;
93
- min-height: var(--tao-control-height-sm);
94
- border: 1px solid var(--tao-color-border);
95
- border-radius: var(--tao-radius-sm);
96
- background: var(--tao-color-bg-container);
97
- color: inherit;
98
- font: inherit;
99
- padding: 3px 4px;
100
- }
101
-
102
- [data-tao-color-picker-controls] input[type="range"] {
103
- accent-color: var(--tao-primary);
104
- padding: 0;
105
- }
106
-
107
90
  [data-tao-color-inputs] {
108
91
  align-items: flex-end;
109
92
  gap: 4px;
@@ -111,14 +94,9 @@
111
94
  display: flex;
112
95
  }
113
96
 
114
- [data-tao-color-inputs] > input {
97
+ [data-tao-color-inputs] > [data-tao-input] {
115
98
  flex: 1;
116
- width: 100%;
117
- }
118
-
119
- [data-tao-color-inputs] > select {
120
- flex-shrink: 0;
121
- width: 58px;
99
+ min-width: 0;
122
100
  }
123
101
 
124
102
  [data-tao-color-field] {
@@ -129,7 +107,7 @@
129
107
  display: flex;
130
108
  }
131
109
 
132
- [data-tao-color-field] > span {
110
+ [data-tao-color-field] > span:not([data-tao-input]) {
133
111
  text-overflow: ellipsis;
134
112
  font-size: 10px;
135
113
  overflow: hidden;
@@ -145,13 +123,7 @@
145
123
  }
146
124
 
147
125
  [data-tao-color-clear] {
148
- color: var(--tao-color-text-secondary);
149
- font: inherit;
150
- cursor: pointer;
151
- background: none;
152
- border: 0;
153
126
  align-self: flex-start;
154
- padding: 0;
155
127
  }
156
128
 
157
129
  [data-tao-color-popup] [class$="-select"] {
@@ -242,7 +214,7 @@
242
214
  display: flex;
243
215
  }
244
216
 
245
- [data-tao-color-stop-list] button, [data-tao-color-presets] button {
217
+ [data-tao-color-stop-list] button, [data-tao-color-swatches] button {
246
218
  border: 1px solid var(--tao-color-border);
247
219
  border-radius: var(--tao-radius-sm);
248
220
  width: 24px;
@@ -264,30 +236,24 @@
264
236
  display: flex;
265
237
  }
266
238
 
267
- [data-tao-color-stop-position] input {
239
+ [data-tao-color-stop-position] > [data-tao-slider] {
268
240
  flex: 1;
269
- min-width: 0;
270
241
  }
271
242
 
272
- [data-tao-color-presets] details {
243
+ [data-tao-color-presets] {
273
244
  border-top: 1px solid var(--tao-color-border-secondary);
274
245
  margin-top: 12px;
275
246
  padding-top: 10px;
276
247
  }
277
248
 
278
- [data-tao-color-presets] summary {
279
- cursor: pointer;
280
- color: var(--tao-color-text-secondary);
281
- }
282
-
283
- [data-tao-color-presets] details > div {
249
+ [data-tao-color-swatches] {
284
250
  flex-wrap: wrap;
285
251
  gap: 8px;
286
252
  margin-top: 8px;
287
253
  display: flex;
288
254
  }
289
255
 
290
- [data-tao-color-picker] button:focus-visible, [data-tao-color-popup] :is(input, select, button, summary):focus-visible {
256
+ [data-tao-color-picker] button:focus-visible, [data-tao-color-popup] button:not([data-tao-button]):focus-visible {
291
257
  outline: 2px solid var(--tao-primary);
292
258
  outline-offset: 2px;
293
259
  }
@@ -1,9 +1,15 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import color_picker, { Color } from "@rc-component/color-picker";
4
- import { createContext, isValidElement, useContext, useEffect, useRef, useState } from "react";
4
+ import { createContext, isValidElement, useContext, useEffect, useId, useRef, useState } from "react";
5
5
  import { TaoPortalScope, useTaoConfig } from "../../provider/tao-provider.js";
6
6
  import { cx } from "../../utils/semantic.js";
7
+ import { Button } from "../button/button.js";
8
+ import { Collapse } from "../collapse/collapse.js";
9
+ import { BaseInput } from "../input/base-input.js";
10
+ import { Segmented } from "../segmented/segmented.js";
11
+ import { Select } from "../select/select.js";
12
+ import { Slider } from "../slider/slider.js";
7
13
  import { Color as external_color_js_Color } from "./color.js";
8
14
  import "./color-picker.css";
9
15
  import { interopDefault } from "../../utils/interop-default.js";
@@ -20,7 +26,8 @@ function colorKeys() {
20
26
  };
21
27
  }
22
28
  function PickerPanel() {
23
- const $ = c(23);
29
+ const $ = c(28);
30
+ const fieldId = useId();
24
31
  const keyForColor = colorKeys();
25
32
  const panel = useContext(PanelContext);
26
33
  const { value, active, props, mode, modes, setMode, format, setFormat, chinese } = panel;
@@ -46,73 +53,132 @@ function PickerPanel() {
46
53
  const complete = void 0 === t1 ? true : t1;
47
54
  return panel.change(replace(next_0), complete);
48
55
  };
49
- const numberInput = _temp;
56
+ let t2;
57
+ if ($[2] !== fieldId) {
58
+ t2 = (label, number, max, change, t3)=>{
59
+ const step = void 0 === t3 ? 1 : t3;
60
+ return /*#__PURE__*/ jsxs("label", {
61
+ "data-tao-color-field": "",
62
+ htmlFor: `${fieldId}-${label}`,
63
+ children: [
64
+ /*#__PURE__*/ jsx("span", {
65
+ children: label
66
+ }),
67
+ /*#__PURE__*/ jsx(BaseInput, {
68
+ id: `${fieldId}-${label}`,
69
+ size: "small",
70
+ disabled: false,
71
+ type: "number",
72
+ "aria-label": label,
73
+ min: 0,
74
+ max: max,
75
+ step: step,
76
+ value: number,
77
+ onChange: (event)=>{
78
+ if ("" !== event.target.value) change(clamp(Number(event.target.value), max));
79
+ }
80
+ })
81
+ ]
82
+ });
83
+ };
84
+ $[2] = fieldId;
85
+ $[3] = t2;
86
+ } else t2 = $[3];
87
+ const numberInput = t2;
50
88
  const rgb = selected.toRgb();
51
89
  const hsb = selected.toHsb();
52
90
  const prefix = props.prefixCls ?? "tao-color-engine";
53
- let t2;
54
- if ($[2] !== chinese || $[3] !== mode || $[4] !== modes.length || $[5] !== setMode) {
55
- t2 = modes.length > 1 && /*#__PURE__*/ jsxs("select", {
91
+ let t3;
92
+ if ($[4] !== chinese || $[5] !== mode || $[6] !== modes.length || $[7] !== setMode) {
93
+ t3 = modes.length > 1 && /*#__PURE__*/ jsx(Segmented, {
56
94
  "aria-label": chinese ? "\u989C\u8272\u6A21\u5F0F" : "Color mode",
95
+ size: "small",
96
+ disabled: false,
57
97
  value: mode,
58
- onChange: (event_0)=>setMode(event_0.target.value),
59
- children: [
60
- /*#__PURE__*/ jsx("option", {
98
+ onChange: setMode,
99
+ options: [
100
+ {
61
101
  value: "single",
62
- children: chinese ? "\u5355\u8272" : "Single"
63
- }),
64
- /*#__PURE__*/ jsx("option", {
102
+ label: chinese ? "\u5355\u8272" : "Single"
103
+ },
104
+ {
65
105
  value: "gradient",
66
- children: chinese ? "\u6E10\u53D8" : "Gradient"
67
- })
106
+ label: chinese ? "\u6E10\u53D8" : "Gradient"
107
+ }
68
108
  ]
69
109
  });
70
- $[2] = chinese;
71
- $[3] = mode;
72
- $[4] = modes.length;
73
- $[5] = setMode;
74
- $[6] = t2;
75
- } else t2 = $[6];
76
- const t3 = "";
77
- const t4 = chinese ? "\u989C\u8272\u683C\u5F0F" : "Color format";
78
- const t5 = props.disabledFormat;
79
- let t6;
80
- if ($[7] !== setFormat) {
81
- t6 = (event_2)=>setFormat(event_2.target.value);
82
- $[7] = setFormat;
83
- $[8] = t6;
84
- } else t6 = $[8];
110
+ $[4] = chinese;
111
+ $[5] = mode;
112
+ $[6] = modes.length;
113
+ $[7] = setMode;
114
+ $[8] = t3;
115
+ } else t3 = $[8];
116
+ const t4 = "";
117
+ const t5 = chinese ? "\u989C\u8272\u683C\u5F0F" : "Color format";
118
+ const t6 = chinese ? "\u989C\u8272\u683C\u5F0F" : "Color format";
85
119
  let t7;
120
+ let t8;
86
121
  if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
87
- t7 = [
122
+ t7 = {
123
+ width: "5.5em",
124
+ flexShrink: 0
125
+ };
126
+ t8 = {
127
+ popup: {
128
+ zIndex: "calc(var(--tao-z-index-popup-base) + 60)"
129
+ }
130
+ };
131
+ $[9] = t7;
132
+ $[10] = t8;
133
+ } else {
134
+ t7 = $[9];
135
+ t8 = $[10];
136
+ }
137
+ const t9 = props.disabledFormat ?? false;
138
+ let t10;
139
+ if ($[11] !== setFormat) {
140
+ t10 = (next_5)=>setFormat(next_5);
141
+ $[11] = setFormat;
142
+ $[12] = t10;
143
+ } else t10 = $[12];
144
+ let t11;
145
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
146
+ t11 = [
88
147
  "hex",
89
148
  "rgb",
90
149
  "hsb"
91
- ].map(_temp4);
92
- $[9] = t7;
93
- } else t7 = $[9];
94
- let t8;
95
- if ($[10] !== format || $[11] !== props.disabledFormat || $[12] !== t4 || $[13] !== t6) {
96
- t8 = /*#__PURE__*/ jsx("select", {
97
- "aria-label": t4,
150
+ ].map(_temp3);
151
+ $[13] = t11;
152
+ } else t11 = $[13];
153
+ let t12;
154
+ if ($[14] !== format || $[15] !== t10 || $[16] !== t5 || $[17] !== t6 || $[18] !== t9) {
155
+ t12 = /*#__PURE__*/ jsx(Select, {
156
+ "aria-label": t5,
157
+ mobileTitle: t6,
158
+ size: "small",
159
+ style: t7,
160
+ styles: t8,
98
161
  value: format,
99
- disabled: t5,
100
- onChange: t6,
101
- children: t7
162
+ disabled: t9,
163
+ onChange: t10,
164
+ options: t11
102
165
  });
103
- $[10] = format;
104
- $[11] = props.disabledFormat;
105
- $[12] = t4;
106
- $[13] = t6;
107
- $[14] = t8;
108
- } else t8 = $[14];
109
- const t9 = "hex" === format ? /*#__PURE__*/ jsx("input", {
166
+ $[14] = format;
167
+ $[15] = t10;
168
+ $[16] = t5;
169
+ $[17] = t6;
170
+ $[18] = t9;
171
+ $[19] = t12;
172
+ } else t12 = $[19];
173
+ const t13 = "hex" === format ? /*#__PURE__*/ jsx(BaseInput, {
174
+ size: "small",
175
+ disabled: false,
110
176
  "aria-label": chinese ? "\u5341\u516D\u8FDB\u5236\u989C\u8272" : "Hex color",
111
177
  value: draft,
112
178
  "aria-invalid": !/^#?(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i.test(draft),
113
- onChange: (event_3)=>{
114
- setDraft(event_3.target.value);
115
- if (/^#?(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i.test(event_3.target.value)) changeSelected(new external_color_js_Color(`#${event_3.target.value.replace(/^#/, "")}`));
179
+ onChange: (event_0)=>{
180
+ setDraft(event_0.target.value);
181
+ if (/^#?(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})$/i.test(event_0.target.value)) changeSelected(new external_color_js_Color(`#${event_0.target.value.replace(/^#/, "")}`));
116
182
  }
117
183
  }) : "rgb" === format ? /*#__PURE__*/ jsxs(Fragment, {
118
184
  children: [
@@ -145,42 +211,44 @@ function PickerPanel() {
145
211
  })))
146
212
  ]
147
213
  });
148
- const t10 = !props.disabledAlpha && numberInput("Alpha", Math.round(100 * rgb.a), 100, (alpha)=>changeSelected(new external_color_js_Color({
214
+ const t14 = !props.disabledAlpha && numberInput("Alpha", Math.round(100 * rgb.a), 100, (alpha)=>changeSelected(new external_color_js_Color({
149
215
  ...rgb,
150
216
  a: alpha / 100
151
217
  })));
152
- let t11;
153
- if ($[15] !== t10 || $[16] !== t8 || $[17] !== t9) {
154
- t11 = /*#__PURE__*/ jsxs("div", {
155
- "data-tao-color-inputs": t3,
218
+ let t15;
219
+ if ($[20] !== t12 || $[21] !== t13 || $[22] !== t14) {
220
+ t15 = /*#__PURE__*/ jsxs("div", {
221
+ "data-tao-color-inputs": t4,
156
222
  children: [
157
- t8,
158
- t9,
159
- t10
223
+ t12,
224
+ t13,
225
+ t14
160
226
  ]
161
227
  });
162
- $[15] = t10;
163
- $[16] = t8;
164
- $[17] = t9;
165
- $[18] = t11;
166
- } else t11 = $[18];
167
- let t12;
168
- if ($[19] !== chinese || $[20] !== panel.clear || $[21] !== props.allowClear) {
169
- t12 = props.allowClear && /*#__PURE__*/ jsx("button", {
170
- type: "button",
228
+ $[20] = t12;
229
+ $[21] = t13;
230
+ $[22] = t14;
231
+ $[23] = t15;
232
+ } else t15 = $[23];
233
+ let t16;
234
+ if ($[24] !== chinese || $[25] !== panel.clear || $[26] !== props.allowClear) {
235
+ t16 = props.allowClear && /*#__PURE__*/ jsx(Button, {
236
+ variant: "ghost",
237
+ size: "small",
238
+ disabled: false,
171
239
  "data-tao-color-clear": "",
172
240
  onClick: panel.clear,
173
241
  children: chinese ? "\u6E05\u9664\u989C\u8272" : "Clear color"
174
242
  });
175
- $[19] = chinese;
176
- $[20] = panel.clear;
177
- $[21] = props.allowClear;
178
- $[22] = t12;
179
- } else t12 = $[22];
243
+ $[24] = chinese;
244
+ $[25] = panel.clear;
245
+ $[26] = props.allowClear;
246
+ $[27] = t16;
247
+ } else t16 = $[27];
180
248
  return /*#__PURE__*/ jsxs("div", {
181
249
  "data-tao-color-picker-controls": "",
182
250
  children: [
183
- t2,
251
+ t3,
184
252
  "gradient" === mode && /*#__PURE__*/ jsxs("div", {
185
253
  "data-tao-color-stops": "",
186
254
  children: [
@@ -202,7 +270,9 @@ function PickerPanel() {
202
270
  background: stop_0.color.toCssString()
203
271
  }
204
272
  }, keyForColor(`${stop_0.percent}:${stop_0.color.toCssString()}`))),
205
- /*#__PURE__*/ jsx("button", {
273
+ /*#__PURE__*/ jsx(Button, {
274
+ variant: "bare",
275
+ disabled: false,
206
276
  type: "button",
207
277
  "aria-label": chinese ? "\u6DFB\u52A0\u8272\u6807" : "Add color stop",
208
278
  onClick: ()=>{
@@ -213,13 +283,15 @@ function PickerPanel() {
213
283
  const next_1 = [
214
284
  ...stops,
215
285
  added
216
- ].sort(_temp2);
286
+ ].sort(_temp);
217
287
  panel.setActive(next_1.indexOf(added));
218
288
  panel.change(new external_color_js_Color(next_1));
219
289
  },
220
290
  children: "+"
221
291
  }),
222
- stops.length > 2 && /*#__PURE__*/ jsx("button", {
292
+ stops.length > 2 && /*#__PURE__*/ jsx(Button, {
293
+ variant: "bare",
294
+ disabled: false,
223
295
  type: "button",
224
296
  "aria-label": chinese ? "\u5220\u9664\u8272\u6807" : "Remove color stop",
225
297
  onClick: ()=>{
@@ -230,27 +302,31 @@ function PickerPanel() {
230
302
  })
231
303
  ]
232
304
  }),
233
- /*#__PURE__*/ jsxs("label", {
305
+ /*#__PURE__*/ jsxs("div", {
234
306
  "data-tao-color-stop-position": "",
235
307
  children: [
236
- chinese ? "\u4F4D\u7F6E" : "Position",
237
- /*#__PURE__*/ jsx("input", {
238
- type: "range",
239
- "aria-label": chinese ? "\u8272\u6807\u4F4D\u7F6E" : "Stop position",
308
+ /*#__PURE__*/ jsx("span", {
309
+ children: chinese ? "\u4F4D\u7F6E" : "Position"
310
+ }),
311
+ /*#__PURE__*/ jsx(Slider, {
312
+ ariaLabelForHandle: chinese ? "\u8272\u6807\u4F4D\u7F6E" : "Stop position",
313
+ disabled: false,
240
314
  min: 0,
241
315
  max: 100,
242
316
  value: stops[activeIndex].percent,
243
- onChange: (event_1)=>{
317
+ tooltip: {
318
+ open: false
319
+ },
320
+ onChange: (percent)=>{
244
321
  const moved = {
245
322
  ...stops[activeIndex],
246
- percent: Number(event_1.target.value)
323
+ percent
247
324
  };
248
- const next_2 = stops.map((stop_1, index_2)=>index_2 === activeIndex ? moved : stop_1).sort(_temp3);
325
+ const next_2 = stops.map((stop_1, index_2)=>index_2 === activeIndex ? moved : stop_1).sort(_temp2);
249
326
  panel.setActive(next_2.indexOf(moved));
250
327
  panel.change(new external_color_js_Color(next_2), false);
251
328
  },
252
- onPointerUp: ()=>panel.complete(value),
253
- onKeyUp: ()=>panel.complete(value)
329
+ onChangeComplete: ()=>panel.complete(value)
254
330
  }),
255
331
  /*#__PURE__*/ jsxs("span", {
256
332
  children: [
@@ -269,81 +345,80 @@ function PickerPanel() {
269
345
  onChange: (next_3)=>changeSelected(new external_color_js_Color(next_3.toRgb()), false),
270
346
  onChangeComplete: (next_4)=>panel.complete(replace(new external_color_js_Color(next_4.toRgb())))
271
347
  }),
272
- t11,
273
- t12
348
+ t15,
349
+ t16
274
350
  ]
275
351
  });
276
352
  }
277
- function _temp4(item) {
278
- return /*#__PURE__*/ jsx("option", {
353
+ function _temp3(item) {
354
+ return {
279
355
  value: item,
280
- children: item.toUpperCase()
281
- }, item);
356
+ label: item.toUpperCase()
357
+ };
282
358
  }
283
- function _temp3(a_0, b_0) {
359
+ function _temp2(a_0, b_0) {
284
360
  return a_0.percent - b_0.percent;
285
361
  }
286
- function _temp2(a, b) {
362
+ function _temp(a, b) {
287
363
  return a.percent - b.percent;
288
364
  }
289
- function _temp(label, number, max, change, t0) {
290
- const step = void 0 === t0 ? 1 : t0;
291
- return /*#__PURE__*/ jsxs("label", {
292
- "data-tao-color-field": "",
293
- children: [
294
- /*#__PURE__*/ jsx("span", {
295
- children: label
296
- }),
297
- /*#__PURE__*/ jsx("input", {
298
- type: "number",
299
- "aria-label": label,
300
- min: 0,
301
- max: max,
302
- step: step,
303
- value: number,
304
- onChange: (event)=>{
305
- if ("" !== event.target.value) change(clamp(Number(event.target.value), max));
306
- }
307
- })
308
- ]
309
- });
310
- }
311
365
  function PresetsPanel() {
312
- const $ = c(2);
366
+ const $ = c(6);
313
367
  const keyForColor = colorKeys();
314
368
  const { props, change, chinese } = useContext(PanelContext);
369
+ if (!props.presets?.length) return null;
315
370
  const t0 = "";
316
- const t1 = props.presets?.map((preset, index)=>/*#__PURE__*/ jsxs("details", {
317
- open: preset.defaultOpen ?? true,
318
- children: [
319
- /*#__PURE__*/ jsx("summary", {
320
- children: preset.label
321
- }),
322
- /*#__PURE__*/ jsx("div", {
323
- children: preset.colors.map((value)=>{
324
- const color = new external_color_js_Color(value);
325
- return /*#__PURE__*/ jsx("button", {
326
- type: "button",
327
- "aria-label": `${chinese ? "\u9884\u8BBE" : "Preset"} ${color.isGradient() ? color.toCssString() : color.toHexString()}`,
328
- style: {
329
- background: color.toCssString()
330
- },
331
- onClick: ()=>change(color)
332
- }, keyForColor(color.toCssString()));
333
- })
371
+ const T0 = Collapse;
372
+ const t1 = true;
373
+ const t2 = false;
374
+ const t3 = "small";
375
+ let t4;
376
+ if ($[0] !== props.presets) {
377
+ t4 = props.presets.flatMap(_temp4);
378
+ $[0] = props.presets;
379
+ $[1] = t4;
380
+ } else t4 = $[1];
381
+ const t5 = props.presets.map((preset_0, index_0)=>({
382
+ key: String(preset_0.key ?? index_0),
383
+ label: preset_0.label,
384
+ children: /*#__PURE__*/ jsx("div", {
385
+ "data-tao-color-swatches": "",
386
+ children: preset_0.colors.map((value)=>{
387
+ const color = new external_color_js_Color(value);
388
+ return /*#__PURE__*/ jsx("button", {
389
+ type: "button",
390
+ "aria-label": `${chinese ? "\u9884\u8BBE" : "Preset"} ${color.isGradient() ? color.toCssString() : color.toHexString()}`,
391
+ style: {
392
+ background: color.toCssString()
393
+ },
394
+ onClick: ()=>change(color)
395
+ }, keyForColor(color.toCssString()));
334
396
  })
335
- ]
336
- }, preset.key ?? index));
337
- let t2;
338
- if ($[0] !== t1) {
339
- t2 = /*#__PURE__*/ jsx("div", {
397
+ })
398
+ }));
399
+ let t6;
400
+ if ($[2] !== T0 || $[3] !== t4 || $[4] !== t5) {
401
+ t6 = /*#__PURE__*/ jsx("div", {
340
402
  "data-tao-color-presets": t0,
341
- children: t1
403
+ children: /*#__PURE__*/ jsx(T0, {
404
+ ghost: t1,
405
+ disabled: t2,
406
+ size: t3,
407
+ defaultActiveKey: t4,
408
+ items: t5
409
+ })
342
410
  });
343
- $[0] = t1;
344
- $[1] = t2;
345
- } else t2 = $[1];
346
- return t2;
411
+ $[2] = T0;
412
+ $[3] = t4;
413
+ $[4] = t5;
414
+ $[5] = t6;
415
+ } else t6 = $[5];
416
+ return t6;
417
+ }
418
+ function _temp4(preset, index) {
419
+ return preset.defaultOpen ?? true ? [
420
+ String(preset.key ?? index)
421
+ ] : [];
347
422
  }
348
423
  function opaque(value) {
349
424
  return value.isGradient() ? new external_color_js_Color(value.getColors().map((stop)=>({