@rockshin/tao-ui 0.0.42 → 0.0.44
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 +8 -2
- package/component-manifest.json +37 -18
- package/dist/components/alert/alert.css +1 -0
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/calendar/calendar.css +10 -60
- package/dist/components/calendar/calendar.js +46 -43
- package/dist/components/card/card.css +1 -1
- package/dist/components/carousel/carousel.css +1 -0
- package/dist/components/carousel/carousel.js +62 -7
- package/dist/components/collapse/collapse-panels.d.ts +4 -0
- package/dist/components/collapse/collapse-panels.js +413 -0
- package/dist/components/collapse/collapse.css +199 -0
- package/dist/components/collapse/collapse.d.ts +77 -0
- package/dist/components/{collapsible/collapsible.js → collapse/collapse.js} +26 -10
- package/dist/components/color-picker/color-picker.css +8 -42
- package/dist/components/color-picker/color-picker.js +220 -145
- package/dist/components/date-picker/date-picker.css +18 -56
- package/dist/components/date-picker/date-picker.d.ts +2 -0
- package/dist/components/date-picker/date-picker.js +11 -6
- package/dist/components/date-picker/presets.js +5 -2
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +3 -1
- package/dist/components/form/field-control.d.ts +6 -0
- package/dist/components/form/field-control.js +42 -0
- package/dist/components/form/form-context.d.ts +3 -0
- package/dist/components/form/form-item.d.ts +2 -1
- package/dist/components/form/form-item.js +56 -42
- package/dist/components/form/form.css +15 -0
- package/dist/components/form/form.d.ts +5 -5
- package/dist/components/form/form.js +87 -68
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/use-form.d.ts +16 -0
- package/dist/components/form/use-form.js +69 -0
- package/dist/components/form-field/form-field-view.d.ts +6 -2
- package/dist/components/form-field/form-field-view.js +116 -84
- package/dist/components/input/base-input.d.ts +25 -0
- package/dist/components/input/base-input.js +104 -0
- package/dist/components/input/input-shared.css +75 -0
- package/dist/components/input/input-shared.d.ts +59 -0
- package/dist/components/input/input-shared.js +152 -0
- package/dist/components/input/input.css +99 -4
- package/dist/components/input/input.d.ts +12 -16
- package/dist/components/input/input.js +11 -154
- package/dist/components/input/otp.d.ts +29 -0
- package/dist/components/input/otp.js +335 -0
- package/dist/components/input/password.d.ts +12 -0
- package/dist/components/input/password.js +117 -0
- package/dist/components/input/search.d.ts +16 -0
- package/dist/components/input/search.js +99 -0
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/input-number/input-number.js +2 -2
- package/dist/components/list/list-pagination.css +5 -5
- package/dist/components/list/list-pagination.js +1 -0
- package/dist/components/mentions/mentions.css +7 -0
- package/dist/components/modal/modal.css +1 -0
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +78 -73
- package/dist/components/select/mobile-select.css +1 -16
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +68 -63
- package/dist/components/select/select-types.d.ts +2 -0
- package/dist/components/select/select.css +19 -0
- package/dist/components/select/select.js +31 -17
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/steps/steps.css +53 -3
- package/dist/components/table/table.css +0 -5
- package/dist/components/table/table.js +21 -22
- package/dist/components/textarea/textarea.css +20 -0
- package/dist/components/textarea/textarea.d.ts +12 -6
- package/dist/components/textarea/textarea.js +120 -219
- package/dist/components/time-picker/time-picker.css +7 -0
- package/dist/components/tree/tree-check.d.ts +1 -0
- package/dist/components/tree/tree-check.js +36 -0
- package/dist/components/tree/tree.css +13 -18
- package/dist/components/tree/tree.js +2 -3
- package/dist/components/tree-select/select-engine.css +7 -0
- package/dist/components/tree-select/tree-select.js +2 -3
- package/dist/components/upload/upload.css +0 -11
- package/dist/components/upload/upload.js +13 -3
- package/dist/docs/component-docs.js +2 -2
- package/dist/docs/components/{collapsible.doc.d.ts → collapse.doc.d.ts} +1 -1
- package/dist/docs/components/collapse.doc.js +47 -0
- package/dist/docs/components/form.doc.js +3 -1
- package/dist/docs/components/input.doc.js +11 -4
- package/dist/docs/components/textarea.doc.js +4 -2
- package/dist/entries/collapse.d.ts +3 -0
- package/dist/entries/{collapsible.js → collapse.js} +1 -1
- package/dist/entries/form.d.ts +2 -2
- package/dist/entries/input.d.ts +1 -1
- package/dist/entries/textarea.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/provider/locale.d.ts +6 -0
- package/dist/provider/locale.js +10 -0
- package/dist/provider/tao-provider.js +1 -0
- package/dist/theme/control.css +2 -2
- package/dist/theme/theme.css +3 -1
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +1 -0
- package/dist/utils/field-label.d.ts +4 -0
- package/dist/utils/field-label.js +7 -0
- package/llms.txt +19 -16
- package/package.json +10 -5
- package/dist/components/collapsible/collapsible.css +0 -49
- package/dist/components/collapsible/collapsible.d.ts +0 -39
- package/dist/docs/components/collapsible.doc.js +0 -39
- package/dist/entries/collapsible.d.ts +0 -3
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, forwardRef, isValidElement, useRef } from "react";
|
|
3
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
4
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
5
|
+
import { cx } from "../../utils/semantic.js";
|
|
6
|
+
import { Button } from "../button/button.js";
|
|
7
|
+
import { SearchIcon } from "../select/select-icons.js";
|
|
8
|
+
import { BaseInput } from "./base-input.js";
|
|
9
|
+
const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
10
|
+
const { enterButton = false, loading, searchIcon, onSearch, onChange, onPressEnter, classNames: customClassNames, styles: customStyles, className, style, addonAfter, ...rest } = props;
|
|
11
|
+
const ctx = useTaoConfig();
|
|
12
|
+
const disabled = props.disabled ?? ctx.disabled;
|
|
13
|
+
const inputRef = useRef(null);
|
|
14
|
+
const classNames = 'function' == typeof customClassNames ? customClassNames({
|
|
15
|
+
props
|
|
16
|
+
}) : customClassNames;
|
|
17
|
+
const styles = 'function' == typeof customStyles ? customStyles({
|
|
18
|
+
props
|
|
19
|
+
}) : customStyles;
|
|
20
|
+
const search = (event)=>{
|
|
21
|
+
if (!disabled && !loading && !event.defaultPrevented) onSearch?.(inputRef.current.value, event, {
|
|
22
|
+
source: 'input'
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const buttonProps = {
|
|
26
|
+
type: 'button',
|
|
27
|
+
disabled: disabled || loading,
|
|
28
|
+
'aria-busy': loading || void 0,
|
|
29
|
+
'aria-label': ctx.locale.search ?? 'Search',
|
|
30
|
+
className: classNames?.button,
|
|
31
|
+
style: styles?.button,
|
|
32
|
+
onMouseDown: (event_0)=>event_0.preventDefault(),
|
|
33
|
+
onClick: search
|
|
34
|
+
};
|
|
35
|
+
const customButton = /*#__PURE__*/ isValidElement(enterButton) && ('button' === enterButton.type || enterButton.type === Button);
|
|
36
|
+
const button = customButton ? /*#__PURE__*/ cloneElement(enterButton, {
|
|
37
|
+
...buttonProps,
|
|
38
|
+
className: cx(enterButton.props.className, classNames?.button),
|
|
39
|
+
style: {
|
|
40
|
+
...enterButton.props.style,
|
|
41
|
+
...styles?.button
|
|
42
|
+
},
|
|
43
|
+
'aria-label': enterButton.props['aria-label'] ?? buttonProps['aria-label'],
|
|
44
|
+
disabled: buttonProps.disabled || enterButton.props.disabled,
|
|
45
|
+
...enterButton.type === Button ? {
|
|
46
|
+
loading,
|
|
47
|
+
size: props.size ?? enterButton.props.size
|
|
48
|
+
} : {},
|
|
49
|
+
onMouseDown: (event_1)=>{
|
|
50
|
+
enterButton.props.onMouseDown?.(event_1);
|
|
51
|
+
event_1.preventDefault();
|
|
52
|
+
},
|
|
53
|
+
onClick: (event_2)=>{
|
|
54
|
+
enterButton.props.onClick?.(event_2);
|
|
55
|
+
search(event_2);
|
|
56
|
+
}
|
|
57
|
+
}) : /*#__PURE__*/ jsx(Button, {
|
|
58
|
+
...buttonProps,
|
|
59
|
+
loading: loading,
|
|
60
|
+
size: props.size,
|
|
61
|
+
variant: enterButton ? 'primary' : 'secondary',
|
|
62
|
+
children: true !== enterButton && enterButton ? enterButton : searchIcon ?? /*#__PURE__*/ jsx(SearchIcon, {})
|
|
63
|
+
});
|
|
64
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
65
|
+
"data-tao-input-search": "",
|
|
66
|
+
className: cx(classNames?.root, className),
|
|
67
|
+
style: {
|
|
68
|
+
...styles?.root,
|
|
69
|
+
...style
|
|
70
|
+
},
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ jsx(BaseInput, {
|
|
73
|
+
...rest,
|
|
74
|
+
ref: mergeRefs(inputRef, ref),
|
|
75
|
+
classNames: {
|
|
76
|
+
...classNames,
|
|
77
|
+
root: void 0
|
|
78
|
+
},
|
|
79
|
+
styles: {
|
|
80
|
+
...styles,
|
|
81
|
+
root: void 0
|
|
82
|
+
},
|
|
83
|
+
onChange: (event_3)=>{
|
|
84
|
+
onChange?.(event_3);
|
|
85
|
+
if ('click' === event_3.type && !disabled && !loading) onSearch?.('', event_3, {
|
|
86
|
+
source: 'clear'
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
onPressEnter: (event_4)=>{
|
|
90
|
+
onPressEnter?.(event_4);
|
|
91
|
+
search(event_4);
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
button,
|
|
95
|
+
addonAfter
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
export { search_Search as Search };
|
|
@@ -2,8 +2,8 @@ import { type AriaAttributes, type ReactNode, type Ref } from 'react';
|
|
|
2
2
|
import { type UseNumberInputOptions } from '../../number-input/use-number-input.js';
|
|
3
3
|
import type { TaoSize, TaoStatus, TaoVariant } from '../../provider/tao-provider.js';
|
|
4
4
|
import type { SemanticClassNames, SemanticStyles } from '../../utils/semantic.js';
|
|
5
|
-
import { type InputSemanticPart } from '../input/input.js';
|
|
6
|
-
export type InputNumberSemanticPart = InputSemanticPart
|
|
5
|
+
import { type InputSemanticPart } from '../input/base-input.js';
|
|
6
|
+
export type InputNumberSemanticPart = Extract<InputSemanticPart, 'root' | 'input' | 'prefix' | 'suffix'>;
|
|
7
7
|
export interface InputNumberProps extends UseNumberInputOptions, Pick<AriaAttributes, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-errormessage' | 'aria-invalid' | 'aria-required'> {
|
|
8
8
|
prefix?: ReactNode;
|
|
9
9
|
suffix?: ReactNode;
|
|
@@ -3,7 +3,7 @@ import { c } from "react-compiler-runtime";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useNumberInput } from "../../number-input/use-number-input.js";
|
|
5
5
|
import { mergeRefs } from "../../utils/refs.js";
|
|
6
|
-
import {
|
|
6
|
+
import { BaseInput } from "../input/base-input.js";
|
|
7
7
|
const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwardedRef) {
|
|
8
8
|
const $ = c(49);
|
|
9
9
|
let ariaDescribedBy;
|
|
@@ -93,7 +93,7 @@ const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwarded
|
|
|
93
93
|
const t2 = "error" === status || error ? true : ariaInvalid;
|
|
94
94
|
let t3;
|
|
95
95
|
if ($[27] !== ariaDescribedBy || $[28] !== ariaErrorMessage || $[29] !== ariaLabel || $[30] !== ariaLabelledBy || $[31] !== ariaRequired || $[32] !== className || $[33] !== classNames || $[34] !== disabled || $[35] !== error || $[36] !== id || $[37] !== inputRest || $[38] !== name || $[39] !== placeholder || $[40] !== prefix || $[41] !== size || $[42] !== status || $[43] !== styles || $[44] !== suffix || $[45] !== t1 || $[46] !== t2 || $[47] !== variant) {
|
|
96
|
-
t3 = /*#__PURE__*/ jsx(
|
|
96
|
+
t3 = /*#__PURE__*/ jsx(BaseInput, {
|
|
97
97
|
ref: t1,
|
|
98
98
|
prefix: prefix,
|
|
99
99
|
suffix: suffix,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
cursor: not-allowed;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
[data-tao-list-pages] button {
|
|
54
|
+
:is([data-tao-list-page-button], [data-tao-list-pages] [class$="-quick-jumper-button"], [data-tao-list-pages] [class$="-simple-pager"] > button) {
|
|
55
55
|
font: inherit;
|
|
56
56
|
color: inherit;
|
|
57
57
|
border-radius: inherit;
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
padding: 0 8px;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
[data-tao-list-pages] button:disabled {
|
|
65
|
+
:is([data-tao-list-page-button], [data-tao-list-pages] [class$="-quick-jumper-button"], [data-tao-list-pages] [class$="-simple-pager"] > button):disabled {
|
|
66
66
|
cursor: not-allowed;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
[data-tao-list-pages] input {
|
|
69
|
+
[data-tao-list-pages] :is([class$="-quick-jumper"], [class$="-simple-pager"]) > input {
|
|
70
70
|
width: 48px;
|
|
71
71
|
min-width: 0;
|
|
72
72
|
height: var(--tao-control-height);
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
padding-inline: 4px;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
[data-tao-list-pages] input:focus-visible {
|
|
84
|
+
[data-tao-list-pages] :is([class$="-quick-jumper"], [class$="-simple-pager"]) > input:focus-visible {
|
|
85
85
|
outline: 2px solid var(--tao-color-primary);
|
|
86
86
|
outline-offset: 2px;
|
|
87
87
|
}
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
gap: 4px;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
[data-tao-list-pages][data-tao-size="small"] input {
|
|
112
|
+
[data-tao-list-pages][data-tao-size="small"] :is([class$="-quick-jumper"], [class$="-simple-pager"]) > input {
|
|
113
113
|
width: 32px;
|
|
114
114
|
height: var(--tao-control-height-sm);
|
|
115
115
|
margin-inline: 4px;
|
|
@@ -218,6 +218,7 @@ function ListPaginationControl(props) {
|
|
|
218
218
|
let t27;
|
|
219
219
|
if ($[51] !== contextLocale.next || $[52] !== contextLocale.previous || $[53] !== current || $[54] !== disabled || $[55] !== itemRender || $[56] !== props.disabled || $[57] !== totalPages) {
|
|
220
220
|
t27 = itemRender ?? ((page, type)=>/*#__PURE__*/ jsx("button", {
|
|
221
|
+
"data-tao-list-page-button": "",
|
|
221
222
|
type: "button",
|
|
222
223
|
"aria-label": "page" === type ? `Page ${page}` : "prev" === type ? contextLocale.previous : "next" === type ? contextLocale.next : "jump-prev" === type ? "Previous pages" : "Next pages",
|
|
223
224
|
"aria-current": "page" === type && page === current ? "page" : void 0,
|
|
@@ -120,6 +120,13 @@
|
|
|
120
120
|
color: var(--tao-color-text);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
@media (hover: hover) and (pointer: fine) {
|
|
124
|
+
[data-tao-mentions]:not(:hover) [class*="-clear-icon"]:not(:focus-visible) {
|
|
125
|
+
opacity: 0;
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
123
130
|
[data-tao-mentions] [class*="-clear-icon"]:focus-visible {
|
|
124
131
|
outline: 2px solid var(--tao-primary);
|
|
125
132
|
outline-offset: 1px;
|
|
@@ -35,4 +35,4 @@ export interface RadioGroupProps extends Pick<AriaAttributes, 'aria-label' | 'ar
|
|
|
35
35
|
name?: string;
|
|
36
36
|
children?: ReactNode;
|
|
37
37
|
}
|
|
38
|
-
export declare function RadioGroup({ options, value, onChange, disabled, direction, name, children, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, }: RadioGroupProps): import("react").JSX.Element;
|
|
38
|
+
export declare function RadioGroup({ options, value, defaultValue, onChange, disabled, direction, name, children, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-errormessage': ariaErrorMessage, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, }: RadioGroupProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { createContext, forwardRef, useContext } from "react";
|
|
3
|
+
import { createContext, forwardRef, useContext, useState } from "react";
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
6
6
|
import "./radio.css";
|
|
@@ -171,34 +171,39 @@ const radio_Radio = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
|
171
171
|
return t15;
|
|
172
172
|
});
|
|
173
173
|
function RadioGroup(t0) {
|
|
174
|
-
const $ = c(
|
|
175
|
-
const { options, value, onChange, disabled, direction: t1, name, children, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, "aria-required": ariaRequired } = t0;
|
|
174
|
+
const $ = c(48);
|
|
175
|
+
const { options, value, defaultValue, onChange, disabled, direction: t1, name, children, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, "aria-required": ariaRequired } = t0;
|
|
176
176
|
const direction = void 0 === t1 ? "horizontal" : t1;
|
|
177
177
|
const ctx = useTaoConfig();
|
|
178
178
|
const resolvedDisabled = disabled ?? ctx.disabled ?? false;
|
|
179
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
180
|
+
const isControlled = void 0 !== value;
|
|
181
|
+
const resolvedValue = isControlled ? value : internalValue;
|
|
179
182
|
let t2;
|
|
180
|
-
if ($[0] !== onChange) {
|
|
183
|
+
if ($[0] !== isControlled || $[1] !== onChange) {
|
|
181
184
|
t2 = (itemValue)=>{
|
|
185
|
+
if (!isControlled) setInternalValue(itemValue);
|
|
182
186
|
onChange?.(itemValue);
|
|
183
187
|
};
|
|
184
|
-
$[0] =
|
|
185
|
-
$[1] =
|
|
186
|
-
|
|
188
|
+
$[0] = isControlled;
|
|
189
|
+
$[1] = onChange;
|
|
190
|
+
$[2] = t2;
|
|
191
|
+
} else t2 = $[2];
|
|
187
192
|
const handleChange = t2;
|
|
188
193
|
let t3;
|
|
189
|
-
if ($[
|
|
194
|
+
if ($[3] !== handleChange || $[4] !== name || $[5] !== resolvedDisabled || $[6] !== resolvedValue) {
|
|
190
195
|
t3 = {
|
|
191
196
|
name,
|
|
192
|
-
value,
|
|
197
|
+
value: resolvedValue,
|
|
193
198
|
disabled: resolvedDisabled,
|
|
194
199
|
onChange: handleChange
|
|
195
200
|
};
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
} else t3 = $[
|
|
201
|
+
$[3] = handleChange;
|
|
202
|
+
$[4] = name;
|
|
203
|
+
$[5] = resolvedDisabled;
|
|
204
|
+
$[6] = resolvedValue;
|
|
205
|
+
$[7] = t3;
|
|
206
|
+
} else t3 = $[7];
|
|
202
207
|
const groupCtxValue = t3;
|
|
203
208
|
let T0;
|
|
204
209
|
let t10;
|
|
@@ -213,7 +218,7 @@ function RadioGroup(t0) {
|
|
|
213
218
|
let t7;
|
|
214
219
|
let t8;
|
|
215
220
|
let t9;
|
|
216
|
-
if ($[
|
|
221
|
+
if ($[8] !== ariaDescribedBy || $[9] !== ariaErrorMessage || $[10] !== ariaInvalid || $[11] !== ariaLabel || $[12] !== ariaLabelledBy || $[13] !== ariaRequired || $[14] !== children || $[15] !== direction || $[16] !== groupCtxValue || $[17] !== id || $[18] !== options) {
|
|
217
222
|
const normalizedOptions = options?.map(_temp);
|
|
218
223
|
T0 = RadioGroupContext.Provider;
|
|
219
224
|
t15 = groupCtxValue;
|
|
@@ -228,47 +233,47 @@ function RadioGroup(t0) {
|
|
|
228
233
|
t12 = ariaInvalid;
|
|
229
234
|
t13 = ariaRequired;
|
|
230
235
|
t14 = normalizedOptions ? normalizedOptions.map(_temp2) : children;
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
236
|
+
$[8] = ariaDescribedBy;
|
|
237
|
+
$[9] = ariaErrorMessage;
|
|
238
|
+
$[10] = ariaInvalid;
|
|
239
|
+
$[11] = ariaLabel;
|
|
240
|
+
$[12] = ariaLabelledBy;
|
|
241
|
+
$[13] = ariaRequired;
|
|
242
|
+
$[14] = children;
|
|
243
|
+
$[15] = direction;
|
|
244
|
+
$[16] = groupCtxValue;
|
|
245
|
+
$[17] = id;
|
|
246
|
+
$[18] = options;
|
|
247
|
+
$[19] = T0;
|
|
248
|
+
$[20] = t10;
|
|
249
|
+
$[21] = t11;
|
|
250
|
+
$[22] = t12;
|
|
251
|
+
$[23] = t13;
|
|
252
|
+
$[24] = t14;
|
|
253
|
+
$[25] = t15;
|
|
254
|
+
$[26] = t4;
|
|
255
|
+
$[27] = t5;
|
|
256
|
+
$[28] = t6;
|
|
257
|
+
$[29] = t7;
|
|
258
|
+
$[30] = t8;
|
|
259
|
+
$[31] = t9;
|
|
255
260
|
} else {
|
|
256
|
-
T0 = $[
|
|
257
|
-
t10 = $[
|
|
258
|
-
t11 = $[
|
|
259
|
-
t12 = $[
|
|
260
|
-
t13 = $[
|
|
261
|
-
t14 = $[
|
|
262
|
-
t15 = $[
|
|
263
|
-
t4 = $[
|
|
264
|
-
t5 = $[
|
|
265
|
-
t6 = $[
|
|
266
|
-
t7 = $[
|
|
267
|
-
t8 = $[
|
|
268
|
-
t9 = $[
|
|
261
|
+
T0 = $[19];
|
|
262
|
+
t10 = $[20];
|
|
263
|
+
t11 = $[21];
|
|
264
|
+
t12 = $[22];
|
|
265
|
+
t13 = $[23];
|
|
266
|
+
t14 = $[24];
|
|
267
|
+
t15 = $[25];
|
|
268
|
+
t4 = $[26];
|
|
269
|
+
t5 = $[27];
|
|
270
|
+
t6 = $[28];
|
|
271
|
+
t7 = $[29];
|
|
272
|
+
t8 = $[30];
|
|
273
|
+
t9 = $[31];
|
|
269
274
|
}
|
|
270
275
|
let t16;
|
|
271
|
-
if ($[
|
|
276
|
+
if ($[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t4 || $[38] !== t5 || $[39] !== t6 || $[40] !== t7 || $[41] !== t8 || $[42] !== t9) {
|
|
272
277
|
t16 = /*#__PURE__*/ jsx("div", {
|
|
273
278
|
"data-tao-radio-group": t4,
|
|
274
279
|
"data-tao-direction": t5,
|
|
@@ -282,30 +287,30 @@ function RadioGroup(t0) {
|
|
|
282
287
|
"aria-required": t13,
|
|
283
288
|
children: t14
|
|
284
289
|
});
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
} else t16 = $[
|
|
290
|
+
$[32] = t10;
|
|
291
|
+
$[33] = t11;
|
|
292
|
+
$[34] = t12;
|
|
293
|
+
$[35] = t13;
|
|
294
|
+
$[36] = t14;
|
|
295
|
+
$[37] = t4;
|
|
296
|
+
$[38] = t5;
|
|
297
|
+
$[39] = t6;
|
|
298
|
+
$[40] = t7;
|
|
299
|
+
$[41] = t8;
|
|
300
|
+
$[42] = t9;
|
|
301
|
+
$[43] = t16;
|
|
302
|
+
} else t16 = $[43];
|
|
298
303
|
let t17;
|
|
299
|
-
if ($[
|
|
304
|
+
if ($[44] !== T0 || $[45] !== t15 || $[46] !== t16) {
|
|
300
305
|
t17 = /*#__PURE__*/ jsx(T0, {
|
|
301
306
|
value: t15,
|
|
302
307
|
children: t16
|
|
303
308
|
});
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
} else t17 = $[
|
|
309
|
+
$[44] = T0;
|
|
310
|
+
$[45] = t15;
|
|
311
|
+
$[46] = t16;
|
|
312
|
+
$[47] = t17;
|
|
313
|
+
} else t17 = $[47];
|
|
309
314
|
return t17;
|
|
310
315
|
}
|
|
311
316
|
function _temp2(opt_0) {
|
|
@@ -140,23 +140,8 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
[data-tao-sheet-done] {
|
|
143
|
-
|
|
144
|
-
background: var(--tao-primary);
|
|
143
|
+
-webkit-tap-highlight-color: transparent;
|
|
145
144
|
width: 100%;
|
|
146
145
|
height: 44px;
|
|
147
|
-
color: var(--tao-color-text-light-solid);
|
|
148
|
-
font-family: var(--tao-font-family);
|
|
149
|
-
font-size: var(--tao-font-size-base);
|
|
150
|
-
font-weight: var(--tao-font-weight-medium);
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
-webkit-tap-highlight-color: transparent;
|
|
153
|
-
border: none;
|
|
154
|
-
justify-content: center;
|
|
155
|
-
align-items: center;
|
|
156
|
-
display: flex;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
[data-tao-sheet-done]:active {
|
|
160
|
-
opacity: .85;
|
|
161
146
|
}
|
|
162
147
|
|
|
@@ -29,5 +29,6 @@ declare function MobileSelectContentInner({ options, value, onChange, onMultiCha
|
|
|
29
29
|
export { MobileSelectContentInner as MobileSelectContent };
|
|
30
30
|
export interface MobileSelectDrawerProps extends MobileSelectContentProps {
|
|
31
31
|
open: boolean;
|
|
32
|
+
mobileTitle?: ReactNode;
|
|
32
33
|
}
|
|
33
|
-
export declare function MobileSelectDrawer({ open, onClose, placeholder, classNames, styles, popupRender, ...rest }: MobileSelectDrawerProps): import("react").JSX.Element;
|
|
34
|
+
export declare function MobileSelectDrawer({ open, mobileTitle, onClose, placeholder, classNames, styles, popupRender, ...rest }: MobileSelectDrawerProps): import("react").JSX.Element;
|
|
@@ -2,7 +2,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useCallback, useMemo, useRef } from "react";
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
5
6
|
import { Drawer } from "../drawer/drawer.js";
|
|
7
|
+
import { useMobileTitle } from "../../utils/field-label.js";
|
|
6
8
|
import { SearchIcon } from "./select-icons.js";
|
|
7
9
|
import { countLeafOptions, defaultFilter, filterTree, flattenLeafOptions } from "./select-model.js";
|
|
8
10
|
import { useSelectSelection } from "./use-select-selection.js";
|
|
@@ -204,8 +206,8 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
204
206
|
}),
|
|
205
207
|
multiple && /*#__PURE__*/ jsx("div", {
|
|
206
208
|
"data-tao-sheet-footer": "",
|
|
207
|
-
children: /*#__PURE__*/ jsx(
|
|
208
|
-
|
|
209
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
210
|
+
size: "large",
|
|
209
211
|
"data-tao-sheet-done": "",
|
|
210
212
|
disabled: disabled || null != maxCount && draft.length > maxCount,
|
|
211
213
|
onClick: handleDone,
|
|
@@ -216,8 +218,9 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
216
218
|
});
|
|
217
219
|
}
|
|
218
220
|
function MobileSelectDrawer(t0) {
|
|
219
|
-
const $ = c(
|
|
221
|
+
const $ = c(29);
|
|
220
222
|
let classNames;
|
|
223
|
+
let mobileTitle;
|
|
221
224
|
let onClose;
|
|
222
225
|
let open;
|
|
223
226
|
let placeholder;
|
|
@@ -225,27 +228,30 @@ function MobileSelectDrawer(t0) {
|
|
|
225
228
|
let rest;
|
|
226
229
|
let styles;
|
|
227
230
|
if ($[0] !== t0) {
|
|
228
|
-
({ open, onClose, placeholder, classNames, styles, popupRender, ...rest } = t0);
|
|
231
|
+
({ open, mobileTitle, onClose, placeholder, classNames, styles, popupRender, ...rest } = t0);
|
|
229
232
|
$[0] = t0;
|
|
230
233
|
$[1] = classNames;
|
|
231
|
-
$[2] =
|
|
232
|
-
$[3] =
|
|
233
|
-
$[4] =
|
|
234
|
-
$[5] =
|
|
235
|
-
$[6] =
|
|
236
|
-
$[7] =
|
|
234
|
+
$[2] = mobileTitle;
|
|
235
|
+
$[3] = onClose;
|
|
236
|
+
$[4] = open;
|
|
237
|
+
$[5] = placeholder;
|
|
238
|
+
$[6] = popupRender;
|
|
239
|
+
$[7] = rest;
|
|
240
|
+
$[8] = styles;
|
|
237
241
|
} else {
|
|
238
242
|
classNames = $[1];
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
mobileTitle = $[2];
|
|
244
|
+
onClose = $[3];
|
|
245
|
+
open = $[4];
|
|
246
|
+
placeholder = $[5];
|
|
247
|
+
popupRender = $[6];
|
|
248
|
+
rest = $[7];
|
|
249
|
+
styles = $[8];
|
|
245
250
|
}
|
|
246
251
|
const { locale } = useTaoConfig();
|
|
252
|
+
const title = useMobileTitle(mobileTitle, locale.select);
|
|
247
253
|
let t1;
|
|
248
|
-
if ($[
|
|
254
|
+
if ($[9] !== classNames || $[10] !== onClose || $[11] !== placeholder || $[12] !== rest || $[13] !== styles) {
|
|
249
255
|
t1 = /*#__PURE__*/ jsx(MobileSelectContentInner, {
|
|
250
256
|
onClose: onClose,
|
|
251
257
|
placeholder: placeholder,
|
|
@@ -253,61 +259,60 @@ function MobileSelectDrawer(t0) {
|
|
|
253
259
|
styles: styles,
|
|
254
260
|
...rest
|
|
255
261
|
});
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
} else t1 = $[
|
|
262
|
+
$[9] = classNames;
|
|
263
|
+
$[10] = onClose;
|
|
264
|
+
$[11] = placeholder;
|
|
265
|
+
$[12] = rest;
|
|
266
|
+
$[13] = styles;
|
|
267
|
+
$[14] = t1;
|
|
268
|
+
} else t1 = $[14];
|
|
263
269
|
const content = t1;
|
|
264
|
-
const t2 =
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
root: t3
|
|
270
|
+
const t2 = classNames?.popup;
|
|
271
|
+
let t3;
|
|
272
|
+
if ($[15] !== t2) {
|
|
273
|
+
t3 = {
|
|
274
|
+
root: t2
|
|
270
275
|
};
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
} else
|
|
274
|
-
const
|
|
275
|
-
let
|
|
276
|
-
if ($[
|
|
277
|
-
|
|
278
|
-
root:
|
|
276
|
+
$[15] = t2;
|
|
277
|
+
$[16] = t3;
|
|
278
|
+
} else t3 = $[16];
|
|
279
|
+
const t4 = styles?.popup;
|
|
280
|
+
let t5;
|
|
281
|
+
if ($[17] !== t4) {
|
|
282
|
+
t5 = {
|
|
283
|
+
root: t4
|
|
279
284
|
};
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
} else
|
|
285
|
+
$[17] = t4;
|
|
286
|
+
$[18] = t5;
|
|
287
|
+
} else t5 = $[18];
|
|
288
|
+
let t6;
|
|
289
|
+
if ($[19] !== content || $[20] !== popupRender) {
|
|
290
|
+
t6 = popupRender ? popupRender(content) : content;
|
|
291
|
+
$[19] = content;
|
|
292
|
+
$[20] = popupRender;
|
|
293
|
+
$[21] = t6;
|
|
294
|
+
} else t6 = $[21];
|
|
283
295
|
let t7;
|
|
284
|
-
if ($[
|
|
285
|
-
t7 =
|
|
286
|
-
$[18] = content;
|
|
287
|
-
$[19] = popupRender;
|
|
288
|
-
$[20] = t7;
|
|
289
|
-
} else t7 = $[20];
|
|
290
|
-
let t8;
|
|
291
|
-
if ($[21] !== onClose || $[22] !== open || $[23] !== t2 || $[24] !== t4 || $[25] !== t6 || $[26] !== t7) {
|
|
292
|
-
t8 = /*#__PURE__*/ jsx(Drawer, {
|
|
296
|
+
if ($[22] !== onClose || $[23] !== open || $[24] !== t3 || $[25] !== t5 || $[26] !== t6 || $[27] !== title) {
|
|
297
|
+
t7 = /*#__PURE__*/ jsx(Drawer, {
|
|
293
298
|
open: open,
|
|
294
299
|
onClose: onClose,
|
|
295
300
|
placement: "bottom",
|
|
296
|
-
title:
|
|
301
|
+
title: title,
|
|
297
302
|
height: "70vh",
|
|
298
|
-
classNames:
|
|
299
|
-
styles:
|
|
300
|
-
children:
|
|
303
|
+
classNames: t3,
|
|
304
|
+
styles: t5,
|
|
305
|
+
children: t6
|
|
301
306
|
});
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
} else
|
|
310
|
-
return
|
|
307
|
+
$[22] = onClose;
|
|
308
|
+
$[23] = open;
|
|
309
|
+
$[24] = t3;
|
|
310
|
+
$[25] = t5;
|
|
311
|
+
$[26] = t6;
|
|
312
|
+
$[27] = title;
|
|
313
|
+
$[28] = t7;
|
|
314
|
+
} else t7 = $[28];
|
|
315
|
+
return t7;
|
|
311
316
|
}
|
|
312
317
|
function CheckIcon() {
|
|
313
318
|
const $ = c(1);
|
|
@@ -120,6 +120,8 @@ export interface SelectProps extends Pick<AriaAttributes, 'aria-label' | 'aria-l
|
|
|
120
120
|
hideSelected?: boolean;
|
|
121
121
|
/** Force mobile or desktop. Otherwise use viewport <576px; an open popup keeps its presentation until closed. */
|
|
122
122
|
mobile?: boolean;
|
|
123
|
+
/** Mobile drawer title. Defaults to the Form.Item/FormField label, then locale text. */
|
|
124
|
+
mobileTitle?: ReactNode;
|
|
123
125
|
/** CSS class on the root element. */
|
|
124
126
|
className?: string;
|
|
125
127
|
/** Inline styles on the root element. */
|