@helsenorge/designsystem-react 10.0.2 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnchorLink.js +2 -2
- package/AnchorLink.js.map +1 -1
- package/Avatar.js +2 -2
- package/Avatar.js.map +1 -1
- package/Badge.js +3 -3
- package/Badge.js.map +1 -1
- package/Button.js +4 -4
- package/Button.js.map +1 -1
- package/CHANGELOG.md +38 -0
- package/Checkbox.js +2 -2
- package/Checkbox.js.map +1 -1
- package/Close.js +2 -2
- package/Close.js.map +1 -1
- package/ErrorBoundary.js +2 -2
- package/ErrorBoundary.js.map +1 -1
- package/Expander.js +2 -2
- package/Expander.js.map +1 -1
- package/FormGroup.js +12 -12
- package/FormGroup.js.map +1 -1
- package/FormLayout.js +3 -3
- package/FormLayout.js.map +1 -1
- package/HelpBubble.js +2 -2
- package/HelpBubble.js.map +1 -1
- package/HighlightPanel.js +2 -2
- package/HighlightPanel.js.map +1 -1
- package/Icon.js +3 -3
- package/Icon.js.map +1 -1
- package/Illustration.js +3 -3
- package/Illustration.js.map +1 -1
- package/Input.js +2 -2
- package/Input.js.map +1 -1
- package/Label.js +8 -8
- package/Label.js.map +1 -1
- package/LazyIcon.js +1 -1
- package/LazyIllustration.js +3 -3
- package/LazyIllustration.js.map +1 -1
- package/LinkList.js +6 -6
- package/LinkList.js.map +1 -1
- package/ListHeader.js +7 -7
- package/ListHeader.js.map +1 -1
- package/Panel.js +2 -2
- package/Panel.js.map +1 -1
- package/PopOver.js +2 -2
- package/PopOver.js.map +1 -1
- package/RadioButton.js +2 -2
- package/RadioButton.js.map +1 -1
- package/Select.js +2 -2
- package/Select.js.map +1 -1
- package/Slider.js +3 -3
- package/Slider.js.map +1 -1
- package/Spacer.js +2 -2
- package/Spacer.js.map +1 -1
- package/StatusDot.js +1 -1
- package/StepButtons.js +4 -4
- package/StepButtons.js.map +1 -1
- package/TabList.js +4 -4
- package/TabList.js.map +1 -1
- package/Table.js +2 -2
- package/Table.js.map +1 -1
- package/TableBody.js +2 -2
- package/TableBody.js.map +1 -1
- package/TableExpandedRow.js +2 -2
- package/TableExpandedRow.js.map +1 -1
- package/TableHead.js +2 -2
- package/TableHead.js.map +1 -1
- package/TableRow.js +2 -2
- package/TableRow.js.map +1 -1
- package/Textarea.js +2 -2
- package/Textarea.js.map +1 -1
- package/Title.js +2 -2
- package/Title.js.map +1 -1
- package/TooltipWord.js +2 -2
- package/TooltipWord.js.map +1 -1
- package/Trigger.js +3 -3
- package/Trigger.js.map +1 -1
- package/components/Button/styles.module.scss +5 -0
- package/components/DictionaryTrigger/index.js +2 -2
- package/components/DictionaryTrigger/index.js.map +1 -1
- package/components/Drawer/Drawer.d.ts +41 -0
- package/components/Drawer/Drawer.test.d.ts +1 -0
- package/components/Drawer/index.d.ts +3 -0
- package/components/Drawer/index.js +350 -0
- package/components/Drawer/index.js.map +1 -0
- package/components/Drawer/styles.module.scss +127 -0
- package/components/Drawer/styles.module.scss.d.ts +16 -0
- package/components/Dropdown/index.js +3 -3
- package/components/Dropdown/index.js.map +1 -1
- package/components/Duolist/index.js +4 -4
- package/components/Duolist/index.js.map +1 -1
- package/components/ExpanderHierarchy/index.js +5 -5
- package/components/ExpanderHierarchy/index.js.map +1 -1
- package/components/ExpanderList/index.js +8 -8
- package/components/ExpanderList/index.js.map +1 -1
- package/components/HelpQuestion/index.js +2 -2
- package/components/HelpQuestion/index.js.map +1 -1
- package/components/HighlightPanel/styles.module.scss +4 -36
- package/components/HighlightPanel/styles.module.scss.d.ts +1 -2
- package/components/Icons/EuropeanHealthCard.js +1 -1
- package/components/Icons/GroupTwins.js +1 -1
- package/components/Icons/Inbox.js +1 -1
- package/components/Icons/LawBook.js +1 -1
- package/components/Icons/PersonCancel.js +1 -1
- package/components/Icons/PersonWithBrain.js +1 -1
- package/components/Icons/Puzzle.js +1 -1
- package/components/Icons/Snapchat.js +1 -1
- package/components/Illustrations/IllustrationNames.d.ts +1 -1
- package/components/Illustrations/IllustrationNames.js +4 -2
- package/components/Illustrations/IllustrationNames.js.map +1 -1
- package/components/Illustrations/ReadLetters.d.ts +9 -0
- package/components/Illustrations/ReadLetters.js +11 -0
- package/components/Illustrations/ReadLetters.js.map +1 -0
- package/components/Illustrations/ReadLettersMedium.d.ts +4 -0
- package/components/Illustrations/ReadLettersMedium.js +110 -0
- package/components/Illustrations/ReadLettersMedium.js.map +1 -0
- package/components/Illustrations/Support2.d.ts +9 -0
- package/components/Illustrations/Support2.js +11 -0
- package/components/Illustrations/Support2.js.map +1 -0
- package/components/Illustrations/Support2Medium.d.ts +4 -0
- package/components/Illustrations/Support2Medium.js +232 -0
- package/components/Illustrations/Support2Medium.js.map +1 -0
- package/components/Label/styles.module.scss +16 -12
- package/components/Label/styles.module.scss.d.ts +3 -1
- package/components/List/styles.module.scss +7 -7
- package/components/Modal/index.js +71 -82
- package/components/Modal/index.js.map +1 -1
- package/components/Modal/styles.module.scss +12 -6
- package/components/NotificationPanel/index.js +3 -3
- package/components/NotificationPanel/index.js.map +1 -1
- package/components/PanelList/index.js +5 -5
- package/components/PanelList/index.js.map +1 -1
- package/components/PopMenu/index.js +5 -5
- package/components/PopMenu/index.js.map +1 -1
- package/components/Portal/index.js +3 -3
- package/components/Portal/index.js.map +1 -1
- package/components/PromoPanel/index.js +2 -2
- package/components/PromoPanel/index.js.map +1 -1
- package/components/StickyNote/index.js +12 -6
- package/components/StickyNote/index.js.map +1 -1
- package/components/Tabs/Tabs.d.ts +2 -0
- package/components/Tabs/index.js +8 -4
- package/components/Tabs/index.js.map +1 -1
- package/components/TagList/index.js +2 -2
- package/components/TagList/index.js.map +1 -1
- package/components/Tile/index.js +6 -6
- package/components/Tile/index.js.map +1 -1
- package/components/Toggle/index.js +3 -3910
- package/components/Toggle/index.js.map +1 -1
- package/components/Tooltip/index.js +2 -2
- package/components/Tooltip/index.js.map +1 -1
- package/components/Validation/index.js +6 -6
- package/components/Validation/index.js.map +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +1 -0
- package/constants.js.map +1 -1
- package/hoc/withBreakpoint/withBreakpoint.js +2 -2
- package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
- package/hooks/useBreakpoint.d.ts +0 -4
- package/hooks/useBreakpoint.js +23 -18
- package/hooks/useBreakpoint.js.map +1 -1
- package/hooks/useEventListenerState.js +3 -3
- package/hooks/useEventListenerState.js.map +1 -1
- package/hooks/useOutsideEvent.d.ts +4 -4
- package/hooks/useOutsideEvent.js +5 -4
- package/hooks/useOutsideEvent.js.map +1 -1
- package/hooks/useReturnFocusOnUnmount.d.ts +5 -0
- package/hooks/useReturnFocusOnUnmount.js +20 -0
- package/hooks/useReturnFocusOnUnmount.js.map +1 -0
- package/package.json +1 -1
- package/scss/_breakpoints.scss +6 -0
- package/scss/_font-mixins.scss +55 -0
- package/scss/typography.module.scss +24 -0
- package/scss/typography.module.scss.d.ts +6 -0
- package/scss/typography.stories.tsx +24 -0
- package/theme/index.js +2 -2
- package/use-animate.js +3952 -0
- package/use-animate.js.map +1 -0
- package/utils/accessibility.d.ts +1 -0
- package/utils/accessibility.js +6 -1
- package/utils/accessibility.js.map +1 -1
- package/utils/component.js +4 -4
- package/utils/component.js.map +1 -1
package/utils/accessibility.d.ts
CHANGED
package/utils/accessibility.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const getAriaLabelAttributes = (config) => {
|
|
2
|
-
const { label, id, prefer = "id" } = config;
|
|
2
|
+
const { label, id, fallbackId, prefer = "id" } = config;
|
|
3
3
|
if (id && prefer === "id") {
|
|
4
4
|
return {
|
|
5
5
|
"aria-labelledby": id
|
|
@@ -15,6 +15,11 @@ const getAriaLabelAttributes = (config) => {
|
|
|
15
15
|
"aria-labelledby": id
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
if (fallbackId) {
|
|
19
|
+
return {
|
|
20
|
+
"aria-labelledby": fallbackId
|
|
21
|
+
};
|
|
22
|
+
}
|
|
18
23
|
};
|
|
19
24
|
const getAriaDescribedBy = (props, errorTextUuid) => {
|
|
20
25
|
const ariaDescribedBy = props["aria-describedby"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.js","sources":["../../src/utils/accessibility.ts"],"sourcesContent":["import { AriaAttributes } from 'react';\n\ninterface AriaLabelAttributesConfig {\n label?: string;\n id?: string;\n prefer?: 'id' | 'label';\n}\n\nexport type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;\n\nexport const getAriaLabelAttributes = (config: AriaLabelAttributesConfig): AriaLabelAttributes | undefined => {\n const { label, id, prefer = 'id' } = config;\n\n if (id && prefer === 'id') {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (label) {\n return {\n 'aria-label': label,\n };\n }\n\n if (id) {\n return {\n 'aria-labelledby': id,\n };\n }\n};\n\nexport interface ErrorAriaProps {\n error?: boolean;\n 'aria-describedby'?: string;\n errorText?: string;\n errorTextId?: string;\n}\n\n/**\n * Get IDs to be used with aria-describedby in form components like <Input />\n * @param props Props from form component\n * @param errorTextUuid Unique ID of the form component's error text\n * @returns Element IDs or undefined if there is no aria-description\n */\nexport const getAriaDescribedBy = (props: ErrorAriaProps, errorTextUuid: string): string | undefined => {\n const ariaDescribedBy: string | undefined = props['aria-describedby'];\n const hasErrorText: boolean = !!(props.errorText || (props.error && props.errorTextId));\n const errorTextId: string | undefined = hasErrorText ? errorTextUuid : undefined;\n\n if (ariaDescribedBy && !errorTextId) {\n return ariaDescribedBy;\n } else if (!ariaDescribedBy && errorTextId) {\n return errorTextId;\n } else if (ariaDescribedBy && errorTextId) {\n return ariaDescribedBy + ' ' + errorTextId;\n }\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accessibility.js","sources":["../../src/utils/accessibility.ts"],"sourcesContent":["import { AriaAttributes } from 'react';\n\ninterface AriaLabelAttributesConfig {\n label?: string;\n id?: string;\n fallbackId?: string;\n prefer?: 'id' | 'label';\n}\n\nexport type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;\n\nexport const getAriaLabelAttributes = (config: AriaLabelAttributesConfig): AriaLabelAttributes | undefined => {\n const { label, id, fallbackId, prefer = 'id' } = config;\n\n if (id && prefer === 'id') {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (label) {\n return {\n 'aria-label': label,\n };\n }\n\n if (id) {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (fallbackId) {\n return {\n 'aria-labelledby': fallbackId,\n };\n }\n};\n\nexport interface ErrorAriaProps {\n error?: boolean;\n 'aria-describedby'?: string;\n errorText?: string;\n errorTextId?: string;\n}\n\n/**\n * Get IDs to be used with aria-describedby in form components like <Input />\n * @param props Props from form component\n * @param errorTextUuid Unique ID of the form component's error text\n * @returns Element IDs or undefined if there is no aria-description\n */\nexport const getAriaDescribedBy = (props: ErrorAriaProps, errorTextUuid: string): string | undefined => {\n const ariaDescribedBy: string | undefined = props['aria-describedby'];\n const hasErrorText: boolean = !!(props.errorText || (props.error && props.errorTextId));\n const errorTextId: string | undefined = hasErrorText ? errorTextUuid : undefined;\n\n if (ariaDescribedBy && !errorTextId) {\n return ariaDescribedBy;\n } else if (!ariaDescribedBy && errorTextId) {\n return errorTextId;\n } else if (ariaDescribedBy && errorTextId) {\n return ariaDescribedBy + ' ' + errorTextId;\n }\n};\n"],"names":[],"mappings":"AAWa,MAAA,yBAAyB,CAAC,WAAuE;AAC5G,QAAM,EAAE,OAAO,IAAI,YAAY,SAAS,SAAS;AAE7C,MAAA,MAAM,WAAW,MAAM;AAClB,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAGF,MAAI,OAAO;AACF,WAAA;AAAA,MACL,cAAc;AAAA,IAChB;AAAA,EAAA;AAGF,MAAI,IAAI;AACC,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAGF,MAAI,YAAY;AACP,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAEJ;AAea,MAAA,qBAAqB,CAAC,OAAuB,kBAA8C;AAChG,QAAA,kBAAsC,MAAM,kBAAkB;AACpE,QAAM,eAAwB,CAAC,EAAE,MAAM,aAAc,MAAM,SAAS,MAAM;AACpE,QAAA,cAAkC,eAAe,gBAAgB;AAEnE,MAAA,mBAAmB,CAAC,aAAa;AAC5B,WAAA;AAAA,EAAA,WACE,CAAC,mBAAmB,aAAa;AACnC,WAAA;AAAA,EAAA,WACE,mBAAmB,aAAa;AACzC,WAAO,kBAAkB,MAAM;AAAA,EAAA;AAEnC;"}
|
package/utils/component.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
const isComponent = (element, type) =>
|
|
3
|
-
const isComponentWithChildren = (element) =>
|
|
1
|
+
import React__default from "react";
|
|
2
|
+
const isComponent = (element, type) => React__default.isValidElement(element) && element.type === type;
|
|
3
|
+
const isComponentWithChildren = (element) => React__default.isValidElement(element);
|
|
4
4
|
function isComponentWithDisplayName(element, displayName) {
|
|
5
|
-
if (!
|
|
5
|
+
if (!React__default.isValidElement(element) || typeof element.type === "string") {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
8
|
const componentType = element.type;
|
package/utils/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/utils/component.ts"],"sourcesContent":["import React, { PropsWithChildren } from 'react';\n\nexport const isComponent = <T>(\n element: {} | null | undefined,\n type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>\n): element is React.ReactElement<T> => React.isValidElement<T>(element) && (element as React.ReactElement).type === type;\n\nexport const isComponentWithChildren = <T>(element: {} | null | undefined): element is React.ReactElement<PropsWithChildren<T>> =>\n React.isValidElement<PropsWithChildren<T>>(element);\n\nexport function isComponentWithDisplayName<T>(element: React.ReactNode, displayName: string): element is React.ReactElement<T> {\n if (!React.isValidElement(element) || typeof element.type === 'string') {\n return false;\n }\n\n const componentType = element.type as React.ComponentType<T> & { displayName?: string };\n\n return componentType.displayName === displayName;\n}\n"],"names":[],"mappings":";AAEa,MAAA,cAAc,CACzB,SACA,
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/utils/component.ts"],"sourcesContent":["import React, { PropsWithChildren } from 'react';\n\nexport const isComponent = <T>(\n element: {} | null | undefined,\n type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>\n): element is React.ReactElement<T> => React.isValidElement<T>(element) && (element as React.ReactElement).type === type;\n\nexport const isComponentWithChildren = <T>(element: {} | null | undefined): element is React.ReactElement<PropsWithChildren<T>> =>\n React.isValidElement<PropsWithChildren<T>>(element);\n\nexport function isComponentWithDisplayName<T>(element: React.ReactNode, displayName: string): element is React.ReactElement<T> {\n if (!React.isValidElement(element) || typeof element.type === 'string') {\n return false;\n }\n\n const componentType = element.type as React.ComponentType<T> & { displayName?: string };\n\n return componentType.displayName === displayName;\n}\n"],"names":["React"],"mappings":";AAEa,MAAA,cAAc,CACzB,SACA,SACqCA,eAAM,eAAkB,OAAO,KAAM,QAA+B,SAAS;AAE7G,MAAM,0BAA0B,CAAI,YACzCA,eAAM,eAAqC,OAAO;AAEpC,SAAA,2BAA8B,SAA0B,aAAuD;AACzH,MAAA,CAACA,eAAM,eAAe,OAAO,KAAK,OAAO,QAAQ,SAAS,UAAU;AAC/D,WAAA;AAAA,EAAA;AAGT,QAAM,gBAAgB,QAAQ;AAE9B,SAAO,cAAc,gBAAgB;AACvC;"}
|