@workday/canvas-kit-react 11.1.0 → 11.1.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.
- package/dist/commonjs/select/lib/Select.d.ts +1306 -57
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +8 -22
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts +1 -2
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +20 -4
- package/dist/es6/select/lib/Select.d.ts +1306 -57
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +9 -23
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts +1 -2
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/es6/select/lib/hooks/useSelectInput.js +20 -4
- package/package.json +4 -4
- package/select/lib/Select.tsx +1 -23
- package/select/lib/hooks/useSelectInput.ts +29 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAC,QAAQ,EAAC,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAA8B,OAAO,EAAS,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAa,SAAS,EAAC,MAAM,sCAAsC,CAAC;AAM3E,OAAO,EAEL,YAAY,EAEZ,SAAS,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAC,QAAQ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;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqND;;;;;;;;;;;;;;;;;OAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;2DAvDH;;;;;;;;;;;;;;;;;eAiBG;;;;;;;YApML;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DA+KD;;;;;;;;;;;;;;;;;eAiBG;;;;;;;YApML;;;;eAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA+KD;;;;;;;;;;;;;;;;;mBAiBG;;;;;;;gBApML;;;;mBAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+OH,CAAC"}
|
|
@@ -17,36 +17,22 @@ const useSelectModel_1 = require("./hooks/useSelectModel");
|
|
|
17
17
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
18
18
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
19
19
|
const selectInputStencil = canvas_kit_styling_1.createStencil({
|
|
20
|
-
base: { name: "
|
|
21
|
-
}, "select-input-
|
|
20
|
+
base: { name: "a28279", styles: "box-sizing:border-box;caret-color:transparent;cursor:default;&::selection{background-color:transparent;}" }
|
|
21
|
+
}, "select-input-7166ac");
|
|
22
22
|
const selectIconsStencil = canvas_kit_styling_1.createStencil({
|
|
23
|
-
base: { name: "
|
|
24
|
-
}, "select-icons-
|
|
23
|
+
base: { name: "482a82", styles: "box-sizing:border-box;position:absolute;pointer-events:none;" }
|
|
24
|
+
}, "select-icons-61db10");
|
|
25
25
|
const hiddenSelectInputStencil = canvas_kit_styling_1.createStencil({
|
|
26
|
-
base: { name: "
|
|
27
|
-
}, "hidden-select-input-
|
|
26
|
+
base: { name: "99924b", styles: "box-sizing:border-box;position:absolute;top:var(--cnvs-sys-space-zero);bottom:var(--cnvs-sys-space-zero);left:var(--cnvs-sys-space-zero);right:var(--cnvs-sys-space-zero);opacity:var(--cnvs-sys-opacity-zero);cursor:default;pointer-events:none;" }
|
|
27
|
+
}, "hidden-select-input-87e693");
|
|
28
28
|
exports.SelectInput = common_1.createSubcomponent(text_input_1.TextInput)({
|
|
29
29
|
modelHook: useSelectModel_1.useSelectModel,
|
|
30
30
|
elemPropsHook: useSelectInput_1.useSelectInput,
|
|
31
31
|
})(({ placeholder = 'Choose an option', inputStartIcon, error, textInputProps, disabled, width, ref, onChange, onInput, value, name, ...elemProps }, Element, model) => {
|
|
32
|
-
const { localRef, elementRef } = common_1.useLocalRef(ref);
|
|
33
|
-
// We need to create a proxy between the multiple inputs. We need to redirect a few methods to
|
|
34
|
-
// the visible input
|
|
35
|
-
react_1.default.useImperativeHandle(elementRef, () => {
|
|
36
|
-
if (localRef.current) {
|
|
37
|
-
localRef.current.focus = (options) => {
|
|
38
|
-
textInputProps.ref.current.focus(options);
|
|
39
|
-
};
|
|
40
|
-
localRef.current.blur = () => {
|
|
41
|
-
textInputProps.ref.current.blur();
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return localRef.current;
|
|
45
|
-
}, [textInputProps.ref, localRef]);
|
|
46
32
|
return (react_1.default.createElement(text_input_1.InputGroup, { "data-width": "ck-formfield-width" },
|
|
47
33
|
inputStartIcon && model.state.selectedIds.length > 0 && (react_1.default.createElement(text_input_1.InputGroup.InnerStart, Object.assign({}, selectIconsStencil()),
|
|
48
34
|
react_1.default.createElement(icon_1.SystemIcon, { icon: inputStartIcon }))),
|
|
49
|
-
react_1.default.createElement(text_input_1.InputGroup.Input, Object.assign({ error: error, disabled: disabled, tabIndex: -1, "aria-hidden": true, onChange: onChange, onInput: onInput, value: value, name: name, ref:
|
|
35
|
+
react_1.default.createElement(text_input_1.InputGroup.Input, Object.assign({ error: error, disabled: disabled, tabIndex: -1, "aria-hidden": true, onChange: onChange, onInput: onInput, value: value, name: name, ref: ref }, hiddenSelectInputStencil())),
|
|
50
36
|
react_1.default.createElement(text_input_1.InputGroup.Input, Object.assign({ as: Element, disabled: disabled, placeholder: placeholder, error: error }, textInputProps, layout_1.mergeStyles(elemProps, selectInputStencil()))),
|
|
51
37
|
react_1.default.createElement(text_input_1.InputGroup.InnerEnd, Object.assign({}, selectIconsStencil()),
|
|
52
38
|
react_1.default.createElement(icon_1.SystemIcon, { icon: canvas_system_icons_web_1.caretDownSmallIcon }))));
|
|
@@ -59,7 +45,7 @@ exports.SelectItem = common_1.createSubcomponent('li')({
|
|
|
59
45
|
})(({ children, ...elemProps }, Element, _model) => {
|
|
60
46
|
return (react_1.default.createElement(combobox_1.Combobox.Menu.Item, Object.assign({ role: "option", as: Element }, elemProps), children));
|
|
61
47
|
});
|
|
62
|
-
const selectCardStyles = canvas_kit_styling_1.createStyles({ name: "
|
|
48
|
+
const selectCardStyles = canvas_kit_styling_1.createStyles({ name: "504572", styles: "max-height:18.75rem;" });
|
|
63
49
|
exports.SelectCard = common_1.createSubcomponent('div')({
|
|
64
50
|
modelHook: useSelectModel_1.useSelectModel,
|
|
65
51
|
elemPropsHook: useSelectCard_1.useSelectCard,
|
|
@@ -111,11 +111,10 @@ export declare const useSelectInput: import("@workday/canvas-kit-react/common").
|
|
|
111
111
|
readonly autoComplete: "off";
|
|
112
112
|
readonly onFocus: () => void;
|
|
113
113
|
readonly textInputProps: {
|
|
114
|
-
readonly ref:
|
|
114
|
+
readonly ref: (instance: HTMLInputElement | null) => void;
|
|
115
115
|
readonly onChange: typeof noop;
|
|
116
116
|
readonly value: string;
|
|
117
117
|
};
|
|
118
|
-
readonly ref: (instance: HTMLInputElement | null) => void;
|
|
119
118
|
readonly 'aria-haspopup': "menu";
|
|
120
119
|
}>;
|
|
121
120
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectInput.d.ts","sourceRoot":"","sources":["../../../../../select/lib/hooks/useSelectInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,iBAAS,IAAI,SAEZ;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useSelectInput.d.ts","sourceRoot":"","sources":["../../../../../select/lib/hooks/useSelectInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,iBAAS,IAAI,SAEZ;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA0HF,mBAAmB;+BArFP,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;EAkIvE,CAAC"}
|
|
@@ -15,8 +15,25 @@ function noop() {
|
|
|
15
15
|
* `useSelectInput` extends {@link useComboboxInput useComboboxInput} and {@link useComboboxKeyboardTypeAhead useComboboxKeyboardTypeAhead} and adds type ahead functionality and Select-specific [keyboard support](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).
|
|
16
16
|
*/
|
|
17
17
|
exports.useSelectInput = common_1.composeHooks(combobox_1.useComboboxInput, combobox_1.useComboboxKeyboardTypeAhead, combobox_1.useComboboxResetCursorToSelected, combobox_1.useComboboxMoveCursorToSelected, common_1.createElemPropsHook(useSelectModel_1.useSelectModel)((model, ref, elemProps = {}) => {
|
|
18
|
-
const
|
|
19
|
-
const textInputRef =
|
|
18
|
+
// const textInputRef = React.useRef<HTMLInputElement>(null);
|
|
19
|
+
const { elementRef: textInputElementRef, localRef: textInputRef } = common_1.useLocalRef(
|
|
20
|
+
// PopupModel says the targetRef is a `HTMLButtonElement`, but it is a `HTMLInputElement`
|
|
21
|
+
model.state.targetRef);
|
|
22
|
+
const { localRef, elementRef } = common_1.useLocalRef(ref);
|
|
23
|
+
// We need to create a proxy between the multiple inputs. We need to redirect a few methods to
|
|
24
|
+
// the visible input
|
|
25
|
+
react_1.default.useImperativeHandle(elementRef, () => {
|
|
26
|
+
if (localRef.current) {
|
|
27
|
+
localRef.current.focus = (options) => {
|
|
28
|
+
textInputRef.current.focus(options);
|
|
29
|
+
};
|
|
30
|
+
localRef.current.blur = () => {
|
|
31
|
+
textInputRef.current.blur();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return localRef.current;
|
|
35
|
+
}, [textInputRef, localRef]);
|
|
36
|
+
// Remap the Popup model's targetRef to be the visible ref. `ref` and `model.state.targetRef` are already linked. We have to override that.
|
|
20
37
|
// Update the text value of the input
|
|
21
38
|
const handleOnChange = (event) => {
|
|
22
39
|
var _a;
|
|
@@ -117,13 +134,12 @@ exports.useSelectInput = common_1.composeHooks(combobox_1.useComboboxInput, comb
|
|
|
117
134
|
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
118
135
|
},
|
|
119
136
|
textInputProps: {
|
|
120
|
-
ref:
|
|
137
|
+
ref: textInputElementRef,
|
|
121
138
|
onChange: noop,
|
|
122
139
|
value: model.state.selectedIds.length > 0 && model.state.items.length > 0
|
|
123
140
|
? model.navigation.getItem(model.state.selectedIds[0], model).textValue
|
|
124
141
|
: '',
|
|
125
142
|
},
|
|
126
|
-
ref: elementRef,
|
|
127
143
|
'aria-haspopup': 'menu',
|
|
128
144
|
};
|
|
129
145
|
}));
|