@chayns-components/core 5.0.0-beta.203 → 5.0.0-beta.205
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.js +8 -2
- package/lib/components/accordion/Accordion.js.map +1 -1
- package/lib/components/text-area/TextArea.js +1 -1
- package/lib/components/text-area/TextArea.js.map +1 -1
- package/lib/components/tooltip/Tooltip.d.ts +9 -1
- package/lib/components/tooltip/Tooltip.js +4 -3
- package/lib/components/tooltip/Tooltip.js.map +1 -1
- package/package.json +2 -2
|
@@ -64,8 +64,14 @@ const Accordion = _ref => {
|
|
|
64
64
|
setIsAccordionOpen(currentIsAccordionOpen => !currentIsAccordionOpen);
|
|
65
65
|
}, [isDisabled, updateOpenAccordionUuid, uuid]);
|
|
66
66
|
(0, _react.useEffect)(() => {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
if (isDisabled) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (typeof updateOpenAccordionUuid === 'function') {
|
|
71
|
+
updateOpenAccordionUuid(uuid);
|
|
72
|
+
}
|
|
73
|
+
setIsAccordionOpen(currentIsAccordionOpen => !currentIsAccordionOpen);
|
|
74
|
+
}, [isDisabled, shouldOpen, updateOpenAccordionUuid, uuid]);
|
|
69
75
|
(0, _react.useEffect)(() => {
|
|
70
76
|
if (isInitialRenderRef.current) {
|
|
71
77
|
isInitialRenderRef.current = false;
|
|
@@ -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","shouldOpen","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 * Whether the Accordion should be opened or closed. Can not be used with isDefaultOpen\n */\n shouldOpen?: 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 shouldOpen = 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 setIsAccordionOpen(shouldOpen);\n }, [shouldOpen]);\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\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EAAE9C,YAAa;IACvB+C,cAAc,EAAEpC,kBAAkB,IAAI,CAACc;EAAO,GAE7C/B,QACU,CAEN,CACP,CACS,CACd,CAAC;AAE1B,CAAC;AAEDH,SAAS,CAACD,WAAW,GAAG,WAAW;AAAC,IAAA0D,QAAA,GAErBzD,SAAS;AAAAF,OAAA,CAAAxB,OAAA,GAAAmF,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","shouldOpen","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 * Whether the Accordion should be opened or closed. Can not be used with isDefaultOpen\n */\n shouldOpen?: 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 shouldOpen = 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 (isDisabled) {\n return;\n }\n\n if (typeof updateOpenAccordionUuid === 'function') {\n updateOpenAccordionUuid(uuid);\n }\n\n setIsAccordionOpen((currentIsAccordionOpen) => !currentIsAccordionOpen);\n }, [isDisabled, shouldOpen, 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;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,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AAU,OAAA,CAAAqE,aAAA,CAACjD,gBAAgB,CAACoD,QAAQ;IAACC,KAAK,EAAEN;EAA8B,gBAC5D7E,MAAA,CAAAU,OAAA,CAAAqE,aAAA,CAACjF,aAAA,CAAAsF,YAAY;IAACC,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAQ;EAAE,gBACxCtF,MAAA,CAAAU,OAAA,CAAAqE,aAAA,CAACzE,cAAA,CAAAI,OAAa;IACV8B,IAAI,EAAEA,IAAK;IACX8B,MAAM,EAAEA,MAAO;IACf3B,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAa,IAAIF,UAAW;IAC3CT,SAAS,EAAEA,SAAU;IACrBsD,OAAO,EAAEhB,eAAgB;IACzBvB,cAAc,EAAEA,cAAe;IAC/BC,YAAY,EAAEA,YAAa;IAC3BC,UAAU,EAAEA,UAAW;IACvBC,iBAAiB,EAAEA,iBAAkB;IACrCG,KAAK,EAAEA,KAAM;IACbC,YAAY,EAAEA;EAAa,CAC9B,CAAC,eACFvD,MAAA,CAAAU,OAAA,CAAAqE,aAAA,CAACjF,aAAA,CAAA0F,eAAe;IAACC,OAAO,EAAE;EAAM,GAC3B,CAACnB,MAAM,IAAId,kBAAkB,kBAC1BxD,MAAA,CAAAU,OAAA,CAAAqE,aAAA,CAAC5E,cAAA,CAAAO,OAAa;IACVgF,SAAS,EAAEpD,aAAc;IACzBqD,QAAQ,EAAE9C,YAAa;IACvB+C,cAAc,EAAEpC,kBAAkB,IAAI,CAACc;EAAO,GAE7C/B,QACU,CAEN,CACP,CACS,CACd,CAAC;AAE1B,CAAC;AAEDH,SAAS,CAACD,WAAW,GAAG,WAAW;AAAC,IAAA0D,QAAA,GAErBzD,SAAS;AAAAF,OAAA,CAAAxB,OAAA,GAAAmF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","names":["_react","_interopRequireWildcard","require","_TextArea","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TextArea","_ref","placeholder","value","onChange","onBlur","maxHeight","displayedValue","setDisplayedValue","useState","isOverflowing","setIsOverflowing","textareaRef","useRef","useEffect","adjustTextareaHeight","useCallback","current","style","height","scrollHeight","parseInt","toString","handleChange","event","target","useMemo","createElement","StyledTextArea","StyledTextAreaInput","ref","rows","displayName","_default","exports"],"sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n CSSProperties,\n FC,\n FocusEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { StyledTextArea, StyledTextAreaInput } from './TextArea.styles';\n\nexport type TextAreaProps = {\n /**\n * The maximum height of the text area.\n */\n maxHeight?: CSSProperties['maxHeight'];\n /**\n * Function that is executed when the text area loses focus.\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Function that is executed when the text of the text area changes.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Placeholder for the text area field.\n */\n placeholder?: string;\n /**\n * Value if the text area should be controlled.\n */\n value?: string;\n};\n\nconst TextArea: FC<TextAreaProps> = ({\n placeholder,\n value,\n onChange,\n onBlur,\n maxHeight = '120px',\n}) => {\n const [displayedValue, setDisplayedValue] = useState('');\n const [isOverflowing, setIsOverflowing] = useState(false);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n /**\n * This function sets the external value\n */\n useEffect(() => {\n if (value) {\n setDisplayedValue(value);\n }\n }, [value]);\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;\n\n setIsOverflowing(textareaRef.current.scrollHeight > parseInt(maxHeight.toString(), 10));\n }\n }, [maxHeight]);\n\n /**\n * This function updates the value\n */\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n setDisplayedValue(event.target.value);\n\n adjustTextareaHeight();\n\n if (onChange) {\n onChange(event);\n }\n },\n [adjustTextareaHeight, onChange]\n );\n\n return useMemo(\n () => (\n <StyledTextArea>\n <StyledTextAreaInput\n ref={textareaRef}\n value={displayedValue}\n placeholder={placeholder}\n onBlur={onBlur}\n onChange={handleChange}\n maxHeight={maxHeight}\n isOverflowing={isOverflowing}\n rows={1}\n />\n </StyledTextArea>\n ),\n [displayedValue, handleChange, isOverflowing, maxHeight, onBlur, placeholder]\n );\n};\n\nTextArea.displayName = 'TextArea';\n\nexport default TextArea;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAYA,IAAAC,SAAA,GAAAD,OAAA;AAAwE,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAyBxE,MAAMW,QAA2B,GAAGC,IAAA,IAM9B;EAAA,IAN+B;IACjCC,WAAW;IACXC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,SAAS,GAAG;EAChB,CAAC,GAAAL,IAAA;EACG,MAAM,CAACM,cAAc,EAAEC,iBAAiB,CAAC,GAAG,IAAAC,eAAQ,EAAC,EAAE,CAAC;EACxD,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;EAEzD,MAAMG,WAAW,GAAG,IAAAC,aAAM,EAAsB,IAAI,CAAC;;EAErD;AACJ;AACA;EACI,IAAAC,gBAAS,EAAC,MAAM;IACZ,
|
|
1
|
+
{"version":3,"file":"TextArea.js","names":["_react","_interopRequireWildcard","require","_TextArea","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","TextArea","_ref","placeholder","value","onChange","onBlur","maxHeight","displayedValue","setDisplayedValue","useState","isOverflowing","setIsOverflowing","textareaRef","useRef","useEffect","adjustTextareaHeight","useCallback","current","style","height","scrollHeight","parseInt","toString","handleChange","event","target","useMemo","createElement","StyledTextArea","StyledTextAreaInput","ref","rows","displayName","_default","exports"],"sources":["../../../src/components/text-area/TextArea.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n CSSProperties,\n FC,\n FocusEventHandler,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { StyledTextArea, StyledTextAreaInput } from './TextArea.styles';\n\nexport type TextAreaProps = {\n /**\n * The maximum height of the text area.\n */\n maxHeight?: CSSProperties['maxHeight'];\n /**\n * Function that is executed when the text area loses focus.\n */\n onBlur?: FocusEventHandler<HTMLTextAreaElement>;\n /**\n * Function that is executed when the text of the text area changes.\n */\n onChange?: ChangeEventHandler<HTMLTextAreaElement>;\n /**\n * Placeholder for the text area field.\n */\n placeholder?: string;\n /**\n * Value if the text area should be controlled.\n */\n value?: string;\n};\n\nconst TextArea: FC<TextAreaProps> = ({\n placeholder,\n value,\n onChange,\n onBlur,\n maxHeight = '120px',\n}) => {\n const [displayedValue, setDisplayedValue] = useState('');\n const [isOverflowing, setIsOverflowing] = useState(false);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n /**\n * This function sets the external value\n */\n useEffect(() => {\n if (typeof value === 'string') {\n setDisplayedValue(value);\n }\n }, [value]);\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n textareaRef.current.style.height = 'auto';\n textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;\n\n setIsOverflowing(textareaRef.current.scrollHeight > parseInt(maxHeight.toString(), 10));\n }\n }, [maxHeight]);\n\n /**\n * This function updates the value\n */\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n setDisplayedValue(event.target.value);\n\n adjustTextareaHeight();\n\n if (onChange) {\n onChange(event);\n }\n },\n [adjustTextareaHeight, onChange]\n );\n\n return useMemo(\n () => (\n <StyledTextArea>\n <StyledTextAreaInput\n ref={textareaRef}\n value={displayedValue}\n placeholder={placeholder}\n onBlur={onBlur}\n onChange={handleChange}\n maxHeight={maxHeight}\n isOverflowing={isOverflowing}\n rows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;IAEtB,IAAIX,QAAQ,EAAE;MACVA,QAAQ,CAACoB,KAAK,CAAC;IACnB;EACJ,CAAC,EACD,CAACT,oBAAoB,EAAEX,QAAQ,CACnC,CAAC;EAED,OAAO,IAAAsB,cAAO,EACV,mBACIpD,MAAA,CAAAW,OAAA,CAAA0C,aAAA,CAAClD,SAAA,CAAAmD,cAAc,qBACXtD,MAAA,CAAAW,OAAA,CAAA0C,aAAA,CAAClD,SAAA,CAAAoD,mBAAmB;IAChBC,GAAG,EAAElB,WAAY;IACjBT,KAAK,EAAEI,cAAe;IACtBL,WAAW,EAAEA,WAAY;IACzBG,MAAM,EAAEA,MAAO;IACfD,QAAQ,EAAEmB,YAAa;IACvBjB,SAAS,EAAEA,SAAU;IACrBI,aAAa,EAAEA,aAAc;IAC7BqB,IAAI,EAAE;EAAE,CACX,CACW,CACnB,EACD,CAACxB,cAAc,EAAEgB,YAAY,EAAEb,aAAa,EAAEJ,SAAS,EAAED,MAAM,EAAEH,WAAW,CAChF,CAAC;AACL,CAAC;AAEDF,QAAQ,CAACgC,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAEnBjC,QAAQ;AAAAkC,OAAA,CAAAjD,OAAA,GAAAgD,QAAA"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import type { ITooltipItem } from './interface';
|
|
3
3
|
export type TooltipProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The elements that the tooltip should surround.
|
|
6
|
+
*/
|
|
7
|
+
children: ReactNode;
|
|
4
8
|
/**
|
|
5
9
|
* The content that should be displayed.
|
|
6
10
|
*/
|
|
7
11
|
item: ITooltipItem;
|
|
12
|
+
/**
|
|
13
|
+
* whether the tooltip should be shown.
|
|
14
|
+
*/
|
|
15
|
+
isDisabled?: boolean;
|
|
8
16
|
};
|
|
9
17
|
declare const Tooltip: FC<TooltipProps>;
|
|
10
18
|
export default Tooltip;
|
|
@@ -14,17 +14,18 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
14
14
|
const Tooltip = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
item,
|
|
17
|
-
children
|
|
17
|
+
children,
|
|
18
|
+
isDisabled
|
|
18
19
|
} = _ref;
|
|
19
20
|
const tooltipRef = (0, _react.useRef)(null);
|
|
20
|
-
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Tooltip.StyledTooltip, null, /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
21
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Tooltip.StyledTooltip, null, isDisabled ? children : /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
21
22
|
shouldShowOnHover: true,
|
|
22
23
|
content: /*#__PURE__*/_react.default.createElement(_TooltipItem.default, {
|
|
23
24
|
text: item.text,
|
|
24
25
|
headline: item.headline
|
|
25
26
|
}),
|
|
26
27
|
ref: tooltipRef
|
|
27
|
-
}, children)), [item,
|
|
28
|
+
}, children)), [isDisabled, children, item, item]);
|
|
28
29
|
};
|
|
29
30
|
Tooltip.displayName = 'Tooltip';
|
|
30
31
|
var _default = Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["_react","_interopRequireWildcard","require","_Popup","_interopRequireDefault","_TooltipItem","_Tooltip","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Tooltip","_ref","item","children","tooltipRef","useRef","useMemo","createElement","StyledTooltip","shouldShowOnHover","content","text","headline","ref","displayName","_default","exports"],"sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, useMemo, useRef } from 'react';\nimport Popup from '../popup/Popup';\nimport type { PopupRef } from '../popup/types';\nimport type { ITooltipItem } from './interface';\nimport TooltipItem from './tooltip-item/TooltipItem';\nimport { StyledTooltip } from './Tooltip.styles';\n\nexport type TooltipProps = {\n /**\n * The content that should be displayed.\n */\n item: ITooltipItem;\n};\n\nconst Tooltip: FC<TooltipProps> = ({ item, children }) => {\n const tooltipRef = useRef<PopupRef>(null);\n\n return useMemo(\n () => (\n <StyledTooltip>\n <Popup\n
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["_react","_interopRequireWildcard","require","_Popup","_interopRequireDefault","_TooltipItem","_Tooltip","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Tooltip","_ref","item","children","isDisabled","tooltipRef","useRef","useMemo","createElement","StyledTooltip","shouldShowOnHover","content","text","headline","ref","displayName","_default","exports"],"sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, { FC, ReactNode, useMemo, useRef } from 'react';\nimport Popup from '../popup/Popup';\nimport type { PopupRef } from '../popup/types';\nimport type { ITooltipItem } from './interface';\nimport TooltipItem from './tooltip-item/TooltipItem';\nimport { StyledTooltip } from './Tooltip.styles';\n\nexport type TooltipProps = {\n /**\n * The elements that the tooltip should surround.\n */\n children: ReactNode;\n /**\n * The content that should be displayed.\n */\n item: ITooltipItem;\n /**\n * whether the tooltip should be shown.\n */\n isDisabled?: boolean;\n};\n\nconst Tooltip: FC<TooltipProps> = ({ item, children, isDisabled }) => {\n const tooltipRef = useRef<PopupRef>(null);\n\n return useMemo(\n () => (\n <StyledTooltip>\n {isDisabled ? (\n children\n ) : (\n <Popup\n shouldShowOnHover\n content={<TooltipItem text={item.text} headline={item.headline} />}\n ref={tooltipRef}\n >\n {children}\n </Popup>\n )}\n </StyledTooltip>\n ),\n [isDisabled, children, item, item]\n );\n};\n\nTooltip.displayName = 'Tooltip';\n\nexport default Tooltip;\n"],"mapp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K,GAAA,IAAAhB,GAAA,CAAAgB,GAAA,SAAAL,MAAA,CAAAT,OAAA,GAAAF,GAAA,MAAAQ,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAArB,GAAA,EAAAW,MAAA,YAAAA,MAAA;AAiBjD,MAAMW,OAAyB,GAAGC,IAAA,IAAoC;EAAA,IAAnC;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAAH,IAAA;EAC7D,MAAMI,UAAU,GAAG,IAAAC,aAAM,EAAW,IAAI,CAAC;EAEzC,OAAO,IAAAC,cAAO,EACV,mBACIpC,MAAA,CAAAS,OAAA,CAAA4B,aAAA,CAAC/B,QAAA,CAAAgC,aAAa,QACTL,UAAU,GACPD,QAAQ,gBAERhC,MAAA,CAAAS,OAAA,CAAA4B,aAAA,CAAClC,MAAA,CAAAM,OAAK;IACF8B,iBAAiB;IACjBC,OAAO,eAAExC,MAAA,CAAAS,OAAA,CAAA4B,aAAA,CAAChC,YAAA,CAAAI,OAAW;MAACgC,IAAI,EAAEV,IAAI,CAACU,IAAK;MAACC,QAAQ,EAAEX,IAAI,CAACW;IAAS,CAAE,CAAE;IACnEC,GAAG,EAAET;EAAW,GAEfF,QACE,CAEA,CAClB,EACD,CAACC,UAAU,EAAED,QAAQ,EAAED,IAAI,EAAEA,IAAI,CACrC,CAAC;AACL,CAAC;AAEDF,OAAO,CAACe,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAEjBhB,OAAO;AAAAiB,OAAA,CAAArC,OAAA,GAAAoC,QAAA"}
|
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.205",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chayns",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "0e2338dd9729d564cca2441b75f8bd699d0a1196"
|
|
68
68
|
}
|