@cimpress-ui/react 0.0.0 → 0.0.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/README.md +1 -1
- package/dist/commonjs/components/button/button.d.ts +6 -1
- package/dist/commonjs/components/button/button.d.ts.map +1 -1
- package/dist/commonjs/components/button/button.js +16 -3
- package/dist/commonjs/components/button/button.js.map +1 -1
- package/dist/commonjs/components/button/constants.d.ts +3 -0
- package/dist/commonjs/components/button/constants.d.ts.map +1 -0
- package/dist/commonjs/components/button/constants.js +9 -0
- package/dist/commonjs/components/button/constants.js.map +1 -0
- package/dist/commonjs/components/button/icon-button.d.ts +6 -1
- package/dist/commonjs/components/button/icon-button.d.ts.map +1 -1
- package/dist/commonjs/components/button/icon-button.js +16 -3
- package/dist/commonjs/components/button/icon-button.js.map +1 -1
- package/dist/commonjs/components/button/icon-link-button.d.ts +9 -3
- package/dist/commonjs/components/button/icon-link-button.d.ts.map +1 -1
- package/dist/commonjs/components/button/icon-link-button.js +6 -0
- package/dist/commonjs/components/button/icon-link-button.js.map +1 -1
- package/dist/commonjs/components/button/link-button.d.ts +9 -3
- package/dist/commonjs/components/button/link-button.d.ts.map +1 -1
- package/dist/commonjs/components/button/link-button.js +6 -0
- package/dist/commonjs/components/button/link-button.js.map +1 -1
- package/dist/commonjs/components/button/types.d.ts +11 -5
- package/dist/commonjs/components/button/types.d.ts.map +1 -1
- package/dist/commonjs/components/button/types.js.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox-group.d.ts +14 -4
- package/dist/commonjs/components/checkbox/checkbox-group.d.ts.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox-group.js +16 -10
- package/dist/commonjs/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.d.ts +9 -4
- package/dist/commonjs/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js +7 -1
- package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts +25 -24
- package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.js +31 -16
- package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
- package/dist/commonjs/components/form/form.d.ts +8 -3
- package/dist/commonjs/components/form/form.d.ts.map +1 -1
- package/dist/commonjs/components/form/form.js +6 -0
- package/dist/commonjs/components/form/form.js.map +1 -1
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.d.ts +16 -0
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.d.ts.map +1 -0
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js +17 -0
- package/dist/commonjs/components/internal/collapsible-list/collapsible-list.js.map +1 -0
- package/dist/commonjs/components/internal/form-field/form-field.d.ts +29 -0
- package/dist/commonjs/components/internal/form-field/form-field.d.ts.map +1 -0
- package/dist/commonjs/components/internal/form-field/form-field.js +56 -0
- package/dist/commonjs/components/internal/form-field/form-field.js.map +1 -0
- package/dist/commonjs/components/internal/spinner/spinner.d.ts +18 -0
- package/dist/commonjs/components/internal/spinner/spinner.d.ts.map +1 -0
- package/dist/commonjs/components/internal/spinner/spinner.js +19 -0
- package/dist/commonjs/components/internal/spinner/spinner.js.map +1 -0
- package/dist/commonjs/components/menu/menu.d.ts +24 -14
- package/dist/commonjs/components/menu/menu.d.ts.map +1 -1
- package/dist/commonjs/components/menu/menu.js +38 -15
- package/dist/commonjs/components/menu/menu.js.map +1 -1
- package/dist/commonjs/components/radio/radio-group.d.ts +14 -4
- package/dist/commonjs/components/radio/radio-group.d.ts.map +1 -1
- package/dist/commonjs/components/radio/radio-group.js +16 -10
- package/dist/commonjs/components/radio/radio-group.js.map +1 -1
- package/dist/commonjs/components/radio/radio.d.ts +9 -4
- package/dist/commonjs/components/radio/radio.d.ts.map +1 -1
- package/dist/commonjs/components/radio/radio.js +6 -0
- package/dist/commonjs/components/radio/radio.js.map +1 -1
- package/dist/commonjs/components/select/select.d.ts +27 -24
- package/dist/commonjs/components/select/select.d.ts.map +1 -1
- package/dist/commonjs/components/select/select.js +33 -14
- package/dist/commonjs/components/select/select.js.map +1 -1
- package/dist/commonjs/components/spacing/box/box.d.ts +5 -3
- package/dist/commonjs/components/spacing/box/box.d.ts.map +1 -1
- package/dist/commonjs/components/spacing/box/box.js +2 -0
- package/dist/commonjs/components/spacing/box/box.js.map +1 -1
- package/dist/commonjs/components/spacing/stack/stack.d.ts +28 -4
- package/dist/commonjs/components/spacing/stack/stack.d.ts.map +1 -1
- package/dist/commonjs/components/spacing/stack/stack.js +11 -3
- package/dist/commonjs/components/spacing/stack/stack.js.map +1 -1
- package/dist/commonjs/components/spacing/types.d.ts +9 -0
- package/dist/commonjs/components/spacing/types.d.ts.map +1 -1
- package/dist/commonjs/components/spacing/types.js +6 -0
- package/dist/commonjs/components/spacing/types.js.map +1 -1
- package/dist/commonjs/components/spinner/spinner.d.ts +8 -5
- package/dist/commonjs/components/spinner/spinner.d.ts.map +1 -1
- package/dist/commonjs/components/spinner/spinner.js +23 -14
- package/dist/commonjs/components/spinner/spinner.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.d.ts +4 -3
- package/dist/commonjs/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js +13 -3
- package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts +8 -3
- package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js +14 -1
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/components/types.d.ts +67 -11
- package/dist/commonjs/components/types.d.ts.map +1 -1
- package/dist/commonjs/components/types.js.map +1 -1
- package/dist/commonjs/components/typography/link.d.ts +4 -3
- package/dist/commonjs/components/typography/link.d.ts.map +1 -1
- package/dist/commonjs/components/typography/link.js +6 -1
- package/dist/commonjs/components/typography/link.js.map +1 -1
- package/dist/commonjs/components/typography/text.d.ts +3 -2
- package/dist/commonjs/components/typography/text.d.ts.map +1 -1
- package/dist/commonjs/components/typography/text.js +3 -0
- package/dist/commonjs/components/typography/text.js.map +1 -1
- package/dist/commonjs/components/typography/types.d.ts +3 -2
- package/dist/commonjs/components/typography/types.d.ts.map +1 -1
- package/dist/commonjs/components/typography/types.js.map +1 -1
- package/dist/commonjs/components/typography/utils.d.ts +1 -0
- package/dist/commonjs/components/typography/utils.d.ts.map +1 -1
- package/dist/commonjs/components/typography/utils.js +1 -0
- package/dist/commonjs/components/typography/utils.js.map +1 -1
- package/dist/commonjs/forward-ref.d.ts +2 -2
- package/dist/commonjs/forward-ref.d.ts.map +1 -1
- package/dist/commonjs/forward-ref.js +1 -0
- package/dist/commonjs/forward-ref.js.map +1 -1
- package/dist/commonjs/icons/add.d.ts +3 -2
- package/dist/commonjs/icons/add.d.ts.map +1 -1
- package/dist/commonjs/icons/add.js +16 -2
- package/dist/commonjs/icons/add.js.map +1 -1
- package/dist/commonjs/icons/alert-triangle.d.ts +3 -2
- package/dist/commonjs/icons/alert-triangle.d.ts.map +1 -1
- package/dist/commonjs/icons/alert-triangle.js +16 -2
- package/dist/commonjs/icons/alert-triangle.js.map +1 -1
- package/dist/commonjs/icons/checkmark-circle-fill.d.ts +8 -0
- package/dist/commonjs/icons/checkmark-circle-fill.d.ts.map +1 -0
- package/dist/commonjs/icons/checkmark-circle-fill.js +21 -0
- package/dist/commonjs/icons/checkmark-circle-fill.js.map +1 -0
- package/dist/commonjs/icons/checkmark-small.d.ts +3 -2
- package/dist/commonjs/icons/checkmark-small.d.ts.map +1 -1
- package/dist/commonjs/icons/checkmark-small.js +16 -2
- package/dist/commonjs/icons/checkmark-small.js.map +1 -1
- package/dist/commonjs/icons/checkmark.d.ts +8 -0
- package/dist/commonjs/icons/checkmark.d.ts.map +1 -0
- package/dist/commonjs/icons/checkmark.js +21 -0
- package/dist/commonjs/icons/checkmark.js.map +1 -0
- package/dist/commonjs/icons/chevron-down-fill.d.ts +8 -0
- package/dist/commonjs/icons/chevron-down-fill.d.ts.map +1 -0
- package/dist/commonjs/icons/chevron-down-fill.js +21 -0
- package/dist/commonjs/icons/chevron-down-fill.js.map +1 -0
- package/dist/commonjs/icons/error-circle-fill.d.ts +8 -0
- package/dist/commonjs/icons/error-circle-fill.d.ts.map +1 -0
- package/dist/commonjs/icons/error-circle-fill.js +21 -0
- package/dist/commonjs/icons/error-circle-fill.js.map +1 -0
- package/dist/commonjs/icons/index.d.ts +5 -0
- package/dist/commonjs/icons/index.d.ts.map +1 -1
- package/dist/commonjs/icons/index.js +9 -1
- package/dist/commonjs/icons/index.js.map +1 -1
- package/dist/commonjs/icons/minus-small.d.ts +3 -2
- package/dist/commonjs/icons/minus-small.d.ts.map +1 -1
- package/dist/commonjs/icons/minus-small.js +16 -2
- package/dist/commonjs/icons/minus-small.js.map +1 -1
- package/dist/commonjs/index.d.ts +13 -11
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +11 -10
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/providers/router/router-provider.d.ts +20 -0
- package/dist/commonjs/providers/router/router-provider.d.ts.map +1 -0
- package/dist/commonjs/providers/router/router-provider.js +15 -0
- package/dist/commonjs/providers/router/router-provider.js.map +1 -0
- package/dist/commonjs/providers/ssr/ssr-provider.d.ts +7 -3
- package/dist/commonjs/providers/ssr/ssr-provider.d.ts.map +1 -1
- package/dist/commonjs/providers/ssr/ssr-provider.js +3 -1
- package/dist/commonjs/providers/ssr/ssr-provider.js.map +1 -1
- package/dist/commonjs/with-style-props.d.ts +17 -11
- package/dist/commonjs/with-style-props.d.ts.map +1 -1
- package/dist/commonjs/with-style-props.js.map +1 -1
- package/dist/esm/components/button/button.d.ts +6 -1
- package/dist/esm/components/button/button.d.ts.map +1 -1
- package/dist/esm/components/button/button.js +16 -3
- package/dist/esm/components/button/button.js.map +1 -1
- package/dist/esm/components/button/constants.d.ts +3 -0
- package/dist/esm/components/button/constants.d.ts.map +1 -0
- package/dist/esm/components/button/constants.js +6 -0
- package/dist/esm/components/button/constants.js.map +1 -0
- package/dist/esm/components/button/icon-button.d.ts +6 -1
- package/dist/esm/components/button/icon-button.d.ts.map +1 -1
- package/dist/esm/components/button/icon-button.js +16 -3
- package/dist/esm/components/button/icon-button.js.map +1 -1
- package/dist/esm/components/button/icon-link-button.d.ts +9 -3
- package/dist/esm/components/button/icon-link-button.d.ts.map +1 -1
- package/dist/esm/components/button/icon-link-button.js +6 -0
- package/dist/esm/components/button/icon-link-button.js.map +1 -1
- package/dist/esm/components/button/link-button.d.ts +9 -3
- package/dist/esm/components/button/link-button.d.ts.map +1 -1
- package/dist/esm/components/button/link-button.js +6 -0
- package/dist/esm/components/button/link-button.js.map +1 -1
- package/dist/esm/components/button/types.d.ts +11 -5
- package/dist/esm/components/button/types.d.ts.map +1 -1
- package/dist/esm/components/button/types.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.d.ts +14 -4
- package/dist/esm/components/checkbox/checkbox-group.d.ts.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.js +16 -10
- package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox.d.ts +9 -4
- package/dist/esm/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js +7 -1
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/combo-box/combo-box.d.ts +25 -24
- package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/esm/components/combo-box/combo-box.js +35 -22
- package/dist/esm/components/combo-box/combo-box.js.map +1 -1
- package/dist/esm/components/form/form.d.ts +8 -3
- package/dist/esm/components/form/form.d.ts.map +1 -1
- package/dist/esm/components/form/form.js +6 -0
- package/dist/esm/components/form/form.js.map +1 -1
- package/dist/esm/components/internal/collapsible-list/collapsible-list.d.ts +16 -0
- package/dist/esm/components/internal/collapsible-list/collapsible-list.d.ts.map +1 -0
- package/dist/esm/components/internal/collapsible-list/collapsible-list.js +14 -0
- package/dist/esm/components/internal/collapsible-list/collapsible-list.js.map +1 -0
- package/dist/esm/components/internal/form-field/form-field.d.ts +29 -0
- package/dist/esm/components/internal/form-field/form-field.d.ts.map +1 -0
- package/dist/esm/components/internal/form-field/form-field.js +48 -0
- package/dist/esm/components/internal/form-field/form-field.js.map +1 -0
- package/dist/esm/components/internal/spinner/spinner.d.ts +18 -0
- package/dist/esm/components/internal/spinner/spinner.d.ts.map +1 -0
- package/dist/esm/components/internal/spinner/spinner.js +14 -0
- package/dist/esm/components/internal/spinner/spinner.js.map +1 -0
- package/dist/esm/components/menu/menu.d.ts +24 -14
- package/dist/esm/components/menu/menu.d.ts.map +1 -1
- package/dist/esm/components/menu/menu.js +39 -16
- package/dist/esm/components/menu/menu.js.map +1 -1
- package/dist/esm/components/radio/radio-group.d.ts +14 -4
- package/dist/esm/components/radio/radio-group.d.ts.map +1 -1
- package/dist/esm/components/radio/radio-group.js +16 -10
- package/dist/esm/components/radio/radio-group.js.map +1 -1
- package/dist/esm/components/radio/radio.d.ts +9 -4
- package/dist/esm/components/radio/radio.d.ts.map +1 -1
- package/dist/esm/components/radio/radio.js +6 -0
- package/dist/esm/components/radio/radio.js.map +1 -1
- package/dist/esm/components/select/select.d.ts +27 -24
- package/dist/esm/components/select/select.d.ts.map +1 -1
- package/dist/esm/components/select/select.js +35 -18
- package/dist/esm/components/select/select.js.map +1 -1
- package/dist/esm/components/spacing/box/box.d.ts +5 -3
- package/dist/esm/components/spacing/box/box.d.ts.map +1 -1
- package/dist/esm/components/spacing/box/box.js +2 -0
- package/dist/esm/components/spacing/box/box.js.map +1 -1
- package/dist/esm/components/spacing/stack/stack.d.ts +28 -4
- package/dist/esm/components/spacing/stack/stack.d.ts.map +1 -1
- package/dist/esm/components/spacing/stack/stack.js +11 -3
- package/dist/esm/components/spacing/stack/stack.js.map +1 -1
- package/dist/esm/components/spacing/types.d.ts +9 -0
- package/dist/esm/components/spacing/types.d.ts.map +1 -1
- package/dist/esm/components/spacing/types.js +6 -0
- package/dist/esm/components/spacing/types.js.map +1 -1
- package/dist/esm/components/spinner/spinner.d.ts +8 -5
- package/dist/esm/components/spinner/spinner.d.ts.map +1 -1
- package/dist/esm/components/spinner/spinner.js +25 -13
- package/dist/esm/components/spinner/spinner.js.map +1 -1
- package/dist/esm/components/text-inputs/text-area.d.ts +4 -3
- package/dist/esm/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-area.js +13 -3
- package/dist/esm/components/text-inputs/text-area.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts +8 -3
- package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js +14 -1
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/components/types.d.ts +67 -11
- package/dist/esm/components/types.d.ts.map +1 -1
- package/dist/esm/components/types.js.map +1 -1
- package/dist/esm/components/typography/link.d.ts +4 -3
- package/dist/esm/components/typography/link.d.ts.map +1 -1
- package/dist/esm/components/typography/link.js +7 -2
- package/dist/esm/components/typography/link.js.map +1 -1
- package/dist/esm/components/typography/text.d.ts +3 -2
- package/dist/esm/components/typography/text.d.ts.map +1 -1
- package/dist/esm/components/typography/text.js +3 -0
- package/dist/esm/components/typography/text.js.map +1 -1
- package/dist/esm/components/typography/types.d.ts +3 -2
- package/dist/esm/components/typography/types.d.ts.map +1 -1
- package/dist/esm/components/typography/types.js.map +1 -1
- package/dist/esm/components/typography/utils.d.ts +1 -0
- package/dist/esm/components/typography/utils.d.ts.map +1 -1
- package/dist/esm/components/typography/utils.js +1 -0
- package/dist/esm/components/typography/utils.js.map +1 -1
- package/dist/esm/forward-ref.d.ts +2 -2
- package/dist/esm/forward-ref.d.ts.map +1 -1
- package/dist/esm/forward-ref.js +1 -0
- package/dist/esm/forward-ref.js.map +1 -1
- package/dist/esm/icons/add.d.ts +3 -2
- package/dist/esm/icons/add.d.ts.map +1 -1
- package/dist/esm/icons/add.js +14 -3
- package/dist/esm/icons/add.js.map +1 -1
- package/dist/esm/icons/alert-triangle.d.ts +3 -2
- package/dist/esm/icons/alert-triangle.d.ts.map +1 -1
- package/dist/esm/icons/alert-triangle.js +13 -2
- package/dist/esm/icons/alert-triangle.js.map +1 -1
- package/dist/esm/icons/checkmark-circle-fill.d.ts +8 -0
- package/dist/esm/icons/checkmark-circle-fill.d.ts.map +1 -0
- package/dist/esm/icons/checkmark-circle-fill.js +16 -0
- package/dist/esm/icons/checkmark-circle-fill.js.map +1 -0
- package/dist/esm/icons/checkmark-small.d.ts +3 -2
- package/dist/esm/icons/checkmark-small.d.ts.map +1 -1
- package/dist/esm/icons/checkmark-small.js +13 -2
- package/dist/esm/icons/checkmark-small.js.map +1 -1
- package/dist/esm/icons/checkmark.d.ts +8 -0
- package/dist/esm/icons/checkmark.d.ts.map +1 -0
- package/dist/esm/icons/checkmark.js +16 -0
- package/dist/esm/icons/checkmark.js.map +1 -0
- package/dist/esm/icons/chevron-down-fill.d.ts +8 -0
- package/dist/esm/icons/chevron-down-fill.d.ts.map +1 -0
- package/dist/esm/icons/chevron-down-fill.js +16 -0
- package/dist/esm/icons/chevron-down-fill.js.map +1 -0
- package/dist/esm/icons/error-circle-fill.d.ts +8 -0
- package/dist/esm/icons/error-circle-fill.d.ts.map +1 -0
- package/dist/esm/icons/error-circle-fill.js +16 -0
- package/dist/esm/icons/error-circle-fill.js.map +1 -0
- package/dist/esm/icons/index.d.ts +5 -0
- package/dist/esm/icons/index.d.ts.map +1 -1
- package/dist/esm/icons/index.js +4 -0
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/icons/minus-small.d.ts +3 -2
- package/dist/esm/icons/minus-small.d.ts.map +1 -1
- package/dist/esm/icons/minus-small.js +13 -2
- package/dist/esm/icons/minus-small.js.map +1 -1
- package/dist/esm/index.d.ts +13 -11
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +11 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/router/router-provider.d.ts +20 -0
- package/dist/esm/providers/router/router-provider.d.ts.map +1 -0
- package/dist/esm/providers/router/router-provider.js +12 -0
- package/dist/esm/providers/router/router-provider.js.map +1 -0
- package/dist/esm/providers/ssr/ssr-provider.d.ts +7 -3
- package/dist/esm/providers/ssr/ssr-provider.d.ts.map +1 -1
- package/dist/esm/providers/ssr/ssr-provider.js +3 -1
- package/dist/esm/providers/ssr/ssr-provider.js.map +1 -1
- package/dist/esm/with-style-props.d.ts +17 -11
- package/dist/esm/with-style-props.d.ts.map +1 -1
- package/dist/esm/with-style-props.js.map +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +74 -29
- package/LICENSE +0 -201
- package/dist/commonjs/components/form-field/form-field.d.ts +0 -13
- package/dist/commonjs/components/form-field/form-field.d.ts.map +0 -1
- package/dist/commonjs/components/form-field/form-field.js +0 -36
- package/dist/commonjs/components/form-field/form-field.js.map +0 -1
- package/dist/commonjs/components/sr-only/sr-only.d.ts +0 -8
- package/dist/commonjs/components/sr-only/sr-only.d.ts.map +0 -1
- package/dist/commonjs/components/sr-only/sr-only.js +0 -10
- package/dist/commonjs/components/sr-only/sr-only.js.map +0 -1
- package/dist/esm/components/form-field/form-field.d.ts +0 -13
- package/dist/esm/components/form-field/form-field.d.ts.map +0 -1
- package/dist/esm/components/form-field/form-field.js +0 -28
- package/dist/esm/components/form-field/form-field.js.map +0 -1
- package/dist/esm/components/sr-only/sr-only.d.ts +0 -8
- package/dist/esm/components/sr-only/sr-only.d.ts.map +0 -1
- package/dist/esm/components/sr-only/sr-only.js +0 -7
- package/dist/esm/components/sr-only/sr-only.js.map +0 -1
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface ComboBoxOption {
|
|
5
|
-
/** The unique id of the item. When integrated with a form, this will be the value of the option. */
|
|
6
|
-
id: string;
|
|
7
|
-
/** The content to display as the label of the option. */
|
|
8
|
-
label: string;
|
|
9
|
-
/** Whether the option is disabled. */
|
|
10
|
-
isDisabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ComboBoxOptionGroup {
|
|
13
|
-
/** The unique id of the group. */
|
|
14
|
-
id: string;
|
|
15
|
-
/** The content to display as the title of the group. */
|
|
16
|
-
label: string;
|
|
17
|
-
/** The options available for selection within the group. */
|
|
18
|
-
options: ComboBoxOption[];
|
|
19
|
-
isDisabled?: never;
|
|
20
|
-
}
|
|
1
|
+
import { type ComboBoxProps as RACComboBoxProps, type ListBoxItemProps as RACListBoxItemProps } from 'react-aria-components';
|
|
2
|
+
import type { CollectionItem, CollectionProps, CommonProps, FieldWithPlaceholderProps, Key, StringLikeChildren } from '../types.js';
|
|
3
|
+
/** Represents the state of the `ComboBox` component for validation purposes. */
|
|
21
4
|
export interface ComboBoxValidationValue {
|
|
22
5
|
/** The selected key in the ComboBox. */
|
|
23
6
|
selectedKey: Key | null;
|
|
24
7
|
/** The value of the ComboBox input. */
|
|
25
8
|
inputValue: string;
|
|
26
9
|
}
|
|
27
|
-
export interface ComboBoxProps<T extends
|
|
28
|
-
/** The options available for selection. Supports groups with a single level of nesting. */
|
|
29
|
-
options: Array<ComboBoxOption | ComboBoxOptionGroup>;
|
|
10
|
+
export interface ComboBoxProps<T extends CollectionItem = CollectionItem> extends CommonProps, FieldWithPlaceholderProps<ComboBoxValidationValue>, CollectionProps<T>, Pick<RACComboBoxProps<T>, 'name' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'selectedKey' | 'defaultSelectedKey' | 'inputValue' | 'defaultInputValue' | 'autoFocus' | 'onSelectionChange' | 'onInputChange'> {
|
|
30
11
|
}
|
|
31
|
-
|
|
12
|
+
/** Allows users to filter a collapsible list and select one item from it. */
|
|
13
|
+
declare const _ComboBox: <T extends CollectionItem>(props: ComboBoxProps<T> & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
32
14
|
export { _ComboBox as ComboBox };
|
|
15
|
+
export interface ComboBoxItemProps<T extends CollectionItem> extends Pick<RACListBoxItemProps<T>, 'id' | 'isDisabled'> {
|
|
16
|
+
children: StringLikeChildren;
|
|
17
|
+
}
|
|
18
|
+
/** Renders a single list item within `ComboBox`. */
|
|
19
|
+
export declare function ComboBoxItem<T extends CollectionItem>({ children, ...props }: ComboBoxItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare namespace ComboBoxItem {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ComboBoxSectionProps<T extends CollectionItem> extends CollectionProps<T> {
|
|
24
|
+
/** The ID of the section. Has to be unique across all sections and items. */
|
|
25
|
+
id?: Key;
|
|
26
|
+
/** The content to display as the section title. */
|
|
27
|
+
title: string;
|
|
28
|
+
}
|
|
29
|
+
/** Groups list items within `ComboBox` into a section. */
|
|
30
|
+
export declare function ComboBoxSection<T extends CollectionItem>({ title, children, items, ...props }: ComboBoxSectionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare namespace ComboBoxSection {
|
|
32
|
+
var displayName: string;
|
|
33
|
+
}
|
|
33
34
|
//# sourceMappingURL=combo-box.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAIA,OAAO,EAYL,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,gBAAgB,IAAI,mBAAmB,EAC7C,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,yBAAyB,EACzB,GAAG,EACH,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,gFAA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,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAezB;yBApBe,eAAe"}
|
|
@@ -1,23 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
7
|
exports.ComboBox = void 0;
|
|
8
|
+
exports.ComboBoxItem = ComboBoxItem;
|
|
9
|
+
exports.ComboBoxSection = ComboBoxSection;
|
|
7
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
11
|
const clsx_1 = __importDefault(require("clsx"));
|
|
9
12
|
const react_1 = require("react");
|
|
10
13
|
const react_aria_components_1 = require("react-aria-components");
|
|
11
14
|
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
15
|
+
const index_js_1 = require("../../icons/index.js");
|
|
12
16
|
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
13
|
-
const
|
|
17
|
+
const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
|
|
18
|
+
const form_field_js_1 = require("../internal/form-field/form-field.js");
|
|
14
19
|
const utils_js_1 = require("../typography/utils.js");
|
|
15
|
-
function ComboBox({ label, description, error,
|
|
20
|
+
function ComboBox({ label, description, error, items, children, placeholder, UNSAFE_className, UNSAFE_style, isReadOnly, ...props }, ref) {
|
|
16
21
|
const triggerPositioningRef = (0, react_1.useRef)(null);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
25
|
+
console.warn('ComboBox requires one of label / aria-label / aria-labelledby for accessibility');
|
|
26
|
+
}
|
|
27
|
+
}, [label, ariaLabel, ariaLabelledBy]);
|
|
28
|
+
if (items != null && typeof children !== 'function') {
|
|
29
|
+
console.warn('`ComboBox` requires `children` to be a function when using `items` prop');
|
|
30
|
+
}
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.ComboBox, { ...props, ref: ref, className: (0, clsx_1.default)('cim-combo-box', UNSAFE_className), style: UNSAFE_style, menuTrigger: "focus", isReadOnly: isReadOnly, "data-readonly": isReadOnly ? true : undefined, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-combo-box-input-wrapper", ref: triggerPositioningRef, children: [(0, jsx_runtime_1.jsx)(ComboBoxInput, { isReadOnly: isReadOnly, placeholder: placeholder }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { className: "cim-combo-box-button", children: (0, jsx_runtime_1.jsx)(index_js_1.IconChevronDownFill, {}) })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { offset: 5, maxHeight: 315,
|
|
32
|
+
// Position the list relative to wrapper div instead of input to account for border
|
|
33
|
+
triggerRef: triggerPositioningRef, widthCorrection: 2, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.ListBox, { className: "cim-combo-box-listbox", items: items, children: children }) })] }));
|
|
20
34
|
}
|
|
35
|
+
// TODO: add link to usage guidelines
|
|
36
|
+
/** Allows users to filter a collapsible list and select one item from it. */
|
|
21
37
|
const _ComboBox = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(ComboBox), 'ComboBox');
|
|
22
38
|
exports.ComboBox = _ComboBox;
|
|
23
39
|
function ComboBoxInput({ isReadOnly, placeholder, }) {
|
|
@@ -27,19 +43,18 @@ function ComboBoxInput({ isReadOnly, placeholder, }) {
|
|
|
27
43
|
// By default, React Aria only opens the popover when the input is focused.
|
|
28
44
|
onClick: () => !isReadOnly && comboBoxState.open(), placeholder: placeholder }));
|
|
29
45
|
}
|
|
30
|
-
|
|
31
|
-
if ('options' in item) {
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(ComboBoxSection, { id: item.id, title: item.label, items: item.options, children: (child) => ((0, jsx_runtime_1.jsx)(ComboBoxItem, { id: child.id, isDisabled: child.isDisabled, children: child.label })) }));
|
|
33
|
-
}
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(ComboBoxItem, { id: item.id, isDisabled: item.isDisabled, children: item.label }));
|
|
35
|
-
}
|
|
46
|
+
/** Renders a single list item within `ComboBox`. */
|
|
36
47
|
function ComboBoxItem({ children, ...props }) {
|
|
37
|
-
|
|
48
|
+
const textValue = typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-combo-box-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_1.IconCheckmark, {}), (0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children })] })) }));
|
|
38
50
|
}
|
|
51
|
+
ComboBoxItem.displayName = 'ComboBoxItem';
|
|
52
|
+
/** Groups list items within `ComboBox` into a section. */
|
|
39
53
|
function ComboBoxSection({ title, children, items, ...props }) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return ((0, jsx_runtime_1.
|
|
54
|
+
if (items != null && typeof children !== 'function') {
|
|
55
|
+
console.warn('`ComboBoxSection` requires `children` to be a function when using `items` prop');
|
|
56
|
+
}
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.ListBoxSection, { ...props, className: "cim-combo-box-section", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Header, { className: (0, clsx_1.default)('cim-combo-box-section-header', (0, utils_js_1.textStyle)({ variant: 'small-semibold', tone: 'subtle' })), children: title }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Collection, { items: items, children: children })] }));
|
|
44
58
|
}
|
|
59
|
+
ComboBoxSection.displayName = 'ComboBoxSection';
|
|
45
60
|
//# sourceMappingURL=combo-box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":";;;;;;;AAAA,gDAAwB;AACxB,iCAAkG;AAClG,iEAa+B;AAC/B,yDAAkD;AAClD,mEAA2D;AAC3D,+DAAmG;AAEnG,qDAAmD;AAkDnD,SAAS,QAAQ,CACf,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAoB,EAC/G,GAAiC;IAEjC,MAAM,qBAAqB,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAE3D,OAAO,CACL,wBAAC,gCAAW,OACN,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAI,EAAC,eAAe,EAAE,gBAAgB,CAAC,EAClD,KAAK,EAAE,YAAY,EACnB,WAAW,EAAC,OAAO,aAEnB,uBAAC,8BAAc,IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,YAAG,KAAK,GAAkB,EACtE,iCAAK,SAAS,EAAC,6BAA6B,EAAC,GAAG,EAAE,qBAAqB,aACrE,uBAAC,aAAa,IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,WAAW,GAAI,EACzE,uBAAC,8BAAS,IAAC,SAAS,EAAC,sBAAsB,YACzC,uBAAC,eAAe,IAAC,MAAM,EAAE,EAAE,EAAE,KAAK,E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EAAE,KAAK,CAAC,UAAU,YACrD,KAAK,CAAC,KAAK,GACC,CAChB,GACe,CACnB,CAAC;IACJ,CAAC;IAED,OAAO,CACL,uBAAC,YAAY,IAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,YACnD,IAAI,CAAC,KAAK,GACE,CAChB,CAAC;AACJ,CAAC;AAMD,SAAS,YAAY,CAAmB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAwB;IAClF,OAAO,CACL,uBAAC,mCAAc,OAAK,KAAK,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,oBAAoB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,YAC/F,QAAQ,GACM,CAClB,CAAC;AACJ,CAAC;AASD,SAAS,eAAe,CAAmB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAA2B;IACtG,OAAO,CACL,wBAAC,+BAAU,OAAK,KAAK,EAAE,SAAS,EAAC,uBAAuB,aACtD,uBAAC,8BAAS,IAAC,SAAS,EAAE,IAAA,cAAI,EAAC,sBAAsB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAChG,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IAC5C,CACd,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAmC;IAC1D,OAAO,CACL,gCAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,wBAAe,KAAK,YACjG,iCAAM,CAAC,EAAC,4OAA4O,GAAG,GACnP,CACP,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport { useContext, useRef, type ForwardedRef, type ReactNode, type SVGAttributes } from 'react';\nimport {\n ComboBoxStateContext,\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n Header as RACHeader,\n Input as RACInput,\n ListBox as RACListBox,\n ListBoxItem as RACListBoxItem,\n Popover as RACPopover,\n Section as RACSection,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../form-field/form-field.js';\nimport type { DOMProps, FieldWithPlaceholderProps, Key } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface ComboBoxOption {\n /** The unique id of the item. When integrated with a form, this will be the value of the option. */\n id: string;\n /** The content to display as the label of the option. */\n label: string;\n /** Whether the option is disabled. */\n isDisabled?: boolean;\n}\n\nexport interface ComboBoxOptionGroup {\n /** The unique id of the group. */\n id: string;\n /** The content to display as the title of the group. */\n label: string;\n /** The options available for selection within the group. */\n options: ComboBoxOption[];\n isDisabled?: never;\n}\n\nexport interface ComboBoxValidationValue {\n /** The selected key in the ComboBox. */\n selectedKey: Key | null;\n /** The value of the ComboBox input. */\n inputValue: string;\n}\n\nexport interface ComboBoxProps<T extends object>\n extends Pick<\n RACComboBoxProps<T>,\n | 'name'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'onInputChange'\n >,\n DOMProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue> {\n /** The options available for selection. Supports groups with a single level of nesting. */\n options: Array<ComboBoxOption | ComboBoxOptionGroup>;\n}\n\nfunction ComboBox<T extends object>(\n { label, description, error, options, placeholder, UNSAFE_className, UNSAFE_style, ...props }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const triggerPositioningRef = useRef<HTMLDivElement>(null);\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n menuTrigger=\"focus\"\n >\n <FormFieldLabel isRequired={props.isRequired}>{label}</FormFieldLabel>\n <div className=\"cim-combo-box-input-wrapper\" ref={triggerPositioningRef}>\n <ComboBoxInput isReadOnly={props.isReadOnly} placeholder={placeholder} />\n <RACButton className=\"cim-combo-box-button\">\n <ChevronDownIcon height={12} width={12} aria-hidden=\"true\" />\n </RACButton>\n </div>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <RACPopover\n offset={2}\n maxHeight={315}\n className=\"cim-combo-box-popover\"\n // Position popover relative to wrapper div instead of input to account for border\n triggerRef={triggerPositioningRef}\n data-experimental-cim-style-root\n >\n <RACListBox className=\"cim-combo-box-listbox\" items={options}>\n {renderOptions}\n </RACListBox>\n </RACPopover>\n </RACComboBox>\n );\n}\n\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxInput({\n isReadOnly,\n placeholder,\n}: {\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n}) {\n const comboBoxState = useContext(ComboBoxStateContext);\n\n return (\n <RACInput\n className={clsx('cim-combo-box-input', textStyle({ variant: 'medium' }))}\n // Ensure the popover opens when the input is clicked.\n // By default, React Aria only opens the popover when the input is focused.\n onClick={() => !isReadOnly && comboBoxState.open()}\n placeholder={placeholder}\n />\n );\n}\n\nfunction renderOptions(item: ComboBoxOption | ComboBoxOptionGroup) {\n if ('options' in item) {\n return (\n <ComboBoxSection id={item.id} title={item.label} items={item.options}>\n {(child) => (\n <ComboBoxItem id={child.id} isDisabled={child.isDisabled}>\n {child.label}\n </ComboBoxItem>\n )}\n </ComboBoxSection>\n );\n }\n\n return (\n <ComboBoxItem id={item.id} isDisabled={item.isDisabled}>\n {item.label}\n </ComboBoxItem>\n );\n}\n\ninterface ComboBoxItemProps<T extends object> extends Pick<RACListBoxItemProps<T>, 'id' | 'value' | 'isDisabled'> {\n children: string;\n}\n\nfunction ComboBoxItem<T extends object>({ children, ...props }: ComboBoxItemProps<T>) {\n return (\n <RACListBoxItem {...props} className={clsx('cim-combo-box-item', textStyle({ variant: 'medium' }))}>\n {children}\n </RACListBoxItem>\n );\n}\n\ninterface ComboBoxSectionProps<T extends object> {\n id: string;\n title: string;\n children: ReactNode | ((item: T) => ReactNode);\n items?: Iterable<T>;\n}\n\nfunction ComboBoxSection<T extends object>({ title, children, items, ...props }: ComboBoxSectionProps<T>) {\n return (\n <RACSection {...props} className=\"cim-combo-box-section\">\n <RACHeader className={clsx('cim-combo-box-header', textStyle({ variant: 'small', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACSection>\n );\n}\n\nfunction ChevronDownIcon(props: SVGAttributes<SVGSVGElement>) {\n return (\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 12\" fill=\"currentColor\" data-icon {...props}>\n <path d=\"M.124 3.603 5.617 9.84a.533.533 0 0 0 .769 0l5.49-6.236a.493.493 0 0 0-.054-.707l-.925-.778a.514.514 0 0 0-.719.055L6.095 6.9a.125.125 0 0 1-.189 0L1.822 2.173A.51.51 0 0 0 1.474 2a.5.5 0 0 0-.37.119l-.926.777a.494.494 0 0 0-.054.707Z\" />\n </svg>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../../../src/components/combo-box/combo-box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AA8Jb,oCAiBC;AAYD,0CAoBC;;AA7MD,gDAAwB;AACxB,iCAAyE;AACzE,iEAc+B;AAC/B,yDAAkD;AAClD,mDAA0E;AAC1E,mEAA2D;AAC3D,0FAAmF;AACnF,wEAA4G;AAS5G,qDAAmD;AA8BnD,SAAS,QAAQ,CACf,EACE,KAAK,EACL,WAAW,EACX,KAAK,EACL,KAAK,EACL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Ac,OAAK,KAAK,EAAE,SAAS,EAAC,oBAAoB,EAAC,SAAS,EAAE,SAAS,YAC3E,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CACnB,6DACE,uBAAC,wBAAa,KAAG,EAEjB,uBAAC,4BAAO,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,YACjG,QAAQ,GACD,IACT,CACJ,GACc,CAClB,CAAC;AACJ,CAAC;AAED,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAS1C,0DAA0D;AAC1D,SAAgB,eAAe,CAA2B,EACxD,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACgB;IACxB,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,CACL,wBAAC,sCAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,uBAAuB,aAC7D,uBAAC,8BAAS,IACR,SAAS,EAAE,IAAA,cAAI,EAAC,8BAA8B,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAExG,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useContext, useEffect, useRef, type ForwardedRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n ComboBox as RACComboBox,\n ComboBoxStateContext as RACComboBoxStateContext,\n Group as RACGroup,\n Header as RACHeader,\n Input as RACInput,\n ListBox as RACListBox,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n Text as RACText,\n type ComboBoxProps as RACComboBoxProps,\n type ListBoxItemProps as RACListBoxItemProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheckmark, IconChevronDownFill } from '../../icons/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type {\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldWithPlaceholderProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\n/** Represents the state of the `ComboBox` component for validation purposes. */\nexport interface ComboBoxValidationValue {\n /** The selected key in the ComboBox. */\n selectedKey: Key | null;\n /** The value of the ComboBox input. */\n inputValue: string;\n}\n\nexport interface ComboBoxProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldWithPlaceholderProps<ComboBoxValidationValue>,\n CollectionProps<T>,\n Pick<\n RACComboBoxProps<T>,\n | 'name'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'inputValue'\n | 'defaultInputValue'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'onInputChange'\n > {}\n\nfunction ComboBox<T extends CollectionItem>(\n {\n label,\n description,\n error,\n items,\n children,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n isReadOnly,\n ...props\n }: ComboBoxProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const triggerPositioningRef = useRef<HTMLDivElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useEffect(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('ComboBox requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (items != null && typeof children !== 'function') {\n console.warn('`ComboBox` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACComboBox\n {...props}\n ref={ref}\n className={clsx('cim-combo-box', UNSAFE_className)}\n style={UNSAFE_style}\n menuTrigger=\"focus\"\n isReadOnly={isReadOnly}\n data-readonly={isReadOnly ? true : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-combo-box-input-wrapper\" ref={triggerPositioningRef}>\n <ComboBoxInput isReadOnly={isReadOnly} placeholder={placeholder} />\n <RACButton className=\"cim-combo-box-button\">\n <IconChevronDownFill />\n </RACButton>\n </RACGroup>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n // Position the list relative to wrapper div instead of input to account for border\n triggerRef={triggerPositioningRef}\n widthCorrection={2} // React Aria calculates the width of the trigger based on the width of the input + button, so we need to add 2px to account for the border on `.cim-combo-box-input-wrapper`\n >\n <RACListBox className=\"cim-combo-box-listbox\" items={items}>\n {children}\n </RACListBox>\n </CollapsibleList>\n </RACComboBox>\n );\n}\n\n// TODO: add link to usage guidelines\n/** Allows users to filter a collapsible list and select one item from it. */\nconst _ComboBox = withStyleProps(forwardRef(ComboBox), 'ComboBox');\n\nexport { _ComboBox as ComboBox };\n\nfunction ComboBoxInput({\n isReadOnly,\n placeholder,\n}: {\n isReadOnly: boolean | undefined;\n placeholder: string | undefined;\n}) {\n const comboBoxState = useContext(RACComboBoxStateContext);\n\n return (\n <RACInput\n className={clsx('cim-combo-box-input', textStyle({ variant: 'medium' }))}\n // Ensure the popover opens when the input is clicked.\n // By default, React Aria only opens the popover when the input is focused.\n onClick={() => !isReadOnly && comboBoxState!.open()}\n placeholder={placeholder}\n />\n );\n}\n\nexport interface ComboBoxItemProps<T extends CollectionItem> extends Pick<RACListBoxItemProps<T>, 'id' | 'isDisabled'> {\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `ComboBox`. */\nexport function ComboBoxItem<T extends CollectionItem>({ children, ...props }: ComboBoxItemProps<T>) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-combo-box-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheckmark />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport interface ComboBoxSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `ComboBox` into a section. */\nexport function ComboBoxSection<T extends CollectionItem>({\n title,\n children,\n items,\n ...props\n}: ComboBoxSectionProps<T>) {\n if (items != null && typeof children !== 'function') {\n console.warn('`ComboBoxSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-combo-box-section\">\n <RACHeader\n className={clsx('cim-combo-box-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nComboBoxSection.displayName = 'ComboBoxSection';\n"]}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type FormProps as RACFormProps } from 'react-aria-components';
|
|
2
|
-
import type {
|
|
3
|
-
export interface FormProps extends
|
|
2
|
+
import type { CommonProps, LabellableProps } from '../types.js';
|
|
3
|
+
export interface FormProps extends CommonProps, Omit<LabellableProps, 'label'>, Pick<RACFormProps, 'action' | 'validationErrors' | 'encType' | 'method' | 'target' | 'autoComplete' | 'autoCapitalize' | 'children' | 'onSubmit' | 'onReset' | 'onInvalid'> {
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A group of inputs that allows users to submit data to a server.
|
|
7
|
+
*
|
|
8
|
+
* See [forms guide](https://ui.cimpress.io/dev-guides/forms/).
|
|
9
|
+
*/
|
|
10
|
+
declare const _Form: (props: FormProps & import("react").RefAttributes<HTMLFormElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
6
11
|
export { _Form as Form };
|
|
7
12
|
//# sourceMappingURL=form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/form.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/form.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGxF,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,SACf,SAAQ,WAAW,EACjB,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,EAC9B,IAAI,CACF,YAAY,EACV,QAAQ,GACR,kBAAkB,GAClB,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,CACd;CAAG;AAUR;;;;GAIG;AACH,QAAA,MAAM,KAAK,4JAA2C,CAAC;AAEvD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -12,6 +13,11 @@ const with_style_props_js_1 = require("../../with-style-props.js");
|
|
|
12
13
|
function Form({ children, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
13
14
|
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Form, { ...props, className: (0, clsx_1.default)('cim-form', UNSAFE_className), style: UNSAFE_style, ref: ref, children: children }));
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A group of inputs that allows users to submit data to a server.
|
|
18
|
+
*
|
|
19
|
+
* See [forms guide](https://ui.cimpress.io/dev-guides/forms/).
|
|
20
|
+
*/
|
|
15
21
|
const _Form = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Form), 'Form');
|
|
16
22
|
exports.Form = _Form;
|
|
17
23
|
//# sourceMappingURL=form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../../src/components/form/form.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../../src/components/form/form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AAExB,iEAAwF;AACxF,yDAAkD;AAClD,mEAA2D;AAqB3D,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAa,EAAE,GAAkC;IACjH,OAAO,CACL,uBAAC,4BAAO,OAAK,KAAK,EAAE,SAAS,EAAE,IAAA,cAAI,EAAC,UAAU,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,YAC7F,QAAQ,GACD,CACX,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,KAAK,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAErC,qBAAI","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport { Form as RACForm, type FormProps as RACFormProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps, LabellableProps } from '../types.js';\n\nexport interface FormProps\n extends CommonProps,\n Omit<LabellableProps, 'label'>,\n Pick<\n RACFormProps,\n | 'action'\n | 'validationErrors'\n | 'encType'\n | 'method'\n | 'target'\n | 'autoComplete'\n | 'autoCapitalize'\n | 'children'\n | 'onSubmit'\n | 'onReset'\n | 'onInvalid'\n > {}\n\nfunction Form({ children, UNSAFE_className, UNSAFE_style, ...props }: FormProps, ref: ForwardedRef<HTMLFormElement>) {\n return (\n <RACForm {...props} className={clsx('cim-form', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n {children}\n </RACForm>\n );\n}\n\n/**\n * A group of inputs that allows users to submit data to a server.\n *\n * See [forms guide](https://ui.cimpress.io/dev-guides/forms/).\n */\nconst _Form = withStyleProps(forwardRef(Form), 'Form');\n\nexport { _Form as Form };\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PopoverProps as RACPopoverProps } from 'react-aria-components';
|
|
2
|
+
interface CollapsibleListProps extends Pick<RACPopoverProps, 'placement' | 'offset' | 'maxHeight' | 'children' | 'triggerRef'> {
|
|
3
|
+
/** A correction amount (in px) to add to the minimum list width. */
|
|
4
|
+
widthCorrection?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Displays a collapsible list activated via a trigger element.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function CollapsibleList({ children, widthCorrection, ...props }: CollapsibleListProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare namespace CollapsibleList {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=collapsible-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-list.d.ts","sourceRoot":"","sources":["../../../../../src/components/internal/collapsible-list/collapsible-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,YAAY,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEpG,UAAU,oBACR,SAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;IAC/F,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,eAAmB,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAahG;yBAbe,eAAe"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollapsibleList = CollapsibleList;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
6
|
+
/**
|
|
7
|
+
* Displays a collapsible list activated via a trigger element.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
function CollapsibleList({ children, widthCorrection = 0, ...props }) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { ...props, className: "cim-collapsible-list",
|
|
13
|
+
// @ts-expect-error `style` doesn't expect CSS variables
|
|
14
|
+
style: { '--trigger-width-corr': `${widthCorrection}px` }, containerPadding: 16, "data-cim-style-root": true, children: children }));
|
|
15
|
+
}
|
|
16
|
+
CollapsibleList.displayName = 'CollapsibleList';
|
|
17
|
+
//# sourceMappingURL=collapsible-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible-list.js","sourceRoot":"","sources":["../../../../../src/components/internal/collapsible-list/collapsible-list.tsx"],"names":[],"mappings":";;AAaA,0CAaC;;AA1BD,iEAAoG;AAQpG;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC,EAAE,GAAG,KAAK,EAAwB;IAC/F,OAAO,CACL,uBAAC,+BAAU,OACL,KAAK,EACT,SAAS,EAAC,sBAAsB;QAChC,wDAAwD;QACxD,KAAK,EAAE,EAAE,sBAAsB,EAAE,GAAG,eAAe,IAAI,EAAE,EACzD,gBAAgB,EAAE,EAAE,yCAGnB,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC","sourcesContent":["import { Popover as RACPopover, type PopoverProps as RACPopoverProps } from 'react-aria-components';\n\ninterface CollapsibleListProps\n extends Pick<RACPopoverProps, 'placement' | 'offset' | 'maxHeight' | 'children' | 'triggerRef'> {\n /** A correction amount (in px) to add to the minimum list width. */\n widthCorrection?: number;\n}\n\n/**\n * Displays a collapsible list activated via a trigger element.\n *\n * @internal\n */\nexport function CollapsibleList({ children, widthCorrection = 0, ...props }: CollapsibleListProps) {\n return (\n <RACPopover\n {...props}\n className=\"cim-collapsible-list\"\n // @ts-expect-error `style` doesn't expect CSS variables\n style={{ '--trigger-width-corr': `${widthCorrection}px` }}\n containerPadding={16}\n data-cim-style-root\n >\n {children}\n </RACPopover>\n );\n}\n\nCollapsibleList.displayName = 'CollapsibleList';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FieldError } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a label for a form field.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function FormFieldLabel({ children, isRequired, isDisabled, }: {
|
|
7
|
+
children: string | undefined;
|
|
8
|
+
isRequired: boolean | undefined;
|
|
9
|
+
isDisabled?: boolean | undefined;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
/**
|
|
12
|
+
* Renders a description for a form field.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function FormFieldDescription({ children }: {
|
|
16
|
+
children: string | undefined;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
/**
|
|
19
|
+
* Renders an error message for a form field.
|
|
20
|
+
*
|
|
21
|
+
* Must be rendered unconditionally, as it can be populated with browser validation errors
|
|
22
|
+
* even if an explicit error message isn't provided.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function FormFieldError({ children }: {
|
|
27
|
+
children: FieldError;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=form-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["../../../../../src/components/internal/form-field/form-field.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClC,kDAiBA;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,kDAalF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,UAAU,CAAA;CAAE,2CAMpE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FormFieldLabel = FormFieldLabel;
|
|
7
|
+
exports.FormFieldDescription = FormFieldDescription;
|
|
8
|
+
exports.FormFieldError = FormFieldError;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
11
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
12
|
+
const index_js_1 = require("../../../icons/index.js");
|
|
13
|
+
const text_js_1 = require("../../typography/text.js");
|
|
14
|
+
const utils_js_1 = require("../../typography/utils.js");
|
|
15
|
+
/**
|
|
16
|
+
* Renders a label for a form field.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function FormFieldLabel({ children, isRequired, isDisabled, }) {
|
|
20
|
+
if (!children) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Label, { className: (0, clsx_1.default)('cim-form-field-label', (0, utils_js_1.textStyle)({ variant: 'medium', tone: isDisabled ? 'muted' : 'base' })), children: [children, isRequired && ((0, jsx_runtime_1.jsx)(text_js_1.Text, { tone: "critical", as: "span", "aria-hidden": true, children: "*" }))] }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Renders a description for a form field.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
function FormFieldDescription({ children }) {
|
|
30
|
+
if (!children) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "description", className: (0, clsx_1.default)('cim-form-field-description', (0, utils_js_1.textStyle)({ variant: 'small', tone: 'subtle' })), children: children }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Renders an error message for a form field.
|
|
37
|
+
*
|
|
38
|
+
* Must be rendered unconditionally, as it can be populated with browser validation errors
|
|
39
|
+
* even if an explicit error message isn't provided.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
function FormFieldError({ children }) {
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.FieldError, { className: (0, clsx_1.default)('cim-form-field-error', (0, utils_js_1.textStyle)({ variant: 'small', tone: 'critical' })), children: (validation) => renderFieldError(children, validation) }));
|
|
45
|
+
}
|
|
46
|
+
function renderFieldError(fieldError, validation) {
|
|
47
|
+
const errors = typeof fieldError === 'function' ? fieldError(validation) : (fieldError ?? validation.validationErrors);
|
|
48
|
+
if (!errors || !errors.length) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return typeof errors === 'object' ? (errors.map((error) => (0, jsx_runtime_1.jsx)(ErrorMessage, { message: error }, error))) : ((0, jsx_runtime_1.jsx)(ErrorMessage, { message: errors }));
|
|
52
|
+
}
|
|
53
|
+
function ErrorMessage({ message }) {
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "cim-form-field-error-message", children: [(0, jsx_runtime_1.jsx)("div", { className: "cim-form-field-error-icon-wrapper", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(index_js_1.IconAlertTriangle, {}) }), message] }));
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=form-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../../../src/components/internal/form-field/form-field.tsx"],"names":[],"mappings":";;;;;AAiBA,wCAyBC;AAMD,oDAaC;AAUD,wCAMC;;AA7ED,gDAAwB;AAExB,iEAK+B;AAC/B,sDAA4D;AAE5D,sDAAgD;AAChD,wDAAsD;AAEtD;;;GAGG;AACH,SAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,UAAU,EACV,UAAU,GAKX;IACC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,wBAAC,6BAAQ,IACP,SAAS,EAAE,IAAA,cAAI,EAAC,sBAAsB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,QAA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d,CAAC;IAED,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAClC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAC,YAAY,IAAa,OAAO,EAAE,KAAK,IAArB,KAAK,CAAoB,CAAC,CACpE,CAAC,CAAC,CAAC,CACF,uBAAC,YAAY,IAAC,OAAO,EAAE,MAAM,GAAI,CAClC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,OAAO,EAAuB;IACpD,OAAO,CACL,iCAAK,SAAS,EAAC,8BAA8B,aAC3C,gCAAK,SAAS,EAAC,mCAAmC,iCAChD,uBAAC,4BAAiB,KAAG,GACjB,EACL,OAAO,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { ReactNode } from 'react';\nimport {\n Label as RACLabel,\n Text as RACText,\n FieldError as RACFieldError,\n type ValidationResult as RACValidationResult,\n} from 'react-aria-components';\nimport { IconAlertTriangle } from '../../../icons/index.js';\nimport type { FieldError } from '../../types.js';\nimport { Text } from '../../typography/text.js';\nimport { textStyle } from '../../typography/utils.js';\n\n/**\n * Renders a label for a form field.\n * @internal\n */\nexport function FormFieldLabel({\n children,\n isRequired,\n isDisabled,\n}: {\n children: string | undefined;\n isRequired: boolean | undefined;\n isDisabled?: boolean | undefined;\n}) {\n if (!children) {\n return null;\n }\n\n return (\n <RACLabel\n className={clsx('cim-form-field-label', textStyle({ variant: 'medium', tone: isDisabled ? 'muted' : 'base' }))}\n >\n {children}\n {isRequired && (\n <Text tone=\"critical\" as=\"span\" aria-hidden>\n *\n </Text>\n )}\n </RACLabel>\n );\n}\n\n/**\n * Renders a description for a form field.\n * @internal\n */\nexport function FormFieldDescription({ children }: { children: string | undefined }) {\n if (!children) {\n return null;\n }\n\n return (\n <RACText\n slot=\"description\"\n className={clsx('cim-form-field-description', textStyle({ variant: 'small', tone: 'subtle' }))}\n >\n {children}\n </RACText>\n );\n}\n\n/**\n * Renders an error message for a form field.\n *\n * Must be rendered unconditionally, as it can be populated with browser validation errors\n * even if an explicit error message isn't provided.\n *\n * @internal\n */\nexport function FormFieldError({ children }: { children: FieldError }) {\n return (\n <RACFieldError className={clsx('cim-form-field-error', textStyle({ variant: 'small', tone: 'critical' }))}>\n {(validation) => renderFieldError(children, validation)}\n </RACFieldError>\n );\n}\n\nfunction renderFieldError(fieldError: FieldError, validation: RACValidationResult): string | ReactNode | undefined {\n const errors =\n typeof fieldError === 'function' ? fieldError(validation) : (fieldError ?? validation.validationErrors);\n\n if (!errors || !errors.length) {\n return null;\n }\n\n return typeof errors === 'object' ? (\n errors.map((error) => <ErrorMessage key={error} message={error} />)\n ) : (\n <ErrorMessage message={errors} />\n );\n}\n\nfunction ErrorMessage({ message }: { message: string }) {\n return (\n <div className=\"cim-form-field-error-message\">\n <div className=\"cim-form-field-error-icon-wrapper\" aria-hidden>\n <IconAlertTriangle />\n </div>\n {message}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
|
+
import type { CommonProps, LabellableProps } from '../../types.js';
|
|
3
|
+
interface SpinnerProps extends CommonProps, Omit<LabellableProps, 'label'> {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
spinnerRef?: Ref<HTMLDivElement>;
|
|
6
|
+
size: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Displays a variable-size loading indicator to represent an ongoing operation.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
declare function Spinner({ children, spinnerRef, size, UNSAFE_className, UNSAFE_style, ...props }: SpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare namespace Spinner {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export { Spinner as InternalSpinner };
|
|
18
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../../../src/components/internal/spinner/spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnE,UAAU,YAAa,SAAQ,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,iBAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAuBtG;kBAvBQ,OAAO;;;AA2BhB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.InternalSpinner = Spinner;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
9
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
10
|
+
/**
|
|
11
|
+
* Displays a variable-size loading indicator to represent an ongoing operation.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
function Spinner({ children, spinnerRef, size, UNSAFE_className, UNSAFE_style, ...props }) {
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.ProgressBar, { ...props, isIndeterminate: true, ref: spinnerRef, className: (0, clsx_1.default)('cim-spinner', UNSAFE_className), style: UNSAFE_style, children: [(0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 80 80", width: size, height: size, preserveAspectRatio: "xMidYMid", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { className: "cim-spinner-ring-bg", cx: "40", cy: "40", r: "35" }), (0, jsx_runtime_1.jsx)("circle", { className: "cim-spinner-ring-fg", cx: "40", cy: "40", r: "35" })] }), children] }));
|
|
17
|
+
}
|
|
18
|
+
Spinner.displayName = 'Spinner';
|
|
19
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../../../src/components/internal/spinner/spinner.tsx"],"names":[],"mappings":";;;;;AA2CoB,kCAAe;;AA3CnC,gDAAwB;AAExB,iEAAsE;AAStE;;;;GAIG;AACH,SAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAgB;IACrG,OAAO,CACL,wBAAC,mCAAc,OACT,KAAK,EACT,eAAe,QACf,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,IAAA,cAAI,EAAC,aAAa,EAAE,gBAAgB,CAAC,EAChD,KAAK,EAAE,YAAY,aAEnB,iCACE,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,mBAAmB,EAAC,UAAU,kCAG9B,mCAAQ,SAAS,EAAC,qBAAqB,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,GAAG,EACjE,mCAAQ,SAAS,EAAC,qBAAqB,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,GAAG,IAC7D,EACL,QAAQ,IACM,CAClB,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { ReactNode, Ref } from 'react';\nimport { ProgressBar as RACProgressBar } from 'react-aria-components';\nimport type { CommonProps, LabellableProps } from '../../types.js';\n\ninterface SpinnerProps extends CommonProps, Omit<LabellableProps, 'label'> {\n children?: ReactNode;\n spinnerRef?: Ref<HTMLDivElement>;\n size: string;\n}\n\n/**\n * Displays a variable-size loading indicator to represent an ongoing operation.\n *\n * @internal\n */\nfunction Spinner({ children, spinnerRef, size, UNSAFE_className, UNSAFE_style, ...props }: SpinnerProps) {\n return (\n <RACProgressBar\n {...props}\n isIndeterminate\n ref={spinnerRef}\n className={clsx('cim-spinner', UNSAFE_className)}\n style={UNSAFE_style}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 80 80\"\n width={size}\n height={size}\n preserveAspectRatio=\"xMidYMid\"\n aria-hidden\n >\n <circle className=\"cim-spinner-ring-bg\" cx=\"40\" cy=\"40\" r=\"35\" />\n <circle className=\"cim-spinner-ring-fg\" cx=\"40\" cy=\"40\" r=\"35\" />\n </svg>\n {children}\n </RACProgressBar>\n );\n}\n\nSpinner.displayName = 'Spinner';\n\nexport { Spinner as InternalSpinner };\n"]}
|
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type MenuItemProps as RACMenuItemProps } from 'react-aria-components';
|
|
3
|
-
import type {
|
|
4
|
-
export interface MenuProps extends
|
|
5
|
-
/**
|
|
6
|
-
|
|
3
|
+
import type { CommonProps, Key, LabellableProps, NavigationProps, CollectionProps, CollectionItem, StringLikeChildren } from '../types.js';
|
|
4
|
+
export interface MenuProps<T extends CollectionItem = CollectionItem> extends CommonProps, CollectionProps<T>, LabellableProps {
|
|
5
|
+
/** Whether the menu trigger is disabled. */
|
|
6
|
+
isDisabled?: boolean;
|
|
7
7
|
/** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */
|
|
8
8
|
onAction?: (key: Key) => void;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Displays a collapsible list of options and actions that users can choose from.
|
|
12
|
+
*
|
|
13
|
+
* See [menu usage guidelines](https://ui.cimpress.io/components/menu/usage-guidelines/).
|
|
14
|
+
*/
|
|
15
|
+
declare const _Menu: <T extends CollectionItem>(props: MenuProps<T> & import("react").RefAttributes<HTMLButtonElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
11
16
|
export { _Menu as Menu };
|
|
12
|
-
export interface MenuSectionProps {
|
|
17
|
+
export interface MenuSectionProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T> {
|
|
13
18
|
/** The ID of the section. Has to be unique across all sections and items. */
|
|
14
19
|
id?: Key;
|
|
15
20
|
/** The content to display as the section title. */
|
|
16
21
|
title: string;
|
|
17
|
-
/** The contents of the section. */
|
|
18
|
-
children: ReactNode;
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
/** Groups list items within `Menu` into a section. */
|
|
24
|
+
export declare function MenuSection<T extends CollectionItem>({ title, children, items, ...props }: MenuSectionProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
21
25
|
export declare namespace MenuSection {
|
|
22
26
|
var displayName: string;
|
|
23
27
|
}
|
|
24
|
-
export interface MenuItemProps extends Pick<RACMenuItemProps, 'isDisabled' | '
|
|
28
|
+
export interface MenuItemProps extends NavigationProps, Pick<RACMenuItemProps, 'isDisabled' | 'onAction'> {
|
|
25
29
|
/** The ID of the item. Has to be unique across all sections and items. */
|
|
26
30
|
id?: Key;
|
|
27
31
|
/** The content to display as the label. */
|
|
28
|
-
|
|
32
|
+
children: StringLikeChildren;
|
|
33
|
+
/** Additional description for the menu item. */
|
|
34
|
+
description?: string;
|
|
35
|
+
/** An icon representing the menu item. */
|
|
36
|
+
icon?: ReactNode;
|
|
29
37
|
}
|
|
30
|
-
|
|
38
|
+
/** Renders a single list item within `Menu`. */
|
|
39
|
+
export declare function MenuItem({ children, description, icon, ...props }: MenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
40
|
export declare namespace MenuItem {
|
|
32
41
|
var displayName: string;
|
|
33
42
|
}
|
|
34
|
-
|
|
35
|
-
export declare
|
|
43
|
+
/** Renders a horizontal divider between list items within `Menu`. */
|
|
44
|
+
export declare function MenuDivider(): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare namespace MenuDivider {
|
|
36
46
|
var displayName: string;
|
|
37
47
|
}
|
|
38
48
|
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAC;AAC/E,OAAO,EAIL,KAAK,aAAa,IAAI,gBAAgB,EAMvC,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EACV,WAAW,EACX,GAAG,EACH,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CAClE,SAAQ,WAAW,EACjB,eAAe,CAAC,CAAC,CAAC,EAClB,eAAe;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wHAAwH;IACxH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAC/B;AAkCD;;;;GAIG;AACH,QAAA,MAAM,KAAK,GArCG,CAAC,SAAS,cAAc,gKAqCgB,CAAC;AAEvD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,CAAC;AAmCz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