@wix/site-ui 1.30.0 → 1.32.0
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/dist/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12749 -652
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/1268.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useLabelableContext, useFieldRootContext, fieldValidityMapping } from "./1477.js";
|
|
2
|
+
import { useLabelableId } from "./9048.js";
|
|
3
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
4
|
+
import { activeElement } from "./4549.js";
|
|
5
|
+
import { ownerDocument } from "./9829.js";
|
|
6
|
+
import { useControlled } from "./8527.js";
|
|
7
|
+
import { useStableCallback } from "./7541.js";
|
|
8
|
+
import { useRegisterFieldControl } from "./4281.js";
|
|
9
|
+
import { useRenderElement } from "./8272.js";
|
|
10
|
+
import { createChangeEventDetails } from "./4768.js";
|
|
11
|
+
import * as __rspack_external_react from "react";
|
|
12
|
+
const FieldControl_FieldControl = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
13
|
+
const { render, className, id: idProp, name: nameProp, value: valueProp, disabled: disabledProp = false, onValueChange, defaultValue, autoFocus = false, style, ...elementProps } = componentProps;
|
|
14
|
+
const { state: fieldState, name: fieldName, disabled: fieldDisabled, setTouched, setDirty, validityData, setFocused, setFilled, validationMode, validation } = useFieldRootContext();
|
|
15
|
+
const disabled = fieldDisabled || disabledProp;
|
|
16
|
+
const name = fieldName ?? nameProp;
|
|
17
|
+
const state = {
|
|
18
|
+
...fieldState,
|
|
19
|
+
disabled
|
|
20
|
+
};
|
|
21
|
+
const { labelId } = useLabelableContext();
|
|
22
|
+
const id = useLabelableId({
|
|
23
|
+
id: idProp
|
|
24
|
+
});
|
|
25
|
+
useIsoLayoutEffect(()=>{
|
|
26
|
+
const hasExternalValue = null != valueProp;
|
|
27
|
+
if (validation.inputRef.current?.value || hasExternalValue && '' !== valueProp) setFilled(true);
|
|
28
|
+
else if (hasExternalValue && '' === valueProp) setFilled(false);
|
|
29
|
+
}, [
|
|
30
|
+
validation.inputRef,
|
|
31
|
+
setFilled,
|
|
32
|
+
valueProp
|
|
33
|
+
]);
|
|
34
|
+
const inputRef = __rspack_external_react.useRef(null);
|
|
35
|
+
useIsoLayoutEffect(()=>{
|
|
36
|
+
if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) setFocused(true);
|
|
37
|
+
}, [
|
|
38
|
+
autoFocus,
|
|
39
|
+
setFocused
|
|
40
|
+
]);
|
|
41
|
+
const [valueUnwrapped] = useControlled({
|
|
42
|
+
controlled: valueProp,
|
|
43
|
+
default: defaultValue,
|
|
44
|
+
name: 'FieldControl',
|
|
45
|
+
state: 'value'
|
|
46
|
+
});
|
|
47
|
+
const isControlled = void 0 !== valueProp;
|
|
48
|
+
const value = isControlled ? valueUnwrapped : void 0;
|
|
49
|
+
const getValueFromInput = useStableCallback(()=>validation.inputRef.current?.value);
|
|
50
|
+
useRegisterFieldControl(validation.inputRef, id, value, getValueFromInput);
|
|
51
|
+
const element = useRenderElement('input', componentProps, {
|
|
52
|
+
ref: [
|
|
53
|
+
forwardedRef,
|
|
54
|
+
inputRef
|
|
55
|
+
],
|
|
56
|
+
state,
|
|
57
|
+
props: [
|
|
58
|
+
{
|
|
59
|
+
id,
|
|
60
|
+
disabled,
|
|
61
|
+
name,
|
|
62
|
+
ref: validation.inputRef,
|
|
63
|
+
'aria-labelledby': labelId,
|
|
64
|
+
autoFocus,
|
|
65
|
+
...isControlled ? {
|
|
66
|
+
value
|
|
67
|
+
} : {
|
|
68
|
+
defaultValue
|
|
69
|
+
},
|
|
70
|
+
onChange (event) {
|
|
71
|
+
const inputValue = event.currentTarget.value;
|
|
72
|
+
onValueChange?.(inputValue, createChangeEventDetails("none", event.nativeEvent));
|
|
73
|
+
setDirty(inputValue !== validityData.initialValue);
|
|
74
|
+
setFilled('' !== inputValue);
|
|
75
|
+
},
|
|
76
|
+
onFocus () {
|
|
77
|
+
setFocused(true);
|
|
78
|
+
},
|
|
79
|
+
onBlur (event) {
|
|
80
|
+
setTouched(true);
|
|
81
|
+
setFocused(false);
|
|
82
|
+
if ('onBlur' === validationMode) validation.commit(event.currentTarget.value);
|
|
83
|
+
},
|
|
84
|
+
onKeyDown (event) {
|
|
85
|
+
if ('INPUT' === event.currentTarget.tagName && 'Enter' === event.key) {
|
|
86
|
+
setTouched(true);
|
|
87
|
+
validation.commit(event.currentTarget.value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
validation.getInputValidationProps(),
|
|
92
|
+
elementProps
|
|
93
|
+
],
|
|
94
|
+
stateAttributesMapping: fieldValidityMapping
|
|
95
|
+
});
|
|
96
|
+
return element;
|
|
97
|
+
});
|
|
98
|
+
if ("production" !== process.env.NODE_ENV) FieldControl_FieldControl.displayName = "FieldControl";
|
|
99
|
+
export { FieldControl_FieldControl };
|
package/dist/1279.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as __rspack_external_react from "react";
|
|
2
|
+
const RadioGroupContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
3
|
+
if ("production" !== process.env.NODE_ENV) RadioGroupContext.displayName = "RadioGroupContext";
|
|
4
|
+
function useRadioGroupContext() {
|
|
5
|
+
return __rspack_external_react.useContext(RadioGroupContext);
|
|
6
|
+
}
|
|
7
|
+
export { RadioGroupContext, useRadioGroupContext };
|
package/dist/1457.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as __rspack_external_react from "react";
|
|
2
|
+
const FieldItemContext = /*#__PURE__*/ __rspack_external_react.createContext({
|
|
3
|
+
disabled: false
|
|
4
|
+
});
|
|
5
|
+
if ("production" !== process.env.NODE_ENV) FieldItemContext.displayName = "FieldItemContext";
|
|
6
|
+
function useFieldItemContext() {
|
|
7
|
+
const context = __rspack_external_react.useContext(FieldItemContext);
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export { FieldItemContext, useFieldItemContext };
|
package/dist/1477.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { NOOP, esm_formatErrorMessage, EMPTY_OBJECT } from "./8272.js";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
let FieldControlDataAttributes_FieldControlDataAttributes = /*#__PURE__*/ function(FieldControlDataAttributes) {
|
|
4
|
+
FieldControlDataAttributes["disabled"] = "data-disabled";
|
|
5
|
+
FieldControlDataAttributes["valid"] = "data-valid";
|
|
6
|
+
FieldControlDataAttributes["invalid"] = "data-invalid";
|
|
7
|
+
FieldControlDataAttributes["touched"] = "data-touched";
|
|
8
|
+
FieldControlDataAttributes["dirty"] = "data-dirty";
|
|
9
|
+
FieldControlDataAttributes["filled"] = "data-filled";
|
|
10
|
+
FieldControlDataAttributes["focused"] = "data-focused";
|
|
11
|
+
return FieldControlDataAttributes;
|
|
12
|
+
}({});
|
|
13
|
+
const DEFAULT_VALIDITY_STATE = {
|
|
14
|
+
badInput: false,
|
|
15
|
+
customError: false,
|
|
16
|
+
patternMismatch: false,
|
|
17
|
+
rangeOverflow: false,
|
|
18
|
+
rangeUnderflow: false,
|
|
19
|
+
stepMismatch: false,
|
|
20
|
+
tooLong: false,
|
|
21
|
+
tooShort: false,
|
|
22
|
+
typeMismatch: false,
|
|
23
|
+
valid: null,
|
|
24
|
+
valueMissing: false
|
|
25
|
+
};
|
|
26
|
+
const DEFAULT_FIELD_STATE_ATTRIBUTES = {
|
|
27
|
+
valid: null,
|
|
28
|
+
touched: false,
|
|
29
|
+
dirty: false,
|
|
30
|
+
filled: false,
|
|
31
|
+
focused: false
|
|
32
|
+
};
|
|
33
|
+
const DEFAULT_FIELD_ROOT_STATE = {
|
|
34
|
+
disabled: false,
|
|
35
|
+
...DEFAULT_FIELD_STATE_ATTRIBUTES
|
|
36
|
+
};
|
|
37
|
+
const fieldValidityMapping = {
|
|
38
|
+
valid (value) {
|
|
39
|
+
if (null === value) return null;
|
|
40
|
+
if (value) return {
|
|
41
|
+
[FieldControlDataAttributes_FieldControlDataAttributes.valid]: ''
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
[FieldControlDataAttributes_FieldControlDataAttributes.invalid]: ''
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const DEFAULT_FIELD_ROOT_CONTEXT = {
|
|
49
|
+
invalid: void 0,
|
|
50
|
+
name: void 0,
|
|
51
|
+
validityData: {
|
|
52
|
+
state: DEFAULT_VALIDITY_STATE,
|
|
53
|
+
errors: [],
|
|
54
|
+
error: '',
|
|
55
|
+
value: '',
|
|
56
|
+
initialValue: null
|
|
57
|
+
},
|
|
58
|
+
setValidityData: NOOP,
|
|
59
|
+
disabled: void 0,
|
|
60
|
+
touched: DEFAULT_FIELD_STATE_ATTRIBUTES.touched,
|
|
61
|
+
setTouched: NOOP,
|
|
62
|
+
dirty: DEFAULT_FIELD_STATE_ATTRIBUTES.dirty,
|
|
63
|
+
setDirty: NOOP,
|
|
64
|
+
filled: DEFAULT_FIELD_STATE_ATTRIBUTES.filled,
|
|
65
|
+
setFilled: NOOP,
|
|
66
|
+
focused: DEFAULT_FIELD_STATE_ATTRIBUTES.focused,
|
|
67
|
+
setFocused: NOOP,
|
|
68
|
+
validate: ()=>null,
|
|
69
|
+
validationMode: 'onSubmit',
|
|
70
|
+
validationDebounceTime: 0,
|
|
71
|
+
shouldValidateOnChange: ()=>false,
|
|
72
|
+
state: DEFAULT_FIELD_ROOT_STATE,
|
|
73
|
+
markedDirtyRef: {
|
|
74
|
+
current: false
|
|
75
|
+
},
|
|
76
|
+
registerFieldControl: NOOP,
|
|
77
|
+
validation: {
|
|
78
|
+
getValidationProps: (props = EMPTY_OBJECT)=>props,
|
|
79
|
+
getInputValidationProps: (props = EMPTY_OBJECT)=>props,
|
|
80
|
+
inputRef: {
|
|
81
|
+
current: null
|
|
82
|
+
},
|
|
83
|
+
commit: async ()=>{}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const FieldRootContext = /*#__PURE__*/ __rspack_external_react.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
|
|
87
|
+
if ("production" !== process.env.NODE_ENV) FieldRootContext.displayName = "FieldRootContext";
|
|
88
|
+
function useFieldRootContext(optional = true) {
|
|
89
|
+
const context = __rspack_external_react.useContext(FieldRootContext);
|
|
90
|
+
if (context.setValidityData === NOOP && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.' : esm_formatErrorMessage(28));
|
|
91
|
+
return context;
|
|
92
|
+
}
|
|
93
|
+
const LabelableContext = /*#__PURE__*/ __rspack_external_react.createContext({
|
|
94
|
+
controlId: void 0,
|
|
95
|
+
registerControlId: NOOP,
|
|
96
|
+
labelId: void 0,
|
|
97
|
+
setLabelId: NOOP,
|
|
98
|
+
messageIds: [],
|
|
99
|
+
setMessageIds: NOOP,
|
|
100
|
+
getDescriptionProps: (externalProps)=>externalProps
|
|
101
|
+
});
|
|
102
|
+
if ("production" !== process.env.NODE_ENV) LabelableContext.displayName = "LabelableContext";
|
|
103
|
+
function useLabelableContext() {
|
|
104
|
+
return __rspack_external_react.useContext(LabelableContext);
|
|
105
|
+
}
|
|
106
|
+
export { DEFAULT_FIELD_ROOT_CONTEXT, DEFAULT_FIELD_STATE_ATTRIBUTES, DEFAULT_VALIDITY_STATE, FieldRootContext, LabelableContext, fieldValidityMapping, useFieldRootContext, useLabelableContext };
|
package/dist/1500.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { isHTMLElement } from "./3829.js";
|
|
2
|
+
const ARROW_UP = 'ArrowUp';
|
|
3
|
+
const ARROW_DOWN = 'ArrowDown';
|
|
4
|
+
const ARROW_LEFT = 'ArrowLeft';
|
|
5
|
+
const ARROW_RIGHT = 'ArrowRight';
|
|
6
|
+
const HOME = 'Home';
|
|
7
|
+
const END = 'End';
|
|
8
|
+
const PAGE_DOWN = 'PageDown';
|
|
9
|
+
const HORIZONTAL_KEYS = new Set([
|
|
10
|
+
ARROW_LEFT,
|
|
11
|
+
ARROW_RIGHT
|
|
12
|
+
]);
|
|
13
|
+
const HORIZONTAL_KEYS_WITH_EXTRA_KEYS = new Set([
|
|
14
|
+
ARROW_LEFT,
|
|
15
|
+
ARROW_RIGHT,
|
|
16
|
+
HOME,
|
|
17
|
+
END
|
|
18
|
+
]);
|
|
19
|
+
const VERTICAL_KEYS = new Set([
|
|
20
|
+
ARROW_UP,
|
|
21
|
+
ARROW_DOWN
|
|
22
|
+
]);
|
|
23
|
+
const VERTICAL_KEYS_WITH_EXTRA_KEYS = new Set([
|
|
24
|
+
ARROW_UP,
|
|
25
|
+
ARROW_DOWN,
|
|
26
|
+
HOME,
|
|
27
|
+
END
|
|
28
|
+
]);
|
|
29
|
+
const ARROW_KEYS = new Set([
|
|
30
|
+
...HORIZONTAL_KEYS,
|
|
31
|
+
...VERTICAL_KEYS
|
|
32
|
+
]);
|
|
33
|
+
const COMPOSITE_KEYS = new Set([
|
|
34
|
+
...ARROW_KEYS,
|
|
35
|
+
HOME,
|
|
36
|
+
END
|
|
37
|
+
]);
|
|
38
|
+
const SHIFT = 'Shift';
|
|
39
|
+
const CONTROL = 'Control';
|
|
40
|
+
const ALT = 'Alt';
|
|
41
|
+
const META = 'Meta';
|
|
42
|
+
const MODIFIER_KEYS = new Set([
|
|
43
|
+
SHIFT,
|
|
44
|
+
CONTROL,
|
|
45
|
+
ALT,
|
|
46
|
+
META
|
|
47
|
+
]);
|
|
48
|
+
function isInputElement(element) {
|
|
49
|
+
return isHTMLElement(element) && 'INPUT' === element.tagName;
|
|
50
|
+
}
|
|
51
|
+
function isNativeInput(element) {
|
|
52
|
+
if (isInputElement(element) && null != element.selectionStart) return true;
|
|
53
|
+
if (isHTMLElement(element) && 'TEXTAREA' === element.tagName) return true;
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {
|
|
57
|
+
if (!scrollContainer || !element || !element.scrollTo) return;
|
|
58
|
+
let targetX = scrollContainer.scrollLeft;
|
|
59
|
+
let targetY = scrollContainer.scrollTop;
|
|
60
|
+
const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;
|
|
61
|
+
const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;
|
|
62
|
+
if (isOverflowingX && 'vertical' !== orientation) {
|
|
63
|
+
const elementOffsetLeft = getOffset(scrollContainer, element, 'left');
|
|
64
|
+
const containerStyles = getStyles(scrollContainer);
|
|
65
|
+
const elementStyles = getStyles(element);
|
|
66
|
+
if ('ltr' === direction) {
|
|
67
|
+
if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
|
|
68
|
+
else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
|
|
69
|
+
}
|
|
70
|
+
if ('rtl' === direction) {
|
|
71
|
+
if (elementOffsetLeft - elementStyles.scrollMarginRight < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;
|
|
72
|
+
else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (isOverflowingY && 'horizontal' !== orientation) {
|
|
76
|
+
const elementOffsetTop = getOffset(scrollContainer, element, 'top');
|
|
77
|
+
const containerStyles = getStyles(scrollContainer);
|
|
78
|
+
const elementStyles = getStyles(element);
|
|
79
|
+
if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;
|
|
80
|
+
else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;
|
|
81
|
+
}
|
|
82
|
+
scrollContainer.scrollTo({
|
|
83
|
+
left: targetX,
|
|
84
|
+
top: targetY,
|
|
85
|
+
behavior: 'auto'
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function getOffset(ancestor, element, side) {
|
|
89
|
+
const propName = 'left' === side ? 'offsetLeft' : 'offsetTop';
|
|
90
|
+
let result = 0;
|
|
91
|
+
while(element.offsetParent){
|
|
92
|
+
result += element[propName];
|
|
93
|
+
if (element.offsetParent === ancestor) break;
|
|
94
|
+
element = element.offsetParent;
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
function getStyles(element) {
|
|
99
|
+
const styles = getComputedStyle(element);
|
|
100
|
+
return {
|
|
101
|
+
scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,
|
|
102
|
+
scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,
|
|
103
|
+
scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,
|
|
104
|
+
scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,
|
|
105
|
+
scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,
|
|
106
|
+
scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,
|
|
107
|
+
scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,
|
|
108
|
+
scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export { ARROW_DOWN, ARROW_KEYS, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, COMPOSITE_KEYS, HORIZONTAL_KEYS, HORIZONTAL_KEYS_WITH_EXTRA_KEYS, MODIFIER_KEYS, PAGE_DOWN, VERTICAL_KEYS, VERTICAL_KEYS_WITH_EXTRA_KEYS, isNativeInput, scrollIntoViewIfNeeded };
|
package/dist/167.js
ADDED
package/dist/2274.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCompositeRootContext } from "./8724.js";
|
|
2
|
+
import { useCompositeListItem } from "./3021.js";
|
|
3
|
+
import { useMergedRefs } from "./8272.js";
|
|
4
|
+
import * as __rspack_external_react from "react";
|
|
5
|
+
function useCompositeItem(params = {}) {
|
|
6
|
+
const { highlightItemOnHover, highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
|
|
7
|
+
const { ref, index } = useCompositeListItem(params);
|
|
8
|
+
const isHighlighted = highlightedIndex === index;
|
|
9
|
+
const itemRef = __rspack_external_react.useRef(null);
|
|
10
|
+
const mergedRef = useMergedRefs(ref, itemRef);
|
|
11
|
+
const compositeProps = __rspack_external_react.useMemo(()=>({
|
|
12
|
+
tabIndex: isHighlighted ? 0 : -1,
|
|
13
|
+
onFocus () {
|
|
14
|
+
onHighlightedIndexChange(index);
|
|
15
|
+
},
|
|
16
|
+
onMouseMove () {
|
|
17
|
+
const item = itemRef.current;
|
|
18
|
+
if (!highlightItemOnHover || !item) return;
|
|
19
|
+
const disabled = item.hasAttribute('disabled') || 'true' === item.ariaDisabled;
|
|
20
|
+
if (!isHighlighted && !disabled) item.focus();
|
|
21
|
+
}
|
|
22
|
+
}), [
|
|
23
|
+
isHighlighted,
|
|
24
|
+
onHighlightedIndexChange,
|
|
25
|
+
index,
|
|
26
|
+
highlightItemOnHover
|
|
27
|
+
]);
|
|
28
|
+
return {
|
|
29
|
+
compositeProps,
|
|
30
|
+
compositeRef: mergedRef,
|
|
31
|
+
index
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export { useCompositeItem };
|
package/dist/2287.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
|
+
import "./4586.js";
|
|
3
|
+
import { NOOP } from "./8272.js";
|
|
4
|
+
const use_sync_external_store = __webpack_require__("../../node_modules/use-sync-external-store/index.js");
|
|
5
|
+
function subscribe() {
|
|
6
|
+
return NOOP;
|
|
7
|
+
}
|
|
8
|
+
function getSnapshot() {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
function getServerSnapshot() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
function useIsHydrating() {
|
|
15
|
+
return (0, use_sync_external_store.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
16
|
+
}
|
|
17
|
+
export { useIsHydrating };
|
package/dist/2418.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const triggerPress = 'trigger-press';
|
|
2
|
+
const triggerHover = 'trigger-hover';
|
|
3
|
+
const triggerFocus = 'trigger-focus';
|
|
4
|
+
const outsidePress = 'outside-press';
|
|
5
|
+
const itemPress = 'item-press';
|
|
6
|
+
const closePress = 'close-press';
|
|
7
|
+
const linkPress = 'link-press';
|
|
8
|
+
const clearPress = 'clear-press';
|
|
9
|
+
const chipRemovePress = 'chip-remove-press';
|
|
10
|
+
const trackPress = 'track-press';
|
|
11
|
+
const incrementPress = 'increment-press';
|
|
12
|
+
const decrementPress = 'decrement-press';
|
|
13
|
+
const inputChange = 'input-change';
|
|
14
|
+
const inputClear = 'input-clear';
|
|
15
|
+
const inputBlur = 'input-blur';
|
|
16
|
+
const inputPaste = 'input-paste';
|
|
17
|
+
const inputPress = 'input-press';
|
|
18
|
+
const focusOut = 'focus-out';
|
|
19
|
+
const escapeKey = 'escape-key';
|
|
20
|
+
const closeWatcher = 'close-watcher';
|
|
21
|
+
const listNavigation = 'list-navigation';
|
|
22
|
+
const keyboard = 'keyboard';
|
|
23
|
+
const pointer = 'pointer';
|
|
24
|
+
const cancelOpen = 'cancel-open';
|
|
25
|
+
const siblingOpen = 'sibling-open';
|
|
26
|
+
const disabled = 'disabled';
|
|
27
|
+
const missing = 'missing';
|
|
28
|
+
const initial = 'initial';
|
|
29
|
+
const imperativeAction = 'imperative-action';
|
|
30
|
+
const windowResize = 'window-resize';
|
|
31
|
+
export { cancelOpen, chipRemovePress, clearPress, closePress, closeWatcher, decrementPress, disabled, escapeKey, focusOut, imperativeAction, incrementPress, initial, inputBlur, inputChange, inputClear, inputPaste, inputPress, itemPress, keyboard, linkPress, listNavigation, missing, outsidePress, pointer, siblingOpen, trackPress, triggerFocus, triggerHover, triggerPress, windowResize };
|
package/dist/2801.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useStableCallback } from "./7541.js";
|
|
2
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
function useValueChanged(value, onChange) {
|
|
5
|
+
const valueRef = __rspack_external_react.useRef(value);
|
|
6
|
+
const onChangeCallback = useStableCallback(onChange);
|
|
7
|
+
useIsoLayoutEffect(()=>{
|
|
8
|
+
if (valueRef.current === value) return;
|
|
9
|
+
onChangeCallback(valueRef.current);
|
|
10
|
+
}, [
|
|
11
|
+
value,
|
|
12
|
+
onChangeCallback
|
|
13
|
+
]);
|
|
14
|
+
useIsoLayoutEffect(()=>{
|
|
15
|
+
valueRef.current = value;
|
|
16
|
+
}, [
|
|
17
|
+
value
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
20
|
+
export { useValueChanged };
|
package/dist/285.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as __rspack_external_react from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "./6046.js";
|
|
4
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
5
|
+
import { useRefWithInit } from "./8272.js";
|
|
6
|
+
function createEventEmitter() {
|
|
7
|
+
const map = new Map();
|
|
8
|
+
return {
|
|
9
|
+
emit (event, data) {
|
|
10
|
+
map.get(event)?.forEach((listener)=>listener(data));
|
|
11
|
+
},
|
|
12
|
+
on (event, listener) {
|
|
13
|
+
if (!map.has(event)) map.set(event, new Set());
|
|
14
|
+
map.get(event).add(listener);
|
|
15
|
+
},
|
|
16
|
+
off (event, listener) {
|
|
17
|
+
map.get(event)?.delete(listener);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
class FloatingTreeStore {
|
|
22
|
+
nodesRef = {
|
|
23
|
+
current: []
|
|
24
|
+
};
|
|
25
|
+
events = createEventEmitter();
|
|
26
|
+
addNode(node) {
|
|
27
|
+
this.nodesRef.current.push(node);
|
|
28
|
+
}
|
|
29
|
+
removeNode(node) {
|
|
30
|
+
const index = this.nodesRef.current.findIndex((n)=>n === node);
|
|
31
|
+
if (-1 !== index) this.nodesRef.current.splice(index, 1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const FloatingNodeContext = /*#__PURE__*/ __rspack_external_react.createContext(null);
|
|
35
|
+
if ("production" !== process.env.NODE_ENV) FloatingNodeContext.displayName = "FloatingNodeContext";
|
|
36
|
+
const FloatingTreeContext = /*#__PURE__*/ __rspack_external_react.createContext(null);
|
|
37
|
+
if ("production" !== process.env.NODE_ENV) FloatingTreeContext.displayName = "FloatingTreeContext";
|
|
38
|
+
const useFloatingParentNodeId = ()=>__rspack_external_react.useContext(FloatingNodeContext)?.id || null;
|
|
39
|
+
const useFloatingTree = (externalTree)=>{
|
|
40
|
+
const contextTree = __rspack_external_react.useContext(FloatingTreeContext);
|
|
41
|
+
return externalTree ?? contextTree;
|
|
42
|
+
};
|
|
43
|
+
function useFloatingNodeId(externalTree) {
|
|
44
|
+
const id = useId();
|
|
45
|
+
const tree = useFloatingTree(externalTree);
|
|
46
|
+
const parentId = useFloatingParentNodeId();
|
|
47
|
+
useIsoLayoutEffect(()=>{
|
|
48
|
+
if (!id) return;
|
|
49
|
+
const node = {
|
|
50
|
+
id,
|
|
51
|
+
parentId
|
|
52
|
+
};
|
|
53
|
+
tree?.addNode(node);
|
|
54
|
+
return ()=>{
|
|
55
|
+
tree?.removeNode(node);
|
|
56
|
+
};
|
|
57
|
+
}, [
|
|
58
|
+
tree,
|
|
59
|
+
id,
|
|
60
|
+
parentId
|
|
61
|
+
]);
|
|
62
|
+
return id;
|
|
63
|
+
}
|
|
64
|
+
function FloatingNode(props) {
|
|
65
|
+
const { children, id } = props;
|
|
66
|
+
const parentId = useFloatingParentNodeId();
|
|
67
|
+
return /*#__PURE__*/ jsx(FloatingNodeContext.Provider, {
|
|
68
|
+
value: __rspack_external_react.useMemo(()=>({
|
|
69
|
+
id,
|
|
70
|
+
parentId
|
|
71
|
+
}), [
|
|
72
|
+
id,
|
|
73
|
+
parentId
|
|
74
|
+
]),
|
|
75
|
+
children: children
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function FloatingTree(props) {
|
|
79
|
+
const { children, externalTree } = props;
|
|
80
|
+
const tree = useRefWithInit(()=>externalTree ?? new FloatingTreeStore()).current;
|
|
81
|
+
return /*#__PURE__*/ jsx(FloatingTreeContext.Provider, {
|
|
82
|
+
value: tree,
|
|
83
|
+
children: children
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export { FloatingNode, FloatingTree, FloatingTreeStore, createEventEmitter, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree };
|
package/dist/2861.js
ADDED
package/dist/3020.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useRenderDialogRoot, IsDrawerContext } from "./6270.js";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
function DialogRoot(props) {
|
|
4
|
+
const mode = __rspack_external_react.useContext(IsDrawerContext) ? 'drawer' : 'dialog';
|
|
5
|
+
return useRenderDialogRoot(props, mode);
|
|
6
|
+
}
|
|
7
|
+
export { DialogRoot };
|
package/dist/3021.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useCompositeListContext } from "./5036.js";
|
|
2
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
let useCompositeListItem_IndexGuessBehavior = /*#__PURE__*/ function(IndexGuessBehavior) {
|
|
5
|
+
IndexGuessBehavior[IndexGuessBehavior["None"] = 0] = "None";
|
|
6
|
+
IndexGuessBehavior[IndexGuessBehavior["GuessFromOrder"] = 1] = "GuessFromOrder";
|
|
7
|
+
return IndexGuessBehavior;
|
|
8
|
+
}({});
|
|
9
|
+
function useCompositeListItem(params = {}) {
|
|
10
|
+
const { label, metadata, textRef, indexGuessBehavior, index: externalIndex } = params;
|
|
11
|
+
const { register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef } = useCompositeListContext();
|
|
12
|
+
const indexRef = __rspack_external_react.useRef(-1);
|
|
13
|
+
const [index, setIndex] = __rspack_external_react.useState(externalIndex ?? (indexGuessBehavior === useCompositeListItem_IndexGuessBehavior.GuessFromOrder ? ()=>{
|
|
14
|
+
if (-1 === indexRef.current) {
|
|
15
|
+
const newIndex = nextIndexRef.current;
|
|
16
|
+
nextIndexRef.current += 1;
|
|
17
|
+
indexRef.current = newIndex;
|
|
18
|
+
}
|
|
19
|
+
return indexRef.current;
|
|
20
|
+
} : -1));
|
|
21
|
+
const componentRef = __rspack_external_react.useRef(null);
|
|
22
|
+
const ref = __rspack_external_react.useCallback((node)=>{
|
|
23
|
+
componentRef.current = node;
|
|
24
|
+
if (-1 !== index && null !== node) {
|
|
25
|
+
elementsRef.current[index] = node;
|
|
26
|
+
if (labelsRef) {
|
|
27
|
+
const isLabelDefined = void 0 !== label;
|
|
28
|
+
labelsRef.current[index] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
index,
|
|
33
|
+
elementsRef,
|
|
34
|
+
labelsRef,
|
|
35
|
+
label,
|
|
36
|
+
textRef
|
|
37
|
+
]);
|
|
38
|
+
useIsoLayoutEffect(()=>{
|
|
39
|
+
if (null != externalIndex) return;
|
|
40
|
+
const node = componentRef.current;
|
|
41
|
+
if (node) {
|
|
42
|
+
register(node, metadata);
|
|
43
|
+
return ()=>{
|
|
44
|
+
unregister(node);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
externalIndex,
|
|
49
|
+
register,
|
|
50
|
+
unregister,
|
|
51
|
+
metadata
|
|
52
|
+
]);
|
|
53
|
+
useIsoLayoutEffect(()=>{
|
|
54
|
+
if (null != externalIndex) return;
|
|
55
|
+
return subscribeMapChange((map)=>{
|
|
56
|
+
const i = componentRef.current ? map.get(componentRef.current)?.index : null;
|
|
57
|
+
if (null != i) setIndex(i);
|
|
58
|
+
});
|
|
59
|
+
}, [
|
|
60
|
+
externalIndex,
|
|
61
|
+
subscribeMapChange,
|
|
62
|
+
setIndex
|
|
63
|
+
]);
|
|
64
|
+
return __rspack_external_react.useMemo(()=>({
|
|
65
|
+
ref,
|
|
66
|
+
index
|
|
67
|
+
}), [
|
|
68
|
+
index,
|
|
69
|
+
ref
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
72
|
+
export { useCompositeListItem, useCompositeListItem_IndexGuessBehavior };
|