@cloudscape-design/components 3.0.1072 → 3.0.1074
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/alert/interfaces.d.ts +0 -16
- package/alert/interfaces.d.ts.map +1 -1
- package/alert/interfaces.js.map +1 -1
- package/app-layout/visual-refresh-toolbar/state/props-merger.js +3 -3
- package/app-layout/visual-refresh-toolbar/state/props-merger.js.map +1 -1
- package/badge/interfaces.d.ts +0 -9
- package/badge/interfaces.d.ts.map +1 -1
- package/badge/interfaces.js.map +1 -1
- package/button/interfaces.d.ts +6 -12
- package/button/interfaces.d.ts.map +1 -1
- package/button/interfaces.js.map +1 -1
- package/button/style.d.ts.map +1 -1
- package/button/style.js +17 -12
- package/button/style.js.map +1 -1
- package/button/styles.css.js +22 -22
- package/button/styles.scoped.css +113 -69
- package/button/styles.selectors.js +22 -22
- package/checkbox/interfaces.d.ts +0 -1
- package/checkbox/interfaces.d.ts.map +1 -1
- package/checkbox/interfaces.js.map +1 -1
- package/container/interfaces.d.ts +0 -15
- package/container/interfaces.d.ts.map +1 -1
- package/container/interfaces.js.map +1 -1
- package/date-range-picker/time-offset.js +3 -3
- package/date-range-picker/time-offset.js.map +1 -1
- package/flashbar/interfaces.d.ts +0 -24
- package/flashbar/interfaces.d.ts.map +1 -1
- package/flashbar/interfaces.js.map +1 -1
- package/internal/base-component/styles.scoped.css +1 -1
- package/internal/context/single-tab-stop-navigation-context.d.ts +2 -0
- package/internal/context/single-tab-stop-navigation-context.d.ts.map +1 -1
- package/internal/context/single-tab-stop-navigation-context.js +35 -4
- package/internal/context/single-tab-stop-navigation-context.js.map +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/hooks/use-virtual/index.d.ts.map +1 -1
- package/internal/hooks/use-virtual/index.js +5 -1
- package/internal/hooks/use-virtual/index.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/date-time/format-time-offset.d.ts +11 -0
- package/internal/utils/date-time/format-time-offset.d.ts.map +1 -1
- package/internal/utils/date-time/format-time-offset.js +17 -0
- package/internal/utils/date-time/format-time-offset.js.map +1 -1
- package/internal/utils/date-time/index.d.ts +1 -1
- package/internal/utils/date-time/index.d.ts.map +1 -1
- package/internal/utils/date-time/index.js +1 -1
- package/internal/utils/date-time/index.js.map +1 -1
- package/link/interfaces.d.ts +0 -6
- package/link/interfaces.d.ts.map +1 -1
- package/link/interfaces.js.map +1 -1
- package/package.json +1 -1
- package/radio-group/interfaces.d.ts +0 -1
- package/radio-group/interfaces.d.ts.map +1 -1
- package/radio-group/interfaces.js.map +1 -1
- package/toggle/interfaces.d.ts +0 -1
- package/toggle/interfaces.d.ts.map +1 -1
- package/toggle/interfaces.js.map +1 -1
|
@@ -69,21 +69,6 @@ export interface ContainerProps extends BaseComponentProps {
|
|
|
69
69
|
*/
|
|
70
70
|
variant?: 'default' | 'stacked';
|
|
71
71
|
/**
|
|
72
|
-
* Specifies an object of selectors and properties that are used to apply custom styles.
|
|
73
|
-
*
|
|
74
|
-
* - `root.background` (string) - (Optional) Background of the container.
|
|
75
|
-
* - `root.borderColor` (string) - (Optional) Border color of the container.
|
|
76
|
-
* - `root.borderRadius` (string) - (Optional) Border radius of the container.
|
|
77
|
-
* - `root.borderWidth` (string) - (Optional) Border width of the container.
|
|
78
|
-
* - `root.boxShadow` (string) - (Optional) Box shadow of the container.
|
|
79
|
-
* - `content.paddingBlock` (string) - (Optional) Block dimension padding of the content slot.
|
|
80
|
-
* - `content.paddingInline` (string) - (Optional) Inline dimension padding of the content slot.
|
|
81
|
-
* - `header.paddingBlock` (string) - (Optional) Block dimension padding of the header slot.
|
|
82
|
-
* - `header.paddingInline` (string) - (Optional) Inline dimension padding of the header slot.
|
|
83
|
-
* - `footer.root.paddingBlock` (string) - (Optional) Block dimension padding of the footer slot.
|
|
84
|
-
* - `footer.root.paddingInline` (string) - (Optional) Inline dimension padding of the footer slot.
|
|
85
|
-
* - `footer.divider.borderColor` (string) - (Optional) Border color of the footer divider.
|
|
86
|
-
* - `footer.divider.borderWidth` (string) - (Optional) Border width of the footer divider.
|
|
87
72
|
* @awsuiSystem core
|
|
88
73
|
*/
|
|
89
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC;IAErD;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAEzB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAEhC
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;OAIG;IACH,iBAAiB,CAAC,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SACpB,CAAC;QACF,OAAO,CAAC,EAAE;YACR,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,MAAM,CAAC,EAAE;YACP,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QACF,MAAM,CAAC,EAAE;YACP,IAAI,EAAE;gBACJ,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,aAAa,CAAC,EAAE,MAAM,CAAC;aACxB,CAAC;YACF,OAAO,EAAE;gBACP,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,WAAW,CAAC,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * @analytics\n */\n analyticsMetadata?: ContainerProps.AnalyticsMetadata;\n\n /**\n * Heading element of the container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Determines whether the container header has padding. If `true`, removes the default padding from the header.\n */\n disableHeaderPaddings?: boolean;\n\n /**\n *\n * Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.\n * You can define different positions and sizes for the media element within the container.\n *\n * * `content` - Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\n *\n * * `position` - Defines the media slot's position within the container. Defaults to `top`.\n *\n * * `width` - Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it.\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n *\n * * `height` - Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it. * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n *\n */\n media?: ContainerProps.Media;\n\n /**\n * Main content of the container.\n */\n children?: React.ReactNode;\n\n /**\n * Determines whether the container content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Enabling this property will make the container to fit into available height. If content is too short, the container\n * will stretch, if too long, the container will shrink and show vertical scrollbar.\n *\n * Use this property to align heights of multiple containers displayed in a single row. It is recommended to stretch\n * all containers to the height of the longest one, to avoid extra vertical scroll areas.\n */\n fitHeight?: boolean;\n\n /**\n * Footer of the container.\n */\n footer?: React.ReactNode;\n\n /**\n * Determines whether the container footer has padding. If `true`, removes the default padding from the footer.\n * @awsuiSystem core\n */\n disableFooterPaddings?: boolean;\n\n /**\n * Specify a container variant with one of the following:\n * * `default` - Use this variant in standalone context.\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * @visualrefresh `stacked` variant\n */\n variant?: 'default' | 'stacked';\n\n /**\n *
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/container/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface ContainerProps extends BaseComponentProps {\n /**\n * Specifies additional analytics-related metadata.\n * * `instanceIdentifier` - A unique string that identifies this component instance in your application.\n * @analytics\n */\n analyticsMetadata?: ContainerProps.AnalyticsMetadata;\n\n /**\n * Heading element of the container. Use the [header component](/components/header/).\n */\n header?: React.ReactNode;\n\n /**\n * Determines whether the container header has padding. If `true`, removes the default padding from the header.\n */\n disableHeaderPaddings?: boolean;\n\n /**\n *\n * Use this slot to render a media element. Supported element types are 'img', 'video', and 'picture'.\n * You can define different positions and sizes for the media element within the container.\n *\n * * `content` - Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\n *\n * * `position` - Defines the media slot's position within the container. Defaults to `top`.\n *\n * * `width` - Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it.\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n *\n * * `height` - Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, media elements larger than the defined width may be cropped, with 'object-fit: cover' centering it. * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n *\n */\n media?: ContainerProps.Media;\n\n /**\n * Main content of the container.\n */\n children?: React.ReactNode;\n\n /**\n * Determines whether the container content has padding. If `true`, removes the default padding from the content area.\n */\n disableContentPaddings?: boolean;\n\n /**\n * Enabling this property will make the container to fit into available height. If content is too short, the container\n * will stretch, if too long, the container will shrink and show vertical scrollbar.\n *\n * Use this property to align heights of multiple containers displayed in a single row. It is recommended to stretch\n * all containers to the height of the longest one, to avoid extra vertical scroll areas.\n */\n fitHeight?: boolean;\n\n /**\n * Footer of the container.\n */\n footer?: React.ReactNode;\n\n /**\n * Determines whether the container footer has padding. If `true`, removes the default padding from the footer.\n * @awsuiSystem core\n */\n disableFooterPaddings?: boolean;\n\n /**\n * Specify a container variant with one of the following:\n * * `default` - Use this variant in standalone context.\n * * `stacked` - Use this variant adjacent to other stacked containers (such as a container,\n * table).\n * @visualrefresh `stacked` variant\n */\n variant?: 'default' | 'stacked';\n\n /**\n * @awsuiSystem core\n */\n style?: ContainerProps.Style;\n}\n\nexport namespace ContainerProps {\n export interface AnalyticsMetadata {\n instanceIdentifier?: string;\n }\n export interface Media {\n /**\n * Use this slot to render your media element. We support `img`, `video`, `picture`, and `iframe` elements.\n */\n content: React.ReactNode;\n\n /**\n * Defines the media slot's position within the container. Defaults to `top`.\n */\n position?: 'top' | 'side';\n\n /**\n * Defines the width of the media slot when positioned on the side. Corresponds to the `width` CSS-property.\n * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.\n *\n * Note: This value is considered only when `position` is set to `side`.\n * If no width is provided, the media slot will take a maximum of 66% of the container's width.\n */\n width?: string | number;\n\n /**\n * Defines the height of the media slot when position on the top. Corresponds to the `height` CSS-property.\n * When this value is set, the media element may be cropped, with `object-fit: cover` centering it.\n *\n * Note: This value is only considered if `position` is set to `top`.\n * If no height is provided, the media slot will be displayed at its full height.\n */\n height?: string | number;\n }\n\n export interface Style {\n root?: {\n background?: string;\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n boxShadow?: string;\n };\n content?: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n header?: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n footer?: {\n root: {\n paddingBlock?: string;\n paddingInline?: string;\n };\n divider: {\n borderColor?: string;\n borderWidth?: string;\n };\n };\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { addMinutes } from 'date-fns';
|
|
4
4
|
import { warnOnce } from '@cloudscape-design/component-toolkit/internal';
|
|
5
|
-
import {
|
|
5
|
+
import { formatTimeOffsetISOInternal, parseTimezoneOffset, shiftTimezoneOffset } from '../internal/utils/date-time';
|
|
6
6
|
/**
|
|
7
7
|
* Appends a time zone offset to a date string, replacing any existing timezone information.
|
|
8
8
|
*/
|
|
@@ -16,8 +16,8 @@ export function setTimeOffset(value, timeOffset) {
|
|
|
16
16
|
};
|
|
17
17
|
return {
|
|
18
18
|
type: 'absolute',
|
|
19
|
-
startDate: stripTimezone(value.startDate) +
|
|
20
|
-
endDate: stripTimezone(value.endDate) +
|
|
19
|
+
startDate: stripTimezone(value.startDate) + formatTimeOffsetISOInternal(value.startDate, timeOffset.startDate),
|
|
20
|
+
endDate: stripTimezone(value.endDate) + formatTimeOffsetISOInternal(value.endDate, timeOffset.endDate),
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-offset.js","sourceRoot":"","sources":["../../../src/date-range-picker/time-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"time-offset.js","sourceRoot":"","sources":["../../../src/date-range-picker/time-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGpH;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAwC,EACxC,UAAoD;IAEpD,IAAI,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,UAAU,CAAC,EAAE;QACjC,OAAO,KAAK,CAAC;KACd;IAED,MAAM,aAAa,GAAG,CAAC,UAAkB,EAAU,EAAE;QACnD,iEAAiE;QACjE,OAAO,UAAU,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,2BAA2B,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC;QAC9G,OAAO,EAAE,aA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ACF;IACD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACtD,CAAC;AAED;;;;;;;;;;;;;;;EAeE;AACF,SAAS,YAAY,CAAC,aAAqB;IACzC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC,IAAI,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { addMinutes } from 'date-fns';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport { formatTimeOffsetISOInternal, parseTimezoneOffset, shiftTimezoneOffset } from '../internal/utils/date-time';\nimport { DateRangePickerProps } from './interfaces';\n\n/**\n * Appends a time zone offset to a date string, replacing any existing timezone information.\n */\nexport function setTimeOffset(\n value: DateRangePickerProps.Value | null,\n timeOffset: { startDate?: number; endDate?: number }\n): DateRangePickerProps.Value | null {\n if (!(value?.type === 'absolute')) {\n return value;\n }\n\n const stripTimezone = (dateString: string): string => {\n // Remove existing timezone info: Z, +HH:MM, -HH:MM, +HHMM, -HHMM\n return dateString.replace(/[Z]$|[+-]\\d{2}:?\\d{2}$/, '');\n };\n\n return {\n type: 'absolute',\n startDate: stripTimezone(value.startDate) + formatTimeOffsetISOInternal(value.startDate, timeOffset.startDate),\n endDate: stripTimezone(value.endDate) + formatTimeOffsetISOInternal(value.endDate, timeOffset.endDate),\n };\n}\n\n/**\n * Re-formats an absolute date range so that it is expressed using the\n * target time offset. The returned value still represents the same range\n * in time, but contains no visible offset.\n */\nexport function shiftTimeOffset(\n value: null | DateRangePickerProps.Value,\n timeOffset: { startDate?: number; endDate?: number }\n): DateRangePickerProps.Value | null {\n if (!value || value.type !== 'absolute') {\n return value;\n }\n\n /*\n This regex matches an ISO date-time (non date-only or month-only) with\n - optional seconds;\n - optional milliseconds;\n - optional time offset or 'Z'.\n */\n const dateTimeRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?(\\.\\d{1,3})?(((\\+|-)\\d{2}(:\\d{2})?)|Z)?$/;\n\n if (!dateTimeRegex.test(value.startDate) || !dateTimeRegex.test(value.endDate)) {\n warnOnce(\n 'DateRangePicker',\n 'You have provided a misformatted start or end date. The component will fall back to an empty value. ' +\n 'Dates have to be ISO8601-formatted with an optional time zone offset.'\n );\n return null;\n }\n\n return {\n type: 'absolute',\n startDate: shiftTimezoneOffset(value.startDate, timeOffset.startDate),\n endDate: shiftTimezoneOffset(value.endDate, timeOffset.endDate),\n };\n}\n\nexport type NormalizedTimeOffset =\n | {\n startDate: number;\n endDate: number;\n }\n | {\n startDate: undefined;\n endDate: undefined;\n };\n\nexport function normalizeTimeOffset(\n value: null | DateRangePickerProps.Value,\n getTimeOffset?: DateRangePickerProps.GetTimeOffsetFunction,\n timeOffset?: number\n): NormalizedTimeOffset {\n if (value && value.type === 'absolute') {\n if (getTimeOffset) {\n return {\n startDate: getTimeOffset(parseDateUTC(value.startDate)),\n endDate: getTimeOffset(parseDateUTC(value.endDate)),\n };\n } else if (timeOffset !== undefined) {\n return { startDate: timeOffset, endDate: timeOffset };\n }\n }\n return { startDate: undefined, endDate: undefined };\n}\n\n/*\n Before the getTimeOffset function is used there is no information on the preferred time offset.\n \n Besides, the ISO date string might or might not contain the offset:\n - 2021-02-03T01:02:03\n - 2021-02-03T01:02:03Z\n - 2021-02-03T01:02:03+01:00\n \n For every value above the date is converted to UTC and the following is true:\n date.getUTCFullYear() === 2021\n date.getUTCMonth() === 1\n date.getUTCDate() === 3\n date.getUTCHours() === 1\n date.getUTCMinutes() === 2\n date.getUTCSeconds() === 3\n*/\nfunction parseDateUTC(isoDateString: string): Date {\n const date = new Date(isoDateString);\n return addMinutes(date, parseTimezoneOffset(isoDateString));\n}\n"]}
|
package/flashbar/interfaces.d.ts
CHANGED
|
@@ -196,30 +196,6 @@ export interface FlashbarProps extends BaseComponentProps {
|
|
|
196
196
|
*/
|
|
197
197
|
i18nStrings?: FlashbarProps.I18nStrings;
|
|
198
198
|
/**
|
|
199
|
-
* Specifies an object of selectors and properties that are used to apply custom styles.
|
|
200
|
-
*
|
|
201
|
-
* - `item.root.background` {error, info, inProgress, success, warning} - (Optional) Background for item types.
|
|
202
|
-
* - `item.root.borderColor` {error, info, inProgress, success, warning} - (Optional) Border color for item types.
|
|
203
|
-
* - `item.root.borderRadius` (string) - (Optional) Item border radius.
|
|
204
|
-
* - `item.root.borderWidth` (string) - (Optional) Item border width.
|
|
205
|
-
* - `item.root.color` {error, info, inProgress, success, warning} - (Optional) Color for item types.
|
|
206
|
-
* - `item.root.focusRing.borderColor` {error, info, inProgress, success, warning} - (Optional) Item focus ring border color.
|
|
207
|
-
* - `item.root.focusRing.borderRadius` (string) - (Optional) Item focus ring border radius.
|
|
208
|
-
* - `item.root.focusRing.borderWidth` (string) - (Optional) Item focus ring border width.
|
|
209
|
-
* - `item.dismissButton.color.active` {error, info, inProgress, success, warning} - (Optional) Color for dismiss button active state.
|
|
210
|
-
* - `item.dismissButton.color.default` {error, info, inProgress, success, warning} - (Optional) Color for dismiss button default state.
|
|
211
|
-
* - `item.dismissButton.color.hover` {error, info, inProgress, success, warning} - (Optional) Color for dismiss button hover state.
|
|
212
|
-
* - `item.dismissButton.focusRing.borderColor` {error, info, inProgress, success, warning} - (Optional) Dismiss button focus ring border color.
|
|
213
|
-
* - `item.dismissButton.focusRing.borderRadius` (string) - (Optional) Dismiss button focus ring border radius.
|
|
214
|
-
* - `item.dismissButton.focusRing.borderWidth` (string) - (Optional) Dismiss button focus ring border width.
|
|
215
|
-
* - `notificationBar.root.background` {active, default, hover} - (Optional) Background for notification bar states.
|
|
216
|
-
* - `notificationBar.root.borderColor` {active, default, hover} - (Optional) Border color for notification bar states.
|
|
217
|
-
* - `notificationBar.root.borderRadius` (string) - (Optional) Notification bar border radius.
|
|
218
|
-
* - `notificationBar.root.borderWidth` (string) - (Optional) Notification bar border width.
|
|
219
|
-
* - `notificationBar.root.color` {active, default, hover} - (Optional) Color for notification bar states.
|
|
220
|
-
* - `notificationBar.expandButton.focusRing.borderColor` (string) - (Optional) Border color for the expand button.
|
|
221
|
-
* - `notificationBar.expandButton.focusRing.borderRadius` (string) - (Optional) Border radius for the expand button.
|
|
222
|
-
* - `notificationBar.expandButton.focusRing.borderWidth` (string) - (Optional) Border width for the expand button.
|
|
223
199
|
* @awsuiSystem core
|
|
224
200
|
*/
|
|
225
201
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/flashbar/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,iBAAiB;QAChC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC;QAC1B,QAAQ,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC;QAClC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;QACrC,aAAa,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;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,aAAa,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAEtD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;IAExC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/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 { ButtonProps } from '../button/interfaces';\nimport { ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n statusIconAriaLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n ariaRole?: FlashbarProps.AriaRole;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n analyticsMetadata?: FlashbarProps.ItemAnalyticsMetadata;\n }\n\n export interface ItemAnalyticsMetadata {\n suppressFlowMetricEvents?: boolean;\n errorContext?: ErrorContext;\n }\n\n export interface I18nStrings {\n ariaLabel?: string;\n errorIconAriaLabel?: string;\n infoIconAriaLabel?: string;\n inProgressIconAriaLabel?: string;\n notificationBarAriaLabel?: string;\n notificationBarText?: string;\n successIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n }\n\n export interface Style {\n item?: {\n root?: {\n background?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderColor?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n color?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n focusRing?: {\n borderColor?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n dismissButton?: {\n color?: {\n active?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n default?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n hover?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n };\n focusRing?: {\n borderColor?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n };\n notificationBar?: {\n root?: {\n background?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n borderColor?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n };\n expandButton?: {\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n };\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error' | 'in-progress';\n export type AriaRole = 'alert' | 'status';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info, in-progress`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.\n * If not provided, `i18nStrings.{type}IconAriaLabel` will be used as a fallback.\n * * `ariaRole` (string) - For flash messages added after page load, specifies how this message is communicated to assistive\n * technology. Use \"status\" for status updates or informational content. Use \"alert\" for important messages that need the\n * user's attention.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called.\n * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `onDismiss` (event => void) - (Optional) Called when a user clicks on the dismiss button.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n * * `analyticsMetadata` (FlashbarProps.ItemAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * * `suppressFlowMetricEvents` - Prevent this item from generating events related to flow metrics.\n * @analytics\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n\n /**\n * Specifies whether flash messages should be stacked.\n */\n stackItems?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component. The object should contain:\n *\n * * `ariaLabel` - Specifies the ARIA label for the list of notifications.\n *\n * If `stackItems` is set to `true`, it should also contain:\n *\n * * `notificationBarAriaLabel` - (optional) Specifies the ARIA label for the notification bar\n * * `notificationBarText` - (optional) Specifies the text shown in the notification bar\n * * `errorIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `error`.\n * * `warningIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `warning`.\n * * `infoIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `info`.\n * * `successIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `success`.\n * * `inProgressIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `in-progress` or with `loading` set to `true`.\n * @i18n\n */\n i18nStrings?: FlashbarProps.I18nStrings;\n\n /**\n * Specifies an object of selectors and properties that are used to apply custom styles.\n *\n * - `item.root.background` {error, info, inProgress, success, warning} - (Optional) Background for item types.\n * - `item.root.borderColor` {error, info, inProgress, success, warning} - (Optional) Border color for item types.\n * - `item.root.borderRadius` (string) - (Optional) Item border radius.\n * - `item.root.borderWidth` (string) - (Optional) Item border width.\n * - `item.root.color` {error, info, inProgress, success, warning} - (Optional) Color for item types.\n * - `item.root.focusRing.borderColor` {error, info, inProgress, success, warning} - (Optional) Item focus ring border color.\n * - `item.root.focusRing.borderRadius` (string) - (Optional) Item focus ring border radius.\n * - `item.root.focusRing.borderWidth` (string) - (Optional) Item focus ring border width.\n * - `item.dismissButton.color.active` {error, info, inProgress, success, warning} - (Optional) Color for dismiss button active state.\n * - `item.dismissButton.color.default` {error, info, inProgress, success, warning} - (Optional) Color for dismiss button default state.\n * - `item.dismissButton.color.hover` {error, info, inProgress, success, warning} - (Optional) Color for dismiss button hover state.\n * - `item.dismissButton.focusRing.borderColor` {error, info, inProgress, success, warning} - (Optional) Dismiss button focus ring border color.\n * - `item.dismissButton.focusRing.borderRadius` (string) - (Optional) Dismiss button focus ring border radius.\n * - `item.dismissButton.focusRing.borderWidth` (string) - (Optional) Dismiss button focus ring border width.\n * - `notificationBar.root.background` {active, default, hover} - (Optional) Background for notification bar states.\n * - `notificationBar.root.borderColor` {active, default, hover} - (Optional) Border color for notification bar states.\n * - `notificationBar.root.borderRadius` (string) - (Optional) Notification bar border radius.\n * - `notificationBar.root.borderWidth` (string) - (Optional) Notification bar border width.\n * - `notificationBar.root.color` {active, default, hover} - (Optional) Color for notification bar states.\n * - `notificationBar.expandButton.focusRing.borderColor` (string) - (Optional) Border color for the expand button.\n * - `notificationBar.expandButton.focusRing.borderRadius` (string) - (Optional) Border radius for the expand button.\n * - `notificationBar.expandButton.focusRing.borderWidth` (string) - (Optional) Border width for the expand button.\n * @awsuiSystem core\n */\n style?: FlashbarProps.Style;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/flashbar/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 { ButtonProps } from '../button/interfaces';\nimport { ErrorContext } from '../internal/analytics/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport namespace FlashbarProps {\n export interface MessageDefinition {\n header?: React.ReactNode;\n content?: React.ReactNode;\n dismissible?: boolean;\n dismissLabel?: string;\n statusIconAriaLabel?: string;\n loading?: boolean;\n type?: FlashbarProps.Type;\n ariaRole?: FlashbarProps.AriaRole;\n action?: React.ReactNode;\n id?: string;\n buttonText?: ButtonProps['children'];\n onButtonClick?: ButtonProps['onClick'];\n onDismiss?: ButtonProps['onClick'];\n analyticsMetadata?: FlashbarProps.ItemAnalyticsMetadata;\n }\n\n export interface ItemAnalyticsMetadata {\n suppressFlowMetricEvents?: boolean;\n errorContext?: ErrorContext;\n }\n\n export interface I18nStrings {\n ariaLabel?: string;\n errorIconAriaLabel?: string;\n infoIconAriaLabel?: string;\n inProgressIconAriaLabel?: string;\n notificationBarAriaLabel?: string;\n notificationBarText?: string;\n successIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n }\n\n export interface Style {\n item?: {\n root?: {\n background?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderColor?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n color?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n focusRing?: {\n borderColor?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n dismissButton?: {\n color?: {\n active?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n default?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n hover?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n };\n focusRing?: {\n borderColor?: {\n error?: string;\n info?: string;\n inProgress?: string;\n success?: string;\n warning?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n };\n notificationBar?: {\n root?: {\n background?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n borderColor?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n borderRadius?: string;\n borderWidth?: string;\n color?: {\n active?: string;\n default?: string;\n hover?: string;\n };\n };\n expandButton?: {\n focusRing?: {\n borderColor?: string;\n borderRadius?: string;\n borderWidth?: string;\n };\n };\n };\n }\n\n export type Type = 'success' | 'warning' | 'info' | 'error' | 'in-progress';\n export type AriaRole = 'alert' | 'status';\n}\n\nexport interface FlashbarProps extends BaseComponentProps {\n /**\n * Specifies flash messages that appear in the same order that they are listed.\n * The value is an array of flash message definition objects.\n *\n * A flash message object contains the following properties:\n * * `header` (ReactNode) - Specifies the heading text.\n * * `content` (ReactNode) - Specifies the primary text displayed in the flash element.\n * * `type` (string) - Indicates the type of the message to be displayed. Allowed values are as follows: `success, error, warning, info, in-progress`. The default is `info`.\n * * `loading` (boolean) - Replaces the status icon with a spinner and forces the type to `info`.\n * * `dismissible` (boolean) - Determines whether the component includes a close button icon. By default, the close button is not included.\n * When a user clicks on this button the `onDismiss` handler is called.\n * * `dismissLabel` (string) - Specifies an `aria-label` for to the dismiss icon button for improved accessibility.\n * * `statusIconAriaLabel` (string) - Specifies an `aria-label` for to the status icon for improved accessibility.\n * If not provided, `i18nStrings.{type}IconAriaLabel` will be used as a fallback.\n * * `ariaRole` (string) - For flash messages added after page load, specifies how this message is communicated to assistive\n * technology. Use \"status\" for status updates or informational content. Use \"alert\" for important messages that need the\n * user's attention.\n * * `action` (ReactNode) - Specifies an action for the flash message. Although it is technically possible to insert any content,\n * our UX guidelines only allow you to add a button.\n * * `buttonText` (string) - Specifies that an action button should be displayed, with the specified text.\n * When a user clicks on this button the `onButtonClick` handler is called.\n * If the `action` property is set, this property is ignored. **Deprecated**, replaced by `action`.\n * * `onButtonClick` (event => void) - Called when a user clicks on the action button. This is not called if you create a custom button\n * using the `action` property. **Deprecated**, replaced by `action`.\n * * `onDismiss` (event => void) - (Optional) Called when a user clicks on the dismiss button.\n * * `id` (string) - Specifies a unique flash message identifier. This property is used in two ways:\n * 1. As a [keys](https://reactjs.org/docs/lists-and-keys.html#keys) source for React rendering.\n * 2. To identify which flash message will be removed from the DOM when it is dismissed, to animate it out.\n * * `analyticsMetadata` (FlashbarProps.ItemAnalyticsMetadata) - (Optional) Specifies additional analytics-related metadata.\n * * `suppressFlowMetricEvents` - Prevent this item from generating events related to flow metrics.\n * @analytics\n */\n items: ReadonlyArray<FlashbarProps.MessageDefinition>;\n\n /**\n * Specifies whether flash messages should be stacked.\n */\n stackItems?: boolean;\n\n /**\n * An object containing all the necessary localized strings required by the component. The object should contain:\n *\n * * `ariaLabel` - Specifies the ARIA label for the list of notifications.\n *\n * If `stackItems` is set to `true`, it should also contain:\n *\n * * `notificationBarAriaLabel` - (optional) Specifies the ARIA label for the notification bar\n * * `notificationBarText` - (optional) Specifies the text shown in the notification bar\n * * `errorIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `error`.\n * * `warningIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `warning`.\n * * `infoIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `info`.\n * * `successIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `success`.\n * * `inProgressIconAriaLabel` - (optional) Specifies the ARIA label for the icon displayed next to the number of items of type `in-progress` or with `loading` set to `true`.\n * @i18n\n */\n i18nStrings?: FlashbarProps.I18nStrings;\n\n /**\n * @awsuiSystem core\n */\n style?: FlashbarProps.Style;\n}\n"]}
|
|
@@ -3,6 +3,7 @@ export type FocusableChangeHandler = (isFocusable: boolean) => void;
|
|
|
3
3
|
export declare const defaultValue: {
|
|
4
4
|
navigationActive: boolean;
|
|
5
5
|
registerFocusable(focusable: HTMLElement, handler: FocusableChangeHandler): () => void;
|
|
6
|
+
resetFocusTarget(): void;
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
8
9
|
* Single tab stop navigation context is used together with keyboard navigation that requires a single tab stop.
|
|
@@ -11,6 +12,7 @@ export declare const defaultValue: {
|
|
|
11
12
|
export declare const SingleTabStopNavigationContext: React.Context<{
|
|
12
13
|
navigationActive: boolean;
|
|
13
14
|
registerFocusable(focusable: HTMLElement, handler: FocusableChangeHandler): () => void;
|
|
15
|
+
resetFocusTarget(): void;
|
|
14
16
|
}>;
|
|
15
17
|
export declare function useSingleTabStopNavigation(focusable: null | React.RefObject<HTMLElement>, options?: {
|
|
16
18
|
tabIndex?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single-tab-stop-navigation-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/single-tab-stop-navigation-context.tsx"],"names":[],"mappings":"AAGA,OAAO,KAQN,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"single-tab-stop-navigation-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/single-tab-stop-navigation-context.tsx"],"names":[],"mappings":"AAGA,OAAO,KAQN,MAAM,OAAO,CAAC;AAKf,MAAM,MAAM,sBAAsB,GAAG,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;AAEpE,eAAO,MAAM,YAAY,EAAE;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;IACvF,gBAAgB,IAAI,IAAI,CAAC;CAK1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B;sBAbvB,OAAO;iCACI,WAAW,WAAW,sBAAsB,GAAG,MAAM,IAAI;wBAClE,IAAI;EAW+C,CAAC;AAE1E,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EAC9C,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAoBhC;AAED,UAAU,oCAAoC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kBAAkB,EAAE,MAAM,IAAI,GAAG,WAAW,CAAC;IAC7C,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,OAAO,GAAG,OAAO,CAAC;IACzD,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;IACtD,kBAAkB,CAAC,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;CACtD;AAED,MAAM,WAAW,0BAA0B;IACzC,iBAAiB,IAAI,IAAI,CAAC;IAC1B,cAAc,IAAI,IAAI,GAAG,WAAW,CAAC;IACrC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;CACzC;AAED,eAAO,MAAM,+BAA+B,yHAuG3C,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { createContext, forwardRef, useContext, useImperativeHandle, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { useEffectOnUpdate } from '../hooks/use-effect-on-update';
|
|
4
5
|
import { nodeBelongs } from '../utils/node-belongs';
|
|
5
6
|
export const defaultValue = {
|
|
6
7
|
navigationActive: false,
|
|
7
8
|
registerFocusable: () => () => { },
|
|
9
|
+
resetFocusTarget: () => { },
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
10
12
|
* Single tab stop navigation context is used together with keyboard navigation that requires a single tab stop.
|
|
@@ -48,6 +50,9 @@ export const SingleTabStopNavigationProvider = forwardRef(({ navigationActive, c
|
|
|
48
50
|
// Register a focusable element to allow navigating into it.
|
|
49
51
|
// The focusable element tabIndex is only set to 0 if the element matches the focus target.
|
|
50
52
|
function registerFocusable(focusableElement, changeHandler) {
|
|
53
|
+
// In case the contexts are nested, we must that the components register to all of them,
|
|
54
|
+
// so that switching between contexts dynamically is possible.
|
|
55
|
+
const parentUnregister = parentContext.registerFocusable(focusableElement, changeHandler);
|
|
51
56
|
focusables.current.add(focusableElement);
|
|
52
57
|
focusHandlers.current.set(focusableElement, changeHandler);
|
|
53
58
|
const isFocusable = !!focusablesState.current.get(focusableElement);
|
|
@@ -57,7 +62,10 @@ export const SingleTabStopNavigationProvider = forwardRef(({ navigationActive, c
|
|
|
57
62
|
changeHandler(newIsFocusable);
|
|
58
63
|
}
|
|
59
64
|
onRegisterFocusable === null || onRegisterFocusable === void 0 ? void 0 : onRegisterFocusable(focusableElement);
|
|
60
|
-
return () =>
|
|
65
|
+
return () => {
|
|
66
|
+
parentUnregister();
|
|
67
|
+
unregisterFocusable(focusableElement);
|
|
68
|
+
};
|
|
61
69
|
}
|
|
62
70
|
function unregisterFocusable(focusableElement) {
|
|
63
71
|
focusables.current.delete(focusableElement);
|
|
@@ -65,18 +73,21 @@ export const SingleTabStopNavigationProvider = forwardRef(({ navigationActive, c
|
|
|
65
73
|
onUnregisterFocusable === null || onUnregisterFocusable === void 0 ? void 0 : onUnregisterFocusable(focusableElement);
|
|
66
74
|
}
|
|
67
75
|
// Update focus target with next single focusable element and notify all registered focusables of a change.
|
|
68
|
-
function updateFocusTarget() {
|
|
76
|
+
function updateFocusTarget(forceUpdate = false) {
|
|
69
77
|
var _a;
|
|
70
78
|
focusTarget.current = getNextFocusTarget();
|
|
71
79
|
for (const focusableElement of focusables.current) {
|
|
72
80
|
const isFocusable = (_a = focusablesState.current.get(focusableElement)) !== null && _a !== void 0 ? _a : false;
|
|
73
81
|
const newIsFocusable = focusTarget.current === focusableElement || !!(isElementSuppressed === null || isElementSuppressed === void 0 ? void 0 : isElementSuppressed(focusableElement));
|
|
74
|
-
if (newIsFocusable !== isFocusable) {
|
|
82
|
+
if (newIsFocusable !== isFocusable || forceUpdate) {
|
|
75
83
|
focusablesState.current.set(focusableElement, newIsFocusable);
|
|
76
84
|
focusHandlers.current.get(focusableElement)(newIsFocusable);
|
|
77
85
|
}
|
|
78
86
|
}
|
|
79
87
|
}
|
|
88
|
+
function resetFocusTarget() {
|
|
89
|
+
updateFocusTarget(true);
|
|
90
|
+
}
|
|
80
91
|
function getFocusTarget() {
|
|
81
92
|
return focusTarget.current;
|
|
82
93
|
}
|
|
@@ -84,6 +95,26 @@ export const SingleTabStopNavigationProvider = forwardRef(({ navigationActive, c
|
|
|
84
95
|
return focusables.current.has(element);
|
|
85
96
|
}
|
|
86
97
|
useImperativeHandle(ref, () => ({ updateFocusTarget, getFocusTarget, isRegistered }));
|
|
87
|
-
|
|
98
|
+
// Only one STSN context should be active at a time.
|
|
99
|
+
// The outer context is preferred over the inners. The components using STSN
|
|
100
|
+
// must either work with either outer or inner context, or an explicit switch mechanism
|
|
101
|
+
// needs to be implemented (that turns the outer context on and off based on user interaction).
|
|
102
|
+
const parentContext = useContext(SingleTabStopNavigationContext);
|
|
103
|
+
const value = parentContext.navigationActive
|
|
104
|
+
? parentContext
|
|
105
|
+
: { navigationActive, registerFocusable, updateFocusTarget, resetFocusTarget };
|
|
106
|
+
// When contexts switching occurs, it is essential that the now-active one updates the focus target
|
|
107
|
+
// to ensure the tab indices are correctly set.
|
|
108
|
+
useEffectOnUpdate(() => {
|
|
109
|
+
if (parentContext.navigationActive) {
|
|
110
|
+
parentContext.resetFocusTarget();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
resetFocusTarget();
|
|
114
|
+
}
|
|
115
|
+
// The updateFocusTarget and its dependencies must be pure.
|
|
116
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
|
+
}, [parentContext.navigationActive]);
|
|
118
|
+
return React.createElement(SingleTabStopNavigationContext.Provider, { value: value }, children);
|
|
88
119
|
});
|
|
89
120
|
//# sourceMappingURL=single-tab-stop-navigation-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single-tab-stop-navigation-context.js","sourceRoot":"","sources":["../../../../src/internal/context/single-tab-stop-navigation-context.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,CAAC,MAAM,YAAY,GAGrB;IACF,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAE1E,MAAM,UAAU,0BAA0B,CACxC,SAA8C,EAC9C,OAA+B;;IAE/B,MAAM,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAC;IACpH,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,IAAG,CAAC,CAA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,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IAED,2GAA2G;IAC3G,SAAS,iBAAiB;;QACxB,WAAW,CAAC,OAAO,GAAG,kBAAkB,EAAE,CAAC;QAC3C,KAAK,MAAM,gBAAgB,IAAI,UAAU,CAAC,OAAO,EAAE;YACjD,MAAM,WAAW,GAAG,MAAA,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,mCAAI,KAAK,CAAC;YAC3E,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,KAAK,gBAAgB,IAAI,CAAC,CAAC,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,gBAAgB,CAAC,CAAA,CAAC;YAC7G,IAAI,cAAc,KAAK,WAAW,EAAE;gBAClC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;gBAC9D,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAE,CAAC,cAAc,CAAC,CAAC;aAC9D;SACF;IACH,CAAC;IAED,SAAS,cAAc;QACrB,OAAO,WAAW,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED,SAAS,YAAY,CAAC,OAAgB;QACpC,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IAEtF,OAAO,CACL,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,IACpF,QAAQ,CAC+B,CAC3C,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, {\n createContext,\n forwardRef,\n useContext,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { nodeBelongs } from '../utils/node-belongs';\n\nexport type FocusableChangeHandler = (isFocusable: boolean) => void;\n\nexport const defaultValue: {\n navigationActive: boolean;\n registerFocusable(focusable: HTMLElement, handler: FocusableChangeHandler): () => void;\n} = {\n navigationActive: false,\n registerFocusable: () => () => {},\n};\n\n/**\n * Single tab stop navigation context is used together with keyboard navigation that requires a single tab stop.\n * It instructs interactive elements to override tab indices for just a single one to remain user-focusable.\n */\nexport const SingleTabStopNavigationContext = createContext(defaultValue);\n\nexport function useSingleTabStopNavigation(\n focusable: null | React.RefObject<HTMLElement>,\n options?: { tabIndex?: number }\n) {\n const { navigationActive: contextNavigationActive, registerFocusable } = useContext(SingleTabStopNavigationContext);\n const [focusTargetActive, setFocusTargetActive] = useState(false);\n const navigationDisabled = options?.tabIndex && options?.tabIndex < 0;\n const navigationActive = contextNavigationActive && !navigationDisabled;\n\n useLayoutEffect(() => {\n if (navigationActive && focusable && focusable.current) {\n const unregister = registerFocusable(focusable.current, isFocusable => setFocusTargetActive(isFocusable));\n return () => unregister();\n }\n });\n\n let tabIndex = options?.tabIndex;\n if (navigationActive) {\n tabIndex = !focusTargetActive ? -1 : (options?.tabIndex ?? 0);\n }\n\n return { navigationActive, tabIndex };\n}\n\ninterface SingleTabStopNavigationProviderProps {\n navigationActive: boolean;\n children: React.ReactNode;\n getNextFocusTarget: () => null | HTMLElement;\n isElementSuppressed?(focusableElement: Element): boolean;\n onRegisterFocusable?(focusableElement: Element): void;\n onUnregisterActive?(focusableElement: Element): void;\n}\n\nexport interface SingleTabStopNavigationAPI {\n updateFocusTarget(): void;\n getFocusTarget(): null | HTMLElement;\n isRegistered(element: Element): boolean;\n}\n\nexport const SingleTabStopNavigationProvider = forwardRef(\n (\n {\n navigationActive,\n children,\n getNextFocusTarget,\n isElementSuppressed,\n onRegisterFocusable,\n onUnregisterActive,\n }: SingleTabStopNavigationProviderProps,\n ref: React.Ref<SingleTabStopNavigationAPI>\n ) => {\n // A set of registered focusable elements that can use keyboard navigation.\n const focusables = useRef(new Set<Element>());\n // A map of registered focusable element handlers to update the respective tab indices.\n const focusHandlers = useRef(new Map<Element, FocusableChangeHandler>());\n // A map of focusable element states to avoid issuing unnecessary updates to registered elements.\n const focusablesState = useRef(new WeakMap<Element, boolean>());\n // A reference to the currently focused element.\n const focusTarget = useRef<null | HTMLElement>(null);\n\n function onUnregisterFocusable(focusableElement: Element) {\n const isUnregisteringFocusedNode = nodeBelongs(focusableElement, document.activeElement);\n if (isUnregisteringFocusedNode) {\n // Wait for unmounted node to get removed from the DOM.\n setTimeout(() => onUnregisterActive?.(focusableElement), 0);\n }\n }\n\n // Register a focusable element to allow navigating into it.\n // The focusable element tabIndex is only set to 0 if the element matches the focus target.\n function registerFocusable(focusableElement: Element, changeHandler: FocusableChangeHandler) {\n focusables.current.add(focusableElement);\n focusHandlers.current.set(focusableElement, changeHandler);\n const isFocusable = !!focusablesState.current.get(focusableElement);\n const newIsFocusable = focusTarget.current === focusableElement || !!isElementSuppressed?.(focusableElement);\n if (newIsFocusable !== isFocusable) {\n focusablesState.current.set(focusableElement, newIsFocusable);\n changeHandler(newIsFocusable);\n }\n onRegisterFocusable?.(focusableElement);\n return () => unregisterFocusable(focusableElement);\n }\n function unregisterFocusable(focusableElement: Element) {\n focusables.current.delete(focusableElement);\n focusHandlers.current.delete(focusableElement);\n onUnregisterFocusable?.(focusableElement);\n }\n\n // Update focus target with next single focusable element and notify all registered focusables of a change.\n function updateFocusTarget() {\n focusTarget.current = getNextFocusTarget();\n for (const focusableElement of focusables.current) {\n const isFocusable = focusablesState.current.get(focusableElement) ?? false;\n const newIsFocusable = focusTarget.current === focusableElement || !!isElementSuppressed?.(focusableElement);\n if (newIsFocusable !== isFocusable) {\n focusablesState.current.set(focusableElement, newIsFocusable);\n focusHandlers.current.get(focusableElement)!(newIsFocusable);\n }\n }\n }\n\n function getFocusTarget() {\n return focusTarget.current;\n }\n\n function isRegistered(element: Element) {\n return focusables.current.has(element);\n }\n\n useImperativeHandle(ref, () => ({ updateFocusTarget, getFocusTarget, isRegistered }));\n\n return (\n <SingleTabStopNavigationContext.Provider value={{ navigationActive, registerFocusable }}>\n {children}\n </SingleTabStopNavigationContext.Provider>\n );\n }\n);\n"]}
|
|
1
|
+
{"version":3,"file":"single-tab-stop-navigation-context.js","sourceRoot":"","sources":["../../../../src/internal/context/single-tab-stop-navigation-context.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,CAAC,MAAM,YAAY,GAIrB;IACF,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;IACjC,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AAE1E,MAAM,UAAU,0BAA0B,CACxC,SAA8C,EAC9C,OAA+B;;IAE/B,MAAM,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAC;IACpH,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,IAAG,CAAC,CAAC;IACtE,MAAM,gBAAgB,GAAG,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IACvF,+FAA+F;IAC/F,MAAM,aAAa,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,aAAa,CAAC,gBAAgB;QAC1C,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAEjF,mGAAmG;IACnG,+CAA+C;IAC/C,iBAAiB,CAAC,GAAG,EAAE;QACrB,IAAI,aAAa,CAAC,gBAAgB,EAAE;YAClC,aAAa,CAAC,gBAAgB,EAAE,CAAC;SAClC;aAAM;YACL,gBAAgB,EAAE,CAAC;SACpB;QACD,2DAA2D;QAC3D,uDAAuD;IACzD,CAAC,EAAE,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAErC,OAAO,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAA2C,CAAC;AACrH,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, {\n createContext,\n forwardRef,\n useContext,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { useEffectOnUpdate } from '../hooks/use-effect-on-update';\nimport { nodeBelongs } from '../utils/node-belongs';\n\nexport type FocusableChangeHandler = (isFocusable: boolean) => void;\n\nexport const defaultValue: {\n navigationActive: boolean;\n registerFocusable(focusable: HTMLElement, handler: FocusableChangeHandler): () => void;\n resetFocusTarget(): void;\n} = {\n navigationActive: false,\n registerFocusable: () => () => {},\n resetFocusTarget: () => {},\n};\n\n/**\n * Single tab stop navigation context is used together with keyboard navigation that requires a single tab stop.\n * It instructs interactive elements to override tab indices for just a single one to remain user-focusable.\n */\nexport const SingleTabStopNavigationContext = createContext(defaultValue);\n\nexport function useSingleTabStopNavigation(\n focusable: null | React.RefObject<HTMLElement>,\n options?: { tabIndex?: number }\n) {\n const { navigationActive: contextNavigationActive, registerFocusable } = useContext(SingleTabStopNavigationContext);\n const [focusTargetActive, setFocusTargetActive] = useState(false);\n const navigationDisabled = options?.tabIndex && options?.tabIndex < 0;\n const navigationActive = contextNavigationActive && !navigationDisabled;\n\n useLayoutEffect(() => {\n if (navigationActive && focusable && focusable.current) {\n const unregister = registerFocusable(focusable.current, isFocusable => setFocusTargetActive(isFocusable));\n return () => unregister();\n }\n });\n\n let tabIndex = options?.tabIndex;\n if (navigationActive) {\n tabIndex = !focusTargetActive ? -1 : (options?.tabIndex ?? 0);\n }\n\n return { navigationActive, tabIndex };\n}\n\ninterface SingleTabStopNavigationProviderProps {\n navigationActive: boolean;\n children: React.ReactNode;\n getNextFocusTarget: () => null | HTMLElement;\n isElementSuppressed?(focusableElement: Element): boolean;\n onRegisterFocusable?(focusableElement: Element): void;\n onUnregisterActive?(focusableElement: Element): void;\n}\n\nexport interface SingleTabStopNavigationAPI {\n updateFocusTarget(): void;\n getFocusTarget(): null | HTMLElement;\n isRegistered(element: Element): boolean;\n}\n\nexport const SingleTabStopNavigationProvider = forwardRef(\n (\n {\n navigationActive,\n children,\n getNextFocusTarget,\n isElementSuppressed,\n onRegisterFocusable,\n onUnregisterActive,\n }: SingleTabStopNavigationProviderProps,\n ref: React.Ref<SingleTabStopNavigationAPI>\n ) => {\n // A set of registered focusable elements that can use keyboard navigation.\n const focusables = useRef(new Set<Element>());\n // A map of registered focusable element handlers to update the respective tab indices.\n const focusHandlers = useRef(new Map<Element, FocusableChangeHandler>());\n // A map of focusable element states to avoid issuing unnecessary updates to registered elements.\n const focusablesState = useRef(new WeakMap<Element, boolean>());\n // A reference to the currently focused element.\n const focusTarget = useRef<null | HTMLElement>(null);\n\n function onUnregisterFocusable(focusableElement: Element) {\n const isUnregisteringFocusedNode = nodeBelongs(focusableElement, document.activeElement);\n if (isUnregisteringFocusedNode) {\n // Wait for unmounted node to get removed from the DOM.\n setTimeout(() => onUnregisterActive?.(focusableElement), 0);\n }\n }\n\n // Register a focusable element to allow navigating into it.\n // The focusable element tabIndex is only set to 0 if the element matches the focus target.\n function registerFocusable(focusableElement: HTMLElement, changeHandler: FocusableChangeHandler) {\n // In case the contexts are nested, we must that the components register to all of them,\n // so that switching between contexts dynamically is possible.\n const parentUnregister = parentContext.registerFocusable(focusableElement, changeHandler);\n\n focusables.current.add(focusableElement);\n focusHandlers.current.set(focusableElement, changeHandler);\n const isFocusable = !!focusablesState.current.get(focusableElement);\n const newIsFocusable = focusTarget.current === focusableElement || !!isElementSuppressed?.(focusableElement);\n if (newIsFocusable !== isFocusable) {\n focusablesState.current.set(focusableElement, newIsFocusable);\n changeHandler(newIsFocusable);\n }\n onRegisterFocusable?.(focusableElement);\n\n return () => {\n parentUnregister();\n unregisterFocusable(focusableElement);\n };\n }\n function unregisterFocusable(focusableElement: Element) {\n focusables.current.delete(focusableElement);\n focusHandlers.current.delete(focusableElement);\n onUnregisterFocusable?.(focusableElement);\n }\n\n // Update focus target with next single focusable element and notify all registered focusables of a change.\n function updateFocusTarget(forceUpdate = false) {\n focusTarget.current = getNextFocusTarget();\n for (const focusableElement of focusables.current) {\n const isFocusable = focusablesState.current.get(focusableElement) ?? false;\n const newIsFocusable = focusTarget.current === focusableElement || !!isElementSuppressed?.(focusableElement);\n if (newIsFocusable !== isFocusable || forceUpdate) {\n focusablesState.current.set(focusableElement, newIsFocusable);\n focusHandlers.current.get(focusableElement)!(newIsFocusable);\n }\n }\n }\n function resetFocusTarget() {\n updateFocusTarget(true);\n }\n function getFocusTarget() {\n return focusTarget.current;\n }\n function isRegistered(element: Element) {\n return focusables.current.has(element);\n }\n useImperativeHandle(ref, () => ({ updateFocusTarget, getFocusTarget, isRegistered }));\n\n // Only one STSN context should be active at a time.\n // The outer context is preferred over the inners. The components using STSN\n // must either work with either outer or inner context, or an explicit switch mechanism\n // needs to be implemented (that turns the outer context on and off based on user interaction).\n const parentContext = useContext(SingleTabStopNavigationContext);\n const value = parentContext.navigationActive\n ? parentContext\n : { navigationActive, registerFocusable, updateFocusTarget, resetFocusTarget };\n\n // When contexts switching occurs, it is essential that the now-active one updates the focus target\n // to ensure the tab indices are correctly set.\n useEffectOnUpdate(() => {\n if (parentContext.navigationActive) {\n parentContext.resetFocusTarget();\n } else {\n resetFocusTarget();\n }\n // The updateFocusTarget and its dependencies must be pure.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [parentContext.navigationActive]);\n\n return <SingleTabStopNavigationContext.Provider value={value}>{children}</SingleTabStopNavigationContext.Provider>;\n }\n);\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -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 (bcd2b51d)";
|
|
3
|
+
export var GIT_SHA = "bcd2b51d";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "console";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-virtual/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAmC,WAAW,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-virtual/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAmC,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAS1F,UAAU,eAAe,CAAC,IAAI;IAC5B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,UAAU,cAAc;IACtB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,EAC9C,KAAK,EACL,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,cAAc,CAsCxC"}
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
import { useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { useVirtual as useVirtualDefault } from '../../vendor/react-virtual';
|
|
5
5
|
import stickyRangeExtractor from './sticky-range-extractor';
|
|
6
|
-
|
|
6
|
+
// Maximum allowed synchronous (nested) item mounts before forcing a bail-out.
|
|
7
|
+
// Mirrors React’s internal safeguard for nested updates: React throws
|
|
8
|
+
// "Maximum update depth exceeded" once >50 sync updates occur within a single commit.
|
|
9
|
+
// See: https://github.com/facebook/react/commit/d8c90fa48d3addefe4b805ec56a3c65e4ee39127
|
|
10
|
+
const MAX_ITEM_MOUNTS = 50 - 1;
|
|
7
11
|
/**
|
|
8
12
|
* The useVirtual from react-virtual@2 might produce an infinite update loop caused by setting
|
|
9
13
|
* measured item sizes in the render cycle (as part of the measureRef assignment):
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-virtual/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAe,MAAM,4BAA4B,CAAC;AAC1F,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAE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,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,iCAC1C,WAAW,KACd,UAAU,EAAE,CAAC,IAAwB,EAAE,EAAE;;YACvC,MAAM,YAAY,GAAG,MAAA,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,mCAAI,CAAC,CAAC;YAC9E,IAAI,YAAY,GAAG,eAAe,EAAE;gBAClC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAC7B,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;aACvE;QACH,CAAC,IACD,CAAC,EACL,CAAC,KAAK,EAAE,cAAc,CAAC,YAAY,CAAC,CACrC,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,SAAS,EAAE,cAAc,CAAC,SAAS;QACnC,aAAa,EAAE,cAAc,CAAC,aAAa;KAC5C,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef } from 'react';\n\nimport { useVirtual as useVirtualDefault, VirtualItem } from '../../vendor/react-virtual';\nimport stickyRangeExtractor from './sticky-range-extractor';\n\n// Maximum allowed synchronous (nested) item mounts before forcing a bail-out.\n// Mirrors React’s internal safeguard for nested updates: React throws\n// \"Maximum update depth exceeded\" once >50 sync updates occur within a single commit.\n// See: https://github.com/facebook/react/commit/d8c90fa48d3addefe4b805ec56a3c65e4ee39127\nconst MAX_ITEM_MOUNTS = 50 - 1;\n\ninterface UseVirtualProps<Item> {\n items: readonly Item[];\n parentRef: React.RefObject<HTMLElement>;\n estimateSize: () => number;\n firstItemSticky?: boolean;\n}\n\ninterface RowVirtualizer {\n virtualItems: VirtualItem[];\n totalSize: number;\n scrollToIndex: (index: number) => void;\n}\n\n/**\n * The useVirtual from react-virtual@2 might produce an infinite update loop caused by setting\n * measured item sizes in the render cycle (as part of the measureRef assignment):\n * The sum of all measured item sizes is returned as totalSize which is then set on the list container.\n * Enforcing new container height might result in an items size change e.g. when the content wraps.\n *\n * The infinite update cycle causes React \"Maximum update depth exceeded\" error and can be additionally confirmed\n * by logging the totalSize which should then bounce between two values.\n *\n * The number of item refs assignments is limited to MAX_ITEM_MOUNTS unless items or indices change.\n * That is based on the assumption the item height stays constant after its first render.\n */\nexport function useVirtual<Item extends object>({\n items,\n parentRef,\n estimateSize,\n firstItemSticky,\n}: UseVirtualProps<Item>): RowVirtualizer {\n const rowVirtualizer = useVirtualDefault({\n size: items.length,\n parentRef,\n estimateSize,\n overscan: 5,\n rangeExtractor: firstItemSticky ? stickyRangeExtractor : undefined,\n });\n\n // Cache virtual item mounts to limit the amount of mounts per item.\n const measuresCache = useRef(new WeakMap<Item, number>());\n\n // Clear mounts cache every time indices, items, or size estimate change.\n const indicesKey = rowVirtualizer.virtualItems.map(item => `${item.index}`).join(':');\n useEffect(() => {\n measuresCache.current = new WeakMap();\n }, [indicesKey, items, estimateSize]);\n\n const virtualItems = useMemo(\n () =>\n rowVirtualizer.virtualItems.map(virtualItem => ({\n ...virtualItem,\n measureRef: (node: null | HTMLElement) => {\n const mountedCount = measuresCache.current.get(items[virtualItem.index]) ?? 0;\n if (mountedCount < MAX_ITEM_MOUNTS) {\n virtualItem.measureRef(node);\n measuresCache.current.set(items[virtualItem.index], mountedCount + 1);\n }\n },\n })),\n [items, rowVirtualizer.virtualItems]\n );\n\n return {\n virtualItems,\n totalSize: rowVirtualizer.totalSize,\n scrollToIndex: rowVirtualizer.scrollToIndex,\n };\n}\n"]}
|
package/internal/manifest.json
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats timezone offset values used in for APIs, maintaining backward compatibility. Always
|
|
3
|
+
* returns "+HH:MM" format, even for UTC ("+00:00"). Used by onChange events to preserve existing
|
|
4
|
+
* API behavior.
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatTimeOffsetISOInternal(isoDate: string, offsetInMinutes?: number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Formats timezone offset for display purposes using succinct UTC notation.
|
|
9
|
+
* Returns "Z" for UTC, "+HH:MM" for other offsets.
|
|
10
|
+
* Used for visual display in components like date-range-picker trigger text.
|
|
11
|
+
*/
|
|
1
12
|
export declare function formatTimeOffsetISO(isoDate: string, offsetInMinutes?: number): string;
|
|
2
13
|
export declare function formatTimeOffsetLocalized(isoDate: string, offsetInMinutes?: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-time-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-time-offset.ts"],"names":[],"mappings":"AAKA,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,UAW5E;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,UAYlF"}
|
|
1
|
+
{"version":3,"file":"format-time-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-time-offset.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,UAQpF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,UAW5E;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,UAYlF"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { padLeftZeros } from '../strings';
|
|
4
|
+
/**
|
|
5
|
+
* Formats timezone offset values used in for APIs, maintaining backward compatibility. Always
|
|
6
|
+
* returns "+HH:MM" format, even for UTC ("+00:00"). Used by onChange events to preserve existing
|
|
7
|
+
* API behavior.
|
|
8
|
+
*/
|
|
9
|
+
export function formatTimeOffsetISOInternal(isoDate, offsetInMinutes) {
|
|
10
|
+
offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);
|
|
11
|
+
const { hours, minutes } = getMinutesAndHours(offsetInMinutes);
|
|
12
|
+
const sign = offsetInMinutes < 0 ? '-' : '+';
|
|
13
|
+
const formattedOffset = `${sign}${formatISO2Digits(hours)}:${formatISO2Digits(minutes)}`;
|
|
14
|
+
return formattedOffset;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats timezone offset for display purposes using succinct UTC notation.
|
|
18
|
+
* Returns "Z" for UTC, "+HH:MM" for other offsets.
|
|
19
|
+
* Used for visual display in components like date-range-picker trigger text.
|
|
20
|
+
*/
|
|
4
21
|
export function formatTimeOffsetISO(isoDate, offsetInMinutes) {
|
|
5
22
|
offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);
|
|
6
23
|
if (offsetInMinutes === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-time-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-time-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,eAAwB;IAC3E,eAAe,GAAG,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC3D,IAAI,eAAe,KAAK,CAAC,EAAE;QACzB,OAAO,GAAG,CAAC;KACZ;IACD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;IAE/D,MAAM,IAAI,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC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AAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { padLeftZeros } from '../strings';\n\nexport function formatTimeOffsetISO(isoDate: string, offsetInMinutes?: number) {\n offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);\n if (offsetInMinutes === 0) {\n return 'Z';\n }\n const { hours, minutes } = getMinutesAndHours(offsetInMinutes);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedOffset = `${sign}${formatISO2Digits(hours)}:${formatISO2Digits(minutes)}`;\n\n return formattedOffset;\n}\n\nexport function formatTimeOffsetLocalized(isoDate: string, offsetInMinutes?: number) {\n offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);\n if (offsetInMinutes === 0) {\n return '(UTC)';\n }\n const { hours, minutes } = getMinutesAndHours(offsetInMinutes);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedMinutes = minutes === 0 ? '' : `:${minutes}`;\n const formattedOffset = `(UTC${sign}${hours}${formattedMinutes})`;\n\n return formattedOffset;\n}\n\nfunction defaultToLocal(isoDate: string, offsetInMinutes?: number) {\n return offsetInMinutes ?? 0 - new Date(isoDate).getTimezoneOffset();\n}\n\nfunction getMinutesAndHours(minutes: number) {\n return { hours: Math.floor(Math.abs(minutes) / 60), minutes: Math.abs(minutes % 60) };\n}\n\nfunction formatISO2Digits(n: number) {\n return padLeftZeros(n.toFixed(0), 2);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"format-time-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-time-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAe,EAAE,eAAwB;IACnF,eAAe,GAAG,cAAc,CAAC,OAA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C;IAC7C,MAAM,gBAAgB,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;IAC5D,MAAM,eAAe,GAAG,OAAO,IAAI,GAAG,KAAK,GAAG,gBAAgB,GAAG,CAAC;IAElE,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,eAAwB;IAC/D,OAAO,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAe;IACzC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC;AACxF,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAS;IACjC,OAAO,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { padLeftZeros } from '../strings';\n\n/**\n * Formats timezone offset values used in for APIs, maintaining backward compatibility. Always\n * returns \"+HH:MM\" format, even for UTC (\"+00:00\"). Used by onChange events to preserve existing\n * API behavior.\n */\nexport function formatTimeOffsetISOInternal(isoDate: string, offsetInMinutes?: number) {\n offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);\n const { hours, minutes } = getMinutesAndHours(offsetInMinutes);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedOffset = `${sign}${formatISO2Digits(hours)}:${formatISO2Digits(minutes)}`;\n\n return formattedOffset;\n}\n\n/**\n * Formats timezone offset for display purposes using succinct UTC notation.\n * Returns \"Z\" for UTC, \"+HH:MM\" for other offsets.\n * Used for visual display in components like date-range-picker trigger text.\n */\nexport function formatTimeOffsetISO(isoDate: string, offsetInMinutes?: number) {\n offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);\n if (offsetInMinutes === 0) {\n return 'Z';\n }\n const { hours, minutes } = getMinutesAndHours(offsetInMinutes);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedOffset = `${sign}${formatISO2Digits(hours)}:${formatISO2Digits(minutes)}`;\n\n return formattedOffset;\n}\n\nexport function formatTimeOffsetLocalized(isoDate: string, offsetInMinutes?: number) {\n offsetInMinutes = defaultToLocal(isoDate, offsetInMinutes);\n if (offsetInMinutes === 0) {\n return '(UTC)';\n }\n const { hours, minutes } = getMinutesAndHours(offsetInMinutes);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedMinutes = minutes === 0 ? '' : `:${minutes}`;\n const formattedOffset = `(UTC${sign}${hours}${formattedMinutes})`;\n\n return formattedOffset;\n}\n\nfunction defaultToLocal(isoDate: string, offsetInMinutes?: number) {\n return offsetInMinutes ?? 0 - new Date(isoDate).getTimezoneOffset();\n}\n\nfunction getMinutesAndHours(minutes: number) {\n return { hours: Math.floor(Math.abs(minutes) / 60), minutes: Math.abs(minutes % 60) };\n}\n\nfunction formatISO2Digits(n: number) {\n return padLeftZeros(n.toFixed(0), 2);\n}\n"]}
|
|
@@ -3,7 +3,7 @@ export { formatDateTimeWithOffset } from './format-date-time-with-offset';
|
|
|
3
3
|
export { formatDate } from './format-date';
|
|
4
4
|
export { formatTime } from './format-time';
|
|
5
5
|
export { formatDateTime } from './format-date-time';
|
|
6
|
-
export { formatTimeOffsetISO } from './format-time-offset';
|
|
6
|
+
export { formatTimeOffsetISO, formatTimeOffsetISOInternal } from './format-time-offset';
|
|
7
7
|
export { isIsoDateOnly, isIsoMonthOnly } from './is-iso-only';
|
|
8
8
|
export { joinDateTime, splitDateTime } from './join-date-time';
|
|
9
9
|
export { parseDate } from './parse-date';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -5,7 +5,7 @@ export { formatDateTimeWithOffset } from './format-date-time-with-offset';
|
|
|
5
5
|
export { formatDate } from './format-date';
|
|
6
6
|
export { formatTime } from './format-time';
|
|
7
7
|
export { formatDateTime } from './format-date-time';
|
|
8
|
-
export { formatTimeOffsetISO } from './format-time-offset';
|
|
8
|
+
export { formatTimeOffsetISO, formatTimeOffsetISOInternal } from './format-time-offset';
|
|
9
9
|
export { isIsoDateOnly, isIsoMonthOnly } from './is-iso-only';
|
|
10
10
|
export { joinDateTime, splitDateTime } from './join-date-time';
|
|
11
11
|
export { parseDate } from './parse-date';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { isoToDisplay, displayToIso } from './display-format';\nexport { formatDateTimeWithOffset } from './format-date-time-with-offset';\nexport { formatDate } from './format-date';\nexport { formatTime } from './format-time';\nexport { formatDateTime } from './format-date-time';\nexport { formatTimeOffsetISO, formatTimeOffsetISOInternal } from './format-time-offset';\nexport { isIsoDateOnly, isIsoMonthOnly } from './is-iso-only';\nexport { joinDateTime, splitDateTime } from './join-date-time';\nexport { parseDate } from './parse-date';\nexport { parseTimezoneOffset } from './parse-timezone-offset';\nexport { shiftTimezoneOffset } from './shift-timezone-offset';\n"]}
|
package/link/interfaces.d.ts
CHANGED
|
@@ -87,12 +87,6 @@ export interface LinkProps extends BaseComponentProps {
|
|
|
87
87
|
*/
|
|
88
88
|
rel?: string;
|
|
89
89
|
/**
|
|
90
|
-
* Specifies an object of selectors and properties that are used to apply custom styles.
|
|
91
|
-
*
|
|
92
|
-
* - `root.color` {active, default, hover} (string) - (Optional) Text color for link.
|
|
93
|
-
* - `root.focusRing.borderColor` (string) - (Optional) Focus ring border color.
|
|
94
|
-
* - `root.focusRing.borderRadius` (string) - (Optional) Focus ring border radius.
|
|
95
|
-
* - `root.focusRing.borderWidth` (string) - (Optional) Focus ring border width.
|
|
96
90
|
* @awsuiSystem core
|
|
97
91
|
*/
|
|
98
92
|
}
|