@workday/canvas-kit-react 11.1.1 → 11.1.3
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/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +3 -3
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/es6/select/lib/hooks/useSelectInput.js +3 -3
- package/package.json +4 -4
- package/select/lib/hooks/useSelectInput.ts +3 -3
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA0HF,mBAAmB;+
|
|
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;+BAtFP,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;EAmIvE,CAAC"}
|
|
@@ -15,7 +15,6 @@ 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 textInputRef = React.useRef<HTMLInputElement>(null);
|
|
19
18
|
const { elementRef: textInputElementRef, localRef: textInputRef } = common_1.useLocalRef(
|
|
20
19
|
// PopupModel says the targetRef is a `HTMLButtonElement`, but it is a `HTMLInputElement`
|
|
21
20
|
model.state.targetRef);
|
|
@@ -61,6 +60,7 @@ exports.useSelectInput = common_1.composeHooks(combobox_1.useComboboxInput, comb
|
|
|
61
60
|
model.state.items.length > 0 &&
|
|
62
61
|
model.state.selectedIds[0]) {
|
|
63
62
|
const value = model.navigation.getItem(model.state.selectedIds[0], model).id;
|
|
63
|
+
const oldValue = model.state.inputRef.current.value;
|
|
64
64
|
// force the hidden input to have the correct value
|
|
65
65
|
if (model.state.inputRef.current.value !== value) {
|
|
66
66
|
const nativeInputValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(model.state.inputRef.current), 'value');
|
|
@@ -68,8 +68,8 @@ exports.useSelectInput = common_1.composeHooks(combobox_1.useComboboxInput, comb
|
|
|
68
68
|
nativeInputValue.set.call(model.state.inputRef.current, value);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
if (model.state.selectedIds[0] !==
|
|
72
|
-
model.state.inputRef.current.value !==
|
|
71
|
+
if (model.state.selectedIds[0] !== oldValue &&
|
|
72
|
+
model.state.inputRef.current.value !== oldValue) {
|
|
73
73
|
// Programmatically dispatch an onChange once items are loaded. This account for when a consumer wants an initial selected item and they're loading them from a server.
|
|
74
74
|
common_1.dispatchInputEvent(model.state.inputRef.current, value);
|
|
75
75
|
}
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA0HF,mBAAmB;+
|
|
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;+BAtFP,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;EAmIvE,CAAC"}
|
|
@@ -9,7 +9,6 @@ function noop() {
|
|
|
9
9
|
* `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/).
|
|
10
10
|
*/
|
|
11
11
|
export const useSelectInput = composeHooks(useComboboxInput, useComboboxKeyboardTypeAhead, useComboboxResetCursorToSelected, useComboboxMoveCursorToSelected, createElemPropsHook(useSelectModel)((model, ref, elemProps = {}) => {
|
|
12
|
-
// const textInputRef = React.useRef<HTMLInputElement>(null);
|
|
13
12
|
const { elementRef: textInputElementRef, localRef: textInputRef } = useLocalRef(
|
|
14
13
|
// PopupModel says the targetRef is a `HTMLButtonElement`, but it is a `HTMLInputElement`
|
|
15
14
|
model.state.targetRef);
|
|
@@ -55,6 +54,7 @@ export const useSelectInput = composeHooks(useComboboxInput, useComboboxKeyboard
|
|
|
55
54
|
model.state.items.length > 0 &&
|
|
56
55
|
model.state.selectedIds[0]) {
|
|
57
56
|
const value = model.navigation.getItem(model.state.selectedIds[0], model).id;
|
|
57
|
+
const oldValue = model.state.inputRef.current.value;
|
|
58
58
|
// force the hidden input to have the correct value
|
|
59
59
|
if (model.state.inputRef.current.value !== value) {
|
|
60
60
|
const nativeInputValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(model.state.inputRef.current), 'value');
|
|
@@ -62,8 +62,8 @@ export const useSelectInput = composeHooks(useComboboxInput, useComboboxKeyboard
|
|
|
62
62
|
nativeInputValue.set.call(model.state.inputRef.current, value);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (model.state.selectedIds[0] !==
|
|
66
|
-
model.state.inputRef.current.value !==
|
|
65
|
+
if (model.state.selectedIds[0] !== oldValue &&
|
|
66
|
+
model.state.inputRef.current.value !== oldValue) {
|
|
67
67
|
// Programmatically dispatch an onChange once items are loaded. This account for when a consumer wants an initial selected item and they're loading them from a server.
|
|
68
68
|
dispatchInputEvent(model.state.inputRef.current, value);
|
|
69
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.3",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^11.1.
|
|
53
|
-
"@workday/canvas-kit-styling": "^11.1.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^11.1.3",
|
|
53
|
+
"@workday/canvas-kit-styling": "^11.1.3",
|
|
54
54
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
55
55
|
"@workday/canvas-tokens-web": "^2.0.0",
|
|
56
56
|
"@workday/design-assets-types": "^0.2.8",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
68
68
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "0ad69fbb1b6f416855fa2815f7c13ffee5deb53a"
|
|
71
71
|
}
|
|
@@ -28,7 +28,6 @@ export const useSelectInput = composeHooks(
|
|
|
28
28
|
useComboboxMoveCursorToSelected,
|
|
29
29
|
createElemPropsHook(useSelectModel)(
|
|
30
30
|
(model, ref, elemProps: {keySofar?: string; placeholder?: string; value?: string} = {}) => {
|
|
31
|
-
// const textInputRef = React.useRef<HTMLInputElement>(null);
|
|
32
31
|
const {elementRef: textInputElementRef, localRef: textInputRef} = useLocalRef(
|
|
33
32
|
// PopupModel says the targetRef is a `HTMLButtonElement`, but it is a `HTMLInputElement`
|
|
34
33
|
model.state.targetRef as any as React.Ref<HTMLInputElement>
|
|
@@ -89,6 +88,7 @@ export const useSelectInput = composeHooks(
|
|
|
89
88
|
model.state.selectedIds[0]
|
|
90
89
|
) {
|
|
91
90
|
const value = model.navigation.getItem(model.state.selectedIds[0], model).id;
|
|
91
|
+
const oldValue = model.state.inputRef.current.value;
|
|
92
92
|
|
|
93
93
|
// force the hidden input to have the correct value
|
|
94
94
|
if (model.state.inputRef.current.value !== value) {
|
|
@@ -103,8 +103,8 @@ export const useSelectInput = composeHooks(
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
if (
|
|
106
|
-
model.state.selectedIds[0] !==
|
|
107
|
-
model.state.inputRef.current.value !==
|
|
106
|
+
model.state.selectedIds[0] !== oldValue &&
|
|
107
|
+
model.state.inputRef.current.value !== oldValue
|
|
108
108
|
) {
|
|
109
109
|
// Programmatically dispatch an onChange once items are loaded. This account for when a consumer wants an initial selected item and they're loading them from a server.
|
|
110
110
|
dispatchInputEvent(model.state.inputRef.current, value);
|