@chayns-components/core 5.0.0-beta.191 → 5.0.0-beta.196
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/accordion/Accordion.d.ts +4 -0
- package/lib/components/accordion/Accordion.js +5 -3
- package/lib/components/accordion/Accordion.js.map +1 -1
- package/lib/components/accordion/accordion-body/AccordionBody.d.ts +4 -0
- package/lib/components/accordion/accordion-body/AccordionBody.js +4 -3
- package/lib/components/accordion/accordion-body/AccordionBody.js.map +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js +8 -2
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/components/date-info/DateInfo.d.ts +40 -0
- package/lib/components/date-info/DateInfo.js +109 -0
- package/lib/components/date-info/DateInfo.js.map +1 -0
- package/lib/components/date-info/utils/format.d.ts +43 -0
- package/lib/components/date-info/utils/format.js +288 -0
- package/lib/components/date-info/utils/format.js.map +1 -0
- package/lib/components/date-info/utils/language.d.ts +1 -0
- package/lib/components/date-info/utils/language.js +34 -0
- package/lib/components/date-info/utils/language.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/types/chayns.d.ts +2 -0
- package/lib/types/chayns.js.map +1 -1
- package/package.json +11 -10
|
@@ -80,6 +80,10 @@ export type AccordionProps = {
|
|
|
80
80
|
* Additional elements to be displayed in the header next to the title.
|
|
81
81
|
*/
|
|
82
82
|
titleElement?: ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* This will render the Accordion closed on the first render.
|
|
85
|
+
*/
|
|
86
|
+
shouldRenderClosed?: boolean;
|
|
83
87
|
};
|
|
84
88
|
declare const Accordion: FC<AccordionProps>;
|
|
85
89
|
export default Accordion;
|
|
@@ -38,7 +38,8 @@ const Accordion = _ref => {
|
|
|
38
38
|
searchPlaceholder,
|
|
39
39
|
shouldHideBackground = false,
|
|
40
40
|
title,
|
|
41
|
-
titleElement
|
|
41
|
+
titleElement,
|
|
42
|
+
shouldRenderClosed = false
|
|
42
43
|
} = _ref;
|
|
43
44
|
const {
|
|
44
45
|
openAccordionUuid,
|
|
@@ -109,9 +110,10 @@ const Accordion = _ref => {
|
|
|
109
110
|
titleElement: titleElement
|
|
110
111
|
}), /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
111
112
|
initial: false
|
|
112
|
-
}, isOpen && /*#__PURE__*/_react.default.createElement(_AccordionBody.default, {
|
|
113
|
+
}, (isOpen || shouldRenderClosed) && /*#__PURE__*/_react.default.createElement(_AccordionBody.default, {
|
|
113
114
|
maxHeight: bodyMaxHeight,
|
|
114
|
-
onScroll: onBodyScroll
|
|
115
|
+
onScroll: onBodyScroll,
|
|
116
|
+
shouldHideBody: shouldRenderClosed && !isOpen
|
|
115
117
|
}, children)))));
|
|
116
118
|
};
|
|
117
119
|
Accordion.displayName = 'Accordion';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_uuid","_AccordionBody","_interopRequireDefault","_AccordionGroup","_AccordionHead","_Accordion","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AccordionContext","React","createContext","isWrapped","exports","displayName","Accordion","_ref","bodyMaxHeight","children","icon","isDefaultOpen","isDisabled","isFixed","isTitleGreyed","onBodyScroll","onClose","onOpen","onSearchChange","rightElement","searchIcon","searchPlaceholder","shouldHideBackground","title","titleElement","openAccordionUuid","updateOpenAccordionUuid","useContext","AccordionGroupContext","isParentWrapped","isAccordionOpen","setIsAccordionOpen","useState","uuid","useUuid","isInitialRenderRef","useRef","isInGroup","isOpen","handleHeadClick","useCallback","currentIsAccordionOpen","useEffect","current","shouldOnlyOpen","accordionContextProviderValue","useMemo","createElement","StyledAccordion","className","Provider","value","MotionConfig","transition","type","onClick","AnimatePresence","initial","maxHeight","onScroll","_default"],"sources":["../../../src/components/accordion/Accordion.tsx"],"sourcesContent":["import { AnimatePresence, MotionConfig } from 'framer-motion';\nimport React, {\n ChangeEventHandler,\n FC,\n ReactNode,\n UIEvent,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport AccordionBody from './accordion-body/AccordionBody';\nimport { AccordionGroupContext } from './accordion-group/AccordionGroup';\nimport AccordionHead from './accordion-head/AccordionHead';\nimport { StyledAccordion } from './Accordion.styles';\n\nexport const AccordionContext = React.createContext({ isWrapped: false });\n\nAccordionContext.displayName = 'AccordionContext';\n\nexport type AccordionProps = {\n /**\n * Maximum height of the accordion body element. This automatically makes the content of the\n * body element scrollable.\n */\n bodyMaxHeight?: number;\n /**\n * The content of the accordion body\n */\n children: ReactNode;\n /**\n * The icon that is displayed in front of the title\n */\n icon?: string;\n /**\n * This can be used to automatically expand the Accordion during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This will disable the Accordion so that it cannot be opened and will gray out the title.\n */\n isDisabled?: boolean;\n /**\n * This can be used so that the Accordion cannot be opened or closed.\n * In addition, in this case the icon is exchanged to mark the Accordions.\n */\n isFixed?: boolean;\n /**\n * This will gray out the title of the Accordion to indicate hidden content, for example.\n */\n isTitleGreyed?: boolean;\n /**\n * This value must be set for nested Accordions. This adjusts the style of\n * the head and the padding of the content.\n */\n isWrapped?: boolean;\n /**\n * Function that is executed when the accordion body will be scrolled\n */\n onBodyScroll?: (event: UIEvent<HTMLDivElement>) => void;\n /**\n * Function that is executed when the accordion will be closed.\n */\n onClose?: VoidFunction;\n /**\n * Function that is executed when the accordion will be opened.\n */\n onOpen?: VoidFunction;\n /**\n * Function that is executed when the text of the search in the accordion\n * head changes. When this function is given, the search field is displayed\n * in the Accordion Head.\n */\n onSearchChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Content to be displayed on the right side in the head of the Accordion\n */\n rightElement?: ReactNode;\n /**\n * Icon to be displayed on the right side in the search input\n */\n searchIcon?: string[];\n /**\n * The placeholder to be used for the search\n */\n searchPlaceholder?: string;\n /**\n * This will hide the background color of the accordion\n */\n shouldHideBackground?: boolean;\n /**\n * Title of the Accordion displayed in the head\n */\n title: string;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n};\n\nconst Accordion: FC<AccordionProps> = ({\n bodyMaxHeight,\n children,\n icon,\n isDefaultOpen = false,\n isDisabled = false,\n isFixed = false,\n isTitleGreyed = false,\n isWrapped = false,\n onBodyScroll,\n onClose,\n onOpen,\n onSearchChange,\n rightElement,\n searchIcon,\n searchPlaceholder,\n shouldHideBackground = false,\n title,\n titleElement,\n}) => {\n const { openAccordionUuid, updateOpenAccordionUuid } = useContext(AccordionGroupContext);\n const { isWrapped: isParentWrapped } = useContext(AccordionContext);\n\n const [isAccordionOpen, setIsAccordionOpen] = useState<boolean>(isDefaultOpen);\n\n const uuid = useUuid();\n\n const isInitialRenderRef = useRef(true);\n\n const isInGroup = typeof updateOpenAccordionUuid === 'function';\n\n const isOpen = isInGroup ? openAccordionUuid === uuid : isAccordionOpen;\n\n const handleHeadClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid);\n }\n\n setIsAccordionOpen((currentIsAccordionOpen) => !currentIsAccordionOpen);\n }, [isDisabled, updateOpenAccordionUuid, uuid]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isOpen) {\n if (typeof onOpen === 'function') {\n onOpen();\n }\n } else if (typeof onClose === 'function') {\n onClose();\n }\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isDefaultOpen && typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenAccordionUuid, uuid]);\n\n const accordionContextProviderValue = useMemo(() => ({ isWrapped }), [isWrapped]);\n\n return (\n <StyledAccordion\n className=\"beta-chayns-accordion\"\n isOpen={isOpen}\n isParentWrapped={isParentWrapped}\n isWrapped={isWrapped}\n shouldHideBackground={shouldHideBackground}\n >\n <AccordionContext.Provider value={accordionContextProviderValue}>\n <MotionConfig transition={{ type: 'tween' }}>\n <AccordionHead\n icon={icon}\n isOpen={isOpen}\n isFixed={isFixed}\n isTitleGreyed={isTitleGreyed || isDisabled}\n isWrapped={isWrapped}\n onClick={handleHeadClick}\n onSearchChange={onSearchChange}\n rightElement={rightElement}\n searchIcon={searchIcon}\n searchPlaceholder={searchPlaceholder}\n title={title}\n titleElement={titleElement}\n />\n <AnimatePresence initial={false}>\n {isOpen && (\n <AccordionBody maxHeight={bodyMaxHeight} onScroll={onBodyScroll}>\n {children}\n </AccordionBody>\n )}\n </AnimatePresence>\n </MotionConfig>\n </AccordionContext.Provider>\n </StyledAccordion>\n );\n};\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAYA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAAqD,SAAAK,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA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SAAS,EAAEA,SAAU;IACrBoD,OAAO,EAAEhB,eAAgB;IACzBrB,cAAc,EAAEA,cAAe;IAC/BC,YAAY,EAAEA,YAAa;IAC3BC,UAAU,EAAEA,UAAW;IACvBC,iBAAiB,EAAEA,iBAAkB;IACrCE,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,CAC9B,CAAC,eACFtD,MAAA,CAAAU,OAAA,CAAAmE,aAAA,CAAC/E,aAAA,CAAAwF,eAAe;IAACC,OAAO,EAAE;EAAM,GAC3BnB,MAAM,iBACHpE,MAAA,CAAAU,OAAA,CAAAmE,aAAA,CAAC1E,cAAA,CAAAO,OAAa;IAAC8E,SAAS,EAAElD,aAAc;IAACmD,QAAQ,EAAE5C;EAAa,GAC3DN,QACU,CAEN,CACP,CACS,CACd,CAAC;AAE1B,CAAC;AAEDH,SAAS,CAACD,WAAW,GAAG,WAAW;AAAC,IAAAuD,QAAA,GAErBtD,SAAS;AAAAF,OAAA,CAAAxB,OAAA,GAAAgF,QAAA"}
|
|
1
|
+
{"version":3,"file":"Accordion.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_uuid","_AccordionBody","_interopRequireDefault","_AccordionGroup","_AccordionHead","_Accordion","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AccordionContext","React","createContext","isWrapped","exports","displayName","Accordion","_ref","bodyMaxHeight","children","icon","isDefaultOpen","isDisabled","isFixed","isTitleGreyed","onBodyScroll","onClose","onOpen","onSearchChange","rightElement","searchIcon","searchPlaceholder","shouldHideBackground","title","titleElement","shouldRenderClosed","openAccordionUuid","updateOpenAccordionUuid","useContext","AccordionGroupContext","isParentWrapped","isAccordionOpen","setIsAccordionOpen","useState","uuid","useUuid","isInitialRenderRef","useRef","isInGroup","isOpen","handleHeadClick","useCallback","currentIsAccordionOpen","useEffect","current","shouldOnlyOpen","accordionContextProviderValue","useMemo","createElement","StyledAccordion","className","Provider","value","MotionConfig","transition","type","onClick","AnimatePresence","initial","maxHeight","onScroll","shouldHideBody","_default"],"sources":["../../../src/components/accordion/Accordion.tsx"],"sourcesContent":["import { AnimatePresence, MotionConfig } from 'framer-motion';\nimport React, {\n ChangeEventHandler,\n FC,\n ReactNode,\n UIEvent,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport AccordionBody from './accordion-body/AccordionBody';\nimport { AccordionGroupContext } from './accordion-group/AccordionGroup';\nimport AccordionHead from './accordion-head/AccordionHead';\nimport { StyledAccordion } from './Accordion.styles';\n\nexport const AccordionContext = React.createContext({ isWrapped: false });\n\nAccordionContext.displayName = 'AccordionContext';\n\nexport type AccordionProps = {\n /**\n * Maximum height of the accordion body element. This automatically makes the content of the\n * body element scrollable.\n */\n bodyMaxHeight?: number;\n /**\n * The content of the accordion body\n */\n children: ReactNode;\n /**\n * The icon that is displayed in front of the title\n */\n icon?: string;\n /**\n * This can be used to automatically expand the Accordion during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This will disable the Accordion so that it cannot be opened and will gray out the title.\n */\n isDisabled?: boolean;\n /**\n * This can be used so that the Accordion cannot be opened or closed.\n * In addition, in this case the icon is exchanged to mark the Accordions.\n */\n isFixed?: boolean;\n /**\n * This will gray out the title of the Accordion to indicate hidden content, for example.\n */\n isTitleGreyed?: boolean;\n /**\n * This value must be set for nested Accordions. This adjusts the style of\n * the head and the padding of the content.\n */\n isWrapped?: boolean;\n /**\n * Function that is executed when the accordion body will be scrolled\n */\n onBodyScroll?: (event: UIEvent<HTMLDivElement>) => void;\n /**\n * Function that is executed when the accordion will be closed.\n */\n onClose?: VoidFunction;\n /**\n * Function that is executed when the accordion will be opened.\n */\n onOpen?: VoidFunction;\n /**\n * Function that is executed when the text of the search in the accordion\n * head changes. When this function is given, the search field is displayed\n * in the Accordion Head.\n */\n onSearchChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Content to be displayed on the right side in the head of the Accordion\n */\n rightElement?: ReactNode;\n /**\n * Icon to be displayed on the right side in the search input\n */\n searchIcon?: string[];\n /**\n * The placeholder to be used for the search\n */\n searchPlaceholder?: string;\n /**\n * This will hide the background color of the accordion\n */\n shouldHideBackground?: boolean;\n /**\n * Title of the Accordion displayed in the head\n */\n title: string;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n /**\n * This will render the Accordion closed on the first render.\n */\n shouldRenderClosed?: boolean;\n};\n\nconst Accordion: FC<AccordionProps> = ({\n bodyMaxHeight,\n children,\n icon,\n isDefaultOpen = false,\n isDisabled = false,\n isFixed = false,\n isTitleGreyed = false,\n isWrapped = false,\n onBodyScroll,\n onClose,\n onOpen,\n onSearchChange,\n rightElement,\n searchIcon,\n searchPlaceholder,\n shouldHideBackground = false,\n title,\n titleElement,\n shouldRenderClosed = false,\n}) => {\n const { openAccordionUuid, updateOpenAccordionUuid } = useContext(AccordionGroupContext);\n const { isWrapped: isParentWrapped } = useContext(AccordionContext);\n\n const [isAccordionOpen, setIsAccordionOpen] = useState<boolean>(isDefaultOpen);\n\n const uuid = useUuid();\n\n const isInitialRenderRef = useRef(true);\n\n const isInGroup = typeof updateOpenAccordionUuid === 'function';\n\n const isOpen = isInGroup ? openAccordionUuid === uuid : isAccordionOpen;\n\n const handleHeadClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid);\n }\n\n setIsAccordionOpen((currentIsAccordionOpen) => !currentIsAccordionOpen);\n }, [isDisabled, updateOpenAccordionUuid, uuid]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isOpen) {\n if (typeof onOpen === 'function') {\n onOpen();\n }\n } else if (typeof onClose === 'function') {\n onClose();\n }\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isDefaultOpen && typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenAccordionUuid, uuid]);\n\n const accordionContextProviderValue = useMemo(() => ({ isWrapped }), [isWrapped]);\n\n return (\n <StyledAccordion\n className=\"beta-chayns-accordion\"\n isOpen={isOpen}\n isParentWrapped={isParentWrapped}\n isWrapped={isWrapped}\n shouldHideBackground={shouldHideBackground}\n >\n <AccordionContext.Provider value={accordionContextProviderValue}>\n <MotionConfig transition={{ type: 'tween' }}>\n <AccordionHead\n icon={icon}\n isOpen={isOpen}\n isFixed={isFixed}\n isTitleGreyed={isTitleGreyed || isDisabled}\n isWrapped={isWrapped}\n onClick={handleHeadClick}\n onSearchChange={onSearchChange}\n rightElement={rightElement}\n searchIcon={searchIcon}\n searchPlaceholder={searchPlaceholder}\n title={title}\n titleElement={titleElement}\n />\n <AnimatePresence initial={false}>\n {(isOpen || shouldRenderClosed) && (\n <AccordionBody\n maxHeight={bodyMaxHeight}\n onScroll={onBodyScroll}\n shouldHideBody={shouldRenderClosed && !isOpen}\n >\n {children}\n </AccordionBody>\n )}\n </AnimatePresence>\n </MotionConfig>\n </AccordionContext.Provider>\n </StyledAccordion>\n );\n};\n\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAYA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,cAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAAqD,SAAAK,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;A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BACxCrF,MAAA,CAAAU,OAAA,CAAAoE,aAAA,CAACxE,cAAA,CAAAI,OAAa;IACV8B,IAAI,EAAEA,IAAK;IACX6B,MAAM,EAAEA,MAAO;IACf1B,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAa,IAAIF,UAAW;IAC3CT,SAAS,EAAEA,SAAU;IACrBqD,OAAO,EAAEhB,eAAgB;IACzBtB,cAAc,EAAEA,cAAe;IAC/BC,YAAY,EAAEA,YAAa;IAC3BC,UAAU,EAAEA,UAAW;IACvBC,iBAAiB,EAAEA,iBAAkB;IACrCE,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,CAC9B,CAAC,eACFtD,MAAA,CAAAU,OAAA,CAAAoE,aAAA,CAAChF,aAAA,CAAAyF,eAAe;IAACC,OAAO,EAAE;EAAM,GAC3B,CAACnB,MAAM,IAAId,kBAAkB,kBAC1BvD,MAAA,CAAAU,OAAA,CAAAoE,aAAA,CAAC3E,cAAA,CAAAO,OAAa;IACV+E,SAAS,EAAEnD,aAAc;IACzBoD,QAAQ,EAAE7C,YAAa;IACvB8C,cAAc,EAAEpC,kBAAkB,IAAI,CAACc;EAAO,GAE7C9B,QACU,CAEN,CACP,CACS,CACd,CAAC;AAE1B,CAAC;AAEDH,SAAS,CAACD,WAAW,GAAG,WAAW;AAAC,IAAAyD,QAAA,GAErBxD,SAAS;AAAAF,OAAA,CAAAxB,OAAA,GAAAkF,QAAA"}
|
|
@@ -9,6 +9,10 @@ export type AccordionBodyProps = {
|
|
|
9
9
|
* Function that is executed when the element will be scrolled
|
|
10
10
|
*/
|
|
11
11
|
onScroll?: (event: UIEvent<HTMLDivElement>) => void;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
shouldHideBody: boolean;
|
|
12
16
|
};
|
|
13
17
|
declare const AccordionBody: FC<AccordionBodyProps>;
|
|
14
18
|
export default AccordionBody;
|
|
@@ -13,15 +13,16 @@ const AccordionBody = _ref => {
|
|
|
13
13
|
let {
|
|
14
14
|
children,
|
|
15
15
|
maxHeight,
|
|
16
|
-
onScroll
|
|
16
|
+
onScroll,
|
|
17
|
+
shouldHideBody
|
|
17
18
|
} = _ref;
|
|
18
19
|
const AccordionGroupContextProviderValue = (0, _react.useMemo)(() => ({
|
|
19
20
|
openAccordionUuid: undefined
|
|
20
21
|
}), []);
|
|
21
22
|
return /*#__PURE__*/_react.default.createElement(_AccordionBody.StyledMotionAccordionBody, {
|
|
22
23
|
animate: {
|
|
23
|
-
height: 'auto',
|
|
24
|
-
opacity: 1
|
|
24
|
+
height: shouldHideBody ? '0' : 'auto',
|
|
25
|
+
opacity: shouldHideBody ? 0 : 1
|
|
25
26
|
},
|
|
26
27
|
className: "beta-chayns-accordion-body",
|
|
27
28
|
exit: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionBody.js","names":["_react","_interopRequireWildcard","require","_AccordionGroup","_AccordionBody","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AccordionBody","_ref","children","maxHeight","onScroll","AccordionGroupContextProviderValue","useMemo","openAccordionUuid","undefined","createElement","StyledMotionAccordionBody","animate","height","opacity","className","exit","initial","AccordionGroupContext","Provider","value","displayName","_default","exports"],"sources":["../../../../src/components/accordion/accordion-body/AccordionBody.tsx"],"sourcesContent":["import React, { FC, UIEvent, useMemo } from 'react';\nimport type { AccordionProps } from '../Accordion';\nimport { AccordionGroupContext } from '../accordion-group/AccordionGroup';\nimport { StyledMotionAccordionBody } from './AccordionBody.styles';\n\nexport type AccordionBodyProps = {\n /**\n * Maximum height of the element. This automatically makes the content of the element scrollable.\n */\n maxHeight: AccordionProps['bodyMaxHeight'];\n /**\n * Function that is executed when the element will be scrolled\n */\n onScroll?: (event: UIEvent<HTMLDivElement>) => void;\n};\n\nconst AccordionBody: FC<AccordionBodyProps> = ({
|
|
1
|
+
{"version":3,"file":"AccordionBody.js","names":["_react","_interopRequireWildcard","require","_AccordionGroup","_AccordionBody","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AccordionBody","_ref","children","maxHeight","onScroll","shouldHideBody","AccordionGroupContextProviderValue","useMemo","openAccordionUuid","undefined","createElement","StyledMotionAccordionBody","animate","height","opacity","className","exit","initial","AccordionGroupContext","Provider","value","displayName","_default","exports"],"sources":["../../../../src/components/accordion/accordion-body/AccordionBody.tsx"],"sourcesContent":["import React, { FC, UIEvent, useMemo } from 'react';\nimport type { AccordionProps } from '../Accordion';\nimport { AccordionGroupContext } from '../accordion-group/AccordionGroup';\nimport { StyledMotionAccordionBody } from './AccordionBody.styles';\n\nexport type AccordionBodyProps = {\n /**\n * Maximum height of the element. This automatically makes the content of the element scrollable.\n */\n maxHeight: AccordionProps['bodyMaxHeight'];\n /**\n * Function that is executed when the element will be scrolled\n */\n onScroll?: (event: UIEvent<HTMLDivElement>) => void;\n /**\n *\n */\n shouldHideBody: boolean;\n};\n\nconst AccordionBody: FC<AccordionBodyProps> = ({\n children,\n maxHeight,\n onScroll,\n shouldHideBody,\n}) => {\n const AccordionGroupContextProviderValue = useMemo(\n () => ({ openAccordionUuid: undefined }),\n []\n );\n\n return (\n <StyledMotionAccordionBody\n animate={{ height: shouldHideBody ? '0' : 'auto', opacity: shouldHideBody ? 0 : 1 }}\n className=\"beta-chayns-accordion-body\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n maxHeight={maxHeight}\n onScroll={onScroll}\n >\n <AccordionGroupContext.Provider value={AccordionGroupContextProviderValue}>\n {children}\n </AccordionGroupContext.Provider>\n </StyledMotionAccordionBody>\n );\n};\n\nAccordionBody.displayName =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AA,YAAAA,MAAA;AAiBnE,MAAMW,aAAqC,GAAGC,IAAA,IAKxC;EAAA,IALyC;IAC3CC,QAAQ;IACRC,SAAS;IACTC,QAAQ;IACRC;EACJ,CAAC,GAAAJ,IAAA;EACG,MAAMK,kCAAkC,GAAG,IAAAC,cAAO,EAC9C,OAAO;IAAEC,iBAAiB,EAAEC;EAAU,CAAC,CAAC,EACxC,EACJ,CAAC;EAED,oBACIpC,MAAA,CAAAY,OAAA,CAAAyB,aAAA,CAACjC,cAAA,CAAAkC,yBAAyB;IACtBC,OAAO,EAAE;MAAEC,MAAM,EAAER,cAAc,GAAG,GAAG,GAAG,MAAM;MAAES,OAAO,EAAET,cAAc,GAAG,CAAC,GAAG;IAAE,CAAE;IACpFU,SAAS,EAAC,4BAA4B;IACtCC,IAAI,EAAE;MAAEH,MAAM,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAE,CAAE;IAChCG,OAAO,EAAE;MAAEJ,MAAM,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAE,CAAE;IACnCX,SAAS,EAAEA,SAAU;IACrBC,QAAQ,EAAEA;EAAS,gBAEnB/B,MAAA,CAAAY,OAAA,CAAAyB,aAAA,CAAClC,eAAA,CAAA0C,qBAAqB,CAACC,QAAQ;IAACC,KAAK,EAAEd;EAAmC,GACrEJ,QAC2B,CACT,CAAC;AAEpC,CAAC;AAEDF,aAAa,CAACqB,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAE7BtB,aAAa;AAAAuB,OAAA,CAAAtC,OAAA,GAAAqC,QAAA"}
|
|
@@ -136,11 +136,17 @@ const StyledMotionRightInput = (0, _styledComponents.default)(_framerMotion.moti
|
|
|
136
136
|
}},
|
|
137
137
|
0.45
|
|
138
138
|
);
|
|
139
|
+
color: ${_ref10 => {
|
|
140
|
+
let {
|
|
141
|
+
theme
|
|
142
|
+
} = _ref10;
|
|
143
|
+
return theme.text;
|
|
144
|
+
}};
|
|
139
145
|
grid-area: header;
|
|
140
|
-
padding: ${
|
|
146
|
+
padding: ${_ref11 => {
|
|
141
147
|
let {
|
|
142
148
|
hasIcon
|
|
143
|
-
} =
|
|
149
|
+
} = _ref11;
|
|
144
150
|
return hasIcon ? '5px 23px 5px 1px' : '5px 1px';
|
|
145
151
|
}};
|
|
146
152
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionHead.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledMotionAccordionHead","styled","motion","div","_ref","theme","text","exports","StyledMotionIconWrapper","_ref2","onClick","StyledMotionContentWrapper","_ref3","StyledMotionTitleWrapper","StyledMotionTitle","_ref4","isOpen","isWrapped","undefined","_ref5","_ref6","_ref7","_ref8","css","StyledMotionTitleElementWrapper","StyledRightWrapper","StyledMotionRightElementWrapper","StyledMotionRightInput","input","_ref9","_ref10","hasIcon","StyledMotionRightInputIconWrapper"],"sources":["../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionAccordionHeadProps = WithTheme<unknown>;\n\nexport const StyledMotionAccordionHead = styled(motion.div)`\n align-items: center;\n color: ${({ theme }: StyledMotionAccordionHeadProps) => theme.text};\n display: flex;\n overflow: hidden;\n padding: 4px 0;\n`;\n\nexport const StyledMotionIconWrapper = styled(motion.div)`\n align-items: center;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 25px;\n justify-content: center;\n width: 25px;\n`;\n\nexport const StyledMotionContentWrapper = styled(motion.div)`\n align-self: flex-start;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n`;\n\nexport const StyledMotionTitleWrapper = styled(motion.div)`\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n`;\n\ninterface StyledMotionTitleProps {\n isOpen: boolean;\n isWrapped: boolean;\n}\n\nexport const StyledMotionTitle = styled(motion.div)<StyledMotionTitleProps>`\n font-size: ${({ isOpen, isWrapped }) => (isOpen && !isWrapped ? '1.3rem' : undefined)};\n font-weight: ${({ isOpen, isWrapped }) => (isOpen && isWrapped ? 700 : 'normal')};\n grid-area: header;\n height: ${({ isWrapped }) => (isWrapped ? '100%' : undefined)};\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n white-space: ${({ isOpen, isWrapped }) => (isOpen && !isWrapped ? 'normal' : 'nowrap')};\n\n ${({ isWrapped }) =>\n isWrapped &&\n css`\n align-items: center;\n display: flex;\n `}\n`;\n\nexport const StyledMotionTitleElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n margin-left: 8px;\n`;\n\nexport const StyledRightWrapper = styled.div`\n display: grid;\n flex: 0 0 auto;\n grid-template-areas: 'right';\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n`;\n\nexport const StyledMotionRightElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n grid-area: header;\n justify-content: flex-end;\n`;\n\ntype StyledMotionRightInputProps = WithTheme<{\n hasIcon: boolean;\n}>;\n\nexport const StyledMotionRightInput = styled(motion.input)<StyledMotionRightInputProps>`\n background-color: transparent;\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ${({ theme }: StyledMotionRightInputProps) => theme['headline-rgb']},\n 0.45\n );\n grid-area: header;\n padding: ${({ hasIcon }) => (hasIcon ? '5px 23px 5px 1px' : '5px 1px')};\n`;\n\nexport const StyledMotionRightInputIconWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n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C,cAAc,CAAC;AAAA,CAAC;AAC5E;AACA;AACA;AACA,eAAeyB,MAAA;EAAA,IAAC;IAAEC;EAAQ,CAAC,GAAAD,MAAA;EAAA,OAAMC,OAAO,GAAG,kBAAkB,GAAG,SAAS;AAAA,CAAE;AAC3E,CAAC;
|
|
1
|
+
{"version":3,"file":"AccordionHead.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledMotionAccordionHead","styled","motion","div","_ref","theme","text","exports","StyledMotionIconWrapper","_ref2","onClick","StyledMotionContentWrapper","_ref3","StyledMotionTitleWrapper","StyledMotionTitle","_ref4","isOpen","isWrapped","undefined","_ref5","_ref6","_ref7","_ref8","css","StyledMotionTitleElementWrapper","StyledRightWrapper","StyledMotionRightElementWrapper","StyledMotionRightInput","input","_ref9","_ref10","_ref11","hasIcon","StyledMotionRightInputIconWrapper"],"sources":["../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionAccordionHeadProps = WithTheme<unknown>;\n\nexport const StyledMotionAccordionHead = styled(motion.div)`\n align-items: center;\n color: ${({ theme }: StyledMotionAccordionHeadProps) => theme.text};\n display: flex;\n overflow: hidden;\n padding: 4px 0;\n`;\n\nexport const StyledMotionIconWrapper = styled(motion.div)`\n align-items: center;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 25px;\n justify-content: center;\n width: 25px;\n`;\n\nexport const StyledMotionContentWrapper = styled(motion.div)`\n align-self: flex-start;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n`;\n\nexport const StyledMotionTitleWrapper = styled(motion.div)`\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n`;\n\ninterface StyledMotionTitleProps {\n isOpen: boolean;\n isWrapped: boolean;\n}\n\nexport const StyledMotionTitle = styled(motion.div)<StyledMotionTitleProps>`\n font-size: ${({ isOpen, isWrapped }) => (isOpen && !isWrapped ? '1.3rem' : undefined)};\n font-weight: ${({ isOpen, isWrapped }) => (isOpen && isWrapped ? 700 : 'normal')};\n grid-area: header;\n height: ${({ isWrapped }) => (isWrapped ? '100%' : undefined)};\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n white-space: ${({ isOpen, isWrapped }) => (isOpen && !isWrapped ? 'normal' : 'nowrap')};\n\n ${({ isWrapped }) =>\n isWrapped &&\n css`\n align-items: center;\n display: flex;\n `}\n`;\n\nexport const StyledMotionTitleElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n margin-left: 8px;\n`;\n\nexport const StyledRightWrapper = styled.div`\n display: grid;\n flex: 0 0 auto;\n grid-template-areas: 'right';\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n`;\n\nexport const StyledMotionRightElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n grid-area: header;\n justify-content: flex-end;\n`;\n\ntype StyledMotionRightInputProps = WithTheme<{\n hasIcon: boolean;\n}>;\n\nexport const StyledMotionRightInput = styled(motion.input)<StyledMotionRightInputProps>`\n background-color: transparent;\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ${({ theme }: StyledMotionRightInputProps) => theme['headline-rgb']},\n 0.45\n );\n color: ${({ theme }: StyledMotionRightInputProps) => theme.text};\n grid-area: header;\n padding: ${({ hasIcon }) => (hasIcon ? '5px 23px 5px 1px' : '5px 1px')};\n`;\n\nexport const StyledMotionRightInputIconWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n height: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OAAKxB,KAAK,CAAC,cAAc,CAAC;AAAA,CAAC;AAC5E;AACA;AACA,aAAayB,MAAA;EAAA,IAAC;IAAEzB;EAAmC,CAAC,GAAAyB,MAAA;EAAA,OAAKzB,KAAK,CAACC,IAAI;AAAA,CAAC;AACpE;AACA,eAAeyB,MAAA;EAAA,IAAC;IAAEC;EAAQ,CAAC,GAAAD,MAAA;EAAA,OAAMC,OAAO,GAAG,kBAAkB,GAAG,SAAS;AAAA,CAAE;AAC3E,CAAC;AAACzB,OAAA,CAAAoB,sBAAA,GAAAA,sBAAA;AAEK,MAAMM,iCAAiC,GAAG,IAAAhC,yBAAM,EAACC,oBAAM,CAACC,GAAG,CAAE;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACI,OAAA,CAAA0B,iCAAA,GAAAA,iCAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type DateInfoProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The date, that should be displayed
|
|
5
|
+
*/
|
|
6
|
+
date: Date | string;
|
|
7
|
+
/**
|
|
8
|
+
* Additional text for "shouldShowDateToNowDifference" prop. Writes a text before the calculated time
|
|
9
|
+
*/
|
|
10
|
+
preText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Adds the current year to the display
|
|
13
|
+
*/
|
|
14
|
+
shouldShowThisYear?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Adds the time to the display.
|
|
17
|
+
* NOTE: The time is display with german text
|
|
18
|
+
*/
|
|
19
|
+
shouldShowTime?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the relative day of week to today should be shown (today, yesterday or tomorrow).
|
|
22
|
+
* NOTE: The text is only available in german
|
|
23
|
+
*/
|
|
24
|
+
shouldShowRelativeDayOfWeek?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Shortens the day and month text to maximum three digits
|
|
27
|
+
*/
|
|
28
|
+
shouldUseShortText?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Adds the day of week to the display
|
|
31
|
+
*/
|
|
32
|
+
shouldShowDayOfWeek?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Shows the difference from the date to now. The component handles updates itself.
|
|
35
|
+
* NOTE: This option is only available in german
|
|
36
|
+
*/
|
|
37
|
+
shouldShowDateToNowDifference?: boolean;
|
|
38
|
+
};
|
|
39
|
+
declare const DateInfo: FC<DateInfoProps>;
|
|
40
|
+
export default DateInfo;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _dateFns = require("date-fns");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _format = require("./utils/format");
|
|
10
|
+
var _language = require("./utils/language");
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
const DateInfo = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
date,
|
|
16
|
+
preText = '',
|
|
17
|
+
shouldShowThisYear,
|
|
18
|
+
shouldShowTime,
|
|
19
|
+
shouldShowRelativeDayOfWeek,
|
|
20
|
+
shouldUseShortText,
|
|
21
|
+
shouldShowDayOfWeek,
|
|
22
|
+
shouldShowDateToNowDifference
|
|
23
|
+
} = _ref;
|
|
24
|
+
const [formattedDate, setFormattedDate] = (0, _react.useState)(new Date(date));
|
|
25
|
+
const [formattedDateString, setFormattedDateString] = (0, _react.useState)('');
|
|
26
|
+
const [language] = (0, _react.useState)((0, _language.getLanguage)());
|
|
27
|
+
(0, _react.useEffect)(() => {
|
|
28
|
+
// This useEffect is used for normal date formation
|
|
29
|
+
if (shouldShowDateToNowDifference) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let newFormattedDateString = (0, _format.getFormattedDayOfWeek)({
|
|
33
|
+
shouldShowDayOfWeek,
|
|
34
|
+
shouldShowRelativeDayOfWeek,
|
|
35
|
+
shouldUseShortText,
|
|
36
|
+
date: formattedDate
|
|
37
|
+
});
|
|
38
|
+
let formatString = 'dd. ';
|
|
39
|
+
formatString += `${(0, _format.getMonthFormat)({
|
|
40
|
+
shouldUseShortText
|
|
41
|
+
})}`;
|
|
42
|
+
formatString += `${(0, _format.getYearFormat)({
|
|
43
|
+
date: formattedDate,
|
|
44
|
+
shouldShowThisYear
|
|
45
|
+
})}`;
|
|
46
|
+
newFormattedDateString += (0, _dateFns.format)(formattedDate, formatString, {
|
|
47
|
+
locale: language
|
|
48
|
+
});
|
|
49
|
+
newFormattedDateString += (0, _format.getFormattedTime)({
|
|
50
|
+
date: formattedDate,
|
|
51
|
+
shouldShowTime
|
|
52
|
+
});
|
|
53
|
+
setFormattedDateString(newFormattedDateString);
|
|
54
|
+
}, [date, formattedDate, language, shouldShowDateToNowDifference, shouldShowDayOfWeek, shouldShowRelativeDayOfWeek, shouldShowThisYear, shouldShowTime, shouldUseShortText]);
|
|
55
|
+
|
|
56
|
+
// Calculate remaining time till next minute to update time according to time left
|
|
57
|
+
const [currentDate, setCurrentDate] = (0, _react.useState)(new Date());
|
|
58
|
+
(0, _react.useEffect)(() => {
|
|
59
|
+
// This useEffect is for calculating the current date for shouldShowDateToNowDifference option
|
|
60
|
+
if (!shouldShowDateToNowDifference) {
|
|
61
|
+
return () => {};
|
|
62
|
+
}
|
|
63
|
+
let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();
|
|
64
|
+
|
|
65
|
+
// If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently
|
|
66
|
+
if (timeoutTime < 0) {
|
|
67
|
+
timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// initialized with remaining time
|
|
71
|
+
let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();
|
|
72
|
+
|
|
73
|
+
// set to elapsed time
|
|
74
|
+
if ((0, _dateFns.isPast)(formattedDate)) {
|
|
75
|
+
timeDiffInMs = currentDate.getTime() - formattedDate.getTime();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// time difference is less than a minute, time should be updated every second
|
|
79
|
+
if (timeDiffInMs < 60000) {
|
|
80
|
+
timeoutTime = 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Set timeoutTime to at least 1000ms
|
|
84
|
+
timeoutTime = Math.max(timeoutTime * 1000, 1000);
|
|
85
|
+
const timeout = setTimeout(() => {
|
|
86
|
+
setCurrentDate(new Date());
|
|
87
|
+
}, timeoutTime);
|
|
88
|
+
return () => {
|
|
89
|
+
clearTimeout(timeout);
|
|
90
|
+
};
|
|
91
|
+
}, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);
|
|
92
|
+
(0, _react.useEffect)(() => {
|
|
93
|
+
// This useEffect is for showing the difference of the date to now
|
|
94
|
+
if (shouldShowDateToNowDifference) {
|
|
95
|
+
setFormattedDateString((0, _format.getTimeTillNow)({
|
|
96
|
+
date: formattedDate,
|
|
97
|
+
currentDate
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
}, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);
|
|
101
|
+
(0, _react.useEffect)(() => {
|
|
102
|
+
setFormattedDate(new Date(date));
|
|
103
|
+
}, [date]);
|
|
104
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement("div", null, preText.trim(), " ", formattedDateString), [formattedDateString, preText]);
|
|
105
|
+
};
|
|
106
|
+
DateInfo.displayName = 'DateInfo';
|
|
107
|
+
var _default = DateInfo;
|
|
108
|
+
exports.default = _default;
|
|
109
|
+
//# sourceMappingURL=DateInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInfo.js","names":["_dateFns","require","_react","_interopRequireWildcard","_format","_language","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","DateInfo","_ref","date","preText","shouldShowThisYear","shouldShowTime","shouldShowRelativeDayOfWeek","shouldUseShortText","shouldShowDayOfWeek","shouldShowDateToNowDifference","formattedDate","setFormattedDate","useState","Date","formattedDateString","setFormattedDateString","language","getLanguage","useEffect","newFormattedDateString","getFormattedDayOfWeek","formatString","getMonthFormat","getYearFormat","format","locale","getFormattedTime","currentDate","setCurrentDate","timeoutTime","getSeconds","timeDiffInMs","getTime","isPast","Math","max","timeout","setTimeout","clearTimeout","getTimeTillNow","useMemo","createElement","trim","displayName","_default","exports"],"sources":["../../../src/components/date-info/DateInfo.tsx"],"sourcesContent":["import { format, isPast } from 'date-fns';\nimport React, { FC, useEffect, useMemo, useState } from 'react';\nimport {\n getFormattedDayOfWeek,\n getFormattedTime,\n getMonthFormat,\n getTimeTillNow,\n getYearFormat,\n} from './utils/format';\nimport { getLanguage } from './utils/language';\n\nexport type DateInfoProps = {\n /**\n * The date, that should be displayed\n */\n date: Date | string;\n /**\n * Additional text for \"shouldShowDateToNowDifference\" prop. Writes a text before the calculated time\n */\n preText?: string;\n /**\n * Adds the current year to the display\n */\n shouldShowThisYear?: boolean;\n /**\n * Adds the time to the display.\n * NOTE: The time is display with german text\n */\n shouldShowTime?: boolean;\n /**\n * Whether the relative day of week to today should be shown (today, yesterday or tomorrow).\n * NOTE: The text is only available in german\n */\n shouldShowRelativeDayOfWeek?: boolean;\n /**\n * Shortens the day and month text to maximum three digits\n */\n shouldUseShortText?: boolean;\n /**\n * Adds the day of week to the display\n */\n shouldShowDayOfWeek?: boolean;\n /**\n * Shows the difference from the date to now. The component handles updates itself.\n * NOTE: This option is only available in german\n */\n shouldShowDateToNowDifference?: boolean;\n};\n\nconst DateInfo: FC<DateInfoProps> = ({\n date,\n preText = '',\n shouldShowThisYear,\n shouldShowTime,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n shouldShowDayOfWeek,\n shouldShowDateToNowDifference,\n}) => {\n const [formattedDate, setFormattedDate] = useState(new Date(date));\n const [formattedDateString, setFormattedDateString] = useState<string>('');\n const [language] = useState(getLanguage());\n\n useEffect(() => {\n // This useEffect is used for normal date formation\n if (shouldShowDateToNowDifference) {\n return;\n }\n\n let newFormattedDateString = getFormattedDayOfWeek({\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldUseShortText,\n date: formattedDate,\n });\n\n let formatString = 'dd. ';\n\n formatString += `${getMonthFormat({ shouldUseShortText })}`;\n\n formatString += `${getYearFormat({\n date: formattedDate,\n shouldShowThisYear,\n })}`;\n\n newFormattedDateString += format(formattedDate, formatString, { locale: language });\n\n newFormattedDateString += getFormattedTime({ date: formattedDate, shouldShowTime });\n\n setFormattedDateString(newFormattedDateString);\n }, [\n date,\n formattedDate,\n language,\n shouldShowDateToNowDifference,\n shouldShowDayOfWeek,\n shouldShowRelativeDayOfWeek,\n shouldShowThisYear,\n shouldShowTime,\n shouldUseShortText,\n ]);\n\n // Calculate remaining time till next minute to update time according to time left\n const [currentDate, setCurrentDate] = useState(new Date());\n\n useEffect(() => {\n // This useEffect is for calculating the current date for shouldShowDateToNowDifference option\n if (!shouldShowDateToNowDifference) {\n return () => {};\n }\n\n let timeoutTime = formattedDate.getSeconds() - new Date().getSeconds();\n\n // If the seconds of date are after seconds of current time, the timeoutTime has to be calculated differently\n if (timeoutTime < 0) {\n timeoutTime = 60 - new Date().getSeconds() + formattedDate.getSeconds();\n }\n\n // initialized with remaining time\n let timeDiffInMs = formattedDate.getTime() - currentDate.getTime();\n\n // set to elapsed time\n if (isPast(formattedDate)) {\n timeDiffInMs = currentDate.getTime() - formattedDate.getTime();\n }\n\n // time difference is less than a minute, time should be updated every second\n if (timeDiffInMs < 60000) {\n timeoutTime = 1;\n }\n\n // Set timeoutTime to at least 1000ms\n timeoutTime = Math.max(timeoutTime * 1000, 1000);\n\n const timeout = setTimeout(() => {\n setCurrentDate(new Date());\n }, timeoutTime);\n\n return () => {\n clearTimeout(timeout);\n };\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n // This useEffect is for showing the difference of the date to now\n if (shouldShowDateToNowDifference) {\n setFormattedDateString(getTimeTillNow({ date: formattedDate, currentDate }));\n }\n }, [currentDate, date, formattedDate, shouldShowDateToNowDifference]);\n\n useEffect(() => {\n setFormattedDate(new Date(date));\n }, [date]);\n\n return useMemo(\n () => (\n <div>\n {preText.trim()} {formattedDateString}\n </div>\n ),\n [formattedDateString, preText]\n );\n};\n\nDateInfo.displayName = 'DateInfo';\n\nexport default DateInfo;\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAOA,IAAAI,SAAA,GAAAJ,OAAA;AAA+C,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAA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AChF;EACJ,CAAC,EAAE,CAACA,WAAW,EAAEzB,IAAI,EAAEQ,aAAa,EAAED,6BAA6B,CAAC,CAAC;EAErE,IAAAS,gBAAS,EAAC,MAAM;IACZP,gBAAgB,CAAC,IAAIE,IAAI,CAACX,IAAI,CAAC,CAAC;EACpC,CAAC,EAAE,CAACA,IAAI,CAAC,CAAC;EAEV,OAAO,IAAAsC,cAAO,EACV,mBACIlE,MAAA,CAAAW,OAAA,CAAAwD,aAAA,cACKtC,OAAO,CAACuC,IAAI,CAAC,CAAC,EAAC,GAAC,EAAC5B,mBACjB,CACR,EACD,CAACA,mBAAmB,EAAEX,OAAO,CACjC,CAAC;AACL,CAAC;AAEDH,QAAQ,CAAC2C,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAEnB5C,QAAQ;AAAA6C,OAAA,CAAA5D,OAAA,GAAA2D,QAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface GetFormattedYearOptions {
|
|
2
|
+
date: Date;
|
|
3
|
+
shouldShowThisYear?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const getYearFormat: ({ date, shouldShowThisYear }: GetFormattedYearOptions) => "" | " yyyy";
|
|
6
|
+
interface GetFormattedMonthOptions {
|
|
7
|
+
shouldUseShortText?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const getMonthFormat: ({ shouldUseShortText }: GetFormattedMonthOptions) => "LLL." | "LLLL";
|
|
10
|
+
interface GetFormattedDayOfWeekOptions {
|
|
11
|
+
shouldShowDayOfWeek?: boolean;
|
|
12
|
+
shouldShowRelativeDayOfWeek?: boolean;
|
|
13
|
+
shouldUseShortText?: boolean;
|
|
14
|
+
date: Date;
|
|
15
|
+
}
|
|
16
|
+
export declare const getFormattedDayOfWeek: ({ shouldShowRelativeDayOfWeek, shouldShowDayOfWeek, shouldUseShortText, date, }: GetFormattedDayOfWeekOptions) => string;
|
|
17
|
+
interface GetFormattedTimeOptions {
|
|
18
|
+
shouldShowTime?: boolean;
|
|
19
|
+
date: Date;
|
|
20
|
+
}
|
|
21
|
+
export declare const getFormattedTime: ({ shouldShowTime, date }: GetFormattedTimeOptions) => string;
|
|
22
|
+
export interface Time {
|
|
23
|
+
value: number;
|
|
24
|
+
type: TimeType;
|
|
25
|
+
isPast: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare enum TimeType {
|
|
28
|
+
Seconds = 0,
|
|
29
|
+
Minutes = 1,
|
|
30
|
+
Hours = 2,
|
|
31
|
+
Days = 3,
|
|
32
|
+
Weeks = 4,
|
|
33
|
+
Months = 5,
|
|
34
|
+
Years = 6
|
|
35
|
+
}
|
|
36
|
+
interface GetTimeTillNowOptions {
|
|
37
|
+
date: Date;
|
|
38
|
+
currentDate: Date;
|
|
39
|
+
}
|
|
40
|
+
export declare const getTimeTillNow: ({ date, currentDate }: GetTimeTillNowOptions) => string;
|
|
41
|
+
export declare const getFormattedPastTimeString: (time: Time) => string;
|
|
42
|
+
export declare const getFormattedFutureTimeString: (time: Time) => string;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getYearFormat = exports.getTimeTillNow = exports.getMonthFormat = exports.getFormattedTime = exports.getFormattedPastTimeString = exports.getFormattedFutureTimeString = exports.getFormattedDayOfWeek = exports.TimeType = void 0;
|
|
7
|
+
var _dateFns = require("date-fns");
|
|
8
|
+
const getYearFormat = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
date,
|
|
11
|
+
shouldShowThisYear
|
|
12
|
+
} = _ref;
|
|
13
|
+
if (shouldShowThisYear) {
|
|
14
|
+
return ' yyyy';
|
|
15
|
+
}
|
|
16
|
+
return (0, _dateFns.isThisYear)(date) ? '' : ' yyyy';
|
|
17
|
+
};
|
|
18
|
+
exports.getYearFormat = getYearFormat;
|
|
19
|
+
const getMonthFormat = _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
shouldUseShortText
|
|
22
|
+
} = _ref2;
|
|
23
|
+
if (shouldUseShortText) {
|
|
24
|
+
return 'LLL.';
|
|
25
|
+
}
|
|
26
|
+
return 'LLLL';
|
|
27
|
+
};
|
|
28
|
+
exports.getMonthFormat = getMonthFormat;
|
|
29
|
+
const getFormattedDayOfWeek = _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
shouldShowRelativeDayOfWeek,
|
|
32
|
+
shouldShowDayOfWeek,
|
|
33
|
+
shouldUseShortText,
|
|
34
|
+
date
|
|
35
|
+
} = _ref3;
|
|
36
|
+
if (!shouldShowDayOfWeek && !shouldShowRelativeDayOfWeek) {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
if (shouldShowRelativeDayOfWeek) {
|
|
40
|
+
if ((0, _dateFns.isToday)(date)) {
|
|
41
|
+
return 'Heute, ';
|
|
42
|
+
}
|
|
43
|
+
if ((0, _dateFns.isTomorrow)(date)) {
|
|
44
|
+
return 'Morgen, ';
|
|
45
|
+
}
|
|
46
|
+
if ((0, _dateFns.isYesterday)(date)) {
|
|
47
|
+
return 'Gestern, ';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (shouldUseShortText) {
|
|
51
|
+
return (0, _dateFns.format)(date, 'E., ');
|
|
52
|
+
}
|
|
53
|
+
return (0, _dateFns.format)(date, 'EEEE, ');
|
|
54
|
+
};
|
|
55
|
+
exports.getFormattedDayOfWeek = getFormattedDayOfWeek;
|
|
56
|
+
const getFormattedTime = _ref4 => {
|
|
57
|
+
let {
|
|
58
|
+
shouldShowTime,
|
|
59
|
+
date
|
|
60
|
+
} = _ref4;
|
|
61
|
+
if (!shouldShowTime) {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
return `, ${(0, _dateFns.format)(date, 'HH:mm')} Uhr`;
|
|
65
|
+
};
|
|
66
|
+
exports.getFormattedTime = getFormattedTime;
|
|
67
|
+
let TimeType = /*#__PURE__*/function (TimeType) {
|
|
68
|
+
TimeType[TimeType["Seconds"] = 0] = "Seconds";
|
|
69
|
+
TimeType[TimeType["Minutes"] = 1] = "Minutes";
|
|
70
|
+
TimeType[TimeType["Hours"] = 2] = "Hours";
|
|
71
|
+
TimeType[TimeType["Days"] = 3] = "Days";
|
|
72
|
+
TimeType[TimeType["Weeks"] = 4] = "Weeks";
|
|
73
|
+
TimeType[TimeType["Months"] = 5] = "Months";
|
|
74
|
+
TimeType[TimeType["Years"] = 6] = "Years";
|
|
75
|
+
return TimeType;
|
|
76
|
+
}({});
|
|
77
|
+
exports.TimeType = TimeType;
|
|
78
|
+
const getTimeTillNow = _ref5 => {
|
|
79
|
+
let {
|
|
80
|
+
date,
|
|
81
|
+
currentDate
|
|
82
|
+
} = _ref5;
|
|
83
|
+
const time = {
|
|
84
|
+
value: 0,
|
|
85
|
+
type: TimeType.Years,
|
|
86
|
+
isPast: false
|
|
87
|
+
};
|
|
88
|
+
if ((0, _dateFns.isPast)(date)) {
|
|
89
|
+
const elapsedMilliseconds = currentDate.getTime() - date.getTime();
|
|
90
|
+
switch (true) {
|
|
91
|
+
case elapsedMilliseconds < 60000:
|
|
92
|
+
time.value = Math.floor(elapsedMilliseconds / 1000);
|
|
93
|
+
time.type = TimeType.Seconds;
|
|
94
|
+
break;
|
|
95
|
+
case elapsedMilliseconds < 3600000:
|
|
96
|
+
time.value = Math.floor(elapsedMilliseconds / 60000);
|
|
97
|
+
time.type = TimeType.Minutes;
|
|
98
|
+
break;
|
|
99
|
+
case elapsedMilliseconds < 86400000:
|
|
100
|
+
time.value = Math.floor(elapsedMilliseconds / 3600000);
|
|
101
|
+
time.type = TimeType.Hours;
|
|
102
|
+
break;
|
|
103
|
+
case elapsedMilliseconds < 604800000:
|
|
104
|
+
time.value = Math.floor(elapsedMilliseconds / 86400000);
|
|
105
|
+
time.type = TimeType.Days;
|
|
106
|
+
break;
|
|
107
|
+
case elapsedMilliseconds < 2592000000:
|
|
108
|
+
time.value = Math.floor(elapsedMilliseconds / 604800000);
|
|
109
|
+
time.type = TimeType.Weeks;
|
|
110
|
+
break;
|
|
111
|
+
case elapsedMilliseconds < 31536000000:
|
|
112
|
+
time.value = Math.floor(elapsedMilliseconds / 2592000000);
|
|
113
|
+
time.type = TimeType.Months;
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
time.value = Math.floor(elapsedMilliseconds / 31536000000);
|
|
117
|
+
time.type = TimeType.Years;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
return `${time.value} ${getFormattedPastTimeString(time)}`;
|
|
121
|
+
}
|
|
122
|
+
const remainingMilliseconds = date.getTime() - currentDate.getTime();
|
|
123
|
+
switch (true) {
|
|
124
|
+
case remainingMilliseconds < 60000:
|
|
125
|
+
time.value = Math.floor(remainingMilliseconds / 1000);
|
|
126
|
+
time.type = TimeType.Seconds;
|
|
127
|
+
break;
|
|
128
|
+
case remainingMilliseconds < 3600000:
|
|
129
|
+
time.value = Math.floor(remainingMilliseconds / 60000);
|
|
130
|
+
time.type = TimeType.Minutes;
|
|
131
|
+
break;
|
|
132
|
+
case remainingMilliseconds < 86400000:
|
|
133
|
+
time.value = Math.floor(remainingMilliseconds / 3600000);
|
|
134
|
+
time.type = TimeType.Hours;
|
|
135
|
+
break;
|
|
136
|
+
case remainingMilliseconds < 604800000:
|
|
137
|
+
time.value = Math.floor(remainingMilliseconds / 86400000);
|
|
138
|
+
time.type = TimeType.Days;
|
|
139
|
+
break;
|
|
140
|
+
case remainingMilliseconds < 2592000000:
|
|
141
|
+
time.value = Math.floor(remainingMilliseconds / 604800000);
|
|
142
|
+
time.type = TimeType.Weeks;
|
|
143
|
+
break;
|
|
144
|
+
case remainingMilliseconds < 31536000000:
|
|
145
|
+
time.value = Math.floor(remainingMilliseconds / 2592000000);
|
|
146
|
+
time.type = TimeType.Months;
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
time.value = Math.floor(remainingMilliseconds / 31536000000);
|
|
150
|
+
time.type = TimeType.Years;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
return `${time.value} ${getFormattedFutureTimeString(time)}`;
|
|
154
|
+
};
|
|
155
|
+
exports.getTimeTillNow = getTimeTillNow;
|
|
156
|
+
const timeTypeStrings = {
|
|
157
|
+
past: {
|
|
158
|
+
seconds: {
|
|
159
|
+
singular: 'Sekunde',
|
|
160
|
+
plural: 'Sekunden'
|
|
161
|
+
},
|
|
162
|
+
minutes: {
|
|
163
|
+
singular: 'Minute',
|
|
164
|
+
plural: 'Minuten'
|
|
165
|
+
},
|
|
166
|
+
hours: {
|
|
167
|
+
singular: 'Stunde',
|
|
168
|
+
plural: 'Stunden'
|
|
169
|
+
},
|
|
170
|
+
days: {
|
|
171
|
+
singular: 'Tag',
|
|
172
|
+
plural: 'Tagen'
|
|
173
|
+
},
|
|
174
|
+
weeks: {
|
|
175
|
+
singular: 'Woche',
|
|
176
|
+
plural: 'Wochen'
|
|
177
|
+
},
|
|
178
|
+
months: {
|
|
179
|
+
singular: 'Monat',
|
|
180
|
+
plural: 'Monaten'
|
|
181
|
+
},
|
|
182
|
+
years: {
|
|
183
|
+
singular: 'Jahr',
|
|
184
|
+
plural: 'Jahren'
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
future: {
|
|
188
|
+
seconds: {
|
|
189
|
+
singular: 'Sekunde',
|
|
190
|
+
plural: 'Sekunden'
|
|
191
|
+
},
|
|
192
|
+
minutes: {
|
|
193
|
+
singular: 'Minute',
|
|
194
|
+
plural: 'Minuten'
|
|
195
|
+
},
|
|
196
|
+
hours: {
|
|
197
|
+
singular: 'Stunde',
|
|
198
|
+
plural: 'Stunden'
|
|
199
|
+
},
|
|
200
|
+
days: {
|
|
201
|
+
singular: 'Tag',
|
|
202
|
+
plural: 'Tagen'
|
|
203
|
+
},
|
|
204
|
+
weeks: {
|
|
205
|
+
singular: 'Woche',
|
|
206
|
+
plural: 'Wochen'
|
|
207
|
+
},
|
|
208
|
+
months: {
|
|
209
|
+
singular: 'Monat',
|
|
210
|
+
plural: 'Monaten'
|
|
211
|
+
},
|
|
212
|
+
years: {
|
|
213
|
+
singular: 'Jahr',
|
|
214
|
+
plural: 'Jahren'
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
const getFormattedPastTimeString = time => {
|
|
219
|
+
const {
|
|
220
|
+
value,
|
|
221
|
+
type
|
|
222
|
+
} = time;
|
|
223
|
+
const {
|
|
224
|
+
past: {
|
|
225
|
+
seconds,
|
|
226
|
+
days,
|
|
227
|
+
weeks,
|
|
228
|
+
months,
|
|
229
|
+
years,
|
|
230
|
+
minutes,
|
|
231
|
+
hours
|
|
232
|
+
}
|
|
233
|
+
} = timeTypeStrings;
|
|
234
|
+
const isSingular = value === 1;
|
|
235
|
+
switch (true) {
|
|
236
|
+
case type === TimeType.Seconds:
|
|
237
|
+
return isSingular ? seconds.singular : seconds.plural;
|
|
238
|
+
case type === TimeType.Minutes:
|
|
239
|
+
return isSingular ? minutes.singular : minutes.plural;
|
|
240
|
+
case type === TimeType.Hours:
|
|
241
|
+
return isSingular ? hours.singular : hours.plural;
|
|
242
|
+
case type === TimeType.Days:
|
|
243
|
+
return isSingular ? days.singular : days.plural;
|
|
244
|
+
case type === TimeType.Weeks:
|
|
245
|
+
return isSingular ? weeks.singular : weeks.plural;
|
|
246
|
+
case type === TimeType.Months:
|
|
247
|
+
return isSingular ? months.singular : months.plural;
|
|
248
|
+
default:
|
|
249
|
+
return isSingular ? years.singular : years.plural;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
exports.getFormattedPastTimeString = getFormattedPastTimeString;
|
|
253
|
+
const getFormattedFutureTimeString = time => {
|
|
254
|
+
const {
|
|
255
|
+
value,
|
|
256
|
+
type
|
|
257
|
+
} = time;
|
|
258
|
+
const {
|
|
259
|
+
future: {
|
|
260
|
+
seconds,
|
|
261
|
+
days,
|
|
262
|
+
weeks,
|
|
263
|
+
months,
|
|
264
|
+
years,
|
|
265
|
+
minutes,
|
|
266
|
+
hours
|
|
267
|
+
}
|
|
268
|
+
} = timeTypeStrings;
|
|
269
|
+
const isSingular = value === 1;
|
|
270
|
+
switch (true) {
|
|
271
|
+
case type === TimeType.Seconds:
|
|
272
|
+
return isSingular ? seconds.singular : seconds.plural;
|
|
273
|
+
case type === TimeType.Minutes:
|
|
274
|
+
return isSingular ? minutes.singular : minutes.plural;
|
|
275
|
+
case type === TimeType.Hours:
|
|
276
|
+
return isSingular ? hours.singular : hours.plural;
|
|
277
|
+
case type === TimeType.Days:
|
|
278
|
+
return isSingular ? days.singular : days.plural;
|
|
279
|
+
case type === TimeType.Weeks:
|
|
280
|
+
return isSingular ? weeks.singular : weeks.plural;
|
|
281
|
+
case type === TimeType.Months:
|
|
282
|
+
return isSingular ? months.singular : months.plural;
|
|
283
|
+
default:
|
|
284
|
+
return isSingular ? years.singular : years.plural;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
exports.getFormattedFutureTimeString = getFormattedFutureTimeString;
|
|
288
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","names":["_dateFns","require","getYearFormat","_ref","date","shouldShowThisYear","isThisYear","exports","getMonthFormat","_ref2","shouldUseShortText","getFormattedDayOfWeek","_ref3","shouldShowRelativeDayOfWeek","shouldShowDayOfWeek","isToday","isTomorrow","isYesterday","format","getFormattedTime","_ref4","shouldShowTime","TimeType","getTimeTillNow","_ref5","currentDate","time","value","type","Years","isPast","elapsedMilliseconds","getTime","Math","floor","Seconds","Minutes","Hours","Days","Weeks","Months","getFormattedPastTimeString","remainingMilliseconds","getFormattedFutureTimeString","timeTypeStrings","past","seconds","singular","plural","minutes","hours","days","weeks","months","years","future","isSingular"],"sources":["../../../../src/components/date-info/utils/format.ts"],"sourcesContent":["import { format, isPast, isThisYear, isToday, isTomorrow, isYesterday } from 'date-fns';\n\ninterface GetFormattedYearOptions {\n date: Date;\n shouldShowThisYear?: boolean;\n}\n\nexport const getYearFormat = ({ date, shouldShowThisYear }: GetFormattedYearOptions) => {\n if (shouldShowThisYear) {\n return ' yyyy';\n }\n\n return isThisYear(date) ? '' : ' yyyy';\n};\n\ninterface GetFormattedMonthOptions {\n shouldUseShortText?: boolean;\n}\n\nexport const getMonthFormat = ({ shouldUseShortText }: GetFormattedMonthOptions) => {\n if (shouldUseShortText) {\n return 'LLL.';\n }\n\n return 'LLLL';\n};\n\ninterface GetFormattedDayOfWeekOptions {\n shouldShowDayOfWeek?: boolean;\n shouldShowRelativeDayOfWeek?: boolean;\n shouldUseShortText?: boolean;\n date: Date;\n}\n\nexport const getFormattedDayOfWeek = ({\n shouldShowRelativeDayOfWeek,\n shouldShowDayOfWeek,\n shouldUseShortText,\n date,\n}: GetFormattedDayOfWeekOptions) => {\n if (!shouldShowDayOfWeek && !shouldShowRelativeDayOfWeek) {\n return '';\n }\n\n if (shouldShowRelativeDayOfWeek) {\n if (isToday(date)) {\n return 'Heute, ';\n }\n\n if (isTomorrow(date)) {\n return 'Morgen, ';\n }\n\n if (isYesterday(date)) {\n return 'Gestern, ';\n }\n }\n\n if (shouldUseShortText) {\n return format(date, 'E., ');\n }\n\n return format(date, 'EEEE, ');\n};\n\ninterface GetFormattedTimeOptions {\n shouldShowTime?: boolean;\n date: Date;\n}\n\nexport const getFormattedTime = ({ shouldShowTime, date }: GetFormattedTimeOptions) => {\n if (!shouldShowTime) {\n return '';\n }\n\n return `, ${format(date, 'HH:mm')} Uhr`;\n};\n\nexport interface Time {\n value: number;\n type: TimeType;\n isPast: boolean;\n}\n\nexport enum TimeType {\n Seconds,\n Minutes,\n Hours,\n Days,\n Weeks,\n Months,\n Years,\n}\n\ninterface GetTimeTillNowOptions {\n date: Date;\n currentDate: Date;\n}\n\nexport const getTimeTillNow = ({ date, currentDate }: GetTimeTillNowOptions): string => {\n const time: Time = {\n value: 0,\n type: TimeType.Years,\n isPast: false,\n };\n\n if (isPast(date)) {\n const elapsedMilliseconds = currentDate.getTime() - date.getTime();\n\n switch (true) {\n case elapsedMilliseconds < 60000:\n time.value = Math.floor(elapsedMilliseconds / 1000);\n time.type = TimeType.Seconds;\n break;\n case elapsedMilliseconds < 3600000:\n time.value = Math.floor(elapsedMilliseconds / 60000);\n time.type = TimeType.Minutes;\n break;\n case elapsedMilliseconds < 86400000:\n time.value = Math.floor(elapsedMilliseconds / 3600000);\n time.type = TimeType.Hours;\n break;\n case elapsedMilliseconds < 604800000:\n time.value = Math.floor(elapsedMilliseconds / 86400000);\n time.type = TimeType.Days;\n break;\n case elapsedMilliseconds < 2592000000:\n time.value = Math.floor(elapsedMilliseconds / 604800000);\n time.type = TimeType.Weeks;\n break;\n case elapsedMilliseconds < 31536000000:\n time.value = Math.floor(elapsedMilliseconds / 2592000000);\n time.type = TimeType.Months;\n break;\n default:\n time.value = Math.floor(elapsedMilliseconds / 31536000000);\n time.type = TimeType.Years;\n break;\n }\n\n return `${time.value} ${getFormattedPastTimeString(time)}`;\n }\n\n const remainingMilliseconds = date.getTime() - currentDate.getTime();\n\n switch (true) {\n case remainingMilliseconds < 60000:\n time.value = Math.floor(remainingMilliseconds / 1000);\n time.type = TimeType.Seconds;\n break;\n case remainingMilliseconds < 3600000:\n time.value = Math.floor(remainingMilliseconds / 60000);\n time.type = TimeType.Minutes;\n break;\n case remainingMilliseconds < 86400000:\n time.value = Math.floor(remainingMilliseconds / 3600000);\n time.type = TimeType.Hours;\n break;\n case remainingMilliseconds < 604800000:\n time.value = Math.floor(remainingMilliseconds / 86400000);\n time.type = TimeType.Days;\n break;\n case remainingMilliseconds < 2592000000:\n time.value = Math.floor(remainingMilliseconds / 604800000);\n time.type = TimeType.Weeks;\n break;\n case remainingMilliseconds < 31536000000:\n time.value = Math.floor(remainingMilliseconds / 2592000000);\n time.type = TimeType.Months;\n break;\n default:\n time.value = Math.floor(remainingMilliseconds / 31536000000);\n time.type = TimeType.Years;\n break;\n }\n\n return `${time.value} ${getFormattedFutureTimeString(time)}`;\n};\n\nconst timeTypeStrings = {\n past: {\n seconds: {\n singular: 'Sekunde',\n plural: 'Sekunden',\n },\n minutes: {\n singular: 'Minute',\n plural: 'Minuten',\n },\n hours: {\n singular: 'Stunde',\n plural: 'Stunden',\n },\n days: {\n singular: 'Tag',\n plural: 'Tagen',\n },\n weeks: {\n singular: 'Woche',\n plural: 'Wochen',\n },\n months: {\n singular: 'Monat',\n plural: 'Monaten',\n },\n years: {\n singular: 'Jahr',\n plural: 'Jahren',\n },\n },\n future: {\n seconds: {\n singular: 'Sekunde',\n plural: 'Sekunden',\n },\n minutes: {\n singular: 'Minute',\n plural: 'Minuten',\n },\n hours: {\n singular: 'Stunde',\n plural: 'Stunden',\n },\n days: {\n singular: 'Tag',\n plural: 'Tagen',\n },\n weeks: {\n singular: 'Woche',\n plural: 'Wochen',\n },\n months: {\n singular: 'Monat',\n plural: 'Monaten',\n },\n years: {\n singular: 'Jahr',\n plural: 'Jahren',\n },\n },\n};\n\nexport const getFormattedPastTimeString = (time: Time): string => {\n const { value, type } = time;\n const {\n past: { seconds, days, weeks, months, years, minutes, hours },\n } = timeTypeStrings;\n const isSingular = value === 1;\n\n switch (true) {\n case type === TimeType.Seconds:\n return isSingular ? seconds.singular : seconds.plural;\n case type === TimeType.Minutes:\n return isSingular ? minutes.singular : minutes.plural;\n case type === TimeType.Hours:\n return isSingular ? hours.singular : hours.plural;\n case type === TimeType.Days:\n return isSingular ? days.singular : days.plural;\n case type === TimeType.Weeks:\n return isSingular ? weeks.singular : weeks.plural;\n case type === TimeType.Months:\n return isSingular ? months.singular : months.plural;\n default:\n return isSingular ? years.singular : years.plural;\n }\n};\n\nexport const getFormattedFutureTimeString = (time: Time): string => {\n const { value, type } = time;\n const {\n future: { seconds, days, weeks, months, years, minutes, hours },\n } = timeTypeStrings;\n const isSingular = value === 1;\n\n switch (true) {\n case type === TimeType.Seconds:\n return isSingular ? seconds.singular : seconds.plural;\n case type === TimeType.Minutes:\n return isSingular ? minutes.singular : minutes.plural;\n case type === TimeType.Hours:\n return isSingular ? hours.singular : hours.plural;\n case type === TimeType.Days:\n return isSingular ? days.singular : days.plural;\n case type === TimeType.Weeks:\n return isSingular ? weeks.singular : weeks.plural;\n case type === TimeType.Months:\n return isSingular ? months.singular : months.plural;\n default:\n return isSingular ? years.singular : years.plural;\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,aAAa,GAAGC,IAAA,IAA2D;EAAA,IAA1D;IAAEC,IAAI;IAAEC;EAA4C,CAAC,GAAAF,IAAA;EAC/E,IAAIE,kBAAkB,EAAE;IACpB,OAAO,OAAO;EAClB;EAEA,OAAO,IAAAC,mBAAU,EAACF,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO;AAC1C,CAAC;AAACG,OAAA,CAAAL,aAAA,GAAAA,aAAA;AAMK,MAAMM,cAAc,GAAGC,KAAA,IAAsD;EAAA,IAArD;IAAEC;EAA6C,CAAC,GAAAD,KAAA;EAC3E,IAAIC,kBAAkB,EAAE;IACpB,OAAO,MAAM;EACjB;EAEA,OAAO,MAAM;AACjB,CAAC;AAACH,OAAA,CAAAC,cAAA,GAAAA,cAAA;AASK,MAAMG,qBAAqB,GAAGC,KAAA,IAKD;EAAA,IALE;IAClCC,2BAA2B;IAC3BC,mBAAmB;IACnBJ,kBAAkB;IAClBN;EAC0B,CAAC,GAAAQ,KAAA;EAC3B,IAAI,CAACE,mBAAmB,IAAI,CAACD,2BAA2B,EAAE;IACtD,OAAO,EAAE;EACb;EAEA,IAAIA,2BAA2B,EAAE;IAC7B,IAAI,IAAAE,gBAAO,EAACX,IAAI,CAAC,EAAE;MACf,OAAO,SAAS;IACpB;IAEA,IAAI,IAAAY,mBAAU,EAACZ,IAAI,CAAC,EAAE;MAClB,OAAO,UAAU;IACrB;IAEA,IAAI,IAAAa,oBAAW,EAACb,IAAI,CAAC,EAAE;MACnB,OAAO,WAAW;IACtB;EACJ;EAEA,IAAIM,kBAAkB,EAA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,4BAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLanguage: () => Locale;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLanguage = void 0;
|
|
7
|
+
var _locale = require("date-fns/locale");
|
|
8
|
+
const getLanguage = () => {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
10
|
+
switch (chayns.env.parameters.translang || chayns.env.language) {
|
|
11
|
+
case 'en':
|
|
12
|
+
return _locale.enGB;
|
|
13
|
+
case 'nl':
|
|
14
|
+
return _locale.nl;
|
|
15
|
+
case 'fr':
|
|
16
|
+
return _locale.fr;
|
|
17
|
+
case 'it':
|
|
18
|
+
return _locale.it;
|
|
19
|
+
case 'pl':
|
|
20
|
+
return _locale.pl;
|
|
21
|
+
case 'pt':
|
|
22
|
+
return _locale.pt;
|
|
23
|
+
case 'es':
|
|
24
|
+
return _locale.es;
|
|
25
|
+
case 'tr':
|
|
26
|
+
return _locale.tr;
|
|
27
|
+
case 'uk':
|
|
28
|
+
return _locale.uk;
|
|
29
|
+
default:
|
|
30
|
+
return _locale.de;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.getLanguage = getLanguage;
|
|
34
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","names":["_locale","require","getLanguage","chayns","env","parameters","translang","language","enGB","nl","fr","it","pl","pt","es","tr","uk","de","exports"],"sources":["../../../../src/components/date-info/utils/language.ts"],"sourcesContent":["import { de, enGB, es, fr, it, nl, pl, pt, tr, uk } from 'date-fns/locale';\n\nexport const getLanguage = (): Locale => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n switch (chayns.env.parameters.translang || chayns.env.language) {\n case 'en':\n return enGB;\n case 'nl':\n return nl;\n case 'fr':\n return fr;\n case 'it':\n return it;\n case 'pl':\n return pl;\n case 'pt':\n return pt;\n case 'es':\n return es;\n case 'tr':\n return tr;\n case 'uk':\n return uk;\n default:\n return de;\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,GAAGA,CAAA,KAAc;EACrC;EACA,QAAQC,MAAM,CAACC,GAAG,CAACC,UAAU,CAACC,SAAS,IAAIH,MAAM,CAACC,GAAG,CAACG,QAAQ;IAC1D,KAAK,IAAI;MACL,OAAOC,YAAI;IACf,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb,KAAK,IAAI;MACL,OAAOC,UAAE;IACb;MACI,OAAOC,UAAE;EACjB;AACJ,CAAC;AAACC,OAAA,CAAAhB,WAAA,GAAAA,WAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { default as ComboBox } from './components/combobox/ComboBox';
|
|
|
13
13
|
export type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';
|
|
14
14
|
export { default as ContentCard } from './components/content-card/ContentCard';
|
|
15
15
|
export { default as ContextMenu } from './components/context-menu/ContextMenu';
|
|
16
|
+
export { default as DateInfo } from './components/date-info/DateInfo';
|
|
16
17
|
export { default as FilterButton } from './components/filter-button/FilterButton';
|
|
17
18
|
export type { FilterButtonItemShape, FilterButtonSize, IFilterButtonItem as FilterButtonItem, } from './components/filter-button/types';
|
|
18
19
|
export { default as GridImage } from './components/grid-image/GridImage';
|
package/lib/index.js
CHANGED
|
@@ -81,6 +81,12 @@ Object.defineProperty(exports, "ContextMenu", {
|
|
|
81
81
|
return _ContextMenu.default;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "DateInfo", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _DateInfo.default;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
84
90
|
Object.defineProperty(exports, "FilterButton", {
|
|
85
91
|
enumerable: true,
|
|
86
92
|
get: function () {
|
|
@@ -250,6 +256,7 @@ var _ColorSchemeProvider = _interopRequireDefault(require("./components/color-sc
|
|
|
250
256
|
var _ComboBox = _interopRequireDefault(require("./components/combobox/ComboBox"));
|
|
251
257
|
var _ContentCard = _interopRequireDefault(require("./components/content-card/ContentCard"));
|
|
252
258
|
var _ContextMenu = _interopRequireDefault(require("./components/context-menu/ContextMenu"));
|
|
259
|
+
var _DateInfo = _interopRequireDefault(require("./components/date-info/DateInfo"));
|
|
253
260
|
var _FilterButton = _interopRequireDefault(require("./components/filter-button/FilterButton"));
|
|
254
261
|
var _GridImage = _interopRequireDefault(require("./components/grid-image/GridImage"));
|
|
255
262
|
var _Icon = _interopRequireDefault(require("./components/icon/Icon"));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_FilterButton","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_TextStringProvider","_TextString","_Tooltip","_fileDialog","_uploadFile","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { WithTheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as FilterButton } from './components/filter-button/FilterButton';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-button/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as TextStringProvider } from './components/textstring-provider/TextStringProvider';\nexport { default as TextString } from './components/textstring/TextString';\nexport type {\n ITextstring as Textstring,\n TextstringReplacement,\n} from './components/textstring/types';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { selectFiles } from './utils/fileDialog';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FilterButton","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_TextStringProvider","_TextString","_Tooltip","_fileDialog","_uploadFile","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { WithTheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as DateInfo } from './components/date-info/DateInfo';\nexport { default as FilterButton } from './components/filter-button/FilterButton';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-button/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as TextStringProvider } from './components/textstring-provider/TextStringProvider';\nexport { default as TextString } from './components/textstring/TextString';\nexport type {\n ITextstring as Textstring,\n TextstringReplacement,\n} from './components/textstring/types';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { selectFiles } from './utils/fileDialog';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,oBAAA,GAAAV,sBAAA,CAAAC,OAAA;AAEA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AAEA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,YAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,SAAA,GAAAd,sBAAA,CAA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":3,"file":"chayns.js","names":["ButtonType","exports"],"sources":["../../src/types/chayns.ts"],"sourcesContent":["declare global {\n let chayns: Chayns;\n}\n\nexport interface Chayns {\n dialog: Dialog;\n env: Env;\n openImage(urls: string | string[], start?: number): Promise<undefined>;\n openVideo(url: string): Promise<void>;\n}\n\nexport interface Dialog {\n select(config: {\n title?: string;\n message?: string;\n list: Array<SelectDialogItem>;\n multiselect?: boolean;\n type?: SelectType;\n preventCloseOnClick?: boolean;\n buttons?: DialogButton[];\n selectAllButton?: string;\n }): Promise<SelectDialogResult>;\n}\n\ndeclare enum ButtonText {\n Cancel = 'Abbrechen',\n No = 'Nein',\n Ok = 'OK',\n Yes = 'Ja',\n}\n\nexport enum ButtonType {\n Cancel = -1,\n Negative = 0,\n Positive = 1,\n}\n\nexport interface DialogButton {\n text: ButtonText | string;\n buttonType: ButtonType | number;\n collapseTime?: number;\n textColor?: string;\n backgroundColor?: string;\n}\n\nexport interface SelectDialogItem {\n name: string;\n value: string | number;\n isSelected?: boolean;\n}\n\nexport interface SelectDialogResult {\n buttonType: ButtonType | number;\n selection: Array<SelectDialogItem>;\n}\n\ndeclare enum SelectType {\n Default = 0,\n Icon = 1,\n IconAndText,\n}\n\nexport interface Env {\n isApp: boolean;\n isMobile: boolean;\n isTablet: boolean;\n}\n"],"mappings":";;;;;;IA+BYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAAC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
|
|
1
|
+
{"version":3,"file":"chayns.js","names":["ButtonType","exports"],"sources":["../../src/types/chayns.ts"],"sourcesContent":["declare global {\n let chayns: Chayns;\n}\n\nexport interface Chayns {\n dialog: Dialog;\n env: Env;\n openImage(urls: string | string[], start?: number): Promise<undefined>;\n openVideo(url: string): Promise<void>;\n}\n\nexport interface Dialog {\n select(config: {\n title?: string;\n message?: string;\n list: Array<SelectDialogItem>;\n multiselect?: boolean;\n type?: SelectType;\n preventCloseOnClick?: boolean;\n buttons?: DialogButton[];\n selectAllButton?: string;\n }): Promise<SelectDialogResult>;\n}\n\ndeclare enum ButtonText {\n Cancel = 'Abbrechen',\n No = 'Nein',\n Ok = 'OK',\n Yes = 'Ja',\n}\n\nexport enum ButtonType {\n Cancel = -1,\n Negative = 0,\n Positive = 1,\n}\n\nexport interface DialogButton {\n text: ButtonText | string;\n buttonType: ButtonType | number;\n collapseTime?: number;\n textColor?: string;\n backgroundColor?: string;\n}\n\nexport interface SelectDialogItem {\n name: string;\n value: string | number;\n isSelected?: boolean;\n}\n\nexport interface SelectDialogResult {\n buttonType: ButtonType | number;\n selection: Array<SelectDialogItem>;\n}\n\ndeclare enum SelectType {\n Default = 0,\n Icon = 1,\n IconAndText,\n}\n\nexport interface Env {\n language: any;\n parameters: any;\n isApp: boolean;\n isMobile: boolean;\n isTablet: boolean;\n}\n"],"mappings":";;;;;;IA+BYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAAAC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.196",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chayns",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"url": "https://github.com/TobitSoftware/chayns-components/issues"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@babel/cli": "^7.
|
|
37
|
-
"@babel/core": "^7.22.
|
|
38
|
-
"@babel/preset-env": "^7.22.
|
|
39
|
-
"@babel/preset-react": "^7.22.
|
|
40
|
-
"@babel/preset-typescript": "^7.
|
|
41
|
-
"@types/react": "^17.0.
|
|
36
|
+
"@babel/cli": "^7.22.5",
|
|
37
|
+
"@babel/core": "^7.22.5",
|
|
38
|
+
"@babel/preset-env": "^7.22.5",
|
|
39
|
+
"@babel/preset-react": "^7.22.5",
|
|
40
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
41
|
+
"@types/react": "^17.0.62",
|
|
42
42
|
"@types/react-dom": "^17.0.20",
|
|
43
43
|
"@types/styled-components": "^5.1.26",
|
|
44
|
-
"@types/uuid": "^9.0.
|
|
44
|
+
"@types/uuid": "^9.0.2",
|
|
45
45
|
"babel-loader": "^8.3.0",
|
|
46
|
-
"lerna": "^
|
|
46
|
+
"lerna": "^7.1.1",
|
|
47
47
|
"react": "^17.0.2",
|
|
48
48
|
"react-dom": "^17.0.2",
|
|
49
49
|
"styled-components": "^5.3.11",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@chayns/colors": "^2.0.0",
|
|
54
54
|
"clsx": "^1.2.1",
|
|
55
|
+
"date-fns": "^2.30.0",
|
|
55
56
|
"framer-motion": "^6.5.1",
|
|
56
57
|
"uuid": "^9.0.0"
|
|
57
58
|
},
|
|
@@ -63,5 +64,5 @@
|
|
|
63
64
|
"publishConfig": {
|
|
64
65
|
"access": "public"
|
|
65
66
|
},
|
|
66
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "3598788a8a1b044f7d506286dd7f942923d17113"
|
|
67
68
|
}
|