@helsenorge/designsystem-react 10.1.0 → 10.2.0
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/AnchorLink.js +2 -2
- package/AnchorLink.js.map +1 -1
- package/Avatar.js +2 -2
- package/Avatar.js.map +1 -1
- package/Badge.js +3 -3
- package/Badge.js.map +1 -1
- package/Button.js +4 -4
- package/Button.js.map +1 -1
- package/CHANGELOG.md +1367 -801
- package/Checkbox.js +2 -2
- package/Checkbox.js.map +1 -1
- package/Close.js +2 -2
- package/Close.js.map +1 -1
- package/ErrorBoundary.js +2 -2
- package/ErrorBoundary.js.map +1 -1
- package/FormGroup.js +12 -12
- package/FormGroup.js.map +1 -1
- package/FormLayout.js +3 -3
- package/FormLayout.js.map +1 -1
- package/HelpBubble.js +2 -2
- package/HelpBubble.js.map +1 -1
- package/HighlightPanel.js +2 -2
- package/HighlightPanel.js.map +1 -1
- package/Icon.js +3 -3
- package/Icon.js.map +1 -1
- package/Illustration.js +3 -3
- package/Illustration.js.map +1 -1
- package/Input.js +2 -2
- package/Input.js.map +1 -1
- package/Label.js +8 -8
- package/Label.js.map +1 -1
- package/LazyIcon.js +1 -1
- package/LazyIllustration.js +3 -3
- package/LazyIllustration.js.map +1 -1
- package/LinkList.js +6 -6
- package/LinkList.js.map +1 -1
- package/ListHeader.js +7 -7
- package/ListHeader.js.map +1 -1
- package/Panel.js +2 -2
- package/Panel.js.map +1 -1
- package/PopOver.js +2 -2
- package/PopOver.js.map +1 -1
- package/RadioButton.js +2 -2
- package/RadioButton.js.map +1 -1
- package/Select.js +2 -2
- package/Select.js.map +1 -1
- package/Slider.js +3 -3
- package/Slider.js.map +1 -1
- package/Spacer.js +2 -2
- package/Spacer.js.map +1 -1
- package/StatusDot.js +1 -1
- package/StepButtons.js +4 -4
- package/StepButtons.js.map +1 -1
- package/TabList.js +4 -4
- package/TabList.js.map +1 -1
- package/Table.js +2 -2
- package/Table.js.map +1 -1
- package/TableBody.js +2 -2
- package/TableBody.js.map +1 -1
- package/TableExpandedRow.js +2 -2
- package/TableExpandedRow.js.map +1 -1
- package/TableHead.js +2 -2
- package/TableHead.js.map +1 -1
- package/TableRow.js +2 -2
- package/TableRow.js.map +1 -1
- package/Textarea.js +2 -2
- package/Textarea.js.map +1 -1
- package/Title.js +2 -2
- package/Title.js.map +1 -1
- package/TooltipWord.js +2 -2
- package/TooltipWord.js.map +1 -1
- package/Trigger.js +3 -3
- package/Trigger.js.map +1 -1
- package/components/Button/styles.module.scss +5 -0
- package/components/DictionaryTrigger/index.js +2 -2
- package/components/DictionaryTrigger/index.js.map +1 -1
- package/components/Drawer/Drawer.d.ts +41 -0
- package/components/Drawer/Drawer.test.d.ts +1 -0
- package/components/Drawer/index.d.ts +3 -0
- package/components/Drawer/index.js +350 -0
- package/components/Drawer/index.js.map +1 -0
- package/components/Drawer/styles.module.scss +127 -0
- package/components/Drawer/styles.module.scss.d.ts +16 -0
- package/components/Dropdown/index.js +3 -3
- package/components/Dropdown/index.js.map +1 -1
- package/components/Duolist/index.js +4 -4
- package/components/Duolist/index.js.map +1 -1
- package/components/ExpanderHierarchy/index.js +5 -5
- package/components/ExpanderHierarchy/index.js.map +1 -1
- package/components/ExpanderList/index.js +8 -8
- package/components/ExpanderList/index.js.map +1 -1
- package/components/HelpQuestion/index.js +2 -2
- package/components/HelpQuestion/index.js.map +1 -1
- package/components/HighlightPanel/styles.module.scss +4 -36
- package/components/HighlightPanel/styles.module.scss.d.ts +1 -2
- package/components/Icons/EuropeanHealthCard.js +1 -1
- package/components/Icons/GroupTwins.js +1 -1
- package/components/Icons/Inbox.js +1 -1
- package/components/Icons/LawBook.js +1 -1
- package/components/Icons/PersonCancel.js +1 -1
- package/components/Icons/PersonWithBrain.js +1 -1
- package/components/Icons/Puzzle.js +1 -1
- package/components/Icons/Snapchat.js +1 -1
- package/components/Illustrations/IllustrationNames.d.ts +1 -1
- package/components/Illustrations/IllustrationNames.js +4 -2
- package/components/Illustrations/IllustrationNames.js.map +1 -1
- package/components/Illustrations/ReadLetters.d.ts +9 -0
- package/components/Illustrations/ReadLetters.js +11 -0
- package/components/Illustrations/ReadLetters.js.map +1 -0
- package/components/Illustrations/ReadLettersMedium.d.ts +4 -0
- package/components/Illustrations/ReadLettersMedium.js +110 -0
- package/components/Illustrations/ReadLettersMedium.js.map +1 -0
- package/components/Illustrations/Support2.d.ts +9 -0
- package/components/Illustrations/Support2.js +11 -0
- package/components/Illustrations/Support2.js.map +1 -0
- package/components/Illustrations/Support2Medium.d.ts +4 -0
- package/components/Illustrations/Support2Medium.js +232 -0
- package/components/Illustrations/Support2Medium.js.map +1 -0
- package/components/Label/styles.module.scss +16 -12
- package/components/Label/styles.module.scss.d.ts +3 -1
- package/components/List/styles.module.scss +7 -7
- package/components/Modal/index.js +71 -82
- package/components/Modal/index.js.map +1 -1
- package/components/Modal/styles.module.scss +12 -6
- package/components/NotificationPanel/index.js +3 -3
- package/components/NotificationPanel/index.js.map +1 -1
- package/components/PanelList/index.js +5 -5
- package/components/PanelList/index.js.map +1 -1
- package/components/PopMenu/index.js +5 -5
- package/components/PopMenu/index.js.map +1 -1
- package/components/Portal/index.js +3 -3
- package/components/Portal/index.js.map +1 -1
- package/components/PromoPanel/index.js +2 -2
- package/components/PromoPanel/index.js.map +1 -1
- package/components/Tabs/index.js +3 -3
- package/components/Tabs/index.js.map +1 -1
- package/components/TagList/index.js +2 -2
- package/components/TagList/index.js.map +1 -1
- package/components/Tile/index.js +6 -6
- package/components/Tile/index.js.map +1 -1
- package/components/Toggle/index.js +3 -3910
- package/components/Toggle/index.js.map +1 -1
- package/components/Tooltip/index.js +2 -2
- package/components/Tooltip/index.js.map +1 -1
- package/components/Validation/index.js +6 -6
- package/components/Validation/index.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/constants.js.map +1 -1
- package/hoc/withBreakpoint/withBreakpoint.js +2 -2
- package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
- package/hooks/useBreakpoint.d.ts +0 -4
- package/hooks/useBreakpoint.js +23 -18
- package/hooks/useBreakpoint.js.map +1 -1
- package/hooks/useEventListenerState.js +3 -3
- package/hooks/useEventListenerState.js.map +1 -1
- package/hooks/useReturnFocusOnUnmount.d.ts +5 -0
- package/hooks/useReturnFocusOnUnmount.js +20 -0
- package/hooks/useReturnFocusOnUnmount.js.map +1 -0
- package/package.json +1 -1
- package/scss/_breakpoints.scss +6 -0
- package/scss/_font-mixins.scss +55 -0
- package/scss/typography.module.scss +24 -0
- package/scss/typography.module.scss.d.ts +6 -0
- package/scss/typography.stories.tsx +24 -0
- package/theme/index.js +2 -2
- package/use-animate.js +3952 -0
- package/use-animate.js.map +1 -0
- package/utils/accessibility.d.ts +1 -0
- package/utils/accessibility.js +6 -1
- package/utils/accessibility.js.map +1 -1
- package/utils/component.js +4 -4
- package/utils/component.js.map +1 -1
package/Checkbox.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { useState, useEffect } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { FormOnColor, FormSize, AnalyticsId, IconSize } from "./constants.js";
|
|
5
5
|
import { usePseudoClasses } from "./hooks/usePseudoClasses.js";
|
|
@@ -13,7 +13,7 @@ import { I as Icon } from "./Icon.js";
|
|
|
13
13
|
import Check from "./components/Icons/Check.js";
|
|
14
14
|
import { g as getLabelText, r as renderLabelAsParent } from "./Label.js";
|
|
15
15
|
import checkboxStyles from "./components/Checkbox/styles.module.scss";
|
|
16
|
-
const Checkbox =
|
|
16
|
+
const Checkbox = React__default.forwardRef((props, ref) => {
|
|
17
17
|
const {
|
|
18
18
|
className,
|
|
19
19
|
checked = false,
|
package/Checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, FormSize, IconSize } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys/color';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport Check from '../Icons/Check';\nimport { getLabelText, renderLabelAsParent } from '../Label';\n\nimport checkboxStyles from './styles.module.scss';\n\nexport interface CheckboxProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-describedby' | 'name' | 'value' | 'disabled' | 'checked' | 'required' | 'onChange'\n > {\n /** Adds custom classes to the element. */\n className?: string;\n /** The <Label/> next to the checkbox - sublabels kan ikke kombineres med large variant */\n label: React.ReactNode;\n /** input id of the checkbox */\n inputId?: string;\n /** Changes the visuals of the checkbox */\n onColor?: keyof typeof FormOnColor;\n /** Changes the visuals of the checkbox */\n size?: keyof typeof FormSize;\n /** Activates Error style for the checkbox - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Checkbox = React.forwardRef((props: CheckboxProps, ref: React.Ref<HTMLInputElement>) => {\n const {\n className,\n checked = false,\n disabled,\n label,\n inputId = uuid(),\n onColor = FormOnColor.onwhite,\n name = inputId,\n size,\n errorText,\n error = !!errorText,\n errorTextId,\n errorWrapperClassName,\n value = getLabelText(label),\n testId,\n required,\n onChange,\n ...rest\n } = props;\n const [isChecked, setIsChecked] = useState(checked);\n const errorTextUuid = useUuid(errorTextId);\n const onWhite = onColor === FormOnColor.onwhite;\n const onGrey = onColor === FormOnColor.ongrey;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const onInvalid = error || onColor === FormOnColor.oninvalid;\n const onDark = onColor === FormOnColor.ondark;\n const large = size === FormSize.large;\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n\n const checkboxWrapperClasses = classNames({\n [checkboxStyles['checkbox-wrapper--large']]: large,\n });\n const checkboxLabelClasses = classNames(checkboxStyles['checkbox-label'], {\n [checkboxStyles['checkbox-label--disabled']]: disabled,\n [checkboxStyles['checkbox-label--on-dark']]: onDark,\n [checkboxStyles['checkbox-label--large']]: large,\n [checkboxStyles['checkbox-label__large--checked']]: large && isChecked,\n [checkboxStyles['checkbox-label__large--focus']]: large && isFocused,\n [checkboxStyles['checkbox-label__large--on-white']]: large && onWhite,\n [checkboxStyles['checkbox-label__large--on-grey']]: large && onGrey,\n [checkboxStyles['checkbox-label__large--on-blueberry']]: large && onBlueberry,\n [checkboxStyles['checkbox-label__large--on-invalid']]: large && onInvalid,\n [checkboxStyles['checkbox-label__large--disabled']]: large && disabled,\n });\n const checkboxClasses = classNames(checkboxStyles.checkbox, className);\n const checkboxIconWrapperClasses = classNames(checkboxStyles['checkbox__icon-wrapper'], {\n [checkboxStyles['checkbox__icon-wrapper--on-white']]: onWhite,\n [checkboxStyles['checkbox__icon-wrapper--on-grey']]: onGrey,\n [checkboxStyles['checkbox__icon-wrapper--on-invalid']]: onInvalid,\n [checkboxStyles['checkbox__icon-wrapper--disabled']]: disabled,\n [checkboxStyles['checkbox__icon-wrapper__regular--checked']]: !large && isChecked,\n [checkboxStyles['checkbox__icon-wrapper__regular--invalid']]: !large && isChecked && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__regular--on-dark']]: !large && isChecked && onDark,\n [checkboxStyles['checkbox__icon-wrapper__large--checked']]: large && isChecked,\n [checkboxStyles['checkbox__icon-wrapper__large--invalid']]: large && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper--on-dark']]: onDark,\n [checkboxStyles['checkbox__icon-wrapper--on-blueberry']]: onBlueberry,\n [checkboxStyles['checkbox__icon-wrapper--invalid']]: onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__large--invalid']]: large && isChecked && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__large--disabled']]: disabled && large && isChecked,\n [checkboxStyles['checkbox__icon-wrapper__large--checked--invalid']]: large && isChecked && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__large--checked--disabled']]: disabled && large && isChecked,\n });\n const labelTextClasses = classNames(checkboxStyles['checkbox-label__text'], {\n [checkboxStyles['checkbox-label__text__large--checked']]: large && isChecked,\n [checkboxStyles['checkbox-label__text__large--invalid']]: large && isChecked && onInvalid,\n [checkboxStyles['checkbox-label__text--on-dark']]: onDark,\n [checkboxStyles['checkbox-label__text--disabled']]: disabled,\n });\n\n let iconColor = getColor('white');\n if (onDark || (large && isChecked)) iconColor = getColor('blueberry', 900);\n if (onInvalid && large && isChecked) iconColor = getColor('white');\n if (disabled) iconColor = getColor('neutral', 700);\n\n useEffect(() => {\n setIsChecked(checked);\n }, [checked]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (onChange) {\n onChange(e);\n }\n\n setIsChecked(!isChecked);\n };\n\n const getLabelContent = (): React.ReactNode => {\n return (\n <>\n <input\n id={inputId}\n name={name}\n className={checkboxClasses}\n type=\"checkbox\"\n checked={isChecked}\n disabled={disabled}\n value={value}\n ref={mergedRefs}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={error}\n required={required}\n onChange={onChangeHandler}\n {...rest}\n />\n <span className={checkboxIconWrapperClasses}>\n {isChecked && <Icon color={iconColor} className={checkboxStyles['checkbox__icon']} svgIcon={Check} size={IconSize.XSmall} />}\n </span>\n </>\n );\n };\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Checkbox} className={checkboxWrapperClasses}>\n {renderLabelAsParent(\n label,\n getLabelContent(),\n inputId,\n onColor as FormOnColor,\n checkboxLabelClasses,\n labelTextClasses,\n checkboxStyles['checkbox-sublabel-wrapper'],\n large\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA4CO,MAAM,WAAW,MAAM,WAAW,CAAC,OAAsB,QAAqC;AAC7F,QAAA;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,UAAU,KAAK;AAAA,IACf,UAAU,YAAY;AAAA,IACtB,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,QAAQ,CAAC,CAAC;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ,aAAa,KAAK;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,OAAO;AAC5C,QAAA,gBAAgB,QAAQ,WAAW;AACnC,QAAA,UAAU,YAAY,YAAY;AAClC,QAAA,SAAS,YAAY,YAAY;AACjC,QAAA,cAAc,YAAY,YAAY;AACtC,QAAA,YAAY,SAAS,YAAY,YAAY;AAC7C,QAAA,SAAS,YAAY,YAAY;AACjC,QAAA,QAAQ,SAAS,SAAS;AAC1B,QAAA,EAAE,WAAW,cAAc,iBAAmC,mBAAmB,GAAG,IAAI,MAAM,IAAI;AACxG,QAAM,aAAa,UAAU,CAAC,KAAK,SAAS,CAAC;AAE7C,QAAM,yBAAyB,WAAW;AAAA,IACxC,CAAC,eAAe,yBAAyB,CAAC,GAAG;AAAA,EAAA,CAC9C;AACD,QAAM,uBAAuB,WAAW,eAAe,gBAAgB,GAAG;AAAA,IACxE,CAAC,eAAe,0BAA0B,CAAC,GAAG;AAAA,IAC9C,CAAC,eAAe,yBAAyB,CAAC,GAAG;AAAA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5H,CAAA;AAAA,IAAA,GACF;AAAA,EAEJ;AAEA,SACG,oBAAA,cAAA,EAAa,WAAW,uBAAuB,WAAsB,aAAa,eACjF,UAAC,oBAAA,OAAA,EAAI,eAAa,QAAQ,oBAAkB,YAAY,UAAU,WAAW,wBAC1E,UAAA;AAAA,IACC;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,2BAA2B;AAAA,IAC1C;AAAA,KAEJ,EACF,CAAA;AAEJ,CAAC;AAED,SAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, FormSize, IconSize } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys/color';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { isMutableRefObject, mergeRefs } from '../../utils/refs';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport Check from '../Icons/Check';\nimport { getLabelText, renderLabelAsParent } from '../Label';\n\nimport checkboxStyles from './styles.module.scss';\n\nexport interface CheckboxProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'aria-describedby' | 'name' | 'value' | 'disabled' | 'checked' | 'required' | 'onChange'\n > {\n /** Adds custom classes to the element. */\n className?: string;\n /** The <Label/> next to the checkbox - sublabels kan ikke kombineres med large variant */\n label: React.ReactNode;\n /** input id of the checkbox */\n inputId?: string;\n /** Changes the visuals of the checkbox */\n onColor?: keyof typeof FormOnColor;\n /** Changes the visuals of the checkbox */\n size?: keyof typeof FormSize;\n /** Activates Error style for the checkbox - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Checkbox = React.forwardRef((props: CheckboxProps, ref: React.Ref<HTMLInputElement>) => {\n const {\n className,\n checked = false,\n disabled,\n label,\n inputId = uuid(),\n onColor = FormOnColor.onwhite,\n name = inputId,\n size,\n errorText,\n error = !!errorText,\n errorTextId,\n errorWrapperClassName,\n value = getLabelText(label),\n testId,\n required,\n onChange,\n ...rest\n } = props;\n const [isChecked, setIsChecked] = useState(checked);\n const errorTextUuid = useUuid(errorTextId);\n const onWhite = onColor === FormOnColor.onwhite;\n const onGrey = onColor === FormOnColor.ongrey;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const onInvalid = error || onColor === FormOnColor.oninvalid;\n const onDark = onColor === FormOnColor.ondark;\n const large = size === FormSize.large;\n const { refObject, isFocused } = usePseudoClasses<HTMLInputElement>(isMutableRefObject(ref) ? ref : null);\n const mergedRefs = mergeRefs([ref, refObject]);\n\n const checkboxWrapperClasses = classNames({\n [checkboxStyles['checkbox-wrapper--large']]: large,\n });\n const checkboxLabelClasses = classNames(checkboxStyles['checkbox-label'], {\n [checkboxStyles['checkbox-label--disabled']]: disabled,\n [checkboxStyles['checkbox-label--on-dark']]: onDark,\n [checkboxStyles['checkbox-label--large']]: large,\n [checkboxStyles['checkbox-label__large--checked']]: large && isChecked,\n [checkboxStyles['checkbox-label__large--focus']]: large && isFocused,\n [checkboxStyles['checkbox-label__large--on-white']]: large && onWhite,\n [checkboxStyles['checkbox-label__large--on-grey']]: large && onGrey,\n [checkboxStyles['checkbox-label__large--on-blueberry']]: large && onBlueberry,\n [checkboxStyles['checkbox-label__large--on-invalid']]: large && onInvalid,\n [checkboxStyles['checkbox-label__large--disabled']]: large && disabled,\n });\n const checkboxClasses = classNames(checkboxStyles.checkbox, className);\n const checkboxIconWrapperClasses = classNames(checkboxStyles['checkbox__icon-wrapper'], {\n [checkboxStyles['checkbox__icon-wrapper--on-white']]: onWhite,\n [checkboxStyles['checkbox__icon-wrapper--on-grey']]: onGrey,\n [checkboxStyles['checkbox__icon-wrapper--on-invalid']]: onInvalid,\n [checkboxStyles['checkbox__icon-wrapper--disabled']]: disabled,\n [checkboxStyles['checkbox__icon-wrapper__regular--checked']]: !large && isChecked,\n [checkboxStyles['checkbox__icon-wrapper__regular--invalid']]: !large && isChecked && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__regular--on-dark']]: !large && isChecked && onDark,\n [checkboxStyles['checkbox__icon-wrapper__large--checked']]: large && isChecked,\n [checkboxStyles['checkbox__icon-wrapper__large--invalid']]: large && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper--on-dark']]: onDark,\n [checkboxStyles['checkbox__icon-wrapper--on-blueberry']]: onBlueberry,\n [checkboxStyles['checkbox__icon-wrapper--invalid']]: onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__large--invalid']]: large && isChecked && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__large--disabled']]: disabled && large && isChecked,\n [checkboxStyles['checkbox__icon-wrapper__large--checked--invalid']]: large && isChecked && onInvalid,\n [checkboxStyles['checkbox__icon-wrapper__large--checked--disabled']]: disabled && large && isChecked,\n });\n const labelTextClasses = classNames(checkboxStyles['checkbox-label__text'], {\n [checkboxStyles['checkbox-label__text__large--checked']]: large && isChecked,\n [checkboxStyles['checkbox-label__text__large--invalid']]: large && isChecked && onInvalid,\n [checkboxStyles['checkbox-label__text--on-dark']]: onDark,\n [checkboxStyles['checkbox-label__text--disabled']]: disabled,\n });\n\n let iconColor = getColor('white');\n if (onDark || (large && isChecked)) iconColor = getColor('blueberry', 900);\n if (onInvalid && large && isChecked) iconColor = getColor('white');\n if (disabled) iconColor = getColor('neutral', 700);\n\n useEffect(() => {\n setIsChecked(checked);\n }, [checked]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (onChange) {\n onChange(e);\n }\n\n setIsChecked(!isChecked);\n };\n\n const getLabelContent = (): React.ReactNode => {\n return (\n <>\n <input\n id={inputId}\n name={name}\n className={checkboxClasses}\n type=\"checkbox\"\n checked={isChecked}\n disabled={disabled}\n value={value}\n ref={mergedRefs}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={error}\n required={required}\n onChange={onChangeHandler}\n {...rest}\n />\n <span className={checkboxIconWrapperClasses}>\n {isChecked && <Icon color={iconColor} className={checkboxStyles['checkbox__icon']} svgIcon={Check} size={IconSize.XSmall} />}\n </span>\n </>\n );\n };\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Checkbox} className={checkboxWrapperClasses}>\n {renderLabelAsParent(\n label,\n getLabelContent(),\n inputId,\n onColor as FormOnColor,\n checkboxLabelClasses,\n labelTextClasses,\n checkboxStyles['checkbox-sublabel-wrapper'],\n large\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;AA4CO,MAAM,WAAWA,eAAM,WAAW,CAAC,OAAsB,QAAqC;AAC7F,QAAA;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,UAAU,KAAK;AAAA,IACf,UAAU,YAAY;AAAA,IACtB,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,QAAQ,CAAC,CAAC;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ,aAAa,KAAK;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,OAAO;AAC5C,QAAA,gBAAgB,QAAQ,WAAW;AACnC,QAAA,UAAU,YAAY,YAAY;AAClC,QAAA,SAAS,YAAY,YAAY;AACjC,QAAA,cAAc,YAAY,YAAY;AACtC,QAAA,YAA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A,UAAA,EAAA,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAI;AAAA,UACJ;AAAA,UACA,WAAW;AAAA,UACX,MAAK;AAAA,UACL,SAAS;AAAA,UACT;AAAA,UACA;AAAA,UACA,KAAK;AAAA,UACL,oBAAkB,mBAAmB,OAAO,aAAa;AAAA,UACzD,gBAAc;AAAA,UACd;AAAA,UACA,UAAU;AAAA,UACT,GAAG;AAAA,QAAA;AAAA,MACN;AAAA,0BACC,QAAK,EAAA,WAAW,4BACd,UAAa,aAAA,oBAAC,QAAK,OAAO,WAAW,WAAW,eAAe,gBAAgB,GAAG,SAAS,OAAO,MAAM,SAAS,QAAQ,EAC5H,CAAA;AAAA,IAAA,GACF;AAAA,EAEJ;AAEA,SACG,oBAAA,cAAA,EAAa,WAAW,uBAAuB,WAAsB,aAAa,eACjF,UAAC,oBAAA,OAAA,EAAI,eAAa,QAAQ,oBAAkB,YAAY,UAAU,WAAW,wBAC1E,UAAA;AAAA,IACC;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,2BAA2B;AAAA,IAC1C;AAAA,KAEJ,EACF,CAAA;AAEJ,CAAC;AAED,SAAS,cAAc;"}
|
package/Close.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { AnalyticsId } from "./constants.js";
|
|
5
5
|
import { useBreakpoint, Breakpoint } from "./hooks/useBreakpoint.js";
|
|
@@ -9,7 +9,7 @@ import { mergeRefs } from "./utils/refs.js";
|
|
|
9
9
|
import { I as Icon } from "./Icon.js";
|
|
10
10
|
import X from "./components/Icons/X.js";
|
|
11
11
|
import styles from "./components/Close/styles.module.scss";
|
|
12
|
-
const Close =
|
|
12
|
+
const Close = React__default.forwardRef(function ButtonForwardedRef(props, ref) {
|
|
13
13
|
const { small, testId, ariaLabel = "Lukk", onClick, className, color = palette.blueberry600 } = props;
|
|
14
14
|
const breakpoint = useBreakpoint();
|
|
15
15
|
const { hoverRef, isHovered } = useHover();
|
package/Close.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Close.js","sources":["../src/components/Close/Close.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { palette } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon from '../Icon';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport interface CloseProps {\n /** Keeps the icon small for all screen sizes */\n small?: boolean;\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Gives color to the svg */\n color?: string;\n}\n\nconst Close = React.forwardRef(function ButtonForwardedRef(props: CloseProps, ref: React.ForwardedRef<HTMLButtonElement>) {\n const { small, testId, ariaLabel = 'Lukk', onClick, className, color = palette.blueberry600 } = props;\n const breakpoint = useBreakpoint();\n const { hoverRef, isHovered } = useHover();\n\n const iconSize = breakpoint === Breakpoint.xs || small ? 38 : 48;\n\n const closeClasses = classNames(styles.close, { [styles['close--small']]: small }, className);\n\n return (\n <button\n ref={mergeRefs([ref, hoverRef])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Close}\n className={closeClasses}\n aria-label={ariaLabel}\n onClick={onClick}\n type=\"button\"\n >\n <Icon svgIcon={X} color={color} size={iconSize} isHovered={isHovered} />\n </button>\n );\n});\n\nexport default Close;\n"],"names":[],"mappings":";;;;;;;;;;;AA6BA,MAAM,
|
|
1
|
+
{"version":3,"file":"Close.js","sources":["../src/components/Close/Close.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { palette } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon from '../Icon';\nimport X from '../Icons/X';\n\nimport styles from './styles.module.scss';\n\nexport interface CloseProps {\n /** Keeps the icon small for all screen sizes */\n small?: boolean;\n /** Function is called when user clicks the button */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Sets the aria-label of the button */\n ariaLabel?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Gives color to the svg */\n color?: string;\n}\n\nconst Close = React.forwardRef(function ButtonForwardedRef(props: CloseProps, ref: React.ForwardedRef<HTMLButtonElement>) {\n const { small, testId, ariaLabel = 'Lukk', onClick, className, color = palette.blueberry600 } = props;\n const breakpoint = useBreakpoint();\n const { hoverRef, isHovered } = useHover();\n\n const iconSize = breakpoint === Breakpoint.xs || small ? 38 : 48;\n\n const closeClasses = classNames(styles.close, { [styles['close--small']]: small }, className);\n\n return (\n <button\n ref={mergeRefs([ref, hoverRef])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Close}\n className={closeClasses}\n aria-label={ariaLabel}\n onClick={onClick}\n type=\"button\"\n >\n <Icon svgIcon={X} color={color} size={iconSize} isHovered={isHovered} />\n </button>\n );\n});\n\nexport default Close;\n"],"names":["React"],"mappings":";;;;;;;;;;;AA6BA,MAAM,QAAQA,eAAM,WAAW,SAAS,mBAAmB,OAAmB,KAA4C;AAClH,QAAA,EAAE,OAAO,QAAQ,YAAY,QAAQ,SAAS,WAAW,QAAQ,QAAQ,aAAiB,IAAA;AAChG,QAAM,aAAa,cAAc;AACjC,QAAM,EAAE,UAAU,UAAU,IAAI,SAAS;AAEzC,QAAM,WAAW,eAAe,WAAW,MAAM,QAAQ,KAAK;AAE9D,QAAM,eAAe,WAAW,OAAO,OAAO,EAAE,CAAC,OAAO,cAAc,CAAC,GAAG,MAAM,GAAG,SAAS;AAG1F,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK,UAAU,CAAC,KAAK,QAAQ,CAAC;AAAA,MAC9B,eAAa;AAAA,MACb,oBAAkB,YAAY;AAAA,MAC9B,WAAW;AAAA,MACX,cAAY;AAAA,MACZ;AAAA,MACA,MAAK;AAAA,MAEL,8BAAC,MAAK,EAAA,SAAS,GAAG,OAAc,MAAM,UAAU,UAAsB,CAAA;AAAA,IAAA;AAAA,EACxE;AAEJ,CAAC;"}
|
package/ErrorBoundary.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from "react";
|
|
2
2
|
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
3
3
|
const v = glob[path];
|
|
4
4
|
if (v) {
|
|
@@ -15,7 +15,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
15
15
|
);
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
class ErrorBoundary extends
|
|
18
|
+
class ErrorBoundary extends React__default.Component {
|
|
19
19
|
constructor(props) {
|
|
20
20
|
super(props);
|
|
21
21
|
this.state = {
|
package/ErrorBoundary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sources":["../src/components/LazyIcon/ErrorBoundary.tsx"],"sourcesContent":["import React from 'react';\n\ninterface ErrorBoundaryProps<T> {\n fallback: React.ReactNode;\n children: React.ReactNode;\n reset: T;\n}\n\ninterface ErrorBoundaryState {\n error: boolean;\n}\n\nclass ErrorBoundary<T> extends React.Component<ErrorBoundaryProps<T>, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps<T>) {\n super(props);\n this.state = {\n error: false,\n };\n }\n\n componentDidCatch(): void {\n this.setState({ error: true });\n }\n\n componentDidUpdate(prevProps: Readonly<ErrorBoundaryProps<T>>): void {\n if (prevProps.reset !== this.props.reset) {\n this.setState({ error: false });\n }\n }\n\n render(): React.ReactNode {\n return this.state.error ? this.props.fallback : this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sources":["../src/components/LazyIcon/ErrorBoundary.tsx"],"sourcesContent":["import React from 'react';\n\ninterface ErrorBoundaryProps<T> {\n fallback: React.ReactNode;\n children: React.ReactNode;\n reset: T;\n}\n\ninterface ErrorBoundaryState {\n error: boolean;\n}\n\nclass ErrorBoundary<T> extends React.Component<ErrorBoundaryProps<T>, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryProps<T>) {\n super(props);\n this.state = {\n error: false,\n };\n }\n\n componentDidCatch(): void {\n this.setState({ error: true });\n }\n\n componentDidUpdate(prevProps: Readonly<ErrorBoundaryProps<T>>): void {\n if (prevProps.reset !== this.props.reset) {\n this.setState({ error: false });\n }\n }\n\n render(): React.ReactNode {\n return this.state.error ? this.props.fallback : this.props.children;\n }\n}\n\nexport default ErrorBoundary;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,sBAAyBA,eAAM,UAAqD;AAAA,EACxF,YAAY,OAA8B;AACxC,UAAM,KAAK;AACX,SAAK,QAAQ;AAAA,MACX,OAAO;AAAA,IACT;AAAA,EAAA;AAAA,EAGF,oBAA0B;AACxB,SAAK,SAAS,EAAE,OAAO,KAAA,CAAM;AAAA,EAAA;AAAA,EAG/B,mBAAmB,WAAkD;AACnE,QAAI,UAAU,UAAU,KAAK,MAAM,OAAO;AACxC,WAAK,SAAS,EAAE,OAAO,MAAA,CAAO;AAAA,IAAA;AAAA,EAChC;AAAA,EAGF,SAA0B;AACxB,WAAO,KAAK,MAAM,QAAQ,KAAK,MAAM,WAAW,KAAK,MAAM;AAAA,EAAA;AAE/D;"}
|
package/FormGroup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { useState } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { FormOnColor, FormSize, AnalyticsId } from "./constants.js";
|
|
5
5
|
import { useUuid } from "./hooks/useUuid.js";
|
|
@@ -14,7 +14,7 @@ import { S as Slider } from "./Slider.js";
|
|
|
14
14
|
import { T as Textarea } from "./Textarea.js";
|
|
15
15
|
import { T as Title } from "./Title.js";
|
|
16
16
|
import formGroupStyles from "./components/FormGroup/styles.module.scss";
|
|
17
|
-
const FormGroup =
|
|
17
|
+
const FormGroup = React__default.forwardRef((props, ref) => {
|
|
18
18
|
const {
|
|
19
19
|
className,
|
|
20
20
|
fieldsetClassName,
|
|
@@ -43,12 +43,12 @@ const FormGroup = React.forwardRef((props, ref) => {
|
|
|
43
43
|
const fieldsetClasses = classNames(formGroupStyles["field-set"], fieldsetClassName);
|
|
44
44
|
const mapFormComponent = (child, index) => {
|
|
45
45
|
if (isComponent(child, FormLayout)) {
|
|
46
|
-
return
|
|
46
|
+
return React__default.cloneElement(child, {
|
|
47
47
|
size,
|
|
48
48
|
mapHelper: mapFormComponent
|
|
49
49
|
});
|
|
50
50
|
} else if (isComponent(child, FormGroup)) {
|
|
51
|
-
return
|
|
51
|
+
return React__default.cloneElement(child, {
|
|
52
52
|
onColor,
|
|
53
53
|
size,
|
|
54
54
|
error,
|
|
@@ -56,7 +56,7 @@ const FormGroup = React.forwardRef((props, ref) => {
|
|
|
56
56
|
errorTextId: errorTextUuid
|
|
57
57
|
});
|
|
58
58
|
} else if (isComponent(child, Checkbox)) {
|
|
59
|
-
return
|
|
59
|
+
return React__default.cloneElement(child, {
|
|
60
60
|
name: name ?? child.props.name,
|
|
61
61
|
onColor,
|
|
62
62
|
size,
|
|
@@ -65,7 +65,7 @@ const FormGroup = React.forwardRef((props, ref) => {
|
|
|
65
65
|
});
|
|
66
66
|
} else if (isComponent(child, RadioButton)) {
|
|
67
67
|
const radioId = typeof child.props.inputId === "undefined" ? radioGroupId + index : child.props.inputId;
|
|
68
|
-
return
|
|
68
|
+
return React__default.cloneElement(child, {
|
|
69
69
|
inputId: radioId,
|
|
70
70
|
name: name ?? child.props.name,
|
|
71
71
|
onColor,
|
|
@@ -79,7 +79,7 @@ const FormGroup = React.forwardRef((props, ref) => {
|
|
|
79
79
|
labelClassNames: getRadioLabelClasses(radioId, onColor, isLarge, checkedRadioId)
|
|
80
80
|
});
|
|
81
81
|
} else if (isComponent(child, Input)) {
|
|
82
|
-
return
|
|
82
|
+
return React__default.cloneElement(child, {
|
|
83
83
|
name: name ?? child.props.name,
|
|
84
84
|
onColor,
|
|
85
85
|
size,
|
|
@@ -87,21 +87,21 @@ const FormGroup = React.forwardRef((props, ref) => {
|
|
|
87
87
|
errorTextId: errorTextUuid
|
|
88
88
|
});
|
|
89
89
|
} else if (isComponent(child, Textarea)) {
|
|
90
|
-
return
|
|
90
|
+
return React__default.cloneElement(child, {
|
|
91
91
|
name: name ?? child.props.name,
|
|
92
92
|
onColor,
|
|
93
93
|
error: !!error,
|
|
94
94
|
errorTextId: errorTextUuid
|
|
95
95
|
});
|
|
96
96
|
} else if (isComponent(child, Select)) {
|
|
97
|
-
return
|
|
97
|
+
return React__default.cloneElement(child, {
|
|
98
98
|
name: name ?? child.props.name,
|
|
99
99
|
onColor,
|
|
100
100
|
error: !!error,
|
|
101
101
|
errorTextId: errorTextUuid
|
|
102
102
|
});
|
|
103
103
|
} else if (isComponent(child, Slider)) {
|
|
104
|
-
return
|
|
104
|
+
return React__default.cloneElement(child, {
|
|
105
105
|
name: name ?? child.props.name,
|
|
106
106
|
error: !!error,
|
|
107
107
|
errorTextId: errorTextUuid
|
|
@@ -113,11 +113,11 @@ const FormGroup = React.forwardRef((props, ref) => {
|
|
|
113
113
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
114
114
|
htmlMarkup === "div" && /* @__PURE__ */ jsxs("div", { className: fieldsetClasses, children: [
|
|
115
115
|
props.legend && /* @__PURE__ */ jsx("h5", { className: legendClasses, children: props.legend }),
|
|
116
|
-
|
|
116
|
+
React__default.Children.map(props.children, mapFormComponent)
|
|
117
117
|
] }),
|
|
118
118
|
htmlMarkup === "fieldset" && /* @__PURE__ */ jsxs("fieldset", { name: props.fieldsetName, className: fieldsetClasses, children: [
|
|
119
119
|
props.legend && /* @__PURE__ */ jsx("legend", { className: legendClasses, children: props.legend }),
|
|
120
|
-
|
|
120
|
+
React__default.Children.map(props.children, mapFormComponent)
|
|
121
121
|
] })
|
|
122
122
|
] });
|
|
123
123
|
};
|
package/FormGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormGroup.js","sources":["../src/components/FormGroup/FormGroup.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, FormSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { isComponent } from '../../utils/component';\nimport Checkbox, { CheckboxProps } from '../Checkbox/Checkbox';\nimport ErrorWrapper from '../ErrorWrapper';\nimport FormLayout, { FormLayoutProps } from '../FormLayout';\nimport Input, { InputProps } from '../Input/Input';\nimport RadioButton, { RadioButtonProps, getRadioLabelClasses } from '../RadioButton/RadioButton';\nimport Select, { SelectProps } from '../Select';\nimport Slider, { SliderProps } from '../Slider';\nimport Textarea, { TextareaProps } from '../Textarea';\nimport Title from '../Title';\n\nimport formGroupStyles from './styles.module.scss';\n\nexport type FormGroupTags = 'fieldset' | 'div';\n\nexport interface FormGroupProps {\n /** title for the the fieldset */\n title?: string;\n /** text placed in the legend tag of the fieldset */\n legend?: string;\n /** Items in the FormGroup component */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the errorWrapper. */\n errorWrapperClassName?: string;\n /** Adds custom classes to the fieldset element. */\n fieldsetClassName?: string;\n /** Changes the visuals of the formgroup */\n onColor?: keyof typeof FormOnColor;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Error message */\n error?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error-wrapper. */\n errorWrapperTestId?: string;\n /** Unique name for the child input element */\n name?: string;\n /** Unique name for the fieldset */\n fieldsetName?: string;\n /** Sets div instead of fieldset tag */\n htmlMarkup?: FormGroupTags;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n}\n\nexport const FormGroup = React.forwardRef((props: FormGroupProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const {\n className,\n fieldsetClassName,\n onColor = FormOnColor.onwhite,\n size = FormSize.medium,\n error,\n errorTextId,\n name,\n htmlMarkup = 'fieldset',\n renderError = true,\n errorWrapperClassName,\n errorWrapperTestId,\n } = props;\n const [checkedRadioId, setCheckedRadioId] = useState<string>();\n const radioGroupId = useUuid();\n const errorTextUuid = useUuid(errorTextId);\n const onDark = onColor === FormOnColor.ondark;\n const isLarge = size === FormSize.large;\n const formGroupWrapperClasses = classNames(formGroupStyles['form-group-wrapper'], className);\n const titleClasses = classNames({\n [formGroupStyles['form-group-wrapper__title--on-dark']]: onDark && !error,\n });\n\n const legendClasses = classNames(formGroupStyles['field-set__legend'], {\n [formGroupStyles['field-set__legend--on-dark']]: onDark && !error,\n });\n\n const fieldsetClasses = classNames(formGroupStyles['field-set'], fieldsetClassName);\n\n const mapFormComponent = (child: React.ReactNode, index: number): React.ReactNode => {\n if (isComponent<FormLayoutProps>(child, FormLayout)) {\n return React.cloneElement(child, {\n size,\n mapHelper: mapFormComponent,\n });\n } else if (isComponent<FormGroupProps>(child, FormGroup)) {\n return React.cloneElement(child, {\n onColor,\n size,\n error,\n renderError: false,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<CheckboxProps>(child, Checkbox)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n size,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<RadioButtonProps>(child, RadioButton)) {\n const radioId = typeof child.props.inputId === 'undefined' ? radioGroupId + index : child.props.inputId;\n return React.cloneElement(child, {\n inputId: radioId,\n name: name ?? child.props.name,\n onColor,\n size,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n setCheckedRadioId(event.target.id);\n child.props.onChange && child.props.onChange(event);\n },\n error: !!error,\n errorTextId: errorTextUuid,\n labelClassNames: getRadioLabelClasses(radioId, onColor as FormOnColor, isLarge, checkedRadioId),\n });\n } else if (isComponent<InputProps>(child, Input)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n size,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<TextareaProps>(child, Textarea)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<SelectProps>(child, Select)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<SliderProps>(child, Slider)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n }\n return child;\n };\n\n const formGroupContent = (): React.ReactNode => {\n return (\n <div>\n {htmlMarkup === 'div' && (\n <div className={fieldsetClasses}>\n {props.legend && <h5 className={legendClasses}>{props.legend}</h5>}\n {React.Children.map(props.children, mapFormComponent)}\n </div>\n )}\n {htmlMarkup === 'fieldset' && (\n <fieldset name={props.fieldsetName} className={fieldsetClasses}>\n {props.legend && <legend className={legendClasses}>{props.legend}</legend>}\n {React.Children.map(props.children, mapFormComponent)}\n </fieldset>\n )}\n </div>\n );\n };\n\n return (\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.FormGroup} className={formGroupWrapperClasses} ref={ref} tabIndex={-1}>\n {props.title && (\n <Title className={titleClasses} htmlMarkup={'h4'} appearance={'title4'} margin={{ marginTop: 0, marginBottom: error ? 1 : 2 }}>\n {props.title}\n </Title>\n )}\n {renderError ? (\n <ErrorWrapper className={errorWrapperClassName} errorText={error} testId={errorWrapperTestId} errorTextId={errorTextUuid}>\n {formGroupContent()}\n </ErrorWrapper>\n ) : (\n formGroupContent()\n )}\n </div>\n );\n});\n\nFormGroup.displayName = 'FormGroup';\n\nexport default FormGroup;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAwDO,MAAM,YAAY,MAAM,WAAW,CAAC,OAAuB,QAA4C;AACtG,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU,YAAY;AAAA,IACtB,OAAO,SAAS;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAiB;AAC7D,QAAM,eAAe,QAAQ;AACvB,QAAA,gBAAgB,QAAQ,WAAW;AACnC,QAAA,SAAS,YAAY,YAAY;AACjC,QAAA,UAAU,SAAS,SAAS;AAClC,QAAM,0BAA0B,WAAW,gBAAgB,oBAAoB,GAAG,SAAS;AAC3F,QAAM,eAAe,WAAW;AAAA,IAC9B,CAAC,gBAAgB,oCAAoC,CAAC,GAAG,UAAU,CAAC;AAAA,EAAA,CACrE;AAED,QAAM,gBAAgB,WAAW,gBAAgB,mBAAmB,GAAG;AAAA,IACrE,CAAC,gBAAgB,4BAA4B,CAAC,GAAG,UAAU,CAAC;AAAA,EAAA,CAC7D;AAED,QAAM,kBAAkB,WAAW,gBAAgB,WAAW,GAAG,iBAAiB;AAE5E,QAAA,mBAAmB,CAAC,OAAwB,UAAmC;AAC/E,QAAA,YAA6B,OAAO,UAAU,GAAG;AAC5C,aAAA,MAAM,aAAa,OAAO;AAAA,QAC/B;AAAA,QACA,WAAW;AAAA,MAAA,CACZ;AAAA,IACQ,WAAA,YAA4B,OAAO,SAAS,GAAG;AACjD,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AiB;AAAA,EAAA,GAErB;AAEJ,CAAC;AAED,UAAU,cAAc;"}
|
|
1
|
+
{"version":3,"file":"FormGroup.js","sources":["../src/components/FormGroup/FormGroup.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, FormSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { isComponent } from '../../utils/component';\nimport Checkbox, { CheckboxProps } from '../Checkbox/Checkbox';\nimport ErrorWrapper from '../ErrorWrapper';\nimport FormLayout, { FormLayoutProps } from '../FormLayout';\nimport Input, { InputProps } from '../Input/Input';\nimport RadioButton, { RadioButtonProps, getRadioLabelClasses } from '../RadioButton/RadioButton';\nimport Select, { SelectProps } from '../Select';\nimport Slider, { SliderProps } from '../Slider';\nimport Textarea, { TextareaProps } from '../Textarea';\nimport Title from '../Title';\n\nimport formGroupStyles from './styles.module.scss';\n\nexport type FormGroupTags = 'fieldset' | 'div';\n\nexport interface FormGroupProps {\n /** title for the the fieldset */\n title?: string;\n /** text placed in the legend tag of the fieldset */\n legend?: string;\n /** Items in the FormGroup component */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the errorWrapper. */\n errorWrapperClassName?: string;\n /** Adds custom classes to the fieldset element. */\n fieldsetClassName?: string;\n /** Changes the visuals of the formgroup */\n onColor?: keyof typeof FormOnColor;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Error message */\n error?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error-wrapper. */\n errorWrapperTestId?: string;\n /** Unique name for the child input element */\n name?: string;\n /** Unique name for the fieldset */\n fieldsetName?: string;\n /** Sets div instead of fieldset tag */\n htmlMarkup?: FormGroupTags;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n}\n\nexport const FormGroup = React.forwardRef((props: FormGroupProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const {\n className,\n fieldsetClassName,\n onColor = FormOnColor.onwhite,\n size = FormSize.medium,\n error,\n errorTextId,\n name,\n htmlMarkup = 'fieldset',\n renderError = true,\n errorWrapperClassName,\n errorWrapperTestId,\n } = props;\n const [checkedRadioId, setCheckedRadioId] = useState<string>();\n const radioGroupId = useUuid();\n const errorTextUuid = useUuid(errorTextId);\n const onDark = onColor === FormOnColor.ondark;\n const isLarge = size === FormSize.large;\n const formGroupWrapperClasses = classNames(formGroupStyles['form-group-wrapper'], className);\n const titleClasses = classNames({\n [formGroupStyles['form-group-wrapper__title--on-dark']]: onDark && !error,\n });\n\n const legendClasses = classNames(formGroupStyles['field-set__legend'], {\n [formGroupStyles['field-set__legend--on-dark']]: onDark && !error,\n });\n\n const fieldsetClasses = classNames(formGroupStyles['field-set'], fieldsetClassName);\n\n const mapFormComponent = (child: React.ReactNode, index: number): React.ReactNode => {\n if (isComponent<FormLayoutProps>(child, FormLayout)) {\n return React.cloneElement(child, {\n size,\n mapHelper: mapFormComponent,\n });\n } else if (isComponent<FormGroupProps>(child, FormGroup)) {\n return React.cloneElement(child, {\n onColor,\n size,\n error,\n renderError: false,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<CheckboxProps>(child, Checkbox)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n size,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<RadioButtonProps>(child, RadioButton)) {\n const radioId = typeof child.props.inputId === 'undefined' ? radioGroupId + index : child.props.inputId;\n return React.cloneElement(child, {\n inputId: radioId,\n name: name ?? child.props.name,\n onColor,\n size,\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => {\n setCheckedRadioId(event.target.id);\n child.props.onChange && child.props.onChange(event);\n },\n error: !!error,\n errorTextId: errorTextUuid,\n labelClassNames: getRadioLabelClasses(radioId, onColor as FormOnColor, isLarge, checkedRadioId),\n });\n } else if (isComponent<InputProps>(child, Input)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n size,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<TextareaProps>(child, Textarea)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<SelectProps>(child, Select)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n onColor,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n } else if (isComponent<SliderProps>(child, Slider)) {\n return React.cloneElement(child, {\n name: name ?? child.props.name,\n error: !!error,\n errorTextId: errorTextUuid,\n });\n }\n return child;\n };\n\n const formGroupContent = (): React.ReactNode => {\n return (\n <div>\n {htmlMarkup === 'div' && (\n <div className={fieldsetClasses}>\n {props.legend && <h5 className={legendClasses}>{props.legend}</h5>}\n {React.Children.map(props.children, mapFormComponent)}\n </div>\n )}\n {htmlMarkup === 'fieldset' && (\n <fieldset name={props.fieldsetName} className={fieldsetClasses}>\n {props.legend && <legend className={legendClasses}>{props.legend}</legend>}\n {React.Children.map(props.children, mapFormComponent)}\n </fieldset>\n )}\n </div>\n );\n };\n\n return (\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.FormGroup} className={formGroupWrapperClasses} ref={ref} tabIndex={-1}>\n {props.title && (\n <Title className={titleClasses} htmlMarkup={'h4'} appearance={'title4'} margin={{ marginTop: 0, marginBottom: error ? 1 : 2 }}>\n {props.title}\n </Title>\n )}\n {renderError ? (\n <ErrorWrapper className={errorWrapperClassName} errorText={error} testId={errorWrapperTestId} errorTextId={errorTextUuid}>\n {formGroupContent()}\n </ErrorWrapper>\n ) : (\n formGroupContent()\n )}\n </div>\n );\n});\n\nFormGroup.displayName = 'FormGroup';\n\nexport default FormGroup;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;AAwDO,MAAM,YAAYA,eAAM,WAAW,CAAC,OAAuB,QAA4C;AACtG,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU,YAAY;AAAA,IACtB,OAAO,S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AAA,MAAA,eAAe,SACd,qBAAC,OAAI,EAAA,WAAW,iBACb,UAAA;AAAA,QAAA,MAAM,UAAW,oBAAA,MAAA,EAAG,WAAW,eAAgB,gBAAM,QAAO;AAAA,QAC5DA,eAAM,SAAS,IAAI,MAAM,UAAU,gBAAgB;AAAA,MAAA,GACtD;AAAA,MAED,eAAe,cACb,qBAAA,YAAA,EAAS,MAAM,MAAM,cAAc,WAAW,iBAC5C,UAAA;AAAA,QAAA,MAAM,UAAW,oBAAA,UAAA,EAAO,WAAW,eAAgB,gBAAM,QAAO;AAAA,QAChEA,eAAM,SAAS,IAAI,MAAM,UAAU,gBAAgB;AAAA,MAAA,EACtD,CAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AAEA,SACG,qBAAA,OAAA,EAAI,eAAa,MAAM,QAAQ,oBAAkB,YAAY,WAAW,WAAW,yBAAyB,KAAU,UAAU,IAC9H,UAAA;AAAA,IAAA,MAAM,SACJ,oBAAA,OAAA,EAAM,WAAW,cAAc,YAAY,MAAM,YAAY,UAAU,QAAQ,EAAE,WAAW,GAAG,cAAc,QAAQ,IAAI,EAAE,GACzH,gBAAM,OACT;AAAA,IAED,cACC,oBAAC,cAAa,EAAA,WAAW,uBAAuB,WAAW,OAAO,QAAQ,oBAAoB,aAAa,eACxG,UAAiB,iBAAA,EACpB,CAAA,IAEA,iBAAiB;AAAA,EAAA,GAErB;AAEJ,CAAC;AAED,UAAU,cAAc;"}
|
package/FormLayout.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { FormSize, AnalyticsId } from "./constants.js";
|
|
5
5
|
import formGroupStyles from "./components/FormLayout/styles.module.scss";
|
|
@@ -11,7 +11,7 @@ var FormLayoutColumns = /* @__PURE__ */ ((FormLayoutColumns2) => {
|
|
|
11
11
|
FormLayoutColumns2["five"] = "five";
|
|
12
12
|
return FormLayoutColumns2;
|
|
13
13
|
})(FormLayoutColumns || {});
|
|
14
|
-
const FormLayout =
|
|
14
|
+
const FormLayout = React__default.forwardRef((props, ref) => {
|
|
15
15
|
const { maxColumns: columns = "one", colMinWidth = 300, size, className, mapHelper } = props;
|
|
16
16
|
const cssVariable = { "--min-col-width": `${colMinWidth}px` };
|
|
17
17
|
const formLayoutContainerClasses = classNames(
|
|
@@ -36,7 +36,7 @@ const FormLayout = React.forwardRef((props, ref) => {
|
|
|
36
36
|
style: cssVariable,
|
|
37
37
|
className: formLayoutContainerClasses,
|
|
38
38
|
ref,
|
|
39
|
-
children:
|
|
39
|
+
children: React__default.Children.map(props.children, (child, index) => {
|
|
40
40
|
return /* @__PURE__ */ jsx("div", { className: formLayoutChildClasses, children: mapHelper ? mapHelper(child, index) : child });
|
|
41
41
|
})
|
|
42
42
|
}
|
package/FormLayout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.js","sources":["../src/components/FormLayout/FormLayout.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormSize } from '../../constants';\n\nimport formGroupStyles from './styles.module.scss';\n\nexport enum FormLayoutColumns {\n one = 'one',\n two = 'two',\n three = 'three',\n four = 'four',\n five = 'five',\n}\n\nexport interface FormLayoutProps {\n /** The max number of columns that will exist if space is available */\n maxColumns?: keyof typeof FormLayoutColumns;\n /** Sets the minimum width for the columns in pixels - this determines how many will fit on a row */\n colMinWidth?: number;\n /** Items in the FormLayout component */\n children?: React.ReactNode;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Function that helps map the form children */\n mapHelper?: (child: React.ReactNode, index: number) => React.ReactNode;\n}\n\nexport const FormLayout = React.forwardRef((props: FormLayoutProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const { maxColumns: columns = FormLayoutColumns.one, colMinWidth = 300, size, className, mapHelper } = props;\n\n const cssVariable = { '--min-col-width': `${colMinWidth}px` } as React.CSSProperties;\n const formLayoutContainerClasses = classNames(\n formGroupStyles['form-layout-container'],\n {\n [formGroupStyles['form-layout-container--large']]: size === FormSize.large,\n },\n className\n );\n const formLayoutChildClasses = classNames(formGroupStyles['form-layout-child'], {\n [formGroupStyles['form-layout-child--two']]: columns === FormLayoutColumns.two,\n [formGroupStyles['form-layout-child--three']]: columns === FormLayoutColumns.three,\n [formGroupStyles['form-layout-child--four']]: columns === FormLayoutColumns.four,\n [formGroupStyles['form-layout-child--five']]: columns === FormLayoutColumns.five,\n });\n\n return (\n <div\n data-testid={props.testId}\n data-analyticsid={AnalyticsId.FormLayout}\n style={cssVariable}\n className={formLayoutContainerClasses}\n ref={ref}\n >\n {React.Children.map(props.children, (child: React.ReactNode, index: number) => {\n return <div className={formLayoutChildClasses}>{mapHelper ? mapHelper(child, index) : child}</div>;\n })}\n </div>\n );\n});\n\nFormLayout.displayName = 'FormLayout';\n\nexport default FormLayout;\n"],"names":["FormLayoutColumns"],"mappings":";;;;;AAQY,IAAA,sCAAAA,uBAAL;AACLA,qBAAA,KAAM,IAAA;AACNA,qBAAA,KAAM,IAAA;AACNA,qBAAA,OAAQ,IAAA;AACRA,qBAAA,MAAO,IAAA;AACPA,qBAAA,MAAO,IAAA;AALGA,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AAyBL,MAAM,
|
|
1
|
+
{"version":3,"file":"FormLayout.js","sources":["../src/components/FormLayout/FormLayout.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormSize } from '../../constants';\n\nimport formGroupStyles from './styles.module.scss';\n\nexport enum FormLayoutColumns {\n one = 'one',\n two = 'two',\n three = 'three',\n four = 'four',\n five = 'five',\n}\n\nexport interface FormLayoutProps {\n /** The max number of columns that will exist if space is available */\n maxColumns?: keyof typeof FormLayoutColumns;\n /** Sets the minimum width for the columns in pixels - this determines how many will fit on a row */\n colMinWidth?: number;\n /** Items in the FormLayout component */\n children?: React.ReactNode;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Function that helps map the form children */\n mapHelper?: (child: React.ReactNode, index: number) => React.ReactNode;\n}\n\nexport const FormLayout = React.forwardRef((props: FormLayoutProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const { maxColumns: columns = FormLayoutColumns.one, colMinWidth = 300, size, className, mapHelper } = props;\n\n const cssVariable = { '--min-col-width': `${colMinWidth}px` } as React.CSSProperties;\n const formLayoutContainerClasses = classNames(\n formGroupStyles['form-layout-container'],\n {\n [formGroupStyles['form-layout-container--large']]: size === FormSize.large,\n },\n className\n );\n const formLayoutChildClasses = classNames(formGroupStyles['form-layout-child'], {\n [formGroupStyles['form-layout-child--two']]: columns === FormLayoutColumns.two,\n [formGroupStyles['form-layout-child--three']]: columns === FormLayoutColumns.three,\n [formGroupStyles['form-layout-child--four']]: columns === FormLayoutColumns.four,\n [formGroupStyles['form-layout-child--five']]: columns === FormLayoutColumns.five,\n });\n\n return (\n <div\n data-testid={props.testId}\n data-analyticsid={AnalyticsId.FormLayout}\n style={cssVariable}\n className={formLayoutContainerClasses}\n ref={ref}\n >\n {React.Children.map(props.children, (child: React.ReactNode, index: number) => {\n return <div className={formLayoutChildClasses}>{mapHelper ? mapHelper(child, index) : child}</div>;\n })}\n </div>\n );\n});\n\nFormLayout.displayName = 'FormLayout';\n\nexport default FormLayout;\n"],"names":["FormLayoutColumns","React"],"mappings":";;;;;AAQY,IAAA,sCAAAA,uBAAL;AACLA,qBAAA,KAAM,IAAA;AACNA,qBAAA,KAAM,IAAA;AACNA,qBAAA,OAAQ,IAAA;AACRA,qBAAA,MAAO,IAAA;AACPA,qBAAA,MAAO,IAAA;AALGA,SAAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;AAyBL,MAAM,aAAaC,eAAM,WAAW,CAAC,OAAwB,QAA4C;AACxG,QAAA,EAAE,YAAY,UAAU,OAAuB,cAAc,KAAK,MAAM,WAAW,UAAA,IAAc;AAEvG,QAAM,cAAc,EAAE,mBAAmB,GAAG,WAAW,KAAK;AAC5D,QAAM,6BAA6B;AAAA,IACjC,gBAAgB,uBAAuB;AAAA,IACvC;AAAA,MACE,CAAC,gBAAgB,8BAA8B,CAAC,GAAG,SAAS,SAAS;AAAA,IACvE;AAAA,IACA;AAAA,EACF;AACA,QAAM,yBAAyB,WAAW,gBAAgB,mBAAmB,GAAG;AAAA,IAC9E,CAAC,gBAAgB,wBAAwB,CAAC,GAAG,YAAY;AAAA,IACzD,CAAC,gBAAgB,0BAA0B,CAAC,GAAG,YAAY;AAAA,IAC3D,CAAC,gBAAgB,yBAAyB,CAAC,GAAG,YAAY;AAAA,IAC1D,CAAC,gBAAgB,yBAAyB,CAAC,GAAG,YAAY;AAAA;AAAA,EAAA,CAC3D;AAGC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAa,MAAM;AAAA,MACnB,oBAAkB,YAAY;AAAA,MAC9B,OAAO;AAAA,MACP,WAAW;AAAA,MACX;AAAA,MAEC,yBAAM,SAAS,IAAI,MAAM,UAAU,CAAC,OAAwB,UAAkB;AACtE,eAAA,oBAAC,SAAI,WAAW,wBAAyB,sBAAY,UAAU,OAAO,KAAK,IAAI,MAAM,CAAA;AAAA,MAC7F,CAAA;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;AAED,WAAW,cAAc;"}
|
package/HelpBubble.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { AnalyticsId } from "./constants.js";
|
|
5
5
|
import { A as AnchorLink } from "./AnchorLink.js";
|
|
@@ -7,7 +7,7 @@ import { C as Close } from "./Close.js";
|
|
|
7
7
|
import { P as PopOverVariant, a as PopOver } from "./PopOver.js";
|
|
8
8
|
import styles from "./components/HelpBubble/styles.module.scss";
|
|
9
9
|
const HelpBubbleVariant = PopOverVariant;
|
|
10
|
-
const HelpBubble =
|
|
10
|
+
const HelpBubble = React__default.forwardRef((props, ref) => {
|
|
11
11
|
const {
|
|
12
12
|
children,
|
|
13
13
|
className = "",
|
package/HelpBubble.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpBubble.js","sources":["../src/components/HelpBubble/HelpBubble.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport AnchorLink, { AnchorLinkTargets } from '../AnchorLink';\nimport Close from '../Close';\nimport PopOver, { PopOverProps, PopOverVariant } from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport const HelpBubbleVariant = PopOverVariant;\n\ntype HelpBubbleRole = 'tooltip';\n\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the HelpBubble is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Adds custom classes to the element. */\n className?: string;\n /** Determines the placement of the helpbubble. Default: automatic positioning. */\n variant?: keyof typeof HelpBubbleVariant;\n /** Show the bubble. Default: false. */\n showBubble?: boolean;\n /** Hide the close button in the bubble. Close button is never rendered if role=\"tooltip\". */\n noCloseButton?: boolean;\n /** Visible text on the link. Link is never rendered if role=\"tooltip\". */\n linkText?: string;\n /** Url the link leads to */\n linkUrl?: string;\n /** Sets the target type of the link. _blank adds an arrow icon at the end of the link */\n linkTarget?: AnchorLinkTargets;\n /** Function is called when link is clicked */\n onLinkClick?: () => void;\n /** Function is called when user clicks the button */\n onClose?: () => void;\n /** aria-label to be passed onto Close */\n closeAriaLabel?: string;\n /** Sets role of the HelpBubble element. If set to \"tooltip\", */\n role?: HelpBubbleRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpBubble = React.forwardRef<HTMLDivElement | SVGSVGElement, HelpBubbleProps>((props, ref) => {\n const {\n children,\n className = '',\n noCloseButton,\n linkText = 'Mer hjelp',\n linkUrl,\n linkTarget,\n onLinkClick,\n onClose,\n closeAriaLabel,\n // Props passed on to PopOver\n showBubble,\n helpBubbleId,\n variant,\n controllerRef,\n role,\n testId,\n } = props;\n\n const isTooltip = role === 'tooltip';\n\n if (!showBubble && !isTooltip) {\n return null;\n }\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n\n const contentClasses = classNames(styles.helpbubble__content, {\n [styles['helpbubble__content--close']]: !noCloseButton && !isTooltip,\n });\n\n const renderLink = (): JSX.Element | undefined => {\n // Det er ikke tillatt med interaktive/fokuserbare elementer i role=\"tooltip\"\n if (isTooltip) {\n return;\n }\n if (onLinkClick && linkText) {\n return (\n <button className={styles.helpbubble__link} onClick={onLinkClick} type=\"button\">\n {linkText}\n </button>\n );\n } else if (linkUrl && linkText) {\n return (\n <AnchorLink href={linkUrl} target={linkTarget}>\n {linkText}\n </AnchorLink>\n );\n }\n };\n\n const renderCloseButton = (): JSX.Element | undefined => {\n if (noCloseButton || isTooltip) {\n return;\n }\n return (\n <div className={styles.helpbubble__close}>\n <Close small onClick={onClose} ariaLabel={closeAriaLabel} />\n </div>\n );\n };\n\n return (\n <PopOver\n id={helpBubbleId}\n variant={variant}\n controllerRef={controllerRef}\n role={role}\n ref={ref}\n show={isTooltip && showBubble}\n testId={testId}\n >\n <div className={helpBubbleClasses} data-analyticsid={AnalyticsId.HelpBubble}>\n {renderCloseButton()}\n <div className={contentClasses}>\n {children}\n {renderLink()}\n </div>\n </div>\n </PopOver>\n );\n});\n\nHelpBubble.displayName = 'HelpBubble';\n\nexport default HelpBubble;\n"],"names":[],"mappings":";;;;;;;;AAWO,MAAM,oBAAoB;AAqCjC,MAAM,
|
|
1
|
+
{"version":3,"file":"HelpBubble.js","sources":["../src/components/HelpBubble/HelpBubble.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport AnchorLink, { AnchorLinkTargets } from '../AnchorLink';\nimport Close from '../Close';\nimport PopOver, { PopOverProps, PopOverVariant } from '../PopOver';\n\nimport styles from './styles.module.scss';\n\nexport const HelpBubbleVariant = PopOverVariant;\n\ntype HelpBubbleRole = 'tooltip';\n\nexport interface HelpBubbleProps extends Pick<PopOverProps, 'children' | 'variant' | 'controllerRef' | 'role'> {\n /** Id of the HelpBubble */\n helpBubbleId?: string;\n /** Content shown inside HelpBubble. Note that if role=\"tooltip\", you must not include interactive/focusable elements. */\n children: React.ReactNode;\n /** Ref for the element the HelpBubble is placed upon */\n controllerRef: React.RefObject<HTMLElement | SVGSVGElement>;\n /** Adds custom classes to the element. */\n className?: string;\n /** Determines the placement of the helpbubble. Default: automatic positioning. */\n variant?: keyof typeof HelpBubbleVariant;\n /** Show the bubble. Default: false. */\n showBubble?: boolean;\n /** Hide the close button in the bubble. Close button is never rendered if role=\"tooltip\". */\n noCloseButton?: boolean;\n /** Visible text on the link. Link is never rendered if role=\"tooltip\". */\n linkText?: string;\n /** Url the link leads to */\n linkUrl?: string;\n /** Sets the target type of the link. _blank adds an arrow icon at the end of the link */\n linkTarget?: AnchorLinkTargets;\n /** Function is called when link is clicked */\n onLinkClick?: () => void;\n /** Function is called when user clicks the button */\n onClose?: () => void;\n /** aria-label to be passed onto Close */\n closeAriaLabel?: string;\n /** Sets role of the HelpBubble element. If set to \"tooltip\", */\n role?: HelpBubbleRole;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst HelpBubble = React.forwardRef<HTMLDivElement | SVGSVGElement, HelpBubbleProps>((props, ref) => {\n const {\n children,\n className = '',\n noCloseButton,\n linkText = 'Mer hjelp',\n linkUrl,\n linkTarget,\n onLinkClick,\n onClose,\n closeAriaLabel,\n // Props passed on to PopOver\n showBubble,\n helpBubbleId,\n variant,\n controllerRef,\n role,\n testId,\n } = props;\n\n const isTooltip = role === 'tooltip';\n\n if (!showBubble && !isTooltip) {\n return null;\n }\n\n const helpBubbleClasses = classNames(styles.helpbubble, className);\n\n const contentClasses = classNames(styles.helpbubble__content, {\n [styles['helpbubble__content--close']]: !noCloseButton && !isTooltip,\n });\n\n const renderLink = (): JSX.Element | undefined => {\n // Det er ikke tillatt med interaktive/fokuserbare elementer i role=\"tooltip\"\n if (isTooltip) {\n return;\n }\n if (onLinkClick && linkText) {\n return (\n <button className={styles.helpbubble__link} onClick={onLinkClick} type=\"button\">\n {linkText}\n </button>\n );\n } else if (linkUrl && linkText) {\n return (\n <AnchorLink href={linkUrl} target={linkTarget}>\n {linkText}\n </AnchorLink>\n );\n }\n };\n\n const renderCloseButton = (): JSX.Element | undefined => {\n if (noCloseButton || isTooltip) {\n return;\n }\n return (\n <div className={styles.helpbubble__close}>\n <Close small onClick={onClose} ariaLabel={closeAriaLabel} />\n </div>\n );\n };\n\n return (\n <PopOver\n id={helpBubbleId}\n variant={variant}\n controllerRef={controllerRef}\n role={role}\n ref={ref}\n show={isTooltip && showBubble}\n testId={testId}\n >\n <div className={helpBubbleClasses} data-analyticsid={AnalyticsId.HelpBubble}>\n {renderCloseButton()}\n <div className={contentClasses}>\n {children}\n {renderLink()}\n </div>\n </div>\n </PopOver>\n );\n});\n\nHelpBubble.displayName = 'HelpBubble';\n\nexport default HelpBubble;\n"],"names":["React"],"mappings":";;;;;;;;AAWO,MAAM,oBAAoB;AAqCjC,MAAM,aAAaA,eAAM,WAA4D,CAAC,OAAO,QAAQ;AAC7F,QAAA;AAAA,IACJ;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,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|
@@ -48,10 +48,10 @@ const HighlightPanel = (props) => {
|
|
|
48
48
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
49
|
/* @__PURE__ */ jsxs("div", { className: styles.highlightpanel__icon, children: [
|
|
50
50
|
typeof svgIcon === "string" ? /* @__PURE__ */ jsx(LazyIcon, { iconName: svgIcon, size: iconSize }) : /* @__PURE__ */ jsx(Icon, { svgIcon, size: iconSize }),
|
|
51
|
-
title && /* @__PURE__ */ jsx("div", { className: styles["
|
|
51
|
+
title && breakpoint < Breakpoint.md && /* @__PURE__ */ jsx("div", { className: styles["highlightpanel__title-wrapper"], children: titleElement })
|
|
52
52
|
] }),
|
|
53
53
|
/* @__PURE__ */ jsxs("div", { className: styles.highlightpanel__content, children: [
|
|
54
|
-
title && /* @__PURE__ */ jsx("div", { className: styles["
|
|
54
|
+
title && breakpoint >= Breakpoint.md && /* @__PURE__ */ jsx("div", { className: styles["highlightpanel__title-wrapper"], children: titleElement }),
|
|
55
55
|
children
|
|
56
56
|
] })
|
|
57
57
|
] });
|
package/HighlightPanel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightPanel.js","sources":["../src/components/HighlightPanel/HighlightPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { useBreakpoint, Breakpoint } from '../..';\nimport { AnalyticsId } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\nimport Icon, { SvgIcon, IconSize } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport LazyIcon from '../LazyIcon';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type HighlightPanelColors = Extract<PaletteNames, 'white' | 'neutral' | 'blueberry' | 'cherry'>;\n\nexport enum HighlightPanelSize {\n medium = 'medium',\n large = 'large',\n fluid = 'fluid',\n}\n\nexport type HighlightPanelTags = Exclude<\n keyof HTMLElementTagNameMap,\n 'dir' | 'font' | 'frame' | 'frameset' | 'marquee' | 'applet' | 'basefont' | 'search'\n>;\n\nexport interface HighlightPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the background color. Default: white */\n color?: HighlightPanelColors;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightPanelSize;\n /** Adds an icon to the highlightpanel. */\n svgIcon?: SvgIcon | IconName;\n /** Changes the underlying element. Default: div */\n htmlMarkup?: HighlightPanelTags;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the content-wrapper. Not used for fluid size. */\n contentWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Element that is set after the icon-element in the DOM, often a title-element */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\ninterface WrapperProps {\n children?: React.ReactNode;\n className: string;\n size?: keyof typeof HighlightPanelSize;\n}\n\nconst Wrapper: React.FC<WrapperProps> = ({ className, size, children }) => (\n <div className={className} data-testid={'highlightpanel-wrapper'}>\n <div className={styles.highlightpanel__row}>\n <div className={classNames(styles.highlightpanel__col, size === HighlightPanelSize.medium && styles['highlightpanel__col--offset'])}>\n {children}\n </div>\n </div>\n </div>\n);\n\ninterface ContentWrapperProps {\n children: React.ReactNode;\n className?: string;\n}\n\nconst ContentWrapper: React.FC<ContentWrapperProps> = props => {\n const { children, className } = props;\n const contentWrapperClasses = classNames(styles['highlightpanel__content-wrapper'], className);\n\n return (\n <div className={contentWrapperClasses}>\n <div className={classNames(styles.highlightpanel__row)}>{children}</div>\n </div>\n );\n};\n\nconst HighlightPanel: React.FC<HighlightPanelProps> = props => {\n const {\n children,\n color = 'white',\n size = HighlightPanelSize.medium,\n testId,\n svgIcon,\n htmlMarkup = 'div',\n className,\n contentWrapperClassName,\n title,\n titleHtmlMarkup = 'h2',\n } = props;\n const breakpoint = useBreakpoint();\n\n const containerClassName = classNames(\n styles[`highlightpanel--${color}`],\n styles[`highlightpanel--${size}`],\n svgIcon && styles['highlightpanel--has-icon'],\n { container: size === 'medium' || size === 'large' },\n className\n );\n\n const renderContent = () => {\n const titleElement = title && (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\">\n {title}\n </Title>\n );\n\n if (svgIcon) {\n const iconSize = size === HighlightPanelSize.large && breakpoint && breakpoint >= Breakpoint.md ? IconSize.Medium : IconSize.Small;\n\n return (\n <>\n <div className={styles.highlightpanel__icon}>\n {typeof svgIcon === 'string' ? <LazyIcon iconName={svgIcon} size={iconSize} /> : <Icon svgIcon={svgIcon} size={iconSize} />}\n {title && <div className={styles['
|
|
1
|
+
{"version":3,"file":"HighlightPanel.js","sources":["../src/components/HighlightPanel/HighlightPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { useBreakpoint, Breakpoint } from '../..';\nimport { AnalyticsId } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\nimport Icon, { SvgIcon, IconSize } from '../Icon';\nimport { IconName } from '../Icons/IconNames';\nimport LazyIcon from '../LazyIcon';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\nexport type HighlightPanelColors = Extract<PaletteNames, 'white' | 'neutral' | 'blueberry' | 'cherry'>;\n\nexport enum HighlightPanelSize {\n medium = 'medium',\n large = 'large',\n fluid = 'fluid',\n}\n\nexport type HighlightPanelTags = Exclude<\n keyof HTMLElementTagNameMap,\n 'dir' | 'font' | 'frame' | 'frameset' | 'marquee' | 'applet' | 'basefont' | 'search'\n>;\n\nexport interface HighlightPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the background color. Default: white */\n color?: HighlightPanelColors;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightPanelSize;\n /** Adds an icon to the highlightpanel. */\n svgIcon?: SvgIcon | IconName;\n /** Changes the underlying element. Default: div */\n htmlMarkup?: HighlightPanelTags;\n /** Adds custom classes to the element. */\n className?: string;\n /** Adds custom classes to the content-wrapper. Not used for fluid size. */\n contentWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Element that is set after the icon-element in the DOM, often a title-element */\n title?: string;\n /** Markup props for title */\n titleHtmlMarkup?: TitleTags;\n}\n\ninterface WrapperProps {\n children?: React.ReactNode;\n className: string;\n size?: keyof typeof HighlightPanelSize;\n}\n\nconst Wrapper: React.FC<WrapperProps> = ({ className, size, children }) => (\n <div className={className} data-testid={'highlightpanel-wrapper'}>\n <div className={styles.highlightpanel__row}>\n <div className={classNames(styles.highlightpanel__col, size === HighlightPanelSize.medium && styles['highlightpanel__col--offset'])}>\n {children}\n </div>\n </div>\n </div>\n);\n\ninterface ContentWrapperProps {\n children: React.ReactNode;\n className?: string;\n}\n\nconst ContentWrapper: React.FC<ContentWrapperProps> = props => {\n const { children, className } = props;\n const contentWrapperClasses = classNames(styles['highlightpanel__content-wrapper'], className);\n\n return (\n <div className={contentWrapperClasses}>\n <div className={classNames(styles.highlightpanel__row)}>{children}</div>\n </div>\n );\n};\n\nconst HighlightPanel: React.FC<HighlightPanelProps> = props => {\n const {\n children,\n color = 'white',\n size = HighlightPanelSize.medium,\n testId,\n svgIcon,\n htmlMarkup = 'div',\n className,\n contentWrapperClassName,\n title,\n titleHtmlMarkup = 'h2',\n } = props;\n const breakpoint = useBreakpoint();\n\n const containerClassName = classNames(\n styles[`highlightpanel--${color}`],\n styles[`highlightpanel--${size}`],\n svgIcon && styles['highlightpanel--has-icon'],\n { container: size === 'medium' || size === 'large' },\n className\n );\n\n const renderContent = (): React.ReactNode => {\n const titleElement = title && (\n <Title testId=\"titleId\" htmlMarkup={titleHtmlMarkup} appearance=\"title4\">\n {title}\n </Title>\n );\n\n if (svgIcon) {\n const iconSize = size === HighlightPanelSize.large && breakpoint && breakpoint >= Breakpoint.md ? IconSize.Medium : IconSize.Small;\n\n return (\n <>\n <div className={styles.highlightpanel__icon}>\n {typeof svgIcon === 'string' ? <LazyIcon iconName={svgIcon} size={iconSize} /> : <Icon svgIcon={svgIcon} size={iconSize} />}\n {title && breakpoint < Breakpoint.md && <div className={styles['highlightpanel__title-wrapper']}>{titleElement}</div>}\n </div>\n <div className={styles.highlightpanel__content}>\n {title && breakpoint >= Breakpoint.md && <div className={styles['highlightpanel__title-wrapper']}>{titleElement}</div>}\n {children}\n </div>\n </>\n );\n }\n\n return (\n <>\n {title && (\n <div className={styles.highlightpanel__content}>\n <div>{titleElement}</div>\n </div>\n )}\n {children}\n </>\n );\n };\n\n const CustomTag = htmlMarkup;\n\n const contentWrapperClasses = classNames(styles['highlightpanel__content-wrapper'], contentWrapperClassName);\n\n if (size === HighlightPanelSize.medium) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <CustomTag className={contentWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.HighlightPanel}>\n {renderContent()}\n </CustomTag>\n </Wrapper>\n );\n }\n\n if (size === HighlightPanelSize.large && svgIcon) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <ContentWrapper className={contentWrapperClasses}>\n <CustomTag\n className={classNames(styles.highlightpanel__col, styles['highlightpanel__col--large-with-icon'])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HighlightPanel}\n >\n {renderContent()}\n </CustomTag>\n </ContentWrapper>\n </Wrapper>\n );\n }\n\n if (size === HighlightPanelSize.large) {\n return (\n <Wrapper className={containerClassName} size={size}>\n <ContentWrapper className={contentWrapperClasses}>\n <CustomTag\n className={classNames(styles.highlightpanel__col, styles['highlightpanel__col--offset'])}\n data-testid={testId}\n data-analyticsid={AnalyticsId.HighlightPanel}\n >\n {renderContent()}\n </CustomTag>\n </ContentWrapper>\n </Wrapper>\n );\n }\n\n if (size === HighlightPanelSize.fluid) {\n return (\n <CustomTag className={containerClassName} data-testid={testId}>\n {renderContent()}\n </CustomTag>\n );\n }\n\n return null;\n};\n\nexport default HighlightPanel;\n"],"names":["HighlightPanelSize"],"mappings":";;;;;;;;;;AAgBY,IAAA,uCAAAA,wBAAL;AACLA,sBAAA,QAAS,IAAA;AACTA,sBAAA,OAAQ,IAAA;AACRA,sBAAA,OAAQ,IAAA;AAHE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,CAAA;AAAA,EAAA;AAIJ,MAAI,SAAS,SAA0B;AAEnC,WAAA,oBAAC,WAAQ,WAAW,oBAAoB,MACtC,UAAC,oBAAA,gBAAA,EAAe,WAAW,uBACzB,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW,WAAW,OAAO,qBAAqB,OAAO,6BAA6B,CAAC;AAAA,QACvF,eAAa;AAAA,QACb,oBAAkB,YAAY;AAAA,QAE7B,UAAc,cAAA;AAAA,MAAA;AAAA,OAEnB,EACF,CAAA;AAAA,EAAA;AAIJ,MAAI,SAAS,SAA0B;AACrC,+BACG,WAAU,EAAA,WAAW,oBAAoB,eAAa,QACpD,2BACH;AAAA,EAAA;AAIG,SAAA;AACT;"}
|
package/Icon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { IconSize, AnalyticsId } from "./constants.js";
|
|
5
5
|
import { useUuid } from "./hooks/useUuid.js";
|
|
@@ -21,7 +21,7 @@ const getIcon = ({
|
|
|
21
21
|
}
|
|
22
22
|
return isHovered ? normalHover : normal;
|
|
23
23
|
};
|
|
24
|
-
const Icon =
|
|
24
|
+
const Icon = React__default.forwardRef((props, ref) => {
|
|
25
25
|
const {
|
|
26
26
|
svgIcon,
|
|
27
27
|
ariaLabel,
|
|
@@ -34,7 +34,7 @@ const Icon = React.forwardRef((props, ref) => {
|
|
|
34
34
|
testId,
|
|
35
35
|
...other
|
|
36
36
|
} = props;
|
|
37
|
-
const svgRaw =
|
|
37
|
+
const svgRaw = React__default.createElement(svgIcon, {
|
|
38
38
|
size,
|
|
39
39
|
isHovered,
|
|
40
40
|
onColor
|
package/Icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sources":["../src/components/Icon/Icon.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { StatusDotOnColor } from '../StatusDot';\n\nexport type SvgIcon = React.FC<SvgPathProps>;\n\nexport interface BaseIconProps {\n /* aria-label for the <svg> element. Used as <title> tag. */\n ariaLabel?: string;\n /* Changes the size of the icon. */\n size?: number;\n /* Changes the color of the icon. */\n color?: string;\n /* Changes the hover color of the icon. */\n hoverColor?: string;\n /* Adds custom classes to the element. */\n className?: string;\n /* Swaps the displayed icon to the hover version and changes its color. */\n isHovered?: boolean;\n /** Defines the color of the icon */\n onColor?: keyof typeof FormOnColor | StatusDotOnColor;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface IconProps extends BaseIconProps {\n /* Sets which icon should be displayed. */\n svgIcon: SvgIcon;\n}\n\nexport interface SvgPathProps {\n size: IconSize;\n isHovered: boolean;\n onColor?: keyof typeof FormOnColor | StatusDotOnColor;\n}\n\ninterface IconConfig {\n size: IconSize;\n isHovered: boolean;\n normal: React.ReactElement;\n normalHover: React.ReactElement;\n xSmall?: React.ReactElement;\n xSmallHover?: React.ReactElement;\n xxSmall?: React.ReactElement;\n xxSmallHover?: React.ReactElement;\n}\n\nexport const getIcon = ({\n size,\n isHovered,\n normal,\n normalHover,\n xSmall,\n xSmallHover,\n xxSmall,\n xxSmallHover,\n}: IconConfig): React.ReactElement => {\n if (size <= IconSize.XXSmall && xxSmall && xxSmallHover) {\n return isHovered ? xxSmallHover : xxSmall;\n }\n if (size <= IconSize.XSmall && xSmall && xSmallHover) {\n return isHovered ? xSmallHover : xSmall;\n }\n\n return isHovered ? normalHover : normal;\n};\n\nexport const Icon = React.forwardRef((props: IconProps, ref: React.ForwardedRef<SVGSVGElement>) => {\n const {\n svgIcon,\n ariaLabel,\n className = '',\n size = IconSize.Small,\n color = 'black',\n hoverColor = color || 'black',\n isHovered = false,\n onColor,\n testId,\n ...other\n } = props;\n\n const svgRaw = React.createElement(svgIcon, {\n size,\n isHovered,\n onColor,\n });\n\n const titleId = useUuid();\n const svgColor = isHovered ? hoverColor : color;\n\n return (\n <svg\n data-testid={testId}\n data-analyticsid={AnalyticsId.Icon}\n ref={ref}\n className={classNames(`hnds-style-icon`, className)}\n role={ariaLabel ? 'img' : 'presentation'}\n aria-labelledby={ariaLabel ? titleId : undefined}\n focusable={false}\n aria-hidden={ariaLabel ? undefined : true}\n viewBox=\"0 0 48 48\"\n style={{ minWidth: size, minHeight: size }}\n width={size}\n height={size}\n fill={svgColor}\n color={svgColor}\n {...other}\n >\n {ariaLabel && <title id={titleId}>{ariaLabel}</title>}\n {svgRaw}\n </svg>\n );\n});\n\nIcon.displayName = 'Icon';\n\nexport default Icon;\n"],"names":[],"mappings":";;;;;AAmDO,MAAM,UAAU,CAAC;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AACpC,MAAI,QAAQ,SAAS,WAAW,WAAW,cAAc;AACvD,WAAO,YAAY,eAAe;AAAA,EAAA;AAEpC,MAAI,QAAQ,SAAS,UAAU,UAAU,aAAa;AACpD,WAAO,YAAY,cAAc;AAAA,EAAA;AAGnC,SAAO,YAAY,cAAc;AACnC;AAEO,MAAM,
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../src/components/Icon/Icon.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, FormOnColor, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { StatusDotOnColor } from '../StatusDot';\n\nexport type SvgIcon = React.FC<SvgPathProps>;\n\nexport interface BaseIconProps {\n /* aria-label for the <svg> element. Used as <title> tag. */\n ariaLabel?: string;\n /* Changes the size of the icon. */\n size?: number;\n /* Changes the color of the icon. */\n color?: string;\n /* Changes the hover color of the icon. */\n hoverColor?: string;\n /* Adds custom classes to the element. */\n className?: string;\n /* Swaps the displayed icon to the hover version and changes its color. */\n isHovered?: boolean;\n /** Defines the color of the icon */\n onColor?: keyof typeof FormOnColor | StatusDotOnColor;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface IconProps extends BaseIconProps {\n /* Sets which icon should be displayed. */\n svgIcon: SvgIcon;\n}\n\nexport interface SvgPathProps {\n size: IconSize;\n isHovered: boolean;\n onColor?: keyof typeof FormOnColor | StatusDotOnColor;\n}\n\ninterface IconConfig {\n size: IconSize;\n isHovered: boolean;\n normal: React.ReactElement;\n normalHover: React.ReactElement;\n xSmall?: React.ReactElement;\n xSmallHover?: React.ReactElement;\n xxSmall?: React.ReactElement;\n xxSmallHover?: React.ReactElement;\n}\n\nexport const getIcon = ({\n size,\n isHovered,\n normal,\n normalHover,\n xSmall,\n xSmallHover,\n xxSmall,\n xxSmallHover,\n}: IconConfig): React.ReactElement => {\n if (size <= IconSize.XXSmall && xxSmall && xxSmallHover) {\n return isHovered ? xxSmallHover : xxSmall;\n }\n if (size <= IconSize.XSmall && xSmall && xSmallHover) {\n return isHovered ? xSmallHover : xSmall;\n }\n\n return isHovered ? normalHover : normal;\n};\n\nexport const Icon = React.forwardRef((props: IconProps, ref: React.ForwardedRef<SVGSVGElement>) => {\n const {\n svgIcon,\n ariaLabel,\n className = '',\n size = IconSize.Small,\n color = 'black',\n hoverColor = color || 'black',\n isHovered = false,\n onColor,\n testId,\n ...other\n } = props;\n\n const svgRaw = React.createElement(svgIcon, {\n size,\n isHovered,\n onColor,\n });\n\n const titleId = useUuid();\n const svgColor = isHovered ? hoverColor : color;\n\n return (\n <svg\n data-testid={testId}\n data-analyticsid={AnalyticsId.Icon}\n ref={ref}\n className={classNames(`hnds-style-icon`, className)}\n role={ariaLabel ? 'img' : 'presentation'}\n aria-labelledby={ariaLabel ? titleId : undefined}\n focusable={false}\n aria-hidden={ariaLabel ? undefined : true}\n viewBox=\"0 0 48 48\"\n style={{ minWidth: size, minHeight: size }}\n width={size}\n height={size}\n fill={svgColor}\n color={svgColor}\n {...other}\n >\n {ariaLabel && <title id={titleId}>{ariaLabel}</title>}\n {svgRaw}\n </svg>\n );\n});\n\nIcon.displayName = 'Icon';\n\nexport default Icon;\n"],"names":["React"],"mappings":";;;;;AAmDO,MAAM,UAAU,CAAC;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAsC;AACpC,MAAI,QAAQ,SAAS,WAAW,WAAW,cAAc;AACvD,WAAO,YAAY,eAAe;AAAA,EAAA;AAEpC,MAAI,QAAQ,SAAS,UAAU,UAAU,aAAa;AACpD,WAAO,YAAY,cAAc;AAAA,EAAA;AAGnC,SAAO,YAAY,cAAc;AACnC;AAEO,MAAM,OAAOA,eAAM,WAAW,CAAC,OAAkB,QAA2C;AAC3F,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,OAAO,SAAS;AAAA,IAChB,QAAQ;AAAA,IACR,aAAa,SAAS;AAAA,IACtB,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AAEE,QAAA,SAASA,eAAM,cAAc,SAAS;AAAA,IAC1C;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAED,QAAM,UAAU,QAAQ;AAClB,QAAA,WAAW,YAAY,aAAa;AAGxC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAa;AAAA,MACb,oBAAkB,YAAY;AAAA,MAC9B;AAAA,MACA,WAAW,WAAW,mBAAmB,SAAS;AAAA,MAClD,MAAM,YAAY,QAAQ;AAAA,MAC1B,mBAAiB,YAAY,UAAU;AAAA,MACvC,WAAW;AAAA,MACX,eAAa,YAAY,SAAY;AAAA,MACrC,SAAQ;AAAA,MACR,OAAO,EAAE,UAAU,MAAM,WAAW,KAAK;AAAA,MACzC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACN,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA,aAAc,oBAAA,SAAA,EAAM,IAAI,SAAU,UAAU,WAAA;AAAA,QAC5C;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAEJ,CAAC;AAED,KAAK,cAAc;"}
|
package/Illustration.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default from "react";
|
|
3
3
|
import { g as getIllustration } from "./utils.js";
|
|
4
4
|
import { AnalyticsId } from "./constants.js";
|
|
5
5
|
import { useUuid } from "./hooks/useUuid.js";
|
|
@@ -8,7 +8,7 @@ var ViewBoxSize = /* @__PURE__ */ ((ViewBoxSize2) => {
|
|
|
8
8
|
ViewBoxSize2["Small"] = "0 0 200 200";
|
|
9
9
|
return ViewBoxSize2;
|
|
10
10
|
})(ViewBoxSize || {});
|
|
11
|
-
const Illustration =
|
|
11
|
+
const Illustration = React__default.forwardRef((props, ref) => {
|
|
12
12
|
const { illustration, ariaLabel, className = "", size = 512, color = "neutral", testId, ...other } = props;
|
|
13
13
|
const titleId = useUuid();
|
|
14
14
|
const viewBox = getIllustration({
|
|
@@ -33,7 +33,7 @@ const Illustration = React.forwardRef((props, ref) => {
|
|
|
33
33
|
fill: color,
|
|
34
34
|
...other
|
|
35
35
|
};
|
|
36
|
-
const svgElement =
|
|
36
|
+
const svgElement = React__default.createElement(illustration, {
|
|
37
37
|
size,
|
|
38
38
|
color,
|
|
39
39
|
svgProperties,
|
package/Illustration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Illustration.js","sources":["../src/components/Illustration/Illustration.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIllustration } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\n\nexport type IllustrationColor = 'neutral' | 'cherry' | 'blueberry';\n\nexport enum ViewBoxSize {\n Medium = '0 0 512 512',\n Small = '0 0 200 200',\n}\n\nexport interface BaseSvgIllustrationProps {\n color: IllustrationColor;\n svgProperties: React.SVGProps<SVGSVGElement>;\n title: React.ReactNode;\n}\nexport interface SvgIllustrationProps extends BaseSvgIllustrationProps {\n size: number;\n}\n\nexport type SvgIllustration = React.ComponentType<SvgIllustrationProps>;\n\nexport interface BaseIllustrationProps {\n /* aria-label for the <svg> element. Used as <title> tag. */\n ariaLabel?: string;\n /* Changes the size of the illustration. */\n size?: number;\n /* Changes the color of the illustration. */\n color?: IllustrationColor;\n /* Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface IllustrationProps extends BaseIllustrationProps {\n /* Sets which illustration should be displayed. */\n illustration: SvgIllustration;\n}\n\nexport const Illustration = React.forwardRef<SVGSVGElement, IllustrationProps>((props, ref) => {\n const { illustration, ariaLabel, className = '', size = 512, color = 'neutral', testId, ...other } = props;\n\n const titleId = useUuid();\n const viewBox = getIllustration({ size, medium: ViewBoxSize.Medium, small: ViewBoxSize.Small });\n\n const svgProperties = {\n 'data-testid': testId,\n 'data-analyticsid': AnalyticsId.Illustration,\n ref,\n className,\n role: ariaLabel ? 'img' : 'presentation',\n 'aria-labelledby': ariaLabel ? titleId : undefined,\n focusable: false,\n 'aria-hidden': ariaLabel ? undefined : true,\n viewBox,\n style: { minWidth: size, minHeight: size },\n width: size,\n height: size,\n fill: color,\n ...other,\n };\n\n const svgElement = React.createElement(illustration, {\n size,\n color,\n svgProperties: svgProperties,\n title: ariaLabel && <title id={titleId}>{ariaLabel}</title>,\n });\n\n return svgElement;\n});\n\nIllustration.displayName = 'Illustration';\n\nexport default Illustration;\n"],"names":["ViewBoxSize"],"mappings":";;;;;AAQY,IAAA,gCAAAA,iBAAL;AACLA,eAAA,QAAS,IAAA;AACTA,eAAA,OAAQ,IAAA;AAFEA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAkCL,MAAM,
|
|
1
|
+
{"version":3,"file":"Illustration.js","sources":["../src/components/Illustration/Illustration.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIllustration } from './utils';\nimport { AnalyticsId } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\n\nexport type IllustrationColor = 'neutral' | 'cherry' | 'blueberry';\n\nexport enum ViewBoxSize {\n Medium = '0 0 512 512',\n Small = '0 0 200 200',\n}\n\nexport interface BaseSvgIllustrationProps {\n color: IllustrationColor;\n svgProperties: React.SVGProps<SVGSVGElement>;\n title: React.ReactNode;\n}\nexport interface SvgIllustrationProps extends BaseSvgIllustrationProps {\n size: number;\n}\n\nexport type SvgIllustration = React.ComponentType<SvgIllustrationProps>;\n\nexport interface BaseIllustrationProps {\n /* aria-label for the <svg> element. Used as <title> tag. */\n ariaLabel?: string;\n /* Changes the size of the illustration. */\n size?: number;\n /* Changes the color of the illustration. */\n color?: IllustrationColor;\n /* Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport interface IllustrationProps extends BaseIllustrationProps {\n /* Sets which illustration should be displayed. */\n illustration: SvgIllustration;\n}\n\nexport const Illustration = React.forwardRef<SVGSVGElement, IllustrationProps>((props, ref) => {\n const { illustration, ariaLabel, className = '', size = 512, color = 'neutral', testId, ...other } = props;\n\n const titleId = useUuid();\n const viewBox = getIllustration({ size, medium: ViewBoxSize.Medium, small: ViewBoxSize.Small });\n\n const svgProperties = {\n 'data-testid': testId,\n 'data-analyticsid': AnalyticsId.Illustration,\n ref,\n className,\n role: ariaLabel ? 'img' : 'presentation',\n 'aria-labelledby': ariaLabel ? titleId : undefined,\n focusable: false,\n 'aria-hidden': ariaLabel ? undefined : true,\n viewBox,\n style: { minWidth: size, minHeight: size },\n width: size,\n height: size,\n fill: color,\n ...other,\n };\n\n const svgElement = React.createElement(illustration, {\n size,\n color,\n svgProperties: svgProperties,\n title: ariaLabel && <title id={titleId}>{ariaLabel}</title>,\n });\n\n return svgElement;\n});\n\nIllustration.displayName = 'Illustration';\n\nexport default Illustration;\n"],"names":["ViewBoxSize","React"],"mappings":";;;;;AAQY,IAAA,gCAAAA,iBAAL;AACLA,eAAA,QAAS,IAAA;AACTA,eAAA,OAAQ,IAAA;AAFEA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AAkCL,MAAM,eAAeC,eAAM,WAA6C,CAAC,OAAO,QAAQ;AAC7F,QAAM,EAAE,cAAc,WAAW,YAAY,IAAI,OAAO,KAAK,QAAQ,WAAW,QAAQ,GAAG,MAAU,IAAA;AAErG,QAAM,UAAU,QAAQ;AAClB,QAAA,UAAU,gBAAgB;AAAA,IAAE;AAAA,IAAM,QAAQ;AAAA,IAAoB,OAAO;AAAA;AAAA,GAAmB;AAE9F,QAAM,gBAAgB;AAAA,IACpB,eAAe;AAAA,IACf,oBAAoB,YAAY;AAAA,IAChC;AAAA,IACA;AAAA,IACA,MAAM,YAAY,QAAQ;AAAA,IAC1B,mBAAmB,YAAY,UAAU;AAAA,IACzC,WAAW;AAAA,IACX,eAAe,YAAY,SAAY;AAAA,IACvC;AAAA,IACA,OAAO,EAAE,UAAU,MAAM,WAAW,KAAK;AAAA,IACzC,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,GAAG;AAAA,EACL;AAEM,QAAA,aAAaA,eAAM,cAAc,cAAc;AAAA,IACnD;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,aAAa,oBAAC,SAAM,EAAA,IAAI,SAAU,UAAU,UAAA,CAAA;AAAA,EAAA,CACpD;AAEM,SAAA;AACT,CAAC;AAED,aAAa,cAAc;"}
|
package/Input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { useRef, useState, useEffect } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { FormOnColor, FormSize, IconSize, AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX } from "./constants.js";
|
|
5
5
|
import { useBreakpoint, Breakpoint } from "./hooks/useBreakpoint.js";
|
|
@@ -31,7 +31,7 @@ const getInputMaxWidth = (characters, hasIcon, iconSize) => {
|
|
|
31
31
|
const borderWidth = "4px";
|
|
32
32
|
return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${iconWidth} + ${borderWidth})`;
|
|
33
33
|
};
|
|
34
|
-
const Input =
|
|
34
|
+
const Input = React__default.forwardRef((props, ref) => {
|
|
35
35
|
const {
|
|
36
36
|
className,
|
|
37
37
|
defaultValue,
|