@wordpress/components 32.2.1-next.v.202602191100.0 → 32.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/build/alignment-matrix-control/cell.cjs +2 -2
- package/build/alignment-matrix-control/cell.cjs.map +1 -1
- package/build/alignment-matrix-control/index.cjs +2 -2
- package/build/alignment-matrix-control/index.cjs.map +1 -1
- package/build/angle-picker-control/angle-circle.cjs +2 -2
- package/build/angle-picker-control/angle-circle.cjs.map +1 -1
- package/build/autocomplete/index.cjs +15 -7
- package/build/autocomplete/index.cjs.map +2 -2
- package/build/date-time/time/index.cjs +1 -1
- package/build/date-time/time/index.cjs.map +2 -2
- package/build/date-time/utils.cjs +9 -0
- package/build/date-time/utils.cjs.map +2 -2
- package/build/private-apis.cjs +0 -4
- package/build/private-apis.cjs.map +3 -3
- package/build/sandbox/index.cjs +125 -1
- package/build/sandbox/index.cjs.map +2 -2
- package/build/select-control/styles/select-control-styles.cjs +8 -8
- package/build/select-control/styles/select-control-styles.cjs.map +2 -2
- package/build/snackbar/list.cjs +4 -1
- package/build/snackbar/list.cjs.map +2 -2
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +2 -2
- package/build/validated-form-controls/control-with-error.cjs +26 -3
- package/build/validated-form-controls/control-with-error.cjs.map +2 -2
- package/build/validated-form-controls/validity-indicator.cjs +2 -0
- package/build/validated-form-controls/validity-indicator.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +2 -2
- package/build-module/alignment-matrix-control/cell.mjs.map +1 -1
- package/build-module/alignment-matrix-control/index.mjs +2 -2
- package/build-module/alignment-matrix-control/index.mjs.map +1 -1
- package/build-module/angle-picker-control/angle-circle.mjs +2 -2
- package/build-module/angle-picker-control/angle-circle.mjs.map +1 -1
- package/build-module/autocomplete/index.mjs +13 -6
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/date-time/time/index.mjs +2 -2
- package/build-module/date-time/time/index.mjs.map +2 -2
- package/build-module/date-time/utils.mjs +8 -0
- package/build-module/date-time/utils.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -4
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/sandbox/index.mjs +126 -2
- package/build-module/sandbox/index.mjs.map +2 -2
- package/build-module/select-control/styles/select-control-styles.mjs +8 -8
- package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
- package/build-module/snackbar/list.mjs +4 -1
- package/build-module/snackbar/list.mjs.map +2 -2
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +2 -2
- package/build-module/validated-form-controls/control-with-error.mjs +27 -4
- package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
- package/build-module/validated-form-controls/validity-indicator.mjs +2 -0
- package/build-module/validated-form-controls/validity-indicator.mjs.map +2 -2
- package/build-style/style-rtl.css +7 -183
- package/build-style/style.css +7 -183
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +19 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +23 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +25 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts +20 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/index.d.ts +8 -0
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
- package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/border-control/border-control-style-picker/hook.d.ts +267 -0
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -0
- package/build-types/box-control/all-input-control.d.ts +4 -0
- package/build-types/box-control/all-input-control.d.ts.map +1 -0
- package/build-types/box-control/axial-input-controls.d.ts +4 -0
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
- package/build-types/box-control/input-controls.d.ts +4 -0
- package/build-types/box-control/input-controls.d.ts.map +1 -0
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
- package/build-types/box-control/unit-control.d.ts +4 -0
- package/build-types/box-control/unit-control.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/test/index.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/index.d.ts.map +1 -0
- package/build-types/custom-select-control/styles.d.ts +11 -0
- package/build-types/custom-select-control/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/index.d.ts +23 -0
- package/build-types/date-time/date-picker/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/styles.d.ts +45 -0
- package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/index.d.ts +2 -0
- package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time-picker/index.d.ts +27 -0
- package/build-types/date-time/time-picker/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/styles.d.ts +93 -0
- package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/time-picker/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts +4 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/timezone.d.ts +7 -0
- package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
- package/build-types/date-time/utils.d.ts +9 -0
- package/build-types/date-time/utils.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +28 -0
- package/build-types/dimension-control/index.d.ts.map +1 -0
- package/build-types/dimension-control/sizes.d.ts +26 -0
- package/build-types/dimension-control/sizes.d.ts.map +1 -0
- package/build-types/dimension-control/stories/index.story.d.ts +4 -0
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -0
- package/build-types/dimension-control/types.d.ts +47 -0
- package/build-types/dimension-control/types.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/index.d.ts +17 -0
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +11 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/styles.d.ts +42 -0
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts +2 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/types.d.ts +252 -0
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -0
- package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
- package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
- package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
- package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/component.d.ts +38 -0
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/index.d.ts +2 -0
- package/build-types/navigator/navigator-provider/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-screen/index.d.ts +2 -0
- package/build-types/navigator/navigator-screen/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +1 -0
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-group/radio/index.d.ts +7 -0
- package/build-types/radio-group/radio/index.d.ts.map +1 -0
- package/build-types/radio-group/radio-context/index.d.ts +6 -0
- package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/types.d.ts +11 -0
- package/build-types/sandbox/types.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts +5 -0
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +12 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +4 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -0
- package/build-types/slot-fill/use-slot.d.ts +9 -0
- package/build-types/slot-fill/use-slot.d.ts.map +1 -0
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/style-provider/test/index.d.ts +2 -0
- package/build-types/style-provider/test/index.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/ui/context/constants.d.ts +8 -0
- package/build-types/ui/context/constants.d.ts.map +1 -0
- package/build-types/ui/context/context-connect.d.ts +40 -0
- package/build-types/ui/context/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/context-system-provider.d.ts +7 -0
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts +2 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts.map +1 -0
- package/build-types/ui/context/index.d.ts +5 -0
- package/build-types/ui/context/index.d.ts.map +1 -0
- package/build-types/ui/context/test/context-connect.d.ts +2 -0
- package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
- package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/context/use-context-system.d.ts +20 -0
- package/build-types/ui/context/use-context-system.d.ts.map +1 -0
- package/build-types/ui/context/utils.d.ts +26 -0
- package/build-types/ui/context/utils.d.ts.map +1 -0
- package/build-types/ui/context/wordpress-component.d.ts +32 -0
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/shortcut/component.d.ts +12 -0
- package/build-types/ui/shortcut/component.d.ts.map +1 -0
- package/build-types/ui/shortcut/index.d.ts +3 -0
- package/build-types/ui/shortcut/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/component.d.ts +29 -0
- package/build-types/ui/tooltip/component.d.ts.map +1 -0
- package/build-types/ui/tooltip/content.d.ts +9 -0
- package/build-types/ui/tooltip/content.d.ts.map +1 -0
- package/build-types/ui/tooltip/context.d.ts +10 -0
- package/build-types/ui/tooltip/context.d.ts.map +1 -0
- package/build-types/ui/tooltip/index.d.ts +3 -0
- package/build-types/ui/tooltip/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/styles.d.ts +12 -0
- package/build-types/ui/tooltip/styles.d.ts.map +1 -0
- package/build-types/ui/tooltip/types.d.ts +62 -0
- package/build-types/ui/tooltip/types.d.ts.map +1 -0
- package/build-types/ui/utils/colors.d.ts +17 -0
- package/build-types/ui/utils/colors.d.ts.map +1 -0
- package/build-types/ui/utils/font-size.d.ts +18 -0
- package/build-types/ui/utils/font-size.d.ts.map +1 -0
- package/build-types/ui/utils/get-valid-children.d.ts +13 -0
- package/build-types/ui/utils/get-valid-children.d.ts.map +1 -0
- package/build-types/ui/utils/index.d.ts +2 -0
- package/build-types/ui/utils/index.d.ts.map +1 -0
- package/build-types/ui/utils/space.d.ts +23 -0
- package/build-types/ui/utils/space.d.ts.map +1 -0
- package/build-types/ui/utils/types.d.ts +14 -0
- package/build-types/ui/utils/types.d.ts.map +1 -0
- package/build-types/ui/utils/use-responsive-value.d.ts +5 -0
- package/build-types/ui/utils/use-responsive-value.d.ts.map +1 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts +15 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +1 -0
- package/build-types/utils/input/base.d.ts +3 -0
- package/build-types/utils/input/base.d.ts.map +1 -0
- package/build-types/utils/input/index.d.ts +2 -0
- package/build-types/utils/input/index.d.ts.map +1 -0
- package/build-types/utils/input/input-control.d.ts +2 -0
- package/build-types/utils/input/input-control.d.ts.map +1 -0
- package/build-types/utils/reduce-motion.d.ts +8 -0
- package/build-types/utils/reduce-motion.d.ts.map +1 -0
- package/build-types/utils/z-index.d.ts +3 -0
- package/build-types/utils/z-index.d.ts.map +1 -0
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/build-types/validated-form-controls/test/checkbox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/checkbox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts +2 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/input-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/input-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/number-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/number-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/range-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/range-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/text-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/text-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/validity-indicator.d.ts +2 -1
- package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
- package/build-types/view/types.d.ts +8 -0
- package/build-types/view/types.d.ts.map +1 -0
- package/package.json +21 -21
- package/src/autocomplete/index.tsx +30 -6
- package/src/autocomplete/test/index.tsx +110 -1
- package/src/button/style.scss +8 -5
- package/src/date-time/test/utils.test.ts +8 -11
- package/src/date-time/time/index.tsx +2 -12
- package/src/date-time/time/test/index.tsx +69 -0
- package/src/date-time/utils.ts +18 -0
- package/src/form-token-field/style.scss +1 -0
- package/src/private-apis.ts +0 -4
- package/src/sandbox/index.tsx +189 -9
- package/src/sandbox/test/index.tsx +65 -24
- package/src/sandbox/types.ts +11 -0
- package/src/select-control/styles/select-control-styles.ts +1 -0
- package/src/snackbar/list.tsx +6 -1
- package/src/style.scss +0 -2
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -16
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +4 -6
- package/src/validated-form-controls/control-with-error.tsx +44 -4
- package/src/validated-form-controls/test/checkbox-control.tsx +49 -0
- package/src/validated-form-controls/test/combobox-control.tsx +61 -0
- package/src/validated-form-controls/test/control-with-error.tsx +182 -1
- package/src/validated-form-controls/test/custom-select-control.tsx +60 -0
- package/src/validated-form-controls/test/form-token-field.tsx +52 -0
- package/src/validated-form-controls/test/input-control.tsx +42 -0
- package/src/validated-form-controls/test/number-control.tsx +44 -0
- package/src/validated-form-controls/test/radio-control.tsx +61 -0
- package/src/validated-form-controls/test/range-control.tsx +73 -0
- package/src/validated-form-controls/test/select-control.tsx +57 -0
- package/src/validated-form-controls/test/text-control.tsx +49 -0
- package/src/validated-form-controls/test/textarea-control.tsx +51 -0
- package/src/validated-form-controls/test/toggle-control.tsx +49 -0
- package/src/validated-form-controls/test/toggle-group-control.tsx +28 -0
- package/src/validated-form-controls/validity-indicator.tsx +3 -0
- package/build/avatar/component.cjs +0 -99
- package/build/avatar/component.cjs.map +0 -7
- package/build/avatar/index.cjs +0 -37
- package/build/avatar/index.cjs.map +0 -7
- package/build/avatar/types.cjs +0 -19
- package/build/avatar/types.cjs.map +0 -7
- package/build/avatar-group/component.cjs +0 -60
- package/build/avatar-group/component.cjs.map +0 -7
- package/build/avatar-group/index.cjs +0 -37
- package/build/avatar-group/index.cjs.map +0 -7
- package/build/avatar-group/types.cjs +0 -19
- package/build/avatar-group/types.cjs.map +0 -7
- package/build-module/avatar/component.mjs +0 -68
- package/build-module/avatar/component.mjs.map +0 -7
- package/build-module/avatar/index.mjs +0 -6
- package/build-module/avatar/index.mjs.map +0 -7
- package/build-module/avatar/types.mjs +0 -1
- package/build-module/avatar/types.mjs.map +0 -7
- package/build-module/avatar-group/component.mjs +0 -29
- package/build-module/avatar-group/component.mjs.map +0 -7
- package/build-module/avatar-group/index.mjs +0 -6
- package/build-module/avatar-group/index.mjs.map +0 -7
- package/build-module/avatar-group/types.mjs +0 -1
- package/build-module/avatar-group/types.mjs.map +0 -7
- package/build-types/avatar/component.d.ts +0 -5
- package/build-types/avatar/component.d.ts.map +0 -1
- package/build-types/avatar/index.d.ts +0 -3
- package/build-types/avatar/index.d.ts.map +0 -1
- package/build-types/avatar/types.d.ts +0 -59
- package/build-types/avatar/types.d.ts.map +0 -1
- package/build-types/avatar-group/component.d.ts +0 -8
- package/build-types/avatar-group/component.d.ts.map +0 -1
- package/build-types/avatar-group/index.d.ts +0 -3
- package/build-types/avatar-group/index.d.ts.map +0 -1
- package/build-types/avatar-group/types.d.ts +0 -14
- package/build-types/avatar-group/types.d.ts.map +0 -1
- package/src/avatar/component.tsx +0 -82
- package/src/avatar/index.ts +0 -2
- package/src/avatar/styles.scss +0 -152
- package/src/avatar/types.ts +0 -59
- package/src/avatar-group/component.tsx +0 -46
- package/src/avatar-group/index.ts +0 -2
- package/src/avatar-group/styles.scss +0 -32
- package/src/avatar-group/types.ts +0 -13
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedTextareaControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedTextareaControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedTextareaControl
|
|
9
|
+
label="Bio"
|
|
10
|
+
help="A short bio."
|
|
11
|
+
onChange={ () => {} }
|
|
12
|
+
value=""
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(
|
|
17
|
+
screen.getByRole( 'textbox', { name: 'Bio' } )
|
|
18
|
+
).toHaveAccessibleDescription( 'A short bio.' );
|
|
19
|
+
} );
|
|
20
|
+
|
|
21
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
22
|
+
const user = userEvent.setup();
|
|
23
|
+
render(
|
|
24
|
+
<form>
|
|
25
|
+
<ValidatedTextareaControl
|
|
26
|
+
label="Bio"
|
|
27
|
+
help="A short bio."
|
|
28
|
+
onChange={ () => {} }
|
|
29
|
+
value=""
|
|
30
|
+
required
|
|
31
|
+
/>
|
|
32
|
+
<button type="submit">Submit</button>
|
|
33
|
+
</form>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const textarea = screen.getByRole( 'textbox', {
|
|
37
|
+
name: /^Bio/,
|
|
38
|
+
} );
|
|
39
|
+
|
|
40
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
41
|
+
|
|
42
|
+
await waitFor( () => {
|
|
43
|
+
expect( textarea ).toHaveAccessibleDescription(
|
|
44
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
45
|
+
);
|
|
46
|
+
} );
|
|
47
|
+
expect( textarea ).toHaveAccessibleDescription(
|
|
48
|
+
expect.stringContaining( 'A short bio.' )
|
|
49
|
+
);
|
|
50
|
+
} );
|
|
51
|
+
} );
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedToggleControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedToggleControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedToggleControl
|
|
9
|
+
label="Dark mode"
|
|
10
|
+
help="Enable dark mode."
|
|
11
|
+
onChange={ () => {} }
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(
|
|
16
|
+
screen.getByRole( 'checkbox', { name: 'Dark mode' } )
|
|
17
|
+
).toHaveAccessibleDescription( 'Enable dark mode.' );
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
21
|
+
const user = userEvent.setup();
|
|
22
|
+
render(
|
|
23
|
+
<form>
|
|
24
|
+
<ValidatedToggleControl
|
|
25
|
+
label="Dark mode"
|
|
26
|
+
help="Enable dark mode."
|
|
27
|
+
onChange={ () => {} }
|
|
28
|
+
required
|
|
29
|
+
/>
|
|
30
|
+
<button type="submit">Submit</button>
|
|
31
|
+
</form>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const toggle = screen.getByRole( 'checkbox', {
|
|
35
|
+
name: /^Dark mode/,
|
|
36
|
+
} );
|
|
37
|
+
|
|
38
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
39
|
+
|
|
40
|
+
await waitFor( () => {
|
|
41
|
+
expect( toggle ).toHaveAccessibleDescription(
|
|
42
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
43
|
+
);
|
|
44
|
+
} );
|
|
45
|
+
expect( toggle ).toHaveAccessibleDescription(
|
|
46
|
+
expect.stringContaining( 'Enable dark mode.' )
|
|
47
|
+
);
|
|
48
|
+
} );
|
|
49
|
+
} );
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { ValidatedToggleGroupControl } from '../components';
|
|
3
|
+
import { ToggleGroupControlOption } from '../../toggle-group-control';
|
|
4
|
+
|
|
5
|
+
// The `help` prop is rendered visually by BaseControl but is not
|
|
6
|
+
// programmatically associated with the toggle group via aria-describedby.
|
|
7
|
+
// Additionally, the validity target is a hidden delegate radio input, not the
|
|
8
|
+
// toggle group itself. These are pre-existing bugs, not caused by ControlWithError.
|
|
9
|
+
describe( 'ValidatedToggleGroupControl', () => {
|
|
10
|
+
// eslint-disable-next-line jest/no-disabled-tests
|
|
11
|
+
it.skip( 'should preserve the help description', () => {
|
|
12
|
+
render(
|
|
13
|
+
<ValidatedToggleGroupControl
|
|
14
|
+
label="Alignment"
|
|
15
|
+
help="Choose text alignment."
|
|
16
|
+
value="left"
|
|
17
|
+
onChange={ () => {} }
|
|
18
|
+
>
|
|
19
|
+
<ToggleGroupControlOption label="Left" value="left" />
|
|
20
|
+
<ToggleGroupControlOption label="Center" value="center" />
|
|
21
|
+
</ValidatedToggleGroupControl>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(
|
|
25
|
+
screen.getByRole( 'radiogroup', { name: 'Alignment' } )
|
|
26
|
+
).toHaveAccessibleDescription( 'Choose text alignment.' );
|
|
27
|
+
} );
|
|
28
|
+
} );
|
|
@@ -15,9 +15,11 @@ import Icon from '../icon';
|
|
|
15
15
|
import Spinner from '../spinner';
|
|
16
16
|
|
|
17
17
|
export function ValidityIndicator( {
|
|
18
|
+
id,
|
|
18
19
|
type,
|
|
19
20
|
message,
|
|
20
21
|
}: {
|
|
22
|
+
id?: string;
|
|
21
23
|
type: 'validating' | 'valid' | 'invalid';
|
|
22
24
|
message?: string;
|
|
23
25
|
} ) {
|
|
@@ -27,6 +29,7 @@ export function ValidityIndicator( {
|
|
|
27
29
|
};
|
|
28
30
|
return (
|
|
29
31
|
<p
|
|
32
|
+
id={ id }
|
|
30
33
|
className={ clsx(
|
|
31
34
|
'components-validated-control__indicator',
|
|
32
35
|
`is-${ type }`
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar/component.tsx
|
|
31
|
-
var component_exports = {};
|
|
32
|
-
__export(component_exports, {
|
|
33
|
-
default: () => component_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(component_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var import_icon = __toESM(require("../icon/index.cjs"));
|
|
38
|
-
var import_tooltip = __toESM(require("../tooltip/index.cjs"));
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
function Avatar({
|
|
41
|
-
className,
|
|
42
|
-
src,
|
|
43
|
-
name,
|
|
44
|
-
label,
|
|
45
|
-
badge = false,
|
|
46
|
-
size = "default",
|
|
47
|
-
borderColor,
|
|
48
|
-
status,
|
|
49
|
-
statusIndicator,
|
|
50
|
-
style,
|
|
51
|
-
...props
|
|
52
|
-
}) {
|
|
53
|
-
const showBadge = badge && !!name;
|
|
54
|
-
const initials = name ? name.split(/\s+/).slice(0, 2).map((word) => word[0]).join("").toUpperCase() : void 0;
|
|
55
|
-
const customProperties = {
|
|
56
|
-
...style,
|
|
57
|
-
...src ? {
|
|
58
|
-
"--components-avatar-url": `url(${src})`
|
|
59
|
-
} : {},
|
|
60
|
-
...borderColor ? {
|
|
61
|
-
"--components-avatar-outline-color": borderColor
|
|
62
|
-
} : {}
|
|
63
|
-
};
|
|
64
|
-
const avatar = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
65
|
-
className: (0, import_clsx.default)("components-avatar", className, {
|
|
66
|
-
"has-avatar-border-color": !!borderColor,
|
|
67
|
-
"has-src": !!src,
|
|
68
|
-
"has-badge": showBadge,
|
|
69
|
-
"is-small": size === "small",
|
|
70
|
-
"has-status": !!status,
|
|
71
|
-
[`is-${status}`]: !!status
|
|
72
|
-
}),
|
|
73
|
-
style: customProperties,
|
|
74
|
-
role: "img",
|
|
75
|
-
"aria-label": name,
|
|
76
|
-
...props,
|
|
77
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
78
|
-
className: "components-avatar__image",
|
|
79
|
-
children: [!src && initials, !!status && !!statusIndicator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
80
|
-
className: "components-avatar__status-indicator",
|
|
81
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.default, {
|
|
82
|
-
icon: statusIndicator
|
|
83
|
-
})
|
|
84
|
-
})]
|
|
85
|
-
}), showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
86
|
-
className: "components-avatar__name",
|
|
87
|
-
children: label || name
|
|
88
|
-
})]
|
|
89
|
-
});
|
|
90
|
-
if (name && (!showBadge || label)) {
|
|
91
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tooltip.default, {
|
|
92
|
-
text: name,
|
|
93
|
-
children: avatar
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return avatar;
|
|
97
|
-
}
|
|
98
|
-
var component_default = Avatar;
|
|
99
|
-
//# sourceMappingURL=component.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/avatar/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport Tooltip from '../tooltip';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction Avatar({\n className,\n src,\n name,\n label,\n badge = false,\n size = 'default',\n borderColor,\n status,\n statusIndicator,\n style,\n ...props\n}) {\n const showBadge = badge && !!name;\n const initials = name ? name.split(/\\s+/).slice(0, 2).map(word => word[0]).join('').toUpperCase() : undefined;\n const customProperties = {\n ...style,\n ...(src ? {\n '--components-avatar-url': `url(${src})`\n } : {}),\n ...(borderColor ? {\n '--components-avatar-outline-color': borderColor\n } : {})\n };\n const avatar = /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-avatar', className, {\n 'has-avatar-border-color': !!borderColor,\n 'has-src': !!src,\n 'has-badge': showBadge,\n 'is-small': size === 'small',\n 'has-status': !!status,\n [`is-${status}`]: !!status\n }),\n style: customProperties,\n role: \"img\",\n \"aria-label\": name,\n ...props,\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: \"components-avatar__image\",\n children: [!src && initials, !!status && !!statusIndicator && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar__status-indicator\",\n children: /*#__PURE__*/_jsx(Icon, {\n icon: statusIndicator\n })\n })]\n }), showBadge && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar__name\",\n children: label || name\n })]\n });\n if (name && (!showBadge || label)) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: name,\n children: avatar\n });\n }\n return avatar;\n}\nexport default Avatar;"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAiB;AACjB,qBAAoB;AACpB,yBAA2C;AAC3C,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,YAAY,SAAS,CAAC,CAAC;AAC7B,QAAM,WAAW,OAAO,KAAK,MAAM,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,IAAI,UAAQ,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,IAAI;AACpG,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,IACH,GAAI,MAAM;AAAA,MACR,2BAA2B,OAAO,GAAG;AAAA,IACvC,IAAI,CAAC;AAAA,IACL,GAAI,cAAc;AAAA,MAChB,qCAAqC;AAAA,IACvC,IAAI,CAAC;AAAA,EACP;AACA,QAAM,SAAsB,uCAAAA,MAAM,OAAO;AAAA,IACvC,eAAW,YAAAC,SAAK,qBAAqB,WAAW;AAAA,MAC9C,2BAA2B,CAAC,CAAC;AAAA,MAC7B,WAAW,CAAC,CAAC;AAAA,MACb,aAAa;AAAA,MACb,YAAY,SAAS;AAAA,MACrB,cAAc,CAAC,CAAC;AAAA,MAChB,CAAC,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC;AAAA,IACtB,CAAC;AAAA,IACD,OAAO;AAAA,IACP,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,IACH,UAAU,CAAc,uCAAAD,MAAM,QAAQ;AAAA,MACpC,WAAW;AAAA,MACX,UAAU,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,mBAAgC,uCAAAE,KAAK,QAAQ;AAAA,QACtF,WAAW;AAAA,QACX,UAAuB,uCAAAA,KAAK,YAAAC,SAAM;AAAA,UAChC,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,GAAG,aAA0B,uCAAAD,KAAK,QAAQ;AAAA,MACzC,WAAW;AAAA,MACX,UAAU,SAAS;AAAA,IACrB,CAAC,CAAC;AAAA,EACJ,CAAC;AACD,MAAI,SAAS,CAAC,aAAa,QAAQ;AACjC,WAAoB,uCAAAA,KAAK,eAAAE,SAAS;AAAA,MAChC,MAAM;AAAA,MACN,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,SAAO;AACT;AACA,IAAO,oBAAQ;",
|
|
6
|
-
"names": ["_jsxs", "clsx", "_jsx", "Icon", "Tooltip"]
|
|
7
|
-
}
|
package/build/avatar/index.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar/index.ts
|
|
31
|
-
var avatar_exports = {};
|
|
32
|
-
__export(avatar_exports, {
|
|
33
|
-
default: () => import_component.default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(avatar_exports);
|
|
36
|
-
var import_component = __toESM(require("./component.cjs"));
|
|
37
|
-
//# sourceMappingURL=index.cjs.map
|
package/build/avatar/types.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// packages/components/src/avatar/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
//# sourceMappingURL=types.cjs.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar-group/component.tsx
|
|
31
|
-
var component_exports = {};
|
|
32
|
-
__export(component_exports, {
|
|
33
|
-
default: () => component_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(component_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var import_element = require("@wordpress/element");
|
|
38
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
-
function AvatarGroup({
|
|
40
|
-
className,
|
|
41
|
-
max = 3,
|
|
42
|
-
children,
|
|
43
|
-
...props
|
|
44
|
-
}) {
|
|
45
|
-
const childArray = import_element.Children.toArray(children);
|
|
46
|
-
const visible = childArray.slice(0, max);
|
|
47
|
-
const overflowCount = childArray.length - max;
|
|
48
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
49
|
-
role: "group",
|
|
50
|
-
className: (0, import_clsx.default)("components-avatar-group", className),
|
|
51
|
-
...props,
|
|
52
|
-
children: [visible, overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
53
|
-
className: "components-avatar-group__overflow",
|
|
54
|
-
"aria-label": `${overflowCount} more`,
|
|
55
|
-
children: `+${overflowCount}`
|
|
56
|
-
})]
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
var component_default = AvatarGroup;
|
|
60
|
-
//# sourceMappingURL=component.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/avatar-group/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction AvatarGroup({\n className,\n max = 3,\n children,\n ...props\n}) {\n const childArray = Children.toArray(children);\n const visible = childArray.slice(0, max);\n const overflowCount = childArray.length - max;\n return /*#__PURE__*/_jsxs(\"div\", {\n role: \"group\",\n className: clsx('components-avatar-group', className),\n ...props,\n children: [visible, overflowCount > 0 && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar-group__overflow\",\n \"aria-label\": `${overflowCount} more`,\n children: `+${overflowCount}`\n })]\n });\n}\nexport default AvatarGroup;"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAyB;AAKzB,yBAA2C;AAC3C,SAAS,YAAY;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,aAAa,wBAAS,QAAQ,QAAQ;AAC5C,QAAM,UAAU,WAAW,MAAM,GAAG,GAAG;AACvC,QAAM,gBAAgB,WAAW,SAAS;AAC1C,SAAoB,uCAAAA,MAAM,OAAO;AAAA,IAC/B,MAAM;AAAA,IACN,eAAW,YAAAC,SAAK,2BAA2B,SAAS;AAAA,IACpD,GAAG;AAAA,IACH,UAAU,CAAC,SAAS,gBAAgB,KAAkB,uCAAAC,KAAK,QAAQ;AAAA,MACjE,WAAW;AAAA,MACX,cAAc,GAAG,aAAa;AAAA,MAC9B,UAAU,IAAI,aAAa;AAAA,IAC7B,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,oBAAQ;",
|
|
6
|
-
"names": ["_jsxs", "clsx", "_jsx"]
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/components/src/avatar-group/index.ts
|
|
31
|
-
var avatar_group_exports = {};
|
|
32
|
-
__export(avatar_group_exports, {
|
|
33
|
-
default: () => import_component.default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(avatar_group_exports);
|
|
36
|
-
var import_component = __toESM(require("./component.cjs"));
|
|
37
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// packages/components/src/avatar-group/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
//# sourceMappingURL=types.cjs.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// packages/components/src/avatar/component.tsx
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import Icon from "../icon/index.mjs";
|
|
4
|
-
import Tooltip from "../tooltip/index.mjs";
|
|
5
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
function Avatar({
|
|
7
|
-
className,
|
|
8
|
-
src,
|
|
9
|
-
name,
|
|
10
|
-
label,
|
|
11
|
-
badge = false,
|
|
12
|
-
size = "default",
|
|
13
|
-
borderColor,
|
|
14
|
-
status,
|
|
15
|
-
statusIndicator,
|
|
16
|
-
style,
|
|
17
|
-
...props
|
|
18
|
-
}) {
|
|
19
|
-
const showBadge = badge && !!name;
|
|
20
|
-
const initials = name ? name.split(/\s+/).slice(0, 2).map((word) => word[0]).join("").toUpperCase() : void 0;
|
|
21
|
-
const customProperties = {
|
|
22
|
-
...style,
|
|
23
|
-
...src ? {
|
|
24
|
-
"--components-avatar-url": `url(${src})`
|
|
25
|
-
} : {},
|
|
26
|
-
...borderColor ? {
|
|
27
|
-
"--components-avatar-outline-color": borderColor
|
|
28
|
-
} : {}
|
|
29
|
-
};
|
|
30
|
-
const avatar = /* @__PURE__ */ _jsxs("div", {
|
|
31
|
-
className: clsx("components-avatar", className, {
|
|
32
|
-
"has-avatar-border-color": !!borderColor,
|
|
33
|
-
"has-src": !!src,
|
|
34
|
-
"has-badge": showBadge,
|
|
35
|
-
"is-small": size === "small",
|
|
36
|
-
"has-status": !!status,
|
|
37
|
-
[`is-${status}`]: !!status
|
|
38
|
-
}),
|
|
39
|
-
style: customProperties,
|
|
40
|
-
role: "img",
|
|
41
|
-
"aria-label": name,
|
|
42
|
-
...props,
|
|
43
|
-
children: [/* @__PURE__ */ _jsxs("span", {
|
|
44
|
-
className: "components-avatar__image",
|
|
45
|
-
children: [!src && initials, !!status && !!statusIndicator && /* @__PURE__ */ _jsx("span", {
|
|
46
|
-
className: "components-avatar__status-indicator",
|
|
47
|
-
children: /* @__PURE__ */ _jsx(Icon, {
|
|
48
|
-
icon: statusIndicator
|
|
49
|
-
})
|
|
50
|
-
})]
|
|
51
|
-
}), showBadge && /* @__PURE__ */ _jsx("span", {
|
|
52
|
-
className: "components-avatar__name",
|
|
53
|
-
children: label || name
|
|
54
|
-
})]
|
|
55
|
-
});
|
|
56
|
-
if (name && (!showBadge || label)) {
|
|
57
|
-
return /* @__PURE__ */ _jsx(Tooltip, {
|
|
58
|
-
text: name,
|
|
59
|
-
children: avatar
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return avatar;
|
|
63
|
-
}
|
|
64
|
-
var component_default = Avatar;
|
|
65
|
-
export {
|
|
66
|
-
component_default as default
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=component.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/avatar/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport Tooltip from '../tooltip';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction Avatar({\n className,\n src,\n name,\n label,\n badge = false,\n size = 'default',\n borderColor,\n status,\n statusIndicator,\n style,\n ...props\n}) {\n const showBadge = badge && !!name;\n const initials = name ? name.split(/\\s+/).slice(0, 2).map(word => word[0]).join('').toUpperCase() : undefined;\n const customProperties = {\n ...style,\n ...(src ? {\n '--components-avatar-url': `url(${src})`\n } : {}),\n ...(borderColor ? {\n '--components-avatar-outline-color': borderColor\n } : {})\n };\n const avatar = /*#__PURE__*/_jsxs(\"div\", {\n className: clsx('components-avatar', className, {\n 'has-avatar-border-color': !!borderColor,\n 'has-src': !!src,\n 'has-badge': showBadge,\n 'is-small': size === 'small',\n 'has-status': !!status,\n [`is-${status}`]: !!status\n }),\n style: customProperties,\n role: \"img\",\n \"aria-label\": name,\n ...props,\n children: [/*#__PURE__*/_jsxs(\"span\", {\n className: \"components-avatar__image\",\n children: [!src && initials, !!status && !!statusIndicator && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar__status-indicator\",\n children: /*#__PURE__*/_jsx(Icon, {\n icon: statusIndicator\n })\n })]\n }), showBadge && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar__name\",\n children: label || name\n })]\n });\n if (name && (!showBadge || label)) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: name,\n children: avatar\n });\n }\n return avatar;\n}\nexport default Avatar;"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,OAAO;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,YAAY,SAAS,CAAC,CAAC;AAC7B,QAAM,WAAW,OAAO,KAAK,MAAM,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,IAAI,UAAQ,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY,IAAI;AACpG,QAAM,mBAAmB;AAAA,IACvB,GAAG;AAAA,IACH,GAAI,MAAM;AAAA,MACR,2BAA2B,OAAO,GAAG;AAAA,IACvC,IAAI,CAAC;AAAA,IACL,GAAI,cAAc;AAAA,MAChB,qCAAqC;AAAA,IACvC,IAAI,CAAC;AAAA,EACP;AACA,QAAM,SAAsB,sBAAM,OAAO;AAAA,IACvC,WAAW,KAAK,qBAAqB,WAAW;AAAA,MAC9C,2BAA2B,CAAC,CAAC;AAAA,MAC7B,WAAW,CAAC,CAAC;AAAA,MACb,aAAa;AAAA,MACb,YAAY,SAAS;AAAA,MACrB,cAAc,CAAC,CAAC;AAAA,MAChB,CAAC,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC;AAAA,IACtB,CAAC;AAAA,IACD,OAAO;AAAA,IACP,MAAM;AAAA,IACN,cAAc;AAAA,IACd,GAAG;AAAA,IACH,UAAU,CAAc,sBAAM,QAAQ;AAAA,MACpC,WAAW;AAAA,MACX,UAAU,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,mBAAgC,qBAAK,QAAQ;AAAA,QACtF,WAAW;AAAA,QACX,UAAuB,qBAAK,MAAM;AAAA,UAChC,MAAM;AAAA,QACR,CAAC;AAAA,MACH,CAAC,CAAC;AAAA,IACJ,CAAC,GAAG,aAA0B,qBAAK,QAAQ;AAAA,MACzC,WAAW;AAAA,MACX,UAAU,SAAS;AAAA,IACrB,CAAC,CAAC;AAAA,EACJ,CAAC;AACD,MAAI,SAAS,CAAC,aAAa,QAAQ;AACjC,WAAoB,qBAAK,SAAS;AAAA,MAChC,MAAM;AAAA,MACN,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,SAAO;AACT;AACA,IAAO,oBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=types.mjs.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// packages/components/src/avatar-group/component.tsx
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { Children } from "@wordpress/element";
|
|
4
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
function AvatarGroup({
|
|
6
|
-
className,
|
|
7
|
-
max = 3,
|
|
8
|
-
children,
|
|
9
|
-
...props
|
|
10
|
-
}) {
|
|
11
|
-
const childArray = Children.toArray(children);
|
|
12
|
-
const visible = childArray.slice(0, max);
|
|
13
|
-
const overflowCount = childArray.length - max;
|
|
14
|
-
return /* @__PURE__ */ _jsxs("div", {
|
|
15
|
-
role: "group",
|
|
16
|
-
className: clsx("components-avatar-group", className),
|
|
17
|
-
...props,
|
|
18
|
-
children: [visible, overflowCount > 0 && /* @__PURE__ */ _jsx("span", {
|
|
19
|
-
className: "components-avatar-group__overflow",
|
|
20
|
-
"aria-label": `${overflowCount} more`,
|
|
21
|
-
children: `+${overflowCount}`
|
|
22
|
-
})]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
var component_default = AvatarGroup;
|
|
26
|
-
export {
|
|
27
|
-
component_default as default
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=component.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/avatar-group/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction AvatarGroup({\n className,\n max = 3,\n children,\n ...props\n}) {\n const childArray = Children.toArray(children);\n const visible = childArray.slice(0, max);\n const overflowCount = childArray.length - max;\n return /*#__PURE__*/_jsxs(\"div\", {\n role: \"group\",\n className: clsx('components-avatar-group', className),\n ...props,\n children: [visible, overflowCount > 0 && /*#__PURE__*/_jsx(\"span\", {\n className: \"components-avatar-group__overflow\",\n \"aria-label\": `${overflowCount} more`,\n children: `+${overflowCount}`\n })]\n });\n}\nexport default AvatarGroup;"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,gBAAgB;AAKzB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,YAAY;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,aAAa,SAAS,QAAQ,QAAQ;AAC5C,QAAM,UAAU,WAAW,MAAM,GAAG,GAAG;AACvC,QAAM,gBAAgB,WAAW,SAAS;AAC1C,SAAoB,sBAAM,OAAO;AAAA,IAC/B,MAAM;AAAA,IACN,WAAW,KAAK,2BAA2B,SAAS;AAAA,IACpD,GAAG;AAAA,IACH,UAAU,CAAC,SAAS,gBAAgB,KAAkB,qBAAK,QAAQ;AAAA,MACjE,WAAW;AAAA,MACX,cAAc,GAAG,aAAa;AAAA,MAC9B,UAAU,IAAI,aAAa;AAAA,IAC7B,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AACA,IAAO,oBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|