@helsenorge/designsystem-react 8.6.0-beta.1 → 9.0.0-beta.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.
Files changed (88) hide show
  1. package/Button.js +7 -7
  2. package/Button.js.map +1 -1
  3. package/CHANGELOG.md +1 -1
  4. package/Checkbox.js +42 -42
  5. package/Checkbox.js.map +1 -1
  6. package/ErrorWrapper.js.map +1 -1
  7. package/FormGroup.js +30 -30
  8. package/FormGroup.js.map +1 -1
  9. package/Icon.js +21 -21
  10. package/Icon.js.map +1 -1
  11. package/Input.js +98 -88
  12. package/Input.js.map +1 -1
  13. package/Label.js +9 -9
  14. package/Label.js.map +1 -1
  15. package/MaxCharacters.js +2 -2
  16. package/MaxCharacters.js.map +1 -1
  17. package/RadioButton.js +61 -61
  18. package/RadioButton.js.map +1 -1
  19. package/Select.js +34 -33
  20. package/Select.js.map +1 -1
  21. package/StatusDot.js +15 -15
  22. package/StatusDot.js.map +1 -1
  23. package/TabList.js +88 -53
  24. package/TabList.js.map +1 -1
  25. package/TabPanel.js +7 -7
  26. package/TabPanel.js.map +1 -1
  27. package/Textarea.js +59 -58
  28. package/Textarea.js.map +1 -1
  29. package/Trigger.js +33 -33
  30. package/Trigger.js.map +1 -1
  31. package/components/Button/Button.d.ts +2 -2
  32. package/components/Checkbox/Checkbox.d.ts +4 -3
  33. package/components/Checkbox/styles.module.scss +0 -14
  34. package/components/Checkbox/styles.module.scss.d.ts +0 -1
  35. package/components/Dropdown/Dropdown.d.ts +2 -2
  36. package/components/Dropdown/index.js +25 -25
  37. package/components/Dropdown/index.js.map +1 -1
  38. package/components/ErrorWrapper/ErrorWrapper.d.ts +3 -0
  39. package/components/ExpanderList/ExpanderList.d.ts +4 -6
  40. package/components/ExpanderList/index.js +118 -126
  41. package/components/ExpanderList/index.js.map +1 -1
  42. package/components/ExpanderList/styles.module.scss +164 -53
  43. package/components/ExpanderList/styles.module.scss.d.ts +29 -5
  44. package/components/FormGroup/FormGroup.d.ts +2 -2
  45. package/components/Icon/Icon.d.ts +4 -4
  46. package/components/Icons/NoAccess.js +7 -7
  47. package/components/Icons/NoAccess.js.map +1 -1
  48. package/components/Input/Input.d.ts +4 -3
  49. package/components/Label/Label.d.ts +4 -4
  50. package/components/Label/SubLabel.d.ts +2 -2
  51. package/components/MaxCharacters/MaxCharacters.d.ts +2 -2
  52. package/components/RadioButton/RadioButton.d.ts +5 -4
  53. package/components/RadioButton/styles.module.scss +0 -15
  54. package/components/RadioButton/styles.module.scss.d.ts +0 -1
  55. package/components/Select/Select.d.ts +4 -3
  56. package/components/SharingStatus/SharingStatus.d.ts +1 -1
  57. package/components/SharingStatus/index.js +5 -5
  58. package/components/SharingStatus/index.js.map +1 -1
  59. package/components/SharingStatus/styles.module.scss +0 -16
  60. package/components/SharingStatus/styles.module.scss.d.ts +0 -4
  61. package/components/StatusDot/StatusDot.d.ts +3 -3
  62. package/components/StatusDot/index.js +3 -3
  63. package/components/Tabs/TabList/TabList.d.ts +3 -3
  64. package/components/Tabs/TabList/styles.module.scss +63 -51
  65. package/components/Tabs/TabList/styles.module.scss.d.ts +7 -3
  66. package/components/Tabs/TabPanel/TabPanel.d.ts +1 -2
  67. package/components/Tabs/TabPanel/styles.module.scss +11 -26
  68. package/components/Tabs/TabPanel/styles.module.scss.d.ts +0 -2
  69. package/components/Tabs/Tabs.d.ts +3 -3
  70. package/components/Tabs/index.js +57 -72
  71. package/components/Tabs/index.js.map +1 -1
  72. package/components/Tabs/styles.module.scss +5 -9
  73. package/components/Tabs/styles.module.scss.d.ts +0 -1
  74. package/components/Textarea/Textarea.d.ts +4 -3
  75. package/components/Toggle/index.js +1222 -1180
  76. package/components/Toggle/index.js.map +1 -1
  77. package/components/Trigger/Trigger.d.ts +2 -2
  78. package/components/Validation/index.js +38 -32
  79. package/components/Validation/index.js.map +1 -1
  80. package/constants.d.ts +1 -1
  81. package/constants.js +1 -1
  82. package/constants.js.map +1 -1
  83. package/docs/FormExample/FormExample.d.ts +2 -1
  84. package/index.js +23 -23
  85. package/package.json +4 -4
  86. package/utils/component.d.ts +1 -0
  87. package/utils/component.js +7 -3
  88. package/utils/component.js.map +1 -1
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  export type TriggerTags = 'button' | 'span';
3
3
  export type TriggerVariant = 'help';
4
4
  export type TriggerSize = 'medium' | 'large';
5
- export type TriggerMode = 'onlight' | 'ondark';
5
+ export type TriggerOnColor = 'onlight' | 'ondark';
6
6
  export interface TriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls'> {
7
7
  /**
8
8
  * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!
@@ -19,7 +19,7 @@ export interface TriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonE
19
19
  /**
20
20
  * Changes the design based on the background the trigger is placed on. Default: onlight.
21
21
  */
22
- mode?: TriggerMode;
22
+ onColor?: TriggerOnColor;
23
23
  /**
24
24
  * Size of the trigger. Default: medium.
25
25
  */
@@ -1,50 +1,56 @@
1
- import { jsx as e, Fragment as m, jsxs as l } from "react/jsx-runtime";
2
- import o from "react";
3
- import c from "classnames";
4
- import { A as f } from "../../AnchorLink.js";
5
- import { L as d } from "../../List.js";
6
- import { useUuid as u } from "../../hooks/useUuid.js";
1
+ import { jsx as o, Fragment as f, jsxs as c } from "react/jsx-runtime";
2
+ import s from "react";
3
+ import T from "classnames";
4
+ import { A as C } from "../../AnchorLink.js";
5
+ import { L as u } from "../../List.js";
6
+ import { useUuid as y } from "../../hooks/useUuid.js";
7
7
  import { T as h } from "../../Title.js";
8
- import n from "./styles.module.scss";
9
- import { AnalyticsId as y } from "../../constants.js";
10
- import { isComponent as T } from "../../utils/component.js";
11
- import { F as g } from "../../FormGroup.js";
12
- const C = (r) => {
13
- const t = (a, i) => {
14
- a == null || a.preventDefault(), i != null && i.focus && (i == null || i.focus());
8
+ import d from "./styles.module.scss";
9
+ import { AnalyticsId as g } from "../../constants.js";
10
+ import { isComponent as m, isComponentWithDisplayName as l } from "../../utils/component.js";
11
+ import { C as k } from "../../Checkbox.js";
12
+ import { F as v } from "../../FormGroup.js";
13
+ import { I as E } from "../../Input.js";
14
+ import { R as I } from "../../RadioButton.js";
15
+ import { S as N } from "../../Select.js";
16
+ import { T as b } from "../../Textarea.js";
17
+ const _ = (r) => {
18
+ const i = (e, t) => {
19
+ e == null || e.preventDefault(), t != null && t.focus && (t == null || t.focus());
15
20
  };
16
- return r.error.ref ? /* @__PURE__ */ e(f, { href: `#${r.name}`, onClick: (a) => t(a, r.error.ref), children: r.error.message }) : /* @__PURE__ */ e(m, { children: r.error.message });
17
- }, v = (r) => /* @__PURE__ */ e(d, { children: Object.entries(r.errors).map(([t, a]) => /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(C, { name: t, error: a }) }, t)) }), N = (r) => {
18
- const { errorTitleHtmlMarkup: t = "h2" } = r, a = u(), i = !!r.errors && Object.entries(r.errors).length > 0, s = c(n.validation__summary, i && n["validation__summary--visible"]);
19
- return /* @__PURE__ */ l(
21
+ return r.error.ref ? /* @__PURE__ */ o(C, { href: `#${r.name}`, onClick: (e) => i(e, r.error.ref), children: r.error.message }) : /* @__PURE__ */ o(f, { children: r.error.message });
22
+ }, x = (r) => /* @__PURE__ */ o(u, { children: Object.entries(r.errors).map(([i, e]) => /* @__PURE__ */ o(u.Item, { children: /* @__PURE__ */ o(_, { name: i, error: e }) }, i)) }), D = (r) => {
23
+ const { errorTitleHtmlMarkup: i = "h2" } = r, e = y(), t = !!r.errors && Object.entries(r.errors).length > 0, n = T(d.validation__summary, t && d["validation__summary--visible"]);
24
+ return /* @__PURE__ */ c(
20
25
  "div",
21
26
  {
22
27
  role: "alert",
23
28
  "aria-live": "polite",
24
29
  "aria-relevant": "all",
25
- "aria-labelledby": i && r.errorTitle ? a : void 0,
26
- className: s,
30
+ "aria-labelledby": t && r.errorTitle ? e : void 0,
31
+ className: n,
27
32
  children: [
28
- i && /* @__PURE__ */ l(m, { children: [
29
- r.errorTitle && /* @__PURE__ */ e(h, { appearance: "title4", id: a, htmlMarkup: t, margin: { marginTop: 0, marginBottom: 1 }, children: r.errorTitle }),
30
- /* @__PURE__ */ e(v, { errors: r.errors })
33
+ t && /* @__PURE__ */ c(f, { children: [
34
+ r.errorTitle && /* @__PURE__ */ o(h, { appearance: "title4", id: e, htmlMarkup: i, margin: { marginTop: 0, marginBottom: 1 }, children: r.errorTitle }),
35
+ /* @__PURE__ */ o(x, { errors: r.errors })
31
36
  ] }),
32
37
  r.children
33
38
  ]
34
39
  }
35
40
  );
36
- }, _ = o.forwardRef((r, t) => {
37
- const a = (i) => T(i, g) ? o.cloneElement(i, {
38
- errorWrapperClassName: n["validation__error-wrapper"]
39
- }) : o.isValidElement(i) && i.type === o.Fragment ? o.Children.map(i.props.children, (s) => a(s)) : i;
40
- return /* @__PURE__ */ l(m, { children: [
41
- /* @__PURE__ */ e("div", { "data-testid": r.testId, "data-analyticsid": y.Validation, className: r.className, ref: t, children: o.Children.map(r.children, (i) => a(i)) }),
42
- /* @__PURE__ */ e(N, { errorTitle: r.errorTitle, errors: r.errors })
41
+ }, F = s.forwardRef((r, i) => {
42
+ const e = d["validation__error-wrapper"], t = (a) => s.cloneElement(a, {
43
+ ...a.props,
44
+ errorWrapperClassName: e
45
+ }), n = (a) => m(a, v) || m(a, k) || m(a, I) || m(a, b) || m(a, E) || m(a, N) || l(a, "DateTimePickerWrapper") || l(a, "DatePicker") || l(a, "DateTime") ? t(a) : s.isValidElement(a) && a.type === s.Fragment ? s.Children.map(a.props.children, (p) => n(p)) : a;
46
+ return /* @__PURE__ */ c(f, { children: [
47
+ /* @__PURE__ */ o("div", { "data-testid": r.testId, "data-analyticsid": g.Validation, className: r.className, ref: i, children: s.Children.map(r.children, (a) => n(a)) }),
48
+ /* @__PURE__ */ o(D, { errorTitle: r.errorTitle, errors: r.errors })
43
49
  ] });
44
50
  });
45
- _.displayName = "Validation";
51
+ F.displayName = "Validation";
46
52
  export {
47
- _ as Validation,
48
- _ as default
53
+ F as Validation,
54
+ F as default
49
55
  };
50
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Validation/ErrorListItem.tsx","../../../src/components/Validation/ErrorList.tsx","../../../src/components/Validation/ValidationSummary.tsx","../../../src/components/Validation/Validation.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ErrorDetails, FocusableElement } from './types';\nimport AnchorLink, { AnchorLinkOnClickEvent } from '../AnchorLink';\n\ninterface ErrorElementProps {\n name: string;\n error: ErrorDetails;\n}\n\nconst ErrorListItem: React.FC<ErrorElementProps> = props => {\n const handleClick = (event?: AnchorLinkOnClickEvent, element?: FocusableElement): void => {\n event?.preventDefault();\n element?.focus && element?.focus();\n };\n\n if (props.error.ref) {\n return (\n <AnchorLink href={`#${props.name}`} onClick={(e): void => handleClick(e, props.error.ref)}>\n {props.error.message}\n </AnchorLink>\n );\n }\n\n return <>{props.error.message}</>;\n};\n\nexport default ErrorListItem;\n","import React from 'react';\n\nimport ErrorListItem from './ErrorListItem';\nimport { ValidationErrors } from './types';\nimport List from '../List';\n\ninterface ErrorListProps {\n errors: ValidationErrors;\n}\n\nconst ErrorList: React.FC<ErrorListProps> = props => (\n <List>\n {Object.entries(props.errors).map(([name, error]) => (\n <List.Item key={name}>\n <ErrorListItem name={name} error={error} />\n </List.Item>\n ))}\n </List>\n);\n\nexport default ErrorList;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport ErrorList from './ErrorList';\nimport { ValidationErrors } from './types';\nimport { useUuid } from '../../hooks/useUuid';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationSummaryProps {\n /** Error summary title */\n errorTitle?: string;\n /** Error list */\n errors?: ValidationErrors;\n /** Markup props for error summary title. Default: h2 */\n errorTitleHtmlMarkup?: TitleTags;\n /** Will be shown last */\n children?: React.ReactNode;\n}\n\nconst ValidationSummary: React.FC<ValidationSummaryProps> = props => {\n const { errorTitleHtmlMarkup = 'h2' } = props;\n const titleId = useUuid();\n\n const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;\n\n const summaryClasses = classNames(styles['validation__summary'], hasErrors && styles['validation__summary--visible']);\n\n return (\n <div\n role={'alert'}\n aria-live={'polite'}\n aria-relevant={'all'}\n aria-labelledby={hasErrors && props.errorTitle ? titleId : undefined}\n className={summaryClasses}\n >\n {hasErrors && (\n <>\n {props.errorTitle && (\n <Title appearance=\"title4\" id={titleId} htmlMarkup={errorTitleHtmlMarkup} margin={{ marginTop: 0, marginBottom: 1 }}>\n {props.errorTitle}\n </Title>\n )}\n <ErrorList errors={props.errors!} />\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default ValidationSummary;\n","import React from 'react';\n\nimport { ValidationErrors } from './types';\nimport ValidationSummary from './ValidationSummary';\nimport { AnalyticsId, FormSize } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormGroup, { FormGroupProps } from '../FormGroup/FormGroup';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationProps {\n /** Error summary title */\n errorTitle?: string;\n /** Validation errors. If errors include references to HTML elements, the errors will be rendered as links with an onClick handler to focus the element. */\n errors?: ValidationErrors;\n /** Items in the Validation compontent */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Validation = React.forwardRef((props: ValidationProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<FormGroupProps>(child, FormGroup)) {\n return React.cloneElement(child, {\n errorWrapperClassName: styles['validation__error-wrapper'],\n });\n }\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return React.Children.map(child.props.children, (child: React.ReactNode) => {\n return renderChild(child);\n });\n }\n\n return child;\n };\n\n return (\n <>\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.Validation} className={props.className} ref={ref}>\n {React.Children.map(props.children, (child: React.ReactNode) => renderChild(child))}\n </div>\n <ValidationSummary errorTitle={props.errorTitle} errors={props.errors} />\n </>\n );\n});\n\nValidation.displayName = 'Validation';\n\nexport default Validation;\n"],"names":["ErrorListItem","props","handleClick","event","element","AnchorLink","e","jsx","Fragment","ErrorList","List","name","error","ValidationSummary","errorTitleHtmlMarkup","titleId","useUuid","hasErrors","summaryClasses","classNames","styles","jsxs","Title","Validation","React","ref","renderChild","child","isComponent","FormGroup","AnalyticsId"],"mappings":";;;;;;;;;;;AAUA,MAAMA,IAA6C,CAASC,MAAA;AACpD,QAAAC,IAAc,CAACC,GAAgCC,MAAqC;AACxF,IAAAD,KAAA,QAAAA,EAAO,kBACEC,KAAA,QAAAA,EAAA,UAASA,KAAA,QAAAA,EAAS;AAAA,EAAM;AAG/B,SAAAH,EAAM,MAAM,wBAEXI,GAAW,EAAA,MAAM,IAAIJ,EAAM,IAAI,IAAI,SAAS,CAACK,MAAYJ,EAAYI,GAAGL,EAAM,MAAM,GAAG,GACrF,UAAAA,EAAM,MAAM,QACf,CAAA,IAIG,gBAAAM,EAAAC,GAAA,EAAG,UAAMP,EAAA,MAAM,QAAQ,CAAA;AAChC,GCfMQ,IAAsC,CAC1CR,MAAA,gBAAAM,EAACG,GACE,EAAA,UAAA,OAAO,QAAQT,EAAM,MAAM,EAAE,IAAI,CAAC,CAACU,GAAMC,CAAK,MAC7C,gBAAAL,EAACG,EAAK,MAAL,EACC,UAAA,gBAAAH,EAACP,GAAc,EAAA,MAAAW,GAAY,OAAAC,EAAc,CAAA,EAAA,GAD3BD,CAEhB,CACD,EACH,CAAA,GCKIE,IAAsD,CAASZ,MAAA;AAC7D,QAAA,EAAE,sBAAAa,IAAuB,KAAS,IAAAb,GAClCc,IAAUC,KAEVC,IAAY,CAAC,CAAChB,EAAM,UAAU,OAAO,QAAQA,EAAM,MAAM,EAAE,SAAS,GAEpEiB,IAAiBC,E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AA,CAAA;AAEJ,CAAC;AAEDsB,EAAW,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Validation/ErrorListItem.tsx","../../../src/components/Validation/ErrorList.tsx","../../../src/components/Validation/ValidationSummary.tsx","../../../src/components/Validation/Validation.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ErrorDetails, FocusableElement } from './types';\nimport AnchorLink, { AnchorLinkOnClickEvent } from '../AnchorLink';\n\ninterface ErrorElementProps {\n name: string;\n error: ErrorDetails;\n}\n\nconst ErrorListItem: React.FC<ErrorElementProps> = props => {\n const handleClick = (event?: AnchorLinkOnClickEvent, element?: FocusableElement): void => {\n event?.preventDefault();\n element?.focus && element?.focus();\n };\n\n if (props.error.ref) {\n return (\n <AnchorLink href={`#${props.name}`} onClick={(e): void => handleClick(e, props.error.ref)}>\n {props.error.message}\n </AnchorLink>\n );\n }\n\n return <>{props.error.message}</>;\n};\n\nexport default ErrorListItem;\n","import React from 'react';\n\nimport ErrorListItem from './ErrorListItem';\nimport { ValidationErrors } from './types';\nimport List from '../List';\n\ninterface ErrorListProps {\n errors: ValidationErrors;\n}\n\nconst ErrorList: React.FC<ErrorListProps> = props => (\n <List>\n {Object.entries(props.errors).map(([name, error]) => (\n <List.Item key={name}>\n <ErrorListItem name={name} error={error} />\n </List.Item>\n ))}\n </List>\n);\n\nexport default ErrorList;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport ErrorList from './ErrorList';\nimport { ValidationErrors } from './types';\nimport { useUuid } from '../../hooks/useUuid';\nimport Title, { TitleTags } from '../Title';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationSummaryProps {\n /** Error summary title */\n errorTitle?: string;\n /** Error list */\n errors?: ValidationErrors;\n /** Markup props for error summary title. Default: h2 */\n errorTitleHtmlMarkup?: TitleTags;\n /** Will be shown last */\n children?: React.ReactNode;\n}\n\nconst ValidationSummary: React.FC<ValidationSummaryProps> = props => {\n const { errorTitleHtmlMarkup = 'h2' } = props;\n const titleId = useUuid();\n\n const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;\n\n const summaryClasses = classNames(styles['validation__summary'], hasErrors && styles['validation__summary--visible']);\n\n return (\n <div\n role={'alert'}\n aria-live={'polite'}\n aria-relevant={'all'}\n aria-labelledby={hasErrors && props.errorTitle ? titleId : undefined}\n className={summaryClasses}\n >\n {hasErrors && (\n <>\n {props.errorTitle && (\n <Title appearance=\"title4\" id={titleId} htmlMarkup={errorTitleHtmlMarkup} margin={{ marginTop: 0, marginBottom: 1 }}>\n {props.errorTitle}\n </Title>\n )}\n <ErrorList errors={props.errors!} />\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default ValidationSummary;\n","import React from 'react';\n\nimport { ValidationErrors } from './types';\nimport ValidationSummary from './ValidationSummary';\nimport { AnalyticsId, FormSize } from '../../constants';\nimport { isComponent, isComponentWithDisplayName } from '../../utils/component';\nimport Checkbox, { CheckboxProps } from '../Checkbox';\nimport { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport FormGroup, { FormGroupProps } from '../FormGroup/FormGroup';\nimport Input, { InputProps } from '../Input';\nimport RadioButton, { RadioButtonProps } from '../RadioButton';\nimport Select, { SelectProps } from '../Select';\nimport Textarea, { TextareaProps } from '../Textarea';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationProps {\n /** Error summary title */\n errorTitle?: string;\n /** Validation errors. If errors include references to HTML elements, the errors will be rendered as links with an onClick handler to focus the element. */\n errors?: ValidationErrors;\n /** Items in the Validation compontent */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Validation = React.forwardRef((props: ValidationProps, ref: React.ForwardedRef<HTMLDivElement>) => {\n const validationErrorClass = styles['validation__error-wrapper'];\n\n const cloneFormElement = <T extends ErrorWrapperClassNameProps>(child: React.ReactElement<T>): React.ReactElement<T> => {\n return React.cloneElement(child, {\n ...child.props,\n errorWrapperClassName: validationErrorClass,\n });\n };\n\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (\n isComponent<FormGroupProps>(child, FormGroup) ||\n isComponent<CheckboxProps>(child, Checkbox) ||\n isComponent<RadioButtonProps>(child, RadioButton) ||\n isComponent<TextareaProps>(child, Textarea) ||\n isComponent<InputProps>(child, Input) ||\n isComponent<SelectProps>(child, Select) ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTimePickerWrapper') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DatePicker') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTime')\n ) {\n return cloneFormElement<ErrorWrapperClassNameProps>(child);\n }\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return React.Children.map(child.props.children, (child: React.ReactNode) => {\n return renderChild(child);\n });\n }\n\n return child;\n };\n\n return (\n <>\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.Validation} className={props.className} ref={ref}>\n {React.Children.map(props.children, (child: React.ReactNode) => renderChild(child))}\n </div>\n <ValidationSummary errorTitle={props.errorTitle} errors={props.errors} />\n </>\n );\n});\n\nValidation.displayName = 'Validation';\n\nexport default Validation;\n"],"names":["ErrorListItem","props","handleClick","event","element","AnchorLink","jsx","Fragment","ErrorList","List","name","error","ValidationSummary","errorTitleHtmlMarkup","titleId","useUuid","hasErrors","summaryClasses","classNames","styles","jsxs","Title","Validation","React","ref","validationErrorClass","cloneFormElement","child","renderChild","isComponent","FormGroup","Checkbox","RadioButton","Textarea","Input","Select","isComponentWithDisplayName","AnalyticsId"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAMA,IAA6C,CAASC,MAAA;AACpD,QAAAC,IAAc,CAACC,GAAgCC,MAAqC;AACxF,IAAAD,KAAA,QAAAA,EAAO,kBACEC,KAAA,QAAAA,EAAA,UAASA,KAAA,QAAAA,EAAS;AAAA,EAAM;AAG/B,SAAAH,EAAM,MAAM,wBAEXI,GAAW,EAAA,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,EAAM,WAAW,CAACtB,GAAwBuB,MAA4C;AACxG,QAAAC,IAAuBN,EAAO,2BAA2B,GAEzDO,IAAmB,CAAuCC,MACvDJ,EAAM,aAAaI,GAAO;AAAA,IAC/B,GAAGA,EAAM;AAAA,IACT,uBAAuBF;AAAA,EAAA,CACxB,GAGGG,IAAc,CAACD,MAEjBE,EAA4BF,GAAOG,CAAS,KAC5CD,EAA2BF,GAAOI,CAAQ,KAC1CF,EAA8BF,GAAOK,CAAW,KAChDH,EAA2BF,GAAOM,CAAQ,KAC1CJ,EAAwBF,GAAOO,CAAK,KACpCL,EAAyBF,GAAOQ,CAAM,KACtCC,EAAuDT,GAAO,uBAAuB,KACrFS,EAAuDT,GAAO,YAAY,KAC1ES,EAAuDT,GAAO,UAAU,IAEjED,EAA6CC,CAAK,IAEvDJ,EAAM,eAAeI,CAAK,KAAKA,EAAM,SAASJ,EAAM,WAC/CA,EAAM,SAAS,IAAII,EAAM,MAAM,UAAU,CAACA,MACxCC,EAAYD,CAAK,CACzB,IAGIA;AAGT,SAEI,gBAAAP,EAAAb,GAAA,EAAA,UAAA;AAAA,IAAC,gBAAAD,EAAA,OAAA,EAAI,eAAaL,EAAM,QAAQ,oBAAkBoC,EAAY,YAAY,WAAWpC,EAAM,WAAW,KAAAuB,GACnG,UAAMD,EAAA,SAAS,IAAItB,EAAM,UAAU,CAAC0B,MAA2BC,EAAYD,CAAK,CAAC,EACpF,CAAA;AAAA,sBACCf,GAAkB,EAAA,YAAYX,EAAM,YAAY,QAAQA,EAAM,QAAQ;AAAA,EACzE,EAAA,CAAA;AAEJ,CAAC;AAEDqB,EAAW,cAAc;"}
package/constants.d.ts CHANGED
@@ -40,7 +40,7 @@ export interface HTMLAnchorProps {
40
40
  referrerPolicy?: '' | 'same-origin' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
41
41
  }
42
42
  export type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;
43
- export declare enum FormMode {
43
+ export declare enum FormOnColor {
44
44
  onwhite = "onwhite",
45
45
  ongrey = "ongrey",
46
46
  onblueberry = "onblueberry",
package/constants.js CHANGED
@@ -4,7 +4,7 @@ var p = /* @__PURE__ */ ((r) => (r.onwhite = "onwhite", r.ongrey = "ongrey", r.o
4
4
  export {
5
5
  u as AVERAGE_CHARACTER_WIDTH_PX,
6
6
  t as AnalyticsId,
7
- p as FormMode,
7
+ p as FormOnColor,
8
8
  a as FormSize,
9
9
  e as IconSize,
10
10
  g as KeyboardEventKey,
package/constants.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n Modal = 1300000,\n PopOver = 11000,\n // TODO: Skille mellom ExpanderTrigger isSticky og isHovered? Skulle tro isHovered trenger vesentlig mindre z-index\n ExpanderTrigger = 10000,\n OverlayScreen = 9999,\n LightBoxButtons = 1000,\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Chip = 'chip',\n Close = 'close',\n DictionaryTrigger = 'dictionary-trigger',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n EmptyState = 'empty-state',\n Expander = 'expander',\n ExpanderHierarchy = 'expander-hierarchy',\n ExpanderHierarchyExpander = 'expander-hierarchy-expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n EyebrowHeader = 'eyebrow-header',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HelpQuestion = 'help-question',\n HighlightPanel = 'highlight-panel',\n Icon = 'icon',\n Illustration = 'Illustration',\n Input = 'input',\n Label = 'label',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n Panel = 'panel',\n PanelList = 'panel-list',\n PopMenu = 'pop-menu',\n PopOver = 'pop-over',\n Portal = 'portal',\n PromoPanel = 'promo-panel',\n RadioButton = 'radio-button',\n Select = 'select',\n SharingStatus = 'sharing-status',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Step = 'step',\n StepButtons = 'step-buttons',\n Stepper = 'stepper',\n Sublabel = 'sublabel',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Toggle = 'toggle',\n Tooltip = 'tooltip',\n Trigger = 'trigger',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n ArrowRight = 'ArrowRight',\n ArrowLeft = 'ArrowLeft',\n Home = 'Home',\n End = 'End',\n Space = ' ',\n Tab = 'Tab',\n}\n"],"names":["IconSize","ZIndex","AVERAGE_CHARACTER_WIDTH_PX","FormMode","FormSize","AnalyticsId","KeyboardEventKey"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,SAAS,GAAT,IAAA,UANUA,IAAAA,KAAA,CAAA,CAAA,GASAC,sBAAAA,OACVA,EAAAA,EAAA,QAAQ,IAAR,IAAA,SACAA,EAAAA,EAAA,UAAU,IAAV,IAAA,WAEAA,EAAAA,EAAA,kBAAkB,GAAlB,IAAA,mBACAA,EAAAA,EAAA,gBAAgB,IAAhB,IAAA,iBACAA,EAAAA,EAAA,kBAAkB,GAAlB,IAAA,mBANUA,IAAAA,KAAA,CAAA,CAAA;AASL,MAAMC,IAA6B;AAyC9B,IAAAC,sBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,cAAc,eACdA,EAAA,SAAS,UACTA,EAAA,YAAY,aALFA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAFEA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACVA,EAAA,aAAa,eACbA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,WAAW,YACXA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,sBACpBA,EAAA,WAAW,YACXA,EAAA,UAAU,WACVA,EAAA,aAAa,eACbA,EAAA,WAAW,YACXA,EAAA,oBAAoB,sBACpBA,EAAA,4BAA4B,+BAC5BA,EAAA,eAAe,iBACfA,EAAA,uBAAuB,0BACvBA,EAAA,gBAAgB,kBAChBA,EAAA,YAAY,cACZA,EAAA,aAAa,eACbA,EAAA,aAAa,eACbA,EAAA,eAAe,iBACfA,EAAA,iBAAiB,mBACjBA,EAAA,OAAO,QACPA,EAAA,eAAe,gBACfA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SACRA,EAAA,OAAO,QACPA,EAAA,WAAW,aACXA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,sBACpBA,EAAA,QAAQ,SACRA,EAAA,YAAY,cACZA,EAAA,UAAU,YACVA,EAAA,UAAU,YACVA,EAAA,SAAS,UACTA,EAAA,aAAa,eACbA,EAAA,cAAc,gBACdA,EAAA,SAAS,UACTA,EAAA,gBAAgB,kBAChBA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,YAAY,cACZA,EAAA,OAAO,QACPA,EAAA,cAAc,gBACdA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,QAAQ,SACRA,EAAA,MAAM,OACNA,EAAA,UAAU,YACVA,EAAA,WAAW,YACXA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,aAAa,cA3DHA,IAAAA,KAAA,CAAA,CAAA,GA8DAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,YAAY,aACZA,EAAA,UAAU,WACVA,EAAA,aAAa,cACbA,EAAA,YAAY,aACZA,EAAA,OAAO,QACPA,EAAA,MAAM,OACNA,EAAA,QAAQ,KACRA,EAAA,MAAM,OAVIA,IAAAA,KAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n Modal = 1300000,\n PopOver = 11000,\n // TODO: Skille mellom ExpanderTrigger isSticky og isHovered? Skulle tro isHovered trenger vesentlig mindre z-index\n ExpanderTrigger = 10000,\n OverlayScreen = 9999,\n LightBoxButtons = 1000,\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Chip = 'chip',\n Close = 'close',\n DictionaryTrigger = 'dictionary-trigger',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n EmptyState = 'empty-state',\n Expander = 'expander',\n ExpanderHierarchy = 'expander-hierarchy',\n ExpanderHierarchyExpander = 'expander-hierarchy-expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n EyebrowHeader = 'eyebrow-header',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HelpQuestion = 'help-question',\n HighlightPanel = 'highlight-panel',\n Icon = 'icon',\n Illustration = 'Illustration',\n Input = 'input',\n Label = 'label',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n Panel = 'panel',\n PanelList = 'panel-list',\n PopMenu = 'pop-menu',\n PopOver = 'pop-over',\n Portal = 'portal',\n PromoPanel = 'promo-panel',\n RadioButton = 'radio-button',\n Select = 'select',\n SharingStatus = 'sharing-status',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Step = 'step',\n StepButtons = 'step-buttons',\n Stepper = 'stepper',\n Sublabel = 'sublabel',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Toggle = 'toggle',\n Tooltip = 'tooltip',\n Trigger = 'trigger',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n ArrowRight = 'ArrowRight',\n ArrowLeft = 'ArrowLeft',\n Home = 'Home',\n End = 'End',\n Space = ' ',\n Tab = 'Tab',\n}\n"],"names":["IconSize","ZIndex","AVERAGE_CHARACTER_WIDTH_PX","FormOnColor","FormSize","AnalyticsId","KeyboardEventKey"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAA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,SACRA,EAAA,YAAY,cACZA,EAAA,UAAU,YACVA,EAAA,UAAU,YACVA,EAAA,SAAS,UACTA,EAAA,aAAa,eACbA,EAAA,cAAc,gBACdA,EAAA,SAAS,UACTA,EAAA,gBAAgB,kBAChBA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,YAAY,cACZA,EAAA,OAAO,QACPA,EAAA,cAAc,gBACdA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,QAAQ,SACRA,EAAA,MAAM,OACNA,EAAA,UAAU,YACVA,EAAA,WAAW,YACXA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,aAAa,cA3DHA,IAAAA,KAAA,CAAA,CAAA,GA8DAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,YAAY,aACZA,EAAA,UAAU,WACVA,EAAA,aAAa,cACbA,EAAA,YAAY,aACZA,EAAA,OAAO,QACPA,EAAA,MAAM,OACNA,EAAA,QAAQ,KACRA,EAAA,MAAM,OAVIA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -9,7 +9,8 @@ export declare enum FormExampleVariants {
9
9
  radiobutton = "radiobutton",
10
10
  textarea = "textarea",
11
11
  input = "input",
12
- select = "select"
12
+ select = "select",
13
+ withoutformgroup = "withoutformgroup"
13
14
  }
14
15
  export declare const FormExample: (props: FormExampleProps) => JSX.Element;
15
16
  export default FormExample;
package/index.js CHANGED
@@ -3,46 +3,46 @@ import { Breakpoint as s, useBreakpoint as u } from "./hooks/useBreakpoint.js";
3
3
  import { useFocusToggle as p } from "./hooks/useFocusToggle.js";
4
4
  import { useFocusTrap as f } from "./hooks/useFocusTrap.js";
5
5
  import { useHover as n } from "./hooks/useHover.js";
6
- import { useIntersectionObserver as d } from "./hooks/useIntersectionObserver.js";
6
+ import { useIntersectionObserver as v } from "./hooks/useIntersectionObserver.js";
7
7
  import { useIsVisible as E } from "./hooks/useIsVisible.js";
8
8
  import { useLayoutEvent as c } from "./hooks/useLayoutEvent.js";
9
- import { usePrevious as A } from "./hooks/usePrevious.js";
10
- import { useSticky as l } from "./hooks/useSticky.js";
9
+ import { usePrevious as y } from "./hooks/usePrevious.js";
10
+ import { useSticky as I } from "./hooks/useSticky.js";
11
11
  import { useSize as g } from "./hooks/useSize.js";
12
12
  import { useResizeObserver as F } from "./hooks/useResizeObserver.js";
13
- import { useToggle as S } from "./hooks/useToggle.js";
14
- import { useKeyboardEvent as H } from "./hooks/useKeyboardEvent.js";
15
- import { useOutsideEvent as O } from "./hooks/useOutsideEvent.js";
16
- import { useUuid as B } from "./hooks/useUuid.js";
17
- import { isMobileUA as M } from "./utils/mobile.js";
18
- import { u as U } from "./uuid.js";
19
- import { AVERAGE_CHARACTER_WIDTH_PX as h, AnalyticsId as D, FormMode as G, FormSize as L, IconSize as W, KeyboardEventKey as X, ZIndex as Z } from "./constants.js";
13
+ import { useToggle as R } from "./hooks/useToggle.js";
14
+ import { useKeyboardEvent as k } from "./hooks/useKeyboardEvent.js";
15
+ import { useOutsideEvent as H } from "./hooks/useOutsideEvent.js";
16
+ import { useUuid as _ } from "./hooks/useUuid.js";
17
+ import { isMobileUA as P } from "./utils/mobile.js";
18
+ import { u as V } from "./uuid.js";
19
+ import { AVERAGE_CHARACTER_WIDTH_PX as D, AnalyticsId as G, FormOnColor as L, FormSize as M, IconSize as W, KeyboardEventKey as X, ZIndex as Z } from "./constants.js";
20
20
  export {
21
- h as AVERAGE_CHARACTER_WIDTH_PX,
22
- D as AnalyticsId,
21
+ D as AVERAGE_CHARACTER_WIDTH_PX,
22
+ G as AnalyticsId,
23
23
  s as Breakpoint,
24
- G as FormMode,
25
- L as FormSize,
24
+ L as FormOnColor,
25
+ M as FormSize,
26
26
  W as IconSize,
27
27
  X as KeyboardEventKey,
28
28
  Z as ZIndex,
29
- M as isMobileUA,
29
+ P as isMobileUA,
30
30
  r as theme,
31
31
  u as useBreakpoint,
32
32
  p as useFocusToggle,
33
33
  f as useFocusTrap,
34
34
  n as useHover,
35
- d as useIntersectionObserver,
35
+ v as useIntersectionObserver,
36
36
  E as useIsVisible,
37
- H as useKeyboardEvent,
37
+ k as useKeyboardEvent,
38
38
  c as useLayoutEvent,
39
- O as useOutsideEvent,
40
- A as usePrevious,
39
+ H as useOutsideEvent,
40
+ y as usePrevious,
41
41
  F as useResizeObserver,
42
42
  g as useSize,
43
- l as useSticky,
44
- S as useToggle,
45
- B as useUuid,
46
- U as uuid
43
+ I as useSticky,
44
+ R as useToggle,
45
+ _ as useUuid,
46
+ V as uuid
47
47
  };
48
48
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -7,18 +7,18 @@
7
7
  "url": "git+https://github.com/helsenorge/designsystem.git"
8
8
  },
9
9
  "homepage": "https://helsenorge.design",
10
- "version": "8.6.0-beta.1",
10
+ "version": "9.0.0-beta.0",
11
11
  "author": "Helsenorge",
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
- "framer-motion": "^11.5.4"
14
+ "framer-motion": "^11.11.8"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "bootstrap": "^4.6.2",
18
18
  "classnames": "^2.3.2",
19
19
  "normalize.css": "^8.0.1",
20
- "react": "^17.0.0 || ^18.0.0",
21
- "react-dom": "^17.0.0 || ^18.0.0"
20
+ "react": "^18.0.0",
21
+ "react-dom": "^18.0.0"
22
22
  },
23
23
  "sideEffects": false
24
24
  }
@@ -1,3 +1,4 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  export declare const isComponent: <T>(element: {} | null | undefined, type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>) => element is React.ReactElement<T>;
3
3
  export declare const isComponentWithChildren: <T>(element: {} | null | undefined) => element is React.ReactElement<PropsWithChildren<T>>;
4
+ export declare function isComponentWithDisplayName<T>(element: React.ReactNode, displayName: string): element is React.ReactElement<T>;
@@ -1,7 +1,11 @@
1
1
  import i from "react";
2
- const e = (t, o) => i.isValidElement(t) && t.type === o, s = (t) => i.isValidElement(t);
2
+ const p = (t, n) => i.isValidElement(t) && t.type === n, s = (t) => i.isValidElement(t);
3
+ function a(t, n) {
4
+ return !i.isValidElement(t) || typeof t.type == "string" ? !1 : t.type.displayName === n;
5
+ }
3
6
  export {
4
- e as isComponent,
5
- s as isComponentWithChildren
7
+ p as isComponent,
8
+ s as isComponentWithChildren,
9
+ a as isComponentWithDisplayName
6
10
  };
7
11
  //# sourceMappingURL=component.js.map
@@ -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"],"names":["isComponent","element","type","React","isComponentWithChildren"],"mappings":";AAEa,MAAAA,IAAc,CACzBC,GACAC,MACqCC,EAAM,eAAkBF,CAAO,KAAMA,EAA+B,SAASC,GAEvGE,IAA0B,CAAIH,MACzCE,EAAM,eAAqCF,CAAO;"}
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":["isComponent","element","type","React","isComponentWithChildren","isComponentWithDisplayName","displayName"],"mappings":";AAEa,MAAAA,IAAc,CACzBC,GACAC,MACqCC,EAAM,eAAkBF,CAAO,KAAMA,EAA+B,SAASC,GAEvGE,IAA0B,CAAIH,MACzCE,EAAM,eAAqCF,CAAO;AAEpC,SAAAI,EAA8BJ,GAA0BK,GAAuD;AACzH,SAAA,CAACH,EAAM,eAAeF,CAAO,KAAK,OAAOA,EAAQ,QAAS,WACrD,KAGaA,EAAQ,KAET,gBAAgBK;AACvC;"}