@rockshin/tao-ui 0.0.1

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 (105) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/components/button/button.css +1055 -0
  4. package/dist/components/button/button.d.ts +15 -0
  5. package/dist/components/button/button.js +93 -0
  6. package/dist/components/checkbox/checkbox.css +1035 -0
  7. package/dist/components/checkbox/checkbox.d.ts +33 -0
  8. package/dist/components/checkbox/checkbox.js +312 -0
  9. package/dist/components/date-picker/calendar/calendar-grid.d.ts +18 -0
  10. package/dist/components/date-picker/calendar/calendar-grid.js +173 -0
  11. package/dist/components/date-picker/calendar/calendar-header.d.ts +10 -0
  12. package/dist/components/date-picker/calendar/calendar-header.js +336 -0
  13. package/dist/components/date-picker/calendar/month-grid.d.ts +9 -0
  14. package/dist/components/date-picker/calendar/month-grid.js +61 -0
  15. package/dist/components/date-picker/calendar/time-panel.d.ts +12 -0
  16. package/dist/components/date-picker/calendar/time-panel.js +233 -0
  17. package/dist/components/date-picker/calendar/use-calendar.d.ts +15 -0
  18. package/dist/components/date-picker/calendar/use-calendar.js +24 -0
  19. package/dist/components/date-picker/calendar/year-grid.d.ts +9 -0
  20. package/dist/components/date-picker/calendar/year-grid.js +60 -0
  21. package/dist/components/date-picker/date-picker.css +1799 -0
  22. package/dist/components/date-picker/date-picker.d.ts +29 -0
  23. package/dist/components/date-picker/date-picker.js +663 -0
  24. package/dist/components/date-picker/presets.d.ts +9 -0
  25. package/dist/components/date-picker/presets.js +36 -0
  26. package/dist/components/date-picker/range-picker.d.ts +30 -0
  27. package/dist/components/date-picker/range-picker.js +432 -0
  28. package/dist/components/date-picker/types.d.ts +39 -0
  29. package/dist/components/date-picker/types.js +7 -0
  30. package/dist/components/drawer/drawer.css +1112 -0
  31. package/dist/components/drawer/drawer.d.ts +17 -0
  32. package/dist/components/drawer/drawer.js +184 -0
  33. package/dist/components/form-actions/form-actions.d.ts +12 -0
  34. package/dist/components/form-actions/form-actions.js +42 -0
  35. package/dist/components/form-field/form-field.d.ts +17 -0
  36. package/dist/components/form-field/form-field.js +101 -0
  37. package/dist/components/form-field/form.css +1036 -0
  38. package/dist/components/form-section/form-section.d.ts +14 -0
  39. package/dist/components/form-section/form-section.js +92 -0
  40. package/dist/components/input/input.css +1185 -0
  41. package/dist/components/input/input.d.ts +15 -0
  42. package/dist/components/input/input.js +143 -0
  43. package/dist/components/pagination/pagination.css +1099 -0
  44. package/dist/components/pagination/pagination.d.ts +22 -0
  45. package/dist/components/pagination/pagination.js +310 -0
  46. package/dist/components/radio/radio.css +1045 -0
  47. package/dist/components/radio/radio.d.ts +34 -0
  48. package/dist/components/radio/radio.js +215 -0
  49. package/dist/components/scroll-area/scroll-area.css +1099 -0
  50. package/dist/components/scroll-area/scroll-area.d.ts +33 -0
  51. package/dist/components/scroll-area/scroll-area.js +375 -0
  52. package/dist/components/select/mobile-select.css +1044 -0
  53. package/dist/components/select/mobile-select.d.ts +19 -0
  54. package/dist/components/select/mobile-select.js +224 -0
  55. package/dist/components/select/select.css +1327 -0
  56. package/dist/components/select/select.d.ts +32 -0
  57. package/dist/components/select/select.js +532 -0
  58. package/dist/components/select/use-is-mobile.d.ts +1 -0
  59. package/dist/components/select/use-is-mobile.js +30 -0
  60. package/dist/components/splitter/splitter.css +1104 -0
  61. package/dist/components/splitter/splitter.d.ts +33 -0
  62. package/dist/components/splitter/splitter.js +451 -0
  63. package/dist/components/switch/switch.css +1170 -0
  64. package/dist/components/switch/switch.d.ts +19 -0
  65. package/dist/components/switch/switch.js +143 -0
  66. package/dist/components/table/table.css +1255 -0
  67. package/dist/components/table/table.d.ts +73 -0
  68. package/dist/components/table/table.js +1022 -0
  69. package/dist/components/tabs/tabs.css +1076 -0
  70. package/dist/components/tabs/tabs.d.ts +24 -0
  71. package/dist/components/tabs/tabs.js +256 -0
  72. package/dist/components/tag/tag.css +1124 -0
  73. package/dist/components/tag/tag.d.ts +33 -0
  74. package/dist/components/tag/tag.js +237 -0
  75. package/dist/index.d.ts +23 -0
  76. package/dist/index.js +23 -0
  77. package/dist/layouts/form-layout/form-layout.d.ts +6 -0
  78. package/dist/layouts/form-layout/form-layout.js +18 -0
  79. package/dist/layouts/stack/layout.css +1003 -0
  80. package/dist/layouts/stack/stack.d.ts +9 -0
  81. package/dist/layouts/stack/stack.js +27 -0
  82. package/dist/number-input/cursor.d.ts +9 -0
  83. package/dist/number-input/cursor.js +44 -0
  84. package/dist/number-input/format.d.ts +5 -0
  85. package/dist/number-input/format.js +50 -0
  86. package/dist/number-input/index.d.ts +5 -0
  87. package/dist/number-input/index.js +2 -0
  88. package/dist/number-input/number-input.d.ts +9 -0
  89. package/dist/number-input/number-input.js +101 -0
  90. package/dist/number-input/percentage.d.ts +3 -0
  91. package/dist/number-input/percentage.js +28 -0
  92. package/dist/number-input/types.d.ts +5 -0
  93. package/dist/number-input/types.js +0 -0
  94. package/dist/number-input/use-number-input.d.ts +30 -0
  95. package/dist/number-input/use-number-input.js +211 -0
  96. package/dist/number-input/validate.d.ts +3 -0
  97. package/dist/number-input/validate.js +17 -0
  98. package/dist/provider/tao-provider.d.ts +42 -0
  99. package/dist/provider/tao-provider.js +67 -0
  100. package/dist/theme/control.css +1061 -0
  101. package/dist/theme/theme.css +957 -0
  102. package/dist/utils/semantic.d.ts +10 -0
  103. package/dist/utils/semantic.js +5 -0
  104. package/llms.txt +67 -0
  105. package/package.json +97 -0
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
+ import './switch.css';
4
+ export type SwitchSemanticPart = 'root' | 'handle';
5
+ export interface SwitchProps {
6
+ checked?: boolean;
7
+ defaultChecked?: boolean;
8
+ onChange?: (checked: boolean) => void;
9
+ disabled?: boolean;
10
+ loading?: boolean;
11
+ size?: 'small' | 'medium';
12
+ checkedChildren?: ReactNode;
13
+ unCheckedChildren?: ReactNode;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ classNames?: SemanticClassNames<SwitchSemanticPart>;
17
+ styles?: SemanticStyles<SwitchSemanticPart>;
18
+ }
19
+ export declare function Switch({ checked, onChange, disabled, loading, size, checkedChildren, unCheckedChildren, className, style, classNames, styles, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,143 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useTaoConfig } from "../../provider/tao-provider.js";
4
+ import { cx } from "../../utils/semantic.js";
5
+ import "./switch.css";
6
+ function Switch(t0) {
7
+ const $ = c(32);
8
+ const { checked, onChange, disabled, loading, size: t1, checkedChildren, unCheckedChildren, className, style, classNames, styles } = t0;
9
+ const size = void 0 === t1 ? "medium" : t1;
10
+ const ctx = useTaoConfig();
11
+ const resolvedDisabled = disabled ?? ctx.disabled ?? false;
12
+ const isDisabled = resolvedDisabled || loading;
13
+ const t2 = !!checked;
14
+ const t3 = classNames?.root;
15
+ let t4;
16
+ if ($[0] !== className || $[1] !== t3) {
17
+ t4 = cx(t3, className);
18
+ $[0] = className;
19
+ $[1] = t3;
20
+ $[2] = t4;
21
+ } else t4 = $[2];
22
+ const t5 = styles?.root;
23
+ let t6;
24
+ if ($[3] !== style || $[4] !== t5) {
25
+ t6 = {
26
+ ...t5,
27
+ ...style
28
+ };
29
+ $[3] = style;
30
+ $[4] = t5;
31
+ $[5] = t6;
32
+ } else t6 = $[5];
33
+ const t7 = checked || void 0;
34
+ let t8;
35
+ if ($[6] !== checked || $[7] !== onChange) {
36
+ t8 = ()=>onChange?.(!checked);
37
+ $[6] = checked;
38
+ $[7] = onChange;
39
+ $[8] = t8;
40
+ } else t8 = $[8];
41
+ const t9 = classNames?.handle;
42
+ const t10 = styles?.handle;
43
+ let t11;
44
+ if ($[9] !== loading) {
45
+ t11 = loading && /*#__PURE__*/ jsx(LoadingIcon, {});
46
+ $[9] = loading;
47
+ $[10] = t11;
48
+ } else t11 = $[10];
49
+ let t12;
50
+ if ($[11] !== t10 || $[12] !== t11 || $[13] !== t9) {
51
+ t12 = /*#__PURE__*/ jsx("div", {
52
+ className: t9,
53
+ style: t10,
54
+ "data-tao-switch-handle": "",
55
+ children: t11
56
+ });
57
+ $[11] = t10;
58
+ $[12] = t11;
59
+ $[13] = t9;
60
+ $[14] = t12;
61
+ } else t12 = $[14];
62
+ let t13;
63
+ if ($[15] !== checkedChildren) {
64
+ t13 = /*#__PURE__*/ jsx("span", {
65
+ "data-tao-switch-inner-checked": "",
66
+ children: checkedChildren
67
+ });
68
+ $[15] = checkedChildren;
69
+ $[16] = t13;
70
+ } else t13 = $[16];
71
+ let t14;
72
+ if ($[17] !== unCheckedChildren) {
73
+ t14 = /*#__PURE__*/ jsx("span", {
74
+ "data-tao-switch-inner-unchecked": "",
75
+ children: unCheckedChildren
76
+ });
77
+ $[17] = unCheckedChildren;
78
+ $[18] = t14;
79
+ } else t14 = $[18];
80
+ let t15;
81
+ if ($[19] !== t13 || $[20] !== t14) {
82
+ t15 = /*#__PURE__*/ jsxs("span", {
83
+ "data-tao-switch-inner": "",
84
+ children: [
85
+ t13,
86
+ t14
87
+ ]
88
+ });
89
+ $[19] = t13;
90
+ $[20] = t14;
91
+ $[21] = t15;
92
+ } else t15 = $[21];
93
+ let t16;
94
+ if ($[22] !== isDisabled || $[23] !== size || $[24] !== t12 || $[25] !== t15 || $[26] !== t2 || $[27] !== t4 || $[28] !== t6 || $[29] !== t7 || $[30] !== t8) {
95
+ t16 = /*#__PURE__*/ jsxs("button", {
96
+ type: "button",
97
+ role: "switch",
98
+ "aria-checked": t2,
99
+ disabled: isDisabled,
100
+ className: t4,
101
+ style: t6,
102
+ "data-tao-switch": "",
103
+ "data-tao-size": size,
104
+ "data-tao-checked": t7,
105
+ onClick: t8,
106
+ children: [
107
+ t12,
108
+ t15
109
+ ]
110
+ });
111
+ $[22] = isDisabled;
112
+ $[23] = size;
113
+ $[24] = t12;
114
+ $[25] = t15;
115
+ $[26] = t2;
116
+ $[27] = t4;
117
+ $[28] = t6;
118
+ $[29] = t7;
119
+ $[30] = t8;
120
+ $[31] = t16;
121
+ } else t16 = $[31];
122
+ return t16;
123
+ }
124
+ function LoadingIcon() {
125
+ const $ = c(1);
126
+ let t0;
127
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
128
+ t0 = /*#__PURE__*/ jsx("svg", {
129
+ "data-tao-switch-loading": "",
130
+ viewBox: "0 0 24 24",
131
+ fill: "none",
132
+ stroke: "currentColor",
133
+ strokeWidth: "3",
134
+ strokeLinecap: "round",
135
+ children: /*#__PURE__*/ jsx("path", {
136
+ d: "M21 12a9 9 0 1 1-6.219-8.56"
137
+ })
138
+ });
139
+ $[0] = t0;
140
+ } else t0 = $[0];
141
+ return t0;
142
+ }
143
+ export { Switch };