@cimpress-ui/react 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/commonjs/components/alert/alert.d.ts +25 -0
- package/dist/commonjs/components/alert/alert.d.ts.map +1 -0
- package/dist/commonjs/components/alert/alert.js +51 -0
- package/dist/commonjs/components/alert/alert.js.map +1 -0
- package/dist/commonjs/components/alert-dialog/alert-dialog.d.ts +51 -0
- package/dist/commonjs/components/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/commonjs/components/alert-dialog/alert-dialog.js +26 -0
- package/dist/commonjs/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/commonjs/components/app-header/app-header.d.ts +20 -0
- package/dist/commonjs/components/app-header/app-header.d.ts.map +1 -0
- package/dist/commonjs/components/app-header/app-header.js +26 -0
- package/dist/commonjs/components/app-header/app-header.js.map +1 -0
- package/dist/commonjs/components/app-header/cimpress-logo.d.ts +2 -0
- package/dist/commonjs/components/app-header/cimpress-logo.d.ts.map +1 -0
- package/dist/commonjs/components/app-header/cimpress-logo.js +9 -0
- package/dist/commonjs/components/app-header/cimpress-logo.js.map +1 -0
- package/dist/commonjs/components/app-header/simple-auth-tool.d.ts +29 -0
- package/dist/commonjs/components/app-header/simple-auth-tool.d.ts.map +1 -0
- package/dist/commonjs/components/app-header/simple-auth-tool.js +31 -0
- package/dist/commonjs/components/app-header/simple-auth-tool.js.map +1 -0
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.js +17 -1
- package/dist/commonjs/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/commonjs/components/button/button.d.ts.map +1 -1
- package/dist/commonjs/components/button/button.js +3 -3
- package/dist/commonjs/components/button/button.js.map +1 -1
- package/dist/commonjs/components/button/icon-button.d.ts.map +1 -1
- package/dist/commonjs/components/button/icon-button.js +3 -3
- package/dist/commonjs/components/button/icon-button.js.map +1 -1
- package/dist/commonjs/components/button/icon-link-button.js +1 -1
- package/dist/commonjs/components/button/icon-link-button.js.map +1 -1
- package/dist/commonjs/components/button/link-button.js +1 -1
- package/dist/commonjs/components/button/link-button.js.map +1 -1
- package/dist/commonjs/components/button/types.js.map +1 -1
- package/dist/commonjs/components/callout/callout.d.ts +27 -0
- package/dist/commonjs/components/callout/callout.d.ts.map +1 -0
- package/dist/commonjs/components/callout/callout.js +46 -0
- package/dist/commonjs/components/callout/callout.js.map +1 -0
- package/dist/commonjs/components/card/card.d.ts +51 -11
- package/dist/commonjs/components/card/card.d.ts.map +1 -1
- package/dist/commonjs/components/card/card.js +19 -13
- package/dist/commonjs/components/card/card.js.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox-group.d.ts +1 -1
- package/dist/commonjs/components/checkbox/checkbox-group.d.ts.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox-group.js +2 -2
- package/dist/commonjs/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js +3 -3
- package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts +7 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.js +15 -6
- package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
- package/dist/commonjs/components/container/container.d.ts +16 -0
- package/dist/commonjs/components/container/container.d.ts.map +1 -0
- package/dist/commonjs/components/container/container.js +13 -0
- package/dist/commonjs/components/container/container.js.map +1 -0
- package/dist/commonjs/components/date-picker/date-picker-calendar.d.ts +2 -0
- package/dist/commonjs/components/date-picker/date-picker-calendar.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/date-picker-calendar.js +26 -0
- package/dist/commonjs/components/date-picker/date-picker-calendar.js.map +1 -0
- package/dist/commonjs/components/date-picker/date-picker.d.ts +17 -0
- package/dist/commonjs/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/date-picker.js +54 -0
- package/dist/commonjs/components/date-picker/date-picker.js.map +1 -0
- package/dist/commonjs/components/date-picker/utils.d.ts +2 -0
- package/dist/commonjs/components/date-picker/utils.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/utils.js +31 -0
- package/dist/commonjs/components/date-picker/utils.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/month/month-view.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/month/month-view.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/month/month-view.js +35 -0
- package/dist/commonjs/components/date-picker/views/month/month-view.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/multi-year/multi-year-view.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/multi-year/multi-year-view.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/multi-year/multi-year-view.js +16 -0
- package/dist/commonjs/components/date-picker/views/multi-year/multi-year-view.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/multi-year/use-multi-year-view-state.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/multi-year/use-multi-year-view-state.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/multi-year/use-multi-year-view-state.js +130 -0
- package/dist/commonjs/components/date-picker/views/multi-year/use-multi-year-view-state.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/types.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/types.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/types.js +3 -0
- package/dist/commonjs/components/date-picker/views/types.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/use-view-header.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/use-view-header.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/use-view-header.js +56 -0
- package/dist/commonjs/components/date-picker/views/use-view-header.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/view-grid-cell.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/view-grid-cell.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/view-grid-cell.js +72 -0
- package/dist/commonjs/components/date-picker/views/view-grid-cell.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/view-grid.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/view-grid.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/view-grid.js +75 -0
- package/dist/commonjs/components/date-picker/views/view-grid.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/view-provider.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/view-provider.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/view-provider.js +21 -0
- package/dist/commonjs/components/date-picker/views/view-provider.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/year/use-year-view-state.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/year/use-year-view-state.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/year/use-year-view-state.js +158 -0
- package/dist/commonjs/components/date-picker/views/year/use-year-view-state.js.map +1 -0
- package/dist/commonjs/components/date-picker/views/year/year-view.d.ts +2 -0
- package/dist/commonjs/components/date-picker/views/year/year-view.d.ts.map +1 -0
- package/dist/commonjs/components/date-picker/views/year/year-view.js +20 -0
- package/dist/commonjs/components/date-picker/views/year/year-view.js.map +1 -0
- package/dist/commonjs/components/dialog-root/dialog-root.d.ts +20 -0
- package/dist/commonjs/components/dialog-root/dialog-root.d.ts.map +1 -0
- package/dist/commonjs/components/dialog-root/dialog-root.js +15 -0
- package/dist/commonjs/components/dialog-root/dialog-root.js.map +1 -0
- package/dist/commonjs/components/disclosure/context.d.ts +3 -0
- package/dist/commonjs/components/disclosure/context.d.ts.map +1 -0
- package/dist/commonjs/components/disclosure/context.js +7 -0
- package/dist/commonjs/components/disclosure/context.js.map +1 -0
- package/dist/commonjs/components/disclosure/disclosure-group.d.ts +15 -4
- package/dist/commonjs/components/disclosure/disclosure-group.d.ts.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure-group.js +11 -5
- package/dist/commonjs/components/disclosure/disclosure-group.js.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure.d.ts +35 -4
- package/dist/commonjs/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure.js +16 -5
- package/dist/commonjs/components/disclosure/disclosure.js.map +1 -1
- package/dist/commonjs/components/divider/divider.d.ts +12 -0
- package/dist/commonjs/components/divider/divider.d.ts.map +1 -0
- package/dist/commonjs/components/divider/divider.js +19 -0
- package/dist/commonjs/components/divider/divider.js.map +1 -0
- package/dist/commonjs/components/drawer/drawer.d.ts +81 -0
- package/dist/commonjs/components/drawer/drawer.d.ts.map +1 -0
- package/dist/commonjs/components/drawer/drawer.js +59 -0
- package/dist/commonjs/components/drawer/drawer.js.map +1 -0
- package/dist/commonjs/components/file-picker/file-picker.d.ts +19 -0
- package/dist/commonjs/components/file-picker/file-picker.d.ts.map +1 -0
- package/dist/commonjs/components/file-picker/file-picker.js +68 -0
- package/dist/commonjs/components/file-picker/file-picker.js.map +1 -0
- package/dist/commonjs/components/internal/form-field/form-field.js +1 -1
- package/dist/commonjs/components/internal/form-field/form-field.js.map +1 -1
- package/dist/commonjs/components/internal/x-button/x-button.d.ts +2 -0
- package/dist/commonjs/components/internal/x-button/x-button.d.ts.map +1 -0
- package/dist/commonjs/components/internal/x-button/x-button.js +17 -0
- package/dist/commonjs/components/internal/x-button/x-button.js.map +1 -0
- package/dist/commonjs/components/link-tabs/context.d.ts +2 -0
- package/dist/commonjs/components/link-tabs/context.d.ts.map +1 -0
- package/dist/commonjs/components/link-tabs/context.js +7 -0
- package/dist/commonjs/components/link-tabs/context.js.map +1 -0
- package/dist/commonjs/components/link-tabs/link-tabs.d.ts +36 -0
- package/dist/commonjs/components/link-tabs/link-tabs.d.ts.map +1 -0
- package/dist/commonjs/components/link-tabs/link-tabs.js +54 -0
- package/dist/commonjs/components/link-tabs/link-tabs.js.map +1 -0
- package/dist/commonjs/components/menu/menu.d.ts +3 -6
- package/dist/commonjs/components/menu/menu.d.ts.map +1 -1
- package/dist/commonjs/components/menu/menu.js +4 -9
- package/dist/commonjs/components/menu/menu.js.map +1 -1
- package/dist/commonjs/components/modal-dialog/modal-dialog.d.ts +63 -0
- package/dist/commonjs/components/modal-dialog/modal-dialog.d.ts.map +1 -0
- package/dist/commonjs/components/modal-dialog/modal-dialog.js +46 -0
- package/dist/commonjs/components/modal-dialog/modal-dialog.js.map +1 -0
- package/dist/commonjs/components/number-field/number-field.d.ts +1 -1
- package/dist/commonjs/components/number-field/number-field.d.ts.map +1 -1
- package/dist/commonjs/components/number-field/number-field.js +6 -4
- package/dist/commonjs/components/number-field/number-field.js.map +1 -1
- package/dist/commonjs/components/pagination/base-pagination.d.ts.map +1 -1
- package/dist/commonjs/components/pagination/base-pagination.js +9 -10
- package/dist/commonjs/components/pagination/base-pagination.js.map +1 -1
- package/dist/commonjs/components/pagination/pagination.d.ts.map +1 -1
- package/dist/commonjs/components/pagination/pagination.js +7 -5
- package/dist/commonjs/components/pagination/pagination.js.map +1 -1
- package/dist/commonjs/components/popover/popover.d.ts +7 -2
- package/dist/commonjs/components/popover/popover.d.ts.map +1 -1
- package/dist/commonjs/components/popover/popover.js +2 -2
- package/dist/commonjs/components/popover/popover.js.map +1 -1
- package/dist/commonjs/components/radio/radio-group.d.ts +1 -1
- package/dist/commonjs/components/radio/radio-group.d.ts.map +1 -1
- package/dist/commonjs/components/radio/radio-group.js +2 -2
- package/dist/commonjs/components/radio/radio-group.js.map +1 -1
- package/dist/commonjs/components/radio/radio.d.ts.map +1 -1
- package/dist/commonjs/components/radio/radio.js +3 -3
- package/dist/commonjs/components/radio/radio.js.map +1 -1
- package/dist/commonjs/components/select/select.d.ts +7 -1
- package/dist/commonjs/components/select/select.d.ts.map +1 -1
- package/dist/commonjs/components/select/select.js +14 -6
- package/dist/commonjs/components/select/select.js.map +1 -1
- package/dist/commonjs/components/spacing/stack/stack.d.ts +1 -1
- package/dist/commonjs/components/spacing/stack/stack.js +1 -1
- package/dist/commonjs/components/spacing/stack/stack.js.map +1 -1
- package/dist/commonjs/components/spacing/types.d.ts +1 -1
- package/dist/commonjs/components/spacing/types.d.ts.map +1 -1
- package/dist/commonjs/components/spacing/types.js +2 -2
- package/dist/commonjs/components/spacing/types.js.map +1 -1
- package/dist/commonjs/components/spinner/spinner.d.ts.map +1 -1
- package/dist/commonjs/components/spinner/spinner.js +3 -3
- package/dist/commonjs/components/spinner/spinner.js.map +1 -1
- package/dist/commonjs/components/table/contexts/column-collection.d.ts.map +1 -1
- package/dist/commonjs/components/table/contexts/column-collection.js +2 -0
- package/dist/commonjs/components/table/contexts/column-collection.js.map +1 -1
- package/dist/commonjs/components/table/contexts/table-state.d.ts +1 -0
- package/dist/commonjs/components/table/contexts/table-state.d.ts.map +1 -1
- package/dist/commonjs/components/table/contexts/table-state.js +6 -1
- package/dist/commonjs/components/table/contexts/table-state.js.map +1 -1
- package/dist/commonjs/components/table/hooks/use-table-cell.js +2 -2
- package/dist/commonjs/components/table/hooks/use-table-cell.js.map +1 -1
- package/dist/commonjs/components/table/table-empty-state.js +1 -1
- package/dist/commonjs/components/table/table-empty-state.js.map +1 -1
- package/dist/commonjs/components/table/table-header-button.d.ts +2 -0
- package/dist/commonjs/components/table/table-header-button.d.ts.map +1 -0
- package/dist/commonjs/components/table/table-header-button.js +16 -0
- package/dist/commonjs/components/table/table-header-button.js.map +1 -0
- package/dist/commonjs/components/table/table-header-cell.d.ts.map +1 -1
- package/dist/commonjs/components/table/table-header-cell.js +7 -5
- package/dist/commonjs/components/table/table-header-cell.js.map +1 -1
- package/dist/commonjs/components/table/table.d.ts +1 -1
- package/dist/commonjs/components/table/table.d.ts.map +1 -1
- package/dist/commonjs/components/table/table.js +2 -2
- package/dist/commonjs/components/table/table.js.map +1 -1
- package/dist/commonjs/components/tabs/tabs.d.ts +53 -0
- package/dist/commonjs/components/tabs/tabs.d.ts.map +1 -0
- package/dist/commonjs/components/tabs/tabs.js +69 -0
- package/dist/commonjs/components/tabs/tabs.js.map +1 -0
- package/dist/commonjs/components/tag/tag-group.d.ts +1 -1
- package/dist/commonjs/components/tag/tag-group.d.ts.map +1 -1
- package/dist/commonjs/components/tag/tag-group.js.map +1 -1
- package/dist/commonjs/components/tag/tag.js +1 -1
- package/dist/commonjs/components/tag/tag.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field-input.d.ts +2 -0
- package/dist/commonjs/components/tag-field/tag-field-input.d.ts.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field-input.js +30 -0
- package/dist/commonjs/components/tag-field/tag-field-input.js.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field-list-box.d.ts +2 -0
- package/dist/commonjs/components/tag-field/tag-field-list-box.d.ts.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field-list-box.js +38 -0
- package/dist/commonjs/components/tag-field/tag-field-list-box.js.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field-tags.d.ts +2 -0
- package/dist/commonjs/components/tag-field/tag-field-tags.d.ts.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field-tags.js +29 -0
- package/dist/commonjs/components/tag-field/tag-field-tags.js.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field.d.ts +51 -0
- package/dist/commonjs/components/tag-field/tag-field.d.ts.map +1 -0
- package/dist/commonjs/components/tag-field/tag-field.js +143 -0
- package/dist/commonjs/components/tag-field/tag-field.js.map +1 -0
- package/dist/commonjs/components/text-inputs/text-area.d.ts +1 -1
- package/dist/commonjs/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js +3 -3
- package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js +3 -3
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/components/toast/toast-region.d.ts +5 -0
- package/dist/commonjs/components/toast/toast-region.d.ts.map +1 -0
- package/dist/commonjs/components/toast/toast-region.js +24 -0
- package/dist/commonjs/components/toast/toast-region.js.map +1 -0
- package/dist/commonjs/components/toast/toast.d.ts +2 -0
- package/dist/commonjs/components/toast/toast.d.ts.map +1 -0
- package/dist/commonjs/components/toast/toast.js +24 -0
- package/dist/commonjs/components/toast/toast.js.map +1 -0
- package/dist/commonjs/components/toast/types.d.ts +5 -0
- package/dist/commonjs/components/toast/types.d.ts.map +1 -0
- package/dist/commonjs/components/toast/types.js +3 -0
- package/dist/commonjs/components/toast/types.js.map +1 -0
- package/dist/commonjs/components/toggle/toggle.d.ts +14 -0
- package/dist/commonjs/components/toggle/toggle.d.ts.map +1 -0
- package/dist/commonjs/components/toggle/toggle.js +32 -0
- package/dist/commonjs/components/toggle/toggle.js.map +1 -0
- package/dist/commonjs/components/toggle-button/toggle-button-group.d.ts +15 -0
- package/dist/commonjs/components/toggle-button/toggle-button-group.d.ts.map +1 -0
- package/dist/commonjs/components/toggle-button/toggle-button-group.js +30 -0
- package/dist/commonjs/components/toggle-button/toggle-button-group.js.map +1 -0
- package/dist/commonjs/components/toggle-button/toggle-button.d.ts +16 -0
- package/dist/commonjs/components/toggle-button/toggle-button.d.ts.map +1 -0
- package/dist/commonjs/components/toggle-button/toggle-button.js +24 -0
- package/dist/commonjs/components/toggle-button/toggle-button.js.map +1 -0
- package/dist/commonjs/components/toggle-button/toggle-icon-button.d.ts +14 -0
- package/dist/commonjs/components/toggle-button/toggle-icon-button.d.ts.map +1 -0
- package/dist/commonjs/components/toggle-button/toggle-icon-button.js +24 -0
- package/dist/commonjs/components/toggle-button/toggle-icon-button.js.map +1 -0
- package/dist/commonjs/components/tooltip/tooltip.d.ts +4 -2
- package/dist/commonjs/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/commonjs/components/tooltip/tooltip.js.map +1 -1
- package/dist/commonjs/components/types.d.ts +4 -0
- package/dist/commonjs/components/types.d.ts.map +1 -1
- package/dist/commonjs/components/types.js.map +1 -1
- package/dist/commonjs/components/typography/text.d.ts.map +1 -1
- package/dist/commonjs/date.d.ts +2 -0
- package/dist/commonjs/date.d.ts.map +1 -0
- package/dist/commonjs/date.js +27 -0
- package/dist/commonjs/date.js.map +1 -0
- package/dist/commonjs/i18n/index.d.ts +3 -0
- package/dist/commonjs/i18n/index.d.ts.map +1 -0
- package/dist/commonjs/i18n/index.js +19 -0
- package/dist/commonjs/i18n/index.js.map +1 -0
- package/dist/commonjs/i18n/localization-provider.d.ts +59 -0
- package/dist/commonjs/i18n/localization-provider.d.ts.map +1 -0
- package/dist/commonjs/i18n/localization-provider.js +82 -0
- package/dist/commonjs/i18n/localization-provider.js.map +1 -0
- package/dist/commonjs/i18n/messages/en-US.d.ts +4 -0
- package/dist/commonjs/i18n/messages/en-US.d.ts.map +1 -0
- package/dist/commonjs/i18n/messages/en-US.js +44 -0
- package/dist/commonjs/i18n/messages/en-US.js.map +1 -0
- package/dist/commonjs/i18n/messages/index.d.ts +3 -0
- package/dist/commonjs/i18n/messages/index.d.ts.map +1 -0
- package/dist/commonjs/i18n/messages/index.js +6 -0
- package/dist/commonjs/i18n/messages/index.js.map +1 -0
- package/dist/commonjs/i18n/messages/types.d.ts +82 -0
- package/dist/commonjs/i18n/messages/types.d.ts.map +1 -0
- package/dist/commonjs/i18n/messages/types.js +3 -0
- package/dist/commonjs/i18n/messages/types.js.map +1 -0
- package/dist/commonjs/icons/index.d.ts +1 -0
- package/dist/commonjs/icons/index.d.ts.map +1 -1
- package/dist/commonjs/icons/index.js +3 -1
- package/dist/commonjs/icons/index.js.map +1 -1
- package/dist/commonjs/icons/rating-star.d.ts +8 -0
- package/dist/commonjs/icons/rating-star.d.ts.map +1 -0
- package/dist/commonjs/icons/rating-star.js +24 -0
- package/dist/commonjs/icons/rating-star.js.map +1 -0
- package/dist/commonjs/index.d.ts +26 -5
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +24 -5
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/providers/ssr/ssr-provider.d.ts +1 -3
- package/dist/commonjs/providers/ssr/ssr-provider.d.ts.map +1 -1
- package/dist/commonjs/providers/ssr/ssr-provider.js +2 -2
- package/dist/commonjs/providers/ssr/ssr-provider.js.map +1 -1
- package/dist/commonjs/utils/is-production.d.ts +2 -0
- package/dist/commonjs/utils/is-production.d.ts.map +1 -0
- package/dist/commonjs/utils/is-production.js +7 -0
- package/dist/commonjs/utils/is-production.js.map +1 -0
- package/dist/commonjs/utils/style/types.d.ts +1 -1
- package/dist/commonjs/utils/style/types.d.ts.map +1 -1
- package/dist/commonjs/utils/style/types.js.map +1 -1
- package/dist/commonjs/utils/use-media-query.d.ts +2 -0
- package/dist/commonjs/utils/use-media-query.d.ts.map +1 -0
- package/dist/commonjs/utils/use-media-query.js +35 -0
- package/dist/commonjs/utils/use-media-query.js.map +1 -0
- package/dist/commonjs/utils/use-production-warning.d.ts +3 -0
- package/dist/commonjs/utils/use-production-warning.d.ts.map +1 -0
- package/dist/commonjs/utils/use-production-warning.js +7 -0
- package/dist/commonjs/utils/use-production-warning.js.map +1 -0
- package/dist/commonjs/with-style-props.d.ts.map +1 -1
- package/dist/esm/components/alert/alert.d.ts +25 -0
- package/dist/esm/components/alert/alert.d.ts.map +1 -0
- package/dist/esm/components/alert/alert.js +45 -0
- package/dist/esm/components/alert/alert.js.map +1 -0
- package/dist/esm/components/alert-dialog/alert-dialog.d.ts +51 -0
- package/dist/esm/components/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/esm/components/alert-dialog/alert-dialog.js +20 -0
- package/dist/esm/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/esm/components/app-header/app-header.d.ts +20 -0
- package/dist/esm/components/app-header/app-header.d.ts.map +1 -0
- package/dist/esm/components/app-header/app-header.js +20 -0
- package/dist/esm/components/app-header/app-header.js.map +1 -0
- package/dist/esm/components/app-header/cimpress-logo.d.ts +2 -0
- package/dist/esm/components/app-header/cimpress-logo.d.ts.map +1 -0
- package/dist/esm/components/app-header/cimpress-logo.js +6 -0
- package/dist/esm/components/app-header/cimpress-logo.js.map +1 -0
- package/dist/esm/components/app-header/simple-auth-tool.d.ts +29 -0
- package/dist/esm/components/app-header/simple-auth-tool.d.ts.map +1 -0
- package/dist/esm/components/app-header/simple-auth-tool.js +28 -0
- package/dist/esm/components/app-header/simple-auth-tool.js.map +1 -0
- package/dist/esm/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/dist/esm/components/breadcrumbs/breadcrumbs.js +18 -2
- package/dist/esm/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/dist/esm/components/button/button.d.ts.map +1 -1
- package/dist/esm/components/button/button.js +3 -3
- package/dist/esm/components/button/button.js.map +1 -1
- package/dist/esm/components/button/icon-button.d.ts.map +1 -1
- package/dist/esm/components/button/icon-button.js +3 -3
- package/dist/esm/components/button/icon-button.js.map +1 -1
- package/dist/esm/components/button/icon-link-button.js +1 -1
- package/dist/esm/components/button/icon-link-button.js.map +1 -1
- package/dist/esm/components/button/link-button.js +1 -1
- package/dist/esm/components/button/link-button.js.map +1 -1
- package/dist/esm/components/button/types.js.map +1 -1
- package/dist/esm/components/callout/callout.d.ts +27 -0
- package/dist/esm/components/callout/callout.d.ts.map +1 -0
- package/dist/esm/components/callout/callout.js +40 -0
- package/dist/esm/components/callout/callout.js.map +1 -0
- package/dist/esm/components/card/card.d.ts +51 -11
- package/dist/esm/components/card/card.d.ts.map +1 -1
- package/dist/esm/components/card/card.js +17 -12
- package/dist/esm/components/card/card.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.d.ts +1 -1
- package/dist/esm/components/checkbox/checkbox-group.d.ts.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.js +2 -2
- package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js +3 -3
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/combo-box/combo-box.d.ts +7 -1
- package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/esm/components/combo-box/combo-box.js +17 -8
- package/dist/esm/components/combo-box/combo-box.js.map +1 -1
- package/dist/esm/components/container/container.d.ts +16 -0
- package/dist/esm/components/container/container.d.ts.map +1 -0
- package/dist/esm/components/container/container.js +7 -0
- package/dist/esm/components/container/container.js.map +1 -0
- package/dist/esm/components/date-picker/date-picker-calendar.d.ts +2 -0
- package/dist/esm/components/date-picker/date-picker-calendar.d.ts.map +1 -0
- package/dist/esm/components/date-picker/date-picker-calendar.js +23 -0
- package/dist/esm/components/date-picker/date-picker-calendar.js.map +1 -0
- package/dist/esm/components/date-picker/date-picker.d.ts +17 -0
- package/dist/esm/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/esm/components/date-picker/date-picker.js +48 -0
- package/dist/esm/components/date-picker/date-picker.js.map +1 -0
- package/dist/esm/components/date-picker/utils.d.ts +2 -0
- package/dist/esm/components/date-picker/utils.d.ts.map +1 -0
- package/dist/esm/components/date-picker/utils.js +26 -0
- package/dist/esm/components/date-picker/utils.js.map +1 -0
- package/dist/esm/components/date-picker/views/month/month-view.d.ts +2 -0
- package/dist/esm/components/date-picker/views/month/month-view.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/month/month-view.js +29 -0
- package/dist/esm/components/date-picker/views/month/month-view.js.map +1 -0
- package/dist/esm/components/date-picker/views/multi-year/multi-year-view.d.ts +2 -0
- package/dist/esm/components/date-picker/views/multi-year/multi-year-view.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/multi-year/multi-year-view.js +13 -0
- package/dist/esm/components/date-picker/views/multi-year/multi-year-view.js.map +1 -0
- package/dist/esm/components/date-picker/views/multi-year/use-multi-year-view-state.d.ts +2 -0
- package/dist/esm/components/date-picker/views/multi-year/use-multi-year-view-state.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/multi-year/use-multi-year-view-state.js +127 -0
- package/dist/esm/components/date-picker/views/multi-year/use-multi-year-view-state.js.map +1 -0
- package/dist/esm/components/date-picker/views/types.d.ts +2 -0
- package/dist/esm/components/date-picker/views/types.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/types.js +2 -0
- package/dist/esm/components/date-picker/views/types.js.map +1 -0
- package/dist/esm/components/date-picker/views/use-view-header.d.ts +2 -0
- package/dist/esm/components/date-picker/views/use-view-header.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/use-view-header.js +53 -0
- package/dist/esm/components/date-picker/views/use-view-header.js.map +1 -0
- package/dist/esm/components/date-picker/views/view-grid-cell.d.ts +2 -0
- package/dist/esm/components/date-picker/views/view-grid-cell.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/view-grid-cell.js +66 -0
- package/dist/esm/components/date-picker/views/view-grid-cell.js.map +1 -0
- package/dist/esm/components/date-picker/views/view-grid.d.ts +2 -0
- package/dist/esm/components/date-picker/views/view-grid.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/view-grid.js +69 -0
- package/dist/esm/components/date-picker/views/view-grid.js.map +1 -0
- package/dist/esm/components/date-picker/views/view-provider.d.ts +2 -0
- package/dist/esm/components/date-picker/views/view-provider.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/view-provider.js +17 -0
- package/dist/esm/components/date-picker/views/view-provider.js.map +1 -0
- package/dist/esm/components/date-picker/views/year/use-year-view-state.d.ts +2 -0
- package/dist/esm/components/date-picker/views/year/use-year-view-state.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/year/use-year-view-state.js +155 -0
- package/dist/esm/components/date-picker/views/year/use-year-view-state.js.map +1 -0
- package/dist/esm/components/date-picker/views/year/year-view.d.ts +2 -0
- package/dist/esm/components/date-picker/views/year/year-view.d.ts.map +1 -0
- package/dist/esm/components/date-picker/views/year/year-view.js +17 -0
- package/dist/esm/components/date-picker/views/year/year-view.js.map +1 -0
- package/dist/esm/components/dialog-root/dialog-root.d.ts +20 -0
- package/dist/esm/components/dialog-root/dialog-root.d.ts.map +1 -0
- package/dist/esm/components/dialog-root/dialog-root.js +12 -0
- package/dist/esm/components/dialog-root/dialog-root.js.map +1 -0
- package/dist/esm/components/disclosure/context.d.ts +3 -0
- package/dist/esm/components/disclosure/context.d.ts.map +1 -0
- package/dist/esm/components/disclosure/context.js +4 -0
- package/dist/esm/components/disclosure/context.js.map +1 -0
- package/dist/esm/components/disclosure/disclosure-group.d.ts +15 -4
- package/dist/esm/components/disclosure/disclosure-group.d.ts.map +1 -1
- package/dist/esm/components/disclosure/disclosure-group.js +10 -4
- package/dist/esm/components/disclosure/disclosure-group.js.map +1 -1
- package/dist/esm/components/disclosure/disclosure.d.ts +35 -4
- package/dist/esm/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/esm/components/disclosure/disclosure.js +16 -5
- package/dist/esm/components/disclosure/disclosure.js.map +1 -1
- package/dist/esm/components/divider/divider.d.ts +12 -0
- package/dist/esm/components/divider/divider.d.ts.map +1 -0
- package/dist/esm/components/divider/divider.js +13 -0
- package/dist/esm/components/divider/divider.js.map +1 -0
- package/dist/esm/components/drawer/drawer.d.ts +81 -0
- package/dist/esm/components/drawer/drawer.d.ts.map +1 -0
- package/dist/esm/components/drawer/drawer.js +50 -0
- package/dist/esm/components/drawer/drawer.js.map +1 -0
- package/dist/esm/components/file-picker/file-picker.d.ts +19 -0
- package/dist/esm/components/file-picker/file-picker.d.ts.map +1 -0
- package/dist/esm/components/file-picker/file-picker.js +62 -0
- package/dist/esm/components/file-picker/file-picker.js.map +1 -0
- package/dist/esm/components/internal/form-field/form-field.js +1 -1
- package/dist/esm/components/internal/form-field/form-field.js.map +1 -1
- package/dist/esm/components/internal/x-button/x-button.d.ts +2 -0
- package/dist/esm/components/internal/x-button/x-button.d.ts.map +1 -0
- package/dist/esm/components/internal/x-button/x-button.js +11 -0
- package/dist/esm/components/internal/x-button/x-button.js.map +1 -0
- package/dist/esm/components/link-tabs/context.d.ts +2 -0
- package/dist/esm/components/link-tabs/context.d.ts.map +1 -0
- package/dist/esm/components/link-tabs/context.js +4 -0
- package/dist/esm/components/link-tabs/context.js.map +1 -0
- package/dist/esm/components/link-tabs/link-tabs.d.ts +36 -0
- package/dist/esm/components/link-tabs/link-tabs.d.ts.map +1 -0
- package/dist/esm/components/link-tabs/link-tabs.js +47 -0
- package/dist/esm/components/link-tabs/link-tabs.js.map +1 -0
- package/dist/esm/components/menu/menu.d.ts +3 -6
- package/dist/esm/components/menu/menu.d.ts.map +1 -1
- package/dist/esm/components/menu/menu.js +5 -9
- package/dist/esm/components/menu/menu.js.map +1 -1
- package/dist/esm/components/modal-dialog/modal-dialog.d.ts +63 -0
- package/dist/esm/components/modal-dialog/modal-dialog.d.ts.map +1 -0
- package/dist/esm/components/modal-dialog/modal-dialog.js +38 -0
- package/dist/esm/components/modal-dialog/modal-dialog.js.map +1 -0
- package/dist/esm/components/number-field/number-field.d.ts +1 -1
- package/dist/esm/components/number-field/number-field.d.ts.map +1 -1
- package/dist/esm/components/number-field/number-field.js +5 -3
- package/dist/esm/components/number-field/number-field.js.map +1 -1
- package/dist/esm/components/pagination/base-pagination.d.ts.map +1 -1
- package/dist/esm/components/pagination/base-pagination.js +6 -7
- package/dist/esm/components/pagination/base-pagination.js.map +1 -1
- package/dist/esm/components/pagination/pagination.d.ts.map +1 -1
- package/dist/esm/components/pagination/pagination.js +7 -5
- package/dist/esm/components/pagination/pagination.js.map +1 -1
- package/dist/esm/components/popover/popover.d.ts +7 -2
- package/dist/esm/components/popover/popover.d.ts.map +1 -1
- package/dist/esm/components/popover/popover.js +2 -2
- package/dist/esm/components/popover/popover.js.map +1 -1
- package/dist/esm/components/radio/radio-group.d.ts +1 -1
- package/dist/esm/components/radio/radio-group.d.ts.map +1 -1
- package/dist/esm/components/radio/radio-group.js +2 -2
- package/dist/esm/components/radio/radio-group.js.map +1 -1
- package/dist/esm/components/radio/radio.d.ts.map +1 -1
- package/dist/esm/components/radio/radio.js +3 -3
- package/dist/esm/components/radio/radio.js.map +1 -1
- package/dist/esm/components/select/select.d.ts +7 -1
- package/dist/esm/components/select/select.d.ts.map +1 -1
- package/dist/esm/components/select/select.js +15 -7
- package/dist/esm/components/select/select.js.map +1 -1
- package/dist/esm/components/spacing/stack/stack.d.ts +1 -1
- package/dist/esm/components/spacing/stack/stack.js +1 -1
- package/dist/esm/components/spacing/stack/stack.js.map +1 -1
- package/dist/esm/components/spacing/types.d.ts +1 -1
- package/dist/esm/components/spacing/types.d.ts.map +1 -1
- package/dist/esm/components/spacing/types.js +2 -2
- package/dist/esm/components/spacing/types.js.map +1 -1
- package/dist/esm/components/spinner/spinner.d.ts.map +1 -1
- package/dist/esm/components/spinner/spinner.js +3 -3
- package/dist/esm/components/spinner/spinner.js.map +1 -1
- package/dist/esm/components/table/contexts/column-collection.d.ts.map +1 -1
- package/dist/esm/components/table/contexts/column-collection.js +2 -0
- package/dist/esm/components/table/contexts/column-collection.js.map +1 -1
- package/dist/esm/components/table/contexts/table-state.d.ts +1 -0
- package/dist/esm/components/table/contexts/table-state.d.ts.map +1 -1
- package/dist/esm/components/table/contexts/table-state.js +8 -3
- package/dist/esm/components/table/contexts/table-state.js.map +1 -1
- package/dist/esm/components/table/hooks/use-table-cell.js +2 -2
- package/dist/esm/components/table/hooks/use-table-cell.js.map +1 -1
- package/dist/esm/components/table/table-empty-state.js +1 -1
- package/dist/esm/components/table/table-empty-state.js.map +1 -1
- package/dist/esm/components/table/table-header-button.d.ts +2 -0
- package/dist/esm/components/table/table-header-button.d.ts.map +1 -0
- package/dist/esm/components/table/table-header-button.js +10 -0
- package/dist/esm/components/table/table-header-button.js.map +1 -0
- package/dist/esm/components/table/table-header-cell.d.ts.map +1 -1
- package/dist/esm/components/table/table-header-cell.js +9 -7
- package/dist/esm/components/table/table-header-cell.js.map +1 -1
- package/dist/esm/components/table/table.d.ts +1 -1
- package/dist/esm/components/table/table.d.ts.map +1 -1
- package/dist/esm/components/table/table.js +2 -2
- package/dist/esm/components/table/table.js.map +1 -1
- package/dist/esm/components/tabs/tabs.d.ts +53 -0
- package/dist/esm/components/tabs/tabs.d.ts.map +1 -0
- package/dist/esm/components/tabs/tabs.js +59 -0
- package/dist/esm/components/tabs/tabs.js.map +1 -0
- package/dist/esm/components/tag/tag-group.d.ts +1 -1
- package/dist/esm/components/tag/tag-group.d.ts.map +1 -1
- package/dist/esm/components/tag/tag-group.js.map +1 -1
- package/dist/esm/components/tag/tag.js +1 -1
- package/dist/esm/components/tag/tag.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field-input.d.ts +2 -0
- package/dist/esm/components/tag-field/tag-field-input.d.ts.map +1 -0
- package/dist/esm/components/tag-field/tag-field-input.js +24 -0
- package/dist/esm/components/tag-field/tag-field-input.js.map +1 -0
- package/dist/esm/components/tag-field/tag-field-list-box.d.ts +2 -0
- package/dist/esm/components/tag-field/tag-field-list-box.d.ts.map +1 -0
- package/dist/esm/components/tag-field/tag-field-list-box.js +35 -0
- package/dist/esm/components/tag-field/tag-field-list-box.js.map +1 -0
- package/dist/esm/components/tag-field/tag-field-tags.d.ts +2 -0
- package/dist/esm/components/tag-field/tag-field-tags.d.ts.map +1 -0
- package/dist/esm/components/tag-field/tag-field-tags.js +26 -0
- package/dist/esm/components/tag-field/tag-field-tags.js.map +1 -0
- package/dist/esm/components/tag-field/tag-field.d.ts +51 -0
- package/dist/esm/components/tag-field/tag-field.d.ts.map +1 -0
- package/dist/esm/components/tag-field/tag-field.js +135 -0
- package/dist/esm/components/tag-field/tag-field.js.map +1 -0
- package/dist/esm/components/text-inputs/text-area.d.ts +1 -1
- package/dist/esm/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-area.js +3 -3
- package/dist/esm/components/text-inputs/text-area.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js +3 -3
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/components/toast/toast-region.d.ts +5 -0
- package/dist/esm/components/toast/toast-region.d.ts.map +1 -0
- package/dist/esm/components/toast/toast-region.js +20 -0
- package/dist/esm/components/toast/toast-region.js.map +1 -0
- package/dist/esm/components/toast/toast.d.ts +2 -0
- package/dist/esm/components/toast/toast.d.ts.map +1 -0
- package/dist/esm/components/toast/toast.js +21 -0
- package/dist/esm/components/toast/toast.js.map +1 -0
- package/dist/esm/components/toast/types.d.ts +5 -0
- package/dist/esm/components/toast/types.d.ts.map +1 -0
- package/dist/esm/components/toast/types.js +2 -0
- package/dist/esm/components/toast/types.js.map +1 -0
- package/dist/esm/components/toggle/toggle.d.ts +14 -0
- package/dist/esm/components/toggle/toggle.d.ts.map +1 -0
- package/dist/esm/components/toggle/toggle.js +26 -0
- package/dist/esm/components/toggle/toggle.js.map +1 -0
- package/dist/esm/components/toggle-button/toggle-button-group.d.ts +15 -0
- package/dist/esm/components/toggle-button/toggle-button-group.d.ts.map +1 -0
- package/dist/esm/components/toggle-button/toggle-button-group.js +24 -0
- package/dist/esm/components/toggle-button/toggle-button-group.js.map +1 -0
- package/dist/esm/components/toggle-button/toggle-button.d.ts +16 -0
- package/dist/esm/components/toggle-button/toggle-button.d.ts.map +1 -0
- package/dist/esm/components/toggle-button/toggle-button.js +18 -0
- package/dist/esm/components/toggle-button/toggle-button.js.map +1 -0
- package/dist/esm/components/toggle-button/toggle-icon-button.d.ts +14 -0
- package/dist/esm/components/toggle-button/toggle-icon-button.d.ts.map +1 -0
- package/dist/esm/components/toggle-button/toggle-icon-button.js +18 -0
- package/dist/esm/components/toggle-button/toggle-icon-button.js.map +1 -0
- package/dist/esm/components/tooltip/tooltip.d.ts +4 -2
- package/dist/esm/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/esm/components/tooltip/tooltip.js.map +1 -1
- package/dist/esm/components/types.d.ts +4 -0
- package/dist/esm/components/types.d.ts.map +1 -1
- package/dist/esm/components/types.js.map +1 -1
- package/dist/esm/components/typography/text.d.ts.map +1 -1
- package/dist/esm/date.d.ts +2 -0
- package/dist/esm/date.d.ts.map +1 -0
- package/dist/esm/date.js +11 -0
- package/dist/esm/date.js.map +1 -0
- package/dist/esm/i18n/index.d.ts +3 -0
- package/dist/esm/i18n/index.d.ts.map +1 -0
- package/dist/esm/i18n/index.js +3 -0
- package/dist/esm/i18n/index.js.map +1 -0
- package/dist/esm/i18n/localization-provider.d.ts +59 -0
- package/dist/esm/i18n/localization-provider.d.ts.map +1 -0
- package/dist/esm/i18n/localization-provider.js +76 -0
- package/dist/esm/i18n/localization-provider.js.map +1 -0
- package/dist/esm/i18n/messages/en-US.d.ts +4 -0
- package/dist/esm/i18n/messages/en-US.d.ts.map +1 -0
- package/dist/esm/i18n/messages/en-US.js +41 -0
- package/dist/esm/i18n/messages/en-US.js.map +1 -0
- package/dist/esm/i18n/messages/index.d.ts +3 -0
- package/dist/esm/i18n/messages/index.d.ts.map +1 -0
- package/dist/esm/i18n/messages/index.js +2 -0
- package/dist/esm/i18n/messages/index.js.map +1 -0
- package/dist/esm/i18n/messages/types.d.ts +82 -0
- package/dist/esm/i18n/messages/types.d.ts.map +1 -0
- package/dist/esm/i18n/messages/types.js +2 -0
- package/dist/esm/i18n/messages/types.js.map +1 -0
- package/dist/esm/icons/index.d.ts +1 -0
- package/dist/esm/icons/index.d.ts.map +1 -1
- package/dist/esm/icons/index.js +1 -0
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/icons/rating-star.d.ts +8 -0
- package/dist/esm/icons/rating-star.d.ts.map +1 -0
- package/dist/esm/icons/rating-star.js +19 -0
- package/dist/esm/icons/rating-star.js.map +1 -0
- package/dist/esm/index.d.ts +26 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +24 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/ssr/ssr-provider.d.ts +1 -3
- package/dist/esm/providers/ssr/ssr-provider.d.ts.map +1 -1
- package/dist/esm/providers/ssr/ssr-provider.js +3 -3
- package/dist/esm/providers/ssr/ssr-provider.js.map +1 -1
- package/dist/esm/utils/is-production.d.ts +2 -0
- package/dist/esm/utils/is-production.d.ts.map +1 -0
- package/dist/esm/utils/is-production.js +4 -0
- package/dist/esm/utils/is-production.js.map +1 -0
- package/dist/esm/utils/style/types.d.ts +1 -1
- package/dist/esm/utils/style/types.d.ts.map +1 -1
- package/dist/esm/utils/style/types.js.map +1 -1
- package/dist/esm/utils/use-media-query.d.ts +2 -0
- package/dist/esm/utils/use-media-query.d.ts.map +1 -0
- package/dist/esm/utils/use-media-query.js +32 -0
- package/dist/esm/utils/use-media-query.js.map +1 -0
- package/dist/esm/utils/use-production-warning.d.ts +3 -0
- package/dist/esm/utils/use-production-warning.d.ts.map +1 -0
- package/dist/esm/utils/use-production-warning.js +4 -0
- package/dist/esm/utils/use-production-warning.js.map +1 -0
- package/dist/esm/with-style-props.d.ts.map +1 -1
- package/dist-styles/core.css +1 -1
- package/dist-styles/normalize.css +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +64 -20
- package/dist/commonjs/components/card/card-context.d.ts +0 -4
- package/dist/commonjs/components/card/card-context.d.ts.map +0 -1
- package/dist/commonjs/components/card/card-context.js +0 -6
- package/dist/commonjs/components/card/card-context.js.map +0 -1
- package/dist/commonjs/components/modal/modal.d.ts +0 -64
- package/dist/commonjs/components/modal/modal.d.ts.map +0 -1
- package/dist/commonjs/components/modal/modal.js +0 -40
- package/dist/commonjs/components/modal/modal.js.map +0 -1
- package/dist/commonjs/components/nav-tabs/nav-tabs.d.ts +0 -23
- package/dist/commonjs/components/nav-tabs/nav-tabs.d.ts.map +0 -1
- package/dist/commonjs/components/nav-tabs/nav-tabs.js +0 -27
- package/dist/commonjs/components/nav-tabs/nav-tabs.js.map +0 -1
- package/dist/esm/components/card/card-context.d.ts +0 -4
- package/dist/esm/components/card/card-context.d.ts.map +0 -1
- package/dist/esm/components/card/card-context.js +0 -3
- package/dist/esm/components/card/card-context.js.map +0 -1
- package/dist/esm/components/modal/modal.d.ts +0 -64
- package/dist/esm/components/modal/modal.d.ts.map +0 -1
- package/dist/esm/components/modal/modal.js +0 -33
- package/dist/esm/components/modal/modal.js.map +0 -1
- package/dist/esm/components/nav-tabs/nav-tabs.d.ts +0 -23
- package/dist/esm/components/nav-tabs/nav-tabs.d.ts.map +0 -1
- package/dist/esm/components/nav-tabs/nav-tabs.js +0 -20
- package/dist/esm/components/nav-tabs/nav-tabs.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getLocalTimeZone, toCalendarDate, today } from '@internationalized/date';
|
|
3
|
+
import { useContext, useState } from 'react';
|
|
4
|
+
import { Calendar as RACCalendar, DatePickerStateContext as RACDatePickerStateContext, } from 'react-aria-components';
|
|
5
|
+
import { MonthView } from './views/month/month-view.js';
|
|
6
|
+
import { MultiYearView } from './views/multi-year/multi-year-view.js';
|
|
7
|
+
import { DatePickerViewProvider } from './views/view-provider.js';
|
|
8
|
+
import { YearView } from './views/year/year-view.js';
|
|
9
|
+
/** @internal */
|
|
10
|
+
export function DatePickerCalendar({ focusedValue, defaultFocusedValue, placeholderValue, }) {
|
|
11
|
+
const datePickerState = useContext(RACDatePickerStateContext);
|
|
12
|
+
const [view, setView] = useState('month');
|
|
13
|
+
const [focusedDate, setFocusedDate] = useState(() => toCalendarDate(focusedValue ?? datePickerState?.value ?? defaultFocusedValue ?? placeholderValue ?? today(getLocalTimeZone())));
|
|
14
|
+
// `RACCalendar` has to be rendered unconditionally so that we have access to the calendar state.
|
|
15
|
+
// However, `RACCalendar` assumes that it's always displaying the month view, and keeps announcing the focused day to screen readers on every change.
|
|
16
|
+
// To prevent this, we control the focused date in `RACCalendar` with a separate state that isn't updated when the month view is hidden.
|
|
17
|
+
const [monthViewFocusedDate, setMonthViewFocusedDate] = useState(focusedDate);
|
|
18
|
+
return (_jsx(DatePickerViewProvider, { currentView: view, switchToView: setView, focusedDate: focusedDate, setFocusedDate: setFocusedDate, children: _jsx(RACCalendar, { focusedValue: view === 'month' ? focusedDate : monthViewFocusedDate, onFocusChange: (date) => {
|
|
19
|
+
setMonthViewFocusedDate(date);
|
|
20
|
+
setFocusedDate(date);
|
|
21
|
+
}, children: view === 'month' ? (_jsx(MonthView, {})) : view === 'year' ? (_jsx(YearView, {})) : view === 'multi-year' ? (_jsx(MultiYearView, {})) : (`Unsupported view '${view}'`) }) }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=date-picker-calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker-calendar.js","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker-calendar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,gBAAgB,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EACL,QAAQ,IAAI,WAAW,EAIvB,sBAAsB,IAAI,yBAAyB,GACpD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAuB,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAMrD,gBAAgB;AAChB,MAAM,UAAU,kBAAkB,CAAyB,EACzD,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACW;IAC3B,MAAM,eAAe,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAC9D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAiB,OAAO,CAAC,CAAC;IAC1D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAe,GAAG,EAAE,CAChE,cAAc,CACZ,YAAY,IAAI,eAAe,EAAE,KAAK,IAAI,mBAAmB,IAAI,gBAAgB,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAC/G,CACF,CAAC;IAEF,iGAAiG;IACjG,qJAAqJ;IACrJ,wIAAwI;IACxI,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAe,WAAW,CAAC,CAAC;IAE5F,OAAO,CACL,KAAC,sBAAsB,IACrB,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,OAAO,EACrB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,YAE9B,KAAC,WAAW,IACV,YAAY,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB,EACnE,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;gBACtB,uBAAuB,CAAC,IAAI,CAAC,CAAC;gBAC9B,cAAc,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC,YAEA,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAClB,KAAC,SAAS,KAAG,CACd,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACpB,KAAC,QAAQ,KAAG,CACb,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAC1B,KAAC,aAAa,KAAG,CAClB,CAAC,CAAC,CAAC,CACF,qBAAqB,IAAI,GAAG,CAC7B,GACW,GACS,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import { type CalendarDate, getLocalTimeZone, toCalendarDate, today } from '@internationalized/date';\nimport { useContext, useState } from 'react';\nimport {\n Calendar as RACCalendar,\n type CalendarProps as RACCalendarProps,\n type DateValue as RACDateValue,\n type DatePickerProps as RACDatePickerProps,\n DatePickerStateContext as RACDatePickerStateContext,\n} from 'react-aria-components';\nimport { MonthView } from './views/month/month-view.js';\nimport { MultiYearView } from './views/multi-year/multi-year-view.js';\nimport { type DatePickerView, DatePickerViewProvider } from './views/view-provider.js';\nimport { YearView } from './views/year/year-view.js';\n\ninterface DatePickerCalendarProps<T extends RACDateValue>\n extends Pick<RACDatePickerProps<T>, 'placeholderValue'>,\n Pick<RACCalendarProps<T>, 'focusedValue' | 'defaultFocusedValue'> {}\n\n/** @internal */\nexport function DatePickerCalendar<T extends RACDateValue>({\n focusedValue,\n defaultFocusedValue,\n placeholderValue,\n}: DatePickerCalendarProps<T>) {\n const datePickerState = useContext(RACDatePickerStateContext);\n const [view, setView] = useState<DatePickerView>('month');\n const [focusedDate, setFocusedDate] = useState<CalendarDate>(() =>\n toCalendarDate(\n focusedValue ?? datePickerState?.value ?? defaultFocusedValue ?? placeholderValue ?? today(getLocalTimeZone()),\n ),\n );\n\n // `RACCalendar` has to be rendered unconditionally so that we have access to the calendar state.\n // However, `RACCalendar` assumes that it's always displaying the month view, and keeps announcing the focused day to screen readers on every change.\n // To prevent this, we control the focused date in `RACCalendar` with a separate state that isn't updated when the month view is hidden.\n const [monthViewFocusedDate, setMonthViewFocusedDate] = useState<CalendarDate>(focusedDate);\n\n return (\n <DatePickerViewProvider\n currentView={view}\n switchToView={setView}\n focusedDate={focusedDate}\n setFocusedDate={setFocusedDate}\n >\n <RACCalendar\n focusedValue={view === 'month' ? focusedDate : monthViewFocusedDate}\n onFocusChange={(date) => {\n setMonthViewFocusedDate(date);\n setFocusedDate(date);\n }}\n >\n {view === 'month' ? (\n <MonthView />\n ) : view === 'year' ? (\n <YearView />\n ) : view === 'multi-year' ? (\n <MultiYearView />\n ) : (\n `Unsupported view '${view}'`\n )}\n </RACCalendar>\n </DatePickerViewProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CalendarDate, CalendarDateTime, ZonedDateTime } from '@internationalized/date';
|
|
2
|
+
import { type CalendarProps as RACCalendarProps, type DatePickerProps as RACDatePickerProps } from 'react-aria-components';
|
|
3
|
+
import type { CommonProps, FieldProps } from '../types.js';
|
|
4
|
+
/** Represents a date with optional time and timezone components. */
|
|
5
|
+
export type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
|
|
6
|
+
/** Maps a date value to a specific subtype depending on which components it contains. */
|
|
7
|
+
export type MappedDateValue<T> = T extends ZonedDateTime ? ZonedDateTime : T extends CalendarDateTime ? CalendarDateTime : T extends CalendarDate ? CalendarDate : never;
|
|
8
|
+
export interface DatePickerProps<T extends DateValue> extends CommonProps, FieldProps<MappedDateValue<T>>, Pick<RACDatePickerProps<T>, 'value' | 'defaultValue' | 'placeholderValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'autoFocus' | 'onFocus' | 'onBlur' | 'isOpen' | 'defaultOpen' | 'onOpenChange' | 'minValue' | 'maxValue' | 'isDateUnavailable' | 'granularity' | 'firstDayOfWeek'>, Pick<RACCalendarProps<T>, 'focusedValue' | 'defaultFocusedValue'> {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Allows users to enter or select a date and time value.
|
|
12
|
+
*
|
|
13
|
+
* See [date picker usage guidelines](https://ui.cimpress.io/components/date-picker/).
|
|
14
|
+
*/
|
|
15
|
+
declare const _DatePicker: <T extends DateValue>(props: DatePickerProps<T> & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
16
|
+
export { _DatePicker as DatePicker };
|
|
17
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7F,OAAO,EACL,KAAK,aAAa,IAAI,gBAAgB,EAGtC,KAAK,eAAe,IAAI,kBAAkB,EAM3C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3D,oEAAoE;AACpE,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAExE,yFAAyF;AACzF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,GACpD,aAAa,GACb,CAAC,SAAS,gBAAgB,GACxB,gBAAgB,GAChB,CAAC,SAAS,YAAY,GACpB,YAAY,GACZ,KAAK,CAAC;AAEd,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,SAAS,CAClD,SAAQ,WAAW,EACjB,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAC9B,IAAI,CACF,kBAAkB,CAAC,CAAC,CAAC,EACnB,OAAO,GACP,cAAc,GACd,kBAAkB,GAClB,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,cAAc,GACd,UAAU,GACV,UAAU,GACV,mBAAmB,GACnB,aAAa,GACb,gBAAgB,CACnB,EACD,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,cAAc,GAAG,qBAAqB,CAAC;CAAG;AAqExE;;;;GAIG;AACH,QAAA,MAAM,WAAW,GAxEG,CAAC,SAAS,SAAS,mKAwEiC,CAAC;AAEzE,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useContext } from 'react';
|
|
5
|
+
import { DateInput as RACDateInput, DatePicker as RACDatePicker, DatePickerStateContext as RACDatePickerStateContext, DateSegment as RACDateSegment, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover, } from 'react-aria-components';
|
|
6
|
+
import { forwardRef } from '../../forward-ref.js';
|
|
7
|
+
import { useLocalizedMessages } from '../../i18n/index.js';
|
|
8
|
+
import { IconCalendarEmpty } from '../../icons/index.js';
|
|
9
|
+
import { useProductionWarning } from '../../utils/use-production-warning.js';
|
|
10
|
+
import { withStyleProps } from '../../with-style-props.js';
|
|
11
|
+
import { IconButton } from '../button/icon-button.js';
|
|
12
|
+
import { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';
|
|
13
|
+
import { textStyle } from '../typography/utils.js';
|
|
14
|
+
import { DatePickerCalendar } from './date-picker-calendar.js';
|
|
15
|
+
function DatePicker({ label, description, error: errorMessage, focusedValue, defaultFocusedValue, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
16
|
+
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
17
|
+
useProductionWarning(() => {
|
|
18
|
+
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
19
|
+
console.warn('DatePicker requires one of label / aria-label / aria-labelledby for accessibility');
|
|
20
|
+
}
|
|
21
|
+
}, [label, ariaLabel, ariaLabelledBy]);
|
|
22
|
+
const messages = useLocalizedMessages('datePicker');
|
|
23
|
+
return (_jsxs(RACDatePicker, { ...props, ref: ref, className: clsx('cim-date-picker', UNSAFE_className), style: UNSAFE_style, children: [_jsx(FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-date-picker-input-group", "data-readonly": props.isReadOnly || undefined, children: [_jsx(RACDateInput, { className: clsx('cim-date-picker-input', textStyle({ variant: 'body' })), children: (segment) => (_jsx("span", { className: "cim-date-picker-segment-wrapper", children: _jsx(RACDateSegment, { segment: segment }) })) }), _jsxs("div", { className: "cim-date-picker-input-controls", children: [_jsx(DatePickerClearButton, { isDisabled: props.isDisabled || props.isReadOnly }), _jsx(IconButton, { icon: _jsx(IconCalendarEmpty, {}), "aria-label": messages.format('openCalendar'), variant: "tertiary", size: "small" })] })] }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description }), _jsx(RACPopover, { className: "cim-date-picker-popover", placement: "bottom end", offset: 5, containerPadding: 16, "data-cim-style-root": true, children: _jsx(RACDialog, { children: _jsx(DatePickerCalendar, { focusedValue: focusedValue, defaultFocusedValue: defaultFocusedValue, placeholderValue: props.placeholderValue }) }) })] }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Allows users to enter or select a date and time value.
|
|
27
|
+
*
|
|
28
|
+
* See [date picker usage guidelines](https://ui.cimpress.io/components/date-picker/).
|
|
29
|
+
*/
|
|
30
|
+
const _DatePicker = withStyleProps(forwardRef(DatePicker), 'DatePicker');
|
|
31
|
+
export { _DatePicker as DatePicker };
|
|
32
|
+
function DatePickerClearButton({ isDisabled }) {
|
|
33
|
+
const datePickerState = useContext(RACDatePickerStateContext);
|
|
34
|
+
const messages = useLocalizedMessages('datePicker');
|
|
35
|
+
if (!datePickerState.value) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return (_jsx(IconButton
|
|
39
|
+
// Don't inherit default Button behavior from DatePicker
|
|
40
|
+
, {
|
|
41
|
+
// Don't inherit default Button behavior from DatePicker
|
|
42
|
+
slot: null, UNSAFE_className: "cim-date-picker-clear", "aria-label": messages.format('clearValue'), onPress: () => datePickerState.setValue(null), icon: _jsx(IconCloseDetached, {}), variant: "tertiary", size: "small", isDisabled: isDisabled }));
|
|
43
|
+
}
|
|
44
|
+
// TODO: use one of our standard icons instead of this custom one
|
|
45
|
+
function IconCloseDetached() {
|
|
46
|
+
return (_jsx("svg", { viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg", className: "cim-icon", fill: "currentcolor", "data-icon": true, children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.21967 0.21967C0.512563 -0.0732233 0.987437 -0.0732233 1.28033 0.21967L6 4.93934L10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967C12.0732 0.512563 12.0732 0.987437 11.7803 1.28033L7.06066 6L11.7803 10.7197C12.0732 11.0126 12.0732 11.4874 11.7803 11.7803C11.4874 12.0732 11.0126 12.0732 10.7197 11.7803L6 7.06066L1.28033 11.7803C0.987437 12.0732 0.512563 12.0732 0.21967 11.7803C-0.0732233 11.4874 -0.0732233 11.0126 0.21967 10.7197L4.93934 6L0.21967 1.28033C-0.0732233 0.987437 -0.0732233 0.512563 0.21967 0.21967Z" }) }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AACtD,OAAO,EAEL,SAAS,IAAI,YAAY,EACzB,UAAU,IAAI,aAAa,EAE3B,sBAAsB,IAAI,yBAAyB,EACnD,WAAW,IAAI,cAAc,EAC7B,MAAM,IAAI,SAAS,EACnB,KAAK,IAAI,QAAQ,EACjB,OAAO,IAAI,UAAU,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE5G,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BA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iB,KAAG,EAC3B,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,EACZ,UAAU,EAAE,UAAU,GACtB,CACH,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,SAAS,iBAAiB;IACxB,OAAO,CACL,cAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,cAAc,+BAClG,eACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,2hBAA2hB,GAC7hB,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { CalendarDate, CalendarDateTime, ZonedDateTime } from '@internationalized/date';\nimport clsx from 'clsx';\nimport { useContext, type ForwardedRef } from 'react';\nimport {\n type CalendarProps as RACCalendarProps,\n DateInput as RACDateInput,\n DatePicker as RACDatePicker,\n type DatePickerProps as RACDatePickerProps,\n DatePickerStateContext as RACDatePickerStateContext,\n DateSegment as RACDateSegment,\n Dialog as RACDialog,\n Group as RACGroup,\n Popover as RACPopover,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCalendarEmpty } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\nimport { DatePickerCalendar } from './date-picker-calendar.js';\n\n/** Represents a date with optional time and timezone components. */\nexport type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;\n\n/** Maps a date value to a specific subtype depending on which components it contains. */\nexport type MappedDateValue<T> = T extends ZonedDateTime\n ? ZonedDateTime\n : T extends CalendarDateTime\n ? CalendarDateTime\n : T extends CalendarDate\n ? CalendarDate\n : never;\n\nexport interface DatePickerProps<T extends DateValue>\n extends CommonProps,\n FieldProps<MappedDateValue<T>>,\n Pick<\n RACDatePickerProps<T>,\n | 'value'\n | 'defaultValue'\n | 'placeholderValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'onFocus'\n | 'onBlur'\n | 'isOpen'\n | 'defaultOpen'\n | 'onOpenChange'\n | 'minValue'\n | 'maxValue'\n | 'isDateUnavailable'\n | 'granularity'\n | 'firstDayOfWeek'\n >,\n Pick<RACCalendarProps<T>, 'focusedValue' | 'defaultFocusedValue'> {}\n\nfunction DatePicker<T extends DateValue>(\n {\n label,\n description,\n error: errorMessage,\n focusedValue,\n defaultFocusedValue,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: DatePickerProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('DatePicker requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('datePicker');\n\n return (\n <RACDatePicker {...props} ref={ref} className={clsx('cim-date-picker', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-date-picker-input-group\" data-readonly={props.isReadOnly || undefined}>\n <RACDateInput className={clsx('cim-date-picker-input', textStyle({ variant: 'body' }))}>\n {(segment) => (\n <span className=\"cim-date-picker-segment-wrapper\">\n <RACDateSegment segment={segment} />\n </span>\n )}\n </RACDateInput>\n <div className=\"cim-date-picker-input-controls\">\n <DatePickerClearButton isDisabled={props.isDisabled || props.isReadOnly} />\n <IconButton\n icon={<IconCalendarEmpty />}\n aria-label={messages.format('openCalendar')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <RACPopover\n className=\"cim-date-picker-popover\"\n placement=\"bottom end\"\n offset={5} // 1px border + 4px actual offset\n containerPadding={16}\n data-cim-style-root\n >\n <RACDialog>\n <DatePickerCalendar<T>\n focusedValue={focusedValue}\n defaultFocusedValue={defaultFocusedValue}\n placeholderValue={props.placeholderValue}\n />\n </RACDialog>\n </RACPopover>\n </RACDatePicker>\n );\n}\n\n/**\n * Allows users to enter or select a date and time value.\n *\n * See [date picker usage guidelines](https://ui.cimpress.io/components/date-picker/).\n */\nconst _DatePicker = withStyleProps(forwardRef(DatePicker), 'DatePicker');\n\nexport { _DatePicker as DatePicker };\n\nfunction DatePickerClearButton({ isDisabled }: { isDisabled: boolean | undefined }) {\n const datePickerState = useContext(RACDatePickerStateContext)!;\n const messages = useLocalizedMessages('datePicker');\n\n if (!datePickerState.value) {\n return null;\n }\n\n return (\n <IconButton\n // Don't inherit default Button behavior from DatePicker\n slot={null}\n UNSAFE_className=\"cim-date-picker-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => datePickerState.setValue(null)}\n icon={<IconCloseDetached />}\n variant=\"tertiary\"\n size=\"small\"\n isDisabled={isDisabled}\n />\n );\n}\n\n// TODO: use one of our standard icons instead of this custom one\nfunction IconCloseDetached() {\n return (\n <svg viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg\" className=\"cim-icon\" fill=\"currentcolor\" data-icon>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0.21967 0.21967C0.512563 -0.0732233 0.987437 -0.0732233 1.28033 0.21967L6 4.93934L10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967C12.0732 0.512563 12.0732 0.987437 11.7803 1.28033L7.06066 6L11.7803 10.7197C12.0732 11.0126 12.0732 11.4874 11.7803 11.7803C11.4874 12.0732 11.0126 12.0732 10.7197 11.7803L6 7.06066L1.28033 11.7803C0.987437 12.0732 0.512563 12.0732 0.21967 11.7803C-0.0732233 11.4874 -0.0732233 11.0126 0.21967 10.7197L4.93934 6L0.21967 1.28033C-0.0732233 0.987437 -0.0732233 0.512563 0.21967 0.21967Z\"\n />\n </svg>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/date-picker/utils.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { maxDate, minDate, toCalendarDate } from '@internationalized/date';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export function getEraFormat(date) {
|
|
4
|
+
return date?.calendar.identifier === 'gregory' && date.era === 'BC' ? 'short' : undefined;
|
|
5
|
+
}
|
|
6
|
+
/** @internal */
|
|
7
|
+
export function isDateInvalid(date, minValue, maxValue) {
|
|
8
|
+
return (minValue != null && date.compare(minValue) < 0) || (maxValue != null && date.compare(maxValue) > 0);
|
|
9
|
+
}
|
|
10
|
+
/** @internal */
|
|
11
|
+
export function constrainValue(date, minValue, maxValue) {
|
|
12
|
+
if (minValue) {
|
|
13
|
+
const newDate = maxDate(date, toCalendarDate(minValue));
|
|
14
|
+
if (newDate) {
|
|
15
|
+
date = newDate;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (maxValue) {
|
|
19
|
+
const newDate = minDate(date, toCalendarDate(maxValue));
|
|
20
|
+
if (newDate) {
|
|
21
|
+
date = newDate;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return date;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/date-picker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAqC,MAAM,yBAAyB,CAAC;AAO9G,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAC,IAA8B;IACzD,OAAO,IAAI,EAAE,QAAQ,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5F,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,IAAe,EAAE,QAA2B,EAAE,QAA2B;IACrG,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9G,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,cAAc,CAC5B,IAAkB,EAClB,QAA2B,EAC3B,QAA2B;IAE3B,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,GAAG,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { maxDate, minDate, toCalendarDate, type CalendarDate, type DateValue } from '@internationalized/date';\nimport type { Context } from 'react';\nimport type { CalendarStateContext as RACCalendarStateContext } from 'react-aria-components';\n\n/** @internal */\nexport type CalendarState = typeof RACCalendarStateContext extends Context<infer R> ? NonNullable<R> : never;\n\n/** @internal */\nexport function getEraFormat(date: CalendarDate | undefined): 'short' | undefined {\n return date?.calendar.identifier === 'gregory' && date.era === 'BC' ? 'short' : undefined;\n}\n\n/** @internal */\nexport function isDateInvalid(date: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean {\n return (minValue != null && date.compare(minValue) < 0) || (maxValue != null && date.compare(maxValue) > 0);\n}\n\n/** @internal */\nexport function constrainValue(\n date: CalendarDate,\n minValue?: DateValue | null,\n maxValue?: DateValue | null,\n): CalendarDate {\n if (minValue) {\n const newDate = maxDate(date, toCalendarDate(minValue));\n if (newDate) {\n date = newDate;\n }\n }\n\n if (maxValue) {\n const newDate = minDate(date, toCalendarDate(maxValue));\n if (newDate) {\n date = newDate;\n }\n }\n\n return date;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"month-view.d.ts","sourceRoot":"","sources":["../../../../../../src/components/date-picker/views/month/month-view.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { isToday } from '@internationalized/date';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useContext, useEffect } from 'react';
|
|
5
|
+
import { CalendarCell as RACCalendarCell, CalendarGrid as RACCalendarGrid, CalendarGridBody as RACCalendarGridBody, CalendarGridHeader as RACCalendarGridHeader, CalendarHeaderCell as RACCalendarHeaderCell, CalendarStateContext as RACCalendarStateContext, HeadingContext as RACHeadingContext, } from 'react-aria-components';
|
|
6
|
+
import { useLocalizedMessages } from '../../../../i18n/index.js';
|
|
7
|
+
import { IconChevronLeft, IconChevronRight } from '../../../../icons/index.js';
|
|
8
|
+
import { Button } from '../../../button/button.js';
|
|
9
|
+
import { IconButton } from '../../../button/icon-button.js';
|
|
10
|
+
import { textStyle } from '../../../typography/utils.js';
|
|
11
|
+
import { useDatePickerView } from './../view-provider.js';
|
|
12
|
+
/** @internal */
|
|
13
|
+
export function MonthView() {
|
|
14
|
+
const state = useContext(RACCalendarStateContext);
|
|
15
|
+
const {
|
|
16
|
+
// @ts-expect-error RACHeadingContext contains a `children` property, but it's not in the types
|
|
17
|
+
children: title, } = useContext(RACHeadingContext);
|
|
18
|
+
const { switchToView } = useDatePickerView();
|
|
19
|
+
const messages = useLocalizedMessages('datePicker');
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
state?.setFocused(true);
|
|
22
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
|
+
}, []);
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "cim-date-picker-view-header", children: [_jsx(IconButton, { slot: "previous", "aria-label": messages.format('previousMonth'), icon: _jsx(IconChevronLeft, {}), variant: "tertiary", size: "small" }), _jsx(Button, { slot: null, "aria-label": messages.format('switchToYearView'), variant: "tertiary", onPress: () => switchToView('year'), children: title }), _jsx(IconButton, { slot: "next", "aria-label": messages.format('nextMonth'), icon: _jsx(IconChevronRight, {}), variant: "tertiary", size: "small" })] }), _jsxs(RACCalendarGrid, { className: "cim-date-picker-view-grid", weekdayStyle: "narrow", children: [_jsx(RACCalendarGridHeader, { children: (day) => (_jsx(RACCalendarHeaderCell, { children: _jsx("div", { className: clsx('cim-date-picker-calendar-header-cell', textStyle({ variant: 'medium-semibold', tone: 'base' })), children: day }) })) }), _jsx(RACCalendarGridBody, { children: (date) => {
|
|
25
|
+
const isCurrentDate = isToday(date, state.timeZone);
|
|
26
|
+
return (_jsx(RACCalendarCell, { className: clsx('cim-date-picker-calendar-cell', textStyle({ variant: isCurrentDate ? 'medium-semibold' : 'medium' })), date: date, "data-current": isCurrentDate || undefined }));
|
|
27
|
+
} })] })] }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=month-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"month-view.js","sourceRoot":"","sources":["../../../../../../src/components/date-picker/views/month/month-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,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day } from '@internationalized/date';\nimport clsx from 'clsx';\nimport { useContext, useEffect } from 'react';\nimport {\n CalendarCell as RACCalendarCell,\n CalendarGrid as RACCalendarGrid,\n CalendarGridBody as RACCalendarGridBody,\n CalendarGridHeader as RACCalendarGridHeader,\n CalendarHeaderCell as RACCalendarHeaderCell,\n CalendarStateContext as RACCalendarStateContext,\n HeadingContext as RACHeadingContext,\n} from 'react-aria-components';\nimport { useLocalizedMessages } from '../../../../i18n/index.js';\nimport { IconChevronLeft, IconChevronRight } from '../../../../icons/index.js';\nimport { Button } from '../../../button/button.js';\nimport { IconButton } from '../../../button/icon-button.js';\nimport { textStyle } from '../../../typography/utils.js';\nimport { useDatePickerView } from './../view-provider.js';\n\n/** @internal */\nexport function MonthView() {\n const state = useContext(RACCalendarStateContext);\n const {\n // @ts-expect-error RACHeadingContext contains a `children` property, but it's not in the types\n children: title,\n } = useContext(RACHeadingContext);\n const { switchToView } = useDatePickerView();\n const messages = useLocalizedMessages('datePicker');\n\n useEffect(() => {\n state?.setFocused(true);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <>\n <div className=\"cim-date-picker-view-header\">\n <IconButton\n slot=\"previous\"\n aria-label={messages.format('previousMonth')}\n icon={<IconChevronLeft />}\n variant=\"tertiary\"\n size=\"small\"\n />\n\n <Button\n slot={null}\n aria-label={messages.format('switchToYearView')}\n variant=\"tertiary\"\n onPress={() => switchToView('year')}\n >\n {title}\n </Button>\n\n <IconButton\n slot=\"next\"\n aria-label={messages.format('nextMonth')}\n icon={<IconChevronRight />}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n\n <RACCalendarGrid className=\"cim-date-picker-view-grid\" weekdayStyle=\"narrow\">\n <RACCalendarGridHeader>\n {(day) => (\n <RACCalendarHeaderCell>\n <div\n className={clsx(\n 'cim-date-picker-calendar-header-cell',\n textStyle({ variant: 'medium-semibold', tone: 'base' }),\n )}\n >\n {day}\n </div>\n </RACCalendarHeaderCell>\n )}\n </RACCalendarGridHeader>\n <RACCalendarGridBody>\n {(date) => {\n const isCurrentDate = isToday(date, state!.timeZone);\n\n return (\n <RACCalendarCell\n className={clsx(\n 'cim-date-picker-calendar-cell',\n textStyle({ variant: isCurrentDate ? 'medium-semibold' : 'medium' }),\n )}\n date={date}\n data-current={isCurrentDate || undefined}\n />\n );\n }}\n </RACCalendarGridBody>\n </RACCalendarGrid>\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-year-view.d.ts","sourceRoot":"","sources":["../../../../../../src/components/date-picker/views/multi-year/multi-year-view.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton } from '../../../button/icon-button.js';
|
|
3
|
+
import { Text } from '../../../typography/text.js';
|
|
4
|
+
import { useViewHeader } from '../use-view-header.js';
|
|
5
|
+
import { ViewGrid } from '../view-grid.js';
|
|
6
|
+
import { useMultiYearViewState } from './use-multi-year-view-state.js';
|
|
7
|
+
/** @internal */
|
|
8
|
+
export function MultiYearView() {
|
|
9
|
+
const state = useMultiYearViewState();
|
|
10
|
+
const { nextButtonProps, prevButtonProps } = useViewHeader(state);
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "cim-date-picker-view-header", children: [_jsx(IconButton, { slot: null, ...prevButtonProps }), _jsx(Text, { as: "span", variant: "title-6", tone: "base", children: state.header }), _jsx(IconButton, { slot: null, ...nextButtonProps })] }), _jsx(ViewGrid, { state: state, className: "cim-date-picker-view-grid-multi-year" })] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=multi-year-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-year-view.js","sourceRoot":"","sources":["../../../../../../src/components/date-picker/views/multi-year/multi-year-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,gBAAgB;AAChB,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;IACtC,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAElE,OAAO,CACL,8BACE,eAAK,SAAS,EAAC,6BAA6B,aAC1C,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,KAAM,eAAe,GAAI,EAE/C,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,MAAM,YAC1C,KAAK,CAAC,MAAM,GACR,EAEP,KAAC,UAAU,IAAC,IAAI,EAAE,IAAI,KAAM,eAAe,GAAI,IAC3C,EAEN,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,sCAAsC,GAAG,IAC1E,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { IconButton } from '../../../button/icon-button.js';\nimport { Text } from '../../../typography/text.js';\nimport { useViewHeader } from '../use-view-header.js';\nimport { ViewGrid } from '../view-grid.js';\nimport { useMultiYearViewState } from './use-multi-year-view-state.js';\n\n/** @internal */\nexport function MultiYearView() {\n const state = useMultiYearViewState();\n const { nextButtonProps, prevButtonProps } = useViewHeader(state);\n\n return (\n <>\n <div className=\"cim-date-picker-view-header\">\n <IconButton slot={null} {...prevButtonProps} />\n\n <Text as=\"span\" variant=\"title-6\" tone=\"base\">\n {state.header}\n </Text>\n\n <IconButton slot={null} {...nextButtonProps} />\n </div>\n\n <ViewGrid state={state} className=\"cim-date-picker-view-grid-multi-year\" />\n </>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-multi-year-view-state.d.ts","sourceRoot":"","sources":["../../../../../../src/components/date-picker/views/multi-year/use-multi-year-view-state.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { endOfYear, isSameDay, isSameYear, startOfYear, today } from '@internationalized/date';
|
|
2
|
+
import { useContext, useMemo, useState } from 'react';
|
|
3
|
+
import { useDateFormatter } from 'react-aria';
|
|
4
|
+
import { CalendarStateContext as RACCalendarStateContext } from 'react-aria-components';
|
|
5
|
+
import { useLocalizedMessages } from '../../../../i18n/index.js';
|
|
6
|
+
import { constrainValue, getEraFormat, isDateInvalid } from '../../utils.js';
|
|
7
|
+
import { useDatePickerView } from '../view-provider.js';
|
|
8
|
+
const ITEMS_PER_ROW = 4;
|
|
9
|
+
const YEARS_PER_SECTION = 20;
|
|
10
|
+
const YEARS_SKIP_AMOUNT = 100;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export function useMultiYearViewState() {
|
|
13
|
+
const calendarState = useContext(RACCalendarStateContext);
|
|
14
|
+
const { switchToView, focusedDate, setFocusedDate } = useDatePickerView();
|
|
15
|
+
const messages = useLocalizedMessages('datePicker');
|
|
16
|
+
const [isFocused, setIsFocused] = useState(true);
|
|
17
|
+
const currentDate = useMemo(() => today(calendarState.timeZone), [calendarState.timeZone]);
|
|
18
|
+
const yearFormatter = useDateFormatter({
|
|
19
|
+
year: 'numeric',
|
|
20
|
+
era: getEraFormat(focusedDate),
|
|
21
|
+
calendar: focusedDate.calendar.identifier,
|
|
22
|
+
timeZone: calendarState.timeZone,
|
|
23
|
+
});
|
|
24
|
+
let startYear = (Math.ceil(focusedDate.year / YEARS_PER_SECTION) - 1) * YEARS_PER_SECTION + 1;
|
|
25
|
+
let endYear = startYear + YEARS_PER_SECTION - 1;
|
|
26
|
+
// Years are always represented by positive numbers.
|
|
27
|
+
// If era implies negative years, flip start and end.
|
|
28
|
+
const isNegativeEra = focusedDate.era === 'BC';
|
|
29
|
+
if (isNegativeEra) {
|
|
30
|
+
const temp = startYear;
|
|
31
|
+
startYear = endYear;
|
|
32
|
+
endYear = temp;
|
|
33
|
+
}
|
|
34
|
+
const data = useMemo(() => {
|
|
35
|
+
const rowCount = Math.ceil(YEARS_PER_SECTION / ITEMS_PER_ROW);
|
|
36
|
+
const result = new Array(rowCount);
|
|
37
|
+
for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
|
38
|
+
result[rowIdx] = new Array(ITEMS_PER_ROW).fill(null);
|
|
39
|
+
}
|
|
40
|
+
for (let yearIdx = 0; yearIdx < YEARS_PER_SECTION; yearIdx++) {
|
|
41
|
+
const rowIdx = Math.floor(yearIdx / ITEMS_PER_ROW);
|
|
42
|
+
const colIdx = yearIdx % ITEMS_PER_ROW;
|
|
43
|
+
const yearToSet = startYear + (isNegativeEra ? -yearIdx : yearIdx);
|
|
44
|
+
const date = focusedDate.set({ year: yearToSet });
|
|
45
|
+
if (date.year !== yearToSet) {
|
|
46
|
+
// Reached minimum/maximum date
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const content = yearFormatter.format(date.toDate(calendarState.timeZone));
|
|
50
|
+
result[rowIdx][colIdx] = {
|
|
51
|
+
date,
|
|
52
|
+
content,
|
|
53
|
+
ariaLabel: content,
|
|
54
|
+
isCurrent: isSameYear(date, currentDate),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}, [startYear, calendarState.timeZone, focusedDate, yearFormatter, isNegativeEra, currentDate]);
|
|
59
|
+
const focusCell = (date) => {
|
|
60
|
+
setFocusedDate(constrainValue(date, calendarState.minValue, calendarState.maxValue));
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
header: yearFormatter.formatRange(focusedDate.set({ year: startYear }).toDate(calendarState.timeZone), focusedDate.set({ year: endYear }).toDate(calendarState.timeZone)),
|
|
64
|
+
previousLabel: messages.format('previousMultiYearSection', { yearCount: 20 }),
|
|
65
|
+
nextLabel: messages.format('nextMultiYearSection', { yearCount: 20 }),
|
|
66
|
+
data,
|
|
67
|
+
isReadOnly: calendarState.isReadOnly,
|
|
68
|
+
isDisabled: calendarState.isDisabled,
|
|
69
|
+
isFocused,
|
|
70
|
+
setIsFocused,
|
|
71
|
+
focusedDate,
|
|
72
|
+
setFocusedDate,
|
|
73
|
+
timeZone: calendarState.timeZone,
|
|
74
|
+
focusPreviousItem() {
|
|
75
|
+
focusCell(focusedDate.subtract({ years: 1 }));
|
|
76
|
+
},
|
|
77
|
+
focusNextItem() {
|
|
78
|
+
focusCell(focusedDate.add({ years: 1 }));
|
|
79
|
+
},
|
|
80
|
+
focusPreviousRow() {
|
|
81
|
+
focusCell(focusedDate.subtract({ years: ITEMS_PER_ROW }));
|
|
82
|
+
},
|
|
83
|
+
focusNextRow() {
|
|
84
|
+
focusCell(focusedDate.add({ years: ITEMS_PER_ROW }));
|
|
85
|
+
},
|
|
86
|
+
focusSectionStart() {
|
|
87
|
+
focusCell(focusedDate.set({ year: startYear }));
|
|
88
|
+
},
|
|
89
|
+
focusSectionEnd() {
|
|
90
|
+
focusCell(focusedDate.set({ year: endYear }));
|
|
91
|
+
},
|
|
92
|
+
focusPreviousSection(shouldSkip) {
|
|
93
|
+
focusCell(focusedDate.subtract({ years: shouldSkip ? YEARS_SKIP_AMOUNT : YEARS_PER_SECTION }));
|
|
94
|
+
},
|
|
95
|
+
focusNextSection(shouldSkip) {
|
|
96
|
+
focusCell(focusedDate.add({ years: shouldSkip ? YEARS_SKIP_AMOUNT : YEARS_PER_SECTION }));
|
|
97
|
+
},
|
|
98
|
+
isPreviousSectionInvalid() {
|
|
99
|
+
const current = startOfYear(focusedDate.set({ year: startYear }));
|
|
100
|
+
const prev = current.subtract({ days: 1 });
|
|
101
|
+
return (isDateInvalid(current, calendarState.minValue, calendarState.maxValue) ||
|
|
102
|
+
isDateInvalid(prev, calendarState.minValue, calendarState.maxValue) ||
|
|
103
|
+
isSameDay(prev, current));
|
|
104
|
+
},
|
|
105
|
+
isNextSectionInvalid() {
|
|
106
|
+
const current = endOfYear(focusedDate.set({ year: endYear }));
|
|
107
|
+
const next = current.add({ days: 1 });
|
|
108
|
+
return (isDateInvalid(current, calendarState.minValue, calendarState.maxValue) ||
|
|
109
|
+
isDateInvalid(next, calendarState.minValue, calendarState.maxValue) ||
|
|
110
|
+
isSameDay(next, current));
|
|
111
|
+
},
|
|
112
|
+
selectFocusedDate() {
|
|
113
|
+
switchToView('year');
|
|
114
|
+
},
|
|
115
|
+
isCellDisabled(date) {
|
|
116
|
+
return (isDateInvalid(endOfYear(date), calendarState.minValue, null) ||
|
|
117
|
+
isDateInvalid(startOfYear(date), null, calendarState.maxValue));
|
|
118
|
+
},
|
|
119
|
+
isCellSelected(date) {
|
|
120
|
+
return calendarState.value !== null && isSameYear(date, calendarState.value);
|
|
121
|
+
},
|
|
122
|
+
isCellTabbable(date) {
|
|
123
|
+
return isSameYear(date, focusedDate);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=use-multi-year-view-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-multi-year-view-state.js","sourceRoot":"","sources":["../../../../../../src/components/date-picker/views/multi-year/use-multi-year-view-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAqB,MAAM,yBAAyB,CAAC;AAClH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,oBAAoB,IAAI,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cA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;gBACnE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CACzB,CAAC;QACJ,CAAC;QACD,oBAAoB;YAClB,MAAM,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;YAEtC,OAAO,CACL,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC;gBACtE,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC;gBACnE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CACzB,CAAC;QACJ,CAAC;QACD,iBAAiB;YACf,YAAY,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QACD,cAAc,CAAC,IAAI;YACjB,OAAO,CACL,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC;gBAC5D,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,CAC/D,CAAC;QACJ,CAAC;QACD,cAAc,CAAC,IAAI;YACjB,OAAO,aAAa,CAAC,KAAK,KAAK,IAAI,IAAI,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QAC/E,CAAC;QACD,cAAc,CAAC,IAAI;YACjB,OAAO,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { endOfYear, isSameDay, isSameYear, startOfYear, today, type CalendarDate } from '@internationalized/date';\nimport { useContext, useMemo, useState } from 'react';\nimport { useDateFormatter } from 'react-aria';\nimport { CalendarStateContext as RACCalendarStateContext } from 'react-aria-components';\nimport { useLocalizedMessages } from '../../../../i18n/index.js';\nimport { constrainValue, getEraFormat, isDateInvalid } from '../../utils.js';\nimport type { ViewGridCellData, ViewGridState } from '../types.js';\nimport { useDatePickerView } from '../view-provider.js';\n\nconst ITEMS_PER_ROW = 4;\nconst YEARS_PER_SECTION = 20;\nconst YEARS_SKIP_AMOUNT = 100;\n\n/** @internal */\nexport function useMultiYearViewState(): ViewGridState {\n const calendarState = useContext(RACCalendarStateContext)!;\n const { switchToView, focusedDate, setFocusedDate } = useDatePickerView();\n const messages = useLocalizedMessages('datePicker');\n const [isFocused, setIsFocused] = useState(true);\n\n const currentDate = useMemo(() => today(calendarState.timeZone), [calendarState.timeZone]);\n\n const yearFormatter = useDateFormatter({\n year: 'numeric',\n era: getEraFormat(focusedDate),\n calendar: focusedDate.calendar.identifier,\n timeZone: calendarState.timeZone,\n });\n\n let startYear = (Math.ceil(focusedDate.year / YEARS_PER_SECTION) - 1) * YEARS_PER_SECTION + 1;\n let endYear = startYear + YEARS_PER_SECTION - 1;\n\n // Years are always represented by positive numbers.\n // If era implies negative years, flip start and end.\n const isNegativeEra = focusedDate.era === 'BC';\n if (isNegativeEra) {\n const temp = startYear;\n startYear = endYear;\n endYear = temp;\n }\n\n const data: (ViewGridCellData | null)[][] = useMemo(() => {\n const rowCount = Math.ceil(YEARS_PER_SECTION / ITEMS_PER_ROW);\n const result: (ViewGridCellData | null)[][] = new Array(rowCount);\n\n for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {\n result[rowIdx] = new Array(ITEMS_PER_ROW).fill(null);\n }\n\n for (let yearIdx = 0; yearIdx < YEARS_PER_SECTION; yearIdx++) {\n const rowIdx = Math.floor(yearIdx / ITEMS_PER_ROW);\n const colIdx = yearIdx % ITEMS_PER_ROW;\n\n const yearToSet = startYear + (isNegativeEra ? -yearIdx : yearIdx);\n const date = focusedDate.set({ year: yearToSet });\n\n if (date.year !== yearToSet) {\n // Reached minimum/maximum date\n continue;\n }\n\n const content = yearFormatter.format(date.toDate(calendarState.timeZone));\n\n result[rowIdx]![colIdx] = {\n date,\n content,\n ariaLabel: content,\n isCurrent: isSameYear(date, currentDate),\n };\n }\n\n return result;\n }, [startYear, calendarState.timeZone, focusedDate, yearFormatter, isNegativeEra, currentDate]);\n\n const focusCell = (date: CalendarDate) => {\n setFocusedDate(constrainValue(date, calendarState.minValue, calendarState.maxValue));\n };\n\n return {\n header: yearFormatter.formatRange(\n focusedDate.set({ year: startYear }).toDate(calendarState.timeZone),\n focusedDate.set({ year: endYear }).toDate(calendarState.timeZone),\n ),\n previousLabel: messages.format('previousMultiYearSection', { yearCount: 20 }),\n nextLabel: messages.format('nextMultiYearSection', { yearCount: 20 }),\n data,\n isReadOnly: calendarState.isReadOnly,\n isDisabled: calendarState.isDisabled,\n isFocused,\n setIsFocused,\n focusedDate,\n setFocusedDate,\n timeZone: calendarState.timeZone,\n focusPreviousItem() {\n focusCell(focusedDate.subtract({ years: 1 }));\n },\n focusNextItem() {\n focusCell(focusedDate.add({ years: 1 }));\n },\n focusPreviousRow() {\n focusCell(focusedDate.subtract({ years: ITEMS_PER_ROW }));\n },\n focusNextRow() {\n focusCell(focusedDate.add({ years: ITEMS_PER_ROW }));\n },\n focusSectionStart() {\n focusCell(focusedDate.set({ year: startYear }));\n },\n focusSectionEnd() {\n focusCell(focusedDate.set({ year: endYear }));\n },\n focusPreviousSection(shouldSkip) {\n focusCell(focusedDate.subtract({ years: shouldSkip ? YEARS_SKIP_AMOUNT : YEARS_PER_SECTION }));\n },\n focusNextSection(shouldSkip) {\n focusCell(focusedDate.add({ years: shouldSkip ? YEARS_SKIP_AMOUNT : YEARS_PER_SECTION }));\n },\n isPreviousSectionInvalid() {\n const current = startOfYear(focusedDate.set({ year: startYear }));\n const prev = current.subtract({ days: 1 });\n\n return (\n isDateInvalid(current, calendarState.minValue, calendarState.maxValue) ||\n isDateInvalid(prev, calendarState.minValue, calendarState.maxValue) ||\n isSameDay(prev, current)\n );\n },\n isNextSectionInvalid() {\n const current = endOfYear(focusedDate.set({ year: endYear }));\n const next = current.add({ days: 1 });\n\n return (\n isDateInvalid(current, calendarState.minValue, calendarState.maxValue) ||\n isDateInvalid(next, calendarState.minValue, calendarState.maxValue) ||\n isSameDay(next, current)\n );\n },\n selectFocusedDate() {\n switchToView('year');\n },\n isCellDisabled(date) {\n return (\n isDateInvalid(endOfYear(date), calendarState.minValue, null) ||\n isDateInvalid(startOfYear(date), null, calendarState.maxValue)\n );\n },\n isCellSelected(date) {\n return calendarState.value !== null && isSameYear(date, calendarState.value);\n },\n isCellTabbable(date) {\n return isSameYear(date, focusedDate);\n },\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/date-picker/views/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/components/date-picker/views/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CalendarDate } from '@internationalized/date';\n\n/** @internal */\nexport interface ViewGridCellData {\n date: CalendarDate;\n content: string;\n ariaLabel: string;\n isCurrent: boolean;\n}\n\n/** @internal */\nexport interface ViewGridState {\n header: string;\n previousLabel: string;\n nextLabel: string;\n data: (ViewGridCellData | null)[][];\n isReadOnly: boolean;\n isDisabled: boolean;\n isFocused: boolean;\n setIsFocused(value: boolean): void;\n focusedDate: CalendarDate;\n setFocusedDate(date: CalendarDate): void;\n timeZone: string;\n focusPreviousItem(): void;\n focusNextItem(): void;\n focusPreviousRow(): void;\n focusNextRow(): void;\n focusSectionStart(): void;\n focusSectionEnd(): void;\n focusPreviousSection(shouldSkip?: boolean): void;\n focusNextSection(shouldSkip?: boolean): void;\n isPreviousSectionInvalid(): boolean;\n isNextSectionInvalid(): boolean;\n selectFocusedDate(): void;\n isCellDisabled(date: CalendarDate): boolean;\n isCellSelected(date: CalendarDate): boolean;\n isCellTabbable(date: CalendarDate): boolean;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-view-header.d.ts","sourceRoot":"","sources":["../../../../../src/components/date-picker/views/use-view-header.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { announce } from '@react-aria/live-announcer';
|
|
3
|
+
import { useUpdateEffect } from '@react-aria/utils';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { IconChevronLeft, IconChevronRight } from '../../../icons/index.js';
|
|
6
|
+
/** @internal */
|
|
7
|
+
export function useViewHeader(state) {
|
|
8
|
+
const { isFocused, header } = state;
|
|
9
|
+
// Announce when the section changes
|
|
10
|
+
useUpdateEffect(() => {
|
|
11
|
+
// only when pressing the Previous or Next button
|
|
12
|
+
if (!isFocused) {
|
|
13
|
+
announce(header);
|
|
14
|
+
}
|
|
15
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
}, [header]);
|
|
17
|
+
// If the next or previous buttons become disabled while they are focused, move focus to the grid.
|
|
18
|
+
const [previousFocused, setPreviousFocused] = useState(false);
|
|
19
|
+
const previousDisabled = state.isDisabled || state.isPreviousSectionInvalid();
|
|
20
|
+
if (previousDisabled && previousFocused) {
|
|
21
|
+
setPreviousFocused(false);
|
|
22
|
+
state.setIsFocused(true);
|
|
23
|
+
}
|
|
24
|
+
const [nextFocused, setNextFocused] = useState(false);
|
|
25
|
+
const nextDisabled = state.isDisabled || state.isNextSectionInvalid();
|
|
26
|
+
if (nextDisabled && nextFocused) {
|
|
27
|
+
setNextFocused(false);
|
|
28
|
+
state.setIsFocused(true);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
prevButtonProps: {
|
|
32
|
+
onPress: () => state.focusPreviousSection(),
|
|
33
|
+
'aria-label': state.previousLabel,
|
|
34
|
+
icon: _jsx(IconChevronLeft, {}),
|
|
35
|
+
variant: 'tertiary',
|
|
36
|
+
size: 'small',
|
|
37
|
+
isDisabled: previousDisabled,
|
|
38
|
+
// @ts-expect-error our buttons don't expose `onFocusChange`, but it gets passed to React Aria anyway
|
|
39
|
+
onFocusChange: setPreviousFocused,
|
|
40
|
+
},
|
|
41
|
+
nextButtonProps: {
|
|
42
|
+
onPress: () => state.focusNextSection(),
|
|
43
|
+
'aria-label': state.nextLabel,
|
|
44
|
+
icon: _jsx(IconChevronRight, {}),
|
|
45
|
+
variant: 'tertiary',
|
|
46
|
+
size: 'small',
|
|
47
|
+
isDisabled: nextDisabled,
|
|
48
|
+
// @ts-expect-error our buttons don't expose `onFocusChange`, but it gets passed to React Aria anyway
|
|
49
|
+
onFocusChange: setNextFocused,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=use-view-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-view-header.js","sourceRoot":"","sources":["../../../../../src/components/date-picker/views/use-view-header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAS5E,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,KAAoB;IAChD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEpC,oCAAoC;IACpC,eAAe,CAAC,GAAG,EAAE;QACnB,iDAAiD;QACjD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,kGAAkG;IAClG,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,wBAAwB,EAAE,CAAC;IAC9E,IAAI,gBAAgB,IAAI,eAAe,EAAE,CAAC;QACxC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;IACtE,IAAI,YAAY,IAAI,WAAW,EAAE,CAAC;QAChC,cAAc,CAAC,KAAK,CAAC,CAAC;QACtB,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,eAAe,EAAE;YACf,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE;YAC3C,YAAY,EAAE,KAAK,CAAC,aAAa;YACjC,IAAI,EAAE,KAAC,eAAe,KAAG;YACzB,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,gBAAgB;YAC5B,qGAAqG;YACrG,aAAa,EAAE,kBAAkB;SAClC;QACD,eAAe,EAAE;YACf,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE;YACvC,YAAY,EAAE,KAAK,CAAC,SAAS;YAC7B,IAAI,EAAE,KAAC,gBAAgB,KAAG;YAC1B,OAAO,EAAE,UAAU;YACnB,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,YAAY;YACxB,qGAAqG;YACrG,aAAa,EAAE,cAAc;SAC9B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { announce } from '@react-aria/live-announcer';\nimport { useUpdateEffect } from '@react-aria/utils';\nimport { useState } from 'react';\nimport { IconChevronLeft, IconChevronRight } from '../../../icons/index.js';\nimport type { IconButtonProps } from '../../button/icon-button.js';\nimport type { ViewGridState } from './types.js';\n\ninterface UseViewHeader {\n prevButtonProps: IconButtonProps;\n nextButtonProps: IconButtonProps;\n}\n\n/** @internal */\nexport function useViewHeader(state: ViewGridState): UseViewHeader {\n const { isFocused, header } = state;\n\n // Announce when the section changes\n useUpdateEffect(() => {\n // only when pressing the Previous or Next button\n if (!isFocused) {\n announce(header);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [header]);\n\n // If the next or previous buttons become disabled while they are focused, move focus to the grid.\n const [previousFocused, setPreviousFocused] = useState(false);\n const previousDisabled = state.isDisabled || state.isPreviousSectionInvalid();\n if (previousDisabled && previousFocused) {\n setPreviousFocused(false);\n state.setIsFocused(true);\n }\n\n const [nextFocused, setNextFocused] = useState(false);\n const nextDisabled = state.isDisabled || state.isNextSectionInvalid();\n if (nextDisabled && nextFocused) {\n setNextFocused(false);\n state.setIsFocused(true);\n }\n\n return {\n prevButtonProps: {\n onPress: () => state.focusPreviousSection(),\n 'aria-label': state.previousLabel,\n icon: <IconChevronLeft />,\n variant: 'tertiary',\n size: 'small',\n isDisabled: previousDisabled,\n // @ts-expect-error our buttons don't expose `onFocusChange`, but it gets passed to React Aria anyway\n onFocusChange: setPreviousFocused,\n },\n nextButtonProps: {\n onPress: () => state.focusNextSection(),\n 'aria-label': state.nextLabel,\n icon: <IconChevronRight />,\n variant: 'tertiary',\n size: 'small',\n isDisabled: nextDisabled,\n // @ts-expect-error our buttons don't expose `onFocusChange`, but it gets passed to React Aria anyway\n onFocusChange: setNextFocused,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-grid-cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/date-picker/views/view-grid-cell.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useFocusRing } from '@react-aria/focus';
|
|
3
|
+
import { getInteractionModality, useHover, usePress } from '@react-aria/interactions';
|
|
4
|
+
import { focusWithoutScrolling, getScrollParent, mergeProps, scrollIntoViewport } from '@react-aria/utils';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useEffect, useRef } from 'react';
|
|
7
|
+
import { textStyle } from '../../typography/utils.js';
|
|
8
|
+
/** @internal */
|
|
9
|
+
export function ViewGridCell({ cellData, state }) {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const isDisabled = cellData ? state.isDisabled || state.isCellDisabled(cellData.date) : true;
|
|
12
|
+
const isSelected = cellData ? !isDisabled && state.isCellSelected(cellData.date) : false;
|
|
13
|
+
const isTabbable = cellData ? state.isCellTabbable(cellData.date) : false;
|
|
14
|
+
const isFocused = state.isFocused && isTabbable;
|
|
15
|
+
const { pressProps, isPressed } = usePress({
|
|
16
|
+
preventFocusOnPress: true,
|
|
17
|
+
isDisabled: isDisabled || state.isReadOnly,
|
|
18
|
+
onPress: () => {
|
|
19
|
+
if (!state.isReadOnly && cellData) {
|
|
20
|
+
state.setFocusedDate(cellData.date);
|
|
21
|
+
state.selectFocusedDate();
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
let tabIndex = undefined;
|
|
26
|
+
if (!isDisabled) {
|
|
27
|
+
tabIndex = isTabbable ? 0 : -1;
|
|
28
|
+
}
|
|
29
|
+
// Focus the button in the DOM when the state updates.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isFocused && ref.current) {
|
|
32
|
+
focusWithoutScrolling(ref.current);
|
|
33
|
+
// Scroll into view if navigating with a keyboard
|
|
34
|
+
if (getInteractionModality() !== 'pointer' && document.activeElement === ref.current) {
|
|
35
|
+
scrollIntoViewport(ref.current, { containingElement: getScrollParent(ref.current) });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, [isFocused]);
|
|
39
|
+
const { hoverProps, isHovered } = useHover({ isDisabled });
|
|
40
|
+
const { focusProps, isFocusVisible } = useFocusRing();
|
|
41
|
+
const cellProps = {
|
|
42
|
+
role: 'gridcell',
|
|
43
|
+
'aria-disabled': isDisabled || undefined,
|
|
44
|
+
'aria-selected': isSelected || undefined,
|
|
45
|
+
};
|
|
46
|
+
if (!cellData) {
|
|
47
|
+
return _jsx("td", { ...cellProps });
|
|
48
|
+
}
|
|
49
|
+
const { date, content, ariaLabel, isCurrent } = cellData;
|
|
50
|
+
const buttonProps = mergeProps(pressProps, hoverProps, focusProps, {
|
|
51
|
+
onFocus() {
|
|
52
|
+
if (!isDisabled) {
|
|
53
|
+
state.setFocusedDate(date);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
tabIndex,
|
|
57
|
+
role: 'button',
|
|
58
|
+
'aria-disabled': isDisabled || undefined,
|
|
59
|
+
'aria-label': ariaLabel,
|
|
60
|
+
onContextMenu(e) {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
return (_jsx("td", { ...cellProps, children: _jsx("div", { ...buttonProps, ref: ref, className: clsx('cim-date-picker-calendar-cell', textStyle({ variant: isCurrent ? 'medium-semibold' : 'medium' })), "data-disabled": isDisabled || undefined, "data-hovered": isHovered || undefined, "data-pressed": isPressed || undefined, "data-selected": isSelected || undefined, "data-focus-visible": (isFocusVisible && isFocused) || undefined, "data-current": isCurrent || undefined, children: content }) }));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=view-grid-cell.js.map
|