@rockshin/tao-ui 0.0.25 → 0.0.26

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 (76) hide show
  1. package/README.md +17 -6
  2. package/component-manifest.json +534 -6
  3. package/dist/components/alert/alert.css +120 -0
  4. package/dist/components/alert/alert.d.ts +20 -0
  5. package/dist/components/alert/alert.js +185 -0
  6. package/dist/components/button/button.css +19 -18
  7. package/dist/components/button/button.d.ts +8 -0
  8. package/dist/components/date-picker/date-picker.js +1 -1
  9. package/dist/components/date-picker/range-picker.js +1 -1
  10. package/dist/components/dropdown/dropdown.css +22 -1
  11. package/dist/components/dropdown/dropdown.js +4 -3
  12. package/dist/components/form/form-context.d.ts +7 -0
  13. package/dist/components/form/form-context.js +8 -0
  14. package/dist/components/form/form-item.d.ts +55 -0
  15. package/dist/components/form/form-item.js +131 -0
  16. package/dist/components/form/form.css +22 -0
  17. package/dist/components/form/form.d.ts +35 -0
  18. package/dist/components/form/form.js +125 -0
  19. package/dist/components/form/index.d.ts +2 -0
  20. package/dist/components/form/index.js +1 -0
  21. package/dist/components/form-field/form-field-view.d.ts +30 -0
  22. package/dist/components/form-field/form-field-view.js +154 -0
  23. package/dist/components/form-field/form-field.d.ts +2 -2
  24. package/dist/components/form-field/form-field.js +29 -137
  25. package/dist/components/form-field/form.css +17 -7
  26. package/dist/components/input/input.css +6 -6
  27. package/dist/components/modal/confirm-dialog.js +14 -111
  28. package/dist/components/modal/modal.d.ts +7 -1
  29. package/dist/components/modal/modal.js +205 -195
  30. package/dist/components/popconfirm/popconfirm.css +44 -0
  31. package/dist/components/popconfirm/popconfirm.d.ts +41 -0
  32. package/dist/components/popconfirm/popconfirm.js +238 -0
  33. package/dist/components/popover/popover.css +105 -0
  34. package/dist/components/popover/popover.d.ts +41 -0
  35. package/dist/components/popover/popover.js +412 -0
  36. package/dist/components/select/select.js +1 -1
  37. package/dist/components/status-icon/status-icon.d.ts +5 -0
  38. package/dist/components/status-icon/status-icon.js +77 -0
  39. package/dist/components/table/table-types.d.ts +7 -0
  40. package/dist/components/table/table.d.ts +1 -1
  41. package/dist/components/table/table.js +296 -283
  42. package/dist/components/tooltip/tooltip.css +93 -0
  43. package/dist/components/tooltip/tooltip.d.ts +33 -0
  44. package/dist/components/tooltip/tooltip.js +226 -0
  45. package/dist/docs/components/alert.doc.d.ts +29 -0
  46. package/dist/docs/components/alert.doc.js +93 -0
  47. package/dist/docs/components/form.doc.d.ts +29 -0
  48. package/dist/docs/components/form.doc.js +71 -0
  49. package/dist/docs/components/modal.doc.d.ts +6 -0
  50. package/dist/docs/components/modal.doc.js +9 -1
  51. package/dist/docs/components/popconfirm.doc.d.ts +29 -0
  52. package/dist/docs/components/popconfirm.doc.js +132 -0
  53. package/dist/docs/components/popover.doc.d.ts +29 -0
  54. package/dist/docs/components/popover.doc.js +121 -0
  55. package/dist/docs/components/stack.doc.d.ts +6 -0
  56. package/dist/docs/components/stack.doc.js +23 -2
  57. package/dist/docs/components/table.doc.js +2 -1
  58. package/dist/docs/components/tao-provider.doc.js +11 -1
  59. package/dist/docs/components/tooltip.doc.d.ts +37 -0
  60. package/dist/docs/components/tooltip.doc.js +76 -0
  61. package/dist/index.d.ts +9 -1
  62. package/dist/index.js +8 -1
  63. package/dist/layouts/stack/stack.d.ts +12 -3
  64. package/dist/layouts/stack/stack.js +60 -34
  65. package/dist/provider/tao-provider.d.ts +71 -0
  66. package/dist/provider/tao-provider.js +166 -120
  67. package/dist/theme/control.css +12 -12
  68. package/dist/theme/theme.css +23 -0
  69. package/dist/utils/breakpoint.d.ts +31 -0
  70. package/dist/utils/breakpoint.js +80 -0
  71. package/dist/utils/overlay.d.ts +19 -0
  72. package/dist/utils/overlay.js +41 -0
  73. package/llms.txt +68 -3
  74. package/package.json +6 -4
  75. package/dist/components/select/use-is-mobile.d.ts +0 -1
  76. package/dist/components/select/use-is-mobile.js +0 -27
@@ -1,144 +1,36 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
- import { cloneElement, isValidElement, useId } from "react";
4
- import { cx } from "../../utils/semantic.js";
3
+ import { FormFieldView } from "./form-field-view.js";
5
4
  import "./form.css";
6
5
  function FormField(t0) {
7
- const $ = c(40);
6
+ const $ = c(11);
8
7
  const { label, htmlFor, required, error, description, children, className, style, classNames, styles } = t0;
9
- const generatedId = useId();
10
- const child = /*#__PURE__*/ isValidElement(children) ? children : null;
11
- const childId = "string" == typeof child?.props.id ? child.props.id : void 0;
12
- const controlId = htmlFor ?? childId ?? `${generatedId}-control`;
13
- const descriptionId = `${generatedId}-description`;
14
- const errorId = `${generatedId}-error`;
15
- const childDescribedBy = "string" == typeof child?.props["aria-describedby"] ? child.props["aria-describedby"] : void 0;
16
- const t1 = error ? errorId : description ? descriptionId : void 0;
17
- let t2;
18
- if ($[0] !== childDescribedBy || $[1] !== t1) {
19
- t2 = [
20
- childDescribedBy,
21
- t1
22
- ].filter(Boolean);
23
- $[0] = childDescribedBy;
24
- $[1] = t1;
25
- $[2] = t2;
26
- } else t2 = $[2];
27
- const describedBy = t2.join(" ");
28
- let t3;
29
- if ($[3] !== child || $[4] !== children || $[5] !== controlId || $[6] !== describedBy || $[7] !== error || $[8] !== errorId || $[9] !== required) {
30
- t3 = child ? /*#__PURE__*/ cloneElement(child, {
31
- id: controlId,
32
- "aria-describedby": describedBy || void 0,
33
- "aria-errormessage": error ? errorId : void 0,
34
- "aria-invalid": error ? true : child.props["aria-invalid"],
35
- "aria-required": required ? true : child.props["aria-required"]
36
- }) : children;
37
- $[3] = child;
38
- $[4] = children;
39
- $[5] = controlId;
40
- $[6] = describedBy;
41
- $[7] = error;
42
- $[8] = errorId;
43
- $[9] = required;
44
- $[10] = t3;
45
- } else t3 = $[10];
46
- const control = t3;
47
- const t4 = classNames?.root;
48
- let t5;
49
- if ($[11] !== className || $[12] !== t4) {
50
- t5 = cx(t4, className);
51
- $[11] = className;
52
- $[12] = t4;
53
- $[13] = t5;
54
- } else t5 = $[13];
55
- const t6 = styles?.root;
56
- let t7;
57
- if ($[14] !== style || $[15] !== t6) {
58
- t7 = {
59
- ...t6,
60
- ...style
61
- };
62
- $[14] = style;
63
- $[15] = t6;
64
- $[16] = t7;
65
- } else t7 = $[16];
66
- const t8 = classNames?.label;
67
- const t9 = styles?.label;
68
- let t10;
69
- if ($[17] !== required) {
70
- t10 = required && /*#__PURE__*/ jsx("span", {
71
- "data-tao-required": "",
72
- "aria-hidden": "true",
73
- children: "*"
8
+ let t1;
9
+ if ($[0] !== children || $[1] !== className || $[2] !== classNames || $[3] !== description || $[4] !== error || $[5] !== htmlFor || $[6] !== label || $[7] !== required || $[8] !== style || $[9] !== styles) {
10
+ t1 = /*#__PURE__*/ jsx(FormFieldView, {
11
+ label: label,
12
+ htmlFor: htmlFor,
13
+ required: required,
14
+ error: error,
15
+ description: description,
16
+ className: className,
17
+ style: style,
18
+ classNames: classNames,
19
+ styles: styles,
20
+ children: children
74
21
  });
75
- $[17] = required;
76
- $[18] = t10;
77
- } else t10 = $[18];
78
- let t11;
79
- if ($[19] !== controlId || $[20] !== label || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
80
- t11 = /*#__PURE__*/ jsxs("label", {
81
- htmlFor: controlId,
82
- className: t8,
83
- style: t9,
84
- "data-tao-form-label": "",
85
- children: [
86
- label,
87
- t10
88
- ]
89
- });
90
- $[19] = controlId;
91
- $[20] = label;
92
- $[21] = t10;
93
- $[22] = t8;
94
- $[23] = t9;
95
- $[24] = t11;
96
- } else t11 = $[24];
97
- let t12;
98
- if ($[25] !== classNames?.description || $[26] !== classNames?.error || $[27] !== description || $[28] !== descriptionId || $[29] !== error || $[30] !== errorId || $[31] !== styles?.description || $[32] !== styles?.error) {
99
- t12 = error ? /*#__PURE__*/ jsx("p", {
100
- className: classNames?.error,
101
- style: styles?.error,
102
- "data-tao-form-error": "",
103
- id: errorId,
104
- role: "alert",
105
- children: error
106
- }) : description ? /*#__PURE__*/ jsx("p", {
107
- className: classNames?.description,
108
- style: styles?.description,
109
- "data-tao-form-description": "",
110
- id: descriptionId,
111
- children: description
112
- }) : null;
113
- $[25] = classNames?.description;
114
- $[26] = classNames?.error;
115
- $[27] = description;
116
- $[28] = descriptionId;
117
- $[29] = error;
118
- $[30] = errorId;
119
- $[31] = styles?.description;
120
- $[32] = styles?.error;
121
- $[33] = t12;
122
- } else t12 = $[33];
123
- let t13;
124
- if ($[34] !== control || $[35] !== t11 || $[36] !== t12 || $[37] !== t5 || $[38] !== t7) {
125
- t13 = /*#__PURE__*/ jsxs("div", {
126
- className: t5,
127
- style: t7,
128
- "data-tao-form-field": "",
129
- children: [
130
- t11,
131
- control,
132
- t12
133
- ]
134
- });
135
- $[34] = control;
136
- $[35] = t11;
137
- $[36] = t12;
138
- $[37] = t5;
139
- $[38] = t7;
140
- $[39] = t13;
141
- } else t13 = $[39];
142
- return t13;
22
+ $[0] = children;
23
+ $[1] = className;
24
+ $[2] = classNames;
25
+ $[3] = description;
26
+ $[4] = error;
27
+ $[5] = htmlFor;
28
+ $[6] = label;
29
+ $[7] = required;
30
+ $[8] = style;
31
+ $[9] = styles;
32
+ $[10] = t1;
33
+ } else t1 = $[10];
34
+ return t1;
143
35
  }
144
36
  export { FormField };
@@ -3,29 +3,39 @@
3
3
  display: flex;
4
4
  }
5
5
 
6
+ [data-tao-form-control] {
7
+ flex-direction: column;
8
+ min-width: 0;
9
+ display: flex;
10
+ }
11
+
12
+ [data-tao-form-error][data-tao-status="warning"] {
13
+ color: var(--tao-warning);
14
+ }
15
+
6
16
  [data-tao-form-label] {
7
- font-size: var(--tao-font-size-sm);
17
+ font-size: var(--tao-form-field-label-font-size, var(--tao-font-size-sm));
8
18
  font-weight: var(--tao-font-weight-medium);
9
- color: var(--tao-color-text);
19
+ color: var(--tao-form-field-label-color, var(--tao-color-text));
10
20
  line-height: var(--tao-line-height);
11
21
  margin-block-end: 6px;
12
22
  }
13
23
 
14
24
  [data-tao-required] {
15
- color: var(--tao-error);
25
+ color: var(--tao-form-field-label-required-mark-color, var(--tao-error));
16
26
  margin-inline-start: 2px;
17
27
  }
18
28
 
19
29
  [data-tao-form-description] {
20
30
  font-size: var(--tao-font-size-xs);
21
- color: var(--tao-color-text-tertiary);
31
+ color: var(--tao-form-field-description-color, var(--tao-color-text-tertiary));
22
32
  line-height: var(--tao-line-height-sm);
23
33
  margin-block-start: 4px;
24
34
  }
25
35
 
26
36
  [data-tao-form-error] {
27
- font-size: var(--tao-font-size-xs);
28
- color: var(--tao-error);
37
+ font-size: var(--tao-form-field-error-font-size, var(--tao-font-size-xs));
38
+ color: var(--tao-form-field-error-color, var(--tao-error));
29
39
  line-height: var(--tao-line-height-sm);
30
40
  margin-block-start: 4px;
31
41
  }
@@ -60,7 +70,7 @@
60
70
  }
61
71
 
62
72
  [data-tao-form-section-body] {
63
- gap: var(--tao-padding-md);
73
+ gap: var(--tao-form-field-item-gap, var(--tao-padding-md));
64
74
  flex-direction: column;
65
75
  display: flex;
66
76
  }
@@ -16,8 +16,8 @@
16
16
  }
17
17
 
18
18
  [data-tao-input][data-tao-size="small"] input {
19
- padding-inline: var(--tao-padding-xs);
20
- font-size: var(--tao-font-size-sm);
19
+ padding-inline: var(--tao-input-padding-inline-sm, var(--tao-padding-xs));
20
+ font-size: var(--tao-input-input-font-size-sm, var(--tao-font-size-sm));
21
21
  }
22
22
 
23
23
  [data-tao-input][data-tao-size="medium"] {
@@ -27,8 +27,8 @@
27
27
  }
28
28
 
29
29
  [data-tao-input][data-tao-size="medium"] input {
30
- padding-inline: var(--tao-padding-sm);
31
- font-size: var(--tao-font-size-base);
30
+ padding-inline: var(--tao-input-padding-inline, var(--tao-padding-sm));
31
+ font-size: var(--tao-input-input-font-size, var(--tao-font-size-base));
32
32
  }
33
33
 
34
34
  [data-tao-input][data-tao-size="large"] {
@@ -39,8 +39,8 @@
39
39
  }
40
40
 
41
41
  [data-tao-input][data-tao-size="large"] input {
42
- padding-inline: var(--tao-padding-sm);
43
- font-size: var(--tao-font-size-lg);
42
+ padding-inline: var(--tao-input-padding-inline-lg, var(--tao-padding-sm));
43
+ font-size: var(--tao-input-input-font-size-lg, var(--tao-font-size-lg));
44
44
  }
45
45
 
46
46
  [data-tao-input][data-tao-variant="borderless"] {
@@ -3,6 +3,7 @@ import { c } from "react/compiler-runtime";
3
3
  import { useState } from "react";
4
4
  import { cx } from "../../utils/semantic.js";
5
5
  import { Button } from "../button/button.js";
6
+ import { StatusIcon } from "../status-icon/status-icon.js";
6
7
  import { Modal } from "./modal.js";
7
8
  function isPromise(v) {
8
9
  return !!v && 'function' == typeof v.then;
@@ -24,7 +25,7 @@ function ConfirmDialog({ open, close, type = 'confirm', icon, title, content, ok
24
25
  };
25
26
  const handleOk = ()=>runAndClose(onOk, true);
26
27
  const handleCancel = ()=>runAndClose(onCancel, false);
27
- const iconNode = null === icon ? null : icon ?? /*#__PURE__*/ jsx(StatusIcon, {
28
+ const iconNode = null === icon ? null : icon ?? /*#__PURE__*/ jsx(StatusIconFor, {
28
29
  type: type
29
30
  });
30
31
  const mergedClassNames = className ? {
@@ -85,117 +86,19 @@ function ConfirmDialog({ open, close, type = 'confirm', icon, title, content, ok
85
86
  })
86
87
  });
87
88
  }
88
- function StatusIcon(t0) {
89
- const $ = c(5);
89
+ function StatusIconFor(t0) {
90
+ const $ = c(2);
90
91
  const { type } = t0;
91
- let t1;
92
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
93
- t1 = {
94
- width: 22,
95
- height: 22,
96
- viewBox: "0 0 24 24",
97
- fill: "none",
98
- stroke: "currentColor",
99
- strokeWidth: 2,
100
- strokeLinecap: "round",
101
- strokeLinejoin: "round",
102
- "aria-hidden=\"true\"": true
103
- };
92
+ const t1 = "confirm" === type ? "warning" : type;
93
+ let t2;
94
+ if ($[0] !== t1) {
95
+ t2 = /*#__PURE__*/ jsx(StatusIcon, {
96
+ type: t1,
97
+ size: 22
98
+ });
104
99
  $[0] = t1;
105
- } else t1 = $[0];
106
- const common = t1;
107
- switch(type){
108
- case "success":
109
- {
110
- let t2;
111
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
112
- t2 = /*#__PURE__*/ jsxs("svg", {
113
- "aria-hidden": "true",
114
- focusable: "false",
115
- ...common,
116
- children: [
117
- /*#__PURE__*/ jsx("circle", {
118
- cx: "12",
119
- cy: "12",
120
- r: "9"
121
- }),
122
- /*#__PURE__*/ jsx("path", {
123
- d: "m8.5 12 2.5 2.5 4.5-5"
124
- })
125
- ]
126
- });
127
- $[1] = t2;
128
- } else t2 = $[1];
129
- return t2;
130
- }
131
- case "error":
132
- {
133
- let t2;
134
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
135
- t2 = /*#__PURE__*/ jsxs("svg", {
136
- "aria-hidden": "true",
137
- focusable: "false",
138
- ...common,
139
- children: [
140
- /*#__PURE__*/ jsx("circle", {
141
- cx: "12",
142
- cy: "12",
143
- r: "9"
144
- }),
145
- /*#__PURE__*/ jsx("path", {
146
- d: "M15 9 9 15M9 9l6 6"
147
- })
148
- ]
149
- });
150
- $[2] = t2;
151
- } else t2 = $[2];
152
- return t2;
153
- }
154
- case "warning":
155
- case "confirm":
156
- {
157
- let t2;
158
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
159
- t2 = /*#__PURE__*/ jsxs("svg", {
160
- "aria-hidden": "true",
161
- focusable: "false",
162
- ...common,
163
- children: [
164
- /*#__PURE__*/ jsx("path", {
165
- d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"
166
- }),
167
- /*#__PURE__*/ jsx("path", {
168
- d: "M12 9v4M12 17h.01"
169
- })
170
- ]
171
- });
172
- $[3] = t2;
173
- } else t2 = $[3];
174
- return t2;
175
- }
176
- default:
177
- {
178
- let t2;
179
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
180
- t2 = /*#__PURE__*/ jsxs("svg", {
181
- "aria-hidden": "true",
182
- focusable: "false",
183
- ...common,
184
- children: [
185
- /*#__PURE__*/ jsx("circle", {
186
- cx: "12",
187
- cy: "12",
188
- r: "9"
189
- }),
190
- /*#__PURE__*/ jsx("path", {
191
- d: "M12 16v-4M12 8h.01"
192
- })
193
- ]
194
- });
195
- $[4] = t2;
196
- } else t2 = $[4];
197
- return t2;
198
- }
199
- }
100
+ $[1] = t2;
101
+ } else t2 = $[1];
102
+ return t2;
200
103
  }
201
104
  export { ConfirmDialog };
@@ -1,4 +1,5 @@
1
1
  import { type FC, type ReactNode } from 'react';
2
+ import { type TaoBreakpointMap } from '../../utils/breakpoint';
2
3
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
4
  import { type ButtonProps } from '../button/button';
4
5
  import './modal.css';
@@ -27,7 +28,12 @@ export interface ModalProps {
27
28
  okButtonProps?: ButtonProps;
28
29
  /** Extra props forwarded to the default Cancel button. */
29
30
  cancelButtonProps?: ButtonProps;
30
- width?: number | string;
31
+ /**
32
+ * Dialog width. Accepts a breakpoint map, e.g.
33
+ * `width={{ xs: '100%', md: 640 }}` — the largest matching breakpoint wins,
34
+ * falling back to the 520px default when no entry matches.
35
+ */
36
+ width?: number | string | TaoBreakpointMap<number | string>;
31
37
  /** Vertically center the dialog. Defaults to true. */
32
38
  centered?: boolean;
33
39
  /** Show the close (×) button. Defaults to true. */