@wordpress/components 32.6.0 → 33.0.1-next.v.202604201441.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/CHANGELOG.md +15 -0
- package/build/autocomplete/get-autocomplete-match.cjs +11 -2
- package/build/autocomplete/get-autocomplete-match.cjs.map +2 -2
- package/build/autocomplete/index.cjs +42 -11
- package/build/autocomplete/index.cjs.map +2 -2
- package/build/external-link/index.cjs +1 -1
- package/build/external-link/index.cjs.map +2 -2
- package/build/menu/styles.cjs +15 -15
- package/build/menu/styles.cjs.map +2 -2
- package/build/navigable-container/container.cjs +72 -110
- package/build/navigable-container/container.cjs.map +2 -2
- package/build-module/autocomplete/get-autocomplete-match.mjs +11 -2
- package/build-module/autocomplete/get-autocomplete-match.mjs.map +2 -2
- package/build-module/autocomplete/index.mjs +42 -11
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/external-link/index.mjs +1 -1
- package/build-module/external-link/index.mjs.map +2 -2
- package/build-module/menu/styles.mjs +15 -15
- package/build-module/menu/styles.mjs.map +2 -2
- package/build-module/navigable-container/container.mjs +73 -111
- package/build-module/navigable-container/container.mjs.map +2 -2
- package/build-types/autocomplete/get-autocomplete-match.d.ts +10 -1
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/external-link/stories/index.story.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigable-container/container.d.ts +3 -8
- package/build-types/navigable-container/container.d.ts.map +1 -1
- package/build-types/navigable-container/types.d.ts +1 -5
- package/build-types/navigable-container/types.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/panel/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/spinner/stories/index.story.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/autocomplete/get-autocomplete-match.ts +25 -4
- package/src/autocomplete/index.tsx +69 -21
- package/src/autocomplete/test/get-autocomplete-match.ts +97 -75
- package/src/base-control/stories/index.story.tsx +1 -0
- package/src/button/stories/index.story.tsx +1 -0
- package/src/checkbox-control/stories/index.story.tsx +1 -0
- package/src/color-indicator/stories/index.story.tsx +1 -0
- package/src/color-palette/stories/index.story.tsx +1 -0
- package/src/color-picker/stories/index.story.tsx +1 -0
- package/src/combobox-control/stories/index.story.tsx +1 -0
- package/src/composite/stories/index.story.tsx +1 -0
- package/src/confirm-dialog/stories/index.story.tsx +1 -1
- package/src/custom-select-control/stories/index.story.tsx +1 -0
- package/src/disabled/stories/index.story.tsx +1 -0
- package/src/drop-zone/stories/index.story.tsx +1 -0
- package/src/dropdown/stories/index.story.tsx +1 -0
- package/src/external-link/index.tsx +1 -6
- package/src/external-link/stories/index.story.tsx +1 -0
- package/src/form-file-upload/stories/index.story.tsx +1 -0
- package/src/form-toggle/stories/index.story.tsx +1 -0
- package/src/form-token-field/stories/index.story.tsx +1 -0
- package/src/gradient-picker/stories/index.story.tsx +1 -0
- package/src/icon/stories/index.story.tsx +1 -0
- package/src/input-control/stories/index.story.tsx +1 -1
- package/src/item-group/stories/index.story.tsx +1 -1
- package/src/keyboard-shortcuts/stories/index.story.tsx +1 -0
- package/src/menu/styles.ts +1 -1
- package/src/menu-group/stories/index.story.tsx +1 -0
- package/src/menu-item/stories/index.story.tsx +1 -0
- package/src/menu-items-choice/stories/index.story.tsx +1 -0
- package/src/mobile/link-settings/index.native.js +1 -1
- package/src/modal/stories/index.story.tsx +1 -0
- package/src/navigable-container/container.tsx +120 -141
- package/src/navigable-container/test/navigable-menu.tsx +24 -0
- package/src/navigable-container/types.ts +1 -5
- package/src/navigation/stories/utils/more-examples.tsx +2 -1
- package/src/navigator/stories/index.story.tsx +1 -0
- package/src/notice/stories/index.story.tsx +1 -0
- package/src/number-control/stories/index.story.tsx +1 -1
- package/src/panel/stories/index.story.tsx +1 -0
- package/src/popover/stories/index.story.tsx +1 -0
- package/src/progress-bar/stories/index.story.tsx +1 -0
- package/src/radio-control/stories/index.story.tsx +1 -0
- package/src/range-control/stories/index.story.tsx +1 -0
- package/src/resizable-box/stories/index.story.tsx +1 -0
- package/src/sandbox/stories/index.story.tsx +1 -0
- package/src/scroll-lock/stories/index.story.tsx +1 -0
- package/src/search-control/stories/index.story.tsx +1 -0
- package/src/select-control/stories/index.story.tsx +1 -0
- package/src/shortcut/stories/index.story.tsx +1 -0
- package/src/slot-fill/stories/index.story.tsx +1 -0
- package/src/snackbar/stories/index.story.tsx +1 -0
- package/src/spinner/stories/index.story.tsx +1 -0
- package/src/text-control/stories/index.story.tsx +1 -0
- package/src/text-highlight/stories/index.story.tsx +1 -0
- package/src/textarea-control/stories/index.story.tsx +1 -0
- package/src/toggle-control/stories/index.story.tsx +1 -0
- package/src/toggle-group-control/stories/index.story.tsx +1 -1
- package/src/tooltip/stories/index.story.tsx +1 -0
- package/src/tree-grid/stories/index.story.tsx +1 -1
- package/src/tree-select/stories/index.story.tsx +1 -0
- package/src/truncate/stories/index.story.tsx +1 -1
- package/src/unit-control/stories/index.story.tsx +1 -1
- package/src/visually-hidden/stories/index.story.tsx +1 -0
- package/build/card/context.cjs +0 -36
- package/build/card/context.cjs.map +0 -7
- package/build-module/card/context.mjs +0 -10
- package/build-module/card/context.mjs.map +0 -7
- package/build-types/card/context.d.ts +0 -3
- package/build-types/card/context.d.ts.map +0 -1
- package/src/card/context.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/shortcut/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,QAAQ,MAAM,KAAK,CAAC;AAE3B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/shortcut/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,QAAQ,MAAM,KAAK,CAAC;AAE3B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAehC,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,QAAQ,CAAwB,CAAC;AAEvE,eAAO,MAAM,aAAa,+HAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/slot-fill/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,EAAE,IAAI,EAAsC,MAAM,KAAK,CAAC;AAE/D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/slot-fill/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,EAAE,IAAI,EAAsC,MAAM,KAAK,CAAC;AAE/D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAmB5B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,IAAI,CAczC,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,OAAO,CAAE,OAAO,IAAI,CAoB/C,CAAC;AAKF,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAE,OAAO,IAAI,CA8BlD,CAAC;AAKF,eAAO,MAAM,WAAW,EAAE,OAAO,CAAE,OAAO,IAAI,CAuB7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/snackbar/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAW3D,OAAO,QAAQ,MAAM,IAAI,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/snackbar/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAW3D,OAAO,QAAQ,MAAM,IAAI,CAAC;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CA6BhC,CAAC;AACF,eAAe,IAAI,CAAC;AASpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,QAAQ,CAA+B,CAAC;AAM9E,eAAO,MAAM,WAAW,EAAE,OAAO,CAAE,OAAO,QAAQ,CAEjD,CAAC;AAWF,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAE,OAAO,QAAQ,CAA+B,CAAC;AAM/E,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAE,OAAO,QAAQ,CAC/B,CAAC;AAO5B,eAAO,MAAM,4BAA4B,EAAE,OAAO,CAAE,OAAO,QAAQ,CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/spinner/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,OAAO,MAAM,KAAK,CAAC;AAG1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/spinner/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,OAAO,MAAM,KAAK,CAAC;AAG1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAe/B,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,OAAO,CAAwB,CAAC;AAGtE,eAAO,MAAM,UAAU,EAAE,OAAO,CAAE,OAAO,OAAO,CAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/text-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,WAAW,MAAM,IAAI,CAAC;AAE7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,WAAW,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/text-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,WAAW,MAAM,IAAI,CAAC;AAE7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,WAAW,CAsBnC,CAAC;AACF,eAAe,IAAI,CAAC;AAqBpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,WAAW,CAEhD,CAAC;AAMF,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAE,OAAO,WAAW,CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/text-highlight/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,aAAa,MAAM,IAAI,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/text-highlight/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,aAAa,MAAM,IAAI,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,CAerC,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,aAAa,CAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/textarea-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,eAAe,MAAM,IAAI,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,eAAe,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/textarea-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,eAAe,MAAM,IAAI,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,eAAe,CAyBvC,CAAC;AACF,eAAe,IAAI,CAAC;AAoBpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,eAAe,CAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/toggle-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,aAAa,MAAM,IAAI,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/toggle-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,aAAa,MAAM,IAAI,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,aAAa,CAoBrC,CAAC;AACF,eAAe,IAAI,CAAC;AAmBpB,eAAO,MAAM,OAAO;;;;0SAAsB,CAAC;AAK3C,eAAO,MAAM,YAAY;;;;0SAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tooltip/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,OAAO,MAAM,IAAI,CAAC;AAGzB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tooltip/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,OAAO,MAAM,IAAI,CAAC;AAGzB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CA4B/B,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,OAAO,CAAwB,CAAC;AAUtE,eAAO,MAAM,gBAAgB,mKAAsB,CAAC;AAapD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,OAAO,CAAE,OAAO,OAAO,CAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tree-select/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,UAAU,MAAM,KAAK,CAAC;AAE7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,UAAU,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tree-select/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AAO3D;;GAEG;AACH,OAAO,UAAU,MAAM,KAAK,CAAC;AAE7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,UAAU,CAsBlC,CAAC;AAEF,eAAe,IAAI,CAAC;AAgBpB,eAAO,MAAM,OAAO,iIAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,cAAc,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,cAAc,CAmBtC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,cAAc,CAanD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAE,OAAO,cAAc,CAW9D,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAE,OAAO,cAAc,CAWpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "33.0.1-next.v.202604201441.0+dab6d8c07",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -64,24 +64,24 @@
|
|
|
64
64
|
"@types/highlight-words-core": "1.2.1",
|
|
65
65
|
"@types/react": "^18.3.27",
|
|
66
66
|
"@use-gesture/react": "^10.3.1",
|
|
67
|
-
"@wordpress/a11y": "^4.44.0",
|
|
68
|
-
"@wordpress/base-styles": "^6.20.0",
|
|
69
|
-
"@wordpress/compose": "^7.44.0",
|
|
70
|
-
"@wordpress/date": "^5.44.0",
|
|
71
|
-
"@wordpress/deprecated": "^4.44.0",
|
|
72
|
-
"@wordpress/dom": "^4.44.0",
|
|
73
|
-
"@wordpress/element": "^6.44.0",
|
|
74
|
-
"@wordpress/escape-html": "^3.44.0",
|
|
75
|
-
"@wordpress/hooks": "^4.44.0",
|
|
76
|
-
"@wordpress/html-entities": "^4.44.0",
|
|
77
|
-
"@wordpress/i18n": "^6.17.0",
|
|
78
|
-
"@wordpress/icons": "^12.2.0",
|
|
79
|
-
"@wordpress/is-shallow-equal": "^5.44.0",
|
|
80
|
-
"@wordpress/keycodes": "^4.44.0",
|
|
81
|
-
"@wordpress/primitives": "^4.44.0",
|
|
82
|
-
"@wordpress/private-apis": "^1.44.0",
|
|
83
|
-
"@wordpress/rich-text": "^7.44.0",
|
|
84
|
-
"@wordpress/warning": "^3.44.0",
|
|
67
|
+
"@wordpress/a11y": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
68
|
+
"@wordpress/base-styles": "^6.20.1-next.v.202604201441.0+dab6d8c07",
|
|
69
|
+
"@wordpress/compose": "^7.44.1-next.v.202604201441.0+dab6d8c07",
|
|
70
|
+
"@wordpress/date": "^5.44.1-next.v.202604201441.0+dab6d8c07",
|
|
71
|
+
"@wordpress/deprecated": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
72
|
+
"@wordpress/dom": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
73
|
+
"@wordpress/element": "^6.44.1-next.v.202604201441.0+dab6d8c07",
|
|
74
|
+
"@wordpress/escape-html": "^3.44.1-next.v.202604201441.0+dab6d8c07",
|
|
75
|
+
"@wordpress/hooks": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
76
|
+
"@wordpress/html-entities": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
77
|
+
"@wordpress/i18n": "^6.17.1-next.v.202604201441.0+dab6d8c07",
|
|
78
|
+
"@wordpress/icons": "^12.2.1-next.v.202604201441.0+dab6d8c07",
|
|
79
|
+
"@wordpress/is-shallow-equal": "^5.44.1-next.v.202604201441.0+dab6d8c07",
|
|
80
|
+
"@wordpress/keycodes": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
81
|
+
"@wordpress/primitives": "^4.44.1-next.v.202604201441.0+dab6d8c07",
|
|
82
|
+
"@wordpress/private-apis": "^1.44.1-next.v.202604201441.0+dab6d8c07",
|
|
83
|
+
"@wordpress/rich-text": "^7.44.1-next.v.202604201441.0+dab6d8c07",
|
|
84
|
+
"@wordpress/warning": "^3.44.1-next.v.202604201441.0+dab6d8c07",
|
|
85
85
|
"change-case": "^4.1.2",
|
|
86
86
|
"clsx": "^2.1.1",
|
|
87
87
|
"colord": "^2.7.0",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@storybook/react-vite": "^10.2.8",
|
|
108
108
|
"@testing-library/jest-dom": "^6.9.1",
|
|
109
109
|
"@types/jest": "^29.5.14",
|
|
110
|
-
"@wordpress/jest-console": "^8.44.0",
|
|
110
|
+
"@wordpress/jest-console": "^8.44.1-next.v.202604201441.0+dab6d8c07",
|
|
111
111
|
"snapshot-diff": "^0.10.0",
|
|
112
112
|
"storybook": "^10.2.8",
|
|
113
113
|
"timezone-mock": "^1.3.6"
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"publishConfig": {
|
|
120
120
|
"access": "public"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "c788005ba4ee2a34851c1217c51602656aa7c3a6"
|
|
123
123
|
}
|
|
@@ -13,13 +13,21 @@ type AutocompleteMatch = {
|
|
|
13
13
|
filterValue: string;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
type AutocompleteMatchOptions = {
|
|
17
|
+
matchCount: number;
|
|
18
|
+
isBackspacing: boolean;
|
|
19
|
+
getTextAfterSelection: () => string;
|
|
20
|
+
lastCompletion?: { name: string; value: string } | null;
|
|
21
|
+
};
|
|
22
|
+
|
|
16
23
|
export function getAutocompleteMatch(
|
|
17
24
|
textContent: string,
|
|
18
25
|
completers: WPCompleter[],
|
|
19
|
-
|
|
20
|
-
isBackspacing: boolean,
|
|
21
|
-
getTextAfterSelection: () => string
|
|
26
|
+
options: AutocompleteMatchOptions
|
|
22
27
|
): AutocompleteMatch | null {
|
|
28
|
+
const { matchCount, isBackspacing, getTextAfterSelection, lastCompletion } =
|
|
29
|
+
options;
|
|
30
|
+
|
|
23
31
|
if ( ! textContent ) {
|
|
24
32
|
return null;
|
|
25
33
|
}
|
|
@@ -58,6 +66,7 @@ export function getAutocompleteMatch(
|
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
const { allowContext, triggerPrefix } = completer;
|
|
69
|
+
|
|
61
70
|
const textWithoutTrigger = textContent.slice(
|
|
62
71
|
triggerIndex + triggerPrefix.length
|
|
63
72
|
);
|
|
@@ -71,7 +80,7 @@ export function getAutocompleteMatch(
|
|
|
71
80
|
return null;
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
const mismatch =
|
|
83
|
+
const mismatch = matchCount === 0;
|
|
75
84
|
const wordsFromTrigger = textWithoutTrigger.split( /\s/ );
|
|
76
85
|
|
|
77
86
|
// Allow matching when typing a trigger + the match string or when
|
|
@@ -108,6 +117,18 @@ export function getAutocompleteMatch(
|
|
|
108
117
|
return null;
|
|
109
118
|
}
|
|
110
119
|
|
|
120
|
+
// After a completion whose value starts with the trigger prefix
|
|
121
|
+
// (e.g. @username), the trigger remains in the text and would
|
|
122
|
+
// re-activate the autocompleter. Suppress the match when the
|
|
123
|
+
// filter value still corresponds to the recently completed text.
|
|
124
|
+
if (
|
|
125
|
+
lastCompletion &&
|
|
126
|
+
lastCompletion.name === completer.name &&
|
|
127
|
+
textWithoutTrigger.trimEnd() === lastCompletion.value
|
|
128
|
+
) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
111
132
|
return {
|
|
112
133
|
completer,
|
|
113
134
|
filterValue: removeAccents( textWithoutTrigger ),
|
|
@@ -108,10 +108,15 @@ export function useAutocomplete( {
|
|
|
108
108
|
state;
|
|
109
109
|
|
|
110
110
|
const backspacingRef = useRef( false );
|
|
111
|
+
const prevRecordTextRef = useRef( '' );
|
|
112
|
+
const lastCompletionRef = useRef< {
|
|
113
|
+
name: string;
|
|
114
|
+
value: string;
|
|
115
|
+
} | null >( null );
|
|
111
116
|
|
|
112
117
|
function insertCompletion( replacement: React.ReactNode ) {
|
|
113
118
|
if ( autocompleter === null ) {
|
|
114
|
-
return;
|
|
119
|
+
return '';
|
|
115
120
|
}
|
|
116
121
|
const end = record.start;
|
|
117
122
|
const start =
|
|
@@ -119,27 +124,48 @@ export function useAutocomplete( {
|
|
|
119
124
|
const toInsert = create( { html: renderToString( replacement ) } );
|
|
120
125
|
|
|
121
126
|
onChange( insert( record, toInsert, start, end ) );
|
|
127
|
+
return getTextContent( toInsert );
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
function select( option: KeyedOption ) {
|
|
125
|
-
|
|
131
|
+
if ( option.isDisabled || ! autocompleter ) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
126
134
|
|
|
127
|
-
|
|
135
|
+
const { getOptionCompletion } = autocompleter;
|
|
136
|
+
if ( ! getOptionCompletion ) {
|
|
137
|
+
dispatch( { type: 'RESET' } );
|
|
138
|
+
contentRef.current?.focus();
|
|
128
139
|
return;
|
|
129
140
|
}
|
|
130
141
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
142
|
+
const completionObject = getCompletionObject(
|
|
143
|
+
getOptionCompletion( option.value, filterValue )
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
if ( 'replace' === completionObject.action ) {
|
|
147
|
+
onReplace( [ completionObject.value ] );
|
|
148
|
+
// When replacing, the component will unmount, so don't reset
|
|
149
|
+
// state (below) on an unmounted component.
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
135
152
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
153
|
+
if ( 'insert-at-caret' === completionObject.action ) {
|
|
154
|
+
const completionText = insertCompletion( completionObject.value );
|
|
155
|
+
// When the completion value starts with the trigger prefix
|
|
156
|
+
// (e.g. @username), the trigger stays in the text and would
|
|
157
|
+
// re-activate the autocompleter. Store the completed text so
|
|
158
|
+
// the effect can suppress the stale re-match.
|
|
159
|
+
if ( completionText.startsWith( autocompleter.triggerPrefix ) ) {
|
|
160
|
+
const afterPrefix = completionText.slice(
|
|
161
|
+
autocompleter.triggerPrefix.length
|
|
162
|
+
);
|
|
163
|
+
if ( afterPrefix ) {
|
|
164
|
+
lastCompletionRef.current = {
|
|
165
|
+
name: autocompleter.name,
|
|
166
|
+
value: afterPrefix,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
143
169
|
}
|
|
144
170
|
}
|
|
145
171
|
|
|
@@ -222,6 +248,9 @@ export function useAutocomplete( {
|
|
|
222
248
|
}, [ record ] );
|
|
223
249
|
|
|
224
250
|
useEffect( () => {
|
|
251
|
+
const isTextChange = record.text !== prevRecordTextRef.current;
|
|
252
|
+
prevRecordTextRef.current = record.text;
|
|
253
|
+
|
|
225
254
|
function getTextAfterSelection() {
|
|
226
255
|
return textContent
|
|
227
256
|
? getTextContent(
|
|
@@ -234,13 +263,12 @@ export function useAutocomplete( {
|
|
|
234
263
|
: '';
|
|
235
264
|
}
|
|
236
265
|
|
|
237
|
-
const match = getAutocompleteMatch(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
);
|
|
266
|
+
const match = getAutocompleteMatch( textContent, completers, {
|
|
267
|
+
matchCount: filteredOptions.length,
|
|
268
|
+
isBackspacing: backspacingRef.current,
|
|
269
|
+
getTextAfterSelection,
|
|
270
|
+
lastCompletion: lastCompletionRef.current,
|
|
271
|
+
} );
|
|
244
272
|
|
|
245
273
|
if ( ! match ) {
|
|
246
274
|
if ( autocompleter ) {
|
|
@@ -251,6 +279,26 @@ export function useAutocomplete( {
|
|
|
251
279
|
|
|
252
280
|
const { completer, filterValue: query } = match;
|
|
253
281
|
|
|
282
|
+
// Don't re-activate a dismissed autocompleter on cursor-only
|
|
283
|
+
// movement. `textContent` (text before cursor) changes with the
|
|
284
|
+
// caret, so the effect re-runs, but `record.text` does not.
|
|
285
|
+
// Complements the render-time `didUserInput` gate in
|
|
286
|
+
// `useAutocompleteProps` for callers using this hook directly.
|
|
287
|
+
if ( ! autocompleter && ! isTextChange ) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Clear stale completion ref when the user types a new trigger
|
|
292
|
+
// for the same completer (the previous completion is no longer
|
|
293
|
+
// relevant). Must be after the cursor-only check so that mere
|
|
294
|
+
// cursor movement doesn't discard the suppression state.
|
|
295
|
+
if (
|
|
296
|
+
lastCompletionRef.current &&
|
|
297
|
+
lastCompletionRef.current.name === completer.name
|
|
298
|
+
) {
|
|
299
|
+
lastCompletionRef.current = null;
|
|
300
|
+
}
|
|
301
|
+
|
|
254
302
|
dispatch( { type: 'MATCH', completer, query } );
|
|
255
303
|
// We want to avoid introducing unexpected side effects.
|
|
256
304
|
// See https://github.com/WordPress/gutenberg/pull/41820
|
|
@@ -14,17 +14,23 @@ const createCompleter = (
|
|
|
14
14
|
...overrides,
|
|
15
15
|
} );
|
|
16
16
|
|
|
17
|
+
const defaultOptions = {
|
|
18
|
+
matchCount: 1,
|
|
19
|
+
isBackspacing: false,
|
|
20
|
+
getTextAfterSelection: () => '',
|
|
21
|
+
};
|
|
22
|
+
|
|
17
23
|
describe( 'getAutocompleteMatch', () => {
|
|
18
24
|
it( 'should return null for empty text content', () => {
|
|
19
25
|
const completers = [ createCompleter() ];
|
|
20
26
|
expect(
|
|
21
|
-
getAutocompleteMatch( '', completers,
|
|
27
|
+
getAutocompleteMatch( '', completers, defaultOptions )
|
|
22
28
|
).toBeNull();
|
|
23
29
|
} );
|
|
24
30
|
|
|
25
31
|
it( 'should return null when no completers are provided', () => {
|
|
26
32
|
expect(
|
|
27
|
-
getAutocompleteMatch( 'some text /', [],
|
|
33
|
+
getAutocompleteMatch( 'some text /', [], defaultOptions )
|
|
28
34
|
).toBeNull();
|
|
29
35
|
} );
|
|
30
36
|
|
|
@@ -34,9 +40,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
34
40
|
getAutocompleteMatch(
|
|
35
41
|
'no trigger here',
|
|
36
42
|
completers,
|
|
37
|
-
|
|
38
|
-
false,
|
|
39
|
-
() => ''
|
|
43
|
+
defaultOptions
|
|
40
44
|
)
|
|
41
45
|
).toBeNull();
|
|
42
46
|
} );
|
|
@@ -46,9 +50,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
46
50
|
const result = getAutocompleteMatch(
|
|
47
51
|
'some text /query',
|
|
48
52
|
completers,
|
|
49
|
-
|
|
50
|
-
false,
|
|
51
|
-
() => ''
|
|
53
|
+
defaultOptions
|
|
52
54
|
);
|
|
53
55
|
expect( result ).toEqual( {
|
|
54
56
|
completer: completers[ 0 ],
|
|
@@ -61,9 +63,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
61
63
|
const result = getAutocompleteMatch(
|
|
62
64
|
'hello @',
|
|
63
65
|
completers,
|
|
64
|
-
|
|
65
|
-
false,
|
|
66
|
-
() => ''
|
|
66
|
+
defaultOptions
|
|
67
67
|
);
|
|
68
68
|
expect( result ).toEqual( {
|
|
69
69
|
completer: completers[ 0 ],
|
|
@@ -83,9 +83,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
83
83
|
const result = getAutocompleteMatch(
|
|
84
84
|
'/command some text @user',
|
|
85
85
|
[ slashCompleter, atCompleter ],
|
|
86
|
-
|
|
87
|
-
false,
|
|
88
|
-
() => ''
|
|
86
|
+
defaultOptions
|
|
89
87
|
);
|
|
90
88
|
expect( result?.completer.name ).toBe( 'at' );
|
|
91
89
|
} );
|
|
@@ -94,47 +92,35 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
94
92
|
const completers = [ createCompleter( { triggerPrefix: '/' } ) ];
|
|
95
93
|
const longText = '/' + 'a'.repeat( 51 );
|
|
96
94
|
expect(
|
|
97
|
-
getAutocompleteMatch( longText, completers,
|
|
95
|
+
getAutocompleteMatch( longText, completers, defaultOptions )
|
|
98
96
|
).toBeNull();
|
|
99
97
|
} );
|
|
100
98
|
|
|
101
99
|
it( 'should match when text after trigger is exactly 50 chars', () => {
|
|
102
100
|
const completers = [ createCompleter( { triggerPrefix: '/' } ) ];
|
|
103
101
|
const text = '/' + 'a'.repeat( 50 );
|
|
104
|
-
const result = getAutocompleteMatch(
|
|
105
|
-
text,
|
|
106
|
-
completers,
|
|
107
|
-
1,
|
|
108
|
-
false,
|
|
109
|
-
() => ''
|
|
110
|
-
);
|
|
102
|
+
const result = getAutocompleteMatch( text, completers, defaultOptions );
|
|
111
103
|
expect( result ).not.toBeNull();
|
|
112
104
|
expect( result?.filterValue ).toBe( 'a'.repeat( 50 ) );
|
|
113
105
|
} );
|
|
114
106
|
|
|
115
107
|
it( 'should return null on mismatch with multiple words and no backspacing', () => {
|
|
116
108
|
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
117
|
-
// 4 words from trigger, mismatch (
|
|
109
|
+
// 4 words from trigger, mismatch (matchCount=0), not backspacing
|
|
118
110
|
expect(
|
|
119
|
-
getAutocompleteMatch(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
false,
|
|
124
|
-
() => ''
|
|
125
|
-
)
|
|
111
|
+
getAutocompleteMatch( 'text @one two three four', completers, {
|
|
112
|
+
...defaultOptions,
|
|
113
|
+
matchCount: 0,
|
|
114
|
+
} )
|
|
126
115
|
).toBeNull();
|
|
127
116
|
} );
|
|
128
117
|
|
|
129
118
|
it( 'should still match on mismatch when there is only one trigger word', () => {
|
|
130
119
|
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
131
|
-
const result = getAutocompleteMatch(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
false,
|
|
136
|
-
() => ''
|
|
137
|
-
);
|
|
120
|
+
const result = getAutocompleteMatch( 'text @xyz', completers, {
|
|
121
|
+
...defaultOptions,
|
|
122
|
+
matchCount: 0,
|
|
123
|
+
} );
|
|
138
124
|
expect( result ).not.toBeNull();
|
|
139
125
|
expect( result?.filterValue ).toBe( 'xyz' );
|
|
140
126
|
} );
|
|
@@ -144,9 +130,11 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
144
130
|
const result = getAutocompleteMatch(
|
|
145
131
|
'text @one two three',
|
|
146
132
|
completers,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
133
|
+
{
|
|
134
|
+
...defaultOptions,
|
|
135
|
+
matchCount: 0,
|
|
136
|
+
isBackspacing: true,
|
|
137
|
+
}
|
|
150
138
|
);
|
|
151
139
|
expect( result ).not.toBeNull();
|
|
152
140
|
} );
|
|
@@ -154,27 +142,25 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
154
142
|
it( 'should NOT match while backspacing if more than 3 words from trigger', () => {
|
|
155
143
|
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
156
144
|
expect(
|
|
157
|
-
getAutocompleteMatch(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
() => ''
|
|
163
|
-
)
|
|
145
|
+
getAutocompleteMatch( 'text @one two three four', completers, {
|
|
146
|
+
...defaultOptions,
|
|
147
|
+
matchCount: 0,
|
|
148
|
+
isBackspacing: true,
|
|
149
|
+
} )
|
|
164
150
|
).toBeNull();
|
|
165
151
|
} );
|
|
166
152
|
|
|
167
153
|
it( 'should return null when text after trigger starts with whitespace', () => {
|
|
168
154
|
const completers = [ createCompleter( { triggerPrefix: '/' } ) ];
|
|
169
155
|
expect(
|
|
170
|
-
getAutocompleteMatch( '/ query', completers,
|
|
156
|
+
getAutocompleteMatch( '/ query', completers, defaultOptions )
|
|
171
157
|
).toBeNull();
|
|
172
158
|
} );
|
|
173
159
|
|
|
174
160
|
it( 'should return null when text after trigger ends with multiple spaces', () => {
|
|
175
161
|
const completers = [ createCompleter( { triggerPrefix: '/' } ) ];
|
|
176
162
|
expect(
|
|
177
|
-
getAutocompleteMatch( '/query ', completers,
|
|
163
|
+
getAutocompleteMatch( '/query ', completers, defaultOptions )
|
|
178
164
|
).toBeNull();
|
|
179
165
|
} );
|
|
180
166
|
|
|
@@ -186,7 +172,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
186
172
|
} ),
|
|
187
173
|
];
|
|
188
174
|
expect(
|
|
189
|
-
getAutocompleteMatch( 'text @user', completers,
|
|
175
|
+
getAutocompleteMatch( 'text @user', completers, defaultOptions )
|
|
190
176
|
).toBeNull();
|
|
191
177
|
} );
|
|
192
178
|
|
|
@@ -198,13 +184,10 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
198
184
|
allowContext,
|
|
199
185
|
} ),
|
|
200
186
|
];
|
|
201
|
-
getAutocompleteMatch(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
false,
|
|
206
|
-
() => 'after'
|
|
207
|
-
);
|
|
187
|
+
getAutocompleteMatch( 'before @user', completers, {
|
|
188
|
+
...defaultOptions,
|
|
189
|
+
getTextAfterSelection: () => 'after',
|
|
190
|
+
} );
|
|
208
191
|
expect( allowContext ).toHaveBeenCalledWith( 'before ', 'after' );
|
|
209
192
|
} );
|
|
210
193
|
|
|
@@ -213,9 +196,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
213
196
|
const result = getAutocompleteMatch(
|
|
214
197
|
'text @café',
|
|
215
198
|
completers,
|
|
216
|
-
|
|
217
|
-
false,
|
|
218
|
-
() => ''
|
|
199
|
+
defaultOptions
|
|
219
200
|
);
|
|
220
201
|
expect( result ).not.toBeNull();
|
|
221
202
|
expect( result?.filterValue ).toBe( 'cafe' );
|
|
@@ -233,9 +214,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
233
214
|
const result = getAutocompleteMatch(
|
|
234
215
|
'@@user',
|
|
235
216
|
[ singleAt, doubleAt ],
|
|
236
|
-
|
|
237
|
-
false,
|
|
238
|
-
() => ''
|
|
217
|
+
defaultOptions
|
|
239
218
|
);
|
|
240
219
|
expect( result?.completer.name ).toBe( 'double' );
|
|
241
220
|
expect( result?.filterValue ).toBe( 'user' );
|
|
@@ -253,9 +232,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
253
232
|
const result = getAutocompleteMatch(
|
|
254
233
|
'hello @user',
|
|
255
234
|
[ singleAt, doubleAt ],
|
|
256
|
-
|
|
257
|
-
false,
|
|
258
|
-
() => ''
|
|
235
|
+
defaultOptions
|
|
259
236
|
);
|
|
260
237
|
expect( result?.completer.name ).toBe( 'single' );
|
|
261
238
|
expect( result?.filterValue ).toBe( 'user' );
|
|
@@ -266,9 +243,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
266
243
|
const result = getAutocompleteMatch(
|
|
267
244
|
'text $$query',
|
|
268
245
|
completers,
|
|
269
|
-
|
|
270
|
-
false,
|
|
271
|
-
() => ''
|
|
246
|
+
defaultOptions
|
|
272
247
|
);
|
|
273
248
|
expect( result ).not.toBeNull();
|
|
274
249
|
expect( result?.filterValue ).toBe( 'query' );
|
|
@@ -279,14 +254,63 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
279
254
|
const result = getAutocompleteMatch(
|
|
280
255
|
'/hello world',
|
|
281
256
|
completers,
|
|
282
|
-
|
|
283
|
-
false,
|
|
284
|
-
() => ''
|
|
257
|
+
defaultOptions
|
|
285
258
|
);
|
|
286
259
|
expect( result ).not.toBeNull();
|
|
287
260
|
expect( result?.filterValue ).toBe( 'hello world' );
|
|
288
261
|
} );
|
|
289
262
|
|
|
263
|
+
describe( 'lastCompletion suppression', () => {
|
|
264
|
+
it( 'should suppress match when text equals last completion value', () => {
|
|
265
|
+
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
266
|
+
expect(
|
|
267
|
+
getAutocompleteMatch( '@user', completers, {
|
|
268
|
+
...defaultOptions,
|
|
269
|
+
lastCompletion: {
|
|
270
|
+
name: completers[ 0 ].name,
|
|
271
|
+
value: 'user',
|
|
272
|
+
},
|
|
273
|
+
} )
|
|
274
|
+
).toBeNull();
|
|
275
|
+
} );
|
|
276
|
+
|
|
277
|
+
it( 'should suppress match ignoring trailing whitespace', () => {
|
|
278
|
+
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
279
|
+
expect(
|
|
280
|
+
getAutocompleteMatch( '@user ', completers, {
|
|
281
|
+
...defaultOptions,
|
|
282
|
+
lastCompletion: {
|
|
283
|
+
name: completers[ 0 ].name,
|
|
284
|
+
value: 'user',
|
|
285
|
+
},
|
|
286
|
+
} )
|
|
287
|
+
).toBeNull();
|
|
288
|
+
} );
|
|
289
|
+
|
|
290
|
+
it( 'should NOT suppress match when completer name differs', () => {
|
|
291
|
+
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
292
|
+
const result = getAutocompleteMatch( '@user', completers, {
|
|
293
|
+
...defaultOptions,
|
|
294
|
+
lastCompletion: { name: 'other', value: 'user' },
|
|
295
|
+
} );
|
|
296
|
+
expect( result ).not.toBeNull();
|
|
297
|
+
expect( result?.filterValue ).toBe( 'user' );
|
|
298
|
+
} );
|
|
299
|
+
|
|
300
|
+
it( 'should NOT suppress match when text diverges from last completion', () => {
|
|
301
|
+
const completers = [ createCompleter( { triggerPrefix: '@' } ) ];
|
|
302
|
+
const result = getAutocompleteMatch( '@user2', completers, {
|
|
303
|
+
...defaultOptions,
|
|
304
|
+
lastCompletion: {
|
|
305
|
+
name: completers[ 0 ].name,
|
|
306
|
+
value: 'user',
|
|
307
|
+
},
|
|
308
|
+
} );
|
|
309
|
+
expect( result ).not.toBeNull();
|
|
310
|
+
expect( result?.filterValue ).toBe( 'user2' );
|
|
311
|
+
} );
|
|
312
|
+
} );
|
|
313
|
+
|
|
290
314
|
it.each( [
|
|
291
315
|
{
|
|
292
316
|
text: 'café @user',
|
|
@@ -327,9 +351,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
327
351
|
const result = getAutocompleteMatch(
|
|
328
352
|
text,
|
|
329
353
|
completers,
|
|
330
|
-
|
|
331
|
-
false,
|
|
332
|
-
() => ''
|
|
354
|
+
defaultOptions
|
|
333
355
|
);
|
|
334
356
|
expect( result ).not.toBeNull();
|
|
335
357
|
expect( result?.filterValue ).toBe( expected );
|
|
@@ -10,6 +10,7 @@ import BaseControl, { useBaseControlProps } from '..';
|
|
|
10
10
|
import Button from '../../button';
|
|
11
11
|
|
|
12
12
|
const meta: Meta< typeof BaseControl > = {
|
|
13
|
+
tags: [ 'manifest' ],
|
|
13
14
|
title: 'Components/Selection & Input/Common/BaseControl',
|
|
14
15
|
id: 'components-basecontrol',
|
|
15
16
|
component: BaseControl,
|