@pega/cosmos-react-core 4.0.0-dev.19.2 → 4.0.0-dev.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppShell/AppShell.js +1 -1
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +1 -1
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +3 -3
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/AppShell/Operator.d.ts +2 -2
- package/lib/components/AppShell/Operator.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +2 -2
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +3 -3
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.js +2 -1
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Card/CardContent.d.ts +2 -2
- package/lib/components/Card/CardContent.d.ts.map +1 -1
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts +1 -1
- package/lib/components/CreditCard/CreditCardDisplay.d.ts.map +1 -1
- package/lib/components/CreditCard/CreditCardDisplay.js +2 -1
- package/lib/components/CreditCard/CreditCardDisplay.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +2 -1
- package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js +2 -1
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/DurationDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DurationDisplay.js +2 -1
- package/lib/components/DateTime/DurationDisplay.js.map +1 -1
- package/lib/components/DateTime/utils.d.ts +2 -1
- package/lib/components/DateTime/utils.d.ts.map +1 -1
- package/lib/components/DateTime/utils.js.map +1 -1
- package/lib/components/Email/EmailDisplay.d.ts.map +1 -1
- package/lib/components/Email/EmailDisplay.js +2 -1
- package/lib/components/Email/EmailDisplay.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +2 -1
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.js +2 -1
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +1 -1
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormField/FormField.d.ts +2 -2
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Icon/iconNames.d.ts +1 -1
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +2 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/semitruck-solid.icon.d.ts +5 -0
- package/lib/components/Icon/icons/semitruck-solid.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/semitruck-solid.icon.js +7 -0
- package/lib/components/Icon/icons/semitruck-solid.icon.js.map +1 -0
- package/lib/components/Icon/icons/semitruck.icon.d.ts +5 -0
- package/lib/components/Icon/icons/semitruck.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/semitruck.icon.js +7 -0
- package/lib/components/Icon/icons/semitruck.icon.js.map +1 -0
- package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.js +5 -2
- package/lib/components/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.styles.js +10 -5
- package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +2 -2
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/Location/LocationDisplay.d.ts.map +1 -1
- package/lib/components/Location/LocationDisplay.js +2 -1
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +1 -1
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/NoValue/NoValue.d.ts +3 -0
- package/lib/components/NoValue/NoValue.d.ts.map +1 -0
- package/lib/components/NoValue/NoValue.js +9 -0
- package/lib/components/NoValue/NoValue.js.map +1 -0
- package/lib/components/NoValue/index.d.ts +2 -0
- package/lib/components/NoValue/index.d.ts.map +1 -0
- package/lib/components/NoValue/index.js +2 -0
- package/lib/components/NoValue/index.js.map +1 -0
- package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
- package/lib/components/Number/NumberDisplay.js +2 -1
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +2 -2
- package/lib/components/Paragraph/ParagraphDisplay.d.ts.map +1 -1
- package/lib/components/Paragraph/ParagraphDisplay.js +2 -1
- package/lib/components/Paragraph/ParagraphDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +2 -1
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +54 -9
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Tree/Tree.d.ts +2 -11
- package/lib/components/Tree/Tree.d.ts.map +1 -1
- package/lib/components/Tree/Tree.js.map +1 -1
- package/lib/components/URL/URLDisplay.d.ts.map +1 -1
- package/lib/components/URL/URLDisplay.js +2 -1
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/useBreakpoint.d.ts.map +1 -1
- package/lib/hooks/useBreakpoint.js +3 -1
- package/lib/hooks/useBreakpoint.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +1 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +1 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +1 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +1 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/theme/ThemeMachine.d.ts +1 -1
- package/lib/theme/ThemeMachine.d.ts.map +1 -1
- package/lib/theme/ThemeMachine.js.map +1 -1
- package/lib/theme/theme.d.ts +556 -550
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +4 -0
- package/lib/types/types.d.ts +14 -6
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/getRelativeOffset.d.ts +7 -0
- package/lib/utils/getRelativeOffset.d.ts.map +1 -0
- package/lib/utils/getRelativeOffset.js +9 -0
- package/lib/utils/getRelativeOffset.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,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,EAChC,GAAG,EAAE,IAAI,KACL,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect,\n useState,\n useCallback,\n forwardRef,\n Ref,\n MouseEvent,\n PropsWithoutRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { reflow } from '../../utils';\nimport { BaseProps, PropsWithDefaults, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { useConsolidatedRef } from '../../hooks';\n\nexport interface BackdropProps extends BaseProps {\n /**\n * Opacity of the Backdrop.\n * @default 0.4\n */\n alpha?: number;\n /** Any React Node to be rendered on top of the Backdrop component. */\n children?: ReactNode;\n /** Props passed to Flex container. */\n container?:
|
|
1
|
+
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../../../src/components/Backdrop/Backdrop.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EAIX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAmDjD,MAAM,sBAAsB,GAAG;IAC7B,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,CAAC;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAiD,KAAK,CAAC,EAAE;IAC/F,MAAM,EACJ,KAAK,EAAE,EAAE,IAAI,EAAE,EAChB,GAAG,KA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K,KAAK,SAAS,IAAI,OAAO,KAAK,GAAG,EAAE;YAC1C,sBAAsB;YACtB,mBAAmB,EAAE,EAAE,CAAC;YACxB,QAAQ,CAAC,MAAM,CAAC,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CAAC,IAAI,IAAI,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC1C,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EACpE,EAAE,EAAE,cAAc,EAClB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,IAAI,KACL,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect,\n useState,\n useCallback,\n forwardRef,\n Ref,\n MouseEvent,\n PropsWithoutRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { reflow } from '../../utils';\nimport { BaseProps, PropsWithDefaults, ForwardProps, ExcludeStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { useConsolidatedRef } from '../../hooks';\n\nexport interface BackdropProps extends BaseProps {\n /**\n * Opacity of the Backdrop.\n * @default 0.4\n */\n alpha?: number;\n /** Any React Node to be rendered on top of the Backdrop component. */\n children?: ReactNode;\n /** Props passed to Flex container. */\n container?: ExcludeStrict<FlexProps['container'], true>;\n /**\n * Toggles visibility of Backdrop.\n * @default false\n */\n open?: boolean;\n /**\n * Determines the color of the Backdrop.\n * @default 'dark'\n */\n variant?: 'dark' | 'light';\n /**\n * Transition speed of Backdrop animation.\n * @default 'medium'\n */\n transitionSpeed?: 'slow' | 'medium' | 'fast' | 'none';\n /**\n * The position of the Backdrop.\n * @default 'fixed'\n */\n position?: 'absolute' | 'fixed';\n /** Accepts a callback function for click event on Backdrop. */\n onClick?: (e: MouseEvent<HTMLDivElement>) => void;\n /** Accepts a callback that gets invoked before opening Backdrop. */\n onBeforeTransitionIn?: () => void;\n /** Accepts a callback that gets invoked after opening Backdrop. */\n onAfterTransitionIn?: () => void;\n /** Accepts a callback that gets invoked before closing Backdrop. */\n onBeforeTransitionOut?: () => void;\n /** Accepts a callback that gets invoked after closing Backdrop */\n onAfterTransitionOut?: () => void;\n /** Ref for a Backdrop's root div element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype BackdropPropsWithDefaults = PropsWithDefaults<\n BackdropProps,\n 'open' | 'transitionSpeed' | 'alpha' | 'position'\n>;\n\nconst transitionSpeedToTheme = {\n slow: 2,\n medium: 1,\n fast: 0.5,\n none: 0\n} as const;\n\nexport const StyledBackdrop = styled.div<BackdropPropsWithDefaults & { opacity: 0 | 1 }>(props => {\n const {\n theme: { base }\n } = props;\n const { opacity, alpha, variant, position } = props;\n const transitionDuration = `max(calc(${transitionSpeedToTheme[props.transitionSpeed]} * ${\n base.animation.speed\n }), 1ms)`;\n\n return css`\n position: ${position};\n z-index: ${position === 'fixed' ? base['z-index'].backdrop : base['z-index'].popover + 1};\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n border-radius: inherit;\n opacity: ${opacity};\n transition-property: opacity;\n transition-timing-function: ${props.theme.base.animation.timing.ease};\n /* stylelint-disable declaration-block-no-duplicate-properties */\n transition-duration: 1ms;\n transition-duration: ${transitionDuration};\n /* stylelint-enable declaration-block-no-duplicate-properties */\n\n ${variant === 'dark' &&\n css`\n background: rgba(0, 0, 0, ${alpha});\n `}\n\n ${variant === 'light' &&\n css`\n background: rgba(255, 255, 255, ${alpha});\n `}\n `;\n});\n\nStyledBackdrop.defaultProps = defaultThemeProp;\n\ntype State = 'closed' | 'opening' | 'open' | 'closing';\n\nconst Backdrop: FunctionComponent<BackdropProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<BackdropProps>, ref: BackdropProps['ref']) => {\n const {\n children,\n container,\n open = false,\n variant = 'dark',\n transitionSpeed = 'medium',\n alpha = 0.6,\n position = 'fixed',\n onBeforeTransitionIn,\n onAfterTransitionIn,\n onBeforeTransitionOut,\n onAfterTransitionOut,\n ...restProps\n } = props;\n\n const cRef = useConsolidatedRef(ref);\n\n const [state, setState] = useState<State>('closed');\n\n const onTransitionEnd = useCallback(\n (e: TransitionEvent) => {\n if (e.propertyName !== 'opacity' || e.target !== e.currentTarget) return;\n let nextState: State;\n\n if (state === 'closing') {\n nextState = 'closed';\n onAfterTransitionOut?.();\n } else {\n nextState = 'open';\n onAfterTransitionIn?.();\n }\n\n setState(nextState);\n },\n [state, onAfterTransitionOut, onAfterTransitionIn]\n );\n\n useEffect(() => {\n if (open) {\n if (state === 'closed' || state === 'closing') {\n onBeforeTransitionIn?.();\n reflow();\n setState('opening');\n }\n } else if (state === 'open' || state === 'opening') {\n onBeforeTransitionOut?.();\n setState('closing');\n }\n }, [open]);\n\n // Using a separate effect instead of combined logic above as it seems more intuitive to mentally manage.\n useEffect(() => {\n if (!cRef.current) return;\n const opacity = window.getComputedStyle(cRef.current).opacity;\n // If the opacity is already at the destination value, sync the state value.\n if (state === 'closing' && opacity === '0') {\n // Since the transition never ran, we have to pretend it did and call the callback.\n // TODO: This maybe can be fixed with the animation api\n onAfterTransitionOut?.();\n setState('closed');\n }\n if (state === 'opening' && opacity === '1') {\n // ditto, see above...\n onAfterTransitionIn?.();\n setState('open');\n }\n }, [state]);\n\n return !open && state === 'closed' ? null : (\n <Flex\n container={{ justify: 'center', alignItems: 'center', ...container }}\n as={StyledBackdrop}\n transitionSpeed={transitionSpeed}\n opacity={state === 'opening' || state === 'open' ? 1 : 0}\n alpha={alpha}\n variant={variant}\n position={position}\n onTransitionEnd={onTransitionEnd}\n ref={cRef}\n {...restProps}\n >\n {children}\n </Flex>\n );\n }\n);\n\nexport default Backdrop;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Boolean/BooleanDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAK5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Boolean/BooleanDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAK5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGtE,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,cAAc;IACpE,oBAAoB;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAMD,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAiBzE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { useI18n } from '../../hooks';
|
|
5
5
|
import { defaultThemeProp } from '../../theme';
|
|
6
|
+
import NoValue from '../NoValue/NoValue';
|
|
6
7
|
const StyledBooleanDisplay = styled.span ``;
|
|
7
8
|
StyledBooleanDisplay.defaultProps = defaultThemeProp;
|
|
8
9
|
const BooleanDisplay = forwardRef(({ value, trueLabel, falseLabel, ...restProps }, ref) => {
|
|
@@ -10,7 +11,7 @@ const BooleanDisplay = forwardRef(({ value, trueLabel, falseLabel, ...restProps
|
|
|
10
11
|
const displayText = value
|
|
11
12
|
? trueLabel || t('boolean_display_true_label')
|
|
12
13
|
: falseLabel || t('boolean_display_false_label');
|
|
13
|
-
return (_jsx(StyledBooleanDisplay, { ref: ref, ...restProps, children: value !== undefined ? displayText : _jsx(
|
|
14
|
+
return (_jsx(StyledBooleanDisplay, { ref: ref, ...restProps, children: value !== undefined ? displayText : _jsx(NoValue, {}) }));
|
|
14
15
|
});
|
|
15
16
|
export default BooleanDisplay;
|
|
16
17
|
//# sourceMappingURL=BooleanDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanDisplay.js","sourceRoot":"","sources":["../../../src/components/Boolean/BooleanDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BooleanDisplay.js","sourceRoot":"","sources":["../../../src/components/Boolean/BooleanDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAiBzC,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAE3C,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,cAAc,GAA0D,UAAU,CACtF,CACE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,SAAS,EAAwC,EACpF,GAA+B,EAC/B,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,WAAW,GAAG,KAAK;QACvB,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,4BAA4B,CAAC;QAC9C,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,6BAA6B,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,oBAAoB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1C,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,GAC3B,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport NoValue from '../NoValue/NoValue';\n\nexport interface BooleanDisplayProps extends BaseProps, NoChildrenProp {\n /** Boolean value */\n value?: boolean;\n /** The text to be displayed when value is true.\n * @default 'Yes'\n */\n trueLabel?: string;\n /** The text to be displayed when value is false.\n * @default 'No'\n */\n falseLabel?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst StyledBooleanDisplay = styled.span``;\n\nStyledBooleanDisplay.defaultProps = defaultThemeProp;\n\nconst BooleanDisplay: FunctionComponent<BooleanDisplayProps & ForwardProps> = forwardRef(\n (\n { value, trueLabel, falseLabel, ...restProps }: PropsWithoutRef<BooleanDisplayProps>,\n ref: BooleanDisplayProps['ref']\n ) => {\n const t = useI18n();\n\n const displayText = value\n ? trueLabel || t('boolean_display_true_label')\n : falseLabel || t('boolean_display_false_label');\n\n return (\n <StyledBooleanDisplay ref={ref} {...restProps}>\n {value !== undefined ? displayText : <NoValue />}\n </StyledBooleanDisplay>\n );\n }\n);\n\nexport default BooleanDisplay;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
-
import { BaseProps, ForwardProps } from '../../types';
|
|
2
|
+
import { BaseProps, ExcludeStrict, ForwardProps } from '../../types';
|
|
3
3
|
import { FlexProps } from '../Flex';
|
|
4
4
|
export interface CardContentProps extends BaseProps {
|
|
5
5
|
/** The content of the Card. */
|
|
6
6
|
children: ReactNode;
|
|
7
|
-
container?:
|
|
7
|
+
container?: ExcludeStrict<FlexProps['container'], true>;
|
|
8
8
|
}
|
|
9
9
|
export declare const StyledCardContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
10
|
declare const CardContent: FunctionComponent<CardContentProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,OAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAM1C,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,+BAA+B;IAC/B,QAAQ,EAAE,SAAS,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,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { StyledPopover } from '../Popover';\n\nimport { StyledCard } from './Card';\nimport { StyledCardFooter } from './CardFooter';\n\nexport interface CardContentProps extends BaseProps {\n /** The content of the Card. */\n children: ReactNode;\n container?:
|
|
1
|
+
{"version":3,"file":"CardContent.js","sourceRoot":"","sources":["../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,OAAO,GAAG,CAAA;MACN,aAAa,aAAa,UAAU,IAAI,UAAU;;4BAE5B,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO;;;YAGzE,gBAAgB;;;;GAIzB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,CAAC,EACvE,QAAQ,EACR,SAAS,EACT,GAAG,SAAS,EACuC,EAAE,EAAE;IACvD,OAAO,CACL,KAAC,IAAI,OAAK,SAAS,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,EAAE,iBAAiB,YACzF,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ExcludeStrict, ForwardProps } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport { StyledPopover } from '../Popover';\n\nimport { StyledCard } from './Card';\nimport { StyledCardFooter } from './CardFooter';\n\nexport interface CardContentProps extends BaseProps {\n /** The content of the Card. */\n children: ReactNode;\n container?: ExcludeStrict<FlexProps['container'], true>;\n}\n\nexport const StyledCardContent = styled.div(({ theme }) => {\n return css`\n ${StyledPopover} &, &:not(${StyledCard} ${StyledCard} > &) {\n position: relative;\n padding: calc(1.5 * ${theme.base.spacing}) calc(${theme.components.card.padding} * 2);\n\n & + &,\n & + ${StyledCardFooter} {\n padding-block-start: 0;\n }\n }\n `;\n});\n\nStyledCardContent.defaultProps = defaultThemeProp;\n\nconst CardContent: FunctionComponent<CardContentProps & ForwardProps> = ({\n children,\n container,\n ...restProps\n}: PropsWithChildren<CardContentProps & ForwardProps>) => {\n return (\n <Flex {...restProps} container={{ direction: 'column', ...container }} as={StyledCardContent}>\n {children}\n </Flex>\n );\n};\n\nexport default CardContent;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const StyledSelectInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
-
export declare const StyledComboBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("
|
|
2
|
+
export declare const StyledComboBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<import("../FormControl").FormControlProps, keyof import("../FormControl").FormControlProps> & Required<Pick<import("../FormControl").FormControlProps, never>> & {
|
|
3
3
|
hasSuggestion?: boolean | undefined;
|
|
4
4
|
}, never>;
|
|
5
5
|
//# sourceMappingURL=ComboBox.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditCardDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/CreditCard/CreditCardDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CreditCardDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/CreditCard/CreditCardDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,YAAY,CAyB/E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import VisuallyHiddenText from '../VisuallyHiddenText';
|
|
4
|
+
import NoValue from '../NoValue/NoValue';
|
|
4
5
|
import { formatCreditCard } from './utils';
|
|
5
6
|
const CreditCardDisplay = forwardRef(({ value, formattingOptions = {}, ...restProps }, ref) => {
|
|
6
7
|
const formatted = value ? formatCreditCard(value, formattingOptions) : undefined;
|
|
7
8
|
return (_jsx("span", { ref: ref, ...restProps, children: formatted ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": 'true', children: formatted }), _jsx(VisuallyHiddenText, { children: formatted
|
|
8
9
|
.replace(/\s+/g, '.')
|
|
9
10
|
.replace(/([0-9•]\.?)/g, digit => `${digit} `)
|
|
10
|
-
.trim() })] })) : (_jsx(
|
|
11
|
+
.trim() })] })) : (_jsx(NoValue, {})) }));
|
|
11
12
|
});
|
|
12
13
|
export default CreditCardDisplay;
|
|
13
14
|
//# sourceMappingURL=CreditCardDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditCardDisplay.js","sourceRoot":"","sources":["../../../src/components/CreditCard/CreditCardDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAC;AAGvE,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"CreditCardDisplay.js","sourceRoot":"","sources":["../../../src/components/CreditCard/CreditCardDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAC;AAGvE,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAGzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,iBAAiB,GAA6D,UAAU,CAC5F,CACE,EAAE,KAAK,EAAE,iBAAiB,GAAG,EAAE,EAAE,GAAG,SAAS,EAA2C,EACxF,GAAkC,EAClC,EAAE;IACF,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjF,OAAO,CACL,eAAM,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1B,SAAS,CAAC,CAAC,CAAC,CACX,8BACE,8BAAkB,MAAM,YAAE,SAAS,GAAQ,EAC3C,KAAC,kBAAkB,cAChB,SAAS;yBACP,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;yBACpB,OAAO,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC;yBAC7C,IAAI,EAAE,GACU,IACpB,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,KAAG,CACZ,GACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef } from 'react';\n\nimport { ForwardProps } from '../../types';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport NoValue from '../NoValue/NoValue';\n\nimport { CreditCardDisplayProps } from './CreditCard.types';\nimport { formatCreditCard } from './utils';\n\nconst CreditCardDisplay: FunctionComponent<CreditCardDisplayProps & ForwardProps> = forwardRef(\n (\n { value, formattingOptions = {}, ...restProps }: PropsWithoutRef<CreditCardDisplayProps>,\n ref: CreditCardDisplayProps['ref']\n ) => {\n const formatted = value ? formatCreditCard(value, formattingOptions) : undefined;\n\n return (\n <span ref={ref} {...restProps}>\n {formatted ? (\n <>\n <span aria-hidden='true'>{formatted}</span>\n <VisuallyHiddenText>\n {formatted\n .replace(/\\s+/g, '.')\n .replace(/([0-9•]\\.?)/g, digit => `${digit} `)\n .trim()}\n </VisuallyHiddenText>\n </>\n ) : (\n <NoValue />\n )}\n </span>\n );\n }\n);\n\nexport default CreditCardDisplay;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Currency/CurrencyDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"CurrencyDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Currency/CurrencyDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOtE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,+GAA+G;IAC/G,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,iBAAiB,CAAC,EAAE;QAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;QACtC;;;WAGG;QACH,QAAQ,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;QACxC;;;WAGG;QACH,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;QAClC;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB;;WAEG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAsD3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useConfiguration } from '../../hooks';
|
|
4
4
|
import VisuallyHiddenText from '../VisuallyHiddenText';
|
|
5
|
+
import NoValue from '../NoValue/NoValue';
|
|
5
6
|
import { formatCurrency, isValidCurrency } from './utils';
|
|
6
7
|
const CurrencyDisplay = forwardRef(({ value, currencyISOCode, formattingOptions: { currency = 'symbol', negative = 'minus-sign', notation = 'standard', groupSeparators = true, fractionDigits } = {}, ...restProps }, ref) => {
|
|
7
8
|
const { locale } = useConfiguration();
|
|
@@ -23,7 +24,7 @@ const CurrencyDisplay = forwardRef(({ value, currencyISOCode, formattingOptions:
|
|
|
23
24
|
currencySign: 'standard',
|
|
24
25
|
currencyDisplay: 'name'
|
|
25
26
|
};
|
|
26
|
-
return (_jsx("span", { ref: ref, ...restProps, children: value || value === 0 ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": 'true', children: formatCurrency(value, { locale, options }) }), _jsx(VisuallyHiddenText, { children: formatCurrency(value, { locale, options: srOptions }) })] })) : (_jsx(
|
|
27
|
+
return (_jsx("span", { ref: ref, ...restProps, children: value || value === 0 ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": 'true', children: formatCurrency(value, { locale, options }) }), _jsx(VisuallyHiddenText, { children: formatCurrency(value, { locale, options: srOptions }) })] })) : (_jsx(NoValue, {})) }));
|
|
27
28
|
});
|
|
28
29
|
export default CurrencyDisplay;
|
|
29
30
|
//# sourceMappingURL=CurrencyDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyDisplay.js","sourceRoot":"","sources":["../../../src/components/Currency/CurrencyDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"CurrencyDisplay.js","sourceRoot":"","sources":["../../../src/components/Currency/CurrencyDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkC1D,MAAM,eAAe,GAA2D,UAAU,CACxF,CACE,EACE,KAAK,EACL,eAAe,EACf,iBAAiB,EAAE,EACjB,QAAQ,GAAG,QAAQ,EACnB,QAAQ,GAAG,YAAY,EACvB,QAAQ,GAAG,UAAU,EACrB,eAAe,GAAG,IAAI,EACtB,cAAc,EACf,GAAG,EAAE,EACN,GAAG,SAAS,EAC0B,EACxC,GAAgC,EAChC,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEtC,MAAM,OAAO,GACX,eAAe,IAAI,eAAe,CAAC,eAAe,CAAC;QACjD,CAAC,CAAE;YACC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,eAAe;YACzB,eAAe,EAAE,QAAQ;YACzB,WAAW,EAAE,eAAe;YAC5B,QAAQ;YACR,YAAY,EAAE,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU;YACpE,qBAAqB,EAAE,cAAc;YACrC,qBAAqB,EAAE,cAAc;SACT;QAChC,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,SAAS,GAAG;QAChB,GAAG,OAAO;QACV,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,UAAU;QACxB,eAAe,EAAE,MAAM;KACxB,CAAC;IAEF,OAAO,CACL,eAAM,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1B,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CACtB,8BACE,8BAAkB,MAAM,YAAE,cAAc,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAQ,EAC5E,KAAC,kBAAkB,cAChB,cAAc,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,GACnC,IACpB,CACJ,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,KAAG,CACZ,GACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport { useConfiguration } from '../../hooks';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport NoValue from '../NoValue/NoValue';\n\nimport { formatCurrency, isValidCurrency } from './utils';\n\nexport interface CurrencyDisplayProps extends BaseProps, NoChildrenProp {\n /** Number value. */\n value?: number | bigint;\n /** Three letter currency shorthand ISO code. If not provided or invalid, component renders only the number. */\n currencyISOCode?: string;\n /** Options to define formatting. */\n formattingOptions?: {\n currency?: 'symbol' | 'code' | 'name';\n /**\n * Determines negative value notation: using minus sign or parentheses.\n * @default 'minus-sign'\n */\n negative?: 'minus-sign' | 'parentheses';\n /**\n * Value display notation.\n * @default 'standard'\n */\n notation?: 'standard' | 'compact';\n /**\n * Fixed number of fraction digits. Maximum is 20, default is currency dependant.\n * @default variable\n */\n fractionDigits?: number;\n /** Determines whether group separators should be shown.\n * @default true\n */\n groupSeparators?: boolean;\n };\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\nconst CurrencyDisplay: FunctionComponent<CurrencyDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n currencyISOCode,\n formattingOptions: {\n currency = 'symbol',\n negative = 'minus-sign',\n notation = 'standard',\n groupSeparators = true,\n fractionDigits\n } = {},\n ...restProps\n }: PropsWithoutRef<CurrencyDisplayProps>,\n ref: CurrencyDisplayProps['ref']\n ) => {\n const { locale } = useConfiguration();\n\n const options =\n currencyISOCode && isValidCurrency(currencyISOCode)\n ? ({\n style: 'currency',\n currency: currencyISOCode,\n currencyDisplay: currency,\n useGrouping: groupSeparators,\n notation,\n currencySign: negative === 'parentheses' ? 'accounting' : 'standard',\n minimumFractionDigits: fractionDigits,\n maximumFractionDigits: fractionDigits\n } as Intl.NumberFormatOptions)\n : undefined;\n\n const srOptions = {\n ...options,\n useGrouping: false,\n currencySign: 'standard',\n currencyDisplay: 'name'\n };\n\n return (\n <span ref={ref} {...restProps}>\n {value || value === 0 ? (\n <>\n <span aria-hidden='true'>{formatCurrency(value, { locale, options })}</span>\n <VisuallyHiddenText>\n {formatCurrency(value, { locale, options: srOptions })}\n </VisuallyHiddenText>\n </>\n ) : (\n <NoValue />\n )}\n </span>\n );\n }\n);\n\nexport default CurrencyDisplay;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DateTimeDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAItD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAe,MAAM,eAAe,CAAC;AAIzD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,+DAA+D;IAC/D,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B,kCAAkC;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,0GAAgB,CAAC;AAEnD,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CA+B3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { useConfiguration, useI18n } from '../../hooks';
|
|
5
|
+
import NoValue from '../NoValue/NoValue';
|
|
5
6
|
import { parseToDate } from './Input/utils';
|
|
6
7
|
import { isValidDate } from './Picker/utils';
|
|
7
8
|
import { formatDateTime } from './utils';
|
|
@@ -16,7 +17,7 @@ const DateTimeDisplay = forwardRef(({ value, variant, format = 'short', clockFor
|
|
|
16
17
|
variant,
|
|
17
18
|
clockFormat,
|
|
18
19
|
timeZone: 'UTC'
|
|
19
|
-
})) : (_jsx(
|
|
20
|
+
})) : (_jsx(NoValue, {})) }));
|
|
20
21
|
});
|
|
21
22
|
export default DateTimeDisplay;
|
|
22
23
|
//# sourceMappingURL=DateTimeDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DateTimeDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DateTimeDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAGzC,OAAO,EAAe,WAAW,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAkBzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AAEnD,MAAM,eAAe,GAA2D,UAAU,CACxF,CACE,EACE,KAAK,EACL,OAAO,EACP,MAAM,GAAG,OAAO,EAChB,WAAW,EACX,GAAG,SAAS,EAC0B,EACxC,GAAgC,EAChC,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACtC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,KAAC,qBAAqB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,YAC3C,CAAC,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3D,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;YACjC,CAAC;YACD,MAAM;YACN,MAAM;YACN,OAAO;YACP,WAAW;YACX,QAAQ,EAAE,KAAK;SAChB,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,KAAG,CACZ,GACqB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useConfiguration, useI18n } from '../../hooks';\nimport NoValue from '../NoValue/NoValue';\n\nimport { DateTimeFormat, DateTimeVariant } from './DateTime.types';\nimport { ClockFormat, parseToDate } from './Input/utils';\nimport { isValidDate } from './Picker/utils';\nimport { formatDateTime } from './utils';\n\nexport interface DateTimeDisplayProps extends BaseProps {\n /** Date as ISO8601 string, timestamp or native Date object. */\n value?: Date | string | number;\n /** Controls date time variant. */\n variant: DateTimeVariant;\n /**\n * Controls display format.\n * @default 'short'\n */\n format?: DateTimeFormat;\n /** Defines clock format that overrides locale based format */\n clockFormat?: ClockFormat;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nexport const StyledDateTimeDisplay = styled.span``;\n\nconst DateTimeDisplay: FunctionComponent<DateTimeDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n variant,\n format = 'short',\n clockFormat,\n ...restProps\n }: PropsWithoutRef<DateTimeDisplayProps>,\n ref: DateTimeDisplayProps['ref']\n ) => {\n const { locale } = useConfiguration();\n const t = useI18n();\n\n return (\n <StyledDateTimeDisplay ref={ref} {...restProps}>\n {(value || value === 0) && isValidDate(parseToDate(value)) ? (\n formatDateTime(parseToDate(value), {\n t,\n locale,\n format,\n variant,\n clockFormat,\n timeZone: 'UTC'\n })\n ) : (\n <NoValue />\n )}\n </StyledDateTimeDisplay>\n );\n }\n);\n\nexport default DateTimeDisplay;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurationDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DurationDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMtD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACtD,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAsB3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -2,10 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useConfiguration } from '../../hooks';
|
|
4
4
|
import Text from '../Text';
|
|
5
|
+
import NoValue from '../NoValue/NoValue';
|
|
5
6
|
import { formatDuration } from './utils';
|
|
6
7
|
const DurationDisplay = forwardRef(({ value, significantUnits = 4, unitDisplay = 'narrow', ...restProps }, ref) => {
|
|
7
8
|
const { locale } = useConfiguration();
|
|
8
|
-
return (_jsx(Text, { ref: ref, ...restProps, children: typeof value === 'number' ? (formatDuration(value, { locale, significantUnits, unitDisplay })) : (_jsx(
|
|
9
|
+
return (_jsx(Text, { ref: ref, ...restProps, children: typeof value === 'number' ? (formatDuration(value, { locale, significantUnits, unitDisplay })) : (_jsx(NoValue, {})) }));
|
|
9
10
|
});
|
|
10
11
|
export default DurationDisplay;
|
|
11
12
|
//# sourceMappingURL=DurationDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DurationDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"DurationDisplay.js","sourceRoot":"","sources":["../../../src/components/DateTime/DurationDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAiBzC,MAAM,eAAe,GAA2D,UAAU,CACxF,CACE,EACE,KAAK,EACL,gBAAgB,GAAG,CAAC,EACpB,WAAW,GAAG,QAAQ,EACtB,GAAG,SAAS,EAC0B,EACxC,GAAgC,EAChC,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAEtC,OAAO,CACL,KAAC,IAAI,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1B,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC3B,cAAc,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC,CACjE,CAAC,CAAC,CAAC,CACF,KAAC,OAAO,KAAG,CACZ,GACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { useConfiguration } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Text from '../Text';\nimport NoValue from '../NoValue/NoValue';\n\nimport { formatDuration } from './utils';\n\nexport interface DurationDisplayProps extends BaseProps {\n /** Number of milliseconds value for controlled input. */\n value?: number;\n /** Determines number of units to be displayed.\n * @default 4\n */\n significantUnits?: 4 | 3 | 2 | 1;\n /** Unit formatting style\n * @default \"narrow\"\n */\n unitDisplay?: Intl.NumberFormatOptions['unitDisplay'];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst DurationDisplay: FunctionComponent<DurationDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n significantUnits = 4,\n unitDisplay = 'narrow',\n ...restProps\n }: PropsWithoutRef<DurationDisplayProps>,\n ref: DurationDisplayProps['ref']\n ) => {\n const { locale } = useConfiguration();\n\n return (\n <Text ref={ref} {...restProps}>\n {typeof value === 'number' ? (\n formatDuration(value, { locale, significantUnits, unitDisplay })\n ) : (\n <NoValue />\n )}\n </Text>\n );\n }\n);\n\nexport default DurationDisplay;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TranslationFunction, TranslationPack } from '../../i18n';
|
|
2
|
+
import { ExcludeStrict } from '../../types';
|
|
2
3
|
import { DateTimeFormat, DateTimeVariant } from './DateTime.types';
|
|
3
4
|
import { ClockFormat } from './Input/utils';
|
|
4
5
|
type DateTimeFormatOptions = {
|
|
@@ -7,7 +8,7 @@ type DateTimeFormatOptions = {
|
|
|
7
8
|
timeZone?: string;
|
|
8
9
|
clockFormat?: ClockFormat;
|
|
9
10
|
} & ({
|
|
10
|
-
variant:
|
|
11
|
+
variant: ExcludeStrict<DateTimeVariant, 'quarteryear'>;
|
|
11
12
|
t?: TranslationFunction<TranslationPack>;
|
|
12
13
|
} | {
|
|
13
14
|
variant: 'quarteryear';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAmB,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,WAAW,EAMZ,MAAM,eAAe,CAAC;AAavB,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;I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EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,UAAU,CAAC,EAAE;QACtE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC,EAAE;KACzE,CAAC;IAEF,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,gBAAgB,IAAI,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QACpF,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAEzC,IAAI,KAAK,GAAG,CAAC,EAAE;YACb,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACvC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBAC7E,KAAK,EAAE,MAAM;gBACb,IAAI;gBACJ,WAAW;aACZ,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;SACzE;KACF;IACD,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { TranslationFunction, TranslationPack } from '../../i18n';\nimport { cap } from '../../utils';\n\nimport { AbsoluteVariant, DateTimeFormat, DateTimeVariant } from './DateTime.types';\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear\n} from './Input/utils';\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} satisfies Partial<Record<Intl.RelativeTimeFormatUnit, number>>;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\ntype DateTimeFormatOptions = {\n locale: string;\n format: DateTimeFormat;\n timeZone?: string;\n clockFormat?: ClockFormat;\n} & (\n | {\n variant: Exclude<DateTimeVariant, 'quarteryear'>;\n t?: TranslationFunction<TranslationPack>;\n }\n | { variant: 'quarteryear'; t: TranslationFunction<TranslationPack> }\n);\n\ntype TimeOptions = Pick<Intl.DateTimeFormatOptions, 'hour' | 'minute' | 'second' | 'hour12'>;\n\nconst timeShort = {\n hour: 'numeric',\n minute: 'numeric'\n} satisfies TimeOptions;\n\nconst timeShort12 = {\n ...timeShort,\n hour12: true\n} satisfies TimeOptions;\n\nconst timeShort24 = {\n ...timeShort,\n hour12: false\n} satisfies TimeOptions;\n\nconst timeLong = {\n ...timeShort,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong12 = {\n ...timeShort12,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong24 = {\n ...timeShort24,\n second: 'numeric'\n} satisfies TimeOptions;\n\ntype AddClockFormatToTimeKeys<Key extends DateTimeVariant> = Key extends `${string}time`\n ? `${Key}${'' | 12 | 24}`\n : Key;\n\nconst formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' }\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort }\n },\n datetime12: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort12 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong12 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort12 }\n },\n datetime24: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort24 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong24 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort24 }\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n time12: {\n short: timeShort12,\n long: timeLong12,\n numeric: timeShort12\n },\n time24: {\n short: timeShort24,\n long: timeLong24,\n numeric: timeShort24\n },\n month: {\n short: { month: 'short' },\n long: { month: 'long' },\n numeric: { month: 'numeric' }\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' },\n long: { year: 'numeric', month: 'long' },\n numeric: { year: 'numeric', month: 'numeric' }\n },\n week: {\n short: { month: 'short', day: 'numeric' },\n long: { month: 'long', day: 'numeric' },\n numeric: { month: 'numeric', day: 'numeric' }\n },\n year: {\n short: { year: 'numeric' },\n long: { year: 'numeric' },\n numeric: { year: '2-digit' }\n },\n relative: {\n short: { style: 'long', numeric: 'auto' },\n long: { style: 'long', numeric: 'auto' },\n numeric: { style: 'short', numeric: 'auto' }\n }\n} satisfies Record<\n AddClockFormatToTimeKeys<Exclude<AbsoluteVariant, 'quarteryear'>>,\n Record<DateTimeFormat, Intl.DateTimeFormatOptions>\n> &\n Record<'relative', Record<DateTimeFormat, Intl.RelativeTimeFormatOptions>>;\n\nconst dateTimeFormatCache: Record<\n // locale\n string,\n Record<\n // timeZone\n string,\n Map<Intl.DateTimeFormatOptions, Intl.DateTimeFormat>\n >\n> = {};\n\nconst relativeTimeFormatCache: Record<\n // locale\n string,\n Map<Intl.RelativeTimeFormatOptions, Intl.RelativeTimeFormat>\n> = {};\n\nconst displayNamesCache: Record<\n // locale\n string,\n Intl.DateTimeDisplayNames\n> = {};\n\nexport function formatDateTime(\n value: Date,\n { t, locale, format, variant, clockFormat, timeZone }: DateTimeFormatOptions\n) {\n const getFormattedDate = (\n date: Date,\n dateVariant: Exclude<AbsoluteVariant, 'quarteryear'>,\n overrideTimeZone?: string\n ) => {\n const resolvedVariant: AddClockFormatToTimeKeys<typeof dateVariant> =\n dateVariant === 'time' || dateVariant === 'datetime'\n ? `${dateVariant}${clockFormat ?? ''}`\n : dateVariant;\n const resolvedTimeZone = overrideTimeZone ?? timeZone;\n const resolvedOptions = formatMapping[resolvedVariant][format];\n\n dateTimeFormatCache[locale] ??= {};\n dateTimeFormatCache[locale][`${resolvedTimeZone}`] ??= new Map();\n\n const map = dateTimeFormatCache[locale][`${resolvedTimeZone}`];\n\n if (!map.has(resolvedOptions)) {\n map.set(\n resolvedOptions,\n new Intl.DateTimeFormat(locale, {\n ...resolvedOptions,\n timeZone: resolvedTimeZone\n })\n );\n }\n\n return map.get(resolvedOptions)!.format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n const resolvedOptions = formatMapping.relative[format];\n\n relativeTimeFormatCache[locale] ??= new Map();\n const map = relativeTimeFormatCache[locale];\n\n if (!map.has(resolvedOptions)) {\n map.set(resolvedOptions, new Intl.RelativeTimeFormat(locale, resolvedOptions));\n }\n\n return map.get(resolvedOptions)!.format(relativeValue, unit);\n };\n\n const getUnitsElapsed = (date: Date, unit: TimeUnit): number => {\n let amount: number;\n const now = new Date();\n\n switch (unit) {\n case 'year':\n amount = date.getUTCFullYear() - now.getUTCFullYear();\n break;\n case 'month':\n if (date.getUTCFullYear() === now.getUTCFullYear()) {\n amount = date.getUTCMonth() - now.getUTCMonth();\n } else if (date < now) {\n amount = (11 - date.getUTCMonth() + now.getUTCMonth() + 1) * -1;\n } else {\n amount = 11 - now.getUTCMonth() + date.getUTCMonth() + 1;\n }\n break;\n case 'day':\n if (date.getUTCMonth() === now.getUTCMonth()) {\n amount = date.getUTCDate() - now.getUTCDate();\n } else if (date < now) {\n const maximalDayOfMonth = new Date(\n Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 0)\n ).getUTCDate();\n amount = (maximalDayOfMonth - date.getUTCDate() + now.getUTCDate()) * -1;\n } else {\n const maximalDayOfMonth = new Date(\n Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 0)\n ).getUTCDate();\n amount = maximalDayOfMonth - now.getUTCDate() + date.getUTCDate() + 1;\n }\n break;\n case 'hour':\n if (date.getUTCDate() === now.getUTCDate()) {\n amount = date.getUTCHours() - now.getUTCHours();\n } else if (date < now) {\n amount = (23 - date.getUTCHours() + now.getUTCHours() + 1) * -1;\n } else {\n amount = 23 - now.getUTCHours() + date.getUTCHours() + 1;\n }\n break;\n case 'minute':\n if (date.getUTCHours() === now.getUTCHours()) {\n amount = date.getUTCMinutes() - now.getUTCMinutes();\n } else if (date < now) {\n amount = (59 - date.getUTCMinutes() + now.getUTCMinutes() + 1) * -1;\n } else {\n amount = 59 - now.getUTCMinutes() + date.getUTCMinutes() + 1;\n }\n break;\n default:\n amount = 0;\n break;\n }\n return amount;\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]) ||\n 'second') as TimeUnit;\n const amount = getUnitsElapsed(date, unit);\n\n return relativeTimeFormatter(amount, unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n displayNamesCache[locale] ??= new Intl.DisplayNames(locale, {\n style: 'long',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n\n const displayNames = displayNamesCache[locale];\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const startDate = getFormattedDate(getStartOfWeek(adjustedUTCDate), 'week', 'UTC');\n const endDate = getFormattedDate(getEndOfWeek(adjustedUTCDate), 'week', 'UTC');\n return `${cap(displayNames.of('weekOfYear'))} ${getWeek(adjustedUTCDate)}, ${getWeekYear(\n adjustedUTCDate\n )} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const quarterNumber = getQuarter(adjustedUTCDate);\n return `${t!(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n switch (variant) {\n case 'relative':\n return getRelativeTime(value);\n case 'week':\n return getFormattedWeek(value);\n case 'quarteryear':\n return getFormattedQuarterYear(value);\n default:\n return getFormattedDate(value, variant);\n }\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\ninterface DurationFormatOptions {\n locale: string;\n significantUnits: 4 | 3 | 2 | 1;\n unitDisplay?: Intl.NumberFormatOptions['unitDisplay'];\n}\n\nconst numberFormatCache: Record<\n // locale\n string,\n Record<\n // unit\n string,\n Record<\n // unitDisplay\n string,\n Intl.NumberFormat\n >\n >\n> = {};\n\nexport function formatDuration(\n valueInMs: number,\n { locale, significantUnits, unitDisplay = 'narrow' }: DurationFormatOptions\n) {\n numberFormatCache[locale] ??= {};\n\n const sign = valueInMs < 0 ? '-' : '';\n const absMs = Math.abs(valueInMs);\n if (absMs < secondInMs) {\n numberFormatCache[locale].seconds ??= {};\n\n numberFormatCache[locale].seconds.narrow ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: 'second',\n unitDisplay: 'narrow'\n });\n\n return numberFormatCache[locale].seconds.narrow.format(0);\n }\n\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n const { value, unit } = durationParts[i];\n\n if (value > 0) {\n numberFormatCache[locale][unit] ??= {};\n numberFormatCache[locale][unit][unitDisplay] ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay\n });\n\n result.push(numberFormatCache[locale][unit][unitDisplay].format(value));\n }\n }\n return `${sign}${result.join(' ')}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/DateTime/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAEL,YAAY,EACZ,UAAU,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,GAAG;IAC/B,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE;IACvC,GAAG,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;IACxB,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;IACpB,MAAM,EAAE,EAAE,GAAG,IAAI;IACjB,MAAM,EAAE,IAAI;CACkD,CAAC;AAmBjE,MAAM,SAAS,GAAG;IAChB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;CACI,CAAC;AAExB,MAAM,WAAW,GAAG;IAClB,GAAG,SAAS;IACZ,MAAM,EAAE,IAAI;CACS,CAAC;AAExB,MAAM,WAAW,GAAG;IAClB,GAAG,SAAS;IACZ,MAAM,EAAE,KAAK;CACQ,CAAC;AAExB,MAAM,QAAQ,GAAG;IACf,GAAG,SAAS;IACZ,MAAM,EAAE,SAAS;CACI,CAAC;AAExB,MAAM,UAAU,GAAG;IACjB,GAAG,WAAW;IACd,MAAM,EAAE,SAAS;CACI,CAAC;AAExB,MAAM,UAAU,GAAG;IACjB,GAAG,WAAW;IACd,MAAM,EAAE,SAAS;CACI,CA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C,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;gBAC7E,KAAK,EAAE,MAAM;gBACb,IAAI;gBACJ,WAAW;aACZ,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;SACzE;KACF;IACD,OAAO,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACtC,CAAC","sourcesContent":["import { TranslationFunction, TranslationPack } from '../../i18n';\nimport { ExcludeStrict } from '../../types';\nimport { cap } from '../../utils';\n\nimport { AbsoluteVariant, DateTimeFormat, DateTimeVariant } from './DateTime.types';\nimport {\n ClockFormat,\n getEndOfWeek,\n getQuarter,\n getStartOfWeek,\n getWeek,\n getWeekYear\n} from './Input/utils';\n\nconst unitsInMs = {\n year: 24 * 60 * 60 * 1000 * 365,\n month: (24 * 60 * 60 * 1000 * 365) / 12,\n day: 24 * 60 * 60 * 1000,\n hour: 60 * 60 * 1000,\n minute: 60 * 1000,\n second: 1000\n} satisfies Partial<Record<Intl.RelativeTimeFormatUnit, number>>;\n\ntype TimeUnit = keyof typeof unitsInMs;\n\ntype DateTimeFormatOptions = {\n locale: string;\n format: DateTimeFormat;\n timeZone?: string;\n clockFormat?: ClockFormat;\n} & (\n | {\n variant: ExcludeStrict<DateTimeVariant, 'quarteryear'>;\n t?: TranslationFunction<TranslationPack>;\n }\n | { variant: 'quarteryear'; t: TranslationFunction<TranslationPack> }\n);\n\ntype TimeOptions = Pick<Intl.DateTimeFormatOptions, 'hour' | 'minute' | 'second' | 'hour12'>;\n\nconst timeShort = {\n hour: 'numeric',\n minute: 'numeric'\n} satisfies TimeOptions;\n\nconst timeShort12 = {\n ...timeShort,\n hour12: true\n} satisfies TimeOptions;\n\nconst timeShort24 = {\n ...timeShort,\n hour12: false\n} satisfies TimeOptions;\n\nconst timeLong = {\n ...timeShort,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong12 = {\n ...timeShort12,\n second: 'numeric'\n} satisfies TimeOptions;\n\nconst timeLong24 = {\n ...timeShort24,\n second: 'numeric'\n} satisfies TimeOptions;\n\ntype AddClockFormatToTimeKeys<Key extends DateTimeVariant> = Key extends `${string}time`\n ? `${Key}${'' | 12 | 24}`\n : Key;\n\nconst formatMapping = {\n date: {\n short: { year: 'numeric', month: 'short', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric' }\n },\n datetime: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort }\n },\n datetime12: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort12 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong12 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort12 }\n },\n datetime24: {\n short: { year: 'numeric', month: 'short', day: 'numeric', ...timeShort24 },\n long: { year: 'numeric', month: 'long', day: 'numeric', ...timeLong24 },\n numeric: { year: 'numeric', month: 'numeric', day: 'numeric', ...timeShort24 }\n },\n time: {\n short: timeShort,\n long: timeLong,\n numeric: timeShort\n },\n time12: {\n short: timeShort12,\n long: timeLong12,\n numeric: timeShort12\n },\n time24: {\n short: timeShort24,\n long: timeLong24,\n numeric: timeShort24\n },\n month: {\n short: { month: 'short' },\n long: { month: 'long' },\n numeric: { month: 'numeric' }\n },\n monthyear: {\n short: { year: 'numeric', month: 'short' },\n long: { year: 'numeric', month: 'long' },\n numeric: { year: 'numeric', month: 'numeric' }\n },\n week: {\n short: { month: 'short', day: 'numeric' },\n long: { month: 'long', day: 'numeric' },\n numeric: { month: 'numeric', day: 'numeric' }\n },\n year: {\n short: { year: 'numeric' },\n long: { year: 'numeric' },\n numeric: { year: '2-digit' }\n },\n relative: {\n short: { style: 'long', numeric: 'auto' },\n long: { style: 'long', numeric: 'auto' },\n numeric: { style: 'short', numeric: 'auto' }\n }\n} satisfies Record<\n AddClockFormatToTimeKeys<ExcludeStrict<AbsoluteVariant, 'quarteryear'>>,\n Record<DateTimeFormat, Intl.DateTimeFormatOptions>\n> &\n Record<'relative', Record<DateTimeFormat, Intl.RelativeTimeFormatOptions>>;\n\nconst dateTimeFormatCache: Record<\n // locale\n string,\n Record<\n // timeZone\n string,\n Map<Intl.DateTimeFormatOptions, Intl.DateTimeFormat>\n >\n> = {};\n\nconst relativeTimeFormatCache: Record<\n // locale\n string,\n Map<Intl.RelativeTimeFormatOptions, Intl.RelativeTimeFormat>\n> = {};\n\nconst displayNamesCache: Record<\n // locale\n string,\n Intl.DateTimeDisplayNames\n> = {};\n\nexport function formatDateTime(\n value: Date,\n { t, locale, format, variant, clockFormat, timeZone }: DateTimeFormatOptions\n) {\n const getFormattedDate = (\n date: Date,\n dateVariant: ExcludeStrict<AbsoluteVariant, 'quarteryear'>,\n overrideTimeZone?: string\n ) => {\n const resolvedVariant: AddClockFormatToTimeKeys<typeof dateVariant> =\n dateVariant === 'time' || dateVariant === 'datetime'\n ? `${dateVariant}${clockFormat ?? ''}`\n : dateVariant;\n const resolvedTimeZone = overrideTimeZone ?? timeZone;\n const resolvedOptions = formatMapping[resolvedVariant][format];\n\n dateTimeFormatCache[locale] ??= {};\n dateTimeFormatCache[locale][`${resolvedTimeZone}`] ??= new Map();\n\n const map = dateTimeFormatCache[locale][`${resolvedTimeZone}`];\n\n if (!map.has(resolvedOptions)) {\n map.set(\n resolvedOptions,\n new Intl.DateTimeFormat(locale, {\n ...resolvedOptions,\n timeZone: resolvedTimeZone\n })\n );\n }\n\n return map.get(resolvedOptions)!.format(date);\n };\n\n const relativeTimeFormatter = (relativeValue: number, unit: TimeUnit) => {\n const resolvedOptions = formatMapping.relative[format];\n\n relativeTimeFormatCache[locale] ??= new Map();\n const map = relativeTimeFormatCache[locale];\n\n if (!map.has(resolvedOptions)) {\n map.set(resolvedOptions, new Intl.RelativeTimeFormat(locale, resolvedOptions));\n }\n\n return map.get(resolvedOptions)!.format(relativeValue, unit);\n };\n\n const getUnitsElapsed = (date: Date, unit: TimeUnit): number => {\n let amount: number;\n const now = new Date();\n\n switch (unit) {\n case 'year':\n amount = date.getUTCFullYear() - now.getUTCFullYear();\n break;\n case 'month':\n if (date.getUTCFullYear() === now.getUTCFullYear()) {\n amount = date.getUTCMonth() - now.getUTCMonth();\n } else if (date < now) {\n amount = (11 - date.getUTCMonth() + now.getUTCMonth() + 1) * -1;\n } else {\n amount = 11 - now.getUTCMonth() + date.getUTCMonth() + 1;\n }\n break;\n case 'day':\n if (date.getUTCMonth() === now.getUTCMonth()) {\n amount = date.getUTCDate() - now.getUTCDate();\n } else if (date < now) {\n const maximalDayOfMonth = new Date(\n Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 0)\n ).getUTCDate();\n amount = (maximalDayOfMonth - date.getUTCDate() + now.getUTCDate()) * -1;\n } else {\n const maximalDayOfMonth = new Date(\n Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 0)\n ).getUTCDate();\n amount = maximalDayOfMonth - now.getUTCDate() + date.getUTCDate() + 1;\n }\n break;\n case 'hour':\n if (date.getUTCDate() === now.getUTCDate()) {\n amount = date.getUTCHours() - now.getUTCHours();\n } else if (date < now) {\n amount = (23 - date.getUTCHours() + now.getUTCHours() + 1) * -1;\n } else {\n amount = 23 - now.getUTCHours() + date.getUTCHours() + 1;\n }\n break;\n case 'minute':\n if (date.getUTCHours() === now.getUTCHours()) {\n amount = date.getUTCMinutes() - now.getUTCMinutes();\n } else if (date < now) {\n amount = (59 - date.getUTCMinutes() + now.getUTCMinutes() + 1) * -1;\n } else {\n amount = 59 - now.getUTCMinutes() + date.getUTCMinutes() + 1;\n }\n break;\n default:\n amount = 0;\n break;\n }\n return amount;\n };\n\n const getRelativeTime = (date: Date) => {\n let elapsed = date.getTime() - Date.now();\n // Deliberately reduce precision to 1 minute\n if (Math.abs(elapsed) < 60000) elapsed = 0;\n const unit = (Object.keys(unitsInMs).find(u => Math.abs(elapsed) >= unitsInMs[u as TimeUnit]) ||\n 'second') as TimeUnit;\n const amount = getUnitsElapsed(date, unit);\n\n return relativeTimeFormatter(amount, unit);\n };\n\n const getFormattedWeek = (date: Date) => {\n displayNamesCache[locale] ??= new Intl.DisplayNames(locale, {\n style: 'long',\n type: 'dateTimeField'\n }) as Intl.DateTimeDisplayNames;\n\n const displayNames = displayNamesCache[locale];\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const startDate = getFormattedDate(getStartOfWeek(adjustedUTCDate), 'week', 'UTC');\n const endDate = getFormattedDate(getEndOfWeek(adjustedUTCDate), 'week', 'UTC');\n return `${cap(displayNames.of('weekOfYear'))} ${getWeek(adjustedUTCDate)}, ${getWeekYear(\n adjustedUTCDate\n )} (${startDate} - ${endDate})`;\n };\n\n const getFormattedQuarterYear = (date: Date) => {\n const formattedYear = getFormattedDate(date, 'year');\n const adjustedUTCDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n const quarterNumber = getQuarter(adjustedUTCDate);\n return `${t!(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n };\n\n switch (variant) {\n case 'relative':\n return getRelativeTime(value);\n case 'week':\n return getFormattedWeek(value);\n case 'quarteryear':\n return getFormattedQuarterYear(value);\n default:\n return getFormattedDate(value, variant);\n }\n}\n\nconst dayInMs = 24 * 60 * 60 * 1000;\nconst hourInMs = 60 * 60 * 1000;\nconst minuteInMs = 60 * 1000;\nconst secondInMs = 1000;\n\ninterface DurationFormatOptions {\n locale: string;\n significantUnits: 4 | 3 | 2 | 1;\n unitDisplay?: Intl.NumberFormatOptions['unitDisplay'];\n}\n\nconst numberFormatCache: Record<\n // locale\n string,\n Record<\n // unit\n string,\n Record<\n // unitDisplay\n string,\n Intl.NumberFormat\n >\n >\n> = {};\n\nexport function formatDuration(\n valueInMs: number,\n { locale, significantUnits, unitDisplay = 'narrow' }: DurationFormatOptions\n) {\n numberFormatCache[locale] ??= {};\n\n const sign = valueInMs < 0 ? '-' : '';\n const absMs = Math.abs(valueInMs);\n if (absMs < secondInMs) {\n numberFormatCache[locale].seconds ??= {};\n\n numberFormatCache[locale].seconds.narrow ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: 'second',\n unitDisplay: 'narrow'\n });\n\n return numberFormatCache[locale].seconds.narrow.format(0);\n }\n\n const durationParts = [\n { unit: 'day', value: Math.floor(absMs / dayInMs) },\n { unit: 'hour', value: Math.floor((absMs % dayInMs) / hourInMs) },\n { unit: 'minute', value: Math.floor((absMs % hourInMs) / minuteInMs) },\n { unit: 'second', value: Math.floor((absMs % minuteInMs) / secondInMs) }\n ];\n\n const result = [];\n for (let i = 0; result.length < significantUnits && i < durationParts.length; i += 1) {\n const { value, unit } = durationParts[i];\n\n if (value > 0) {\n numberFormatCache[locale][unit] ??= {};\n numberFormatCache[locale][unit][unitDisplay] ??= new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay\n });\n\n result.push(numberFormatCache[locale][unit][unitDisplay].format(value));\n }\n }\n return `${sign}${result.join(' ')}`;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAItE,MAAM,WAAW,iBAAkB,SAAQ,SAAS,EAAE,cAAc;IAClE,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAAG,eAAe,CAAC,CAAC;CAChD;AAED,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAgBrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import Link from '../Link';
|
|
4
|
+
import NoValue from '../NoValue/NoValue';
|
|
4
5
|
const EmailDisplay = forwardRef(({ value, displayText, variant = 'link', ...restProps }, ref) => {
|
|
5
|
-
const displayValue = value ?
|
|
6
|
+
const displayValue = value ? displayText || value : _jsx(NoValue, {});
|
|
6
7
|
return variant === 'text' || !value ? (_jsx("span", { ref: ref, ...restProps, children: displayValue })) : (_jsx(Link, { ref: ref, ...restProps, href: `mailto:${value}`, children: displayValue }));
|
|
7
8
|
});
|
|
8
9
|
export default EmailDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmailDisplay.js","sourceRoot":"","sources":["../../../src/components/Email/EmailDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,IAAI,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"EmailDisplay.js","sourceRoot":"","sources":["../../../src/components/Email/EmailDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAgBzC,MAAM,YAAY,GAAwD,UAAU,CAClF,CACE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,EAAsC,EAC1F,GAA6B,EAC7B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,KAAC,OAAO,KAAG,CAAC;IAChE,OAAO,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,eAAM,GAAG,EAAE,GAAG,KAAM,SAAS,YAC1B,YAAY,GACR,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,UAAU,KAAK,EAAE,YAC7E,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport Link from '../Link';\nimport NoValue from '../NoValue/NoValue';\n\nexport interface EmailDisplayProps extends BaseProps, NoChildrenProp {\n /** Email address, no 'mailto:' scheme */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'link'\n */\n variant?: 'link' | 'text';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement>;\n}\n\nconst EmailDisplay: FunctionComponent<EmailDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<EmailDisplayProps>,\n ref: EmailDisplayProps['ref']\n ) => {\n const displayValue = value ? displayText || value : <NoValue />;\n return variant === 'text' || !value ? (\n <span ref={ref} {...restProps}>\n {displayValue}\n </span>\n ) : (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={`mailto:${value}`}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default EmailDisplay;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldValueList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAGtE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldValueList.d.ts","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAGtE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWlF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,uBAAwB,SAAQ,UAAU;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,mBAAoB,SAAQ,SAAS,EAAE,cAAc,EAAE,UAAU;IAChF,qDAAqD;IACrD,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;CAClD;AAED,eAAO,MAAM,eAAe,wGAE3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,wGAE5B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,+HAuB/B,CAAC;AAIH,eAAO,MAAM,uBAAuB,yGAAe,CAAC;AAEpD,eAAO,MAAM,cAAc,sCACqB,uBAAuB;;CAwBtE,CAAC;;;;AAmDF,wBAAqE"}
|
|
@@ -7,6 +7,7 @@ import { useBreakpoint, useConsolidatedRef, useTestIds } from '../../hooks';
|
|
|
7
7
|
import { defaultThemeProp } from '../../theme';
|
|
8
8
|
import ShowMoreLess from '../ShowMoreLess';
|
|
9
9
|
import { withTestIds } from '../../utils';
|
|
10
|
+
import NoValue from '../NoValue/NoValue';
|
|
10
11
|
import { getFieldValueListTestIds, getFieldValueItemTestIds } from './FieldValueList.test-ids';
|
|
11
12
|
export const StyledFieldName = styled.dt `
|
|
12
13
|
word-break: break-word;
|
|
@@ -43,7 +44,7 @@ export const StyledStackedFieldValue = styled.div ``;
|
|
|
43
44
|
export const FieldValueItem = withTestIds(({ testId, name, value, variant = 'inline' }) => {
|
|
44
45
|
const testIds = useTestIds(testId, getFieldValueItemTestIds);
|
|
45
46
|
const displayValue = typeof value === 'string' ? _jsx(ShowMoreLess, { lines: 3, children: value }) : value;
|
|
46
|
-
const labelAndValue = (_jsxs(_Fragment, { children: [_jsx(StyledLabel, { "data-testid": testIds.name, as: StyledFieldName, children: name }), _jsx(StyledFieldValue, { "data-testid": testIds.value, children: value ? displayValue : _jsx(
|
|
47
|
+
const labelAndValue = (_jsxs(_Fragment, { children: [_jsx(StyledLabel, { "data-testid": testIds.name, as: StyledFieldName, children: name }), _jsx(StyledFieldValue, { "data-testid": testIds.value, children: value ? displayValue : _jsx(NoValue, {}) })] }));
|
|
47
48
|
return variant === 'stacked' ? (_jsx(StyledStackedFieldValue, { "data-testid": testIds.root, children: labelAndValue })) : (_jsx(_Fragment, { children: labelAndValue }));
|
|
48
49
|
}, getFieldValueItemTestIds);
|
|
49
50
|
const FieldValueList = forwardRef(({ testId, fields, variant = 'inline', ...restProps }, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqC,UAAU,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../src/components/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqC,UAAU,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAwB/F,MAAM,CAAC,MAA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O,CACL,KAAC,cAAc,IACb,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,OAAO,EACL,CAAC,YAAY,IAAI,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,uBAAuB;oBACjE,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,QAAQ,IAET,EAAE,IAAI,IAAI,CACf,CACH,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["import { ReactNode, FunctionComponent, Ref, forwardRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp, TestIdProp } from '../../types';\nimport Grid from '../Grid';\nimport { StyledLabel } from '../Label';\nimport { useBreakpoint, useConsolidatedRef, useTestIds } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport ShowMoreLess from '../ShowMoreLess';\nimport { withTestIds } from '../../utils';\nimport NoValue from '../NoValue/NoValue';\n\nimport { getFieldValueListTestIds, getFieldValueItemTestIds } from './FieldValueList.test-ids';\n\nexport type FieldValueVariant = 'inline' | 'stacked';\n\nexport interface FieldValueListItemProps extends TestIdProp {\n name: string;\n value?: ReactNode;\n variant?: FieldValueVariant;\n}\n\nexport interface FieldValueListItem extends FieldValueListItemProps {\n id?: string;\n}\n\nexport interface FieldValueListProps extends BaseProps, NoChildrenProp, TestIdProp {\n /** The set of field values to render in the list. */\n fields: FieldValueListItem[];\n /**\n * Determines if the field and values should be displayed on the same line, or stacked with the field above the value.\n * @default 'inline'\n */\n variant?: FieldValueVariant | 'value-comparison';\n}\n\nexport const StyledFieldName = styled.dt`\n word-break: break-word;\n`;\n\nexport const StyledFieldValue = styled.dd`\n word-break: break-word;\n`;\n\nexport type StyledFieldValueListProps = Pick<FieldValueListProps, 'variant'>;\n\nexport const StyledFieldValueList = styled.dl<StyledFieldValueListProps>(({ variant, theme }) => {\n return css`\n width: 100%;\n\n ${variant === 'value-comparison' &&\n css`\n dt {\n width: 100%;\n }\n dd {\n text-align: end;\n padding-inline-start: calc(2 * ${theme.base.spacing});\n }\n ${StyledLabel} {\n max-width: unset;\n }\n dd:not(:last-of-type),\n dt:not(:last-of-type) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n padding-bottom: calc(0.5 * ${theme.base.spacing});\n }\n `}\n `;\n});\n\nStyledFieldValueList.defaultProps = defaultThemeProp;\n\nexport const StyledStackedFieldValue = styled.div``;\n\nexport const FieldValueItem = withTestIds(\n ({ testId, name, value, variant = 'inline' }: FieldValueListItemProps) => {\n const testIds = useTestIds(testId, getFieldValueItemTestIds);\n\n const displayValue =\n typeof value === 'string' ? <ShowMoreLess lines={3}>{value}</ShowMoreLess> : value;\n\n const labelAndValue = (\n <>\n <StyledLabel data-testid={testIds.name} as={StyledFieldName}>\n {name}\n </StyledLabel>\n <StyledFieldValue data-testid={testIds.value}>\n {value ? displayValue : <NoValue />}\n </StyledFieldValue>\n </>\n );\n\n return variant === 'stacked' ? (\n <StyledStackedFieldValue data-testid={testIds.root}>{labelAndValue}</StyledStackedFieldValue>\n ) : (\n <>{labelAndValue}</>\n );\n },\n getFieldValueItemTestIds\n);\n\nconst FieldValueList: FunctionComponent<FieldValueListProps & ForwardProps> = forwardRef(\n (\n { testId, fields, variant = 'inline', ...restProps }: FieldValueListProps,\n ref: Ref<HTMLDivElement>\n ) => {\n const testIds = useTestIds(testId, getFieldValueListTestIds);\n\n const fieldValueListRef = useConsolidatedRef<HTMLDivElement>(ref);\n\n const isXSContentWidthOrAbove = useBreakpoint('xs', {\n breakpointRef: fieldValueListRef,\n themeProp: 'content-width'\n });\n\n return (\n <Grid\n data-testid={testIds.root}\n {...restProps}\n ref={fieldValueListRef}\n container={{\n cols:\n ['inline', 'value-comparison'].includes(variant) && isXSContentWidthOrAbove\n ? '16ch minmax(0, 1fr)'\n : 'minmax(0, 1fr)',\n colGap: variant !== 'value-comparison' ? 2 : 0,\n rowGap: variant !== 'value-comparison' ? 1 : 0.5\n }}\n as={StyledFieldValueList}\n variant={variant}\n >\n {fields.map(({ id, name, value, variant: fieldVariant }) => {\n return (\n <FieldValueItem\n name={name}\n value={value}\n variant={\n (fieldVariant ?? variant) === 'stacked' || !isXSContentWidthOrAbove\n ? 'stacked'\n : 'inline'\n }\n key={id ?? name}\n />\n );\n })}\n </Grid>\n );\n }\n);\n\nexport default withTestIds(FieldValueList, getFieldValueListTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/File/FileDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FileDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/File/FileDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAItE,OAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,aAAa,EAAE,WAAW,GAAG,YAAY,CAAC,EACrD,SAAS,EACT,cAAc;IAChB,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,iBAAiB,GAAG,eAAe,CAAC,CAAC;CACjE;AAED,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CA0CnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import Link from '../Link';
|
|
4
|
+
import NoValue from '../NoValue/NoValue';
|
|
4
5
|
import FileItem from './FileItem';
|
|
5
6
|
const FileDisplay = forwardRef(({ displayText, value, variant, thumbnail, onPreview, onDownload, ...restProps }, ref) => {
|
|
6
7
|
if (variant === 'text' || !value) {
|
|
7
|
-
return (_jsx("span", { ref: ref, ...restProps, children: value ? displayText || value : _jsx(
|
|
8
|
+
return (_jsx("span", { ref: ref, ...restProps, children: value ? displayText || value : _jsx(NoValue, {}) }));
|
|
8
9
|
}
|
|
9
10
|
if (variant === 'link')
|
|
10
11
|
return (_jsx(Link, { ref: ref, ...restProps, href: value, children: displayText || value }));
|