@digdir/designsystemet-react 0.0.0-test-20250424120827 → 0.0.0-test-20250430125130

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2024 Digitaliseringsdirektoratet (Digdir)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -6,7 +6,7 @@ var react = require('react');
6
6
  var reactDom = require('react-dom');
7
7
  var ComboboxIdContext = require('./ComboboxIdContext.js');
8
8
 
9
- const useFloatingCombobox = ({ listRef }) => {
9
+ const useFloatingCombobox = ({ listRef, }) => {
10
10
  const [open, setOpen] = react.useState(false);
11
11
  const { activeIndex } = ComboboxIdContext.useComboboxId();
12
12
  const dispatch = ComboboxIdContext.useComboboxIdDispatch();
@@ -95,9 +95,7 @@ const Popover = react.forwardRef(function Popover({ id, className, onClose, onOp
95
95
  if (id)
96
96
  setPopoverId?.(id);
97
97
  }, [id]);
98
- return (jsxRuntime.jsx(Component, { className: cl('ds-popover', className), id: id || popoverId,
99
- // @ts-ignore @types/react-dom does not understand popover yet
100
- popover: 'manual', "data-variant": variant, ref: mergedRefs, ...rest }));
98
+ return (jsxRuntime.jsx(Component, { className: cl('ds-popover', className), id: id || popoverId, popover: 'manual', "data-variant": variant, ref: mergedRefs, ...rest }));
101
99
  });
102
100
  const arrowPseudoElement = {
103
101
  name: 'ArrowPseudoElement',
@@ -4,7 +4,7 @@ import { useState } from 'react';
4
4
  import { flushSync } from 'react-dom';
5
5
  import { useComboboxId, useComboboxIdDispatch } from './ComboboxIdContext.js';
6
6
 
7
- const useFloatingCombobox = ({ listRef }) => {
7
+ const useFloatingCombobox = ({ listRef, }) => {
8
8
  const [open, setOpen] = useState(false);
9
9
  const { activeIndex } = useComboboxId();
10
10
  const dispatch = useComboboxIdDispatch();
@@ -93,9 +93,7 @@ const Popover = forwardRef(function Popover({ id, className, onClose, onOpen, op
93
93
  if (id)
94
94
  setPopoverId?.(id);
95
95
  }, [id]);
96
- return (jsx(Component, { className: cl('ds-popover', className), id: id || popoverId,
97
- // @ts-ignore @types/react-dom does not understand popover yet
98
- popover: 'manual', "data-variant": variant, ref: mergedRefs, ...rest }));
96
+ return (jsx(Component, { className: cl('ds-popover', className), id: id || popoverId, popover: 'manual', "data-variant": variant, ref: mergedRefs, ...rest }));
99
97
  });
100
98
  const arrowPseudoElement = {
101
99
  name: 'ArrowPseudoElement',
@@ -1,42 +1,19 @@
1
- import type { MutableRefObject } from 'react';
1
+ import { useInteractions } from '@floating-ui/react';
2
+ import type { UseFloatingReturn } from '@floating-ui/react';
3
+ import type { RefObject } from 'react';
2
4
  type UseFloatingComboboxProps = {
3
- listRef: MutableRefObject<(HTMLElement | null)[]>;
5
+ listRef: RefObject<(HTMLElement | null)[]>;
4
6
  };
5
- export declare const useFloatingCombobox: ({ listRef }: UseFloatingComboboxProps) => {
7
+ export declare const useFloatingCombobox: ({ listRef, }: UseFloatingComboboxProps) => {
6
8
  open: boolean;
7
9
  setOpen: React.Dispatch<React.SetStateAction<boolean>>;
8
- activeIndex: number;
9
- refs: {
10
- reference: MutableRefObject<import("@floating-ui/react-dom").ReferenceType | null>;
11
- floating: React.MutableRefObject<HTMLElement | null>;
12
- setReference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
13
- setFloating: (node: HTMLElement | null) => void;
14
- } & import("@floating-ui/react").ExtendedRefs<HTMLInputElement>;
15
- floatingStyles: React.CSSProperties;
16
- context: {
17
- x: number;
18
- y: number;
19
- placement: import("@floating-ui/utils").Placement;
20
- strategy: import("@floating-ui/utils").Strategy;
21
- middlewareData: import("@floating-ui/core").MiddlewareData;
22
- isPositioned: boolean;
23
- update: () => void;
24
- floatingStyles: React.CSSProperties;
25
- open: boolean;
26
- onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
27
- events: import("@floating-ui/react").FloatingEvents;
28
- dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
29
- nodeId: string | undefined;
30
- floatingId: string;
31
- refs: import("@floating-ui/react").ExtendedRefs<HTMLInputElement>;
32
- elements: import("@floating-ui/react").ExtendedElements<HTMLInputElement>;
33
- };
34
- getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
35
- getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
36
- getItemProps: (userProps?: Omit<React.HTMLProps<HTMLElement>, "selected" | "active"> & {
37
- active?: boolean;
38
- selected?: boolean;
39
- }) => Record<string, unknown>;
10
+ activeIndex: number | null;
11
+ refs: UseFloatingReturn<HTMLInputElement>["refs"];
12
+ floatingStyles: UseFloatingReturn<HTMLInputElement>["floatingStyles"];
13
+ context: UseFloatingReturn<HTMLInputElement>["context"];
14
+ getReferenceProps: ReturnType<typeof useInteractions>["getReferenceProps"];
15
+ getFloatingProps: ReturnType<typeof useInteractions>["getFloatingProps"];
16
+ getItemProps: ReturnType<typeof useInteractions>["getItemProps"];
40
17
  };
41
18
  export {};
42
19
  //# sourceMappingURL=useFloatingCombobox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFloatingCombobox.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/useFloatingCombobox.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAK9C,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,gBAAgB,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,aAAa,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuExE,CAAC"}
1
+ {"version":3,"file":"useFloatingCombobox.d.ts","sourceRoot":"","sources":["../../../src/components/Combobox/useFloatingCombobox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,eAAe,EAGhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,SAAS,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,cAEjC,wBAAwB,KAAG;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;IAClD,cAAc,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACtE,OAAO,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC;IACxD,iBAAiB,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,mBAAmB,CAAC,CAAC;IAC3E,gBAAgB,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACzE,YAAY,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,cAAc,CAAC,CAAC;CAwElE,CAAC"}
@@ -21,7 +21,7 @@ import { DropdownTriggerContext } from './DropdownTriggerContext';
21
21
  * </Dropdown.TriggerContext>
22
22
  */
23
23
  declare const Dropdown: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & Omit<import("..").PopoverProps, "variant">, "placement"> & {
24
- placement?: import("@floating-ui/utils").Placement;
24
+ placement?: import("@floating-ui/dom").Placement;
25
25
  } & React.RefAttributes<HTMLDivElement>> & {
26
26
  TriggerContext: {
27
27
  ({ children, }: import("./DropdownTriggerContext").DropdownTriggerContextProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACf,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAInE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMlD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC,GAAG,CAAC;QAClB,UAAU,mBAAmB;YAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB;KACF;IACD,UAAU,KAAK,CAAC;QACd,UAAU,cAAc,CAAC,CAAC;YACxB,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB;KACF;CACF;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CACnC,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,EAC7C;IACE;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,cAAc,CAAC;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,OAAO;IA9DhB;;OAEG;SACE,MAAM;IACX;;;OAGG;gBACS,SAAS;IACrB;;;OAGG;WACI,OAAO;IACd;;;;OAIG;cACO,SAAS,GAAG,QAAQ;IAC9B;;OAEG;mBACY,KAAK,GAAG,cAAc;IACrC;;OAEG;aACM,MAAM,IAAI;IACnB;;OAEG;cACO,MAAM,IAAI;IACpB;;;OAGG;oBACa,OAAO;IACvB;;;OAGG;cACO,OAAO;wCAiIpB,CAAC"}
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,cAAc,EACf,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,KAAK,EAAmB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAInE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,E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
13
  */
14
14
  declare const Popover: React.ForwardRefExoticComponent<Omit<import("../../types").DefaultProps & React.HTMLAttributes<HTMLDivElement>, "id" | "data-color" | "variant" | "asChild" | "open" | "placement" | "onClose" | "autoPlacement" | "onOpen"> & {
15
15
  id?: string;
16
- placement?: import("@floating-ui/utils").Placement;
16
+ placement?: import("@floating-ui/dom").Placement;
17
17
  open?: boolean;
18
18
  variant?: "default" | "tinted";
19
19
  'data-color'?: import("../../colors").Color | import("../../colors").SeverityColors;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digdir/designsystemet-react",
3
3
  "type": "module",
4
- "version": "0.0.0-test-20250424120827",
4
+ "version": "0.0.0-test-20250430125130",
5
5
  "description": "React components for Designsystemet",
6
6
  "author": "Designsystemet team",
7
7
  "repository": {
@@ -28,12 +28,6 @@
28
28
  "files": [
29
29
  "dist/**"
30
30
  ],
31
- "scripts": {
32
- "build": "yarn run clean && tsc -b tsconfig.lib.json --emitDeclarationOnly false && rollup -c --bundleConfigAsCjs",
33
- "clean": "rimraf dist && rimraf tsc-build && rimraf --glob \"*.tsbuildinfo\"",
34
- "copy-css-to-build": "copyfiles -u 1 ./src/**/*.css ./tsc-build/",
35
- "types": "tsc --noEmit"
36
- },
37
31
  "peerDependencies": {
38
32
  "react": ">=18.3.1 || ^19.0.0",
39
33
  "react-dom": ">=18.3.1 || ^19.0.0"
@@ -53,6 +47,7 @@
53
47
  "clsx": "^2.1.1"
54
48
  },
55
49
  "devDependencies": {
50
+ "tsx": "4.19.4",
56
51
  "@rollup/plugin-commonjs": "^28.0.3",
57
52
  "@rollup/plugin-node-resolve": "^16.0.1",
58
53
  "@testing-library/dom": "^10.4.0",
@@ -68,6 +63,18 @@
68
63
  "rimraf": "^6.0.1",
69
64
  "rollup": "^4.39.0",
70
65
  "rollup-plugin-copy": "^3.5.0",
71
- "typescript": "^5.8.2"
66
+ "typescript": "^5.8.2",
67
+ "@storybook/types": "^8.6.12",
68
+ "@storybook/test": "^8.6.12",
69
+ "@storybook/react": "^8.6.12",
70
+ "@storybook/blocks": "^8.6.12",
71
+ "@storybook/preview-api": "^8.6.12",
72
+ "@digdir/designsystemet-css": "^0.0.0-test-20250430125130"
73
+ },
74
+ "scripts": {
75
+ "build": "pnpm run clean && tsc -b tsconfig.lib.json --emitDeclarationOnly false && rollup -c --bundleConfigAsCjs",
76
+ "clean": "rimraf dist && rimraf tsc-build && rimraf --glob \"*.tsbuildinfo\"",
77
+ "copy-css-to-build": "copyfiles -u 1 ./src/**/*.css ./tsc-build/",
78
+ "types": "tsc --noEmit"
72
79
  }
73
- }
80
+ }