@cimpress-ui/react 0.4.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- 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.map +1 -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/card/card.d.ts +41 -13
- package/dist/commonjs/components/card/card.d.ts.map +1 -1
- package/dist/commonjs/components/card/card.js +15 -15
- package/dist/commonjs/components/card/card.js.map +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js +1 -1
- package/dist/commonjs/components/checkbox/checkbox.js.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts +5 -0
- package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.js +10 -3
- package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
- package/dist/commonjs/components/date-picker/date-picker.js +1 -1
- package/dist/commonjs/components/date-picker/date-picker.js.map +1 -1
- 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.map +1 -1
- package/dist/commonjs/components/file-picker/file-picker.js +2 -2
- package/dist/commonjs/components/file-picker/file-picker.js.map +1 -1
- 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/modal-dialog/modal-dialog.d.ts +3 -3
- package/dist/commonjs/components/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/commonjs/components/modal-dialog/modal-dialog.js +1 -5
- package/dist/commonjs/components/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/commonjs/components/number-field/number-field.js +1 -1
- package/dist/commonjs/components/number-field/number-field.js.map +1 -1
- package/dist/commonjs/components/radio/radio.js +1 -1
- package/dist/commonjs/components/radio/radio.js.map +1 -1
- package/dist/commonjs/components/select/select.d.ts +5 -0
- package/dist/commonjs/components/select/select.d.ts.map +1 -1
- package/dist/commonjs/components/select/select.js +9 -2
- package/dist/commonjs/components/select/select.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-field/tag-field-input.js +1 -2
- package/dist/commonjs/components/tag-field/tag-field-input.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field-list-box.js +9 -2
- package/dist/commonjs/components/tag-field/tag-field-list-box.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field-tags.js +6 -4
- package/dist/commonjs/components/tag-field/tag-field-tags.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field.d.ts +19 -11
- package/dist/commonjs/components/tag-field/tag-field.d.ts.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field.js +16 -16
- package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/components/toggle/toggle.js +1 -1
- package/dist/commonjs/components/toggle/toggle.js.map +1 -1
- 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/i18n/messages/en-US.d.ts.map +1 -1
- package/dist/commonjs/i18n/messages/en-US.js +6 -0
- package/dist/commonjs/i18n/messages/en-US.js.map +1 -1
- package/dist/commonjs/i18n/messages/types.d.ts +10 -0
- package/dist/commonjs/i18n/messages/types.d.ts.map +1 -1
- package/dist/commonjs/i18n/messages/types.js.map +1 -1
- 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 +10 -4
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +10 -4
- package/dist/commonjs/index.js.map +1 -1
- 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.map +1 -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/card/card.d.ts +41 -13
- package/dist/esm/components/card/card.d.ts.map +1 -1
- package/dist/esm/components/card/card.js +12 -12
- package/dist/esm/components/card/card.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js +1 -1
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/combo-box/combo-box.d.ts +5 -0
- package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/esm/components/combo-box/combo-box.js +11 -4
- package/dist/esm/components/combo-box/combo-box.js.map +1 -1
- package/dist/esm/components/date-picker/date-picker.js +1 -1
- package/dist/esm/components/date-picker/date-picker.js.map +1 -1
- 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.map +1 -1
- package/dist/esm/components/file-picker/file-picker.js +2 -2
- package/dist/esm/components/file-picker/file-picker.js.map +1 -1
- 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/modal-dialog/modal-dialog.d.ts +3 -3
- package/dist/esm/components/modal-dialog/modal-dialog.d.ts.map +1 -1
- package/dist/esm/components/modal-dialog/modal-dialog.js +1 -5
- package/dist/esm/components/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/esm/components/number-field/number-field.js +1 -1
- package/dist/esm/components/number-field/number-field.js.map +1 -1
- package/dist/esm/components/radio/radio.js +1 -1
- package/dist/esm/components/radio/radio.js.map +1 -1
- package/dist/esm/components/select/select.d.ts +5 -0
- package/dist/esm/components/select/select.d.ts.map +1 -1
- package/dist/esm/components/select/select.js +10 -3
- package/dist/esm/components/select/select.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-field/tag-field-input.js +1 -2
- package/dist/esm/components/tag-field/tag-field-input.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field-list-box.js +10 -3
- package/dist/esm/components/tag-field/tag-field-list-box.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field-tags.js +6 -4
- package/dist/esm/components/tag-field/tag-field-tags.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field.d.ts +19 -11
- package/dist/esm/components/tag-field/tag-field.d.ts.map +1 -1
- package/dist/esm/components/tag-field/tag-field.js +13 -13
- package/dist/esm/components/tag-field/tag-field.js.map +1 -1
- package/dist/esm/components/text-inputs/text-area.js +1 -1
- package/dist/esm/components/text-inputs/text-area.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js +1 -1
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/components/toggle/toggle.js +1 -1
- package/dist/esm/components/toggle/toggle.js.map +1 -1
- 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/i18n/messages/en-US.d.ts.map +1 -1
- package/dist/esm/i18n/messages/en-US.js +6 -0
- package/dist/esm/i18n/messages/en-US.js.map +1 -1
- package/dist/esm/i18n/messages/types.d.ts +10 -0
- package/dist/esm/i18n/messages/types.d.ts.map +1 -1
- package/dist/esm/i18n/messages/types.js.map +1 -1
- 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 +10 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +10 -4
- package/dist/esm/index.js.map +1 -1
- package/dist-styles/core.css +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +4 -2
- package/dist/commonjs/components/header/cimpress-logo.d.ts.map +0 -1
- package/dist/commonjs/components/header/cimpress-logo.js.map +0 -1
- package/dist/commonjs/components/header/header.d.ts +0 -10
- package/dist/commonjs/components/header/header.d.ts.map +0 -1
- package/dist/commonjs/components/header/header.js +0 -19
- package/dist/commonjs/components/header/header.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/header/cimpress-logo.d.ts.map +0 -1
- package/dist/esm/components/header/cimpress-logo.js.map +0 -1
- package/dist/esm/components/header/header.d.ts +0 -10
- package/dist/esm/components/header/header.d.ts.map +0 -1
- package/dist/esm/components/header/header.js +0 -13
- package/dist/esm/components/header/header.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
- /package/dist/commonjs/components/{header → app-header}/cimpress-logo.d.ts +0 -0
- /package/dist/commonjs/components/{header → app-header}/cimpress-logo.js +0 -0
- /package/dist/esm/components/{header → app-header}/cimpress-logo.d.ts +0 -0
- /package/dist/esm/components/{header → app-header}/cimpress-logo.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAGb,gDAAwB;AACxB,iCAAsD;AACtD,iEAU+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAAyD;AACzD,qFAA6E;AAC7E,mEAA2D;AAC3D,6DAAsD;AACtD,wEAA4G;AAE5G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BAAuB,gBAC5B,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7C,IAAI,EAAE,uBAAC,iBAAiB,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,gCAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,4BAA4B,EAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,cAAc,+BAClG,iCACE,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,81 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { AriaLabelingProps, CommonProps } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_DrawerRootProps {
|
|
4
|
+
/** The drawer trigger with its associated drawer. Provide the trigger as the first child, and the drawer as the second child. */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Whether the drawer is open (controlled). */
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
/** Whether the drawer is open by default (uncontrolled). */
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
/** Handler that is called when the drawer's open state changes. */
|
|
11
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Encapsulates a drawer trigger and its associated drawer.
|
|
15
|
+
* The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.
|
|
16
|
+
*/
|
|
17
|
+
export declare function UNSTABLE_DrawerRoot(props: UNSTABLE_DrawerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare namespace UNSTABLE_DrawerRoot {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
}
|
|
21
|
+
export interface UNSTABLE_DrawerRenderProps {
|
|
22
|
+
/** Closes the drawer when called. */
|
|
23
|
+
close: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface UNSTABLE_DrawerProps extends CommonProps, AriaLabelingProps {
|
|
26
|
+
/** The contents of the drawer. A function may be provided to access a function to close the drawer. */
|
|
27
|
+
children: ReactNode | ((renderProps: UNSTABLE_DrawerRenderProps) => ReactNode);
|
|
28
|
+
/** The title of the drawer. */
|
|
29
|
+
title?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.
|
|
32
|
+
* @default 'medium'
|
|
33
|
+
*/
|
|
34
|
+
size?: 'small' | 'medium' | 'large';
|
|
35
|
+
/**
|
|
36
|
+
* Whether to close the drawer when the user interacts outside of it or presses the Escape key.
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
isDismissible?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the drawer is open (controlled).
|
|
42
|
+
* If using `DrawerRoot`, this prop has no effect - provide `isOpen` to `DrawerRoot` instead.
|
|
43
|
+
*/
|
|
44
|
+
isOpen?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the drawer is open by default (uncontrolled).
|
|
47
|
+
* If using `DrawerRoot`, this prop has no effect - provide `defaultOpen` to `DrawerRoot` instead.
|
|
48
|
+
*/
|
|
49
|
+
defaultOpen?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Handler that is called when the drawer's open state changes.
|
|
52
|
+
* If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.
|
|
53
|
+
*/
|
|
54
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Displays an overlay element which blocks interaction with outside elements.
|
|
58
|
+
*
|
|
59
|
+
* See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).
|
|
60
|
+
*/
|
|
61
|
+
declare const _UNSTABLE_Drawer: (props: UNSTABLE_DrawerProps & import("react").RefAttributes<HTMLElement>) => import("react").JSX.Element | null;
|
|
62
|
+
export { _UNSTABLE_Drawer as UNSTABLE_Drawer };
|
|
63
|
+
export interface UNSTABLE_DrawerBodyProps {
|
|
64
|
+
/** The content to render within the drawer. */
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/** Renders content within `Drawer`. */
|
|
68
|
+
export declare function UNSTABLE_DrawerBody(props: UNSTABLE_DrawerBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export declare namespace UNSTABLE_DrawerBody {
|
|
70
|
+
var displayName: string;
|
|
71
|
+
}
|
|
72
|
+
export interface UNSTABLE_DrawerActionsProps {
|
|
73
|
+
/** Actions that should be available in the drawer. */
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
}
|
|
76
|
+
/** Renders actions within `Drawer`. */
|
|
77
|
+
export declare function UNSTABLE_DrawerActions({ children, ...props }: UNSTABLE_DrawerActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
export declare namespace UNSTABLE_DrawerActions {
|
|
79
|
+
var displayName: string;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAcpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGlE,MAAM,WAAW,wBAAwB;IACvC,iIAAiI;IACjI,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mEAAmE;IACnE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAElE;yBAFe,mBAAmB;;;AAMnC,MAAM,WAAW,0BAA0B;IACzC,qCAAqC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW,EAAE,iBAAiB;IAC1E,uGAAuG;IACvG,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,WAAW,EAAE,0BAA0B,KAAK,SAAS,CAAC,CAAC;IAC/E,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AA6DD;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,kHAAwC,CAAC;AAE/D,OAAO,EAAE,gBAAgB,IAAI,eAAe,EAAE,CAAC;AAE/C,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,uCAAuC;AACvC,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAElE;yBAFe,mBAAmB;;;AAMnC,MAAM,WAAW,2BAA2B;IAC1C,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,uCAAuC;AACvC,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,2BAA2B,2CASzF;yBATe,sBAAsB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UNSTABLE_Drawer = void 0;
|
|
8
|
+
exports.UNSTABLE_DrawerRoot = UNSTABLE_DrawerRoot;
|
|
9
|
+
exports.UNSTABLE_DrawerBody = UNSTABLE_DrawerBody;
|
|
10
|
+
exports.UNSTABLE_DrawerActions = UNSTABLE_DrawerActions;
|
|
11
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
12
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
15
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
16
|
+
const index_js_1 = require("../../i18n/index.js");
|
|
17
|
+
const use_media_query_js_1 = require("../../utils/use-media-query.js");
|
|
18
|
+
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
19
|
+
const focusable_container_js_1 = require("../internal/focusable-container/focusable-container.js");
|
|
20
|
+
const x_button_js_1 = require("../internal/x-button/x-button.js");
|
|
21
|
+
const utils_js_1 = require("../typography/utils.js");
|
|
22
|
+
/**
|
|
23
|
+
* Encapsulates a drawer trigger and its associated drawer.
|
|
24
|
+
* The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.
|
|
25
|
+
*/
|
|
26
|
+
function UNSTABLE_DrawerRoot(props) {
|
|
27
|
+
return (0, jsx_runtime_1.jsx)(react_aria_components_1.DialogTrigger, { ...props });
|
|
28
|
+
}
|
|
29
|
+
UNSTABLE_DrawerRoot.displayName = 'DrawerRoot';
|
|
30
|
+
function UNSTABLE_Drawer({ children, title, size = 'medium', UNSAFE_className, UNSAFE_style, isDismissible = true, isOpen, defaultOpen, onOpenChange, ...props }, ref) {
|
|
31
|
+
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
32
|
+
(0, use_production_warning_js_1.useProductionWarning)(() => {
|
|
33
|
+
if (!title && !ariaLabel && !ariaLabelledBy) {
|
|
34
|
+
console.warn('Drawer requires one of title / aria-label / aria-labelledby for accessibility');
|
|
35
|
+
}
|
|
36
|
+
}, [title, ariaLabel, ariaLabelledBy]);
|
|
37
|
+
const messages = (0, index_js_1.useLocalizedMessages)('common');
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ModalOverlay, { className: "cim-drawer-overlay", isDismissable: isDismissible, isKeyboardDismissDisabled: !isDismissible, isOpen: isOpen, defaultOpen: defaultOpen, onOpenChange: onOpenChange, "data-cim-style-root": true, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Modal, { className: (0, clsx_1.default)('cim-drawer', UNSAFE_className), style: UNSAFE_style, "data-size": size, children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { ...props, ref: ref, className: "cim-drawer-dialog", children: (renderProps) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "cim-drawer-header", children: [title && ((0, jsx_runtime_1.jsx)(react_aria_components_1.Heading, { slot: "title", className: (0, clsx_1.default)('cim-drawer-title', (0, utils_js_1.textStyle)({ variant: 'title-5', tone: 'base' })), children: title })), (0, jsx_runtime_1.jsx)(x_button_js_1.XButton, { "aria-label": messages.format('dismiss'), slot: "close" })] }), typeof children === 'function' ? children(renderProps) : children] })) }) }) }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Displays an overlay element which blocks interaction with outside elements.
|
|
42
|
+
*
|
|
43
|
+
* See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).
|
|
44
|
+
*/
|
|
45
|
+
const _UNSTABLE_Drawer = (0, forward_ref_js_1.forwardRef)(UNSTABLE_Drawer, 'Drawer');
|
|
46
|
+
exports.UNSTABLE_Drawer = _UNSTABLE_Drawer;
|
|
47
|
+
/** Renders content within `Drawer`. */
|
|
48
|
+
function UNSTABLE_DrawerBody(props) {
|
|
49
|
+
return (0, jsx_runtime_1.jsx)(focusable_container_js_1.FocusableContainer, { ...props, className: "cim-drawer-body", scrollDirection: "vertical" });
|
|
50
|
+
}
|
|
51
|
+
UNSTABLE_DrawerBody.displayName = 'DrawerBody';
|
|
52
|
+
/** Renders actions within `Drawer`. */
|
|
53
|
+
function UNSTABLE_DrawerActions({ children, ...props }) {
|
|
54
|
+
const matches = (0, use_media_query_js_1.useMediaQuery)('(min-width: 640px)');
|
|
55
|
+
const componentChildren = matches ? children : react_1.Children.toArray(children).reverse();
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...props, className: "cim-drawer-actions", children: componentChildren }));
|
|
57
|
+
}
|
|
58
|
+
UNSTABLE_DrawerActions.displayName = 'DrawerActions';
|
|
59
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAmCb,kDAEC;AAmHD,kDAEC;AAUD,wDASC;;AA3KD,gDAAwB;AACxB,iCAAoE;AACpE,iEAM+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,uEAA+D;AAC/D,qFAA6E;AAC7E,mGAA4F;AAC5F,kEAA2D;AAE3D,qDAAmD;AAanD;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,OAAO,uBAAC,qCAAgB,OAAK,KAAK,GAAI,CAAC;AACzC,CAAC;AAED,mBAAmB,CAAC,WAAW,GAAG,YAAY,CAAC;AAuC/C,SAAS,eAAe,CACtB,EACE,QAAQ,EACR,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,gBAAgB,EAChB,YAAY,EACZ,aAAa,GAAG,IAAI,EACpB,MAAM,EACN,WAAW,EACX,YAAY,EACZ,GAAG,KAAK,EACa,EACvB,GAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,gDAAoB,EAAC,G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;;GAIG;AACH,MAAM,gBAAgB,GAAG,IAAA,2BAAU,EAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;AAElC,2CAAe;AAO5C,uCAAuC;AACvC,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,OAAO,uBAAC,2CAAkB,OAAK,KAAK,EAAE,SAAS,EAAC,iBAAiB,EAAC,eAAe,EAAC,UAAU,GAAG,CAAC;AAClG,CAAC;AAED,mBAAmB,CAAC,WAAW,GAAG,YAAY,CAAC;AAO/C,uCAAuC;AACvC,SAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAA+B;IACxF,MAAM,OAAO,GAAG,IAAA,kCAAa,EAAC,oBAAoB,CAAC,CAAC;IACpD,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;IAEpF,OAAO,CACL,mCAAS,KAAK,EAAE,SAAS,EAAC,oBAAoB,YAC3C,iBAAiB,GACd,CACP,CAAC;AACJ,CAAC;AAED,sBAAsB,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { Children, type ForwardedRef, type ReactNode } from 'react';\nimport {\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { useMediaQuery } from '../../utils/use-media-query.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { FocusableContainer } from '../internal/focusable-container/focusable-container.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface UNSTABLE_DrawerRootProps {\n /** The drawer trigger with its associated drawer. Provide the trigger as the first child, and the drawer as the second child. */\n children: ReactNode;\n /** Whether the drawer is open (controlled). */\n isOpen?: boolean;\n /** Whether the drawer is open by default (uncontrolled). */\n defaultOpen?: boolean;\n /** Handler that is called when the drawer's open state changes. */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\n/**\n * Encapsulates a drawer trigger and its associated drawer.\n * The trigger can be any Cimpress UI button, and the drawer will be displayed when the trigger is activated.\n */\nexport function UNSTABLE_DrawerRoot(props: UNSTABLE_DrawerRootProps) {\n return <RACDialogTrigger {...props} />;\n}\n\nUNSTABLE_DrawerRoot.displayName = 'DrawerRoot';\n\nexport interface UNSTABLE_DrawerRenderProps {\n /** Closes the drawer when called. */\n close: () => void;\n}\n\nexport interface UNSTABLE_DrawerProps extends CommonProps, AriaLabelingProps {\n /** The contents of the drawer. A function may be provided to access a function to close the drawer. */\n children: ReactNode | ((renderProps: UNSTABLE_DrawerRenderProps) => ReactNode);\n /** The title of the drawer. */\n title?: string;\n /**\n * The size of the drawer. This prop is ignored on small devices - drawers on small devices will always take up all available width.\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Whether to close the drawer when the user interacts outside of it or presses the Escape key.\n * @default true\n */\n isDismissible?: boolean;\n /**\n * Whether the drawer is open (controlled).\n * If using `DrawerRoot`, this prop has no effect - provide `isOpen` to `DrawerRoot` instead.\n */\n isOpen?: boolean;\n /**\n * Whether the drawer is open by default (uncontrolled).\n * If using `DrawerRoot`, this prop has no effect - provide `defaultOpen` to `DrawerRoot` instead.\n */\n defaultOpen?: boolean;\n /**\n * Handler that is called when the drawer's open state changes.\n * If using `DrawerRoot`, this prop has no effect - provide `onOpenChange` to `DrawerRoot` instead.\n */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nfunction UNSTABLE_Drawer(\n {\n children,\n title,\n size = 'medium',\n UNSAFE_className,\n UNSAFE_style,\n isDismissible = true,\n isOpen,\n defaultOpen,\n onOpenChange,\n ...props\n }: UNSTABLE_DrawerProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!title && !ariaLabel && !ariaLabelledBy) {\n console.warn('Drawer requires one of title / aria-label / aria-labelledby for accessibility');\n }\n }, [title, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('common');\n\n return (\n <RACModalOverlay\n className=\"cim-drawer-overlay\"\n isDismissable={isDismissible}\n isKeyboardDismissDisabled={!isDismissible}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n data-cim-style-root\n >\n <RACModal className={clsx('cim-drawer', UNSAFE_className)} style={UNSAFE_style} data-size={size}>\n <RACDialog {...props} ref={ref} className=\"cim-drawer-dialog\">\n {(renderProps) => (\n <>\n <div className=\"cim-drawer-header\">\n {title && (\n <RACHeading\n slot=\"title\"\n className={clsx('cim-drawer-title', textStyle({ variant: 'title-5', tone: 'base' }))}\n >\n {title}\n </RACHeading>\n )}\n <XButton aria-label={messages.format('dismiss')} slot=\"close\" />\n </div>\n {typeof children === 'function' ? children(renderProps) : children}\n </>\n )}\n </RACDialog>\n </RACModal>\n </RACModalOverlay>\n );\n}\n\n/**\n * Displays an overlay element which blocks interaction with outside elements.\n *\n * See [drawer usage guidelines](https://ui.cimpress.io/components/drawer/).\n */\nconst _UNSTABLE_Drawer = forwardRef(UNSTABLE_Drawer, 'Drawer');\n\nexport { _UNSTABLE_Drawer as UNSTABLE_Drawer };\n\nexport interface UNSTABLE_DrawerBodyProps {\n /** The content to render within the drawer. */\n children: ReactNode;\n}\n\n/** Renders content within `Drawer`. */\nexport function UNSTABLE_DrawerBody(props: UNSTABLE_DrawerBodyProps) {\n return <FocusableContainer {...props} className=\"cim-drawer-body\" scrollDirection=\"vertical\" />;\n}\n\nUNSTABLE_DrawerBody.displayName = 'DrawerBody';\n\nexport interface UNSTABLE_DrawerActionsProps {\n /** Actions that should be available in the drawer. */\n children: ReactNode;\n}\n\n/** Renders actions within `Drawer`. */\nexport function UNSTABLE_DrawerActions({ children, ...props }: UNSTABLE_DrawerActionsProps) {\n const matches = useMediaQuery('(min-width: 640px)');\n const componentChildren = matches ? children : Children.toArray(children).reverse();\n\n return (\n <div {...props} className=\"cim-drawer-actions\">\n {componentChildren}\n </div>\n );\n}\n\nUNSTABLE_DrawerActions.displayName = 'DrawerActions';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAI7C,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3D,MAAM,WAAW,wBACf,SAAQ,WAAW,EACjB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,EACtC,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;IACzG,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C;AAmID,QAAA,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"file-picker.d.ts","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAI7C,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3D,MAAM,WAAW,wBACf,SAAQ,WAAW,EACjB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,EACtC,IAAI,CAAC,mBAAmB,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,eAAe,CAAC;IACzG,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oCAAoC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C;AAmID,QAAA,MAAM,oBAAoB,0KAAgE,CAAC;AAE3F,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -61,8 +61,8 @@ function UNSTABLE_FilePicker({ id, label, description, isDisabled, isRequired, i
|
|
|
61
61
|
[react_aria_components_1.LabelContext, label != null ? { id: labelId, htmlFor: buttonId } : {}],
|
|
62
62
|
[react_aria_components_1.TextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],
|
|
63
63
|
[react_aria_components_1.FieldErrorContext, validationState.displayValidation],
|
|
64
|
-
], children: [(0, jsx_runtime_1.jsxs)("div", { ...props, className: (0, clsx_1.default)('cim-file-
|
|
64
|
+
], children: [(0, jsx_runtime_1.jsxs)("div", { ...props, className: (0, clsx_1.default)('cim-file-picker', UNSAFE_className), style: UNSAFE_style, ref: ref, children: [label && ((0, jsx_runtime_1.jsxs)(form_field_js_1.FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: [label, isRequired && (0, jsx_runtime_1.jsx)(visually_hidden_js_1.UNSTABLE_VisuallyHidden, { children: labelMessages.format('required') })] })), (0, jsx_runtime_1.jsxs)("div", { className: "cim-file-picker-button-container", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.FileTrigger, { onSelect: handleSelect, acceptedFileTypes: acceptedFileTypes, allowsMultiple: allowsMultiple, acceptDirectory: acceptDirectory, defaultCamera: defaultCamera, children: (0, jsx_runtime_1.jsx)(button_js_1.Button, { id: buttonId, isDisabled: isDisabled, "aria-labelledby": [buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' '), "aria-describedby": [fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' '), "aria-details": ariaDetails, children: messages.format('chooseFile') }) }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { id: fileTextId, as: "p", variant: "medium", tone: "base", children: labelText })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }), name && ((0, jsx_runtime_1.jsx)("input", { type: "file", className: "cim-file-picker-hidden-input", name: name, multiple: allowsMultiple, required: isRequired, ref: fileInputRef }))] }));
|
|
65
65
|
}
|
|
66
|
-
const _UNSTABLE_FilePicker = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(UNSTABLE_FilePicker), '
|
|
66
|
+
const _UNSTABLE_FilePicker = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(UNSTABLE_FilePicker), 'FilePicker');
|
|
67
67
|
exports.UNSTABLE_FilePicker = _UNSTABLE_FilePicker;
|
|
68
68
|
//# sourceMappingURL=file-picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-picker.js","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":";;;;;;;AAAA,2CAAqD;AACr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AC,YAAY,CAAC,GACvB,GACM,EACjB,uBAAC,cAAI,IAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,EAAC,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,YACtD,SAAS,GACL,IACH,EACN,uBAAC,8BAAc,cAAE,KAAK,GAAkB,EACxC,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,IACtD,EACL,IAAI,IAAI,CACP,kCACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,6BAA6B,EACvC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,YAAY,GACjB,CACH,IACW,CACf,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,mBAAmB,CAAC,EAAE,WAAW,CAAC,CAAC;AAEzD,mDAAmB","sourcesContent":["import { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useId, useSlotId } from '@react-aria/utils';\nimport { useFormValidationState } from '@react-stately/form';\nimport clsx from 'clsx';\nimport { type ForwardedRef, useRef, useState } from 'react';\nimport {\n FieldErrorContext as RACFieldErrorContext,\n FileTrigger as RACFileTrigger,\n type FileTriggerProps as RACFileTriggerProps,\n LabelContext as RACLabelContext,\n Provider as RACProvider,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { Button } from '../button/button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { UNSTABLE_VisuallyHidden } from '../visually-hidden/visually-hidden.js';\n\nexport interface UNSTABLE_FilePickerProps\n extends CommonProps,\n Omit<FieldProps<File[]>, 'aria-label'>,\n Pick<RACFileTriggerProps, 'acceptedFileTypes' | 'allowsMultiple' | 'acceptDirectory' | 'defaultCamera'> {\n /** Whether the field is disabled. */\n isDisabled?: boolean;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Whether the field is invalid. */\n isInvalid?: boolean;\n /** The allowed file types that can be selected. */\n acceptedFileTypes?: string[];\n /** Whether multiple files can be selected. */\n allowsMultiple?: boolean;\n /** Handler called when files are selected. */\n onSelect?: (files: File[] | null) => void;\n}\n\nfunction UNSTABLE_FilePicker(\n {\n id,\n label,\n description,\n isDisabled,\n isRequired,\n isInvalid,\n onSelect,\n acceptedFileTypes,\n allowsMultiple,\n acceptDirectory,\n defaultCamera,\n error,\n name,\n validate,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-details': ariaDetails,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: UNSTABLE_FilePickerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const buttonId = useId(id);\n const labelId = useId();\n const fileTextId = useId();\n\n const [files, setFiles] = useState<File[] | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const handleSelect = (files: FileList | null) => {\n // Commit validation to clear any previous validation errors when new files are selected\n validationState.commitValidation();\n\n const filesArray = files?.length ? Array.from(files) : null;\n setFiles(filesArray);\n onSelect?.(filesArray);\n\n if (fileInputRef.current) {\n fileInputRef.current.files = files;\n }\n };\n\n const labelMessages = useLocalizedMessages('label');\n const messages = useLocalizedMessages('filePicker');\n const labelText =\n files?.length != null\n ? files.length === 1\n ? files[0]?.name\n : messages.format('multipleFilesSelected', { fileCount: files.length })\n : messages.format('noFilesSelected', { allowsMultiple: allowsMultiple ?? false });\n\n const validationBehavior = 'native';\n const validationState = useFormValidationState({\n value: files,\n isInvalid,\n isRequired,\n name,\n validate,\n validationBehavior,\n });\n useFormValidation({ isInvalid, isRequired, validate, validationBehavior }, validationState, fileInputRef);\n useFormReset(fileInputRef, files, setFiles);\n\n const descriptionId = useSlotId([Boolean(description)]);\n const errorMessageId = useSlotId([\n Boolean(error || validationState.displayValidation.validationErrors),\n validationState.displayValidation.isInvalid,\n ]);\n\n return (\n <RACProvider\n values={[\n [RACLabelContext, label != null ? { id: labelId, htmlFor: buttonId } : {}],\n [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],\n [RACFieldErrorContext, validationState.displayValidation],\n ]}\n >\n <div {...props} className={clsx('cim-file-field', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n {label && (\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n {/*\n * Button elements don't support `aria-required`, so we need to add visually hidden text to indicate that the field is required.\n * See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-required#examples:~:text=Note%3A%20If%20the%20field%27s%20label%20already%20contains%20the%20word%20%22required%22%2C%20it%20is%20recommended%20to%20leave%20out%20the%20aria%2Drequired%20attribute.%20This%20avoids%20that%20screen%20readers%20read%20out%20the%20term%20%22required%22%20twice.\n */}\n {isRequired && <UNSTABLE_VisuallyHidden>{labelMessages.format('required')}</UNSTABLE_VisuallyHidden>}\n </FormFieldLabel>\n )}\n <div className=\"cim-file-field-button-container\">\n <RACFileTrigger\n onSelect={handleSelect}\n acceptedFileTypes={acceptedFileTypes}\n allowsMultiple={allowsMultiple}\n acceptDirectory={acceptDirectory}\n defaultCamera={defaultCamera}\n >\n <Button\n id={buttonId}\n isDisabled={isDisabled}\n aria-labelledby={[buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' ')}\n aria-describedby={[fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' ')}\n aria-details={ariaDetails}\n >\n {messages.format('chooseFile')}\n </Button>\n </RACFileTrigger>\n <Text id={fileTextId} as=\"p\" variant=\"medium\" tone=\"base\">\n {labelText}\n </Text>\n </div>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </div>\n {name && (\n <input\n type=\"file\"\n className=\"cim-file-field-hidden-input\"\n name={name}\n multiple={allowsMultiple}\n required={isRequired}\n ref={fileInputRef}\n />\n )}\n </RACProvider>\n );\n}\n\nconst _UNSTABLE_FilePicker = withStyleProps(forwardRef(UNSTABLE_FilePicker), 'FileField');\n\nexport { _UNSTABLE_FilePicker as UNSTABLE_FilePicker };\n"]}
|
|
1
|
+
{"version":3,"file":"file-picker.js","sourceRoot":"","sources":["../../../../src/components/file-picker/file-picker.tsx"],"names":[],"mappings":";;;;;;;AAAA,2CAAqD;AACrD,6CAAmE;AACnE,8CAA6D;AAC7D,gDAAwB;AACxB,iCAA4D;AAC5D,iEAO+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mEAA2D;AAC3D,mDAA6C;AAC7C,wEAA4G;AAE5G,mDAA6C;AAC7C,8EAAgF;AAoBhF,SAAS,mBAAmB,CAC1B,EACE,EAAE,EACF,KAAK,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,cAAc,EAAE,WAAW,EAC3B,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACiB,EAC3B,GAAiC;IAEjC,MAAM,QAAQ,GAAG,IAAA,aAAK,EAAC,EAAE,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAA,aAAK,GAAE,CAAC;IACxB,MAAM,UAAU,GAAG,IAAA,aAAK,GAAE,CAAC;IAE3B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,CAAC,KAAsB,EAAE,EAAE;QAC9C,wFAAwF;QACxF,eAAe,CAAC,gBAAgB,EA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EAAE,UAAU,qBACL,CAAC,QAAQ,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,sBACnF,CAAC,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,kBAC1E,WAAW,YAExB,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,GACvB,GACM,EACjB,uBAAC,cAAI,IAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,EAAC,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,YACtD,SAAS,GACL,IACH,EACN,uBAAC,8BAAc,cAAE,KAAK,GAAkB,EACxC,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,IACtD,EACL,IAAI,IAAI,CACP,kCACE,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,8BAA8B,EACxC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,YAAY,GACjB,CACH,IACW,CACf,CAAC;AACJ,CAAC;AAED,MAAM,oBAAoB,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,mBAAmB,CAAC,EAAE,YAAY,CAAC,CAAC;AAE1D,mDAAmB","sourcesContent":["import { useFormValidation } from '@react-aria/form';\nimport { useFormReset, useId, useSlotId } from '@react-aria/utils';\nimport { useFormValidationState } from '@react-stately/form';\nimport clsx from 'clsx';\nimport { type ForwardedRef, useRef, useState } from 'react';\nimport {\n FieldErrorContext as RACFieldErrorContext,\n FileTrigger as RACFileTrigger,\n type FileTriggerProps as RACFileTriggerProps,\n LabelContext as RACLabelContext,\n Provider as RACProvider,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { Button } from '../button/button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { CommonProps, FieldProps } from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { UNSTABLE_VisuallyHidden } from '../visually-hidden/visually-hidden.js';\n\nexport interface UNSTABLE_FilePickerProps\n extends CommonProps,\n Omit<FieldProps<File[]>, 'aria-label'>,\n Pick<RACFileTriggerProps, 'acceptedFileTypes' | 'allowsMultiple' | 'acceptDirectory' | 'defaultCamera'> {\n /** Whether the field is disabled. */\n isDisabled?: boolean;\n /** Whether the field is required. */\n isRequired?: boolean;\n /** Whether the field is invalid. */\n isInvalid?: boolean;\n /** The allowed file types that can be selected. */\n acceptedFileTypes?: string[];\n /** Whether multiple files can be selected. */\n allowsMultiple?: boolean;\n /** Handler called when files are selected. */\n onSelect?: (files: File[] | null) => void;\n}\n\nfunction UNSTABLE_FilePicker(\n {\n id,\n label,\n description,\n isDisabled,\n isRequired,\n isInvalid,\n onSelect,\n acceptedFileTypes,\n allowsMultiple,\n acceptDirectory,\n defaultCamera,\n error,\n name,\n validate,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-details': ariaDetails,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: UNSTABLE_FilePickerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const buttonId = useId(id);\n const labelId = useId();\n const fileTextId = useId();\n\n const [files, setFiles] = useState<File[] | null>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const handleSelect = (files: FileList | null) => {\n // Commit validation to clear any previous validation errors when new files are selected\n validationState.commitValidation();\n\n const filesArray = files?.length ? Array.from(files) : null;\n setFiles(filesArray);\n onSelect?.(filesArray);\n\n if (fileInputRef.current) {\n fileInputRef.current.files = files;\n }\n };\n\n const labelMessages = useLocalizedMessages('label');\n const messages = useLocalizedMessages('filePicker');\n const labelText =\n files?.length != null\n ? files.length === 1\n ? files[0]?.name\n : messages.format('multipleFilesSelected', { fileCount: files.length })\n : messages.format('noFilesSelected', { allowsMultiple: allowsMultiple ?? false });\n\n const validationBehavior = 'native';\n const validationState = useFormValidationState({\n value: files,\n isInvalid,\n isRequired,\n name,\n validate,\n validationBehavior,\n });\n useFormValidation({ isInvalid, isRequired, validate, validationBehavior }, validationState, fileInputRef);\n useFormReset(fileInputRef, files, setFiles);\n\n const descriptionId = useSlotId([Boolean(description)]);\n const errorMessageId = useSlotId([\n Boolean(error || validationState.displayValidation.validationErrors),\n validationState.displayValidation.isInvalid,\n ]);\n\n return (\n <RACProvider\n values={[\n [RACLabelContext, label != null ? { id: labelId, htmlFor: buttonId } : {}],\n [RACTextContext, { slots: { description: { id: descriptionId }, errorMessage: { id: errorMessageId } } }],\n [RACFieldErrorContext, validationState.displayValidation],\n ]}\n >\n <div {...props} className={clsx('cim-file-picker', UNSAFE_className)} style={UNSAFE_style} ref={ref}>\n {label && (\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n {/*\n * Button elements don't support `aria-required`, so we need to add visually hidden text to indicate that the field is required.\n * See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-required#examples:~:text=Note%3A%20If%20the%20field%27s%20label%20already%20contains%20the%20word%20%22required%22%2C%20it%20is%20recommended%20to%20leave%20out%20the%20aria%2Drequired%20attribute.%20This%20avoids%20that%20screen%20readers%20read%20out%20the%20term%20%22required%22%20twice.\n */}\n {isRequired && <UNSTABLE_VisuallyHidden>{labelMessages.format('required')}</UNSTABLE_VisuallyHidden>}\n </FormFieldLabel>\n )}\n <div className=\"cim-file-picker-button-container\">\n <RACFileTrigger\n onSelect={handleSelect}\n acceptedFileTypes={acceptedFileTypes}\n allowsMultiple={allowsMultiple}\n acceptDirectory={acceptDirectory}\n defaultCamera={defaultCamera}\n >\n <Button\n id={buttonId}\n isDisabled={isDisabled}\n aria-labelledby={[buttonId, label != null ? labelId : null, ariaLabelledBy].filter(Boolean).join(' ')}\n aria-describedby={[fileTextId, descriptionId, errorMessageId, ariaDescribedBy].join(' ')}\n aria-details={ariaDetails}\n >\n {messages.format('chooseFile')}\n </Button>\n </RACFileTrigger>\n <Text id={fileTextId} as=\"p\" variant=\"medium\" tone=\"base\">\n {labelText}\n </Text>\n </div>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </div>\n {name && (\n <input\n type=\"file\"\n className=\"cim-file-picker-hidden-input\"\n name={name}\n multiple={allowsMultiple}\n required={isRequired}\n ref={fileInputRef}\n />\n )}\n </RACProvider>\n );\n}\n\nconst _UNSTABLE_FilePicker = withStyleProps(forwardRef(UNSTABLE_FilePicker), 'FilePicker');\n\nexport { _UNSTABLE_FilePicker as UNSTABLE_FilePicker };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/link-tabs/context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinkTabsContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/** @internal */
|
|
6
|
+
exports.LinkTabsContext = (0, react_1.createContext)(null);
|
|
7
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/components/link-tabs/context.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAUtC,gBAAgB;AACH,QAAA,eAAe,GAAG,IAAA,qBAAa,EAA8B,IAAI,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\nimport type { Href } from '../types.js';\n\n/** @internal */\nexport interface LinkTabsContextValue {\n isDisabled?: boolean;\n currentHref: Href | null;\n setCurrentHref: (href: Href | null) => void;\n}\n\n/** @internal */\nexport const LinkTabsContext = createContext<LinkTabsContextValue | null>(null);\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type LinkProps as RACLinkProps } from 'react-aria-components';
|
|
3
|
+
import type { AriaLabelingProps, CommonProps, Href, NavigationProps, StringLikeChildren, WithRequired } from '../types.js';
|
|
4
|
+
export interface LinkTabsProps extends CommonProps, AriaLabelingProps {
|
|
5
|
+
/** Link tabs belonging to the group. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Whether the link tabs are disabled. */
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
/** The currently selected key in the collection (controlled). */
|
|
10
|
+
currentHref?: Href | null;
|
|
11
|
+
/** The initial selected key in the collection (uncontrolled). */
|
|
12
|
+
defaultHref?: Href | null;
|
|
13
|
+
/** Handler that is called when the selection changes. */
|
|
14
|
+
onHrefChange?: (href: Href | null) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Displays a list of tabs to help users navigate through a website.
|
|
18
|
+
*
|
|
19
|
+
* See [tabs usage guidelines](https://ui.cimpress.io/components/tabs/).
|
|
20
|
+
*/
|
|
21
|
+
declare const _LinkTabs: (props: LinkTabsProps & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
22
|
+
export { _LinkTabs as LinkTabs };
|
|
23
|
+
export interface LinkTabProps extends Omit<CommonProps, 'id'>, WithRequired<NavigationProps, 'href'>, Pick<RACLinkProps, 'children' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {
|
|
24
|
+
/** The text to display as the tab title. */
|
|
25
|
+
children: StringLikeChildren;
|
|
26
|
+
/** An icon displayed before the tab title. */
|
|
27
|
+
iconStart?: ReactNode;
|
|
28
|
+
/** A badge displayed after the tab title. */
|
|
29
|
+
badge?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/** Renders a single tab within `LinkTabs`. */
|
|
32
|
+
export declare function LinkTab({ children, href, iconStart, badge, UNSAFE_className, UNSAFE_style, isDisabled, ...props }: LinkTabProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare namespace LinkTab {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=link-tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/link-tabs/link-tabs.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAmB,KAAK,SAAS,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIxF,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,aAAc,SAAQ,WAAW,EAAE,iBAAiB;IACnE,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,yDAAyD;IACzD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5C;AAkDD;;;;GAIG;AACH,QAAA,MAAM,SAAS,+JAAmD,CAAC;AAEnE,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,CAAC;AAEjC,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC7B,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,EACrC,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;IAC/E,4CAA4C;IAC5C,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,GAAG,KAAK,EACT,EAAE,YAAY,2CA8Bd;yBAvCe,OAAO"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.LinkTabs = void 0;
|
|
8
|
+
exports.LinkTab = LinkTab;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
const utils_1 = require("@react-aria/utils");
|
|
11
|
+
const utils_2 = require("@react-stately/utils");
|
|
12
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
15
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
16
|
+
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
17
|
+
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
18
|
+
const text_js_1 = require("../typography/text.js");
|
|
19
|
+
const context_js_1 = require("./context.js");
|
|
20
|
+
function LinkTabs({ children, currentHref, defaultHref, onHrefChange, UNSAFE_className, UNSAFE_style, id, isDisabled, ...props }, ref) {
|
|
21
|
+
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
22
|
+
(0, use_production_warning_js_1.useProductionWarning)(() => {
|
|
23
|
+
if (!ariaLabel && !ariaLabelledBy) {
|
|
24
|
+
console.warn('LinkTabs requires one of aria-label / aria-labelledby for accessibility');
|
|
25
|
+
}
|
|
26
|
+
}, [ariaLabel, ariaLabelledBy]);
|
|
27
|
+
const linkTabsId = (0, utils_1.useId)(id);
|
|
28
|
+
const [href, setHref] = (0, utils_2.useControlledState)(currentHref, defaultHref ?? null, onHrefChange);
|
|
29
|
+
const linkTabsContext = (0, react_1.useMemo)(() => ({
|
|
30
|
+
isDisabled,
|
|
31
|
+
currentHref: href,
|
|
32
|
+
setCurrentHref: setHref,
|
|
33
|
+
}), [isDisabled, href, setHref]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)("nav", { ...props, ref: ref, id: linkTabsId, children: (0, jsx_runtime_1.jsx)("ul", { className: (0, clsx_1.default)('cim-tab-list', 'cim-link-tabs', UNSAFE_className), style: UNSAFE_style, "aria-labelledby": linkTabsId, "data-disabled": isDisabled, children: (0, jsx_runtime_1.jsx)(context_js_1.LinkTabsContext.Provider, { value: linkTabsContext, children: children }) }) }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Displays a list of tabs to help users navigate through a website.
|
|
38
|
+
*
|
|
39
|
+
* See [tabs usage guidelines](https://ui.cimpress.io/components/tabs/).
|
|
40
|
+
*/
|
|
41
|
+
const _LinkTabs = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(LinkTabs), 'LinkTabs');
|
|
42
|
+
exports.LinkTabs = _LinkTabs;
|
|
43
|
+
/** Renders a single tab within `LinkTabs`. */
|
|
44
|
+
function LinkTab({ children, href, iconStart, badge, UNSAFE_className, UNSAFE_style, isDisabled, ...props }) {
|
|
45
|
+
const linkTabsContext = (0, react_1.useContext)(context_js_1.LinkTabsContext);
|
|
46
|
+
if (!linkTabsContext) {
|
|
47
|
+
throw new Error('Cannot use link tab outside of link tabs');
|
|
48
|
+
}
|
|
49
|
+
const { isDisabled: isGroupDisabled, currentHref, setCurrentHref } = linkTabsContext;
|
|
50
|
+
const isCurrent = href === currentHref;
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)(react_aria_components_1.Link, { ...props, className: (0, clsx_1.default)('cim-tab-item', 'cim-link-tab-item', UNSAFE_className), style: UNSAFE_style, href: href, onPress: () => setCurrentHref(href), "aria-current": isCurrent ? 'page' : undefined, "data-selected": isCurrent || undefined, isDisabled: isDisabled || isGroupDisabled, children: [iconStart, (0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "medium-semibold", alignment: "center", children: children }), badge] }) }));
|
|
52
|
+
}
|
|
53
|
+
LinkTab.displayName = 'LinkTab';
|
|
54
|
+
//# sourceMappingURL=link-tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-tabs.js","sourceRoot":"","sources":["../../../../src/components/link-tabs/link-tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAwGb,0BAuCC;;AA7ID,6CAA0C;AAC1C,gDAA0D;AAC1D,gDAAwB;AACxB,iCAA+E;AAC/E,iEAAwF;AACxF,yDAAkD;AAClD,qFAA6E;AAC7E,mEAA2D;AAS3D,mDAA6C;AAC7C,6CAA0E;AAe1E,SAAS,QAAQ,CACf,EACE,QAAQ,EACR,WAAW,EACX,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,EAAE,EACF,UAAU,EACV,GAAG,KAAK,EACM,EAChB,GAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,gDAAoB,EAAC,GAAG,EAAE;QACxB,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAEhC,MAAM,UA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G,IAAI,KAAK,WAAW,CAAC;IAEvC,OAAO,CACL,yCACE,wBAAC,4BAAO,OACF,KAAK,EACT,SAAS,EAAE,IAAA,cAAI,EAAC,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,EACtE,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,kBACrB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,mBAC7B,SAAS,IAAI,SAAS,EACrC,UAAU,EAAE,UAAU,IAAI,eAAe,aAExC,SAAS,EACV,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,iBAAiB,EAAC,SAAS,EAAC,QAAQ,YACzD,QAAQ,GACJ,EACN,KAAK,IACE,GACP,CACN,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ReactNode, type ForwardedRef, useMemo, useContext } from 'react';\nimport { Link as RACLink, type LinkProps as RACLinkProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type {\n AriaLabelingProps,\n CommonProps,\n Href,\n NavigationProps,\n StringLikeChildren,\n WithRequired,\n} from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { LinkTabsContext, type LinkTabsContextValue } from './context.js';\n\nexport interface LinkTabsProps extends CommonProps, AriaLabelingProps {\n /** Link tabs belonging to the group. */\n children: ReactNode;\n /** Whether the link tabs are disabled. */\n isDisabled?: boolean;\n /** The currently selected key in the collection (controlled). */\n currentHref?: Href | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultHref?: Href | null;\n /** Handler that is called when the selection changes. */\n onHrefChange?: (href: Href | null) => void;\n}\n\nfunction LinkTabs(\n {\n children,\n currentHref,\n defaultHref,\n onHrefChange,\n UNSAFE_className,\n UNSAFE_style,\n id,\n isDisabled,\n ...props\n }: LinkTabsProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn('LinkTabs requires one of aria-label / aria-labelledby for accessibility');\n }\n }, [ariaLabel, ariaLabelledBy]);\n\n const linkTabsId = useId(id);\n const [href, setHref] = useControlledState(currentHref, defaultHref ?? null, onHrefChange);\n\n const linkTabsContext: LinkTabsContextValue = useMemo(\n () => ({\n isDisabled,\n currentHref: href,\n setCurrentHref: setHref,\n }),\n [isDisabled, href, setHref],\n );\n\n return (\n <nav {...props} ref={ref} id={linkTabsId}>\n <ul\n className={clsx('cim-tab-list', 'cim-link-tabs', UNSAFE_className)}\n style={UNSAFE_style}\n aria-labelledby={linkTabsId}\n data-disabled={isDisabled}\n >\n <LinkTabsContext.Provider value={linkTabsContext}>{children}</LinkTabsContext.Provider>\n </ul>\n </nav>\n );\n}\n\n/**\n * Displays a list of tabs to help users navigate through a website.\n *\n * See [tabs usage guidelines](https://ui.cimpress.io/components/tabs/).\n */\nconst _LinkTabs = withStyleProps(forwardRef(LinkTabs), 'LinkTabs');\n\nexport { _LinkTabs as LinkTabs };\n\nexport interface LinkTabProps\n extends Omit<CommonProps, 'id'>,\n WithRequired<NavigationProps, 'href'>,\n Pick<RACLinkProps, 'children' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The text to display as the tab title. */\n children: StringLikeChildren;\n /** An icon displayed before the tab title. */\n iconStart?: ReactNode;\n /** A badge displayed after the tab title. */\n badge?: ReactNode;\n}\n\n/** Renders a single tab within `LinkTabs`. */\nexport function LinkTab({\n children,\n href,\n iconStart,\n badge,\n UNSAFE_className,\n UNSAFE_style,\n isDisabled,\n ...props\n}: LinkTabProps) {\n const linkTabsContext = useContext(LinkTabsContext);\n if (!linkTabsContext) {\n throw new Error('Cannot use link tab outside of link tabs');\n }\n\n const { isDisabled: isGroupDisabled, currentHref, setCurrentHref } = linkTabsContext;\n\n const isCurrent = href === currentHref;\n\n return (\n <li>\n <RACLink\n {...props}\n className={clsx('cim-tab-item', 'cim-link-tab-item', UNSAFE_className)}\n style={UNSAFE_style}\n href={href}\n onPress={() => setCurrentHref(href)}\n aria-current={isCurrent ? 'page' : undefined}\n data-selected={isCurrent || undefined}\n isDisabled={isDisabled || isGroupDisabled}\n >\n {iconStart}\n <Text as=\"span\" variant=\"medium-semibold\" alignment=\"center\">\n {children}\n </Text>\n {badge}\n </RACLink>\n </li>\n );\n}\n\nLinkTab.displayName = 'LinkTab';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
2
|
import type { AriaLabelingProps, CommonProps } from '../types.js';
|
|
3
3
|
export interface ModalDialogRenderProps {
|
|
4
4
|
/** Closes the modal dialog when called. */
|
|
@@ -8,9 +8,9 @@ export interface ModalDialogProps extends CommonProps, AriaLabelingProps {
|
|
|
8
8
|
/** The contents of the modal dialog. A function may be provided to access a function to close the modal dialog. */
|
|
9
9
|
children: ReactNode | ((renderProps: ModalDialogRenderProps) => ReactNode);
|
|
10
10
|
/** The title of the modal dialog. */
|
|
11
|
-
title
|
|
11
|
+
title: string;
|
|
12
12
|
/**
|
|
13
|
-
* The size of the modal dialog.
|
|
13
|
+
* The size of the modal dialog.
|
|
14
14
|
* @default 'medium'
|
|
15
15
|
*/
|
|
16
16
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/modal-dialog/modal-dialog.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"modal-dialog.d.ts","sourceRoot":"","sources":["../../../../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|
@@ -9,11 +9,9 @@ exports.ModalDialogBody = ModalDialogBody;
|
|
|
9
9
|
exports.ModalDialogActions = ModalDialogActions;
|
|
10
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
11
|
const clsx_1 = __importDefault(require("clsx"));
|
|
12
|
-
const react_1 = require("react");
|
|
13
12
|
const react_aria_components_1 = require("react-aria-components");
|
|
14
13
|
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
15
14
|
const index_js_1 = require("../../i18n/index.js");
|
|
16
|
-
const use_media_query_js_1 = require("../../utils/use-media-query.js");
|
|
17
15
|
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
18
16
|
const focusable_container_js_1 = require("../internal/focusable-container/focusable-container.js");
|
|
19
17
|
const x_button_js_1 = require("../internal/x-button/x-button.js");
|
|
@@ -42,9 +40,7 @@ function ModalDialogBody(props) {
|
|
|
42
40
|
ModalDialogBody.displayName = 'ModalDialogBody';
|
|
43
41
|
/** Renders actions within `ModalDialog`. */
|
|
44
42
|
function ModalDialogActions({ children, ...props }) {
|
|
45
|
-
|
|
46
|
-
const componentChildren = matches ? children : react_1.Children.toArray(children).reverse();
|
|
47
|
-
return ((0, jsx_runtime_1.jsx)("div", { ...props, className: "cim-modal-actions", children: componentChildren }));
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...props, className: "cim-modal-actions", children: children }));
|
|
48
44
|
}
|
|
49
45
|
ModalDialogActions.displayName = 'ModalDialogActions';
|
|
50
46
|
//# sourceMappingURL=modal-dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-dialog.js","sourceRoot":"","sources":["../../../../src/components/modal-dialog/modal-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;
|
|
1
|
+
{"version":3,"file":"modal-dialog.js","sourceRoot":"","sources":["../../../../src/components/modal-dialog/modal-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAiIb,0CAEC;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+BAAU,IACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,IAAA,cAAI,EAAC,iBAAiB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,YAElF,KAAK,GACK,CACd,EACD,uBAAC,qBAAO,kBAAa,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAC,OAAO,GAAG,IAC5D,EACL,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,IACjE,CACJ,GACS,GACH,GACK,CACnB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAA,2BAAU,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAEnC,mCAAW;AAOpC,4CAA4C;AAC5C,SAAgB,eAAe,CAAC,KAA2B;IACzD,OAAO,uBAAC,2CAAkB,OAAK,KAAK,EAAE,SAAS,EAAC,gBAAgB,EAAC,eAAe,EAAC,UAAU,GAAG,CAAC;AACjG,CAAC;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAOhD,4CAA4C;AAC5C,SAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAA2B;IAChF,OAAO,CACL,mCAAS,KAAK,EAAE,SAAS,EAAC,mBAAmB,YAC1C,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef, ReactNode } from 'react';\nimport {\n Dialog as RACDialog,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { FocusableContainer } from '../internal/focusable-container/focusable-container.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AriaLabelingProps, CommonProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface ModalDialogRenderProps {\n /** Closes the modal dialog when called. */\n close: () => void;\n}\n\nexport interface ModalDialogProps extends CommonProps, AriaLabelingProps {\n /** The contents of the modal dialog. A function may be provided to access a function to close the modal dialog. */\n children: ReactNode | ((renderProps: ModalDialogRenderProps) => ReactNode);\n /** The title of the modal dialog. */\n title: string;\n /**\n * The size of the modal dialog.\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Whether to close the modal dialog when the user interacts outside of it or presses the Escape key.\n * @default true\n */\n isDismissible?: boolean;\n /**\n * Whether the modal dialog is open (controlled).\n * If using `DialogRoot`, this prop has no effect - provide `isOpen` to `DialogRoot` instead.\n */\n isOpen?: boolean;\n /**\n * Whether the modal dialog is open by default (uncontrolled).\n * If using `DialogRoot`, this prop has no effect - provide `defaultOpen` to `DialogRoot` instead.\n */\n defaultOpen?: boolean;\n /**\n * Handler that is called when the modal dialog's open state changes.\n * If using `DialogRoot`, this prop has no effect - provide `onOpenChange` to `DialogRoot` instead.\n */\n onOpenChange?: (isOpen: boolean) => void;\n}\n\nfunction ModalDialog(\n {\n children,\n title,\n size = 'medium',\n UNSAFE_className,\n UNSAFE_style,\n isDismissible = true,\n isOpen,\n defaultOpen,\n onOpenChange,\n ...props\n }: ModalDialogProps,\n ref: ForwardedRef<HTMLElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!title && !ariaLabel && !ariaLabelledBy) {\n console.warn('ModalDialog requires one of title / aria-label / aria-labelledby for accessibility');\n }\n }, [title, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('common');\n\n return (\n <RACModalOverlay\n className=\"cim-modal-overlay\"\n isDismissable={isDismissible}\n isKeyboardDismissDisabled={!isDismissible}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n data-cim-style-root\n >\n <RACModal className={clsx('cim-modal', UNSAFE_className)} style={UNSAFE_style} data-size={size}>\n <RACDialog {...props} ref={ref} className=\"cim-modal-dialog\">\n {(renderProps) => (\n <>\n <div className=\"cim-modal-header\">\n {title && (\n <RACHeading\n slot=\"title\"\n className={clsx('cim-modal-title', textStyle({ variant: 'title-5', tone: 'base' }))}\n >\n {title}\n </RACHeading>\n )}\n <XButton aria-label={messages.format('dismiss')} slot=\"close\" />\n </div>\n {typeof children === 'function' ? children(renderProps) : children}\n </>\n )}\n </RACDialog>\n </RACModal>\n </RACModalOverlay>\n );\n}\n\n/**\n * Displays an overlay element which blocks interaction with outside elements.\n *\n * See [modal dialog usage guidelines](https://ui.cimpress.io/components/modal-dialog/).\n */\nconst _ModalDialog = forwardRef(ModalDialog, 'ModalDialog');\n\nexport { _ModalDialog as ModalDialog };\n\nexport interface ModalDialogBodyProps {\n /** The content to render within the modal dialog. */\n children: ReactNode;\n}\n\n/** Renders content within `ModalDialog`. */\nexport function ModalDialogBody(props: ModalDialogBodyProps) {\n return <FocusableContainer {...props} className=\"cim-modal-body\" scrollDirection=\"vertical\" />;\n}\n\nModalDialogBody.displayName = 'ModalDialogBody';\n\nexport interface ModalDialogActionsProps {\n /** Actions that should be available in the modal dialog. */\n children: ReactNode;\n}\n\n/** Renders actions within `ModalDialog`. */\nexport function ModalDialogActions({ children, ...props }: ModalDialogActionsProps) {\n return (\n <div {...props} className=\"cim-modal-actions\">\n {children}\n </div>\n );\n}\n\nModalDialogActions.displayName = 'ModalDialogActions';\n"]}
|
|
@@ -28,7 +28,7 @@ function NumberField({ label, description, error: errorMessage, placeholder, UNS
|
|
|
28
28
|
// NumberField uses `NaN` to signify an empty value, which is unintuitive
|
|
29
29
|
// https://github.com/adobe/react-spectrum/issues/5524
|
|
30
30
|
// https://github.com/adobe/react-spectrum/issues/6971
|
|
31
|
-
value: value === null ? Number.NaN : value, defaultValue: defaultValue === null ? Number.NaN : defaultValue, onChange: onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-number-field-input-group", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { className: (0, clsx_1.default)('cim-number-field-input', (0, utils_js_1.textStyle)({ variant: '
|
|
31
|
+
value: value === null ? Number.NaN : value, defaultValue: defaultValue === null ? Number.NaN : defaultValue, onChange: onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined, children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-number-field-input-group", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { className: (0, clsx_1.default)('cim-number-field-input', (0, utils_js_1.textStyle)({ variant: 'body' })), placeholder: placeholder }), (0, jsx_runtime_1.jsxs)("div", { className: "cim-number-field-spinner", children: [(0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { slot: "decrement", icon: (0, jsx_runtime_1.jsx)(index_js_2.IconSubtract, {}), "aria-label": messages.format('decrement'), variant: "tertiary", size: "small" }), (0, jsx_runtime_1.jsx)("div", { className: "cim-number-field-spinner-separator" }), (0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { slot: "increment", icon: (0, jsx_runtime_1.jsx)(index_js_2.IconAdd, {}), "aria-label": messages.format('increment'), variant: "tertiary", size: "small" })] })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }));
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Allows users to edit a number with a keyboard or increment/decrement buttons.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.js","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AAExB,iEAK+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAA6D;AAC7D,qFAA6E;AAC7E,mEAA2D;AAC3D,6DAAsD;AACtD,wEAA4G;AAE5G,qDAAmD;AA2BnD,SAAS,WAAW,CAClB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACS,EACnB,GAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,gDAAoB,EAAC,GAAG,EAAE;QACxB,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QACrG,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAEvC,MAAM,QAAQ,GAAG,IAAA,+BAAoB,EAAC,aAAa,CAAC,CAAC;IAErD,OAAO,CACL,wBAAC,mCAAc,OACT,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAI,EAAC,kBAAkB,EAAE,gBAAgB,CAAC,EACrD,KAAK,EAAE,YAAY;QACnB,yEAAyE;QACzE,sDAAsD;QACtD,sDAAsD;QACtD,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAC1C,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,EAC/D,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,aAExF,uBAAC,8BAAc,IAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,YACvE,KAAK,GACS,EACjB,wBAAC,6BAAQ,IAAC,SAAS,EAAC,8BAA8B,aAChD,uBAAC,6BAAQ,IACP,SAAS,EAAE,IAAA,cAAI,EAAC,wBAAwB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"number-field.js","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AAExB,iEAK+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAA6D;AAC7D,qFAA6E;AAC7E,mEAA2D;AAC3D,6DAAsD;AACtD,wEAA4G;AAE5G,qDAAmD;AA2BnD,SAAS,WAAW,CAClB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACS,EACnB,GAAiC;IAEjC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAE7E,IAAA,gDAAoB,EAAC,GAAG,EAAE;QACxB,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QACrG,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,E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AAS,EAAC,oCAAoC,GAAG,EACtD,uBAAC,2BAAU,IACT,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,uBAAC,kBAAO,KAAG,gBACL,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,EACxC,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,GACZ,IACE,IACG,EACX,uBAAC,8BAAc,cAAE,YAAY,GAAkB,EAC/C,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,IAC3C,CAClB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAEnD,mCAAW","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport {\n Input as RACInput,\n NumberField as RACNumberField,\n type NumberFieldProps as RACNumberFieldProps,\n Group as RACGroup,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconAdd, IconSubtract } 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, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface NumberFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<number>,\n Pick<\n RACNumberFieldProps,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'minValue'\n | 'maxValue'\n | 'step'\n | 'formatOptions'\n | 'onFocus'\n | 'onBlur'\n > {\n /** The current value (controlled). A `null` value means an empty field. */\n value?: number | null;\n /** The default value (uncontrolled). A `null` value means an empty field. */\n defaultValue?: number | null;\n /** Handler that is called when the value changes. A `null` value means an empty field. */\n onChange?: (value: number | null) => void;\n}\n\nfunction NumberField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n value,\n defaultValue,\n onChange,\n ...props\n }: NumberFieldProps,\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('NumberField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('numberField');\n\n return (\n <RACNumberField\n {...props}\n ref={ref}\n className={clsx('cim-number-field', UNSAFE_className)}\n style={UNSAFE_style}\n // NumberField uses `NaN` to signify an empty value, which is unintuitive\n // https://github.com/adobe/react-spectrum/issues/5524\n // https://github.com/adobe/react-spectrum/issues/6971\n value={value === null ? Number.NaN : value}\n defaultValue={defaultValue === null ? Number.NaN : defaultValue}\n onChange={onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-number-field-input-group\">\n <RACInput\n className={clsx('cim-number-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n />\n <div className=\"cim-number-field-spinner\">\n <IconButton\n slot=\"decrement\"\n icon={<IconSubtract />}\n aria-label={messages.format('decrement')}\n variant=\"tertiary\"\n size=\"small\"\n />\n <div className=\"cim-number-field-spinner-separator\" />\n <IconButton\n slot=\"increment\"\n icon={<IconAdd />}\n aria-label={messages.format('increment')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </RACNumberField>\n );\n}\n\n/**\n * Allows users to edit a number with a keyboard or increment/decrement buttons.\n *\n * See [number field usage guidelines](https://ui.cimpress.io/components/number-field/).\n */\nconst _NumberField = withStyleProps(forwardRef(NumberField), 'NumberField');\n\nexport { _NumberField as NumberField };\n"]}
|