@cloudscape-design/components-themeable 3.0.1101 → 3.0.1103
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/app-layout/visual-refresh-toolbar/drawer/styles.scss +10 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/app-layout/utils/use-ai-drawer.d.ts +0 -1
- package/lib/internal/template/app-layout/utils/use-ai-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/utils/use-ai-drawer.js +1 -1
- package/lib/internal/template/app-layout/utils/use-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.d.ts +0 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.js +0 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/global-drawers.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/index.d.ts +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/index.js +2 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts +0 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +0 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.css.js +25 -24
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +74 -66
- package/lib/internal/template/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +25 -24
- package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts +0 -7
- package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.js +0 -14
- package/lib/internal/template/app-layout/visual-refresh-toolbar/internal.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.d.ts +0 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js +0 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/navigation/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/notifications/index.d.ts +0 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/notifications/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/notifications/index.js +0 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/notifications/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.d.ts +0 -2
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.js +0 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/split-panel/index.js.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts +0 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.d.ts.map +1 -1
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js +0 -3
- package/lib/internal/template/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.d.ts +4 -18
- package/lib/internal/template/date-range-picker/calendar/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.js +2 -2
- package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/interfaces.d.ts +22 -0
- package/lib/internal/template/date-range-picker/calendar/interfaces.d.ts.map +1 -0
- package/lib/internal/template/date-range-picker/calendar/interfaces.js +2 -0
- package/lib/internal/template/date-range-picker/calendar/interfaces.js.map +1 -0
- package/lib/internal/template/date-range-picker/calendar/range-inputs.d.ts +2 -20
- package/lib/internal/template/date-range-picker/calendar/range-inputs.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/range-inputs.js +11 -13
- package/lib/internal/template/date-range-picker/calendar/range-inputs.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/utils.d.ts +4 -0
- package/lib/internal/template/date-range-picker/calendar/utils.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/utils.js +40 -0
- package/lib/internal/template/date-range-picker/calendar/utils.js.map +1 -1
- package/lib/internal/template/date-range-picker/dropdown.d.ts +3 -2
- package/lib/internal/template/date-range-picker/dropdown.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/dropdown.js +2 -2
- package/lib/internal/template/date-range-picker/dropdown.js.map +1 -1
- package/lib/internal/template/date-range-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/index.js +3 -2
- package/lib/internal/template/date-range-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.d.ts +53 -11
- package/lib/internal/template/date-range-picker/interfaces.d.ts.map +1 -1
- package/lib/internal/template/date-range-picker/interfaces.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/plugins/widget/internal.d.ts +4 -0
- package/lib/internal/template/internal/plugins/widget/internal.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget/internal.js +16 -0
- package/lib/internal/template/internal/plugins/widget/internal.js.map +1 -1
- package/lib/internal/template/internal/plugins/widget.d.ts +1 -1
- package/lib/internal/template/internal/plugins/widget.d.ts.map +1 -1
- package/lib/internal/template/internal/plugins/widget.js +1 -1
- package/lib/internal/template/internal/plugins/widget.js.map +1 -1
- package/lib/internal/template/internal/utils/date-time/format-date-time-with-offset.d.ts.map +1 -1
- package/lib/internal/template/internal/utils/date-time/format-date-time-with-offset.js +4 -0
- package/lib/internal/template/internal/utils/date-time/format-date-time-with-offset.js.map +1 -1
- package/lib/internal/template/link/interfaces.d.ts +15 -0
- package/lib/internal/template/link/interfaces.d.ts.map +1 -1
- package/lib/internal/template/link/interfaces.js.map +1 -1
- package/lib/internal/template/link/internal.d.ts.map +1 -1
- package/lib/internal/template/link/internal.js +4 -3
- package/lib/internal/template/link/internal.js.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-groups.d.ts.map +1 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-groups.js +4 -1
- package/lib/internal/template/mixed-line-bar-chart/bar-groups.js.map +1 -1
- package/lib/internal/template/status-indicator/index.d.ts +1 -1
- package/lib/internal/template/status-indicator/index.d.ts.map +1 -1
- package/lib/internal/template/status-indicator/index.js.map +1 -1
- package/lib/internal/template/status-indicator/interfaces.d.ts +46 -0
- package/lib/internal/template/status-indicator/interfaces.d.ts.map +1 -0
- package/lib/internal/template/status-indicator/interfaces.js +2 -0
- package/lib/internal/template/status-indicator/interfaces.js.map +1 -0
- package/lib/internal/template/status-indicator/internal.d.ts +3 -31
- package/lib/internal/template/status-indicator/internal.d.ts.map +1 -1
- package/lib/internal/template/status-indicator/internal.js +6 -2
- package/lib/internal/template/status-indicator/internal.js.map +1 -1
- package/lib/internal/template/steps/interfaces.d.ts +1 -1
- package/lib/internal/template/steps/interfaces.d.ts.map +1 -1
- package/lib/internal/template/steps/interfaces.js.map +1 -1
- package/lib/internal/template/table/internal.js +2 -2
- package/lib/internal/template/table/internal.js.map +1 -1
- package/lib/internal/template/toggle/interfaces.d.ts +15 -0
- package/lib/internal/template/toggle/interfaces.d.ts.map +1 -1
- package/lib/internal/template/toggle/interfaces.js.map +1 -1
- package/lib/internal/template/toggle/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle/internal.js +3 -2
- package/lib/internal/template/toggle/internal.js.map +1 -1
- package/lib/internal/template/toggle-button/index.d.ts.map +1 -1
- package/lib/internal/template/toggle-button/index.js +2 -2
- package/lib/internal/template/toggle-button/index.js.map +1 -1
- package/lib/internal/template/toggle-button/interfaces.d.ts +1 -1
- package/lib/internal/template/toggle-button/interfaces.d.ts.map +1 -1
- package/lib/internal/template/toggle-button/interfaces.js.map +1 -1
- package/lib/internal/template/toggle-button/internal.d.ts.map +1 -1
- package/lib/internal/template/toggle-button/internal.js +2 -2
- package/lib/internal/template/toggle-button/internal.js.map +1 -1
- package/package.json +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 { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\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 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?: TimeInputProps.Format;\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 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 *\n * Defaults to `iso`.\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\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 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 */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\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\n * absolute range.\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\n * absolute range.\n * @i18n\n */\n dateTimeConstraintText?: string;\n\n /**\n * Constraint text for the month input fields for the\n * absolute range.\n * @i18n\n */\n monthConstraintText?: 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 export type AbsoluteFormat = 'iso' | 'long-localized';\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport type QuarterIndex = 0 | 1 | 2;\n\nexport type RangeCalendarI18nStrings = Pick<\n DateRangePickerProps.I18nStrings,\n | 'todayAriaLabel'\n | 'nextMonthAriaLabel'\n | 'previousMonthAriaLabel'\n | 'currentMonthAriaLabel'\n | 'nextYearAriaLabel'\n | 'previousYearAriaLabel'\n | 'startMonthLabel'\n | 'startDateLabel'\n | 'startTimeLabel'\n | 'endMonthLabel'\n | 'endDateLabel'\n | 'endTimeLabel'\n | 'dateConstraintText'\n | 'dateTimeConstraintText'\n | 'monthConstraintText'\n | 'renderSelectedAbsoluteRangeAriaLive'\n>;\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 { BaseComponentProps } from '../internal/base-component';\nimport { ExpandToViewport } from '../internal/components/dropdown/interfaces';\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 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\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 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 */\n ariaLabel?: string;\n\n /**\n * Adds `aria-labelledby` to the trigger and dropdown.\n */\n ariaLabelledby?: string;\n\n /**\n * Adds `aria-describedby` to the trigger and dropdown.\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 export type AbsoluteFormat = DateFormat;\n\n export type DateInputFormat = EditableDateFormat | undefined;\n\n export type TimeInputFormat = TimeInputProps.Format;\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
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (a463d12a)";
|
|
3
|
+
export var GIT_SHA = "a463d12a";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "console";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -7,6 +7,10 @@ export declare function clearInitialMessages(): void;
|
|
|
7
7
|
* Returns whether there is an app layout present on this page or not
|
|
8
8
|
*/
|
|
9
9
|
export declare function isAppLayoutReady(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a promise that resolves once the app layout has loaded
|
|
12
|
+
*/
|
|
13
|
+
export declare function whenAppLayoutReady(): Promise<unknown>;
|
|
10
14
|
/**
|
|
11
15
|
* Registers a new runtime drawer to app layout
|
|
12
16
|
* @param drawer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/internal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/internal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAY9G,KAAK,gBAAgB,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAW1D,wBAAgB,wBAAwB,wCAEvC;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,cAWjE;AAED,wBAAgB,oBAAoB,SAEnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,YAE/B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,qBAOjC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,QAMvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,QAE3D"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { reportRuntimeApiWarning } from '../helpers/metrics';
|
|
4
4
|
const storageKeyMessageHandler = Symbol.for('awsui-widget-api-message-handler');
|
|
5
5
|
const storageKeyInitialMessages = Symbol.for('awsui-widget-api-initial-messages');
|
|
6
|
+
const storageKeyReadyDeferCallbacks = Symbol.for('awsui-widget-api-ready-defer');
|
|
6
7
|
function getWindow() {
|
|
7
8
|
return window;
|
|
8
9
|
}
|
|
@@ -14,11 +15,14 @@ export function getAppLayoutInitialState() {
|
|
|
14
15
|
return getWindow()[storageKeyInitialMessages];
|
|
15
16
|
}
|
|
16
17
|
export function registerAppLayoutHandler(handler) {
|
|
18
|
+
var _a;
|
|
17
19
|
const win = getWindow();
|
|
18
20
|
if (win[storageKeyMessageHandler]) {
|
|
19
21
|
reportRuntimeApiWarning('AppLayoutWidget', 'Double registration attempt, the old handler will be overridden');
|
|
20
22
|
}
|
|
21
23
|
win[storageKeyMessageHandler] = handler;
|
|
24
|
+
(_a = win[storageKeyReadyDeferCallbacks]) === null || _a === void 0 ? void 0 : _a.forEach(fn => fn());
|
|
25
|
+
win[storageKeyReadyDeferCallbacks] = [];
|
|
22
26
|
return () => {
|
|
23
27
|
win[storageKeyMessageHandler] = undefined;
|
|
24
28
|
};
|
|
@@ -32,6 +36,18 @@ export function clearInitialMessages() {
|
|
|
32
36
|
export function isAppLayoutReady() {
|
|
33
37
|
return !!getAppLayoutMessageHandler();
|
|
34
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns a promise that resolves once the app layout has loaded
|
|
41
|
+
*/
|
|
42
|
+
export function whenAppLayoutReady() {
|
|
43
|
+
var _a;
|
|
44
|
+
if (isAppLayoutReady()) {
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
}
|
|
47
|
+
const win = getWindow();
|
|
48
|
+
win[storageKeyReadyDeferCallbacks] = (_a = win[storageKeyReadyDeferCallbacks]) !== null && _a !== void 0 ? _a : [];
|
|
49
|
+
return new Promise(resolve => { var _a; return (_a = win[storageKeyReadyDeferCallbacks]) === null || _a === void 0 ? void 0 : _a.push(resolve); });
|
|
50
|
+
}
|
|
35
51
|
/**
|
|
36
52
|
* Registers a new runtime drawer to app layout
|
|
37
53
|
* @param drawer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/internal.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAChF,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../../../src/internal/plugins/widget/internal.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAChF,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;AAClF,MAAM,6BAA6B,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAUjF,SAAS,SAAS;IAChB,OAAO,MAAiC,CAAC;AAC3C,CAAC;AAED,SAAS,0BAA0B;IACjC,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,OAAO,GAAG,CAAC,wBAAwB,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,wBAAwB;IACtC,OAAO,SAAS,EAAE,CAAC,yBAAyB,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAyB;;IAChE,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,IAAI,GAAG,CAAC,wBAAwB,CAAC,EAAE;QACjC,uBAAuB,CAAC,iBAAiB,EAAE,iEAAiE,CAAC,CAAC;KAC/G;IACD,GAAG,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC;I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CAAG,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAA+B;;IAC1D,MAAA,0BAA0B,EAAE,0CAAG,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { reportRuntimeApiWarning } from '../helpers/metrics';\nimport { AppLayoutMessage, AppLayoutUpdateMessage, DrawerPayload, RegisterDrawerMessage } from './interfaces';\n\nconst storageKeyMessageHandler = Symbol.for('awsui-widget-api-message-handler');\nconst storageKeyInitialMessages = Symbol.for('awsui-widget-api-initial-messages');\nconst storageKeyReadyDeferCallbacks = Symbol.for('awsui-widget-api-ready-defer');\n\ninterface WindowWithApi extends Window {\n [storageKeyMessageHandler]: AppLayoutHandler | undefined;\n [storageKeyInitialMessages]: Array<RegisterDrawerMessage> | undefined;\n [storageKeyReadyDeferCallbacks]: Array<(value?: unknown) => void> | undefined;\n}\n\ntype AppLayoutHandler = (event: AppLayoutMessage) => void;\n\nfunction getWindow() {\n return window as Window as WindowWithApi;\n}\n\nfunction getAppLayoutMessageHandler() {\n const win = getWindow();\n return win[storageKeyMessageHandler];\n}\n\nexport function getAppLayoutInitialState() {\n return getWindow()[storageKeyInitialMessages];\n}\n\nexport function registerAppLayoutHandler(handler: AppLayoutHandler) {\n const win = getWindow();\n if (win[storageKeyMessageHandler]) {\n reportRuntimeApiWarning('AppLayoutWidget', 'Double registration attempt, the old handler will be overridden');\n }\n win[storageKeyMessageHandler] = handler;\n win[storageKeyReadyDeferCallbacks]?.forEach(fn => fn());\n win[storageKeyReadyDeferCallbacks] = [];\n return () => {\n win[storageKeyMessageHandler] = undefined;\n };\n}\n\nexport function clearInitialMessages() {\n getWindow()[storageKeyInitialMessages] = undefined;\n}\n\n/**\n * Returns whether there is an app layout present on this page or not\n */\nexport function isAppLayoutReady() {\n return !!getAppLayoutMessageHandler();\n}\n\n/**\n * Returns a promise that resolves once the app layout has loaded\n */\nexport function whenAppLayoutReady() {\n if (isAppLayoutReady()) {\n return Promise.resolve();\n }\n const win = getWindow();\n win[storageKeyReadyDeferCallbacks] = win[storageKeyReadyDeferCallbacks] ?? [];\n return new Promise(resolve => win[storageKeyReadyDeferCallbacks]?.push(resolve));\n}\n\n/**\n * Registers a new runtime drawer to app layout\n * @param drawer\n */\nexport function registerLeftDrawer(drawer: DrawerPayload) {\n const win = getWindow();\n const message: RegisterDrawerMessage = { type: 'registerLeftDrawer', payload: drawer };\n win[storageKeyInitialMessages] = win[storageKeyInitialMessages] ?? [];\n win[storageKeyInitialMessages].push(message);\n getAppLayoutMessageHandler()?.(message);\n}\n\n/**\n * Interact with already registered app layout drawers\n * @param message\n */\nexport function updateDrawer(message: AppLayoutUpdateMessage) {\n getAppLayoutMessageHandler()?.(message);\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './widget/interfaces';
|
|
2
|
-
export { registerLeftDrawer, updateDrawer, isAppLayoutReady } from './widget/internal';
|
|
2
|
+
export { registerLeftDrawer, updateDrawer, isAppLayoutReady, whenAppLayoutReady } from './widget/internal';
|
|
3
3
|
//# sourceMappingURL=widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/widget.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../../src/internal/plugins/widget.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export * from './widget/interfaces';
|
|
4
|
-
export { registerLeftDrawer, updateDrawer, isAppLayoutReady } from './widget/internal';
|
|
4
|
+
export { registerLeftDrawer, updateDrawer, isAppLayoutReady, whenAppLayoutReady } from './widget/internal';
|
|
5
5
|
//# sourceMappingURL=widget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../src/internal/plugins/widget.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport * from './widget/interfaces';\nexport { registerLeftDrawer, updateDrawer, isAppLayoutReady } from './widget/internal';\n"]}
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../src/internal/plugins/widget.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport * from './widget/interfaces';\nexport { registerLeftDrawer, updateDrawer, isAppLayoutReady, whenAppLayoutReady } from './widget/internal';\n"]}
|
package/lib/internal/template/internal/utils/date-time/format-date-time-with-offset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-date-time-with-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-date-time-with-offset.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAK7E,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,oBAAoB,CAAC,cAAc,CAAC;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,
|
|
1
|
+
{"version":3,"file":"format-date-time-with-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-date-time-with-offset.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAK7E,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,oBAAoB,CAAC,cAAc,CAAC;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,UAeA"}
|
|
@@ -10,6 +10,10 @@ export function formatDateTimeWithOffset({ date, format, hideTimeOffset, timeOff
|
|
|
10
10
|
case 'long-localized': {
|
|
11
11
|
return formatDateLocalized({ date, hideTimeOffset, isDateOnly, isMonthOnly, locale, timeOffset });
|
|
12
12
|
}
|
|
13
|
+
case 'slashed': {
|
|
14
|
+
const formatted = formatDateIso({ date, hideTimeOffset, isDateOnly, isMonthOnly, timeOffset }).split('T');
|
|
15
|
+
return `${formatted[0].split('-').join('/')}${formatted[1] ? `T${formatted[1]}` : ''}`;
|
|
16
|
+
}
|
|
13
17
|
default: {
|
|
14
18
|
return formatDateIso({ date, hideTimeOffset, isDateOnly, isMonthOnly, timeOffset });
|
|
15
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-date-time-with-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-date-time-with-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,UAAU,wBAAwB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,MAAM,GAOP;IACC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,MAAM,EAAE;QACd,KAAK,gBAAgB,CAAC,CAAC;YACrB,OAAO,mBAAmB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;SACnG;QACD,OAAO,CAAC,CAAC;YACP,OAAO,aAAa,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;SACrF;KACF;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DateRangePickerProps } from '../../../date-range-picker/interfaces';\nimport formatDateIso from './format-date-iso';\nimport formatDateLocalized from './format-date-localized';\nimport { isIsoDateOnly, isIsoMonthOnly } from './is-iso-only';\n\nexport function formatDateTimeWithOffset({\n date,\n format,\n hideTimeOffset,\n timeOffset,\n locale,\n}: {\n date: string;\n format: DateRangePickerProps.AbsoluteFormat;\n hideTimeOffset?: boolean;\n timeOffset?: number;\n locale?: string;\n}) {\n const isDateOnly = isIsoDateOnly(date);\n const isMonthOnly = isIsoMonthOnly(date);\n switch (format) {\n case 'long-localized': {\n return formatDateLocalized({ date, hideTimeOffset, isDateOnly, isMonthOnly, locale, timeOffset });\n }\n default: {\n return formatDateIso({ date, hideTimeOffset, isDateOnly, isMonthOnly, timeOffset });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"format-date-time-with-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-date-time-with-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAGtC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,mBAAmB,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,UAAU,wBAAwB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,cAAc,EACd,UAAU,EACV,MAAM,GAOP;IACC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,MAAM,EAAE;QACd,KAAK,gBAAgB,CAAC,CAAC;YACrB,OAAO,mBAAmB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;SACnG;QACD,KAAK,SAAS,CAAC,CAAC;YACd,MAAM,SAAS,GAAG,aAAa,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1G,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SACxF;QACD,OAAO,CAAC,CAAC;YACP,OAAO,aAAa,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;SACrF;KACF;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { DateRangePickerProps } from '../../../date-range-picker/interfaces';\nimport formatDateIso from './format-date-iso';\nimport formatDateLocalized from './format-date-localized';\nimport { isIsoDateOnly, isIsoMonthOnly } from './is-iso-only';\n\nexport function formatDateTimeWithOffset({\n date,\n format,\n hideTimeOffset,\n timeOffset,\n locale,\n}: {\n date: string;\n format: DateRangePickerProps.AbsoluteFormat;\n hideTimeOffset?: boolean;\n timeOffset?: number;\n locale?: string;\n}) {\n const isDateOnly = isIsoDateOnly(date);\n const isMonthOnly = isIsoMonthOnly(date);\n switch (format) {\n case 'long-localized': {\n return formatDateLocalized({ date, hideTimeOffset, isDateOnly, isMonthOnly, locale, timeOffset });\n }\n case 'slashed': {\n const formatted = formatDateIso({ date, hideTimeOffset, isDateOnly, isMonthOnly, timeOffset }).split('T');\n return `${formatted[0].split('-').join('/')}${formatted[1] ? `T${formatted[1]}` : ''}`;\n }\n default: {\n return formatDateIso({ date, hideTimeOffset, isDateOnly, isMonthOnly, timeOffset });\n }\n }\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseComponentProps } from '../internal/base-component';
|
|
3
3
|
import { BaseNavigationDetail, CancelableEventHandler, ClickDetail as _ClickDetail, NonCancelableEventHandler } from '../internal/events';
|
|
4
|
+
/**
|
|
5
|
+
* @awsuiSystem core
|
|
6
|
+
*/
|
|
7
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
4
8
|
export interface LinkProps extends BaseComponentProps {
|
|
5
9
|
/**
|
|
6
10
|
* Determines the visual style of the link as follows:
|
|
@@ -90,6 +94,17 @@ export interface LinkProps extends BaseComponentProps {
|
|
|
90
94
|
* @awsuiSystem core
|
|
91
95
|
*/
|
|
92
96
|
style?: LinkProps.Style;
|
|
97
|
+
/**
|
|
98
|
+
* Attributes to add to the native element.
|
|
99
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
100
|
+
* - `className` will be appended.
|
|
101
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
102
|
+
*
|
|
103
|
+
* We do not support using this attribute to apply custom styling.
|
|
104
|
+
*
|
|
105
|
+
* @awsuiSystem core
|
|
106
|
+
*/
|
|
107
|
+
nativeAttributes?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
93
108
|
}
|
|
94
109
|
export declare namespace LinkProps {
|
|
95
110
|
type Variant = 'primary' | 'secondary' | 'info' | 'awsui-value-large';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/link/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,IAAI,YAAY,EAC3B,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/link/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,IAAI,YAAY,EAC3B,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD;;;;;;;;;;;;;;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EhD,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;IAED,KAAY,WAAW,GAAG,YAAY,CAAC;IACvC,UAAiB,KAAK;QACpB,IAAI,CAAC,EAAE;YACL,KAAK,CAAC,EAAE;gBACN,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/link/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';\nimport {\n BaseNavigationDetail,\n CancelableEventHandler,\n ClickDetail as _ClickDetail,\n NonCancelableEventHandler,\n} from '../internal/events';\n\nexport interface LinkProps extends BaseComponentProps {\n /**\n * Determines the visual style of the link as follows:\n *\n * - `primary` - Displays the link text with bold styling for sufficient contrast with surrounding text.\n * Use this for links where the context doesn't imply interactivity such as\n * \"Learn more\" links and links within paragraphs.\n * - `secondary` - Does not provide any additional indicators for interactivity (except for an underline when the user hovers over or focuses the link).\n * This can be used in cases where the interactivity is strongly implied by its context,\n * such as in a table or a list of external links.\n * - `info` - Use for \"info\" links that link to content in a help panel.\n *\n * The default is `secondary`, except inside the following components where it defaults to `primary`:\n * - Table\n * - Cards\n * - Alert\n * - Popover\n * - Help Panel (main `content` only)\n */\n variant?: LinkProps.Variant;\n\n /**\n * Determines the font size and line height.\n * This property is overridden if the variant is `info`.\n */\n fontSize?: LinkProps.FontSize;\n\n /**\n * Determines the text color of the link and its icon.\n *\n * - `normal`: Use in most cases where a link is required.\n * - `inverted`: Use to style links inside Flashbars.\n *\n * This property is overridden if the variant is `info`.\n */\n color?: LinkProps.Color;\n\n /**\n * Marks the link as external by adding an icon after the text. If `href`\n * is provided, opens the link in a new tab when clicked.\n */\n external?: boolean;\n\n /**\n * Specifies where to open the linked URL. Set this to `_blank` to open the URL\n * in a new tab. If you set this property to `_blank`, the component\n * automatically adds `rel=\"noopener noreferrer\"` to avoid performance\n * and security issues.\n *\n * For other options see the documentation for <a> tag's\n * [target attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target).\n */\n target?: string;\n\n /**\n * The URL that the link points to.\n * If an `href` is not provided, the component will render using a\n * \"button\" role and `target` will not be used.\n */\n href?: string;\n\n /**\n * The text to render inside the link.\n */\n children?: React.ReactNode;\n\n /**\n * Adds an aria-label to the HTML element.\n */\n ariaLabel?: string;\n\n /**\n * Adds an aria-label to the external icon.\n * @i18n\n */\n externalIconAriaLabel?: string;\n\n /**\n * Called when a link is clicked without any modifier keys. If the link has no `href` provided, it will be called on\n * all clicks.\n *\n * If you want to implement client-side routing yourself, use this event and prevent default browser navigation\n * (by calling `preventDefault`).\n */\n onFollow?: CancelableEventHandler<LinkProps.FollowDetail>;\n\n /**\n * Called when the user clicks on the link. Do not use this handler for navigation, use the `onFollow` event instead.\n */\n onClick?: NonCancelableEventHandler<LinkProps.ClickDetail>;\n\n /**\n * Adds a `rel` attribute to the link. If the `rel` property is provided, it overrides the default behaviour.\n * By default, the component sets the `rel` attribute to \"noopener noreferrer\" when `external` is `true` or `target` is `\"_blank\"`.\n */\n rel?: string;\n\n /**\n * @awsuiSystem core\n */\n style?: LinkProps.Style;\n}\n\nexport namespace LinkProps {\n export type Variant = 'primary' | 'secondary' | 'info' | 'awsui-value-large';\n export type FontSize =\n | 'body-s'\n | 'body-m'\n | 'heading-xs'\n | 'heading-s'\n | 'heading-m'\n | 'heading-l'\n | 'heading-xl'\n | 'display-l'\n | 'inherit';\n export type Color = 'normal' | 'inverted';\n\n export type FollowDetail = BaseNavigationDetail;\n\n export interface Ref {\n /**\n * Sets the browser focus on the anchor element.\n */\n focus(): void;\n }\n\n export type ClickDetail = _ClickDetail;\n export interface Style {\n root?: {\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/link/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';\nimport {\n BaseNavigationDetail,\n CancelableEventHandler,\n ClickDetail as _ClickDetail,\n NonCancelableEventHandler,\n} from '../internal/events';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface LinkProps extends BaseComponentProps {\n /**\n * Determines the visual style of the link as follows:\n *\n * - `primary` - Displays the link text with bold styling for sufficient contrast with surrounding text.\n * Use this for links where the context doesn't imply interactivity such as\n * \"Learn more\" links and links within paragraphs.\n * - `secondary` - Does not provide any additional indicators for interactivity (except for an underline when the user hovers over or focuses the link).\n * This can be used in cases where the interactivity is strongly implied by its context,\n * such as in a table or a list of external links.\n * - `info` - Use for \"info\" links that link to content in a help panel.\n *\n * The default is `secondary`, except inside the following components where it defaults to `primary`:\n * - Table\n * - Cards\n * - Alert\n * - Popover\n * - Help Panel (main `content` only)\n */\n variant?: LinkProps.Variant;\n\n /**\n * Determines the font size and line height.\n * This property is overridden if the variant is `info`.\n */\n fontSize?: LinkProps.FontSize;\n\n /**\n * Determines the text color of the link and its icon.\n *\n * - `normal`: Use in most cases where a link is required.\n * - `inverted`: Use to style links inside Flashbars.\n *\n * This property is overridden if the variant is `info`.\n */\n color?: LinkProps.Color;\n\n /**\n * Marks the link as external by adding an icon after the text. If `href`\n * is provided, opens the link in a new tab when clicked.\n */\n external?: boolean;\n\n /**\n * Specifies where to open the linked URL. Set this to `_blank` to open the URL\n * in a new tab. If you set this property to `_blank`, the component\n * automatically adds `rel=\"noopener noreferrer\"` to avoid performance\n * and security issues.\n *\n * For other options see the documentation for <a> tag's\n * [target attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target).\n */\n target?: string;\n\n /**\n * The URL that the link points to.\n * If an `href` is not provided, the component will render using a\n * \"button\" role and `target` will not be used.\n */\n href?: string;\n\n /**\n * The text to render inside the link.\n */\n children?: React.ReactNode;\n\n /**\n * Adds an aria-label to the HTML element.\n */\n ariaLabel?: string;\n\n /**\n * Adds an aria-label to the external icon.\n * @i18n\n */\n externalIconAriaLabel?: string;\n\n /**\n * Called when a link is clicked without any modifier keys. If the link has no `href` provided, it will be called on\n * all clicks.\n *\n * If you want to implement client-side routing yourself, use this event and prevent default browser navigation\n * (by calling `preventDefault`).\n */\n onFollow?: CancelableEventHandler<LinkProps.FollowDetail>;\n\n /**\n * Called when the user clicks on the link. Do not use this handler for navigation, use the `onFollow` event instead.\n */\n onClick?: NonCancelableEventHandler<LinkProps.ClickDetail>;\n\n /**\n * Adds a `rel` attribute to the link. If the `rel` property is provided, it overrides the default behaviour.\n * By default, the component sets the `rel` attribute to \"noopener noreferrer\" when `external` is `true` or `target` is `\"_blank\"`.\n */\n rel?: string;\n\n /**\n * @awsuiSystem core\n */\n style?: LinkProps.Style;\n\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.AnchorHTMLAttributes<HTMLAnchorElement>>;\n}\n\nexport namespace LinkProps {\n export type Variant = 'primary' | 'secondary' | 'info' | 'awsui-value-large';\n export type FontSize =\n | 'body-s'\n | 'body-m'\n | 'heading-xs'\n | 'heading-s'\n | 'heading-m'\n | 'heading-l'\n | 'heading-xl'\n | 'display-l'\n | 'inherit';\n export type Color = 'normal' | 'inverted';\n\n export type FollowDetail = BaseNavigationDetail;\n\n export interface Ref {\n /**\n * Sets the browser focus on the anchor element.\n */\n focus(): void;\n }\n\n export type ClickDetail = _ClickDetail;\n export interface Style {\n root?: {\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/link/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAqBlD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/link/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAqBlD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAKlF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAUzC,QAAA,MAAM,YAAY;cAHJ,SAAS,CAAC,SAAS,CAAC,GAAG,gBAAgB,GAAG,MAAM,GAAG,UAAU;uCAkN1E,CAAC;AAqBF,eAAe,YAAY,CAAC"}
|
|
@@ -18,10 +18,11 @@ import useForwardFocus from '../internal/hooks/forward-focus';
|
|
|
18
18
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
19
19
|
import { KeyCode } from '../internal/keycode';
|
|
20
20
|
import { checkSafeUrl } from '../internal/utils/check-safe-url';
|
|
21
|
+
import WithNativeAttributes from '../internal/utils/with-native-attributes';
|
|
21
22
|
import { getLinkStyles } from './style';
|
|
22
23
|
import styles from './styles.css.js';
|
|
23
24
|
const InternalLink = React.forwardRef((_a, ref) => {
|
|
24
|
-
var { variant: providedVariant, fontSize = 'body-m', color = 'normal', external = false, target, href, rel, ariaLabel, externalIconAriaLabel, onFollow, onClick, children, __internalRootRef, style } = _a, props = __rest(_a, ["variant", "fontSize", "color", "external", "target", "href", "rel", "ariaLabel", "externalIconAriaLabel", "onFollow", "onClick", "children", "__internalRootRef", "style"]);
|
|
25
|
+
var { variant: providedVariant, fontSize = 'body-m', color = 'normal', external = false, target, href, rel, ariaLabel, externalIconAriaLabel, onFollow, onClick, children, nativeAttributes, __internalRootRef, style } = _a, props = __rest(_a, ["variant", "fontSize", "color", "external", "target", "href", "rel", "ariaLabel", "externalIconAriaLabel", "onFollow", "onClick", "children", "nativeAttributes", "__internalRootRef", "style"]);
|
|
25
26
|
checkSafeUrl('Link', href);
|
|
26
27
|
const isButton = !href;
|
|
27
28
|
const { defaultVariant } = useContext(LinkDefaultVariantContext);
|
|
@@ -126,9 +127,9 @@ const InternalLink = React.forwardRef((_a, ref) => {
|
|
|
126
127
|
variant === 'info' && (React.createElement("span", { hidden: true, id: infoId }, ":"))));
|
|
127
128
|
const { tabIndex } = useSingleTabStopNavigation(linkRef, { tabIndex: isButton ? 0 : undefined });
|
|
128
129
|
if (isButton) {
|
|
129
|
-
return (React.createElement(
|
|
130
|
+
return (React.createElement(WithNativeAttributes, Object.assign({}, sharedProps, { tag: "a", componentName: "Link", nativeAttributes: nativeAttributes, role: "button", tabIndex: tabIndex, onKeyDown: handleButtonKeyDown, onClick: handleButtonClick }), content));
|
|
130
131
|
}
|
|
131
|
-
return (React.createElement(
|
|
132
|
+
return (React.createElement(WithNativeAttributes, Object.assign({}, sharedProps, { tag: "a", componentName: "Link", nativeAttributes: nativeAttributes, tabIndex: tabIndex, target: anchorTarget, rel: anchorRel, href: href, onClick: handleLinkClick }), content));
|
|
132
133
|
});
|
|
133
134
|
function getVariantStyle(variant) {
|
|
134
135
|
return `variant-${variant.replace(/^awsui-/, '')}`;
|
|
@@ -1 +1 @@
|
|
|
1
|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C7F,OAAO,SAAS,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;AAC1D,CAAC;AAED,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_VALUE,\n getFunnelValueSelector,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireCancelableEvent, fireNonCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { LinkProps } from './interfaces';\nimport { getLinkStyles } from './style';\n\nimport styles from './styles.css.js';\n\ntype InternalLinkProps = InternalBaseComponentProps &\n Omit<LinkProps, 'variant'> & {\n variant?: LinkProps['variant'] | 'top-navigation' | 'link' | 'recovery';\n };\n\nconst InternalLink = React.forwardRef(\n (\n {\n variant: providedVariant,\n fontSize = 'body-m',\n color = 'normal',\n external = false,\n target,\n href,\n rel,\n ariaLabel,\n externalIconAriaLabel,\n onFollow,\n onClick,\n children,\n __internalRootRef,\n style,\n ...props\n }: InternalLinkProps,\n ref: React.Ref<LinkProps.Ref>\n ) => {\n checkSafeUrl('Link', href);\n const isButton = !href;\n const { defaultVariant } = useContext(LinkDefaultVariantContext);\n const variant = providedVariant || defaultVariant;\n const specialStyles = ['top-navigation', 'link', 'recovery'];\n const hasSpecialStyle = specialStyles.indexOf(variant) > -1;\n\n const i18n = useInternalI18n('link');\n const baseProps = getBaseProps(props);\n const anchorTarget = target ?? (external ? '_blank' : undefined);\n const anchorRel = rel ?? (anchorTarget === '_blank' ? 'noopener noreferrer' : undefined);\n const uniqueId = useUniqueId('link');\n const linkId = useUniqueId('link-self');\n const infoId = useUniqueId('link-info');\n\n const infoLinkLabelFromContext = useContext(InfoLinkLabelContext);\n\n const { funnelIdentifier, funnelInteractionId } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const fireFunnelEvent = (funnelInteractionId: string) => {\n if (variant === 'info') {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.helpPanelInteracted({\n funnelIdentifier,\n funnelInteractionId,\n stepIdentifier,\n stepNumber,\n stepName,\n subStepIdentifier,\n stepNameSelector,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n } else if (external) {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.externalLinkInteracted({\n funnelIdentifier,\n funnelInteractionId,\n stepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n };\n\n const fireFollowEvent = (event: React.SyntheticEvent) => {\n if (funnelInteractionId) {\n fireFunnelEvent(funnelInteractionId);\n }\n\n fireCancelableEvent(onFollow, { href, external, target: anchorTarget }, event);\n };\n\n const fireClickEvent = (event: React.MouseEvent | React.KeyboardEvent) => {\n const { altKey, ctrlKey, metaKey, shiftKey } = event;\n const button = 'button' in event ? event.button : 0;\n // make onClick non-cancelable to prevent it from being used to block full page reload\n // for navigation use `onFollow` event instead\n fireNonCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey });\n };\n\n const handleLinkClick = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollowEvent(event);\n }\n fireClickEvent(event);\n };\n\n const handleButtonClick = (event: React.MouseEvent) => {\n fireFollowEvent(event);\n fireClickEvent(event);\n };\n\n const handleButtonKeyDown = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.space || event.keyCode === KeyCode.enter) {\n event.preventDefault();\n fireFollowEvent(event);\n fireClickEvent(event);\n }\n };\n\n const linkRef = useRef<HTMLElement>(null);\n const isVisualRefresh = useVisualRefresh();\n useForwardFocus(ref, linkRef);\n\n // Visual refresh should only add styles to buttons that don't already have unique styles (e.g. primary/secondary variants)\n const applyButtonStyles = isButton && isVisualRefresh && !hasSpecialStyle;\n\n const sharedProps = {\n id: linkId,\n ...baseProps,\n ref: useMergeRefs(linkRef, __internalRootRef),\n className: clsx(\n styles.link,\n baseProps.className,\n applyButtonStyles ? styles.button : null,\n styles[getVariantStyle(variant)],\n styles[getFontSizeStyle(variant, fontSize)],\n styles[getColorStyle(variant, color)]\n ),\n style: getLinkStyles(style),\n 'aria-label': ariaLabel,\n 'aria-labelledby': undefined as string | undefined,\n [DATA_ATTR_FUNNEL_VALUE]: uniqueId,\n };\n\n if (variant === 'info' && infoLinkLabelFromContext && !ariaLabel) {\n sharedProps['aria-labelledby'] = `${sharedProps.id} ${infoId} ${infoLinkLabelFromContext}`;\n }\n\n const renderedExternalIconAriaLabel = i18n('externalIconAriaLabel', externalIconAriaLabel);\n const content = (\n <>\n {children}\n {external && (\n <span className={styles['icon-wrapper']}>\n \n <span\n className={styles.icon}\n aria-label={renderedExternalIconAriaLabel}\n role={renderedExternalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" size=\"inherit\" />\n </span>\n </span>\n )}\n {variant === 'info' && (\n <span hidden={true} id={infoId}>\n :\n </span>\n )}\n </>\n );\n\n const { tabIndex } = useSingleTabStopNavigation(linkRef, { tabIndex: isButton ? 0 : undefined });\n\n if (isButton) {\n return (\n <a\n {...sharedProps}\n role=\"button\"\n tabIndex={tabIndex}\n onKeyDown={handleButtonKeyDown}\n onClick={handleButtonClick}\n >\n {content}\n </a>\n );\n }\n\n return (\n <a\n {...sharedProps}\n tabIndex={tabIndex}\n target={anchorTarget}\n rel={anchorRel}\n href={href}\n onClick={handleLinkClick}\n >\n {content}\n </a>\n );\n }\n);\n\nfunction getVariantStyle(variant: Exclude<InternalLinkProps['variant'], undefined>) {\n return `variant-${variant.replace(/^awsui-/, '')}`;\n}\n\nfunction getFontSizeStyle(variant: InternalLinkProps['variant'], fontSize: InternalLinkProps['fontSize']) {\n switch (variant) {\n case 'info':\n return 'font-size-body-s';\n case 'awsui-value-large':\n return 'font-size-display-l';\n default:\n return `font-size-${fontSize}`;\n }\n}\n\nfunction getColorStyle(variant: InternalLinkProps['variant'], color: InternalLinkProps['color']) {\n return `color-${variant === 'info' ? 'normal' : color}`;\n}\n\nexport default InternalLink;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/link/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAE3F,OAAO,EA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AAC1D,CAAC;AAED,eAAe,YAAY,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FUNNEL_VALUE,\n getFunnelValueSelector,\n getSubStepAllSelector,\n getTextFromSelector,\n} from '../internal/analytics/selectors';\nimport { getBaseProps } from '../internal/base-component';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport { fireCancelableEvent, fireNonCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport WithNativeAttributes from '../internal/utils/with-native-attributes';\nimport { LinkProps } from './interfaces';\nimport { getLinkStyles } from './style';\n\nimport styles from './styles.css.js';\n\ntype InternalLinkProps = InternalBaseComponentProps &\n Omit<LinkProps, 'variant'> & {\n variant?: LinkProps['variant'] | 'top-navigation' | 'link' | 'recovery';\n };\n\nconst InternalLink = React.forwardRef(\n (\n {\n variant: providedVariant,\n fontSize = 'body-m',\n color = 'normal',\n external = false,\n target,\n href,\n rel,\n ariaLabel,\n externalIconAriaLabel,\n onFollow,\n onClick,\n children,\n nativeAttributes,\n __internalRootRef,\n style,\n ...props\n }: InternalLinkProps,\n ref: React.Ref<LinkProps.Ref>\n ) => {\n checkSafeUrl('Link', href);\n const isButton = !href;\n const { defaultVariant } = useContext(LinkDefaultVariantContext);\n const variant = providedVariant || defaultVariant;\n const specialStyles = ['top-navigation', 'link', 'recovery'];\n const hasSpecialStyle = specialStyles.indexOf(variant) > -1;\n\n const i18n = useInternalI18n('link');\n const baseProps = getBaseProps(props);\n const anchorTarget = target ?? (external ? '_blank' : undefined);\n const anchorRel = rel ?? (anchorTarget === '_blank' ? 'noopener noreferrer' : undefined);\n const uniqueId = useUniqueId('link');\n const linkId = useUniqueId('link-self');\n const infoId = useUniqueId('link-info');\n\n const infoLinkLabelFromContext = useContext(InfoLinkLabelContext);\n\n const { funnelIdentifier, funnelInteractionId } = useFunnel();\n const { stepIdentifier, stepNumber, stepNameSelector } = useFunnelStep();\n const { subStepIdentifier, subStepSelector, subStepNameSelector } = useFunnelSubStep();\n\n const fireFunnelEvent = (funnelInteractionId: string) => {\n if (variant === 'info') {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.helpPanelInteracted({\n funnelIdentifier,\n funnelInteractionId,\n stepIdentifier,\n stepNumber,\n stepName,\n subStepIdentifier,\n stepNameSelector,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n } else if (external) {\n const stepName = getTextFromSelector(stepNameSelector);\n const subStepName = getTextFromSelector(subStepNameSelector);\n\n FunnelMetrics.externalLinkInteracted({\n funnelIdentifier,\n funnelInteractionId,\n stepIdentifier,\n stepNumber,\n stepName,\n stepNameSelector,\n subStepIdentifier,\n subStepSelector,\n subStepName,\n subStepNameSelector,\n elementSelector: getFunnelValueSelector(uniqueId),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n };\n\n const fireFollowEvent = (event: React.SyntheticEvent) => {\n if (funnelInteractionId) {\n fireFunnelEvent(funnelInteractionId);\n }\n\n fireCancelableEvent(onFollow, { href, external, target: anchorTarget }, event);\n };\n\n const fireClickEvent = (event: React.MouseEvent | React.KeyboardEvent) => {\n const { altKey, ctrlKey, metaKey, shiftKey } = event;\n const button = 'button' in event ? event.button : 0;\n // make onClick non-cancelable to prevent it from being used to block full page reload\n // for navigation use `onFollow` event instead\n fireNonCancelableEvent(onClick, { altKey, button, ctrlKey, metaKey, shiftKey });\n };\n\n const handleLinkClick = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollowEvent(event);\n }\n fireClickEvent(event);\n };\n\n const handleButtonClick = (event: React.MouseEvent) => {\n fireFollowEvent(event);\n fireClickEvent(event);\n };\n\n const handleButtonKeyDown = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.space || event.keyCode === KeyCode.enter) {\n event.preventDefault();\n fireFollowEvent(event);\n fireClickEvent(event);\n }\n };\n\n const linkRef = useRef<HTMLElement>(null);\n const isVisualRefresh = useVisualRefresh();\n useForwardFocus(ref, linkRef);\n\n // Visual refresh should only add styles to buttons that don't already have unique styles (e.g. primary/secondary variants)\n const applyButtonStyles = isButton && isVisualRefresh && !hasSpecialStyle;\n\n const sharedProps = {\n id: linkId,\n ...baseProps,\n ref: useMergeRefs(linkRef, __internalRootRef),\n className: clsx(\n styles.link,\n baseProps.className,\n applyButtonStyles ? styles.button : null,\n styles[getVariantStyle(variant)],\n styles[getFontSizeStyle(variant, fontSize)],\n styles[getColorStyle(variant, color)]\n ),\n style: getLinkStyles(style),\n 'aria-label': ariaLabel,\n 'aria-labelledby': undefined as string | undefined,\n [DATA_ATTR_FUNNEL_VALUE]: uniqueId,\n };\n\n if (variant === 'info' && infoLinkLabelFromContext && !ariaLabel) {\n sharedProps['aria-labelledby'] = `${sharedProps.id} ${infoId} ${infoLinkLabelFromContext}`;\n }\n\n const renderedExternalIconAriaLabel = i18n('externalIconAriaLabel', externalIconAriaLabel);\n const content = (\n <>\n {children}\n {external && (\n <span className={styles['icon-wrapper']}>\n \n <span\n className={styles.icon}\n aria-label={renderedExternalIconAriaLabel}\n role={renderedExternalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" size=\"inherit\" />\n </span>\n </span>\n )}\n {variant === 'info' && (\n <span hidden={true} id={infoId}>\n :\n </span>\n )}\n </>\n );\n\n const { tabIndex } = useSingleTabStopNavigation(linkRef, { tabIndex: isButton ? 0 : undefined });\n\n if (isButton) {\n return (\n <WithNativeAttributes\n {...sharedProps}\n tag=\"a\"\n componentName=\"Link\"\n nativeAttributes={nativeAttributes}\n role=\"button\"\n tabIndex={tabIndex}\n onKeyDown={handleButtonKeyDown}\n onClick={handleButtonClick}\n >\n {content}\n </WithNativeAttributes>\n );\n }\n\n return (\n <WithNativeAttributes\n {...sharedProps}\n tag=\"a\"\n componentName=\"Link\"\n nativeAttributes={nativeAttributes}\n tabIndex={tabIndex}\n target={anchorTarget}\n rel={anchorRel}\n href={href}\n onClick={handleLinkClick}\n >\n {content}\n </WithNativeAttributes>\n );\n }\n);\n\nfunction getVariantStyle(variant: Exclude<InternalLinkProps['variant'], undefined>) {\n return `variant-${variant.replace(/^awsui-/, '')}`;\n}\n\nfunction getFontSizeStyle(variant: InternalLinkProps['variant'], fontSize: InternalLinkProps['fontSize']) {\n switch (variant) {\n case 'info':\n return 'font-size-body-s';\n case 'awsui-value-large':\n return 'font-size-display-l';\n default:\n return `font-size-${fontSize}`;\n }\n}\n\nfunction getColorStyle(variant: InternalLinkProps['variant'], color: InternalLinkProps['color']) {\n return `color-${variant === 'info' ? 'normal' : color}`;\n}\n\nexport default InternalLink;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-groups.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-groups.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;A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
|
@@ -9,6 +9,9 @@ const OUTLINE_PADDING = 2;
|
|
|
9
9
|
* Other rectangles are only needed for the "findBarGroups" test-utils selector.
|
|
10
10
|
*/
|
|
11
11
|
export default function BarGroups({ ariaLabel, isRefresh, isPopoverPinned, barGroups, highlightedGroupIndex, highlightedGroupRef, }) {
|
|
12
|
-
return (React.createElement("g", { role: "group", "aria-hidden": "true" }, barGroups.map((group, index) => (React.createElement("rect", { key: index, x: Math.max(0, group.position.x - OUTLINE_PADDING), y: Math.max(0, group.position.y - OUTLINE_PADDING), width: group.position.width + 2 * OUTLINE_PADDING, height: group.position.height + 2 * OUTLINE_PADDING, ref: index === highlightedGroupIndex ? highlightedGroupRef : undefined, rx: isRefresh ? 4 : 2, role: "button", "aria-label": ariaLabel, "aria-haspopup": true, "aria-expanded": isPopoverPinned,
|
|
12
|
+
return (React.createElement("g", { role: "group", "aria-hidden": "true" }, barGroups.map((group, index) => (React.createElement("rect", { key: index, x: Math.max(0, group.position.x - OUTLINE_PADDING), y: Math.max(0, group.position.y - OUTLINE_PADDING), width: group.position.width + 2 * OUTLINE_PADDING, height: group.position.height + 2 * OUTLINE_PADDING, ref: index === highlightedGroupIndex ? highlightedGroupRef : undefined, rx: isRefresh ? 4 : 2, role: "button", "aria-label": ariaLabel, "aria-haspopup": true, "aria-expanded": isPopoverPinned,
|
|
13
|
+
// We must use "transparent" instead of "none" so that Firefox popover placement works correctly.
|
|
14
|
+
// When an SVG element has no stroke or fill color the Firefox optimizes it out.
|
|
15
|
+
fill: "transparent", className: styles['bar-group'] })))));
|
|
13
16
|
}
|
|
14
17
|
//# sourceMappingURL=bar-groups.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-groups.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/bar-groups.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,MAAM,MAAM,iBAAiB,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AS,EACT,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,mBAAmB,GACN;IACb,OAAO,CACL,2BAAG,IAAI,EAAC,OAAO,iBAAa,MAAM,IAC/B,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC/B,8BACE,GAAG,EAAE,KAAK,EACV,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,eAAe,CAAC,EAClD,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,eAAe,CAAC,EAClD,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,GAAG,eAAe,EACjD,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,eAAe,EACnD,GAAG,EAAE,KAAK,KAAK,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,EACtE,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACrB,IAAI,EAAC,QAAQ,gBACD,SAAS,mBACN,IAAI,mBACJ,eAAe;QAC9B,iGAAiG;QACjG,gFAAgF;QAChF,IAAI,EAAC,aAAa,EAClB,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,GAC9B,CACH,CAAC,CACA,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { ChartDataTypes } from './interfaces';\nimport { ScaledBarGroup } from './make-scaled-bar-groups';\n\nimport styles from './styles.css.js';\n\nconst OUTLINE_PADDING = 2;\n\ninterface BarGroups<T extends ChartDataTypes> {\n ariaLabel: string;\n isRefresh: boolean;\n isPopoverPinned: boolean;\n barGroups: ScaledBarGroup<T>[];\n highlightedGroupIndex: null | number;\n highlightedGroupRef: React.RefObject<SVGRectElement>;\n}\n\n/**\n * The component renders empty SVG rectangles corresponding to the bar group slots.\n * The highlighted group rectangle is used for the pseudo-focus and therefore requires ARIA attributes.\n * Other rectangles are only needed for the \"findBarGroups\" test-utils selector.\n */\nexport default function BarGroups<T extends ChartDataTypes>({\n ariaLabel,\n isRefresh,\n isPopoverPinned,\n barGroups,\n highlightedGroupIndex,\n highlightedGroupRef,\n}: BarGroups<T>) {\n return (\n <g role=\"group\" aria-hidden=\"true\">\n {barGroups.map((group, index) => (\n <rect\n key={index}\n x={Math.max(0, group.position.x - OUTLINE_PADDING)}\n y={Math.max(0, group.position.y - OUTLINE_PADDING)}\n width={group.position.width + 2 * OUTLINE_PADDING}\n height={group.position.height + 2 * OUTLINE_PADDING}\n ref={index === highlightedGroupIndex ? highlightedGroupRef : undefined}\n rx={isRefresh ? 4 : 2}\n role=\"button\"\n aria-label={ariaLabel}\n aria-haspopup={true}\n aria-expanded={isPopoverPinned}\n // We must use \"transparent\" instead of \"none\" so that Firefox popover placement works correctly.\n // When an SVG element has no stroke or fill color the Firefox optimizes it out.\n fill=\"transparent\"\n className={styles['bar-group']}\n />\n ))}\n </g>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { StatusIndicatorProps } from './
|
|
2
|
+
import { StatusIndicatorProps } from './interfaces';
|
|
3
3
|
export { StatusIndicatorProps };
|
|
4
4
|
export default function StatusIndicator({ type, wrapText, ...props }: StatusIndicatorProps): JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/status-indicator/index.tsx"],"names":[],"mappings":";AAOA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/status-indicator/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,IAAgB,EAAE,QAAe,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,eAK5G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/status-indicator/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/status-indicator/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;;AACb,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,uBAAuB,MAAM,YAAY,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAqE;QAArE,EAAE,IAAI,GAAG,SAAS,EAAE,QAAQ,GAAG,IAAI,OAAkC,EAA7B,KAAK,cAA7C,oBAA+C,CAAF;IACnF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;QAC7D,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC9D,CAAC,CAAC;IACH,OAAO,oBAAC,uBAAuB,kBAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,IAAM,KAAK,EAAM,kBAAkB,EAAI,CAAC;AACxG,CAAC;AAED,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\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 { StatusIndicatorProps } from './interfaces';\nimport InternalStatusIndicator from './internal';\n\nexport { StatusIndicatorProps };\n\nexport default function StatusIndicator({ type = 'success', wrapText = true, ...props }: StatusIndicatorProps) {\n const baseComponentProps = useBaseComponent('StatusIndicator', {\n props: { colorOverride: props.colorOverride, type, wrapText },\n });\n return <InternalStatusIndicator type={type} wrapText={wrapText} {...props} {...baseComponentProps} />;\n}\n\napplyDisplayName(StatusIndicator, 'StatusIndicator');\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseComponentProps } from '../internal/base-component';
|
|
3
|
+
/**
|
|
4
|
+
* @awsuiSystem core
|
|
5
|
+
*/
|
|
6
|
+
import { NativeAttributes } from '../internal/utils/with-native-attributes';
|
|
7
|
+
export interface StatusIndicatorProps extends BaseComponentProps {
|
|
8
|
+
/**
|
|
9
|
+
* Specifies the status type.
|
|
10
|
+
*/
|
|
11
|
+
type?: StatusIndicatorProps.Type;
|
|
12
|
+
/**
|
|
13
|
+
* A text fragment that communicates the status.
|
|
14
|
+
*/
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Specifies an `aria-label` for the icon. If the status text alone does not fully describe the status,
|
|
18
|
+
* use this to communicate additional context.
|
|
19
|
+
*/
|
|
20
|
+
iconAriaLabel?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies an override for the status indicator color.
|
|
23
|
+
*/
|
|
24
|
+
colorOverride?: StatusIndicatorProps.Color;
|
|
25
|
+
/**
|
|
26
|
+
* Specifies if the text content should wrap. If you set it to false, it prevents the text from wrapping
|
|
27
|
+
* and truncates it with an ellipsis.
|
|
28
|
+
*/
|
|
29
|
+
wrapText?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Attributes to add to the native element.
|
|
32
|
+
* Some attributes will be automatically combined with internal attribute values:
|
|
33
|
+
* - `className` will be appended.
|
|
34
|
+
* - Event handlers will be chained, unless the default is prevented.
|
|
35
|
+
*
|
|
36
|
+
* We do not support using this attribute to apply custom styling.
|
|
37
|
+
*
|
|
38
|
+
* @awsuiSystem core
|
|
39
|
+
*/
|
|
40
|
+
nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;
|
|
41
|
+
}
|
|
42
|
+
export declare namespace StatusIndicatorProps {
|
|
43
|
+
type Type = 'error' | 'warning' | 'success' | 'info' | 'stopped' | 'pending' | 'in-progress' | 'loading';
|
|
44
|
+
type Color = 'blue' | 'grey' | 'green' | 'red' | 'yellow';
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/status-indicator/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D;;OAEG;IACH,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;CACxE;AAED,yBAAiB,oBAAoB,CAAC;IAGpC,KAAY,IAAI,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;IAChH,KAAY,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;CAClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/status-indicator/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\n/**\n * @awsuiSystem core\n */\nimport { NativeAttributes } from '../internal/utils/with-native-attributes';\n\nexport interface StatusIndicatorProps extends BaseComponentProps {\n /**\n * Specifies the status type.\n */\n type?: StatusIndicatorProps.Type;\n /**\n * A text fragment that communicates the status.\n */\n children?: React.ReactNode;\n /**\n * Specifies an `aria-label` for the icon. If the status text alone does not fully describe the status,\n * use this to communicate additional context.\n */\n iconAriaLabel?: string;\n /**\n * Specifies an override for the status indicator color.\n */\n colorOverride?: StatusIndicatorProps.Color;\n /**\n * Specifies if the text content should wrap. If you set it to false, it prevents the text from wrapping\n * and truncates it with an ellipsis.\n */\n wrapText?: boolean;\n /**\n * Attributes to add to the native element.\n * Some attributes will be automatically combined with internal attribute values:\n * - `className` will be appended.\n * - Event handlers will be chained, unless the default is prevented.\n *\n * We do not support using this attribute to apply custom styling.\n *\n * @awsuiSystem core\n */\n nativeAttributes?: NativeAttributes<React.HTMLAttributes<HTMLElement>>;\n}\n\nexport namespace StatusIndicatorProps {\n // Why not enums? Explained there\n // https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum\n export type Type = 'error' | 'warning' | 'success' | 'info' | 'stopped' | 'pending' | 'in-progress' | 'loading';\n export type Color = 'blue' | 'grey' | 'green' | 'red' | 'yellow';\n}\n"]}
|