@cloudscape-design/components 3.0.1277 → 3.0.1279
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/action-card/index.d.ts +1 -1
- package/action-card/index.d.ts.map +1 -1
- package/action-card/index.js.map +1 -1
- package/action-card/internal.d.ts +1 -1
- package/action-card/internal.d.ts.map +1 -1
- package/action-card/internal.js.map +1 -1
- package/breadcrumb-group/interfaces.d.ts +1 -1
- package/breadcrumb-group/interfaces.js.map +1 -1
- package/cards/index.js +49 -41
- package/cards/index.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +7 -6
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +8 -0
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/drawer/implementation.d.ts +7 -2
- package/drawer/implementation.d.ts.map +1 -1
- package/drawer/implementation.js +5 -2
- package/drawer/implementation.js.map +1 -1
- package/drawer/index.d.ts +11 -1
- package/drawer/index.d.ts.map +1 -1
- package/drawer/index.js +16 -4
- package/drawer/index.js.map +1 -1
- package/drawer/interfaces.d.ts +72 -7
- package/drawer/interfaces.d.ts.map +1 -1
- package/drawer/interfaces.js +2 -0
- package/drawer/interfaces.js.map +1 -1
- package/drawer/next.d.ts +16 -0
- package/drawer/next.d.ts.map +1 -0
- package/drawer/next.js +31 -0
- package/drawer/next.js.map +1 -0
- package/drawer/styles.css.js +16 -12
- package/drawer/styles.scoped.css +23 -17
- package/drawer/styles.selectors.js +16 -12
- package/drawer/utils.d.ts +12 -0
- package/drawer/utils.d.ts.map +1 -0
- package/drawer/utils.js +74 -0
- package/drawer/utils.js.map +1 -0
- package/internal/base-component/styles.scoped.css +5 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/styles/tokens.d.ts +1 -0
- package/internal/generated/styles/tokens.js +1 -0
- package/internal/generated/theming/index.cjs +31 -0
- package/internal/generated/theming/index.js +31 -0
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/table/selection/interfaces.d.ts +1 -0
- package/table/selection/interfaces.d.ts.map +1 -1
- package/table/selection/interfaces.js.map +1 -1
- package/table/selection/selection-control.d.ts +1 -0
- package/table/selection/selection-control.d.ts.map +1 -1
- package/table/selection/selection-control.js +9 -2
- package/table/selection/selection-control.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';\nimport { TimeInputProps } from '../time-input/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * Provides a reason why a particular date in the calendar is not enabled (only when `isDateEnabled` returns `false`).\n * If provided, the date becomes focusable.\n * @param date\n */\n dateDisabledReason?: DateRangePickerProps.DateDisabledReasonFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * This does not apply when the 'granularity' is set to 'month'\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the date format to use on the date inputs in the absolute dropdown.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n dateInputFormat?: DateRangePickerProps.DateInputFormat;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true or `granularity` is set to 'month'.\n */\n timeInputFormat?: DateRangePickerProps.TimeInputFormat;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps,\n Pick<CalendarProps, 'granularity'> {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies which time units to allow in the custom relative range control.\n */\n customRelativeRangeUnits?: DateRangePickerProps.TimeUnit[];\n\n /**\n * Specifies custom content to fully override the relative range tab.\n * When provided, all default relative range functionality is replaced.\n */\n renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Specifies whether to start with the previous or current period (month or year)\n * when multiple calendar grids are displayed in absolute mode.\n *\n * Defaults to 'auto', which starts with previous if no date is selected,\n * or current if a selection is present.\n */\n absoluteMultiGridStartPeriod?: DateRangePickerProps.StartPeriod;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface DateDisabledReasonFunction {\n (date: Date): string;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RelativeRangeControl = (\n selectedRange: RelativeValue | null,\n setSelectedRange: (value: RelativeValue) => void\n ) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n * @deprecated Use `ariaLabel` on the component instead.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n * @deprecated Use `ariaLabelledby` on the component instead.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n * @deprecated Use `ariaDescribedby` on the component instead.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n * @i18n\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n * @i18n\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n * @i18n\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Description for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionMonthlyDescription?: string;\n\n /**\n * Visible label of the Cancel button\n * @i18n\n */\n cancelButtonLabel?: string;\n\n /**\n * Visible label of the Clear and dismiss button\n * @i18n\n */\n clearButtonLabel?: string;\n\n /**\n * Visible label of the Apply button\n * @i18n\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n * @i18n\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n * @i18n\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationLabel?: string;\n\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationPlaceholder?: string;\n\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n * @i18n\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Visible label for the Start Month input for the\n * absolute range.\n * @i18n\n */\n startMonthLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n * @i18n\n */\n startDateLabel?: string;\n\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n * @i18n\n */\n startTimeLabel?: string;\n\n /**\n * Visible label for the End Month input for the\n * absolute range.\n * @i18n\n */\n endMonthLabel?: string;\n\n /**\n * Visible label for the End Date input for the\n * absolute range.\n * @i18n\n */\n endDateLabel?: string;\n\n /**\n * Visible label for the End Time input for the absolute range.\n * This serves as a fallback if no format specific date constraint test is provided\n *\n * @i18n\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the date input field for the\n * absolute range with no time option.\n * @i18n\n */\n dateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'slashed' format with no time option.\n * @i18n\n */\n slashedDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'iso' format with no time option.\n * @i18n\n */\n isoDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range.\n * This serves as a fallback if no format specific datetime constraint test is provided\n *\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'iso' format with.\n * @i18n\n */\n isoDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range.\n * This serves as a fallback if no format specific month constraint test is provided.\n *\n * @i18n\n */\n monthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedMonthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'iso' format.\n * @i18n\n */\n isoMonthConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n * @i18n\n */\n todayAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n * @i18n\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n * @i18n\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Used as part of the `aria-label` for the current month in the calendar.\n * @i18n\n */\n currentMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next year' button.\n * @i18n\n */\n nextYearAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous year' button.\n * @i18n\n */\n previousYearAriaLabel?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'iso' format (dashes).\n * Should match the expected date format (for example \"YYYY-MM-DD\", \"JJJJ-MM-TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n isoDatePlaceholder?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'slashed' format (slashes).\n * Should match the expected date format (for example \"YYYY/MM/DD\", \"JJJJ/MM/TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n slashedDatePlaceholder?: string;\n\n /**\n * Placeholder text for time inputs in absolute mode.\n * Should match the expected time format (for example \"hh:mm:ss\", \"HH:MM:SS\").\n * Used for both start and end time inputs.\n * @i18n\n */\n timePlaceholder?: string;\n }\n\n export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\n\n export type StartPeriod = 'previous' | 'current' | 'auto';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-range-picker/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { ExpandToViewport } from '../dropdown/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { DateFormat, EditableDateFormat } from '../internal/utils/date-time/interfaces';\nimport { TimeInputProps } from '../time-input/interfaces';\n\nexport interface DateRangePickerBaseProps {\n /**\n * The current date range value. Can be either an absolute time range\n * or a relative time range.\n */\n value: null | DateRangePickerProps.Value;\n\n /**\n * A list of relative time ranges that are shown as suggestions.\n */\n relativeOptions: ReadonlyArray<DateRangePickerProps.RelativeOption>;\n\n /**\n * A function that defines whether a particular date should be enabled\n * in the calendar or not. Note that disabling a date in the calendar\n * still allows users to enter this date via keyboard. We therefore\n * recommend that you also validate these constraints client- and\n * server-side, in the same way as for other form elements.\n */\n isDateEnabled?: DateRangePickerProps.IsDateEnabledFunction;\n\n /**\n * Provides a reason why a particular date in the calendar is not enabled (only when `isDateEnabled` returns `false`).\n * If provided, the date becomes focusable.\n * @param date\n */\n dateDisabledReason?: DateRangePickerProps.DateDisabledReasonFunction;\n\n /**\n * The locale to be used for rendering month names and defining the\n * starting date of the week. If not provided, it will be determined\n * from the page and browser locales. Supported values and formats\n * are as-per the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Starting day of the week. [0-6] maps to [Sunday-Saturday].\n * By default the starting day of the week is defined by the locale,\n * but you can override it using this property.\n */\n startOfWeek?: number;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * @i18n\n */\n i18nStrings?: DateRangePickerProps.I18nStrings;\n\n /**\n * Hides time inputs and changes the input format to date-only, e.g. 2021-04-06.\n *\n * Do not use `dateOnly` flag conditionally. The component does not trigger the value update\n * when the flag changes which means the value format can become inconsistent.\n *\n * This does not apply when the 'granularity' is set to 'month'\n *\n * Default: `false`.\n */\n dateOnly?: boolean;\n\n /**\n * Determines the range selector mode as follows:\n *\n * * `default` for combined absolute/relative range selector.\n * * `absolute-only` for absolute-only range selector.\n * * `relative-only` for relative-only range selector.\n *\n * By default, the range selector mode is `default`.\n */\n rangeSelectorMode?: DateRangePickerProps.RangeSelectorMode;\n\n /**\n * Specifies the date format to use on the date inputs in the absolute dropdown.\n *\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n dateInputFormat?: DateRangePickerProps.DateInputFormat;\n\n /**\n * Specifies the format of the time input for absolute ranges.\n *\n * Use to restrict the granularity of time that the user can enter.\n *\n * Has no effect when `dateOnly` is true or `granularity` is set to 'month'.\n */\n timeInputFormat?: DateRangePickerProps.TimeInputFormat;\n\n /**\n * Fired whenever a user changes the component's value.\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<DateRangePickerProps.ChangeDetail>;\n\n /**\n * The time offset from UTC in minutes that should be used to\n * display and produce values.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n *\n * @deprecated Use `getTimeOffset` instead.\n */\n timeOffset?: number;\n\n /**\n * A function that defines timezone offset from UTC in minutes for selected dates.\n * Use it to define time relative to the desired timezone.\n *\n * The function is called for the start date and the end date and takes a UTC date\n * corresponding the selected value as an argument.\n *\n * Has no effect when `dateOnly` is true.\n *\n * Default: the user's current time offset as provided by the browser.\n */\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction;\n}\nexport interface DateRangePickerProps\n extends BaseComponentProps,\n FormFieldValidationControlProps,\n ExpandToViewport,\n DateRangePickerBaseProps,\n Pick<CalendarProps, 'granularity'> {\n /**\n * Specifies the placeholder text that is rendered when the value is empty.\n */\n placeholder?: string;\n\n /**\n * Specifies that the component is disabled, preventing the user from\n * modifying the value. A disabled component cannot receive focus.\n */\n disabled?: boolean;\n\n /**\n * Specifies that the component is read-only, preventing the user from\n * modifying the value. A read-only component can receive focus.\n */\n readOnly?: boolean;\n\n /**\n * Fired when keyboard focus is set onto the UI control.\n */\n onFocus?: NonCancelableEventHandler<null>;\n\n /**\n * Fired when keyboard focus is removed from the UI control.\n */\n onBlur?: NonCancelableEventHandler<null>;\n\n /**\n * A function that defines whether a particular range is valid or not.\n *\n * Ensure that your function checks for missing fields in the value.\n */\n isValidRange: DateRangePickerProps.ValidationFunction;\n\n /**\n * Specifies whether the component should show a button that\n * allows the user to clear the selected value.\n */\n showClearButton?: boolean;\n\n /**\n * Specifies an additional control displayed in the dropdown, located below the range calendar.\n */\n customAbsoluteRangeControl?: DateRangePickerProps.AbsoluteRangeControl;\n\n /**\n * Specifies which time units to allow in the custom relative range control.\n */\n customRelativeRangeUnits?: DateRangePickerProps.TimeUnit[];\n\n /**\n * Specifies custom content to fully override the relative range tab.\n * When provided, all default relative range functionality is replaced.\n */\n renderRelativeRangeContent?: DateRangePickerProps.RelativeRangeControl;\n\n /**\n * Specifies the time format to use for displaying the absolute time range.\n *\n * It can take the following values:\n * * `iso`: ISO 8601 format, e.g.: 2024-01-30T13:32:32+01:00 (or 2024-01-30 when `dateOnly` is true)\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024, 13:32:32 (UTC+1) (or January 30, 2024 when `dateOnly` is true)\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)\n */\n absoluteFormat?: DateRangePickerProps.AbsoluteFormat;\n\n /**\n * Specifies whether to hide the time offset in the displayed absolute time range.\n * Defaults to `false`.\n */\n hideTimeOffset?: boolean;\n\n /**\n * Adds `aria-label` to the trigger and dropdown.\n */\n ariaLabel?: string;\n\n /**\n * Specifies whether to start with the previous or current period (month or year)\n * when multiple calendar grids are displayed in absolute mode.\n *\n * Defaults to 'auto', which starts with previous if no date is selected,\n * or current if a selection is present.\n */\n absoluteMultiGridStartPeriod?: DateRangePickerProps.StartPeriod;\n\n /**\n * Specifies custom content to fully override the trigger content.\n * When provided, the default content of the trigger is replaced.\n */\n renderTriggerContent?: DateRangePickerProps.RenderTriggerContent;\n}\n\nexport namespace DateRangePickerProps {\n export type Value = AbsoluteValue | RelativeValue;\n export interface AbsoluteValue {\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n startDate: string;\n /**\n * In ISO8601 format, e.g.: 2021-04-06T17:23:50+02:00 (or 2021-04-06 when `dateOnly` is true)\n */\n endDate: string;\n type: 'absolute';\n }\n\n export interface RelativeValue {\n /**\n * If provided, used to match this value\n * to a provided relative option.\n */\n key?: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n export interface RelativeOption {\n /**\n * Used to uniquely identify this relative option.\n */\n key: string;\n amount: number;\n unit: TimeUnit;\n type: 'relative';\n }\n\n export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n\n export type ValidationFunction = (value: Value | null) => ValidationResult;\n\n export type ValidationResult = ValidRangeResult | InvalidRangeResult;\n\n export interface ValidRangeResult {\n valid: true;\n }\n\n export interface InvalidRangeResult {\n valid: false;\n errorMessage: string;\n }\n\n export interface ChangeDetail {\n /**\n * The newly selected range of this date range picker.\n */\n value: null | Value;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n\n export interface DateDisabledReasonFunction {\n (date: Date): string;\n }\n\n export interface GetTimeOffsetFunction {\n (date: Date): number;\n }\n\n export interface DateTimeStrings {\n date: string;\n time: string;\n }\n\n export interface PendingAbsoluteValue {\n start: DateTimeStrings;\n end: DateTimeStrings;\n }\n\n export type AbsoluteRangeControl = (\n selectedRange: PendingAbsoluteValue,\n setSelectedRange: React.Dispatch<React.SetStateAction<PendingAbsoluteValue>>\n ) => React.ReactNode;\n\n export type RelativeRangeControl = (\n selectedRange: RelativeValue | null,\n setSelectedRange: (value: RelativeValue) => void\n ) => React.ReactNode;\n\n export type RenderTriggerContent = (props: { formattedDate: JSX.Element }) => React.ReactNode;\n\n export type RangeSelectorMode = 'default' | 'absolute-only' | 'relative-only';\n\n export interface Ref {\n /**\n * Sets the browser focus on the UI control\n */\n focus(): void;\n }\n\n export interface I18nStrings {\n /**\n * Adds `aria-label` to the trigger and dropdown.\n * @deprecated Use `ariaLabel` on the component instead.\n */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n * @deprecated Use `ariaLabelledby` on the component instead.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\n * @deprecated Use `ariaDescribedby` on the component instead.\n */\n ariaDescribedby?: string;\n\n /**\n * Label of the mode selection group. In the standard view, it adds 'aria-label' to the group of segments.\n * In a narrow container the label is visible and attached to the select component.\n * @i18n\n */\n modeSelectionLabel?: string;\n\n /**\n * Segment title of the relative range selection mode\n * @i18n\n */\n relativeModeTitle?: string;\n\n /**\n * Segment title of the absolute range selection mode\n * @i18n\n */\n absoluteModeTitle?: string;\n\n /**\n * Heading for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionHeading?: string;\n\n /**\n * Description for the relative range selection area\n * @i18n\n */\n relativeRangeSelectionMonthlyDescription?: string;\n\n /**\n * Visible label of the Cancel button\n * @i18n\n */\n cancelButtonLabel?: string;\n\n /**\n * Visible label of the Clear and dismiss button\n * @i18n\n */\n clearButtonLabel?: string;\n\n /**\n * Visible label of the Apply button\n * @i18n\n */\n applyButtonLabel?: string;\n\n /**\n * Formatting function for relative ranges.\n * This function must convert a relative range to a human-readable string.\n * @i18n\n */\n formatRelativeRange?: (value: RelativeValue) => string;\n\n /**\n * Formatting function for time units.\n *\n * This function must return a localized form of the unit that fits the provided time value.\n * @i18n\n */\n formatUnit?: (unit: TimeUnit, value: number) => string;\n\n /**\n * Visible label for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionLabel?: string;\n\n /**\n * Visible description for the option for selecting\n * a custom relative range.\n * @i18n\n */\n customRelativeRangeOptionDescription?: string;\n\n /**\n * Visible label for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationLabel?: string;\n\n /**\n * Placeholder for the duration selector for\n * the custom relative range.\n * @i18n\n */\n customRelativeRangeDurationPlaceholder?: string;\n\n /**\n * Visible label for the unit selector for the\n * custom relative range.\n * @i18n\n */\n customRelativeRangeUnitLabel?: string;\n\n /**\n * Visible label for the Start Month input for the\n * absolute range.\n * @i18n\n */\n startMonthLabel?: string;\n\n /**\n * Visible label for the Start Date input for the\n * absolute range.\n * @i18n\n */\n startDateLabel?: string;\n\n /**\n * Visible label for the Start Time input for the\n * absolute range.\n * @i18n\n */\n startTimeLabel?: string;\n\n /**\n * Visible label for the End Month input for the\n * absolute range.\n * @i18n\n */\n endMonthLabel?: string;\n\n /**\n * Visible label for the End Date input for the\n * absolute range.\n * @i18n\n */\n endDateLabel?: string;\n\n /**\n * Visible label for the End Time input for the absolute range.\n * This serves as a fallback if no format specific date constraint test is provided\n *\n * @i18n\n */\n endTimeLabel?: string;\n\n /**\n * Constraint text for the date input field for the\n * absolute range with no time option.\n * @i18n\n */\n dateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'slashed' format with no time option.\n * @i18n\n */\n slashedDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range in 'iso' format with no time option.\n * @i18n\n */\n isoDateConstraintText?: string;\n\n /**\n * Constraint text for the input fields for the absolute range.\n * This serves as a fallback if no format specific datetime constraint test is provided\n *\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the date input fields for the absolute range in 'iso' format with.\n * @i18n\n */\n isoDateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range.\n * This serves as a fallback if no format specific month constraint test is provided.\n *\n * @i18n\n */\n monthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'slashed' format.\n * @i18n\n */\n slashedMonthConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the absolute range in 'iso' format.\n * @i18n\n */\n isoMonthConstraintText?: string;\n\n /**\n * Provides a text alternative for the error icon in the error alert.\n * @i18n\n */\n errorIconAriaLabel?: string;\n\n /**\n * When the property is set, screen readers announce the selected range when the absolute range gets selected.\n */\n renderSelectedAbsoluteRangeAriaLive?: (startDate: string, endDate: string) => string;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n * @i18n\n */\n todayAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n * @i18n\n */\n nextMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n * @i18n\n */\n previousMonthAriaLabel?: string;\n\n /**\n * Used as part of the `aria-label` for the current month in the calendar.\n * @i18n\n */\n currentMonthAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'next year' button.\n * @i18n\n */\n nextYearAriaLabel?: string;\n\n /**\n * Specifies an `aria-label` for the 'previous year' button.\n * @i18n\n */\n previousYearAriaLabel?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'iso' format (dashes).\n * Should match the expected date format (for example \"YYYY-MM-DD\", \"JJJJ-MM-TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n isoDatePlaceholder?: string;\n\n /**\n * Placeholder text for date inputs in absolute mode with 'slashed' format (slashes).\n * Should match the expected date format (for example \"YYYY/MM/DD\", \"JJJJ/MM/TT\" for German).\n * Used for both start and end date inputs.\n * @i18n\n */\n slashedDatePlaceholder?: string;\n\n /**\n * Placeholder text for time inputs in absolute mode.\n * Should match the expected time format (for example \"hh:mm:ss\", \"HH:MM:SS\").\n * Used for both start and end time inputs.\n * @i18n\n */\n timePlaceholder?: string;\n }\n\n export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\n\n export type StartPeriod = 'previous' | 'current' | 'auto';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
2
|
-
import {
|
|
3
|
-
type DrawerInternalProps =
|
|
2
|
+
import { NextDrawerProps } from './interfaces';
|
|
3
|
+
type DrawerInternalProps = NextDrawerProps & InternalBaseComponentProps;
|
|
4
4
|
export declare function DrawerImplementation({
|
|
5
5
|
header,
|
|
6
6
|
footer,
|
|
@@ -10,6 +10,11 @@ export declare function DrawerImplementation({
|
|
|
10
10
|
disableContentPaddings,
|
|
11
11
|
__internalRootRef,
|
|
12
12
|
headerActions,
|
|
13
|
+
position,
|
|
14
|
+
placement,
|
|
15
|
+
offset,
|
|
16
|
+
stickyOffset,
|
|
17
|
+
zIndex,
|
|
13
18
|
...restProps
|
|
14
19
|
}: DrawerInternalProps): JSX.Element;
|
|
15
20
|
export declare const createWidgetizedDrawer: (Loader?: typeof DrawerImplementation | undefined) => typeof DrawerImplementation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM/C,KAAK,mBAAmB,GAAG,eAAe,GAAG,0BAA0B,CAAC;AAExE,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,QAAmB,EACnB,SAAiB,EACjB,MAAM,EACN,YAAY,EACZ,MAAM,EACN,GAAG,SAAS,EACb,EAAE,mBAAmB,eAwErB;AAED,eAAO,MAAM,sBAAsB,mFAAkD,CAAC"}
|
package/drawer/implementation.js
CHANGED
|
@@ -11,14 +11,17 @@ import { createWidgetizedComponent } from '../internal/widgets';
|
|
|
11
11
|
import InternalLiveRegion from '../live-region/internal';
|
|
12
12
|
import InternalStatusIndicator from '../status-indicator/internal';
|
|
13
13
|
import { useStickyFooter } from './use-sticky-footer';
|
|
14
|
+
import { getPositionStyles } from './utils';
|
|
14
15
|
import styles from './styles.css.js';
|
|
15
|
-
export function DrawerImplementation({ header, footer, children, loading, i18nStrings, disableContentPaddings, __internalRootRef, headerActions, ...restProps }) {
|
|
16
|
+
export function DrawerImplementation({ header, footer, children, loading, i18nStrings, disableContentPaddings, __internalRootRef, headerActions, position = 'static', placement = 'end', offset, stickyOffset, zIndex, ...restProps }) {
|
|
16
17
|
const baseProps = getBaseProps(restProps);
|
|
17
18
|
const isToolbar = useAppLayoutToolbarDesignEnabled();
|
|
18
19
|
const i18n = useInternalI18n('drawer');
|
|
20
|
+
const positionStyles = getPositionStyles({ position, placement, offset, stickyOffset, zIndex });
|
|
19
21
|
const containerProps = {
|
|
20
22
|
...baseProps,
|
|
21
|
-
|
|
23
|
+
style: positionStyles.style,
|
|
24
|
+
className: clsx(baseProps.className, styles.drawer, isToolbar && styles['with-toolbar'], !!footer && styles['with-footer'], positionStyles.className),
|
|
22
25
|
};
|
|
23
26
|
const footerRef = useRef(null);
|
|
24
27
|
const runtimeDrawerContext = useRuntimeDrawerContext({ rootRef: __internalRootRef });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../../src/drawer/implementation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,MAAM,UAAU,oBAAoB,CAAC,EACnC,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,QAAQ,GAAG,QAAQ,EACnB,SAAS,GAAG,KAAK,EACjB,MAAM,EACN,YAAY,EACZ,MAAM,EACN,GAAG,SAAS,EACQ;IACpB,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,gCAAgC,EAAE,CAAC;IACrD,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IAChG,MAAM,cAAc,GAAG;QACrB,GAAG,SAAS;QACZ,KAAK,EAAE,cAAc,CAAC,KAAK;QAC3B,SAAS,EAAE,IAAI,CACb,SAAS,CAAC,SAAS,EACnB,MAAM,CAAC,MAAM,EACb,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,EACnC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,EACjC,cAAc,CAAC,SAAS,CACzB;KACF,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE/C,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,OAAO,EAAE,iBAA2C,EAAE,CAAC,CAAC;IAC/G,MAAM,yBAAyB,GAAG,CAAC,CAAC,CAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,YAAY,CAAA,CAAC;IACvE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,eAAe,CAAC;QACnD,SAAS,EAAE,iBAA2C;QACtD,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,CAAC,CAAC,CACf,gCACM,cAAc,EAClB,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAC1E,GAAG,EAAE,iBAAiB;QAEtB,oBAAC,uBAAuB,IAAC,IAAI,EAAC,SAAS;YACrC,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,IAC/B,IAAI,CAAC,yBAAyB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,CAAC,CACvC,CACG,CACtB,CACP,CAAC,CAAC,CAAC,CACF,gCAAS,cAAc,EAAE,GAAG,EAAE,iBAAiB;QAC5C,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,MAAM,EACb,oBAAoB,IAAI,MAAM,CAAC,sBAAsB,CAAC,EACtD,yBAAyB,IAAI,MAAM,CAAC,wBAAwB,CAAC,CAC9D;YAEA,MAAM;YACN,aAAa,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,IAAG,aAAa,CAAO,CAC7E,CACP;QACD,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,2BAA2B,CAAC,EACnC,MAAM,CAAC,OAAO,EACd,CAAC,sBAAsB,IAAI,MAAM,CAAC,uBAAuB,CAAC,CAC3D;YAED,oBAAC,oBAAoB,QAAE,QAAQ,CAAwB,CACnD;QACL,MAAM,IAAI,CACT,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC7B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,cAAc;aACtC,CAAC,IAED,MAAM,CACH,CACP,CACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC,oBAAoB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useRuntimeDrawerContext } from '../app-layout/runtime-drawer/use-runtime-drawer-context';\nimport { useAppLayoutToolbarDesignEnabled } from '../app-layout/utils/feature-flags';\nimport { BuiltInErrorBoundary } from '../error-boundary/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { createWidgetizedComponent } from '../internal/widgets';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport { NextDrawerProps } from './interfaces';\nimport { useStickyFooter } from './use-sticky-footer';\nimport { getPositionStyles } from './utils';\n\nimport styles from './styles.css.js';\n\ntype DrawerInternalProps = NextDrawerProps & InternalBaseComponentProps;\n\nexport function DrawerImplementation({\n header,\n footer,\n children,\n loading,\n i18nStrings,\n disableContentPaddings,\n __internalRootRef,\n headerActions,\n position = 'static',\n placement = 'end',\n offset,\n stickyOffset,\n zIndex,\n ...restProps\n}: DrawerInternalProps) {\n const baseProps = getBaseProps(restProps);\n const isToolbar = useAppLayoutToolbarDesignEnabled();\n const i18n = useInternalI18n('drawer');\n const positionStyles = getPositionStyles({ position, placement, offset, stickyOffset, zIndex });\n const containerProps = {\n ...baseProps,\n style: positionStyles.style,\n className: clsx(\n baseProps.className,\n styles.drawer,\n isToolbar && styles['with-toolbar'],\n !!footer && styles['with-footer'],\n positionStyles.className\n ),\n };\n const footerRef = useRef<HTMLDivElement>(null);\n\n const runtimeDrawerContext = useRuntimeDrawerContext({ rootRef: __internalRootRef as RefObject<HTMLElement> });\n const hasAdditionalDrawerAction = !!runtimeDrawerContext?.isExpandable;\n const { isSticky: isFooterSticky } = useStickyFooter({\n drawerRef: __internalRootRef as RefObject<HTMLElement>,\n footerRef,\n });\n\n return loading ? (\n <div\n {...containerProps}\n className={clsx(containerProps.className, styles['content-with-paddings'])}\n ref={__internalRootRef}\n >\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">\n {i18n('i18nStrings.loadingText', i18nStrings?.loadingText)}\n </InternalLiveRegion>\n </InternalStatusIndicator>\n </div>\n ) : (\n <div {...containerProps} ref={__internalRootRef}>\n {header && (\n <div\n className={clsx(\n styles.header,\n runtimeDrawerContext && styles['with-runtime-context'],\n hasAdditionalDrawerAction && styles['with-additional-action']\n )}\n >\n {header}\n {headerActions && <div className={styles['header-actions']}>{headerActions}</div>}\n </div>\n )}\n <div\n className={clsx(\n styles['test-utils-drawer-content'],\n styles.content,\n !disableContentPaddings && styles['content-with-paddings']\n )}\n >\n <BuiltInErrorBoundary>{children}</BuiltInErrorBoundary>\n </div>\n {footer && (\n <div\n ref={footerRef}\n className={clsx(styles.footer, {\n [styles['is-sticky']]: isFooterSticky,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n );\n}\n\nexport const createWidgetizedDrawer = createWidgetizedComponent(DrawerImplementation);\n"]}
|
package/drawer/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import { DrawerProps } from './interfaces';
|
|
2
2
|
export { DrawerProps };
|
|
3
|
-
|
|
3
|
+
declare const Drawer: ({
|
|
4
|
+
header,
|
|
5
|
+
headerActions,
|
|
6
|
+
footer,
|
|
7
|
+
disableContentPaddings,
|
|
8
|
+
loading,
|
|
9
|
+
children,
|
|
10
|
+
i18nStrings,
|
|
11
|
+
...props
|
|
12
|
+
}: DrawerProps) => JSX.Element;
|
|
13
|
+
export default Drawer;
|
package/drawer/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,GAAmB,qGAS5B,WAAW,gBA0Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/drawer/index.js
CHANGED
|
@@ -2,12 +2,24 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
'use client';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { getBaseProps } from '../internal/base-component';
|
|
5
6
|
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
6
7
|
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
7
8
|
import { InternalDrawer } from './internal';
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const Drawer = function Drawer({ header, headerActions, footer, disableContentPaddings = false, loading = false, children, i18nStrings, ...props }) {
|
|
10
|
+
const baseComponentProps = useBaseComponent('Drawer', {
|
|
11
|
+
props: {
|
|
12
|
+
disableContentPaddings,
|
|
13
|
+
loading,
|
|
14
|
+
},
|
|
15
|
+
metadata: {
|
|
16
|
+
hasHeader: !!header,
|
|
17
|
+
hasHeaderActions: !!headerActions,
|
|
18
|
+
hasFooter: !!footer,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return (React.createElement(InternalDrawer, { ...getBaseProps(props), ...baseComponentProps, header: header, headerActions: headerActions, footer: footer, disableContentPaddings: disableContentPaddings, loading: loading, i18nStrings: i18nStrings }, children));
|
|
22
|
+
};
|
|
23
|
+
export default Drawer;
|
|
12
24
|
applyDisplayName(Drawer, 'Drawer');
|
|
13
25
|
//# sourceMappingURL=index.js.map
|
package/drawer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,MAAM,MAAM,GAAG,SAAS,MAAM,CAAC,EAC7B,MAAM,EACN,aAAa,EACb,MAAM,EACN,sBAAsB,GAAG,KAAK,EAC9B,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,WAAW,EACX,GAAG,KAAK,EACI;IACZ,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE;QACpD,KAAK,EAAE;YACL,sBAAsB;YACtB,OAAO;SACR;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,CAAC,CAAC,MAAM;YACnB,gBAAgB,EAAE,CAAC,CAAC,aAAa;YACjC,SAAS,EAAE,CAAC,CAAC,MAAM;SACpB;KACF,CAAC,CAAC;IACH,OAAO,CACL,oBAAC,cAAc,OACT,YAAY,CAAC,KAAK,CAAC,KACnB,kBAAkB,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,IAEvB,QAAQ,CACM,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\nimport React from 'react';\n\nimport { getBaseProps } from '../internal/base-component';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { DrawerProps } from './interfaces';\nimport { InternalDrawer } from './internal';\n\nexport { DrawerProps };\n\nconst Drawer = function Drawer({\n header,\n headerActions,\n footer,\n disableContentPaddings = false,\n loading = false,\n children,\n i18nStrings,\n ...props\n}: DrawerProps) {\n const baseComponentProps = useBaseComponent('Drawer', {\n props: {\n disableContentPaddings,\n loading,\n },\n metadata: {\n hasHeader: !!header,\n hasHeaderActions: !!headerActions,\n hasFooter: !!footer,\n },\n });\n return (\n <InternalDrawer\n {...getBaseProps(props)}\n {...baseComponentProps}\n header={header}\n headerActions={headerActions}\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n loading={loading}\n i18nStrings={i18nStrings}\n >\n {children}\n </InternalDrawer>\n );\n};\n\nexport default Drawer;\n\napplyDisplayName(Drawer, 'Drawer');\n"]}
|
package/drawer/interfaces.d.ts
CHANGED
|
@@ -9,11 +9,10 @@ export interface DrawerProps extends BaseComponentProps {
|
|
|
9
9
|
header?: React.ReactNode;
|
|
10
10
|
/**
|
|
11
11
|
* Main content of the drawer.
|
|
12
|
-
*
|
|
13
12
|
*/
|
|
14
13
|
children?: React.ReactNode;
|
|
15
14
|
/**
|
|
16
|
-
* Renders the drawer in a loading state. We recommend that you also set a `loadingText`.
|
|
15
|
+
* Renders the drawer in a loading state. We recommend that you also set a `i18nStrings.loadingText`.
|
|
17
16
|
*/
|
|
18
17
|
loading?: boolean;
|
|
19
18
|
/**
|
|
@@ -22,9 +21,10 @@ export interface DrawerProps extends BaseComponentProps {
|
|
|
22
21
|
disableContentPaddings?: boolean;
|
|
23
22
|
/**
|
|
24
23
|
* An object containing all the necessary localized strings required by the component.
|
|
24
|
+
* - `loadingText` - The text that's displayed when the drawer is in a loading state.
|
|
25
25
|
* @i18n
|
|
26
26
|
*/
|
|
27
|
-
i18nStrings?: I18nStrings;
|
|
27
|
+
i18nStrings?: DrawerProps.I18nStrings;
|
|
28
28
|
/**
|
|
29
29
|
* Actions for the header. Available only if you specify the `header` property.
|
|
30
30
|
*/
|
|
@@ -37,10 +37,75 @@ export interface DrawerProps extends BaseComponentProps {
|
|
|
37
37
|
*/
|
|
38
38
|
footer?: React.ReactNode;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
export declare namespace DrawerProps {
|
|
41
|
+
interface I18nStrings {
|
|
42
|
+
loadingText?: string;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export interface NextDrawerProps extends DrawerProps {
|
|
46
|
+
/**
|
|
47
|
+
* Specifies the CSS positioning mode of the drawer, and supports the following options:
|
|
48
|
+
* * `static` (default) - The drawer is positioned in the normal document flow.
|
|
49
|
+
* * `sticky` - The drawer sticks to its nearest scrolling ancestor. Only meaningful with `placement="top"` or `placement="bottom"`. Using `sticky` with `placement="start"` or `placement="end"` falls back to `static`.
|
|
50
|
+
* * `absolute` - The drawer is positioned relative to its nearest positioned ancestor.
|
|
51
|
+
* * `fixed` - The drawer is positioned relative to the viewport.
|
|
52
|
+
*
|
|
53
|
+
* @awsuiSystem core
|
|
54
|
+
*/
|
|
55
|
+
position?: NextDrawerProps.Position;
|
|
56
|
+
/**
|
|
57
|
+
* Specifies which edge of its container the drawer is anchored to, and supports these options:
|
|
58
|
+
* * `start` - Anchored to the inline-start edge.
|
|
59
|
+
* * `end` - (default) Anchored to the inline-end edge.
|
|
60
|
+
* * `top` - Anchored to the top edge.
|
|
61
|
+
* * `bottom` - Anchored to the bottom edge.
|
|
62
|
+
*
|
|
63
|
+
* @awsuiSystem core
|
|
64
|
+
*/
|
|
65
|
+
placement?: NextDrawerProps.Placement;
|
|
41
66
|
/**
|
|
42
|
-
|
|
67
|
+
* Specifies the distance in pixels between the drawer and the edges of its container.
|
|
68
|
+
* Applicable when using `position="absolute"` or `position="fixed"`.
|
|
69
|
+
* Supported properties:
|
|
70
|
+
* * `start` - Distance from the inline-start edge. Not applicable when `placement` is `"end"`.
|
|
71
|
+
* * `end` - Distance from the inline-end edge. Not applicable when `placement` is `"start"`.
|
|
72
|
+
* * `top` - Distance from the top edge. Not applicable when `placement` is `"bottom"`.
|
|
73
|
+
* * `bottom` - Distance from the bottom edge. Not applicable when `placement` is `"top"`.
|
|
74
|
+
*
|
|
75
|
+
* @awsuiSystem core
|
|
76
|
+
*/
|
|
77
|
+
offset?: NextDrawerProps.Offset;
|
|
78
|
+
/**
|
|
79
|
+
* Specifies the distance in pixels from the top or bottom edge of the scrolling container
|
|
80
|
+
* at which the drawer sticks. Applicable only when using `position="sticky"` with `placement="top"` or `placement="bottom"`.
|
|
81
|
+
* * Supported properties:
|
|
82
|
+
* * `top` - Distance from the top of the scrolling container.
|
|
83
|
+
* * `bottom` - Distance from the bottom of the scrolling container.
|
|
84
|
+
*
|
|
85
|
+
* @awsuiSystem core
|
|
86
|
+
*/
|
|
87
|
+
stickyOffset?: NextDrawerProps.StickyOffset;
|
|
88
|
+
/**
|
|
89
|
+
* Sets the CSS `z-index` of the drawer. Use this to control stacking order when the drawer
|
|
90
|
+
* overlaps other positioned elements on the page.
|
|
91
|
+
*
|
|
92
|
+
* Applicable when using `position="sticky"`, `position="absolute"`, or `position="fixed"`.
|
|
93
|
+
*
|
|
94
|
+
* @awsuiSystem core
|
|
43
95
|
*/
|
|
44
|
-
|
|
96
|
+
zIndex?: number;
|
|
45
97
|
}
|
|
46
|
-
export {
|
|
98
|
+
export declare namespace NextDrawerProps {
|
|
99
|
+
type Position = 'static' | 'sticky' | 'absolute' | 'fixed';
|
|
100
|
+
type Placement = 'start' | 'end' | 'top' | 'bottom';
|
|
101
|
+
interface Offset {
|
|
102
|
+
start?: number;
|
|
103
|
+
end?: number;
|
|
104
|
+
top?: number;
|
|
105
|
+
bottom?: number;
|
|
106
|
+
}
|
|
107
|
+
interface StickyOffset {
|
|
108
|
+
top?: number;
|
|
109
|
+
bottom?: number;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC;IAEtC;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEhC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,yBAAiB,WAAW,CAAC;IAC3B,UAAiB,WAAW;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;CACF;AAGD,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC;IAEpC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC;IAEtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC;IAEhC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC;IAE5C;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yBAAiB,eAAe,CAAC;IAC/B,KAAY,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IAElE,KAAY,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IAE3D,UAAiB,MAAM;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAED,UAAiB,YAAY;QAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;CACF"}
|
package/drawer/interfaces.js
CHANGED
package/drawer/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface DrawerProps extends BaseComponentProps {\n /**\n * Header of the drawer.\n *\n * It should contain the only `h2` used in the drawer.\n */\n header?: React.ReactNode;\n\n /**\n * Main content of the drawer.\n
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/drawer/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface DrawerProps extends BaseComponentProps {\n /**\n * Header of the drawer.\n *\n * It should contain the only `h2` used in the drawer.\n */\n header?: React.ReactNode;\n\n /**\n * Main content of the drawer.\n */\n children?: React.ReactNode;\n\n /**\n * Renders the drawer in a loading state. We recommend that you also set a `i18nStrings.loadingText`.\n */\n loading?: boolean;\n\n /**\n * Determines whether the drawer content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component.\n * - `loadingText` - The text that's displayed when the drawer is in a loading state.\n * @i18n\n */\n i18nStrings?: DrawerProps.I18nStrings;\n\n /**\n * Actions for the header. Available only if you specify the `header` property.\n */\n headerActions?: React.ReactNode;\n\n /**\n * Sticky footer content that remains visible at the bottom during scroll.\n *\n * Automatically becomes non-sticky when scrollable content area is too small\n * to ensure content remains accessible (not covered by the footer).\n */\n footer?: React.ReactNode;\n}\n\nexport namespace DrawerProps {\n export interface I18nStrings {\n loadingText?: string;\n }\n}\n\n// Props for a future release\nexport interface NextDrawerProps extends DrawerProps {\n /**\n * Specifies the CSS positioning mode of the drawer, and supports the following options:\n * * `static` (default) - The drawer is positioned in the normal document flow.\n * * `sticky` - The drawer sticks to its nearest scrolling ancestor. Only meaningful with `placement=\"top\"` or `placement=\"bottom\"`. Using `sticky` with `placement=\"start\"` or `placement=\"end\"` falls back to `static`.\n * * `absolute` - The drawer is positioned relative to its nearest positioned ancestor.\n * * `fixed` - The drawer is positioned relative to the viewport.\n *\n * @awsuiSystem core\n */\n position?: NextDrawerProps.Position;\n\n /**\n * Specifies which edge of its container the drawer is anchored to, and supports these options:\n * * `start` - Anchored to the inline-start edge.\n * * `end` - (default) Anchored to the inline-end edge.\n * * `top` - Anchored to the top edge.\n * * `bottom` - Anchored to the bottom edge.\n *\n * @awsuiSystem core\n */\n placement?: NextDrawerProps.Placement;\n\n /**\n * Specifies the distance in pixels between the drawer and the edges of its container.\n * Applicable when using `position=\"absolute\"` or `position=\"fixed\"`.\n * Supported properties:\n * * `start` - Distance from the inline-start edge. Not applicable when `placement` is `\"end\"`.\n * * `end` - Distance from the inline-end edge. Not applicable when `placement` is `\"start\"`.\n * * `top` - Distance from the top edge. Not applicable when `placement` is `\"bottom\"`.\n * * `bottom` - Distance from the bottom edge. Not applicable when `placement` is `\"top\"`.\n *\n * @awsuiSystem core\n */\n offset?: NextDrawerProps.Offset;\n\n /**\n * Specifies the distance in pixels from the top or bottom edge of the scrolling container\n * at which the drawer sticks. Applicable only when using `position=\"sticky\"` with `placement=\"top\"` or `placement=\"bottom\"`.\n * * Supported properties:\n * * `top` - Distance from the top of the scrolling container.\n * * `bottom` - Distance from the bottom of the scrolling container.\n *\n * @awsuiSystem core\n */\n stickyOffset?: NextDrawerProps.StickyOffset;\n\n /**\n * Sets the CSS `z-index` of the drawer. Use this to control stacking order when the drawer\n * overlaps other positioned elements on the page.\n *\n * Applicable when using `position=\"sticky\"`, `position=\"absolute\"`, or `position=\"fixed\"`.\n *\n * @awsuiSystem core\n */\n zIndex?: number;\n}\n\nexport namespace NextDrawerProps {\n export type Position = 'static' | 'sticky' | 'absolute' | 'fixed';\n\n export type Placement = 'start' | 'end' | 'top' | 'bottom';\n\n export interface Offset {\n start?: number;\n end?: number;\n top?: number;\n bottom?: number;\n }\n\n export interface StickyOffset {\n top?: number;\n bottom?: number;\n }\n}\n"]}
|
package/drawer/next.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextDrawerProps } from './interfaces';
|
|
2
|
+
export { NextDrawerProps };
|
|
3
|
+
declare const Drawer: ({
|
|
4
|
+
header,
|
|
5
|
+
headerActions,
|
|
6
|
+
footer,
|
|
7
|
+
disableContentPaddings,
|
|
8
|
+
loading,
|
|
9
|
+
position,
|
|
10
|
+
placement,
|
|
11
|
+
offset,
|
|
12
|
+
stickyOffset,
|
|
13
|
+
zIndex,
|
|
14
|
+
...props
|
|
15
|
+
}: NextDrawerProps) => JSX.Element;
|
|
16
|
+
export default Drawer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/drawer/next.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,MAAM,GAAmB,iIAY5B,eAAe,gBAiCjB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/drawer/next.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// eslint-disable-next-line @cloudscape-design/build-tools/react-server-components-directive
|
|
4
|
+
'use client';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
7
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
8
|
+
import { getExternalProps } from '../internal/utils/external-props';
|
|
9
|
+
import { InternalDrawer } from './internal';
|
|
10
|
+
const Drawer = function Drawer({ header, headerActions, footer, disableContentPaddings = false, loading = false, position = 'static', placement = 'end', offset, stickyOffset, zIndex, ...props }) {
|
|
11
|
+
const baseComponentProps = useBaseComponent('Drawer', {
|
|
12
|
+
props: {
|
|
13
|
+
disableContentPaddings,
|
|
14
|
+
loading,
|
|
15
|
+
placement,
|
|
16
|
+
position,
|
|
17
|
+
zIndex,
|
|
18
|
+
},
|
|
19
|
+
metadata: {
|
|
20
|
+
hasHeader: !!header,
|
|
21
|
+
hasHeaderActions: !!headerActions,
|
|
22
|
+
hasFooter: !!footer,
|
|
23
|
+
hasOffset: !!offset,
|
|
24
|
+
hasStickyOffset: !!stickyOffset,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return (React.createElement(InternalDrawer, { ...getExternalProps(props), ...baseComponentProps, header: header, headerActions: headerActions, footer: footer, disableContentPaddings: disableContentPaddings, loading: loading, placement: placement, position: position, offset: offset, stickyOffset: stickyOffset, zIndex: zIndex }));
|
|
28
|
+
};
|
|
29
|
+
export default Drawer;
|
|
30
|
+
applyDisplayName(Drawer, 'Drawer');
|
|
31
|
+
//# sourceMappingURL=next.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../../../src/drawer/next.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,4FAA4F;AAC5F,YAAY,CAAC;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI5C,MAAM,MAAM,GAAG,SAAS,MAAM,CAAC,EAC7B,MAAM,EACN,aAAa,EACb,MAAM,EACN,sBAAsB,GAAG,KAAK,EAC9B,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,QAAQ,EACnB,SAAS,GAAG,KAAK,EACjB,MAAM,EACN,YAAY,EACZ,MAAM,EACN,GAAG,KAAK,EACQ;IAChB,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,QAAQ,EAAE;QACpD,KAAK,EAAE;YACL,sBAAsB;YACtB,OAAO;YACP,SAAS;YACT,QAAQ;YACR,MAAM;SACP;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,CAAC,CAAC,MAAM;YACnB,gBAAgB,EAAE,CAAC,CAAC,aAAa;YACjC,SAAS,EAAE,CAAC,CAAC,MAAM;YACnB,SAAS,EAAE,CAAC,CAAC,MAAM;YACnB,eAAe,EAAE,CAAC,CAAC,YAAY;SAChC;KACF,CAAC,CAAC;IACH,OAAO,CACL,oBAAC,cAAc,OACT,gBAAgB,CAAC,KAAK,CAAC,KACvB,kBAAkB,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n// eslint-disable-next-line @cloudscape-design/build-tools/react-server-components-directive\n'use client';\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { getExternalProps } from '../internal/utils/external-props';\nimport { NextDrawerProps } from './interfaces';\nimport { InternalDrawer } from './internal';\n\nexport { NextDrawerProps };\n\nconst Drawer = function Drawer({\n header,\n headerActions,\n footer,\n disableContentPaddings = false,\n loading = false,\n position = 'static',\n placement = 'end',\n offset,\n stickyOffset,\n zIndex,\n ...props\n}: NextDrawerProps) {\n const baseComponentProps = useBaseComponent('Drawer', {\n props: {\n disableContentPaddings,\n loading,\n placement,\n position,\n zIndex,\n },\n metadata: {\n hasHeader: !!header,\n hasHeaderActions: !!headerActions,\n hasFooter: !!footer,\n hasOffset: !!offset,\n hasStickyOffset: !!stickyOffset,\n },\n });\n return (\n <InternalDrawer\n {...getExternalProps(props)}\n {...baseComponentProps}\n header={header}\n headerActions={headerActions}\n footer={footer}\n disableContentPaddings={disableContentPaddings}\n loading={loading}\n placement={placement}\n position={position}\n offset={offset}\n stickyOffset={stickyOffset}\n zIndex={zIndex}\n />\n );\n};\n\nexport default Drawer;\n\napplyDisplayName(Drawer, 'Drawer');\n"]}
|
package/drawer/styles.css.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"drawer": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"with-
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"header
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
4
|
+
"drawer": "awsui_drawer_1sxt8_zqi16_189",
|
|
5
|
+
"position-absolute": "awsui_position-absolute_1sxt8_zqi16_222",
|
|
6
|
+
"position-sticky": "awsui_position-sticky_1sxt8_zqi16_222",
|
|
7
|
+
"position-fixed": "awsui_position-fixed_1sxt8_zqi16_222",
|
|
8
|
+
"with-footer": "awsui_with-footer_1sxt8_zqi16_225",
|
|
9
|
+
"position-static": "awsui_position-static_1sxt8_zqi16_229",
|
|
10
|
+
"content": "awsui_content_1sxt8_zqi16_232",
|
|
11
|
+
"header": "awsui_header_1sxt8_zqi16_236",
|
|
12
|
+
"with-additional-action": "awsui_with-additional-action_1sxt8_zqi16_253",
|
|
13
|
+
"with-runtime-context": "awsui_with-runtime-context_1sxt8_zqi16_261",
|
|
14
|
+
"with-toolbar": "awsui_with-toolbar_1sxt8_zqi16_264",
|
|
15
|
+
"header-actions": "awsui_header-actions_1sxt8_zqi16_283",
|
|
16
|
+
"content-with-paddings": "awsui_content-with-paddings_1sxt8_zqi16_289",
|
|
17
|
+
"footer": "awsui_footer_1sxt8_zqi16_296",
|
|
18
|
+
"is-sticky": "awsui_is-sticky_1sxt8_zqi16_302",
|
|
19
|
+
"test-utils-drawer-content": "awsui_test-utils-drawer-content_1sxt8_zqi16_310"
|
|
16
20
|
};
|
|
17
21
|
|
package/drawer/styles.scoped.css
CHANGED
|
@@ -186,7 +186,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
186
186
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
187
187
|
SPDX-License-Identifier: Apache-2.0
|
|
188
188
|
*/
|
|
189
|
-
.
|
|
189
|
+
.awsui_drawer_1sxt8_zqi16_189:not(#\9) {
|
|
190
190
|
border-collapse: separate;
|
|
191
191
|
border-spacing: 0;
|
|
192
192
|
box-sizing: border-box;
|
|
@@ -217,17 +217,23 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
217
217
|
-webkit-font-smoothing: auto;
|
|
218
218
|
-moz-osx-font-smoothing: auto;
|
|
219
219
|
word-wrap: break-word;
|
|
220
|
+
background-color: var(--color-background-drawer-5hs0eh, #ffffff);
|
|
220
221
|
}
|
|
221
|
-
.
|
|
222
|
+
.awsui_drawer_1sxt8_zqi16_189.awsui_position-absolute_1sxt8_zqi16_222:not(#\9), .awsui_drawer_1sxt8_zqi16_189.awsui_position-sticky_1sxt8_zqi16_222:not(#\9), .awsui_drawer_1sxt8_zqi16_189.awsui_position-fixed_1sxt8_zqi16_222:not(#\9) {
|
|
223
|
+
box-shadow: var(--shadow-panel-vk7iea, 0px 0px 0px 1px #b6bec9);
|
|
224
|
+
}
|
|
225
|
+
.awsui_drawer_1sxt8_zqi16_189.awsui_with-footer_1sxt8_zqi16_225:not(#\9) {
|
|
222
226
|
display: flex;
|
|
223
227
|
flex-direction: column;
|
|
228
|
+
}
|
|
229
|
+
.awsui_drawer_1sxt8_zqi16_189.awsui_with-footer_1sxt8_zqi16_225.awsui_position-static_1sxt8_zqi16_229:not(#\9) {
|
|
224
230
|
min-block-size: 100%;
|
|
225
231
|
}
|
|
226
|
-
.
|
|
232
|
+
.awsui_drawer_1sxt8_zqi16_189.awsui_with-footer_1sxt8_zqi16_225 > .awsui_content_1sxt8_zqi16_232:not(#\9) {
|
|
227
233
|
flex: 1;
|
|
228
234
|
}
|
|
229
235
|
|
|
230
|
-
.
|
|
236
|
+
.awsui_header_1sxt8_zqi16_236:not(#\9) {
|
|
231
237
|
font-size: var(--font-panel-header-size-33h9j8, 18px);
|
|
232
238
|
letter-spacing: var(--letter-spacing-heading-m-29ewnk, -0.01em);
|
|
233
239
|
line-height: var(--font-panel-header-line-height-8xb2qj, 22px);
|
|
@@ -244,7 +250,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
244
250
|
/* stylelint-enable @cloudscape-design/no-implicit-descendant, selector-max-type */
|
|
245
251
|
}
|
|
246
252
|
@media (min-width: 689px) {
|
|
247
|
-
.
|
|
253
|
+
.awsui_header_1sxt8_zqi16_236.awsui_with-additional-action_1sxt8_zqi16_253:not(#\9) {
|
|
248
254
|
/*
|
|
249
255
|
this padding is needed when the drawer renders inside a runtime drawer and the runtime drawer has an additional action
|
|
250
256
|
on the right (or left in rtl). in this case this padding ensures that the drawer's content does not overlap with runtime actions
|
|
@@ -252,18 +258,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
252
258
|
padding-inline: var(--space-panel-side-left-u1m3s9, 28px) calc(var(--space-xxxl-aut1u7, 40px) + var(--space-scaled-xxl-6wgq96, 32px));
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
|
-
.
|
|
261
|
+
.awsui_header_1sxt8_zqi16_236.awsui_with-runtime-context_1sxt8_zqi16_261:not(#\9) {
|
|
256
262
|
padding-block: 14px;
|
|
257
263
|
}
|
|
258
|
-
.awsui_with-
|
|
264
|
+
.awsui_with-toolbar_1sxt8_zqi16_264 > .awsui_header_1sxt8_zqi16_236:not(#\9) {
|
|
259
265
|
border-color: transparent;
|
|
260
266
|
margin-block-end: 0px;
|
|
261
267
|
}
|
|
262
|
-
.
|
|
263
|
-
.
|
|
264
|
-
.
|
|
265
|
-
.
|
|
266
|
-
.
|
|
268
|
+
.awsui_header_1sxt8_zqi16_236 h2:not(#\9),
|
|
269
|
+
.awsui_header_1sxt8_zqi16_236 h3:not(#\9),
|
|
270
|
+
.awsui_header_1sxt8_zqi16_236 h4:not(#\9),
|
|
271
|
+
.awsui_header_1sxt8_zqi16_236 h5:not(#\9),
|
|
272
|
+
.awsui_header_1sxt8_zqi16_236 h6:not(#\9) {
|
|
267
273
|
font-size: var(--font-panel-header-size-33h9j8, 18px);
|
|
268
274
|
letter-spacing: var(--letter-spacing-heading-m-29ewnk, -0.01em);
|
|
269
275
|
line-height: var(--font-panel-header-line-height-8xb2qj, 22px);
|
|
@@ -274,26 +280,26 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
274
280
|
margin-block: 0;
|
|
275
281
|
}
|
|
276
282
|
|
|
277
|
-
.awsui_header-
|
|
283
|
+
.awsui_header-actions_1sxt8_zqi16_283:not(#\9) {
|
|
278
284
|
display: inline-flex;
|
|
279
285
|
align-items: flex-start;
|
|
280
286
|
z-index: 1;
|
|
281
287
|
}
|
|
282
288
|
|
|
283
|
-
.awsui_content-with-
|
|
289
|
+
.awsui_content-with-paddings_1sxt8_zqi16_289:not(#\9):not(:empty) {
|
|
284
290
|
padding-block-start: var(--space-panel-content-top-qvd1dr, 20px);
|
|
285
291
|
padding-inline-start: var(--space-panel-side-left-u1m3s9, 28px);
|
|
286
292
|
padding-inline-end: var(--space-panel-side-right-8wwirc, 24px);
|
|
287
293
|
padding-block-end: var(--space-panel-content-bottom-24c6lu, 40px);
|
|
288
294
|
}
|
|
289
295
|
|
|
290
|
-
.
|
|
296
|
+
.awsui_footer_1sxt8_zqi16_296:not(#\9) {
|
|
291
297
|
background-color: var(--color-background-container-content-6u8rvp, #ffffff);
|
|
292
298
|
border-block-start: var(--border-divider-section-width-uwo8my, 1px) solid var(--color-border-panel-header-ygztvl, #c6c6cd);
|
|
293
299
|
padding-block: var(--space-panel-content-top-qvd1dr, 20px);
|
|
294
300
|
padding-inline: var(--space-panel-side-left-u1m3s9, 28px) var(--space-panel-side-right-8wwirc, 24px);
|
|
295
301
|
}
|
|
296
|
-
.
|
|
302
|
+
.awsui_footer_1sxt8_zqi16_296.awsui_is-sticky_1sxt8_zqi16_302:not(#\9) {
|
|
297
303
|
position: sticky;
|
|
298
304
|
inset-block-end: 0;
|
|
299
305
|
inset-inline-start: 0;
|
|
@@ -301,6 +307,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
301
307
|
z-index: 810;
|
|
302
308
|
}
|
|
303
309
|
|
|
304
|
-
.awsui_test-utils-drawer-
|
|
310
|
+
.awsui_test-utils-drawer-content_1sxt8_zqi16_310:not(#\9) {
|
|
305
311
|
/* used in test-utils */
|
|
306
312
|
}
|