@helsenorge/designsystem-react 13.0.0-workspaces-beta.5 → 13.0.0-workspaces-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/CHANGELOG.md +2 -0
- package/lib/DictionaryTrigger.js +1 -1
- package/lib/DictionaryTrigger.js.map +1 -1
- package/lib/Drawer.js +1 -1
- package/lib/Drawer.js.map +1 -1
- package/lib/HelpTriggerIcon.js +1 -1
- package/lib/HelpTriggerIcon.js.map +1 -1
- package/lib/HelpTriggerStandalone.js +1 -1
- package/lib/HelpTriggerStandalone.js.map +1 -1
- package/lib/Highlighter.js +1 -1
- package/lib/Highlighter.js.map +1 -1
- package/lib/HorizontalScroll.js +1 -1
- package/lib/HorizontalScroll.js.map +1 -1
- package/lib/Icon.js +1 -1
- package/lib/Icon.js.map +1 -1
- package/lib/Illustration.js +1 -1
- package/lib/Illustration.js.map +1 -1
- package/lib/Input.js +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/LazyIcon.js +1 -1
- package/lib/LazyIcon.js.map +1 -1
- package/lib/LazyIllustration.js +1 -1
- package/lib/LazyIllustration.js.map +1 -1
- package/lib/LinkList.js +1 -1
- package/lib/LinkList.js.map +1 -1
- package/lib/RadioButton.js +1 -1
- package/lib/RadioButton.js.map +1 -1
- package/lib/Select.js +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/SingleSelectItem.js +1 -1
- package/lib/SingleSelectItem.js.map +1 -1
- package/lib/Slider.js +1 -1
- package/lib/Slider.js.map +1 -1
- package/lib/Table.js +1 -1
- package/lib/Table.js.map +1 -1
- package/lib/TableBody.js +1 -1
- package/lib/TableBody.js.map +1 -1
- package/lib/TableCell.js +1 -1
- package/lib/TableCell.js.map +1 -1
- package/lib/TableHead.js +1 -1
- package/lib/TableHead.js.map +1 -1
- package/lib/TableHeadCell.js +1 -1
- package/lib/TableHeadCell.js.map +1 -1
- package/lib/TableRow.js +1 -1
- package/lib/TableRow.js.map +1 -1
- package/lib/Textarea.js +1 -1
- package/lib/Textarea.js.map +1 -1
- package/lib/components/FavoriteButton/index.js +1 -1
- package/lib/components/FavoriteButton/index.js.map +1 -1
- package/lib/components/HelpTriggerInline/index.js +1 -1
- package/lib/components/HelpTriggerInline/index.js.map +1 -1
- package/lib/components/Illustrations/BabyMobile.js +1 -1
- package/lib/components/Illustrations/BabyMobile.js.map +1 -1
- package/lib/components/Illustrations/Child.js +1 -1
- package/lib/components/Illustrations/Child.js.map +1 -1
- package/lib/components/Illustrations/Doctor.js +1 -1
- package/lib/components/Illustrations/Doctor.js.map +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js +1 -1
- package/lib/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
- package/lib/components/Illustrations/GiveBabyFood.js +1 -1
- package/lib/components/Illustrations/GiveBabyFood.js.map +1 -1
- package/lib/components/Illustrations/HealthcarePersonnel.js +1 -1
- package/lib/components/Illustrations/HealthcarePersonnel.js.map +1 -1
- package/lib/components/Illustrations/ReadLetters.js +1 -1
- package/lib/components/Illustrations/ReadLetters.js.map +1 -1
- package/lib/components/Illustrations/Stroller.js +1 -1
- package/lib/components/Illustrations/Stroller.js.map +1 -1
- package/lib/components/Illustrations/Support2.js +1 -1
- package/lib/components/Illustrations/Support2.js.map +1 -1
- package/lib/components/StickyNote/index.js +1 -1
- package/lib/components/StickyNote/index.js.map +1 -1
- package/lib/floating-ui.react.js +6 -6
- package/lib/floating-ui.react.js.map +1 -1
- package/package.json +614 -9
package/lib/Textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.js","names":[],"sources":["../src/components/Textarea/Textarea.tsx","../src/components/Textarea/index.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { renderLabel } from '../Label';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** The text is displayed in the end of the text-counter */\n maxText?: string;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea = React.forwardRef((props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => {\n const {\n maxCharacters,\n maxText,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n ...rest\n } = props;\n\n const [rows, setRows] = useState(minRows);\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useIdWithFallback(errorTextIdProp);\n\n useEffect(() => {\n setTextareaInput(defaultValue || '');\n }, [defaultValue]);\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n const previousRows = target.rows;\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows === previousRows) {\n target.rows = currentRows;\n }\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n }\n\n if (currentRows < maxRows) {\n setRows(currentRows);\n } else {\n setRows(maxRows);\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useEffect(() => {\n if (value) setTextareaInput(value);\n\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel(label, textareaId, onColor as FormOnColor)}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={rows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={maxText}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n","import Textarea from './Textarea';\nexport * from './Textarea';\nexport default Textarea;\n"],"mappings":";;;;;;;;;;;AA8DA,IAAM,uBAAuB,eAA+B;AAK1D,QAAO,QAAQ,aAAA,GAAwC;;AAGzD,IAAM,WAAW,MAAM,YAAY,OAAsB,QAAwC;CAC/F,MAAM,EACJ,eACA,SACA,OACA,QACA,cACA,cAAc,cACd,aACA,UAAU,YAAY,SACtB,OACA,aAAa,MAAM,EACnB,UAAU,GACV,UAAU,IACV,MACA,OACA,WACA,aAAa,iBACb,uBACA,WACA,UACA,MACA,eAAe,OACf,aACA,UACA,UACA,UACA,
|
|
1
|
+
{"version":3,"file":"Textarea.js","names":[],"sources":["../src/components/Textarea/Textarea.tsx","../src/components/Textarea/index.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\n\nimport cn from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormOnColor } from '../../constants';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\nimport { uuid } from '../../utils/uuid';\nimport ErrorWrapper, { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport { renderLabel } from '../Label';\nimport MaxCharacters from '../MaxCharacters/MaxCharacters';\n\nimport styles from './styles.module.scss';\n\nexport interface TextareaProps\n extends ErrorWrapperClassNameProps,\n Pick<\n React.InputHTMLAttributes<HTMLTextAreaElement>,\n | 'aria-describedby'\n | 'autoFocus'\n | 'disabled'\n | 'name'\n | 'autoComplete'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'defaultValue'\n | 'onChange'\n | 'value'\n > {\n /** max character limit in textarea */\n maxCharacters?: number;\n /** The text is displayed in the end of the text-counter */\n maxText?: string;\n /** Width of textarea in characters (approximate) */\n width?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** If true, the component will have a bottom margin. */\n marginBottom?: boolean;\n /** If true, the component will be transparent. */\n transparent?: boolean;\n /** Changes the visuals of the textarea */\n onColor?: keyof typeof FormOnColor;\n /** Label of the input */\n label?: React.ReactNode;\n /** id of the textarea */\n textareaId?: string;\n /** max rows */\n maxRows?: number;\n /** min rows */\n minRows?: number;\n /** auto-grows until maxRows */\n grow?: boolean;\n /** Activates Error style for the input */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n}\n\nconst getTextareaMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n const scrollbarWidth = '16px';\n const borderWidth = '4px';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth} + ${scrollbarWidth} + ${borderWidth})`;\n};\n\nconst Textarea = React.forwardRef((props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => {\n const {\n maxCharacters,\n maxText,\n width,\n testId,\n defaultValue,\n marginBottom: gutterBottom,\n transparent,\n onColor = FormOnColor.onwhite,\n label,\n textareaId = uuid(),\n minRows = 3,\n maxRows = 10,\n grow,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n errorWrapperClassName,\n autoFocus,\n disabled,\n name,\n autoComplete = 'off',\n placeholder,\n readOnly,\n required,\n onChange,\n value,\n ...rest\n } = props;\n\n const [rows, setRows] = useState(minRows);\n const [textareaInput, setTextareaInput] = useState(value || defaultValue || '');\n const referanse = useRef<HTMLDivElement>(null);\n const errorTextUuid = useIdWithFallback(errorTextIdProp);\n\n useEffect(() => {\n setTextareaInput(defaultValue || '');\n }, [defaultValue]);\n\n const resizeHeight = (target: HTMLTextAreaElement): void => {\n const textareaLineHeight = 28;\n\n const previousRows = target.rows;\n target.rows = minRows; // reset number of rows in textarea\n\n const currentRows = Math.floor((target.scrollHeight - 16) / textareaLineHeight); // scrollHeight - 16px of padding to calculate the rows\n\n if (currentRows === previousRows) {\n target.rows = currentRows;\n }\n\n if (currentRows >= maxRows) {\n target.rows = maxRows;\n target.scrollTop = target.scrollHeight;\n }\n\n if (currentRows < maxRows) {\n setRows(currentRows);\n } else {\n setRows(maxRows);\n }\n };\n\n const onDark = onColor === FormOnColor.ondark;\n const onBlueberry = onColor === FormOnColor.onblueberry;\n const maxCharactersExceeded = !!maxCharacters && textareaInput.toString().length > maxCharacters;\n const onError = onColor === FormOnColor.oninvalid || !!errorText || !!error || maxCharactersExceeded;\n\n const textareaWrapperClass = cn(styles.textarea, {\n [styles['textarea--gutterBottom']]: gutterBottom,\n });\n\n const contentWrapperClass = cn(styles['input-container'], {\n [styles['input-container--transparent']]: transparent,\n [styles['input-container--on-blueberry']]: onBlueberry,\n [styles['input-container--on-dark']]: onDark,\n [styles['input-container--invalid']]: onError,\n [styles['input-container--disabled']]: props.disabled,\n });\n\n const textareaClass = cn(styles['input-container__input'], {\n [styles[`input-container__input--disabled`]]: props.disabled,\n });\n\n useEffect(() => {\n if (value) setTextareaInput(value);\n\n if (grow && referanse.current?.children && referanse.current?.children[0]) {\n const textarea = referanse.current?.children[0] as HTMLTextAreaElement;\n resizeHeight(textarea);\n }\n }, [value]);\n\n const onChangeHandler = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n setTextareaInput(e.target.value);\n\n if (onChange) {\n onChange(e);\n }\n\n if (grow) {\n resizeHeight(e.target);\n }\n };\n\n const maxWidth = width ? getTextareaMaxWidth(width) : undefined;\n\n return (\n <ErrorWrapper className={errorWrapperClassName} errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Textarea} className={textareaWrapperClass}>\n {renderLabel(label, textareaId, onColor as FormOnColor)}\n <div className={contentWrapperClass} ref={referanse} style={{ maxWidth }}>\n <textarea\n {...rest}\n rows={rows}\n defaultValue={defaultValue}\n id={textareaId}\n className={textareaClass}\n ref={ref}\n aria-describedby={getAriaDescribedBy(props, errorTextUuid)}\n aria-invalid={!!onError}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n disabled={disabled}\n name={name}\n autoComplete={autoComplete ? autoComplete : undefined}\n placeholder={placeholder}\n readOnly={readOnly}\n required={required}\n onChange={onChangeHandler}\n value={value}\n />\n </div>\n {maxCharacters && (\n <MaxCharacters\n maxCharacters={maxCharacters}\n length={textareaInput.toString().length}\n maxText={maxText}\n onColor={onColor}\n maxWidth={maxWidth}\n />\n )}\n </div>\n </ErrorWrapper>\n );\n});\n\nTextarea.displayName = 'Textarea';\n\nexport default Textarea;\n","import Textarea from './Textarea';\nexport * from './Textarea';\nexport default Textarea;\n"],"mappings":";;;;;;;;;;;AA8DA,IAAM,uBAAuB,eAA+B;AAK1D,QAAO,QAAQ,aAAA,GAAwC;;AAGzD,IAAM,WAAW,MA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AC;CAEF,MAAM,gBAAgB,WAAG,OAAO,2BAA2B,GACxD,OAAO,sCAAsC,MAAM,UACrD,CAAC;AAEF,iBAAgB;AACd,MAAI,MAAO,kBAAiB,MAAM;AAElC,MAAI,QAAQ,UAAU,SAAS,YAAY,UAAU,SAAS,SAAS,IAAI;GACzE,MAAM,WAAW,UAAU,SAAS,SAAS;AAC7C,gBAAa,SAAS;;IAEvB,CAAC,MAAM,CAAC;CAEX,MAAM,mBAAmB,MAAoD;AAC3E,mBAAiB,EAAE,OAAO,MAAM;AAEhC,MAAI,SACF,UAAS,EAAE;AAGb,MAAI,KACF,cAAa,EAAE,OAAO;;CAI1B,MAAM,WAAW,QAAQ,oBAAoB,MAAM,GAAG,KAAA;AAEtD,QACE,oBAAC,sBAAA;EAAa,WAAW;EAAkC;EAAW,aAAa;YACjF,qBAAC,OAAA;GAAI,eAAa;GAAQ,oBAAkB,YAAY;GAAU,WAAW;;IAC1E,YAAY,OAAO,YAAY,QAAuB;IACvD,oBAAC,OAAA;KAAI,WAAW;KAAqB,KAAK;KAAW,OAAO,EAAE,UAAU;eACtE,oBAAC,YAAA;MACC,GAAI;MACE;MACQ;MACd,IAAI;MACJ,WAAW;MACN;MACL,oBAAkB,mBAAmB,OAAO,cAAc;MAC1D,gBAAc,CAAC,CAAC;MAEL;MACD;MACJ;MACN,cAAc,eAAe,eAAe,KAAA;MAC/B;MACH;MACA;MACV,UAAU;MACH;OACP;MACE;IACL,iBACC,oBAAC,uBAAA;KACgB;KACf,QAAQ,cAAc,UAAU,CAAC;KACxB;KACA;KACC;MACV;;IAEA;GACO;EAEjB;AAEF,SAAS,cAAc;ACxNvB,IAAA,qBD0Ne"}
|
|
@@ -98,7 +98,7 @@ const starIconHoverDesktop = (isChecked, isActive) => /* @__PURE__ */ jsxs(Fragm
|
|
|
98
98
|
strokeLinejoin: "round"
|
|
99
99
|
})] });
|
|
100
100
|
const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(props, ref) {
|
|
101
|
-
const { checked, id, onClick, resources, tabIndex, testId
|
|
101
|
+
const { checked, id, onClick, resources, tabIndex, testId, ...other } = props;
|
|
102
102
|
const buttonWrapperClasses = classNames(styles.favoritebutton);
|
|
103
103
|
const { refObject, isHovered, isActive } = usePseudoClasses(isMutableRefObject(ref) ? ref : null);
|
|
104
104
|
const breakpoint = useBreakpoint();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mergedResources: HNDesignsystemFavoriteButton"],"sources":["../../../src/resources/HN.Designsystem.FavoriteButton.nb-NO.json","../../../src/components/FavoriteButton/resourceHelper.ts","../../../src/components/FavoriteButton/StarIcon.tsx","../../../src/components/FavoriteButton/FavoriteButton.tsx","../../../src/components/FavoriteButton/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Favorittmarkering\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.FavoriteButton.nb-NO.json';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFavoriteButton => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import styles from './styles.module.scss';\n\nconst normalStroke = 'var(--color-action-graphics-onlight)';\nconst normalFill = 'transparent';\nconst hoverFill = '#126F8721'; // kan ikke bruke transparent token på svg\nconst hoverStroke = 'var(--color-action-graphics-onlight-hover)';\nconst activeStroke = 'var(--core-color-blueberry-800)';\n\nconst fillColor = (isChecked: boolean, isActive: boolean, isHovered: boolean): string => {\n if (isChecked) {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n } else {\n if (isHovered) {\n return hoverFill;\n } else {\n return normalFill;\n }\n }\n};\n\nconst strokeColor = (isActive: boolean, isHovered: boolean): string => {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n};\n\nexport const starIconNormalMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => {\n return (\n <>\n <path\n d=\"M20.1026 31.1787L13.4007 34.7023C10.833 36.0523 7.83185 33.8719 8.32233 31.0126L9.60261 23.5492L4.17653 18.2675C2.09656 16.2428 3.24317 12.712 6.11581 12.2956L13.5982 11.2112L16.9493 4.42107C18.2332 1.81969 21.9426 1.81969 23.2265 4.42107L26.5776 11.2112L34.06 12.2956C36.9326 12.712 38.0792 16.2428 35.9993 18.2675L30.5732 23.5492L31.852 31.0044C32.3428 33.8651 29.3386 36.0456 26.7708 34.6925L20.1026 31.1787Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n display=\"block\"\n />\n <path\n d=\"M20.0961 26.5515L12.6372 30.4731L14.0621 22.1671L8.01953 16.2853L16.3582 15.0768L20.0877 7.52002L23.8171 15.0768L32.1558 16.2853L26.1133 22.1671L27.5381 30.4731L20.0961 26.5515Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n );\n};\n\nexport const starIconHoverMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M22.2128 31.4832L16.2246 36.117C13.9303 37.8924 10.5961 36.2662 10.5826 33.3653L10.5475 25.7929L4.28665 21.5336C1.88672 19.9009 2.40278 16.2246 5.15948 15.3158L12.3399 12.9486L14.461 5.67964C15.2736 2.89484 18.9267 2.2507 20.6428 4.58962L25.1221 10.6947L32.6791 10.4633C35.5804 10.3745 37.3227 13.6526 35.6259 16.0077L31.1994 22.1514L33.7534 29.2712C34.7335 32.0033 32.1536 34.6724 29.3898 33.7857L22.2128 31.4832Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M21.4079 26.8365L14.7433 31.9937L14.7041 23.5664L7.73204 18.8233L15.7342 16.1851L18.0947 8.09555L23.0798 14.8899L31.5016 14.6321L26.5722 21.4738L29.4178 29.4062L21.4079 26.8365Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\nexport const starIconNormalDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M30.1061 44.1854L20.3139 49.3338C17.7461 50.6838 14.745 48.5034 15.2355 45.6441L17.1061 34.7394L9.17653 27.0207C7.09656 24.9961 8.24318 21.4653 11.1158 21.0489L22.053 19.4638L26.9493 9.54278C28.2331 6.9414 31.9426 6.94139 33.2265 9.54278L38.1227 19.4638L49.06 21.0489C51.9326 21.4653 53.0792 24.9961 50.9993 27.0207L43.0697 34.7394L44.9389 45.6359C45.4296 48.4966 42.4254 50.6772 39.8576 49.324L30.1061 44.1854Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M30.0998 39.4723L19.5927 44.9966L21.5998 33.2961L13.0879 25.0106L24.8343 23.3082L30.0879 12.6632L35.3414 23.3082L47.0879 25.0106L38.576 33.2961L40.5831 44.9966L30.0998 39.4723Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n\nexport const starIconHoverDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M33.1609 44.7458L24.4114 51.5164C22.1171 53.2918 18.783 51.6656 18.7695 48.7646L18.7181 37.7007L9.56864 31.4763C7.1687 29.8436 7.68476 26.1672 10.4415 25.2584L20.9373 21.7982L24.0364 11.1776C24.849 8.39281 28.5021 7.74867 30.2182 10.0876L36.7629 19.0077L47.8092 18.6695C50.7105 18.5807 52.4528 21.8588 50.756 24.2138L44.2872 33.1922L48.0201 43.5985C49.0002 46.3306 46.4203 48.9997 43.6565 48.113L33.1609 44.7458Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M32.3991 40.1029L23.0108 47.3678L22.9557 35.4965L13.1343 28.815L24.4067 25.0987L27.732 13.7031L34.7542 23.2741L46.6178 22.9109L39.674 32.5486L43.6823 43.7228L32.3991 40.1029Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n","import React, { AriaAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { starIconHoverDesktop, starIconHoverMobile, starIconNormalDesktop, starIconNormalMobile } from './StarIcon';\nimport { AnalyticsId, HTMLButtonProps, LanguageLocales } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport { isMutableRefObject } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport interface FavoriteButtonProps extends HTMLButtonProps, AriaAttributes {\n /** Determines if the FavoriteButton is checked */\n checked: boolean;\n /** Gives a unique id to the button */\n id?: string;\n /** Function that is called when clicked */\n onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemFavoriteButton>;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(\n props: FavoriteButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement>\n) {\n const { checked, id, onClick, resources, tabIndex, testId, ...other } = props;\n\n const buttonWrapperClasses = classNames(styles.favoritebutton);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLButtonElement>(isMutableRefObject(ref) ? ref : null);\n const breakpoint = useBreakpoint();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemFavoriteButton = {\n ...defaultResources,\n ...resources,\n ariaLabel: other['aria-label'] || resources?.ariaLabel || defaultResources.ariaLabel,\n };\n\n const isMobile = breakpoint <= Breakpoint.sm;\n\n const starIcon = ((): React.JSX.Element => {\n if (isMobile) {\n if (isHovered) {\n return starIconHoverMobile(checked, isActive);\n } else {\n return starIconNormalMobile(checked, isActive);\n }\n } else {\n if (isHovered) {\n return starIconHoverDesktop(checked, isActive);\n } else {\n return starIconNormalDesktop(checked, isActive);\n }\n }\n })();\n\n return (\n <button\n id={id}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.FavoriteButton}\n className={buttonWrapperClasses}\n ref={refObject}\n tabIndex={tabIndex}\n role=\"switch\"\n aria-checked={checked}\n type=\"button\"\n aria-label={mergedResources.ariaLabel}\n {...other}\n >\n <svg focusable={false} overflow=\"visible\" role=\"presentation\" viewBox={isMobile ? '0 0 41 41' : '0 0 61 61'} {...other}>\n {starIcon}\n </svg>\n </button>\n );\n});\n\nFavoriteButton.displayName = 'FavoriteButton';\n\nexport default FavoriteButton;\n","export * from './FavoriteButton';\n\nimport { FavoriteButton } from './FavoriteButton';\nexport default FavoriteButton;\n"],"mappings":";;;;;;;;;;;ACIA,MAAa,gBAAgB,aAA4D;AACvF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACNb,IAAM,eAAe;AACrB,I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,MAAK;GAAe,SAAS,WAAW,cAAc;GAAa,GAAI;aAC9G;IACG;GACC;EAEX;AAEF,eAAe,cAAc;ACrF7B,IAAA,yBAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["mergedResources: HNDesignsystemFavoriteButton"],"sources":["../../../src/resources/HN.Designsystem.FavoriteButton.nb-NO.json","../../../src/components/FavoriteButton/resourceHelper.ts","../../../src/components/FavoriteButton/StarIcon.tsx","../../../src/components/FavoriteButton/FavoriteButton.tsx","../../../src/components/FavoriteButton/index.ts"],"sourcesContent":["{\n \"ariaLabel\": \"Favorittmarkering\"\n}\n","import { LanguageLocales } from '../../constants';\nimport nbNO from '../../resources/HN.Designsystem.FavoriteButton.nb-NO.json';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFavoriteButton => {\n switch (language) {\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n","import styles from './styles.module.scss';\n\nconst normalStroke = 'var(--color-action-graphics-onlight)';\nconst normalFill = 'transparent';\nconst hoverFill = '#126F8721'; // kan ikke bruke transparent token på svg\nconst hoverStroke = 'var(--color-action-graphics-onlight-hover)';\nconst activeStroke = 'var(--core-color-blueberry-800)';\n\nconst fillColor = (isChecked: boolean, isActive: boolean, isHovered: boolean): string => {\n if (isChecked) {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n } else {\n if (isHovered) {\n return hoverFill;\n } else {\n return normalFill;\n }\n }\n};\n\nconst strokeColor = (isActive: boolean, isHovered: boolean): string => {\n if (isActive) {\n return activeStroke;\n } else {\n if (isHovered) {\n return hoverStroke;\n } else {\n return normalStroke;\n }\n }\n};\n\nexport const starIconNormalMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => {\n return (\n <>\n <path\n d=\"M20.1026 31.1787L13.4007 34.7023C10.833 36.0523 7.83185 33.8719 8.32233 31.0126L9.60261 23.5492L4.17653 18.2675C2.09656 16.2428 3.24317 12.712 6.11581 12.2956L13.5982 11.2112L16.9493 4.42107C18.2332 1.81969 21.9426 1.81969 23.2265 4.42107L26.5776 11.2112L34.06 12.2956C36.9326 12.712 38.0792 16.2428 35.9993 18.2675L30.5732 23.5492L31.852 31.0044C32.3428 33.8651 29.3386 36.0456 26.7708 34.6925L20.1026 31.1787Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n display=\"block\"\n />\n <path\n d=\"M20.0961 26.5515L12.6372 30.4731L14.0621 22.1671L8.01953 16.2853L16.3582 15.0768L20.0877 7.52002L23.8171 15.0768L32.1558 16.2853L26.1133 22.1671L27.5381 30.4731L20.0961 26.5515Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n );\n};\n\nexport const starIconHoverMobile = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M22.2128 31.4832L16.2246 36.117C13.9303 37.8924 10.5961 36.2662 10.5826 33.3653L10.5475 25.7929L4.28665 21.5336C1.88672 19.9009 2.40278 16.2246 5.15948 15.3158L12.3399 12.9486L14.461 5.67964C15.2736 2.89484 18.9267 2.2507 20.6428 4.58962L25.1221 10.6947L32.6791 10.4633C35.5804 10.3745 37.3227 13.6526 35.6259 16.0077L31.1994 22.1514L33.7534 29.2712C34.7335 32.0033 32.1536 34.6724 29.3898 33.7857L22.2128 31.4832Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M21.4079 26.8365L14.7433 31.9937L14.7041 23.5664L7.73204 18.8233L15.7342 16.1851L18.0947 8.09555L23.0798 14.8899L31.5016 14.6321L26.5722 21.4738L29.4178 29.4062L21.4079 26.8365Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\nexport const starIconNormalDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M30.1061 44.1854L20.3139 49.3338C17.7461 50.6838 14.745 48.5034 15.2355 45.6441L17.1061 34.7394L9.17653 27.0207C7.09656 24.9961 8.24318 21.4653 11.1158 21.0489L22.053 19.4638L26.9493 9.54278C28.2331 6.9414 31.9426 6.94139 33.2265 9.54278L38.1227 19.4638L49.06 21.0489C51.9326 21.4653 53.0792 24.9961 50.9993 27.0207L43.0697 34.7394L44.9389 45.6359C45.4296 48.4966 42.4254 50.6772 39.8576 49.324L30.1061 44.1854Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M30.0998 39.4723L19.5927 44.9966L21.5998 33.2961L13.0879 25.0106L24.8343 23.3082L30.0879 12.6632L35.3414 23.3082L47.0879 25.0106L38.576 33.2961L40.5831 44.9966L30.0998 39.4723Z\"\n stroke={strokeColor(isActive, false)}\n fill={fillColor(isChecked, isActive, false)}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n\nexport const starIconHoverDesktop = (isChecked: boolean, isActive: boolean): React.JSX.Element => (\n <>\n <path\n d=\"M33.1609 44.7458L24.4114 51.5164C22.1171 53.2918 18.783 51.6656 18.7695 48.7646L18.7181 37.7007L9.56864 31.4763C7.1687 29.8436 7.68476 26.1672 10.4415 25.2584L20.9373 21.7982L24.0364 11.1776C24.849 8.39281 28.5021 7.74867 30.2182 10.0876L36.7629 19.0077L47.8092 18.6695C50.7105 18.5807 52.4528 21.8588 50.756 24.2138L44.2872 33.1922L48.0201 43.5985C49.0002 46.3306 46.4203 48.9997 43.6565 48.113L33.1609 44.7458Z\"\n stroke=\"black\"\n fill=\"transparent\"\n strokeWidth=\"3\"\n strokeLinecap=\"round\"\n className={styles['favoritebutton__star-icon--focus']}\n />\n <path\n d=\"M32.3991 40.1029L23.0108 47.3678L22.9557 35.4965L13.1343 28.815L24.4067 25.0987L27.732 13.7031L34.7542 23.2741L46.6178 22.9109L39.674 32.5486L43.6823 43.7228L32.3991 40.1029Z\"\n stroke={strokeColor(isActive, true)}\n fill={fillColor(isChecked, isActive, true)}\n fillOpacity={isChecked ? '1' : '0.13'}\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </>\n);\n","import React, { AriaAttributes } from 'react';\n\nimport classNames from 'classnames';\n\nimport { getResources } from './resourceHelper';\nimport { starIconHoverDesktop, starIconHoverMobile, starIconNormalDesktop, starIconNormalMobile } from './StarIcon';\nimport { AnalyticsId, HTMLButtonProps, LanguageLocales } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { HNDesignsystemFavoriteButton } from '../../resources/Resources';\nimport { useLanguage } from '../../utils/language';\nimport { isMutableRefObject } from '../../utils/refs';\n\nimport styles from './styles.module.scss';\n\nexport interface FavoriteButtonProps extends HTMLButtonProps, AriaAttributes {\n /** Determines if the FavoriteButton is checked */\n checked: boolean;\n /** Gives a unique id to the button */\n id?: string;\n /** Function that is called when clicked */\n onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Resources for component */\n resources?: Partial<HNDesignsystemFavoriteButton>;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const FavoriteButton = React.forwardRef(function FavoriteButtonForwardedRef(\n props: FavoriteButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement>\n) {\n const { checked, id, onClick, resources, tabIndex, testId, ...other } = props;\n\n const buttonWrapperClasses = classNames(styles.favoritebutton);\n const { refObject, isHovered, isActive } = usePseudoClasses<HTMLButtonElement>(isMutableRefObject(ref) ? ref : null);\n const breakpoint = useBreakpoint();\n const { language } = useLanguage<LanguageLocales>(LanguageLocales.NORWEGIAN);\n const defaultResources = getResources(language);\n\n const mergedResources: HNDesignsystemFavoriteButton = {\n ...defaultResources,\n ...resources,\n ariaLabel: other['aria-label'] || resources?.ariaLabel || defaultResources.ariaLabel,\n };\n\n const isMobile = breakpoint <= Breakpoint.sm;\n\n const starIcon = ((): React.JSX.Element => {\n if (isMobile) {\n if (isHovered) {\n return starIconHoverMobile(checked, isActive);\n } else {\n return starIconNormalMobile(checked, isActive);\n }\n } else {\n if (isHovered) {\n return starIconHoverDesktop(checked, isActive);\n } else {\n return starIconNormalDesktop(checked, isActive);\n }\n }\n })();\n\n return (\n <button\n id={id}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.FavoriteButton}\n className={buttonWrapperClasses}\n ref={refObject}\n tabIndex={tabIndex}\n role=\"switch\"\n aria-checked={checked}\n type=\"button\"\n aria-label={mergedResources.ariaLabel}\n {...other}\n >\n <svg focusable={false} overflow=\"visible\" role=\"presentation\" viewBox={isMobile ? '0 0 41 41' : '0 0 61 61'} {...other}>\n {starIcon}\n </svg>\n </button>\n );\n});\n\nFavoriteButton.displayName = 'FavoriteButton';\n\nexport default FavoriteButton;\n","export * from './FavoriteButton';\n\nimport { FavoriteButton } from './FavoriteButton';\nexport default FavoriteButton;\n"],"mappings":";;;;;;;;;;;ACIA,MAAa,gBAAgB,aAA4D;AACvF,SAAQ,UAAR;EACE,KAAK,gBAAgB;EACrB,QACE,QAAO;;;ACNb,IAAM,eAAe;AACrB,IAAM,aAAa;AACnB,IAAM,YAAY;AAClB,IAAM,cAAc;AACpB,IAAM,eAAe;AAErB,IAAM,aAAa,WAAoB,UAAmB,cAA+B;AACvF,KAAI,UACF,KAAI,SACF,QAAO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react";
|
|
|
7
7
|
import classNames from "classnames";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import styles from "./styles.module.scss";
|
|
10
|
-
var HelpTriggerInline = React.forwardRef(({ ariaLabel, ariaLabelledById, children, className, testId, weight = "normal"
|
|
10
|
+
var HelpTriggerInline = React.forwardRef(({ ariaLabel, ariaLabelledById, children, className, testId, weight = "normal", ...rest }, ref) => {
|
|
11
11
|
const ariaLabelAttributes = getAriaLabelAttributes({
|
|
12
12
|
label: ariaLabel,
|
|
13
13
|
id: ariaLabelledById
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/HelpTriggerInline/HelpTriggerInline.tsx","../../../src/components/HelpTriggerInline/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport { HelpTriggerIconInternal, HelpTriggerWeights } from '../HelpTriggerIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTriggerInlineProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /** Sets the text content of the HelpTriggerInline. */\n children: string;\n /**\n * Sets the colors of the help trigger. Default: normal.\n */\n weight?: HelpTriggerWeights;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst HelpTriggerInline = React.forwardRef<HTMLButtonElement, HelpTriggerInlineProps>(\n ({ ariaLabel, ariaLabelledById, children, className, testId, weight = 'normal', ...rest }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const helpTriggerInlineStyles = classNames(styles['help-trigger-inline'], className);\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>, false);\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTriggerInline}\n className={helpTriggerInlineStyles}\n ref={mergeRefs([refObject, ref])}\n {...ariaLabelAttributes}\n {...rest}\n >\n <span className={styles['help-trigger-inline__text']}>{children}</span>\n <HelpTriggerIconInternal weight={weight} size={'inherit'} htmlMarkup={'span'} isHovered={isHovered} />\n </button>\n );\n }\n);\n\nHelpTriggerInline.displayName = 'HelpTriggerInline';\n\nexport default HelpTriggerInline;\n","import HelpTriggerInline from './HelpTriggerInline';\nexport * from './HelpTriggerInline';\nexport default HelpTriggerInline;\n"],"mappings":";;;;;;;;;AAsCA,IAAM,oBAAoB,MAAM,YAC7B,EAAE,WAAW,kBAAkB,UAAU,WAAW,QAAQ,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/HelpTriggerInline/HelpTriggerInline.tsx","../../../src/components/HelpTriggerInline/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport { HelpTriggerIconInternal, HelpTriggerWeights } from '../HelpTriggerIcon';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpTriggerInlineProps\n extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls' | 'aria-expanded'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /** Sets the text content of the HelpTriggerInline. */\n children: string;\n /**\n * Sets the colors of the help trigger. Default: normal.\n */\n weight?: HelpTriggerWeights;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst HelpTriggerInline = React.forwardRef<HTMLButtonElement, HelpTriggerInlineProps>(\n ({ ariaLabel, ariaLabelledById, children, className, testId, weight = 'normal', ...rest }, ref) => {\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n const helpTriggerInlineStyles = classNames(styles['help-trigger-inline'], className);\n const { refObject, isHovered } = usePseudoClasses<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>, false);\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.HelpTriggerInline}\n className={helpTriggerInlineStyles}\n ref={mergeRefs([refObject, ref])}\n {...ariaLabelAttributes}\n {...rest}\n >\n <span className={styles['help-trigger-inline__text']}>{children}</span>\n <HelpTriggerIconInternal weight={weight} size={'inherit'} htmlMarkup={'span'} isHovered={isHovered} />\n </button>\n );\n }\n);\n\nHelpTriggerInline.displayName = 'HelpTriggerInline';\n\nexport default HelpTriggerInline;\n","import HelpTriggerInline from './HelpTriggerInline';\nexport * from './HelpTriggerInline';\nexport default HelpTriggerInline;\n"],"mappings":";;;;;;;;;AAsCA,IAAM,oBAAoB,MAAM,YAC7B,EAAE,WAAW,kBAAkB,UAAU,WAAW,QAAQ,SAAS,UAAU,GAAG,QAAQ,QAAQ;CACjG,MAAM,sBAAsB,uBAAuB;EAAE,OAAO;EAAW,IAAI;EAAkB,CAAC;CAC9F,MAAM,0BAA0B,WAAW,OAAO,wBAAwB,UAAU;CACpF,MAAM,EAAE,WAAW,cAAc,iBAAoC,KAA2C,MAAM;AAEtH,QACE,qBAAC,UAAA;EACC,cAAY;EACZ,MAAK;EACL,eAAa;EACb,oBAAkB,YAAY;EAC9B,WAAW;EACX,KAAK,UAAU,CAAC,WAAW,IAAI,CAAC;EAChC,GAAI;EACJ,GAAI;aAEJ,oBAAC,QAAA;GAAK,WAAW,OAAO;GAA+B;IAAgB,EACvE,oBAAC,yBAAA;GAAgC;GAAQ,MAAM;GAAW,YAAY;GAAmB;IAAa,CAAA;GAC/F;EAGd;AAED,kBAAkB,cAAc;AC5DhC,IAAA,4BD8De"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as BabyMobileMedium_default } from "../../BabyMobileMedium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var BabyMobile = ({ size = 512, color
|
|
7
|
+
var BabyMobile = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(BabyMobileMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BabyMobile.js","names":["BabyMobile: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/BabyMobile.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport BabyMobileMedium from './BabyMobileMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n details1: string;\n details2: string;\n}\n\nconst BabyMobile: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <BabyMobileMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default BabyMobile;\n"],"mappings":";;;;;;AAWA,IAAMA,cAA8C,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BabyMobile.js","names":["BabyMobile: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/BabyMobile.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport BabyMobileMedium from './BabyMobileMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n details1: string;\n details2: string;\n}\n\nconst BabyMobile: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <BabyMobileMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default BabyMobile;\n"],"mappings":";;;;;;AAWA,IAAMA,cAA8C,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGrF,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,0BAAA;GAAwB;GAAO,GAAI;IAAQ;EAEpB,CAAC;;AAG1C,IAAA,qBAAe"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as ChildMedium_default } from "../../ChildMedium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var Child = ({ size = 512, color
|
|
7
|
+
var Child = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(ChildMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Child.js","names":["Child: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Child.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport ChildMedium from './ChildMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n body: string;\n block1: string;\n block2: string;\n block3: string;\n block4: string;\n}\n\nconst Child: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <ChildMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default Child;\n"],"mappings":";;;;;;AAeA,IAAMA,SAAyC,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Child.js","names":["Child: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Child.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport ChildMedium from './ChildMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n body: string;\n block1: string;\n block2: string;\n block3: string;\n block4: string;\n}\n\nconst Child: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <ChildMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default Child;\n"],"mappings":";;;;;;AAeA,IAAMA,SAAyC,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGhF,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,qBAAA;GAAmB;GAAO,GAAI;IAAQ;EAEf,CAAC;;AAG1C,IAAA,gBAAe"}
|
|
@@ -3,7 +3,7 @@ import { t as DoctorMedium_default } from "../../DoctorMedium.js";
|
|
|
3
3
|
import { t as DoctorSmall_default } from "../../DoctorSmall.js";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
var Doctor = ({ size = 512, color
|
|
6
|
+
var Doctor = ({ size = 512, color, ...rest }) => {
|
|
7
7
|
return getIllustration({
|
|
8
8
|
size,
|
|
9
9
|
medium: /* @__PURE__ */ jsx(DoctorMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Doctor.js","names":["Doctor: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Doctor.tsx"],"sourcesContent":["import React from 'react';\n\nimport DoctorMedium from './DoctorMedium';\nimport DoctorSmall from './DoctorSmall';\nimport { SvgIllustrationProps } from '../Illustration';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n shirt: string;\n}\n\nconst Doctor: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <DoctorMedium color={color} {...rest} />;\n const small = <DoctorSmall color={color} {...rest} />;\n\n return getIllustration({ size, medium, small });\n};\n\nexport default Doctor;\n"],"mappings":";;;;;AAYA,IAAMA,UAA0C,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Doctor.js","names":["Doctor: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Doctor.tsx"],"sourcesContent":["import React from 'react';\n\nimport DoctorMedium from './DoctorMedium';\nimport DoctorSmall from './DoctorSmall';\nimport { SvgIllustrationProps } from '../Illustration';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n shirt: string;\n}\n\nconst Doctor: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <DoctorMedium color={color} {...rest} />;\n const small = <DoctorSmall color={color} {...rest} />;\n\n return getIllustration({ size, medium, small });\n};\n\nexport default Doctor;\n"],"mappings":";;;;;AAYA,IAAMA,UAA0C,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAIjF,QAAO,gBAAgB;EAAE;EAAM,QAHhB,oBAAC,sBAAA;GAAoB;GAAO,GAAI;IAAQ;EAGhB,OAFzB,oBAAC,qBAAA;GAAmB;GAAO,GAAI;IAAQ;EAEP,CAAC;;AAGjD,IAAA,iBAAe"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as FacialRecognitionFingerprintMedium_default } from "../../FacialRecognitionFingerprintMedium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var FacialRecognitionFingerprint = ({ size = 512, color
|
|
7
|
+
var FacialRecognitionFingerprint = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(FacialRecognitionFingerprintMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacialRecognitionFingerprint.js","names":["FacialRecognitionFingerprint: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/FacialRecognitionFingerprint.tsx"],"sourcesContent":["import React from 'react';\n\nimport FacialRecognitionFingerprintMedium from './FacialRecognitionFingerprintMedium';\nimport { SvgIllustrationProps } from '../Illustration';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n shirt: string;\n}\n\nconst FacialRecognitionFingerprint: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <FacialRecognitionFingerprintMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default FacialRecognitionFingerprint;\n"],"mappings":";;;;;;AAWA,IAAMA,gCAAgE,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"FacialRecognitionFingerprint.js","names":["FacialRecognitionFingerprint: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/FacialRecognitionFingerprint.tsx"],"sourcesContent":["import React from 'react';\n\nimport FacialRecognitionFingerprintMedium from './FacialRecognitionFingerprintMedium';\nimport { SvgIllustrationProps } from '../Illustration';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n shirt: string;\n}\n\nconst FacialRecognitionFingerprint: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <FacialRecognitionFingerprintMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default FacialRecognitionFingerprint;\n"],"mappings":";;;;;;AAWA,IAAMA,gCAAgE,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGvG,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,4CAAA;GAA0C;GAAO,GAAI;IAAQ;EAEtC,CAAC;;AAG1C,IAAA,uCAAe"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as GiveBabyFoodMedium_default } from "../../GiveBabyFoodMedium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var GiveBabyFood = ({ size = 512, color
|
|
7
|
+
var GiveBabyFood = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(GiveBabyFoodMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiveBabyFood.js","names":["GiveBabyFood: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/GiveBabyFood.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport GiveBabyFoodMedium from './GiveBabyFoodMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n skin: string;\n details: string;\n chair: string;\n lines: string;\n}\n\nconst GiveBabyFood: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <GiveBabyFoodMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default GiveBabyFood;\n"],"mappings":";;;;;;AAcA,IAAMA,gBAAgD,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"GiveBabyFood.js","names":["GiveBabyFood: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/GiveBabyFood.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport GiveBabyFoodMedium from './GiveBabyFoodMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n hair: string;\n skin: string;\n details: string;\n chair: string;\n lines: string;\n}\n\nconst GiveBabyFood: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <GiveBabyFoodMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default GiveBabyFood;\n"],"mappings":";;;;;;AAcA,IAAMA,gBAAgD,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGvF,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,4BAAA;GAA0B;GAAO,GAAI;IAAQ;EAEtB,CAAC;;AAG1C,IAAA,uBAAe"}
|
|
@@ -3,7 +3,7 @@ import { t as HealthcarePersonnelMedium_default } from "../../HealthcarePersonne
|
|
|
3
3
|
import { t as HealthcarePersonnelSmall_default } from "../../HealthcarePersonnelSmall.js";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
var HealthcarePersonnel = ({ size = 512, color
|
|
6
|
+
var HealthcarePersonnel = ({ size = 512, color, ...rest }) => {
|
|
7
7
|
return getIllustration({
|
|
8
8
|
size,
|
|
9
9
|
medium: /* @__PURE__ */ jsx(HealthcarePersonnelMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HealthcarePersonnel.js","names":["HealthcarePersonnel: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/HealthcarePersonnel.tsx"],"sourcesContent":["import React from 'react';\n\nimport HealthcarePersonnelMedium from './HealthcarePersonnelMedium';\nimport HealthcarePersonnelSmall from './HealthcarePersonnelSmall';\nimport { SvgIllustrationProps } from '../Illustration';\nimport { getIllustration } from '../Illustration/utils';\n\nconst HealthcarePersonnel: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <HealthcarePersonnelMedium color={color} {...rest} />;\n const small = <HealthcarePersonnelSmall color={color} {...rest} />;\n\n return getIllustration({ size, medium, small });\n};\n\nexport default HealthcarePersonnel;\n"],"mappings":";;;;;AAOA,IAAMA,uBAAuD,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"HealthcarePersonnel.js","names":["HealthcarePersonnel: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/HealthcarePersonnel.tsx"],"sourcesContent":["import React from 'react';\n\nimport HealthcarePersonnelMedium from './HealthcarePersonnelMedium';\nimport HealthcarePersonnelSmall from './HealthcarePersonnelSmall';\nimport { SvgIllustrationProps } from '../Illustration';\nimport { getIllustration } from '../Illustration/utils';\n\nconst HealthcarePersonnel: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <HealthcarePersonnelMedium color={color} {...rest} />;\n const small = <HealthcarePersonnelSmall color={color} {...rest} />;\n\n return getIllustration({ size, medium, small });\n};\n\nexport default HealthcarePersonnel;\n"],"mappings":";;;;;AAOA,IAAMA,uBAAuD,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAI9F,QAAO,gBAAgB;EAAE;EAAM,QAHhB,oBAAC,mCAAA;GAAiC;GAAO,GAAI;IAAQ;EAG7B,OAFzB,oBAAC,kCAAA;GAAgC;GAAO,GAAI;IAAQ;EAEpB,CAAC;;AAGjD,IAAA,8BAAe"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as ReadLettersMedium_default } from "../../ReadLettersMedium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var ReadLetters = ({ size = 512, color
|
|
7
|
+
var ReadLetters = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(ReadLettersMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadLetters.js","names":["ReadLetters: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/ReadLetters.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport ReadLettersMedium from './ReadLettersMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n letter: string;\n sweater: string;\n lines: string;\n}\n\nconst ReadLetters: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <ReadLettersMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default ReadLetters;\n"],"mappings":";;;;;;AAYA,IAAMA,eAA+C,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ReadLetters.js","names":["ReadLetters: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/ReadLetters.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport ReadLettersMedium from './ReadLettersMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n letter: string;\n sweater: string;\n lines: string;\n}\n\nconst ReadLetters: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <ReadLettersMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default ReadLetters;\n"],"mappings":";;;;;;AAYA,IAAMA,eAA+C,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGtF,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,2BAAA;GAAyB;GAAO,GAAI;IAAQ;EAErB,CAAC;;AAG1C,IAAA,sBAAe"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as StrollerMedium_default } from "../../StrollerMedium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var Stroller = ({ size = 512, color
|
|
7
|
+
var Stroller = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(StrollerMedium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stroller.js","names":["Stroller: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Stroller.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport StrollerMedium from './StrollerMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n feet: string;\n handle: string;\n stroller1: string;\n stroller2: string;\n stroller3: string;\n wheels: string;\n}\n\nconst Stroller: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <StrollerMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default Stroller;\n"],"mappings":";;;;;;AAeA,IAAMA,YAA4C,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Stroller.js","names":["Stroller: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Stroller.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport StrollerMedium from './StrollerMedium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n feet: string;\n handle: string;\n stroller1: string;\n stroller2: string;\n stroller3: string;\n wheels: string;\n}\n\nconst Stroller: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <StrollerMedium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default Stroller;\n"],"mappings":";;;;;;AAeA,IAAMA,YAA4C,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGnF,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,wBAAA;GAAsB;GAAO,GAAI;IAAQ;EAElB,CAAC;;AAG1C,IAAA,mBAAe"}
|
|
@@ -4,7 +4,7 @@ import "../../Illustration.js";
|
|
|
4
4
|
import { t as Support2Medium_default } from "../../Support2Medium.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
var Support2 = ({ size = 512, color
|
|
7
|
+
var Support2 = ({ size = 512, color, ...rest }) => {
|
|
8
8
|
return getIllustration({
|
|
9
9
|
size,
|
|
10
10
|
medium: /* @__PURE__ */ jsx(Support2Medium_default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Support2.js","names":["Support2: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Support2.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport Support2Medium from './Support2Medium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n details1: string;\n details2: string;\n lines: string;\n}\n\nconst Support2: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <Support2Medium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default Support2;\n"],"mappings":";;;;;;AAYA,IAAMA,YAA4C,EAAE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Support2.js","names":["Support2: React.FC<SvgIllustrationProps>"],"sources":["../../../src/components/Illustrations/Support2.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SvgIllustrationProps } from '../Illustration';\nimport Support2Medium from './Support2Medium';\nimport { getIllustration } from '../Illustration/utils';\n\nexport interface Palette {\n details1: string;\n details2: string;\n lines: string;\n}\n\nconst Support2: React.FC<SvgIllustrationProps> = ({ size = 512, color, ...rest }) => {\n const medium = <Support2Medium color={color} {...rest} />;\n\n return getIllustration({ size, medium });\n};\n\nexport default Support2;\n"],"mappings":";;;;;;AAYA,IAAMA,YAA4C,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW;AAGnF,QAAO,gBAAgB;EAAE;EAAM,QAFhB,oBAAC,wBAAA;GAAsB;GAAO,GAAI;IAAQ;EAElB,CAAC;;AAG1C,IAAA,mBAAe"}
|
|
@@ -111,7 +111,7 @@ var Triangle = ({ isHover, isFocus, isActive, isError }) => {
|
|
|
111
111
|
};
|
|
112
112
|
var Triangle_default = Triangle;
|
|
113
113
|
var StickyNote = (props) => {
|
|
114
|
-
const { wrapperClassName, timestamp, onXButtonClick, arialabelXButton, footerText, error, errorText, errorTextId: errorTextIdProp, onClickWhileDisabled, testId
|
|
114
|
+
const { wrapperClassName, timestamp, onXButtonClick, arialabelXButton, footerText, error, errorText, errorTextId: errorTextIdProp, onClickWhileDisabled, testId, ...textareaProps } = props;
|
|
115
115
|
const errorTextId = useIdWithFallback(errorTextIdProp);
|
|
116
116
|
const stickynoteRef = useRef(null);
|
|
117
117
|
const textareaRef = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Triangle: React.FC<TriangleProps>","colors: Palette","svg: React.ReactNode","StickyNote: React.FC<StickyNoteProps>"],"sources":["../../../src/components/StickyNote/Close.tsx","../../../src/components/StickyNote/Triangle.tsx","../../../src/components/StickyNote/StickyNote.tsx","../../../src/components/StickyNote/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\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 /** 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}\n\n/*\n Denne er kopiert fra Close-komponent. \n Det er for å kunne ha en egen lokal variant for StickyNote. \n Likt som i Figma.\n */\n\nconst Close = React.forwardRef(function ButtonForwardedRef(props: CloseProps, ref: React.ForwardedRef<HTMLButtonElement>) {\n const { testId, ariaLabel = 'Lukk', onClick } = props;\n const { refObject, isHovered } = usePseudoClasses();\n\n const iconSize = useIsMobileBreakpoint() ? 38 : 48;\n\n const closeClasses = classNames(styles.close);\n\n return (\n <button\n ref={mergeRefs([ref, refObject])}\n data-testid={testId}\n className={closeClasses}\n aria-label={ariaLabel}\n onClick={onClick}\n type=\"button\"\n >\n <span className={classNames(styles['close__inner-container'])}>\n <Icon svgIcon={X} color=\"black\" size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n});\n\nexport default Close;\n","import React from 'react';\n\ninterface TriangleProps {\n isHover: boolean;\n isFocus: boolean;\n isActive: boolean;\n isError: boolean;\n}\n\nexport interface Palette {\n border: string;\n background: string;\n}\n\nconst Triangle: React.FC<TriangleProps> = ({ isHover, isFocus, isActive, isError }) => {\n const palette = ((): Palette => {\n const colors: Palette = {\n border: 'var(--component-stickynote-border-normal)',\n background: 'var(--component-stickynote-background-fold-normal-light)',\n };\n\n if (!isError) {\n if (isHover) {\n colors.background = 'var(--component-stickynote-background-fold-normal-medium)';\n }\n if (isFocus) {\n colors.border = 'var(--color-action-border-onlight-focus)';\n colors.background = 'var(--component-stickynote-background-fold-normal-medium)';\n }\n if (isActive) {\n colors.background = 'var(--component-stickynote-background-fold-normal-dark)';\n }\n } else {\n colors.border = 'var(--component-stickynote-border-error)';\n colors.background = 'var(--component-stickynote-background-fold-error-light)';\n if (isHover) {\n colors.background = 'var(--component-stickynote-background-fold-error-medium)';\n }\n if (isFocus) {\n colors.border = 'var(--color-action-border-onlight-focus)';\n colors.background = 'var(--component-stickynote-background-fold-error-medium)';\n }\n if (isActive) {\n colors.background = 'var(--component-stickynote-background-fold-error-dark)';\n }\n }\n return colors;\n })();\n\n let svg: React.ReactNode;\n\n if (isFocus) {\n svg = (\n <svg width=\"21\" height=\"21\" viewBox=\"0 0 21 21\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <mask id=\"path-1-inside-1_7753_1401\" fill=\"white\">\n <path d=\"M0.493163 20.9211L0.276366 20.9211L0.276367 0.921142L20.2764 0.921143L20.2764 1.13794L0.493163 20.9211Z\" />\n </mask>\n <path\n d=\"M0.493163 20.9211L0.276366 20.9211L0.276367 0.921142L20.2764 0.921143L20.2764 1.13794L0.493163 20.9211Z\"\n fill={palette.background}\n />\n <path\n d=\"M0.493163 20.9211L0.493163 22.9211L1.32159 22.9211L1.90738 22.3354L0.493163 20.9211ZM0.276366 20.9211L-1.72363 20.9211L-1.72363 22.9211L0.276366 22.9211L0.276366 20.9211ZM0.276367 0.921142L0.276367 -1.07886L-1.72363 -1.07886L-1.72363 0.921142L0.276367 0.921142ZM20.2764 0.921143L22.2764 0.921143L22.2764 -1.07886L20.2764 -1.07886L20.2764 0.921143ZM20.2764 1.13794L21.6906 2.55215L22.2764 1.96637L22.2764 1.13794L20.2764 1.13794ZM0.493163 20.9211L0.493163 18.9211L0.276366 18.9211L0.276366 20.9211L0.276366 22.9211L0.493163 22.9211L0.493163 20.9211ZM0.276366 20.9211L2.27637 20.9211L2.27637 0.921142L0.276367 0.921142L-1.72363 0.921142L-1.72363 20.9211L0.276366 20.9211ZM0.276367 0.921142L0.276367 2.92114L20.2764 2.92114L20.2764 0.921143L20.2764 -1.07886L0.276367 -1.07886L0.276367 0.921142ZM20.2764 0.921143L18.2764 0.921142L18.2764 1.13794L20.2764 1.13794L22.2764 1.13794L22.2764 0.921143L20.2764 0.921143ZM20.2764 1.13794L18.8622 -0.276274L-0.92105 19.5069L0.493163 20.9211L1.90738 22.3354L21.6906 2.55215L20.2764 1.13794Z\"\n fill={palette.border}\n mask=\"url(#path-1-inside-1_7753_1401)\"\n />\n </svg>\n );\n } else {\n svg = (\n <svg width=\"21\" height=\"21\" viewBox=\"0 0 21 21\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <mask id=\"path-1-inside-1_7717_293537\" fill=\"white\">\n <path d=\"M0.923827 20.9211L0.70703 20.9211L0.707031 0.921142L20.707 0.921143L20.707 1.13794L0.923827 20.9211Z\" />\n </mask>\n <path\n d=\"M0.923827 20.9211L0.70703 20.9211L0.707031 0.921142L20.707 0.921143L20.707 1.13794L0.923827 20.9211Z\"\n fill={palette.background}\n />\n <path\n d=\"M0.923827 20.9211L0.923827 21.9211L1.33804 21.9211L1.63093 21.6282L0.923827 20.9211ZM0.70703 20.9211L-0.29297 20.9211L-0.29297 21.9211L0.70703 21.9211L0.70703 20.9211ZM0.707031 0.921142L0.707031 -0.0788582L-0.292969 -0.0788583L-0.292969 0.921142L0.707031 0.921142ZM20.707 0.921143L21.707 0.921143L21.707 -0.0788574L20.707 -0.0788574L20.707 0.921143ZM20.707 1.13794L21.4141 1.84505L21.707 1.55215L21.707 1.13794L20.707 1.13794ZM0.923827 20.9211L0.923827 19.9211L0.70703 19.9211L0.70703 20.9211L0.70703 21.9211L0.923827 21.9211L0.923827 20.9211ZM0.70703 20.9211L1.70703 20.9211L1.70703 0.921142L0.707031 0.921142L-0.292969 0.921142L-0.29297 20.9211L0.70703 20.9211ZM0.707031 0.921142L0.707031 1.92114L20.707 1.92114L20.707 0.921143L20.707 -0.0788574L0.707031 -0.0788582L0.707031 0.921142ZM20.707 0.921143L19.707 0.921143L19.707 1.13794L20.707 1.13794L21.707 1.13794L21.707 0.921143L20.707 0.921143ZM20.707 1.13794L19.9999 0.430833L0.21672 20.214L0.923827 20.9211L1.63093 21.6282L21.4141 1.84505L20.707 1.13794Z\"\n fill={palette.border}\n mask=\"url(#path-1-inside-1_7717_293537)\"\n />\n </svg>\n );\n }\n\n return <>{svg}</>;\n};\n\nexport default Triangle;\n","import React, { useLayoutEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Close from './Close';\nimport Triangle from './Triangle';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\n\nimport styles from './styles.module.scss';\n\nexport interface StickyNoteProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Aria label for the delete/close button */\n arialabelXButton: string;\n /** Activates the error styling */\n error?: boolean;\n /** Error text to show below the note */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Text shown under the textarea */\n footerText?: string;\n /** Function run when clicking the delete/close button */\n onXButtonClick?: () => void;\n /** Function run if user clicks the component while it is disabled */\n onClickWhileDisabled?: () => void;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Timestamp shown over the textarea */\n timestamp: string;\n /** Classname for the outer wrapper */\n wrapperClassName?: string;\n}\n\nconst StickyNote: React.FC<StickyNoteProps> = (props: StickyNoteProps) => {\n const {\n wrapperClassName,\n timestamp,\n onXButtonClick,\n arialabelXButton,\n footerText,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n onClickWhileDisabled,\n testId,\n ...textareaProps\n } = props;\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const stickynoteRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const { isFocused: isTextareaFocused } = usePseudoClasses<HTMLTextAreaElement>(textareaRef);\n const { isHovered, isActive } = usePseudoClasses<HTMLDivElement>(stickynoteRef);\n\n const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>): void => {\n if ((event.target as HTMLElement).closest('button')) {\n return;\n }\n if (textareaProps.disabled) {\n if (onClickWhileDisabled) onClickWhileDisabled();\n return;\n }\n textareaRef.current?.focus();\n };\n\n const resizeTextarea = (): void => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n resizeTarget(textarea);\n };\n\n const resizeTarget = (target: HTMLTextAreaElement): void => {\n // Reset field height\n target.style.height = 'inherit';\n // Set new height\n target.style.height = `${target.scrollHeight}px`;\n };\n\n useLayoutEffect(() => {\n resizeTextarea();\n // Must run after the shadow DOM has been set up to work on microweb\n setTimeout(() => resizeTextarea(), 1000);\n }, []);\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n const textarea = e.target as HTMLTextAreaElement;\n resizeTarget(textarea);\n if (textareaProps.onChange) textareaProps.onChange(e);\n };\n\n return (\n <div>\n <div\n data-testid={testId}\n ref={stickynoteRef}\n className={classNames(styles['sticky-note'], wrapperClassName, {\n [styles['sticky-note--focused']]: isTextareaFocused,\n [styles['sticky-note--active']]: isActive,\n [styles['sticky-note--hovered']]: isHovered && !isTextareaFocused && !textareaProps.disabled,\n [styles['sticky-note--error']]: error,\n })}\n onClick={handleWrapperClick}\n role=\"textbox\"\n tabIndex={-1}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n handleWrapperClick(e as React.KeyboardEvent<HTMLDivElement>);\n }\n }}\n >\n <div className={classNames(styles['sticky-note__header'])}>\n {timestamp && <span className={styles['sticky-note__header__timestamp']}>{timestamp}</span>}\n </div>\n <textarea\n ref={textareaRef}\n data-testid={`${testId}-textarea`}\n className={classNames(styles['sticky-note__textarea'], textareaProps.className)}\n {...textareaProps}\n onChange={handleChange}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n />\n <Close onClick={onXButtonClick} ariaLabel={arialabelXButton} testId=\"closeButton\" />\n <div className={classNames(styles['sticky-note__footer'])}>{footerText && <span>{footerText}</span>}</div>\n <div className={classNames(styles['sticky-note__triangle'])}>\n <Triangle isHover={isHovered} isActive={isActive} isFocus={isTextareaFocused} isError={!!error} />\n </div>\n </div>\n {error && (\n <p className={styles['sticky-note__error-text']} id={errorTextId}>\n {errorText}\n </p>\n )}\n </div>\n );\n};\n\nexport default StickyNote;\n","import StickyNote from './StickyNote';\nexport * from './StickyNote';\nexport default StickyNote;\n"],"mappings":";;;;;;;;;;;;;;AAmDA,IAAA,gBAxBc,MAAM,WAAW,SAAS,mBAAmB,OAAmB,KAA4C;CACxH,MAAM,EAAE,QAAQ,YAAY,QAAQ,YAAY;CAChD,MAAM,EAAE,WAAW,cAAc,kBAAkB;CAEnD,MAAM,WAAW,uBAAuB,GAAG,KAAK;CAEhD,MAAM,eAAe,WAAW,OAAO,MAAM;AAE7C,QACE,oBAAC,UAAA;EACC,KAAK,UAAU,CAAC,KAAK,UAAU,CAAC;EAChC,eAAa;EACb,WAAW;EACX,cAAY;EACH;EACT,MAAK;YAEL,oBAAC,QAAA;GAAK,WAAW,WAAW,OAAO,0BAA0B;aAC3D,oBAAC,cAAA;IAAK,SAAS;IAAG,OAAM;IAAQ,MAAM;IAAqB;KAAa;IACnE;GACA;EAEX;ACnCF,IAAMA,YAAqC,EAAE,SAAS,SAAS,UAAU,cAAc;CACrF,MAAM,iBAA0B;EAC9B,MAAMC,SAAkB;GACtB,QAAQ;GACR,YAAY;GACb;AAED,MAAI,CAAC,SAAS;AACZ,OAAI,QACF,QAAO,aAAa;AAEtB,OAAI,SAAS;AACX,WAAO,SAAS;AAChB,WAAO,aAAa;;AAEtB,OAAI,SACF,QAAO,aAAa;SAEjB;AACL,UAAO,SAAS;AAChB,UAAO,aAAa;AACpB,O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QAAA,EAAA,UAAM,YAAA,CAAkB;KAAO;GAC1G,oBAAC,OAAA;IAAI,WAAW,WAAW,OAAO,yBAAyB;cACzD,oBAAC,kBAAA;KAAS,SAAS;KAAqB;KAAU,SAAS;KAAmB,SAAS,CAAC,CAAC;MAAS;KAC9F;;GACF,EACL,SACC,oBAAC,KAAA;EAAE,WAAW,OAAO;EAA4B,IAAI;YAClD;GACC,CAAA,EAAA,CAEF;;ACnIV,IAAA,qBDuIe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Triangle: React.FC<TriangleProps>","colors: Palette","svg: React.ReactNode","StickyNote: React.FC<StickyNoteProps>"],"sources":["../../../src/components/StickyNote/Close.tsx","../../../src/components/StickyNote/Triangle.tsx","../../../src/components/StickyNote/StickyNote.tsx","../../../src/components/StickyNote/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\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 /** 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}\n\n/*\n Denne er kopiert fra Close-komponent. \n Det er for å kunne ha en egen lokal variant for StickyNote. \n Likt som i Figma.\n */\n\nconst Close = React.forwardRef(function ButtonForwardedRef(props: CloseProps, ref: React.ForwardedRef<HTMLButtonElement>) {\n const { testId, ariaLabel = 'Lukk', onClick } = props;\n const { refObject, isHovered } = usePseudoClasses();\n\n const iconSize = useIsMobileBreakpoint() ? 38 : 48;\n\n const closeClasses = classNames(styles.close);\n\n return (\n <button\n ref={mergeRefs([ref, refObject])}\n data-testid={testId}\n className={closeClasses}\n aria-label={ariaLabel}\n onClick={onClick}\n type=\"button\"\n >\n <span className={classNames(styles['close__inner-container'])}>\n <Icon svgIcon={X} color=\"black\" size={iconSize} isHovered={isHovered} />\n </span>\n </button>\n );\n});\n\nexport default Close;\n","import React from 'react';\n\ninterface TriangleProps {\n isHover: boolean;\n isFocus: boolean;\n isActive: boolean;\n isError: boolean;\n}\n\nexport interface Palette {\n border: string;\n background: string;\n}\n\nconst Triangle: React.FC<TriangleProps> = ({ isHover, isFocus, isActive, isError }) => {\n const palette = ((): Palette => {\n const colors: Palette = {\n border: 'var(--component-stickynote-border-normal)',\n background: 'var(--component-stickynote-background-fold-normal-light)',\n };\n\n if (!isError) {\n if (isHover) {\n colors.background = 'var(--component-stickynote-background-fold-normal-medium)';\n }\n if (isFocus) {\n colors.border = 'var(--color-action-border-onlight-focus)';\n colors.background = 'var(--component-stickynote-background-fold-normal-medium)';\n }\n if (isActive) {\n colors.background = 'var(--component-stickynote-background-fold-normal-dark)';\n }\n } else {\n colors.border = 'var(--component-stickynote-border-error)';\n colors.background = 'var(--component-stickynote-background-fold-error-light)';\n if (isHover) {\n colors.background = 'var(--component-stickynote-background-fold-error-medium)';\n }\n if (isFocus) {\n colors.border = 'var(--color-action-border-onlight-focus)';\n colors.background = 'var(--component-stickynote-background-fold-error-medium)';\n }\n if (isActive) {\n colors.background = 'var(--component-stickynote-background-fold-error-dark)';\n }\n }\n return colors;\n })();\n\n let svg: React.ReactNode;\n\n if (isFocus) {\n svg = (\n <svg width=\"21\" height=\"21\" viewBox=\"0 0 21 21\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <mask id=\"path-1-inside-1_7753_1401\" fill=\"white\">\n <path d=\"M0.493163 20.9211L0.276366 20.9211L0.276367 0.921142L20.2764 0.921143L20.2764 1.13794L0.493163 20.9211Z\" />\n </mask>\n <path\n d=\"M0.493163 20.9211L0.276366 20.9211L0.276367 0.921142L20.2764 0.921143L20.2764 1.13794L0.493163 20.9211Z\"\n fill={palette.background}\n />\n <path\n d=\"M0.493163 20.9211L0.493163 22.9211L1.32159 22.9211L1.90738 22.3354L0.493163 20.9211ZM0.276366 20.9211L-1.72363 20.9211L-1.72363 22.9211L0.276366 22.9211L0.276366 20.9211ZM0.276367 0.921142L0.276367 -1.07886L-1.72363 -1.07886L-1.72363 0.921142L0.276367 0.921142ZM20.2764 0.921143L22.2764 0.921143L22.2764 -1.07886L20.2764 -1.07886L20.2764 0.921143ZM20.2764 1.13794L21.6906 2.55215L22.2764 1.96637L22.2764 1.13794L20.2764 1.13794ZM0.493163 20.9211L0.493163 18.9211L0.276366 18.9211L0.276366 20.9211L0.276366 22.9211L0.493163 22.9211L0.493163 20.9211ZM0.276366 20.9211L2.27637 20.9211L2.27637 0.921142L0.276367 0.921142L-1.72363 0.921142L-1.72363 20.9211L0.276366 20.9211ZM0.276367 0.921142L0.276367 2.92114L20.2764 2.92114L20.2764 0.921143L20.2764 -1.07886L0.276367 -1.07886L0.276367 0.921142ZM20.2764 0.921143L18.2764 0.921142L18.2764 1.13794L20.2764 1.13794L22.2764 1.13794L22.2764 0.921143L20.2764 0.921143ZM20.2764 1.13794L18.8622 -0.276274L-0.92105 19.5069L0.493163 20.9211L1.90738 22.3354L21.6906 2.55215L20.2764 1.13794Z\"\n fill={palette.border}\n mask=\"url(#path-1-inside-1_7753_1401)\"\n />\n </svg>\n );\n } else {\n svg = (\n <svg width=\"21\" height=\"21\" viewBox=\"0 0 21 21\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <mask id=\"path-1-inside-1_7717_293537\" fill=\"white\">\n <path d=\"M0.923827 20.9211L0.70703 20.9211L0.707031 0.921142L20.707 0.921143L20.707 1.13794L0.923827 20.9211Z\" />\n </mask>\n <path\n d=\"M0.923827 20.9211L0.70703 20.9211L0.707031 0.921142L20.707 0.921143L20.707 1.13794L0.923827 20.9211Z\"\n fill={palette.background}\n />\n <path\n d=\"M0.923827 20.9211L0.923827 21.9211L1.33804 21.9211L1.63093 21.6282L0.923827 20.9211ZM0.70703 20.9211L-0.29297 20.9211L-0.29297 21.9211L0.70703 21.9211L0.70703 20.9211ZM0.707031 0.921142L0.707031 -0.0788582L-0.292969 -0.0788583L-0.292969 0.921142L0.707031 0.921142ZM20.707 0.921143L21.707 0.921143L21.707 -0.0788574L20.707 -0.0788574L20.707 0.921143ZM20.707 1.13794L21.4141 1.84505L21.707 1.55215L21.707 1.13794L20.707 1.13794ZM0.923827 20.9211L0.923827 19.9211L0.70703 19.9211L0.70703 20.9211L0.70703 21.9211L0.923827 21.9211L0.923827 20.9211ZM0.70703 20.9211L1.70703 20.9211L1.70703 0.921142L0.707031 0.921142L-0.292969 0.921142L-0.29297 20.9211L0.70703 20.9211ZM0.707031 0.921142L0.707031 1.92114L20.707 1.92114L20.707 0.921143L20.707 -0.0788574L0.707031 -0.0788582L0.707031 0.921142ZM20.707 0.921143L19.707 0.921143L19.707 1.13794L20.707 1.13794L21.707 1.13794L21.707 0.921143L20.707 0.921143ZM20.707 1.13794L19.9999 0.430833L0.21672 20.214L0.923827 20.9211L1.63093 21.6282L21.4141 1.84505L20.707 1.13794Z\"\n fill={palette.border}\n mask=\"url(#path-1-inside-1_7717_293537)\"\n />\n </svg>\n );\n }\n\n return <>{svg}</>;\n};\n\nexport default Triangle;\n","import React, { useLayoutEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Close from './Close';\nimport Triangle from './Triangle';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { getAriaDescribedBy } from '../../utils/accessibility';\n\nimport styles from './styles.module.scss';\n\nexport interface StickyNoteProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Aria label for the delete/close button */\n arialabelXButton: string;\n /** Activates the error styling */\n error?: boolean;\n /** Error text to show below the note */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Text shown under the textarea */\n footerText?: string;\n /** Function run when clicking the delete/close button */\n onXButtonClick?: () => void;\n /** Function run if user clicks the component while it is disabled */\n onClickWhileDisabled?: () => void;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Timestamp shown over the textarea */\n timestamp: string;\n /** Classname for the outer wrapper */\n wrapperClassName?: string;\n}\n\nconst StickyNote: React.FC<StickyNoteProps> = (props: StickyNoteProps) => {\n const {\n wrapperClassName,\n timestamp,\n onXButtonClick,\n arialabelXButton,\n footerText,\n error,\n errorText,\n errorTextId: errorTextIdProp,\n onClickWhileDisabled,\n testId,\n ...textareaProps\n } = props;\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const stickynoteRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const { isFocused: isTextareaFocused } = usePseudoClasses<HTMLTextAreaElement>(textareaRef);\n const { isHovered, isActive } = usePseudoClasses<HTMLDivElement>(stickynoteRef);\n\n const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>): void => {\n if ((event.target as HTMLElement).closest('button')) {\n return;\n }\n if (textareaProps.disabled) {\n if (onClickWhileDisabled) onClickWhileDisabled();\n return;\n }\n textareaRef.current?.focus();\n };\n\n const resizeTextarea = (): void => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n resizeTarget(textarea);\n };\n\n const resizeTarget = (target: HTMLTextAreaElement): void => {\n // Reset field height\n target.style.height = 'inherit';\n // Set new height\n target.style.height = `${target.scrollHeight}px`;\n };\n\n useLayoutEffect(() => {\n resizeTextarea();\n // Must run after the shadow DOM has been set up to work on microweb\n setTimeout(() => resizeTextarea(), 1000);\n }, []);\n\n const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {\n const textarea = e.target as HTMLTextAreaElement;\n resizeTarget(textarea);\n if (textareaProps.onChange) textareaProps.onChange(e);\n };\n\n return (\n <div>\n <div\n data-testid={testId}\n ref={stickynoteRef}\n className={classNames(styles['sticky-note'], wrapperClassName, {\n [styles['sticky-note--focused']]: isTextareaFocused,\n [styles['sticky-note--active']]: isActive,\n [styles['sticky-note--hovered']]: isHovered && !isTextareaFocused && !textareaProps.disabled,\n [styles['sticky-note--error']]: error,\n })}\n onClick={handleWrapperClick}\n role=\"textbox\"\n tabIndex={-1}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n handleWrapperClick(e as React.KeyboardEvent<HTMLDivElement>);\n }\n }}\n >\n <div className={classNames(styles['sticky-note__header'])}>\n {timestamp && <span className={styles['sticky-note__header__timestamp']}>{timestamp}</span>}\n </div>\n <textarea\n ref={textareaRef}\n data-testid={`${testId}-textarea`}\n className={classNames(styles['sticky-note__textarea'], textareaProps.className)}\n {...textareaProps}\n onChange={handleChange}\n aria-describedby={getAriaDescribedBy(props, errorTextId)}\n />\n <Close onClick={onXButtonClick} ariaLabel={arialabelXButton} testId=\"closeButton\" />\n <div className={classNames(styles['sticky-note__footer'])}>{footerText && <span>{footerText}</span>}</div>\n <div className={classNames(styles['sticky-note__triangle'])}>\n <Triangle isHover={isHovered} isActive={isActive} isFocus={isTextareaFocused} isError={!!error} />\n </div>\n </div>\n {error && (\n <p className={styles['sticky-note__error-text']} id={errorTextId}>\n {errorText}\n </p>\n )}\n </div>\n );\n};\n\nexport default StickyNote;\n","import StickyNote from './StickyNote';\nexport * from './StickyNote';\nexport default StickyNote;\n"],"mappings":";;;;;;;;;;;;;;AAmDA,IAAA,gBAxBc,MAAM,WAAW,SAAS,mBAAmB,OAAmB,KAA4C;CACxH,MAAM,EAAE,QAAQ,YAAY,QAAQ,YAAY;CAChD,MAAM,EAAE,WAAW,cAAc,kBAAkB;CAEnD,MAAM,WAAW,uBAAuB,GAAG,KAAK;CAEhD,MAAM,eAAe,WAAW,OAAO,MAAM;AAE7C,QACE,oBAAC,UAAA;EACC,KAAK,UAAU,CAAC,KAAK,UAAU,CAAC;EAChC,eAAa;EACb,WAAW;EACX,cAAY;EACH;EACT,MAAK;YAEL,oBAAC,QAAA;GAAK,WAAW,WAAW,OAAO,0BAA0B;aAC3D,oBAAC,cAAA;IAAK,SAAS;IAAG,O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tD,aAAa,oBAAC,QAAA;KAAK,WAAW,OAAO;eAAoC;MAAiB;KACvF;GACN,oBAAC,YAAA;IACC,KAAK;IACL,eAAa,GAAG,OAAO;IACvB,WAAW,WAAW,OAAO,0BAA0B,cAAc,UAAU;IAC/E,GAAI;IACJ,UAAU;IACV,oBAAkB,mBAAmB,OAAO,YAAY;KACxD;GACF,oBAAC,eAAA;IAAM,SAAS;IAAgB,WAAW;IAAkB,QAAO;KAAgB;GACpF,oBAAC,OAAA;IAAI,WAAW,WAAW,OAAO,uBAAuB;cAAG,cAAc,oBAAC,QAAA,EAAA,UAAM,YAAA,CAAkB;KAAO;GAC1G,oBAAC,OAAA;IAAI,WAAW,WAAW,OAAO,yBAAyB;cACzD,oBAAC,kBAAA;KAAS,SAAS;KAAqB;KAAU,SAAS;KAAmB,SAAS,CAAC,CAAC;MAAS;KAC9F;;GACF,EACL,SACC,oBAAC,KAAA;EAAE,WAAW,OAAO;EAA4B,IAAI;YAClD;GACC,CAAA,EAAA,CAEF;;ACnIV,IAAA,qBDuIe"}
|
package/lib/floating-ui.react.js
CHANGED
|
@@ -898,7 +898,7 @@ var flip$2 = function(options) {
|
|
|
898
898
|
async fn(state) {
|
|
899
899
|
var _middlewareData$arrow, _middlewareData$flip;
|
|
900
900
|
const { placement, middlewareData, rects, initialPlacement, platform: platform$1, elements } = state;
|
|
901
|
-
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true
|
|
901
|
+
const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
|
|
902
902
|
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
|
|
903
903
|
const side = getSide(placement);
|
|
904
904
|
const initialSideAxis = getSideAxis(initialPlacement);
|
|
@@ -975,7 +975,7 @@ var hide$2 = function(options) {
|
|
|
975
975
|
options,
|
|
976
976
|
async fn(state) {
|
|
977
977
|
const { rects } = state;
|
|
978
|
-
const { strategy = "referenceHidden"
|
|
978
|
+
const { strategy = "referenceHidden", ...detectOverflowOptions } = evaluate(options, state);
|
|
979
979
|
switch (strategy) {
|
|
980
980
|
case "referenceHidden": {
|
|
981
981
|
const offsets = getSideOffsets(await detectOverflow$1(state, {
|
|
@@ -1064,7 +1064,7 @@ var shift$2 = function(options) {
|
|
|
1064
1064
|
x: x$1,
|
|
1065
1065
|
y: y$1
|
|
1066
1066
|
};
|
|
1067
|
-
} }
|
|
1067
|
+
} }, ...detectOverflowOptions } = evaluate(options, state);
|
|
1068
1068
|
const coords = {
|
|
1069
1069
|
x,
|
|
1070
1070
|
y
|
|
@@ -1115,7 +1115,7 @@ var size$2 = function(options) {
|
|
|
1115
1115
|
async fn(state) {
|
|
1116
1116
|
var _state$middlewareData, _state$middlewareData2;
|
|
1117
1117
|
const { placement, rects, platform: platform$1, elements } = state;
|
|
1118
|
-
const { apply = () => {}
|
|
1118
|
+
const { apply = () => {}, ...detectOverflowOptions } = evaluate(options, state);
|
|
1119
1119
|
const overflow = await detectOverflow$1(state, detectOverflowOptions);
|
|
1120
1120
|
const side = getSide(placement);
|
|
1121
1121
|
const alignment = getAlignment(placement);
|
|
@@ -1947,7 +1947,7 @@ function error() {
|
|
|
1947
1947
|
}
|
|
1948
1948
|
}
|
|
1949
1949
|
var FloatingArrow = /* @__PURE__ */ React$1.forwardRef(function FloatingArrow$1(props, ref) {
|
|
1950
|
-
const { context: { placement, elements: { floating }, middlewareData: { arrow: arrow$3, shift: shift$3 } }, width = 14, height = 7, tipRadius = 0, strokeWidth = 0, staticOffset, stroke, d, style: { transform
|
|
1950
|
+
const { context: { placement, elements: { floating }, middlewareData: { arrow: arrow$3, shift: shift$3 } }, width = 14, height = 7, tipRadius = 0, strokeWidth = 0, staticOffset, stroke, d, style: { transform, ...restStyle } = {}, ...rest } = props;
|
|
1951
1951
|
if (process.env.NODE_ENV !== "production") {
|
|
1952
1952
|
if (!ref) warn("The `ref` prop is required for `FloatingArrow`.");
|
|
1953
1953
|
}
|
|
@@ -3492,7 +3492,7 @@ function mergeProps(userProps, propsList, elementKey) {
|
|
|
3492
3492
|
const isItem = elementKey === "item";
|
|
3493
3493
|
let domUserProps = userProps;
|
|
3494
3494
|
if (isItem && userProps) {
|
|
3495
|
-
const { [ACTIVE_KEY]: _, [SELECTED_KEY]: __
|
|
3495
|
+
const { [ACTIVE_KEY]: _, [SELECTED_KEY]: __, ...validProps } = userProps;
|
|
3496
3496
|
domUserProps = validProps;
|
|
3497
3497
|
}
|
|
3498
3498
|
return {
|