@cloudscape-design/components 3.0.27 → 3.0.30
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/internal.d.ts.map +1 -1
- package/alert/internal.js +3 -4
- package/alert/internal.js.map +1 -1
- package/app-layout/index.js +1 -1
- package/app-layout/index.js.map +1 -1
- package/app-layout/visual-refresh/styles.css.js +59 -59
- package/app-layout/visual-refresh/styles.scoped.css +146 -146
- package/app-layout/visual-refresh/styles.selectors.js +59 -59
- package/autosuggest/controller.d.ts +1 -4
- package/autosuggest/controller.d.ts.map +1 -1
- package/autosuggest/controller.js +1 -45
- package/autosuggest/controller.js.map +1 -1
- package/autosuggest/internal.d.ts.map +1 -1
- package/autosuggest/internal.js +16 -23
- package/autosuggest/internal.js.map +1 -1
- package/autosuggest/options-controller.d.ts +22 -0
- package/autosuggest/options-controller.d.ts.map +1 -0
- package/autosuggest/options-controller.js +63 -0
- package/autosuggest/options-controller.js.map +1 -0
- package/autosuggest/options-list.d.ts.map +1 -1
- package/autosuggest/options-list.js +2 -1
- package/autosuggest/options-list.js.map +1 -1
- package/breadcrumb-group/internal.d.ts.map +1 -1
- package/breadcrumb-group/internal.js +4 -4
- package/breadcrumb-group/internal.js.map +1 -1
- package/button-dropdown/category-elements/category-element.d.ts +1 -1
- package/button-dropdown/category-elements/category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/category-element.js +2 -2
- package/button-dropdown/category-elements/category-element.js.map +1 -1
- package/button-dropdown/category-elements/expandable-category-element.d.ts +1 -1
- package/button-dropdown/category-elements/expandable-category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/expandable-category-element.js +4 -2
- package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.d.ts +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.js +4 -2
- package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
- package/button-dropdown/category-elements/styles.css.js +13 -12
- package/button-dropdown/category-elements/styles.scoped.css +26 -22
- package/button-dropdown/category-elements/styles.selectors.js +13 -12
- package/button-dropdown/interfaces.d.ts +3 -1
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +6 -11
- package/button-dropdown/internal.js.map +1 -1
- package/button-dropdown/item-element/index.d.ts +1 -1
- package/button-dropdown/item-element/index.d.ts.map +1 -1
- package/button-dropdown/item-element/index.js +2 -1
- package/button-dropdown/item-element/index.js.map +1 -1
- package/button-dropdown/item-element/styles.css.js +14 -13
- package/button-dropdown/item-element/styles.scoped.css +21 -17
- package/button-dropdown/item-element/styles.selectors.js +14 -13
- package/button-dropdown/items-list.d.ts +1 -1
- package/button-dropdown/items-list.d.ts.map +1 -1
- package/button-dropdown/items-list.js +4 -4
- package/button-dropdown/items-list.js.map +1 -1
- package/button-dropdown/utils/use-button-dropdown.d.ts +2 -2
- package/button-dropdown/utils/use-button-dropdown.d.ts.map +1 -1
- package/button-dropdown/utils/use-button-dropdown.js +7 -5
- package/button-dropdown/utils/use-button-dropdown.js.map +1 -1
- package/button-dropdown/utils/use-highlighted-menu.d.ts +1 -0
- package/button-dropdown/utils/use-highlighted-menu.d.ts.map +1 -1
- package/button-dropdown/utils/use-highlighted-menu.js +11 -3
- package/button-dropdown/utils/use-highlighted-menu.js.map +1 -1
- package/cards/index.js +1 -1
- package/cards/index.js.map +1 -1
- package/checkbox/styles.css.js +3 -3
- package/checkbox/styles.scoped.css +6 -6
- package/checkbox/styles.selectors.js +3 -3
- package/code-editor/index.d.ts.map +1 -1
- package/code-editor/index.js +2 -3
- package/code-editor/index.js.map +1 -1
- package/container/internal.js +1 -1
- package/container/internal.js.map +1 -1
- package/container/use-sticky-header.js +1 -1
- package/container/use-sticky-header.js.map +1 -1
- package/date-picker/calendar/index.d.ts.map +1 -1
- package/date-picker/calendar/index.js +2 -1
- package/date-picker/calendar/index.js.map +1 -1
- package/date-picker/calendar/utils/memoized-date.d.ts +2 -0
- package/date-picker/calendar/utils/memoized-date.d.ts.map +1 -0
- package/date-picker/calendar/utils/memoized-date.js +13 -0
- package/date-picker/calendar/utils/memoized-date.js.map +1 -0
- package/date-picker/embedded.js +1 -1
- package/date-picker/embedded.js.map +1 -1
- package/date-picker/index.js +1 -1
- package/date-picker/index.js.map +1 -1
- package/date-picker/use-date-picker.d.ts.map +1 -1
- package/date-picker/use-date-picker.js +1 -1
- package/date-picker/use-date-picker.js.map +1 -1
- package/date-range-picker/calendar/grids/day/index.js +1 -1
- package/date-range-picker/calendar/grids/day/index.js.map +1 -1
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +3 -3
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/dropdown.d.ts +1 -0
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +18 -30
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/embedded.d.ts +7 -0
- package/date-range-picker/embedded.d.ts.map +1 -0
- package/date-range-picker/embedded.js +46 -0
- package/date-range-picker/embedded.js.map +1 -0
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +5 -18
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +46 -44
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/date-range-picker/time-offset.d.ts +0 -7
- package/date-range-picker/time-offset.d.ts.map +1 -1
- package/date-range-picker/time-offset.js +4 -60
- package/date-range-picker/time-offset.js.map +1 -1
- package/date-range-picker/use-date-range-picker.d.ts +29 -0
- package/date-range-picker/use-date-range-picker.d.ts.map +1 -0
- package/date-range-picker/use-date-range-picker.js +58 -0
- package/date-range-picker/use-date-range-picker.js.map +1 -0
- package/flashbar/index.js +1 -1
- package/flashbar/index.js.map +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +3 -6
- package/form-field/internal.js.map +1 -1
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +3 -6
- package/header/internal.js.map +1 -1
- package/icon/icons.js +1 -1
- package/icon/interfaces.d.ts +1 -1
- package/icon/interfaces.d.ts.map +1 -1
- package/icon/interfaces.js.map +1 -1
- package/icon/internal.js +1 -1
- package/icon/internal.js.map +1 -1
- package/input/styles.css.js +13 -13
- package/input/styles.scoped.css +35 -37
- package/input/styles.selectors.js +13 -13
- package/internal/components/abstract-switch/index.d.ts.map +1 -1
- package/internal/components/abstract-switch/index.js +5 -5
- package/internal/components/abstract-switch/index.js.map +1 -1
- package/internal/components/abstract-switch/styles.css.js +11 -11
- package/internal/components/abstract-switch/styles.scoped.css +20 -13
- package/internal/components/abstract-switch/styles.selectors.js +11 -11
- package/internal/components/checkbox-icon/index.d.ts.map +1 -1
- package/internal/components/checkbox-icon/index.js +3 -4
- package/internal/components/checkbox-icon/index.js.map +1 -1
- package/internal/components/content-layout/index.d.ts.map +1 -1
- package/internal/components/content-layout/index.js +3 -4
- package/internal/components/content-layout/index.js.map +1 -1
- package/internal/components/date-input/index.d.ts.map +1 -1
- package/internal/components/date-input/index.js +3 -2
- package/internal/components/date-input/index.js.map +1 -1
- package/internal/components/dropdown/index.js +1 -1
- package/internal/components/dropdown/index.js.map +1 -1
- package/internal/components/masked-input/utils/mask-format.d.ts.map +1 -1
- package/internal/components/masked-input/utils/mask-format.js +2 -1
- package/internal/components/masked-input/utils/mask-format.js.map +1 -1
- package/internal/components/masked-input/utils/strings.d.ts +0 -1
- package/internal/components/masked-input/utils/strings.d.ts.map +1 -1
- package/internal/components/masked-input/utils/strings.js +0 -6
- package/internal/components/masked-input/utils/strings.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/hooks/use-mutation-observer/index.d.ts +5 -0
- package/internal/hooks/use-mutation-observer/index.d.ts.map +1 -1
- package/internal/hooks/use-mutation-observer/index.js +5 -0
- package/internal/hooks/use-mutation-observer/index.js.map +1 -1
- package/internal/hooks/use-portal-mode-classes/index.js +1 -1
- package/internal/hooks/use-portal-mode-classes/index.js.map +1 -1
- package/internal/hooks/use-singleton-handler/index.d.ts +2 -1
- package/internal/hooks/use-singleton-handler/index.d.ts.map +1 -1
- package/internal/hooks/use-singleton-handler/index.js.map +1 -1
- package/internal/hooks/use-visual-mode/index.d.ts +1 -1
- package/internal/hooks/use-visual-mode/index.d.ts.map +1 -1
- package/internal/hooks/use-visual-mode/index.js +16 -11
- package/internal/hooks/use-visual-mode/index.js.map +1 -1
- package/internal/utils/date-time/display-format.d.ts +9 -0
- package/internal/utils/date-time/display-format.d.ts.map +1 -0
- package/internal/utils/date-time/display-format.js +15 -0
- package/internal/utils/date-time/display-format.js.map +1 -0
- package/internal/utils/date-time/format-date.d.ts +7 -0
- package/internal/utils/date-time/format-date.d.ts.map +1 -0
- package/internal/utils/date-time/format-date.js +15 -0
- package/internal/utils/date-time/format-date.js.map +1 -0
- package/internal/utils/date-time/format-time.d.ts +5 -0
- package/internal/utils/date-time/format-time.d.ts.map +1 -0
- package/internal/utils/date-time/format-time.js +13 -0
- package/internal/utils/date-time/format-time.js.map +1 -0
- package/internal/utils/date-time/format-timezone-offset.d.ts +2 -0
- package/internal/utils/date-time/format-timezone-offset.d.ts.map +1 -0
- package/internal/utils/date-time/format-timezone-offset.js +11 -0
- package/internal/utils/date-time/format-timezone-offset.js.map +1 -0
- package/internal/utils/date-time/get-browser-timezone-offset.d.ts +7 -0
- package/internal/utils/date-time/get-browser-timezone-offset.d.ts.map +1 -0
- package/internal/utils/date-time/get-browser-timezone-offset.js +11 -0
- package/internal/utils/date-time/get-browser-timezone-offset.js.map +1 -0
- package/internal/utils/date-time/index.d.ts +11 -0
- package/internal/utils/date-time/index.d.ts.map +1 -0
- package/internal/utils/date-time/index.js +13 -0
- package/internal/utils/date-time/index.js.map +1 -0
- package/internal/utils/date-time/is-iso-date-only.d.ts +5 -0
- package/internal/utils/date-time/is-iso-date-only.d.ts.map +1 -0
- package/internal/utils/date-time/is-iso-date-only.js +10 -0
- package/internal/utils/date-time/is-iso-date-only.js.map +1 -0
- package/internal/utils/date-time/join-date-time.d.ts +2 -0
- package/internal/utils/date-time/join-date-time.d.ts.map +1 -0
- package/internal/utils/date-time/join-date-time.js +6 -0
- package/internal/utils/date-time/join-date-time.js.map +1 -0
- package/internal/utils/date-time/parse-date.d.ts +8 -0
- package/internal/utils/date-time/parse-date.d.ts.map +1 -0
- package/internal/utils/date-time/parse-date.js +16 -0
- package/internal/utils/date-time/parse-date.js.map +1 -0
- package/internal/utils/date-time/parse-timezone-offset.d.ts +5 -0
- package/internal/utils/date-time/parse-timezone-offset.d.ts.map +1 -0
- package/internal/utils/date-time/parse-timezone-offset.js +20 -0
- package/internal/utils/date-time/parse-timezone-offset.js.map +1 -0
- package/internal/utils/date-time/shift-timezone-offset.d.ts +12 -0
- package/internal/utils/date-time/shift-timezone-offset.d.ts.map +1 -0
- package/internal/utils/date-time/shift-timezone-offset.js +27 -0
- package/internal/utils/date-time/shift-timezone-offset.js.map +1 -0
- package/internal/utils/strings/index.d.ts +3 -0
- package/internal/utils/strings/index.d.ts.map +1 -0
- package/internal/utils/strings/index.js +5 -0
- package/internal/utils/strings/index.js.map +1 -0
- package/internal/utils/strings/join-strings.d.ts +5 -0
- package/internal/utils/strings/join-strings.d.ts.map +1 -0
- package/internal/utils/{strings.js → strings/join-strings.js} +7 -6
- package/internal/utils/strings/join-strings.js.map +1 -0
- package/internal/utils/strings/pad-left-zeros.d.ts +5 -0
- package/internal/utils/strings/pad-left-zeros.d.ts.map +1 -0
- package/internal/utils/strings/pad-left-zeros.js +12 -0
- package/internal/utils/strings/pad-left-zeros.js.map +1 -0
- package/link/internal.js +3 -3
- package/link/internal.js.map +1 -1
- package/link/styles.css.js +19 -18
- package/link/styles.scoped.css +73 -69
- package/link/styles.selectors.js +19 -18
- package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-series.js +3 -4
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +1 -1
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/mixed-line-bar-chart/interfaces.d.ts +5 -4
- package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
- package/mixed-line-bar-chart/interfaces.js.map +1 -1
- package/modal/internal.js +1 -1
- package/modal/internal.js.map +1 -1
- package/package.json +1 -1
- package/pie-chart/pie-chart.d.ts.map +1 -1
- package/pie-chart/pie-chart.js +2 -2
- package/pie-chart/pie-chart.js.map +1 -1
- package/pie-chart/segments.d.ts +1 -2
- package/pie-chart/segments.d.ts.map +1 -1
- package/pie-chart/segments.js +2 -2
- package/pie-chart/segments.js.map +1 -1
- package/popover/container.js +1 -1
- package/popover/container.js.map +1 -1
- package/popover/styles.css.js +48 -48
- package/popover/styles.scoped.css +65 -60
- package/popover/styles.selectors.js +48 -48
- package/property-filter/index.d.ts.map +1 -1
- package/property-filter/index.js +10 -2
- package/property-filter/index.js.map +1 -1
- package/radio-group/radio-button.d.ts.map +1 -1
- package/radio-group/radio-button.js +3 -4
- package/radio-group/radio-button.js.map +1 -1
- package/radio-group/styles.css.js +9 -9
- package/radio-group/styles.scoped.css +16 -16
- package/radio-group/styles.selectors.js +9 -9
- package/s3-resource-selector/s3-modal/index.d.ts.map +1 -1
- package/s3-resource-selector/s3-modal/index.js +2 -3
- package/s3-resource-selector/s3-modal/index.js.map +1 -1
- package/split-panel/index.d.ts.map +1 -1
- package/split-panel/index.js +2 -2
- package/split-panel/index.js.map +1 -1
- package/table/internal.js +1 -1
- package/table/internal.js.map +1 -1
- package/table/sticky-scrollbar.js +1 -1
- package/table/sticky-scrollbar.js.map +1 -1
- package/table/styles.css.js +32 -32
- package/table/styles.scoped.css +40 -43
- package/table/styles.selectors.js +32 -32
- package/tabs/styles.css.js +21 -21
- package/tabs/styles.scoped.css +40 -43
- package/tabs/styles.selectors.js +21 -21
- package/tabs/tab-header-bar.js +1 -1
- package/tabs/tab-header-bar.js.map +1 -1
- package/textarea/styles.css.js +4 -4
- package/textarea/styles.scoped.css +13 -14
- package/textarea/styles.selectors.js +4 -4
- package/toggle/internal.d.ts.map +1 -1
- package/toggle/internal.js +3 -1
- package/toggle/internal.js.map +1 -1
- package/toggle/styles.css.js +8 -8
- package/toggle/styles.scoped.css +15 -14
- package/toggle/styles.selectors.js +8 -8
- package/tutorial-panel/components/tutorial-detail-view/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-detail-view/index.js +3 -4
- package/tutorial-panel/components/tutorial-detail-view/index.js.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
- package/tutorial-panel/components/tutorial-list/index.js +5 -7
- package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
- package/wizard/index.d.ts.map +1 -1
- package/wizard/index.js +2 -3
- package/wizard/index.js.map +1 -1
- package/date-picker/calendar/utils/date.d.ts +0 -10
- package/date-picker/calendar/utils/date.d.ts.map +0 -1
- package/date-picker/calendar/utils/date.js +0 -50
- package/date-picker/calendar/utils/date.js.map +0 -1
- package/internal/components/date-input/utils/date.d.ts +0 -5
- package/internal/components/date-input/utils/date.d.ts.map +0 -1
- package/internal/components/date-input/utils/date.js +0 -11
- package/internal/components/date-input/utils/date.js.map +0 -1
- package/internal/utils/strings.d.ts +0 -2
- package/internal/utils/strings.d.ts.map +0 -1
- package/internal/utils/strings.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { padLeftZeros } from '../strings';
|
|
4
|
+
export function formatTimezoneOffset(offsetInMinutes) {
|
|
5
|
+
var hoursOffset = padLeftZeros(Math.floor(Math.abs(offsetInMinutes) / 60).toFixed(0), 2);
|
|
6
|
+
var minuteOffset = padLeftZeros(Math.abs(offsetInMinutes % 60).toFixed(0), 2);
|
|
7
|
+
var sign = offsetInMinutes < 0 ? '-' : '+';
|
|
8
|
+
var formattedOffset = "".concat(sign).concat(hoursOffset, ":").concat(minuteOffset);
|
|
9
|
+
return formattedOffset;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=format-timezone-offset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/format-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,UAAU,oBAAoB,CAAC,eAAuB;IAC1D,IAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3F,IAAM,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEhF,IAAM,IAAI,GAAG,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC7C,IAAM,eAAe,GAAG,UAAG,IAAI,SAAG,WAAW,cAAI,YAAY,CAAE,CAAC;IAEhE,OAAO,eAAe,CAAC;AACzB,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 formatTimezoneOffset(offsetInMinutes: number) {\n const hoursOffset = padLeftZeros(Math.floor(Math.abs(offsetInMinutes) / 60).toFixed(0), 2);\n const minuteOffset = padLeftZeros(Math.abs(offsetInMinutes % 60).toFixed(0), 2);\n\n const sign = offsetInMinutes < 0 ? '-' : '+';\n const formattedOffset = `${sign}${hoursOffset}:${minuteOffset}`;\n\n return formattedOffset;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-browser-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/get-browser-timezone-offset.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,wBAAwB,WAEvC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Returns the time offset of the browser.
|
|
5
|
+
*
|
|
6
|
+
* I.e. determines the `x` in `current offset = UTC + x`
|
|
7
|
+
*/
|
|
8
|
+
export function getBrowserTimezoneOffset() {
|
|
9
|
+
return 0 - new Date().getTimezoneOffset();
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=get-browser-timezone-offset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-browser-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/get-browser-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,iBAAiB,EAAE,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Returns the time offset of the browser.\n *\n * I.e. determines the `x` in `current offset = UTC + x`\n */\nexport function getBrowserTimezoneOffset() {\n return 0 - new Date().getTimezoneOffset();\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { isoToDisplay, displayToIso } from './display-format';
|
|
2
|
+
export { formatDate } from './format-date';
|
|
3
|
+
export { formatTime } from './format-time';
|
|
4
|
+
export { formatTimezoneOffset } from './format-timezone-offset';
|
|
5
|
+
export { getBrowserTimezoneOffset } from './get-browser-timezone-offset';
|
|
6
|
+
export { isIsoDateOnly } from './is-iso-date-only';
|
|
7
|
+
export { joinDateTime } from './join-date-time';
|
|
8
|
+
export { parseDate } from './parse-date';
|
|
9
|
+
export { parseTimezoneOffset } from './parse-timezone-offset';
|
|
10
|
+
export { shiftTimezoneOffset } from './shift-timezone-offset';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { isoToDisplay, displayToIso } from './display-format';
|
|
4
|
+
export { formatDate } from './format-date';
|
|
5
|
+
export { formatTime } from './format-time';
|
|
6
|
+
export { formatTimezoneOffset } from './format-timezone-offset';
|
|
7
|
+
export { getBrowserTimezoneOffset } from './get-browser-timezone-offset';
|
|
8
|
+
export { isIsoDateOnly } from './is-iso-date-only';
|
|
9
|
+
export { joinDateTime } from './join-date-time';
|
|
10
|
+
export { parseDate } from './parse-date';
|
|
11
|
+
export { parseTimezoneOffset } from './parse-timezone-offset';
|
|
12
|
+
export { shiftTimezoneOffset } from './shift-timezone-offset';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,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 { formatDate } from './format-date';\nexport { formatTime } from './format-time';\nexport { formatTimezoneOffset } from './format-timezone-offset';\nexport { getBrowserTimezoneOffset } from './get-browser-timezone-offset';\nexport { isIsoDateOnly } from './is-iso-date-only';\nexport { joinDateTime } from './join-date-time';\nexport { parseDate } from './parse-date';\nexport { parseTimezoneOffset } from './parse-timezone-offset';\nexport { shiftTimezoneOffset } from './shift-timezone-offset';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-iso-date-only.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/is-iso-date-only.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,WAE/C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var dateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if ISO date-string is date-only.
|
|
6
|
+
*/
|
|
7
|
+
export function isIsoDateOnly(dateString) {
|
|
8
|
+
return dateRegex.test(dateString);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=is-iso-date-only.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-iso-date-only.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/is-iso-date-only.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,IAAM,SAAS,GAAG,qBAAqB,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,OAAO,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nconst dateRegex = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * Checks if ISO date-string is date-only.\n */\nexport function isIsoDateOnly(dateString: string) {\n return dateRegex.test(dateString);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-date-time.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/join-date-time.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAElE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export function joinDateTime(dateString, timeString) {
|
|
4
|
+
return "".concat(dateString, "T").concat(timeString);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=join-date-time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-date-time.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/join-date-time.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,UAAkB;IACjE,OAAO,UAAG,UAAU,cAAI,UAAU,CAAE,CAAC;AACvC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function joinDateTime(dateString: string, timeString: string) {\n return `${dateString}T${timeString}`;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses date string and returns Date object or null.
|
|
3
|
+
*
|
|
4
|
+
* We cannot use new Date(string) constructor, because it produces GMT time that may have different date than the local.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseDate(value: string): Date;
|
|
7
|
+
export declare function parseDate(value: string, strict: boolean): Date | null;
|
|
8
|
+
//# sourceMappingURL=parse-date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-date.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-date.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;AAC/C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export function parseDate(value, strict) {
|
|
4
|
+
if (strict === void 0) { strict = false; }
|
|
5
|
+
var _a = value.split('-'), yearString = _a[0], monthString = _a[1], dayString = _a[2];
|
|
6
|
+
var year = Number(yearString);
|
|
7
|
+
var month = Number(monthString);
|
|
8
|
+
var day = Number(dayString);
|
|
9
|
+
if (strict) {
|
|
10
|
+
if (isNaN(year) || isNaN(month) || isNaN(day)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return new Date(year, (month || 1) - 1, day || 1);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=parse-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-date.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-date.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAStC,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,MAAc;IAAd,uBAAA,EAAA,cAAc;IAC/C,IAAA,KAAuC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAtD,UAAU,QAAA,EAAE,WAAW,QAAA,EAAE,SAAS,QAAoB,CAAC;IAE9D,IAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAChC,IAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAClC,IAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAE9B,IAAI,MAAM,EAAE;QACV,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE;YAC7C,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Parses date string and returns Date object or null.\n *\n * We cannot use new Date(string) constructor, because it produces GMT time that may have different date than the local.\n */\nexport function parseDate(value: string): Date;\nexport function parseDate(value: string, strict: boolean): Date | null;\nexport function parseDate(value: string, strict = false): Date | null {\n const [yearString, monthString, dayString] = value.split('-');\n\n const year = Number(yearString);\n const month = Number(monthString);\n const day = Number(dayString);\n\n if (strict) {\n if (isNaN(year) || isNaN(month) || isNaN(day)) {\n return null;\n }\n }\n\n return new Date(year, (month || 1) - 1, day || 1);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-timezone-offset.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAexD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { getBrowserTimezoneOffset } from './get-browser-timezone-offset';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts timezone offset from ISO8601 date string.
|
|
6
|
+
*/
|
|
7
|
+
export function parseTimezoneOffset(date) {
|
|
8
|
+
var _a = date.split('T'), time = _a[1];
|
|
9
|
+
var _b = time.split(/(-|\+)/), signCharacter = _b[1], offsetPart = _b[2];
|
|
10
|
+
if (signCharacter && offsetPart) {
|
|
11
|
+
var _c = offsetPart.split(':'), offsetHours = _c[0], offsetMinutes = _c[1];
|
|
12
|
+
return Number(signCharacter + '1') * (Number(offsetHours) * 60 + Number(offsetMinutes));
|
|
13
|
+
}
|
|
14
|
+
var utcTimezoneIndicator = date.indexOf('Z');
|
|
15
|
+
if (utcTimezoneIndicator !== -1) {
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
return getBrowserTimezoneOffset();
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=parse-timezone-offset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/parse-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IACxC,IAAA,KAAW,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAvB,IAAI,QAAmB,CAAC;IAC3B,IAAA,KAAgC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAjD,aAAa,QAAA,EAAE,UAAU,QAAwB,CAAC;IAE3D,IAAI,aAAa,IAAI,UAAU,EAAE;QACzB,IAAA,KAA+B,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAAnD,WAAW,QAAA,EAAE,aAAa,QAAyB,CAAC;QAC3D,OAAO,MAAM,CAAC,aAAa,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;KACzF;IAED,IAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,oBAAoB,KAAK,CAAC,CAAC,EAAE;QAC/B,OAAO,CAAC,CAAC;KACV;IAED,OAAO,wBAAwB,EAAE,CAAC;AACpC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getBrowserTimezoneOffset } from './get-browser-timezone-offset';\n\n/**\n * Extracts timezone offset from ISO8601 date string.\n */\nexport function parseTimezoneOffset(date: string): number {\n const [, time] = date.split('T');\n const [, signCharacter, offsetPart] = time.split(/(-|\\+)/);\n\n if (signCharacter && offsetPart) {\n const [offsetHours, offsetMinutes] = offsetPart.split(':');\n return Number(signCharacter + '1') * (Number(offsetHours) * 60 + Number(offsetMinutes));\n }\n\n const utcTimezoneIndicator = date.indexOf('Z');\n if (utcTimezoneIndicator !== -1) {\n return 0;\n }\n\n return getBrowserTimezoneOffset();\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-formats an ISO8601 date string so that it is expressed using the
|
|
3
|
+
* target timezone offset. The returned date string still represents the
|
|
4
|
+
* same instant in time, but contains no visible offset.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* ```
|
|
8
|
+
* shiftTimezoneOffset("2020-01-01T09:00:00+03:00", 2 * 60) === "2020-01-01T08:00:00"
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function shiftTimezoneOffset(dateString: string, targetTimezoneOffset: number): string;
|
|
12
|
+
//# sourceMappingURL=shift-timezone-offset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shift-timezone-offset.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/shift-timezone-offset.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAUnF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { addMinutes } from 'date-fns';
|
|
4
|
+
import { joinDateTime } from '.';
|
|
5
|
+
import { formatDate } from './format-date';
|
|
6
|
+
import { formatTime } from './format-time';
|
|
7
|
+
import { parseTimezoneOffset } from './parse-timezone-offset';
|
|
8
|
+
/**
|
|
9
|
+
* Re-formats an ISO8601 date string so that it is expressed using the
|
|
10
|
+
* target timezone offset. The returned date string still represents the
|
|
11
|
+
* same instant in time, but contains no visible offset.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* ```
|
|
15
|
+
* shiftTimezoneOffset("2020-01-01T09:00:00+03:00", 2 * 60) === "2020-01-01T08:00:00"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function shiftTimezoneOffset(dateString, targetTimezoneOffset) {
|
|
19
|
+
var _a = dateString.split('T'), datePart = _a[0], timeAndOffsetPart = _a[1];
|
|
20
|
+
var timePart = timeAndOffsetPart.split(/-|\+|Z/)[0];
|
|
21
|
+
var valueWithoutOffset = joinDateTime(datePart, timePart);
|
|
22
|
+
var originalTimezoneOffset = parseTimezoneOffset(dateString);
|
|
23
|
+
var date = new Date(valueWithoutOffset);
|
|
24
|
+
var adjustedDate = addMinutes(date, targetTimezoneOffset - originalTimezoneOffset);
|
|
25
|
+
return joinDateTime(formatDate(adjustedDate), formatTime(adjustedDate));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=shift-timezone-offset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shift-timezone-offset.js","sourceRoot":"","sources":["../../../../../src/internal/utils/date-time/shift-timezone-offset.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,oBAA4B;IAC5E,IAAA,KAAgC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,EAApD,QAAQ,QAAA,EAAE,iBAAiB,QAAyB,CAAC;IACrD,IAAA,QAAQ,GAAI,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAArC,CAAsC;IACrD,IAAM,kBAAkB,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5D,IAAM,sBAAsB,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAE/D,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1C,IAAM,YAAY,GAAG,UAAU,CAAC,IAAI,EAAE,oBAAoB,GAAG,sBAAsB,CAAC,CAAC;IAErF,OAAO,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { addMinutes } from 'date-fns';\nimport { joinDateTime } from '.';\nimport { formatDate } from './format-date';\nimport { formatTime } from './format-time';\nimport { parseTimezoneOffset } from './parse-timezone-offset';\n\n/**\n * Re-formats an ISO8601 date string so that it is expressed using the\n * target timezone offset. The returned date string still represents the\n * same instant in time, but contains no visible offset.\n *\n * Example:\n * ```\n * shiftTimezoneOffset(\"2020-01-01T09:00:00+03:00\", 2 * 60) === \"2020-01-01T08:00:00\"\n * ```\n */\nexport function shiftTimezoneOffset(dateString: string, targetTimezoneOffset: number) {\n const [datePart, timeAndOffsetPart] = dateString.split('T');\n const [timePart] = timeAndOffsetPart.split(/-|\\+|Z/);\n const valueWithoutOffset = joinDateTime(datePart, timePart);\n const originalTimezoneOffset = parseTimezoneOffset(dateString);\n\n const date = new Date(valueWithoutOffset);\n const adjustedDate = addMinutes(date, targetTimezoneOffset - originalTimezoneOffset);\n\n return joinDateTime(formatDate(adjustedDate), formatTime(adjustedDate));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/strings/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/utils/strings/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { joinStrings } from './join-strings';\nexport { padLeftZeros } from './pad-left-zeros';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-strings.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/strings/join-strings.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAErF"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Joins strings with a whitespace, discarding empty strings. Useful to combine multiple aria-labels.
|
|
5
|
+
*/
|
|
6
|
+
export function joinStrings() {
|
|
5
7
|
var strings = [];
|
|
6
8
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
7
9
|
strings[_i] = arguments[_i];
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=strings.js.map
|
|
11
|
+
return strings.filter(Boolean).join(' ') || undefined;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=join-strings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-strings.js","sourceRoot":"","sources":["../../../../../src/internal/utils/strings/join-strings.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC;;GAEG;AACH,MAAM,UAAU,WAAW;IAAC,iBAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,4BAAqC;;IAC/D,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;AACxD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Joins strings with a whitespace, discarding empty strings. Useful to combine multiple aria-labels.\n */\nexport function joinStrings(...strings: Array<string | undefined>): string | undefined {\n return strings.filter(Boolean).join(' ') || undefined;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pad-left-zeros.d.ts","sourceRoot":"","sources":["../../../../../src/internal/utils/strings/pad-left-zeros.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Prefixes given text with zeros until it reaches the target length.
|
|
5
|
+
*/
|
|
6
|
+
export function padLeftZeros(text, length) {
|
|
7
|
+
while (text.length < length) {
|
|
8
|
+
text = "0".concat(text);
|
|
9
|
+
}
|
|
10
|
+
return text;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=pad-left-zeros.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pad-left-zeros.js","sourceRoot":"","sources":["../../../../../src/internal/utils/strings/pad-left-zeros.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc;IACvD,OAAO,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE;QAC3B,IAAI,GAAG,WAAI,IAAI,CAAE,CAAC;KACnB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Prefixes given text with zeros until it reaches the target length.\n */\nexport function padLeftZeros(text: string, length: number): string {\n while (text.length < length) {\n text = `0${text}`;\n }\n return text;\n}\n"]}
|
package/link/internal.js
CHANGED
|
@@ -41,7 +41,7 @@ var InternalLink = React.forwardRef(function (_a, ref) {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
var linkRef = useRef(null);
|
|
44
|
-
var isVisualRefresh = useVisualRefresh(
|
|
44
|
+
var isVisualRefresh = useVisualRefresh();
|
|
45
45
|
useForwardFocus(ref, linkRef);
|
|
46
46
|
// Visual refresh should only add styles to buttons that don't already have unique styles (e.g. primary/secondary variants)
|
|
47
47
|
var applyButtonStyles = isButton && isVisualRefresh && !hasSpecialStyle;
|
|
@@ -51,8 +51,8 @@ var InternalLink = React.forwardRef(function (_a, ref) {
|
|
|
51
51
|
ref: useMergeRefs(linkRef, __internalRootRef), className: clsx(styles.link, baseProps.className, applyButtonStyles ? styles.button : null, styles[getVariantStyle(variant)], styles[getFontSizeStyle(variant, fontSize)], styles[getColorStyle(variant, color)]), 'aria-label': ariaLabel });
|
|
52
52
|
var content = (React.createElement(React.Fragment, null,
|
|
53
53
|
children,
|
|
54
|
-
external && (React.createElement(
|
|
55
|
-
|
|
54
|
+
external && (React.createElement("span", { className: styles['icon-wrapper'] },
|
|
55
|
+
"\u00A0",
|
|
56
56
|
React.createElement("span", { className: styles.icon, "aria-label": externalIconAriaLabel, role: externalIconAriaLabel ? 'img' : undefined },
|
|
57
57
|
React.createElement(InternalIcon, { name: "external", size: "inherit" }))))));
|
|
58
58
|
if (isButton) {
|
package/link/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/link/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAOhE,IAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CACnC,UACE,EAcoB,EACpB,GAA6B;IAd3B,IAAA,eAAqB,EAArB,OAAO,mBAAG,WAAW,KAAA,EACrB,gBAAmB,EAAnB,QAAQ,mBAAG,QAAQ,KAAA,EACnB,aAAgB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ates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport InternalIcon from '../icon/internal';\nimport styles from './styles.css.js';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireCancelableEvent, isPlainLeftClick } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { KeyCode } from '../internal/keycode';\nimport { LinkProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\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 = 'secondary',\n fontSize = 'body-m',\n color = 'normal',\n external = false,\n target,\n href,\n rel,\n ariaLabel,\n externalIconAriaLabel,\n onFollow,\n children,\n __internalRootRef = null,\n ...props\n }: InternalLinkProps,\n ref: React.Ref<LinkProps.Ref>\n ) => {\n checkSafeUrl('Link', href);\n const isButton = !href;\n const specialStyles = ['top-navigation', 'link', 'recovery'];\n const hasSpecialStyle = specialStyles.indexOf(variant) > -1;\n\n const focusVisible = useFocusVisible();\n const baseProps = getBaseProps(props);\n const anchorTarget = target ?? (external ? '_blank' : undefined);\n const anchorRel = rel ?? (anchorTarget === '_blank' ? 'noopener noreferrer' : undefined);\n\n const fireFollowEvent = (event: React.SyntheticEvent) => {\n fireCancelableEvent(onFollow, { href, external, target: anchorTarget }, event);\n };\n\n const handleLinkClick = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollowEvent(event);\n }\n };\n\n const handleButtonClick = (event: React.MouseEvent) => {\n fireFollowEvent(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 }\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 ...focusVisible,\n ...baseProps,\n // https://github.com/microsoft/TypeScript/issues/36659\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: useMergeRefs(linkRef as any, __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 'aria-label': ariaLabel,\n };\n\n const content = (\n <>\n {children}\n {external && (\n <span className={styles['icon-wrapper']}>\n \n <span\n className={styles.icon}\n aria-label={externalIconAriaLabel}\n role={externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" size=\"inherit\" />\n </span>\n </span>\n )}\n </>\n );\n\n if (isButton) {\n return (\n <a {...sharedProps} role=\"button\" tabIndex={0} onKeyDown={handleButtonKeyDown} onClick={handleButtonClick}>\n {content}\n </a>\n );\n }\n\n return (\n // we dynamically set proper rel in the code above\n // eslint-disable-next-line react/jsx-no-target-blank\n <a {...sharedProps} target={anchorTarget} rel={anchorRel} href={href} onClick={handleLinkClick}>\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"]}
|
package/link/styles.css.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"link": "
|
|
5
|
-
"variant-secondary": "awsui_variant-
|
|
6
|
-
"variant-primary": "awsui_variant-
|
|
7
|
-
"variant-info": "awsui_variant-
|
|
8
|
-
"variant-value-large": "awsui_variant-value-
|
|
9
|
-
"variant-top-navigation": "awsui_variant-top-
|
|
10
|
-
"variant-recovery": "awsui_variant-
|
|
11
|
-
"button": "
|
|
12
|
-
"color-inverted": "awsui_color-
|
|
13
|
-
"font-size-body-s": "awsui_font-size-body-
|
|
14
|
-
"font-size-body-m": "awsui_font-size-body-
|
|
15
|
-
"font-size-heading-xs": "awsui_font-size-heading-
|
|
16
|
-
"font-size-heading-s": "awsui_font-size-heading-
|
|
17
|
-
"font-size-heading-m": "awsui_font-size-heading-
|
|
18
|
-
"font-size-heading-l": "awsui_font-size-heading-
|
|
19
|
-
"font-size-heading-xl": "awsui_font-size-heading-
|
|
20
|
-
"font-size-display-l": "awsui_font-size-display-
|
|
21
|
-
"icon": "
|
|
4
|
+
"link": "awsui_link_4c84z_v8uku_93",
|
|
5
|
+
"variant-secondary": "awsui_variant-secondary_4c84z_v8uku_138",
|
|
6
|
+
"variant-primary": "awsui_variant-primary_4c84z_v8uku_173",
|
|
7
|
+
"variant-info": "awsui_variant-info_4c84z_v8uku_208",
|
|
8
|
+
"variant-value-large": "awsui_variant-value-large_4c84z_v8uku_243",
|
|
9
|
+
"variant-top-navigation": "awsui_variant-top-navigation_4c84z_v8uku_277",
|
|
10
|
+
"variant-recovery": "awsui_variant-recovery_4c84z_v8uku_312",
|
|
11
|
+
"button": "awsui_button_4c84z_v8uku_347",
|
|
12
|
+
"color-inverted": "awsui_color-inverted_4c84z_v8uku_382",
|
|
13
|
+
"font-size-body-s": "awsui_font-size-body-s_4c84z_v8uku_401",
|
|
14
|
+
"font-size-body-m": "awsui_font-size-body-m_4c84z_v8uku_406",
|
|
15
|
+
"font-size-heading-xs": "awsui_font-size-heading-xs_4c84z_v8uku_410",
|
|
16
|
+
"font-size-heading-s": "awsui_font-size-heading-s_4c84z_v8uku_414",
|
|
17
|
+
"font-size-heading-m": "awsui_font-size-heading-m_4c84z_v8uku_419",
|
|
18
|
+
"font-size-heading-l": "awsui_font-size-heading-l_4c84z_v8uku_424",
|
|
19
|
+
"font-size-heading-xl": "awsui_font-size-heading-xl_4c84z_v8uku_429",
|
|
20
|
+
"font-size-display-l": "awsui_font-size-display-l_4c84z_v8uku_434",
|
|
21
|
+
"icon-wrapper": "awsui_icon-wrapper_4c84z_v8uku_440",
|
|
22
|
+
"icon": "awsui_icon_4c84z_v8uku_440"
|
|
22
23
|
};
|
|
23
24
|
|