@wordpress/components 25.9.0 → 25.10.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 +32 -0
- package/build/alignment-matrix-control/cell.js +8 -5
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/index.js +27 -43
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/utils.js +29 -9
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +20 -39
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +11 -32
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/circular-option-picker/types.js.map +1 -1
- package/build/color-palette/index.js +7 -2
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/component.js +12 -2
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/picker.js +77 -1
- package/build/color-picker/picker.js.map +1 -1
- package/build/color-picker/styles.js +8 -8
- package/build/color-picker/styles.js.map +1 -1
- package/build/color-picker/types.js.map +1 -1
- package/build/composite/v2.js +43 -0
- package/build/composite/v2.js.map +1 -0
- package/build/confirm-dialog/component.js +74 -8
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/confirm-dialog/types.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +13 -4
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/font-size-picker/utils.js +1 -1
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/modal/index.js +45 -16
- package/build/modal/index.js.map +1 -1
- package/build/palette-edit/index.js +4 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +34 -6
- package/build/popover/index.js.map +1 -1
- package/build/private-apis.js +9 -1
- package/build/private-apis.js.map +1 -1
- package/build/progress-bar/styles.js +5 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/sandbox/index.js +1 -1
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +1 -1
- package/build/sandbox/index.native.js.map +1 -1
- package/build/tabs/context.js +16 -0
- package/build/tabs/context.js.map +1 -0
- package/build/tabs/index.js +147 -0
- package/build/tabs/index.js.map +1 -0
- package/build/tabs/styles.js +38 -0
- package/build/tabs/styles.js.map +1 -0
- package/build/tabs/tab.js +46 -0
- package/build/tabs/tab.js.map +1 -0
- package/build/tabs/tablist.js +47 -0
- package/build/tabs/tablist.js.map +1 -0
- package/build/tabs/tabpanel.js +48 -0
- package/build/tabs/tabpanel.js.map +1 -0
- package/build/tabs/types.js +6 -0
- package/build/tabs/types.js.map +1 -0
- package/build/text/component.js +7 -6
- package/build/text/component.js.map +1 -1
- package/build/text/hook.js +6 -15
- package/build/text/hook.js.map +1 -1
- package/build/text/index.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/text/types.js.map +1 -1
- package/build/text/utils.js +17 -33
- package/build/text/utils.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +1 -0
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toolbar/toolbar/index.js +17 -10
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar/types.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +2 -2
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/tools-panel/types.js.map +1 -1
- package/build/unit-control/utils.js +108 -0
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/unit-values.js +1 -1
- package/build/utils/unit-values.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +7 -4
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +27 -43
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +29 -8
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +20 -39
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +10 -31
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/circular-option-picker/types.js.map +1 -1
- package/build-module/color-palette/index.js +7 -2
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/component.js +13 -3
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/picker.js +78 -2
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -8
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/color-picker/types.js.map +1 -1
- package/build-module/composite/v2.js +15 -0
- package/build-module/composite/v2.js.map +1 -0
- package/build-module/confirm-dialog/component.js +72 -7
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/confirm-dialog/types.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +13 -4
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/font-size-picker/utils.js +1 -1
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/modal/index.js +47 -18
- package/build-module/modal/index.js.map +1 -1
- package/build-module/palette-edit/index.js +4 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/popover/index.js +34 -6
- package/build-module/popover/index.js.map +1 -1
- package/build-module/private-apis.js +9 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/progress-bar/styles.js +5 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/sandbox/index.js +1 -1
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -1
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/tabs/context.js +12 -0
- package/build-module/tabs/context.js.map +1 -0
- package/build-module/tabs/index.js +142 -0
- package/build-module/tabs/index.js.map +1 -0
- package/build-module/tabs/styles.js +36 -0
- package/build-module/tabs/styles.js.map +1 -0
- package/build-module/tabs/tab.js +43 -0
- package/build-module/tabs/tab.js.map +1 -0
- package/build-module/tabs/tablist.js +41 -0
- package/build-module/tabs/tablist.js.map +1 -0
- package/build-module/tabs/tabpanel.js +43 -0
- package/build-module/tabs/tabpanel.js.map +1 -0
- package/build-module/tabs/types.js +2 -0
- package/build-module/tabs/types.js.map +1 -0
- package/build-module/text/component.js +6 -6
- package/build-module/text/component.js.map +1 -1
- package/build-module/text/hook.js +11 -19
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/index.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/text/types.js.map +1 -1
- package/build-module/text/utils.js +17 -10
- package/build-module/text/utils.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +1 -0
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +18 -11
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/types.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +2 -2
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/tools-panel/types.js.map +1 -1
- package/build-module/unit-control/utils.js +108 -0
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/unit-values.js +1 -1
- package/build-module/utils/unit-values.js.map +1 -1
- package/build-style/style-rtl.css +16 -4
- package/build-style/style.css +16 -4
- package/build-types/alignment-matrix-control/cell.d.ts +1 -1
- package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/utils.d.ts +9 -9
- package/build-types/alignment-matrix-control/utils.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +4 -6
- package/build-types/circular-option-picker/types.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/picker.d.ts +1 -1
- package/build-types/color-picker/picker.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/color-picker/types.d.ts +3 -0
- package/build-types/color-picker/types.d.ts.map +1 -1
- package/build-types/composite/v2.d.ts +12 -0
- package/build-types/composite/v2.d.ts.map +1 -0
- package/build-types/confirm-dialog/component.d.ts +70 -29
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/confirm-dialog/stories/index.story.d.ts +11 -0
- package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -0
- package/build-types/confirm-dialog/test/index.d.ts +2 -0
- package/build-types/confirm-dialog/test/index.d.ts.map +1 -0
- package/build-types/confirm-dialog/types.d.ts +32 -10
- package/build-types/confirm-dialog/types.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/font-size-picker/utils.d.ts.map +1 -1
- package/build-types/heading/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/styles.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/tabs/context.d.ts +8 -0
- package/build-types/tabs/context.d.ts.map +1 -0
- package/build-types/tabs/index.d.ts +13 -0
- package/build-types/tabs/index.d.ts.map +1 -0
- package/build-types/tabs/stories/index.story.d.ts +20 -0
- package/build-types/tabs/stories/index.story.d.ts.map +1 -0
- package/build-types/tabs/styles.d.ts +17 -0
- package/build-types/tabs/styles.d.ts.map +1 -0
- package/build-types/tabs/tab.d.ts +10 -0
- package/build-types/tabs/tab.d.ts.map +1 -0
- package/build-types/tabs/tablist.d.ts +7 -0
- package/build-types/tabs/tablist.d.ts.map +1 -0
- package/build-types/tabs/tabpanel.d.ts +7 -0
- package/build-types/tabs/tabpanel.d.ts.map +1 -0
- package/build-types/tabs/test/index.d.ts +2 -0
- package/build-types/tabs/test/index.d.ts.map +1 -0
- package/build-types/tabs/types.d.ts +134 -0
- package/build-types/tabs/types.d.ts.map +1 -0
- package/build-types/text/component.d.ts +4 -2
- package/build-types/text/component.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +171 -165
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/index.d.ts +2 -2
- package/build-types/text/index.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts +21 -0
- package/build-types/text/stories/index.story.d.ts.map +1 -0
- package/build-types/text/styles.d.ts +7 -7
- package/build-types/text/styles.d.ts.map +1 -1
- package/build-types/text/types.d.ts +1 -1
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/text/utils.d.ts +56 -61
- package/build-types/text/utils.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.story.d.ts +5 -0
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/types.d.ts +10 -0
- package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +2 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/unit-control/utils.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/alignment-matrix-control/cell.tsx +6 -2
- package/src/alignment-matrix-control/index.tsx +31 -54
- package/src/alignment-matrix-control/stories/index.story.tsx +3 -7
- package/src/alignment-matrix-control/test/index.tsx +117 -18
- package/src/alignment-matrix-control/utils.tsx +33 -9
- package/src/button/style.scss +1 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +24 -38
- package/src/circular-option-picker/circular-option-picker.tsx +11 -28
- package/src/circular-option-picker/types.ts +6 -5
- package/src/color-palette/index.tsx +6 -1
- package/src/color-picker/component.tsx +25 -3
- package/src/color-picker/picker.tsx +96 -2
- package/src/color-picker/styles.ts +0 -1
- package/src/color-picker/types.ts +3 -0
- package/src/composite/v2.ts +22 -0
- package/src/confirm-dialog/README.md +1 -1
- package/src/confirm-dialog/component.tsx +79 -13
- package/src/confirm-dialog/stories/{index.story.js → index.story.tsx} +26 -24
- package/src/confirm-dialog/test/{index.js → index.tsx} +3 -3
- package/src/confirm-dialog/types.ts +32 -12
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +32 -25
- package/src/font-size-picker/utils.ts +2 -1
- package/src/heading/stories/index.story.tsx +2 -4
- package/src/modal/index.tsx +58 -22
- package/src/modal/test/index.tsx +29 -0
- package/src/notice/style.scss +0 -1
- package/src/palette-edit/index.tsx +4 -0
- package/src/popover/index.tsx +99 -57
- package/src/popover/style.scss +9 -0
- package/src/private-apis.ts +15 -1
- package/src/progress-bar/styles.ts +19 -4
- package/src/sandbox/index.native.js +1 -1
- package/src/sandbox/index.tsx +3 -1
- package/src/tabs/README.md +242 -0
- package/src/tabs/context.ts +13 -0
- package/src/tabs/index.tsx +167 -0
- package/src/tabs/stories/index.story.tsx +352 -0
- package/src/tabs/styles.ts +103 -0
- package/src/tabs/tab.tsx +39 -0
- package/src/tabs/tablist.tsx +40 -0
- package/src/tabs/tabpanel.tsx +42 -0
- package/src/tabs/test/index.tsx +1124 -0
- package/src/tabs/types.ts +142 -0
- package/src/text/README.md +2 -2
- package/src/text/{component.js → component.tsx} +10 -6
- package/src/text/{hook.js → hook.ts} +12 -15
- package/src/text/stories/index.story.tsx +80 -0
- package/src/text/types.ts +1 -6
- package/src/text/{utils.js → utils.ts} +40 -14
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +8 -0
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +1 -0
- package/src/toolbar/stories/index.story.tsx +15 -0
- package/src/toolbar/test/index.tsx +8 -0
- package/src/toolbar/toolbar/README.md +9 -0
- package/src/toolbar/toolbar/index.tsx +21 -12
- package/src/toolbar/toolbar/style.scss +9 -0
- package/src/toolbar/toolbar/types.ts +10 -0
- package/src/tools-panel/tools-panel/README.md +3 -0
- package/src/tools-panel/tools-panel-item/hook.ts +4 -6
- package/src/tools-panel/types.ts +2 -0
- package/src/unit-control/utils.ts +124 -0
- package/src/utils/unit-values.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/text/stories/index.story.js +0 -53
- /package/src/text/{index.js → index.ts} +0 -0
- /package/src/text/{styles.js → styles.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/text/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,QAAQ,GACjB,MAAM,GACN,SAAS,GACT,UAAU,GACV,YAAY,GACZ,aAAa,GACb,OAAO,CAAC;AAEX,KAAK,WAAW,GAAG,OAAO,CAAC;AAE3B,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtE,MAAM,WAAW,KAAM,SAAQ,aAAa;IAC3C;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAE,WAAW,CAAE,CAAC;IACrC;;OAEG;IACH,gCAAgC,CAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/text/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,QAAQ,GACjB,MAAM,GACN,SAAS,GACT,UAAU,GACV,YAAY,GACZ,aAAa,GACb,OAAO,CAAC;AAEX,KAAK,WAAW,GAAG,OAAO,CAAC;AAE3B,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEtE,MAAM,WAAW,KAAM,SAAQ,aAAa;IAC3C;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAE,WAAW,CAAE,CAAC;IACrC;;OAEG;IACH,gCAAgC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC3E;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAE,OAAO,CAAE,CAAC;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAE,SAAS,CAAE,CAAC;IACrC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,iBAAiB,CAAC,EAAE,WAAW,CAAE,UAAU,CAAE,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAE,YAAY,CAAE,CAAC;IAC3C;;OAEG;IACH,sBAAsB,CAAC,EAAE,aAAa,CAAE,OAAO,CAAE,CAAC;IAClD;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAE,UAAU,CAAE,GAAG,QAAQ,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAE,YAAY,CAAE,GAAG,UAAU,CAAC;IACpD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAE,eAAe,CAAE,CAAC;IACjD;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B"}
|
|
@@ -1,69 +1,64 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FindAllArgs } from 'highlight-words-core';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
+
* Source:
|
|
5
|
+
* https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
|
|
4
6
|
*/
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @typedef Options
|
|
9
|
+
* @property {string} [activeClassName=''] Classname for active highlighted areas.
|
|
10
|
+
* @property {number} [activeIndex=-1] The index of the active highlighted area.
|
|
11
|
+
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.
|
|
12
|
+
* @property {boolean} [autoEscape] Whether to automatically escape text.
|
|
13
|
+
* @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
|
|
14
|
+
* @property {string} children Children to highlight.
|
|
15
|
+
* @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
|
|
16
|
+
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
|
|
17
|
+
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
|
|
18
|
+
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
|
|
19
|
+
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
|
|
20
|
+
* @property {string[]} [searchWords=[]] Words to search for and highlight.
|
|
21
|
+
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
|
|
22
|
+
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
|
|
23
|
+
*/
|
|
24
|
+
interface Options {
|
|
25
|
+
activeClassName?: string;
|
|
26
|
+
activeIndex?: number;
|
|
27
|
+
activeStyle?: React.AllHTMLAttributes<HTMLDivElement>['style'];
|
|
28
|
+
autoEscape?: boolean;
|
|
29
|
+
caseSensitive?: boolean;
|
|
30
|
+
children: string;
|
|
31
|
+
findChunks?: FindAllArgs['findChunks'];
|
|
32
|
+
highlightClassName?: string | Record<string, unknown>;
|
|
33
|
+
highlightStyle?: React.AllHTMLAttributes<HTMLDivElement>['style'];
|
|
34
|
+
highlightTag?: keyof JSX.IntrinsicElements;
|
|
35
|
+
sanitize?: FindAllArgs['sanitize'];
|
|
36
|
+
searchWords?: string[];
|
|
37
|
+
unhighlightClassName?: string;
|
|
38
|
+
unhighlightStyle?: React.AllHTMLAttributes<HTMLDivElement>['style'];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param options
|
|
42
|
+
* @param options.activeClassName
|
|
43
|
+
* @param options.activeIndex
|
|
44
|
+
* @param options.activeStyle
|
|
45
|
+
* @param options.autoEscape
|
|
46
|
+
* @param options.caseSensitive
|
|
47
|
+
* @param options.children
|
|
48
|
+
* @param options.findChunks
|
|
49
|
+
* @param options.highlightClassName
|
|
50
|
+
* @param options.highlightStyle
|
|
51
|
+
* @param options.highlightTag
|
|
52
|
+
* @param options.sanitize
|
|
53
|
+
* @param options.searchWords
|
|
54
|
+
* @param options.unhighlightClassName
|
|
55
|
+
* @param options.unhighlightStyle
|
|
56
|
+
*/
|
|
57
|
+
export declare function createHighlighterText({ activeClassName, activeIndex, activeStyle, autoEscape, caseSensitive, children, findChunks, highlightClassName, highlightStyle, highlightTag, sanitize, searchWords, unhighlightClassName, unhighlightStyle, }: Options): (import("react").DOMElement<Record<string, unknown>, Element> | import("react").DetailedReactHTMLElement<{
|
|
6
58
|
children: string;
|
|
7
59
|
className: string;
|
|
8
60
|
key: number;
|
|
9
61
|
style: import("react").CSSProperties | undefined;
|
|
10
62
|
}, HTMLElement>)[] | null;
|
|
11
|
-
export
|
|
12
|
-
/**
|
|
13
|
-
* Classname for active highlighted areas.
|
|
14
|
-
*/
|
|
15
|
-
activeClassName?: string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* The index of the active highlighted area.
|
|
18
|
-
*/
|
|
19
|
-
activeIndex?: number | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Styles to apply to the active highlighted area.
|
|
22
|
-
*/
|
|
23
|
-
activeStyle?: import('react').AllHTMLAttributes<HTMLDivElement>['style'];
|
|
24
|
-
/**
|
|
25
|
-
* Whether to automatically escape text.
|
|
26
|
-
*/
|
|
27
|
-
autoEscape?: boolean | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Whether to highlight in a case-sensitive manner.
|
|
30
|
-
*/
|
|
31
|
-
caseSensitive?: boolean | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Children to highlight.
|
|
34
|
-
*/
|
|
35
|
-
children: string;
|
|
36
|
-
/**
|
|
37
|
-
* Custom `findChunks` function to pass to `highlight-words-core`.
|
|
38
|
-
*/
|
|
39
|
-
findChunks?: import('highlight-words-core').FindAllArgs['findChunks'];
|
|
40
|
-
/**
|
|
41
|
-
* Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
|
|
42
|
-
*/
|
|
43
|
-
highlightClassName?: string | Record<string, unknown> | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Styles to apply to highlighted text.
|
|
46
|
-
*/
|
|
47
|
-
highlightStyle?: import('react').AllHTMLAttributes<HTMLDivElement>['style'];
|
|
48
|
-
/**
|
|
49
|
-
* Tag to use for the highlighted text.
|
|
50
|
-
*/
|
|
51
|
-
highlightTag?: keyof JSX.IntrinsicElements | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Custom `santize` function to pass to `highlight-words-core`.
|
|
54
|
-
*/
|
|
55
|
-
sanitize?: import('highlight-words-core').FindAllArgs['sanitize'];
|
|
56
|
-
/**
|
|
57
|
-
* Words to search for and highlight.
|
|
58
|
-
*/
|
|
59
|
-
searchWords?: string[] | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Classname to apply to unhighlighted text.
|
|
62
|
-
*/
|
|
63
|
-
unhighlightClassName?: string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Style to apply to unhighlighted text.
|
|
66
|
-
*/
|
|
67
|
-
unhighlightStyle?: import('react').AllHTMLAttributes<HTMLDivElement>['style'];
|
|
68
|
-
};
|
|
63
|
+
export {};
|
|
69
64
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/text/utils.
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/text/utils.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQxD;;;GAGG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAEH,UAAU,OAAO;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAE,cAAc,CAAE,CAAE,OAAO,CAAE,CAAC;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,WAAW,CAAE,YAAY,CAAE,CAAC;IACzC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAE,MAAM,EAAE,OAAO,CAAE,CAAC;IACxD,cAAc,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAE,cAAc,CAAE,CAAE,OAAO,CAAE,CAAC;IACtE,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,iBAAiB,CAAC;IAC3C,QAAQ,CAAC,EAAE,WAAW,CAAE,UAAU,CAAE,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAE,cAAc,CAAE,CAAE,OAAO,CAAE,CAAC;CACxE;AAkBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAE,EACtC,eAAoB,EACpB,WAAgB,EAChB,WAAW,EACX,UAAU,EACV,aAAqB,EACrB,QAAQ,EACR,UAAU,EACV,kBAAuB,EACvB,cAAmB,EACnB,YAAqB,EACrB,QAAQ,EACR,WAAgB,EAChB,oBAAyB,EACzB,gBAAgB,GAChB,EAAE,OAAO;;;;;0BA2ET"}
|
package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option-base/component.tsx"],"names":[],"mappings":";AAeA;;GAEG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EACX,iCAAiC,EAEjC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/toggle-group-control/toggle-group-control-option-base/component.tsx"],"names":[],"mappings":";AAeA;;GAEG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EACX,iCAAiC,EAEjC,MAAM,UAAU,CAAC;AA0JlB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,qCAAqC,qNAG1C,CAAC;AAEF,eAAe,qCAAqC,CAAC"}
|
|
@@ -11,4 +11,9 @@ declare const meta: Meta<typeof Toolbar>;
|
|
|
11
11
|
export default meta;
|
|
12
12
|
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("../toolbar/types").ToolbarProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | keyof import("../toolbar/types").ToolbarProps> & import("react").RefAttributes<any>>;
|
|
13
13
|
export declare const WithoutGroup: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("../toolbar/types").ToolbarProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | keyof import("../toolbar/types").ToolbarProps> & import("react").RefAttributes<any>>;
|
|
14
|
+
/**
|
|
15
|
+
* Set the variant to `unstyled` to remove default border styles.
|
|
16
|
+
* Otherwise, leave it as `undefined` for default styles.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Unstyled: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("../toolbar/types").ToolbarProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | keyof import("../toolbar/types").ToolbarProps> & import("react").RefAttributes<any>>;
|
|
14
19
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/toolbar/stories/index.story.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAwBtD;;GAEG;AACH,OAAO,EACN,OAAO,EAKP,MAAM,IAAI,CAAC;AAGZ,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/toolbar/stories/index.story.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAwBtD;;GAEG;AACH,OAAO,EACN,OAAO,EAKP,MAAM,IAAI,CAAC;AAGZ,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAwB/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAgBpB,eAAO,MAAM,OAAO,iZAAsB,CAAC;AA8F3C,eAAO,MAAM,YAAY,iZAAsB,CAAC;AAahD;;;GAGG;AAEH,eAAO,MAAM,QAAQ,iZAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toolbar/toolbar/index.tsx"],"names":[],"mappings":";AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/toolbar/toolbar/index.tsx"],"names":[],"mappings":";AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA+D5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,OAAO,uSAAmC,CAAC;AACxD,eAAe,OAAO,CAAC"}
|
|
@@ -11,5 +11,15 @@ export type ToolbarProps = {
|
|
|
11
11
|
* An accessible label for the toolbar.
|
|
12
12
|
*/
|
|
13
13
|
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specifies the toolbar's style.
|
|
16
|
+
*
|
|
17
|
+
* Leave undefined for the default style. Or `'unstyled'` which
|
|
18
|
+
* removes the border from the toolbar, but keeps the default
|
|
19
|
+
* popover style.
|
|
20
|
+
*
|
|
21
|
+
* @default undefined
|
|
22
|
+
*/
|
|
23
|
+
variant?: 'unstyled' | undefined;
|
|
14
24
|
};
|
|
15
25
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/toolbar/toolbar/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/toolbar/toolbar/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel-item/hook.ts"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,uBAAuB,CAAE,mBAAmB,EAAE,KAAK,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel-item/hook.ts"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,uBAAuB,CAAE,mBAAmB,EAAE,KAAK,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8L5D"}
|
|
@@ -47,6 +47,8 @@ export type ToolsPanelProps = {
|
|
|
47
47
|
/**
|
|
48
48
|
* Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render
|
|
49
49
|
* placeholder content instead of null when they are toggled off and hidden.
|
|
50
|
+
* Note that placeholder items won't apply the `className` that would be
|
|
51
|
+
* normally applied to a visible `ToolsPanelItem` via the `className` prop.
|
|
50
52
|
*
|
|
51
53
|
* @default false
|
|
52
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools-panel/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG,CAAE,UAAU,CAAC,EAAE,GAAG,KAAM,GAAG,CAAC;AACzD,KAAK,QAAQ,GAAG,CAAE,OAAO,CAAC,EAAE,cAAc,EAAE,KAAM,IAAI,CAAC;AAEvD,MAAM,MAAM,eAAe,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools-panel/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unit-control/utils.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unit-control/utils.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA6NjD;;GAEG;AACH,eAAO,MAAM,aAAa,qBAA4B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,SAAS,qBAOrB,CAAC;AAEF,eAAO,MAAM,YAAY,mBAAc,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAC1B,YAAY,CAAC,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,iBAAiB,EAAE,GAChC,CAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAE,CAM5C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CACvB,KAAK,CAAC,EAAE,iBAAiB,EAAE,GACzB,KAAK,IAAI,iBAAiB,EAAE,CAK9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC/C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAC1B,YAAY,GAAE,iBAAiB,EAAkB,GAC/C,CAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAE,CAyB5C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,YAAY,CAAC,EAAE,iBAAiB,EAAE,EAClC,gBAAgB,CAAC,EAAE,MAAM,EACzB,YAAY,CAAC,EAAE,MAAM,GACnB,CAAE,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAE,CAmB5C;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAE,IAAI,EAAE,MAAM,GAAI,MAAM,GAAG,SAAS,CAG5E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,iBAAiB,sBAAe,EAChC,cAAc,EAAE,iBAAiB,EAAE,GACjC,iBAAiB,EAAE,CASrB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc;;;;MAQtB,iBAAiB,EAmBrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAC1B,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,GAAE,iBAAiB,EAAkB,GACxC,iBAAiB,EAAE,CAkBrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.10.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -43,23 +43,23 @@
|
|
|
43
43
|
"@types/gradient-parser": "0.1.3",
|
|
44
44
|
"@types/highlight-words-core": "1.2.1",
|
|
45
45
|
"@use-gesture/react": "^10.2.24",
|
|
46
|
-
"@wordpress/a11y": "^3.
|
|
47
|
-
"@wordpress/compose": "^6.
|
|
48
|
-
"@wordpress/date": "^4.
|
|
49
|
-
"@wordpress/deprecated": "^3.
|
|
50
|
-
"@wordpress/dom": "^3.
|
|
51
|
-
"@wordpress/element": "^5.
|
|
52
|
-
"@wordpress/escape-html": "^2.
|
|
53
|
-
"@wordpress/hooks": "^3.
|
|
54
|
-
"@wordpress/html-entities": "^3.
|
|
55
|
-
"@wordpress/i18n": "^4.
|
|
56
|
-
"@wordpress/icons": "^9.
|
|
57
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
58
|
-
"@wordpress/keycodes": "^3.
|
|
59
|
-
"@wordpress/primitives": "^3.
|
|
60
|
-
"@wordpress/private-apis": "^0.
|
|
61
|
-
"@wordpress/rich-text": "^6.
|
|
62
|
-
"@wordpress/warning": "^2.
|
|
46
|
+
"@wordpress/a11y": "^3.44.0",
|
|
47
|
+
"@wordpress/compose": "^6.21.0",
|
|
48
|
+
"@wordpress/date": "^4.44.0",
|
|
49
|
+
"@wordpress/deprecated": "^3.44.0",
|
|
50
|
+
"@wordpress/dom": "^3.44.0",
|
|
51
|
+
"@wordpress/element": "^5.21.0",
|
|
52
|
+
"@wordpress/escape-html": "^2.44.0",
|
|
53
|
+
"@wordpress/hooks": "^3.44.0",
|
|
54
|
+
"@wordpress/html-entities": "^3.44.0",
|
|
55
|
+
"@wordpress/i18n": "^4.44.0",
|
|
56
|
+
"@wordpress/icons": "^9.35.0",
|
|
57
|
+
"@wordpress/is-shallow-equal": "^4.44.0",
|
|
58
|
+
"@wordpress/keycodes": "^3.44.0",
|
|
59
|
+
"@wordpress/primitives": "^3.42.0",
|
|
60
|
+
"@wordpress/private-apis": "^0.26.0",
|
|
61
|
+
"@wordpress/rich-text": "^6.21.0",
|
|
62
|
+
"@wordpress/warning": "^2.44.0",
|
|
63
63
|
"change-case": "^4.1.2",
|
|
64
64
|
"classnames": "^2.3.1",
|
|
65
65
|
"colord": "^2.7.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "f83bb1a71e8fa416131b81a9f282a72a1dc6c694"
|
|
93
93
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { CompositeItem } from '../composite';
|
|
4
|
+
import { CompositeItem } from '../composite/v2';
|
|
5
5
|
import Tooltip from '../tooltip';
|
|
6
6
|
import { VisuallyHidden } from '../visually-hidden';
|
|
7
7
|
|
|
@@ -17,6 +17,7 @@ import type { AlignmentMatrixControlCellProps } from './types';
|
|
|
17
17
|
import type { WordPressComponentProps } from '../context';
|
|
18
18
|
|
|
19
19
|
export default function Cell( {
|
|
20
|
+
id,
|
|
20
21
|
isActive = false,
|
|
21
22
|
value,
|
|
22
23
|
...props
|
|
@@ -25,7 +26,10 @@ export default function Cell( {
|
|
|
25
26
|
|
|
26
27
|
return (
|
|
27
28
|
<Tooltip text={ tooltipText }>
|
|
28
|
-
<CompositeItem
|
|
29
|
+
<CompositeItem
|
|
30
|
+
id={ id }
|
|
31
|
+
render={ <CellView { ...props } role="gridcell" /> }
|
|
32
|
+
>
|
|
29
33
|
{ /* VoiceOver needs a text content to be rendered within grid cell,
|
|
30
34
|
otherwise it'll announce the content as "blank". So we use a visually
|
|
31
35
|
hidden element instead of aria-label. */ }
|
|
@@ -8,32 +8,17 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, isRTL } from '@wordpress/i18n';
|
|
10
10
|
import { useInstanceId } from '@wordpress/compose';
|
|
11
|
-
import { useState, useEffect } from '@wordpress/element';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
15
14
|
*/
|
|
16
15
|
import Cell from './cell';
|
|
17
|
-
import { Composite,
|
|
16
|
+
import { Composite, CompositeRow, useCompositeStore } from '../composite/v2';
|
|
18
17
|
import { Root, Row } from './styles/alignment-matrix-control-styles';
|
|
19
18
|
import AlignmentMatrixControlIcon from './icon';
|
|
20
|
-
import { GRID, getItemId } from './utils';
|
|
19
|
+
import { GRID, getItemId, getItemValue } from './utils';
|
|
21
20
|
import type { WordPressComponentProps } from '../context';
|
|
22
|
-
import type {
|
|
23
|
-
AlignmentMatrixControlProps,
|
|
24
|
-
AlignmentMatrixControlValue,
|
|
25
|
-
} from './types';
|
|
26
|
-
|
|
27
|
-
const noop = () => {};
|
|
28
|
-
|
|
29
|
-
function useBaseId( id?: string ) {
|
|
30
|
-
const instanceId = useInstanceId(
|
|
31
|
-
AlignmentMatrixControl,
|
|
32
|
-
'alignment-matrix-control'
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
return id || instanceId;
|
|
36
|
-
}
|
|
21
|
+
import type { AlignmentMatrixControlProps } from './types';
|
|
37
22
|
|
|
38
23
|
/**
|
|
39
24
|
*
|
|
@@ -61,31 +46,27 @@ export function AlignmentMatrixControl( {
|
|
|
61
46
|
label = __( 'Alignment Matrix Control' ),
|
|
62
47
|
defaultValue = 'center center',
|
|
63
48
|
value,
|
|
64
|
-
onChange
|
|
49
|
+
onChange,
|
|
65
50
|
width = 92,
|
|
66
51
|
...props
|
|
67
52
|
}: WordPressComponentProps< AlignmentMatrixControlProps, 'div', false > ) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
const baseId = useInstanceId(
|
|
54
|
+
AlignmentMatrixControl,
|
|
55
|
+
'alignment-matrix-control',
|
|
56
|
+
id
|
|
57
|
+
);
|
|
71
58
|
|
|
72
|
-
const
|
|
73
|
-
baseId,
|
|
74
|
-
|
|
59
|
+
const compositeStore = useCompositeStore( {
|
|
60
|
+
defaultActiveId: getItemId( baseId, defaultValue ),
|
|
61
|
+
activeId: getItemId( baseId, value ),
|
|
62
|
+
setActiveId: ( nextActiveId ) => {
|
|
63
|
+
const nextValue = getItemValue( baseId, nextActiveId );
|
|
64
|
+
if ( nextValue ) onChange?.( nextValue );
|
|
65
|
+
},
|
|
75
66
|
rtl: isRTL(),
|
|
76
67
|
} );
|
|
77
68
|
|
|
78
|
-
const
|
|
79
|
-
onChange( nextValue );
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const { setCurrentId } = composite;
|
|
83
|
-
|
|
84
|
-
useEffect( () => {
|
|
85
|
-
if ( typeof value !== 'undefined' ) {
|
|
86
|
-
setCurrentId( getItemId( baseId, value ) );
|
|
87
|
-
}
|
|
88
|
-
}, [ value, setCurrentId, baseId ] );
|
|
69
|
+
const activeId = compositeStore.useState( 'activeId' );
|
|
89
70
|
|
|
90
71
|
const classes = classnames(
|
|
91
72
|
'component-alignment-matrix-control',
|
|
@@ -94,38 +75,34 @@ export function AlignmentMatrixControl( {
|
|
|
94
75
|
|
|
95
76
|
return (
|
|
96
77
|
<Composite
|
|
97
|
-
{
|
|
98
|
-
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
78
|
+
store={ compositeStore }
|
|
79
|
+
render={
|
|
80
|
+
<Root
|
|
81
|
+
{ ...props }
|
|
82
|
+
aria-label={ label }
|
|
83
|
+
className={ classes }
|
|
84
|
+
id={ baseId }
|
|
85
|
+
role="grid"
|
|
86
|
+
size={ width }
|
|
87
|
+
/>
|
|
88
|
+
}
|
|
104
89
|
>
|
|
105
90
|
{ GRID.map( ( cells, index ) => (
|
|
106
|
-
<
|
|
107
|
-
{ ...composite }
|
|
108
|
-
as={ Row }
|
|
109
|
-
role="row"
|
|
110
|
-
key={ index }
|
|
111
|
-
>
|
|
91
|
+
<CompositeRow render={ <Row role="row" /> } key={ index }>
|
|
112
92
|
{ cells.map( ( cell ) => {
|
|
113
93
|
const cellId = getItemId( baseId, cell );
|
|
114
|
-
const isActive =
|
|
94
|
+
const isActive = cellId === activeId;
|
|
115
95
|
|
|
116
96
|
return (
|
|
117
97
|
<Cell
|
|
118
|
-
{ ...composite }
|
|
119
98
|
id={ cellId }
|
|
120
99
|
isActive={ isActive }
|
|
121
100
|
key={ cell }
|
|
122
101
|
value={ cell }
|
|
123
|
-
onFocus={ () => handleOnChange( cell ) }
|
|
124
|
-
tabIndex={ isActive ? 0 : -1 }
|
|
125
102
|
/>
|
|
126
103
|
);
|
|
127
104
|
} ) }
|
|
128
|
-
</
|
|
105
|
+
</CompositeRow>
|
|
129
106
|
) ) }
|
|
130
107
|
</Composite>
|
|
131
108
|
);
|
|
@@ -6,7 +6,7 @@ import type { Meta, StoryFn } from '@storybook/react';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
10
|
import { Icon } from '@wordpress/icons';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -24,10 +24,11 @@ const meta: Meta< typeof AlignmentMatrixControl > = {
|
|
|
24
24
|
'AlignmentMatrixControl.Icon': AlignmentMatrixControl.Icon,
|
|
25
25
|
},
|
|
26
26
|
argTypes: {
|
|
27
|
-
onChange: {
|
|
27
|
+
onChange: { control: { type: null } },
|
|
28
28
|
value: { control: { type: null } },
|
|
29
29
|
},
|
|
30
30
|
parameters: {
|
|
31
|
+
actions: { argTypesRegex: '^on.*' },
|
|
31
32
|
controls: { expanded: true },
|
|
32
33
|
docs: { canvas: { sourceState: 'shown' } },
|
|
33
34
|
},
|
|
@@ -42,11 +43,6 @@ const Template: StoryFn< typeof AlignmentMatrixControl > = ( {
|
|
|
42
43
|
const [ value, setValue ] =
|
|
43
44
|
useState< AlignmentMatrixControlProps[ 'value' ] >();
|
|
44
45
|
|
|
45
|
-
// Convenience handler for Canvas view so changes are reflected
|
|
46
|
-
useEffect( () => {
|
|
47
|
-
setValue( defaultValue );
|
|
48
|
-
}, [ defaultValue ] );
|
|
49
|
-
|
|
50
46
|
return (
|
|
51
47
|
<AlignmentMatrixControl
|
|
52
48
|
{ ...props }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen, within } from '@testing-library/react';
|
|
4
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -17,34 +17,133 @@ const getCell = ( name: string ) => {
|
|
|
17
17
|
return within( getControl() ).getByRole( 'gridcell', { name } );
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const renderAndInitCompositeStore = async (
|
|
21
|
+
jsx: JSX.Element,
|
|
22
|
+
focusedCell = 'center center'
|
|
23
|
+
) => {
|
|
24
|
+
const view = render( jsx );
|
|
25
|
+
await waitFor( () => {
|
|
26
|
+
expect( getCell( focusedCell ) ).toHaveAttribute( 'tabindex', '0' );
|
|
27
|
+
} );
|
|
28
|
+
return view;
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
describe( 'AlignmentMatrixControl', () => {
|
|
21
32
|
describe( 'Basic rendering', () => {
|
|
22
|
-
it( 'should render', () => {
|
|
23
|
-
|
|
33
|
+
it( 'should render', async () => {
|
|
34
|
+
await renderAndInitCompositeStore( <AlignmentMatrixControl /> );
|
|
24
35
|
|
|
25
36
|
expect( getControl() ).toBeInTheDocument();
|
|
26
37
|
} );
|
|
38
|
+
|
|
39
|
+
it( 'should be centered by default', async () => {
|
|
40
|
+
const user = userEvent.setup();
|
|
41
|
+
|
|
42
|
+
await renderAndInitCompositeStore( <AlignmentMatrixControl /> );
|
|
43
|
+
|
|
44
|
+
await user.tab();
|
|
45
|
+
|
|
46
|
+
expect( getCell( 'center center' ) ).toHaveFocus();
|
|
47
|
+
} );
|
|
27
48
|
} );
|
|
28
49
|
|
|
29
|
-
describe( '
|
|
30
|
-
|
|
31
|
-
|
|
50
|
+
describe( 'Should change value', () => {
|
|
51
|
+
describe( 'with Mouse', () => {
|
|
52
|
+
describe( 'on cell click', () => {
|
|
53
|
+
it.each( [
|
|
54
|
+
'top left',
|
|
55
|
+
'top center',
|
|
56
|
+
'top right',
|
|
57
|
+
'center left',
|
|
58
|
+
'center right',
|
|
59
|
+
'bottom left',
|
|
60
|
+
'bottom center',
|
|
61
|
+
'bottom right',
|
|
62
|
+
] )( '%s', async ( alignment ) => {
|
|
63
|
+
const user = userEvent.setup();
|
|
64
|
+
const spy = jest.fn();
|
|
65
|
+
|
|
66
|
+
await renderAndInitCompositeStore(
|
|
67
|
+
<AlignmentMatrixControl
|
|
68
|
+
value="center"
|
|
69
|
+
onChange={ spy }
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const cell = getCell( alignment );
|
|
74
|
+
|
|
75
|
+
await user.click( cell );
|
|
32
76
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const spy = jest.fn();
|
|
77
|
+
expect( cell ).toHaveFocus();
|
|
78
|
+
expect( spy ).toHaveBeenCalledWith( alignment );
|
|
79
|
+
} );
|
|
37
80
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
81
|
+
it( 'unless already focused', async () => {
|
|
82
|
+
const user = userEvent.setup();
|
|
83
|
+
const spy = jest.fn();
|
|
41
84
|
|
|
42
|
-
|
|
85
|
+
await renderAndInitCompositeStore(
|
|
86
|
+
<AlignmentMatrixControl
|
|
87
|
+
value="center"
|
|
88
|
+
onChange={ spy }
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
43
91
|
|
|
44
|
-
|
|
92
|
+
const cell = getCell( 'center center' );
|
|
45
93
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
94
|
+
await user.click( cell );
|
|
95
|
+
|
|
96
|
+
expect( cell ).toHaveFocus();
|
|
97
|
+
expect( spy ).not.toHaveBeenCalled();
|
|
98
|
+
} );
|
|
99
|
+
} );
|
|
100
|
+
} );
|
|
101
|
+
|
|
102
|
+
describe( 'with Keyboard', () => {
|
|
103
|
+
describe( 'on arrow press', () => {
|
|
104
|
+
it.each( [
|
|
105
|
+
[ 'ArrowUp', 'top center' ],
|
|
106
|
+
[ 'ArrowLeft', 'center left' ],
|
|
107
|
+
[ 'ArrowDown', 'bottom center' ],
|
|
108
|
+
[ 'ArrowRight', 'center right' ],
|
|
109
|
+
] )( '%s', async ( keyRef, cellRef ) => {
|
|
110
|
+
const user = userEvent.setup();
|
|
111
|
+
const spy = jest.fn();
|
|
112
|
+
|
|
113
|
+
await renderAndInitCompositeStore(
|
|
114
|
+
<AlignmentMatrixControl onChange={ spy } />
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
await user.tab();
|
|
118
|
+
await user.keyboard( `[${ keyRef }]` );
|
|
119
|
+
|
|
120
|
+
expect( getCell( cellRef ) ).toHaveFocus();
|
|
121
|
+
expect( spy ).toHaveBeenCalledWith( cellRef );
|
|
122
|
+
} );
|
|
123
|
+
} );
|
|
124
|
+
|
|
125
|
+
describe( 'but not at at edge', () => {
|
|
126
|
+
it.each( [
|
|
127
|
+
[ 'ArrowUp', 'top left' ],
|
|
128
|
+
[ 'ArrowLeft', 'top left' ],
|
|
129
|
+
[ 'ArrowDown', 'bottom right' ],
|
|
130
|
+
[ 'ArrowRight', 'bottom right' ],
|
|
131
|
+
] )( '%s', async ( keyRef, cellRef ) => {
|
|
132
|
+
const user = userEvent.setup();
|
|
133
|
+
const spy = jest.fn();
|
|
134
|
+
|
|
135
|
+
await renderAndInitCompositeStore(
|
|
136
|
+
<AlignmentMatrixControl onChange={ spy } />
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const cell = getCell( cellRef );
|
|
140
|
+
await user.click( cell );
|
|
141
|
+
await user.keyboard( `[${ keyRef }]` );
|
|
142
|
+
|
|
143
|
+
expect( cell ).toHaveFocus();
|
|
144
|
+
expect( spy ).toHaveBeenCalledWith( cellRef );
|
|
145
|
+
} );
|
|
146
|
+
} );
|
|
147
|
+
} );
|
|
49
148
|
} );
|
|
50
149
|
} );
|