@smudi/designsystem 1.5.3 → 2.0.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/@smudi/components/button/button.d.ts +19 -1
- package/@smudi/components/button/button.d.ts.map +1 -1
- package/@smudi/components/button/button.js +16 -15
- package/@smudi/components/card/card-icon-block.d.ts +18 -0
- package/@smudi/components/card/card-icon-block.d.ts.map +1 -1
- package/@smudi/components/card/card.d.ts +13 -0
- package/@smudi/components/card/card.d.ts.map +1 -1
- package/@smudi/components/dialog/dialog.d.ts +12 -0
- package/@smudi/components/dialog/dialog.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-button.d.ts +15 -6
- package/@smudi/components/dropdown/dropdown-button.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-item.d.ts +11 -1
- package/@smudi/components/dropdown/dropdown-item.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown-list.d.ts +11 -1
- package/@smudi/components/dropdown/dropdown-list.d.ts.map +1 -1
- package/@smudi/components/dropdown/dropdown.d.ts +16 -1
- package/@smudi/components/dropdown/dropdown.d.ts.map +1 -1
- package/@smudi/components/file-upload/file-upload.d.ts +6 -0
- package/@smudi/components/file-upload/file-upload.d.ts.map +1 -0
- package/@smudi/components/file-upload/file-upload.js +7 -0
- package/@smudi/components/header/header-content.d.ts +11 -0
- package/@smudi/components/header/header-content.d.ts.map +1 -1
- package/@smudi/components/header/header-divider.d.ts +14 -0
- package/@smudi/components/header/header-divider.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-button.d.ts +9 -0
- package/@smudi/components/header/header-menu/header-menu-button.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-content.d.ts +13 -0
- package/@smudi/components/header/header-menu/header-menu-content.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-group.d.ts +10 -0
- package/@smudi/components/header/header-menu/header-menu-group.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu-item.d.ts +16 -0
- package/@smudi/components/header/header-menu/header-menu-item.d.ts.map +1 -1
- package/@smudi/components/header/header-menu/header-menu.d.ts +15 -0
- package/@smudi/components/header/header-menu/header-menu.d.ts.map +1 -1
- package/@smudi/components/header/header-search/header-search-button.d.ts +17 -0
- package/@smudi/components/header/header-search/header-search-button.d.ts.map +1 -1
- package/@smudi/components/header/header-search/header-search.d.ts +18 -0
- package/@smudi/components/header/header-search/header-search.d.ts.map +1 -1
- package/@smudi/components/header/header.d.ts +65 -23
- package/@smudi/components/header/header.d.ts.map +1 -1
- package/@smudi/components/layout-components/cluster-layouts/cluster-layout.module.css.js +1 -1
- package/@smudi/components/layout-components/split-view/index.d.ts +8 -0
- package/@smudi/components/layout-components/split-view/index.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/index.js +10 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.d.ts +8 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.js +44 -0
- package/@smudi/components/layout-components/split-view/split-view-divider.module.css.js +9 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.d.ts +23 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view-panel.js +8 -0
- package/@smudi/components/layout-components/split-view/split-view.d.ts +14 -0
- package/@smudi/components/layout-components/split-view/split-view.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/split-view.js +67 -0
- package/@smudi/components/layout-components/split-view/split-view.module.css.js +8 -0
- package/@smudi/components/layout-components/split-view/use-resize.d.ts +34 -0
- package/@smudi/components/layout-components/split-view/use-resize.d.ts.map +1 -0
- package/@smudi/components/layout-components/split-view/use-resize.js +67 -0
- package/@smudi/components/select/select.d.ts +7 -0
- package/@smudi/components/select/select.d.ts.map +1 -1
- package/@smudi/components/select/select.js +13 -6
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion-list.d.ts +4 -0
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion-list.d.ts.map +1 -1
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.d.ts +17 -0
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.d.ts.map +1 -1
- package/@smudi/components/suggestion/smudi-suggestion/smudi-suggestion.js +43 -82
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.d.ts +10 -0
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.d.ts.map +1 -1
- package/@smudi/components/suggestion/suggestion-no-chips/suggestion-no-chips.js +44 -33
- package/@smudi/components/suggestion/suggestion.d.ts +1 -0
- package/@smudi/components/suggestion/suggestion.d.ts.map +1 -1
- package/@smudi/components/table/table.d.ts +25 -3
- package/@smudi/components/table/table.d.ts.map +1 -1
- package/@smudi/components/table/table.js +21 -3
- package/@smudi/components/toast/toast.d.ts +45 -0
- package/@smudi/components/toast/toast.d.ts.map +1 -1
- package/@smudi/components/toast/toast.js +144 -141
- package/@smudi/react.js +94 -94
- package/@smudi/smudi/icons/metadata.d.ts +9 -9
- package/@smudi/smudi/react.d.ts +3 -2
- package/@smudi/smudi/react.d.ts.map +1 -1
- package/@smudi/styles.css +1 -1
- package/@smudi/types/modular-scale.type.d.ts +1 -1
- package/README.md +33 -0
- package/package.json +11 -10
- package/@smudi/components/stepper/index.js +0 -17
- package/@smudi/components/stepper/step/step-list.js +0 -40
- package/@smudi/components/stepper/step/step-list.module.css.js +0 -7
- package/@smudi/components/stepper/step/step.js +0 -86
- package/@smudi/components/stepper/step/step.module.css.js +0 -10
- package/@smudi/components/stepper/step-content/step-content-list.js +0 -25
- package/@smudi/components/stepper/step-content/step-content-list.module.css.js +0 -7
- package/@smudi/components/stepper/step-content/step-content.js +0 -28
- package/@smudi/components/stepper/step-content/step-content.module.css.js +0 -7
- package/@smudi/components/stepper/stepper-context.js +0 -23
- package/@smudi/components/stepper/stepper.js +0 -62
- package/@smudi/components/stepper/stepper.module.css.js +0 -7
- package/@smudi/components/stepper/use-stepper-state.js +0 -17
|
@@ -1,55 +1,97 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes } from 'react';
|
|
1
|
+
import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export declare const UDILogo: () => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export type HeaderProps = HTMLAttributes<HTMLElement> & {
|
|
4
|
-
teamName?: string;
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Name of the team, shown on the left in the header instead of the UDI
|
|
6
|
+
* logo. Can be a plain string, or a `ReactNode` if the team needs more
|
|
7
|
+
* than plain text (e.g. custom formatting or icons).
|
|
8
|
+
*/
|
|
9
|
+
teamName?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Heading level used for `teamName`. Set this to the level that fits the
|
|
12
|
+
* page's heading hierarchy, so you avoid multiple `<h1>`s on the same
|
|
13
|
+
* page.
|
|
9
14
|
* @default 1
|
|
10
15
|
*/
|
|
11
16
|
teamNameHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* `null`
|
|
18
|
+
* When set, the logo/team name becomes a link to the front page. Set to
|
|
19
|
+
* `true` to link to `/`, or provide your own URL (useful for apps that
|
|
20
|
+
* aren't hosted at the root, or that should link to another domain). Set
|
|
21
|
+
* to `null` or `false` to explicitly turn the link off.
|
|
17
22
|
*/
|
|
18
23
|
homeHref?: string | boolean | null;
|
|
19
24
|
/**
|
|
20
|
-
* `aria-label` for
|
|
21
|
-
*
|
|
25
|
+
* `aria-label` for the link set by `homeHref`, used by screen readers.
|
|
26
|
+
* Does not change the visual content (logo/team name is shown as normal).
|
|
22
27
|
* @default "Til forsiden"
|
|
23
28
|
*/
|
|
24
29
|
ariaLabel?: string;
|
|
30
|
+
/** Maximum width of the header's content area. */
|
|
25
31
|
maxWidth?: CSSProperties["maxWidth"];
|
|
32
|
+
/**
|
|
33
|
+
* Visual style of the header.
|
|
34
|
+
* @default "default"
|
|
35
|
+
*/
|
|
26
36
|
variant?: "default" | "tinted";
|
|
27
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Color palette used by the header.
|
|
39
|
+
* @default "neutral"
|
|
40
|
+
*/
|
|
41
|
+
"data-color"?: "neutral" | "primary";
|
|
28
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Page header showing the UDI logo (or a custom team name) together with
|
|
45
|
+
* navigation content. Use `Header.Content`, `Header.Menu` and
|
|
46
|
+
* `Header.Search` to compose the header's contents.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Header>
|
|
51
|
+
* <Header.Content>
|
|
52
|
+
* <Button variant="tertiary">Home</Button>
|
|
53
|
+
* </Header.Content>
|
|
54
|
+
* </Header>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
29
57
|
export declare const Header: React.ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
30
|
-
teamName?: string;
|
|
31
58
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
59
|
+
* Name of the team, shown on the left in the header instead of the UDI
|
|
60
|
+
* logo. Can be a plain string, or a `ReactNode` if the team needs more
|
|
61
|
+
* than plain text (e.g. custom formatting or icons).
|
|
62
|
+
*/
|
|
63
|
+
teamName?: ReactNode;
|
|
64
|
+
/**
|
|
65
|
+
* Heading level used for `teamName`. Set this to the level that fits the
|
|
66
|
+
* page's heading hierarchy, so you avoid multiple `<h1>`s on the same
|
|
67
|
+
* page.
|
|
35
68
|
* @default 1
|
|
36
69
|
*/
|
|
37
70
|
teamNameHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
38
71
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* `null`
|
|
72
|
+
* When set, the logo/team name becomes a link to the front page. Set to
|
|
73
|
+
* `true` to link to `/`, or provide your own URL (useful for apps that
|
|
74
|
+
* aren't hosted at the root, or that should link to another domain). Set
|
|
75
|
+
* to `null` or `false` to explicitly turn the link off.
|
|
43
76
|
*/
|
|
44
77
|
homeHref?: string | boolean | null;
|
|
45
78
|
/**
|
|
46
|
-
* `aria-label` for
|
|
47
|
-
*
|
|
79
|
+
* `aria-label` for the link set by `homeHref`, used by screen readers.
|
|
80
|
+
* Does not change the visual content (logo/team name is shown as normal).
|
|
48
81
|
* @default "Til forsiden"
|
|
49
82
|
*/
|
|
50
83
|
ariaLabel?: string;
|
|
84
|
+
/** Maximum width of the header's content area. */
|
|
51
85
|
maxWidth?: CSSProperties["maxWidth"];
|
|
86
|
+
/**
|
|
87
|
+
* Visual style of the header.
|
|
88
|
+
* @default "default"
|
|
89
|
+
*/
|
|
52
90
|
variant?: "default" | "tinted";
|
|
53
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Color palette used by the header.
|
|
93
|
+
* @default "neutral"
|
|
94
|
+
*/
|
|
95
|
+
"data-color"?: "neutral" | "primary";
|
|
54
96
|
} & React.RefAttributes<HTMLElement>>;
|
|
55
97
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../components/header/header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../components/header/header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMtE,eAAO,MAAM,OAAO,+CAOnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACtD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM;IAtDjB;;;;OAIG;eACQ,SAAS;IACpB;;;;;OAKG;2BACoB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;IAC5C;;;;;OAKG;eACQ,MAAM,GAAG,OAAO,GAAG,IAAI;IAClC;;;;OAIG;gBACS,MAAM;IAClB,kDAAkD;eACvC,aAAa,CAAC,UAAU,CAAC;IACpC;;;OAGG;cACO,SAAS,GAAG,QAAQ;IAC9B;;;OAGG;mBACY,SAAS,GAAG,SAAS;qCA6IpC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SplitViewProps } from './split-view';
|
|
3
|
+
import { SplitViewPanel, SplitViewPanelProps } from './split-view-panel';
|
|
4
|
+
declare const SplitView: FC<SplitViewProps> & {
|
|
5
|
+
Panel: typeof SplitViewPanel;
|
|
6
|
+
};
|
|
7
|
+
export { SplitView, type SplitViewPanelProps, type SplitViewProps };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../components/layout-components/split-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,KAAK,cAAc,EAA8B,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,QAAA,MAAM,SAAS,EAGT,EAAE,CAAC,cAAc,CAAC,GAAG;IACzB,KAAK,EAAE,OAAO,cAAc,CAAC;CAC9B,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps, KeyboardEvent } from 'react';
|
|
2
|
+
type Props = ComponentProps<"button"> & {
|
|
3
|
+
handleKeyResize: (event: KeyboardEvent) => void;
|
|
4
|
+
handleDragResize: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function SplitViewDivider({ className, handleKeyResize, handleDragResize, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=split-view-divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-view-divider.d.ts","sourceRoot":"","sources":["../../../../components/layout-components/split-view/split-view-divider.tsx"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3D,KAAK,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG;IACtC,eAAe,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,GAAG,IAAI,EACR,EAAE,KAAK,2CAyBP"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import e from "./split-view-divider.module.css.js";
|
|
4
|
+
import { classNames as t } from "../../utils/class-names.js";
|
|
5
|
+
import { ChevronUpDownIcon as a } from "@navikt/aksel-icons";
|
|
6
|
+
function c({
|
|
7
|
+
className: n,
|
|
8
|
+
handleKeyResize: o,
|
|
9
|
+
handleDragResize: r,
|
|
10
|
+
...s
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ i(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
"aria-label": "Resize panels (not relevant for screen reader)",
|
|
16
|
+
...s,
|
|
17
|
+
className: t(e["smudi-split-view-divider"], n),
|
|
18
|
+
onKeyDown: o,
|
|
19
|
+
onMouseDown: r,
|
|
20
|
+
type: "button",
|
|
21
|
+
children: /* @__PURE__ */ i(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
className: t(
|
|
25
|
+
"ds-button smudi-button smudi-button--secondary-tinted",
|
|
26
|
+
e["smudi-split-view-divider-indicator"]
|
|
27
|
+
),
|
|
28
|
+
"data-icon": "true",
|
|
29
|
+
"data-size": "xs",
|
|
30
|
+
"aria-hidden": !0,
|
|
31
|
+
children: /* @__PURE__ */ i(
|
|
32
|
+
a,
|
|
33
|
+
{
|
|
34
|
+
className: e["smudi-split-view-divider-indicator-icon"]
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
c as SplitViewDivider
|
|
44
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const i = {
|
|
3
|
+
"smudi-split-view-divider": "_smudi-split-view-divider_ngvqb_2",
|
|
4
|
+
"smudi-split-view-divider-indicator": "_smudi-split-view-divider-indicator_ngvqb_12",
|
|
5
|
+
"smudi-split-view-divider-indicator-icon": "_smudi-split-view-divider-indicator-icon_ngvqb_44"
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
i as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export type SplitViewPanelProps = PropsWithChildren & {
|
|
3
|
+
/**
|
|
4
|
+
* The starting width in percentage.
|
|
5
|
+
* If none are passed all widths will be divided equally.
|
|
6
|
+
*/
|
|
7
|
+
defaultWidth?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The minWidth in percentage.
|
|
10
|
+
*/
|
|
11
|
+
minWidth?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The maxWidth in percentage.
|
|
14
|
+
*/
|
|
15
|
+
maxWidth?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Defines a single resizable panel inside a `SplitView`. Its `children` are
|
|
19
|
+
* rendered as-is; the width props are read by `SplitView` (via the
|
|
20
|
+
* `useResize` hook) to compute the panel's starting/min/max width.
|
|
21
|
+
*/
|
|
22
|
+
export declare function SplitViewPanel({ children }: SplitViewPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=split-view-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-view-panel.d.ts","sourceRoot":"","sources":["../../../../components/layout-components/split-view/split-view-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACpD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAE/D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
export type SplitViewProps = ComponentProps<"div"> & {
|
|
3
|
+
/**
|
|
4
|
+
* Emits a list of the current panel widths.
|
|
5
|
+
* This can be useful if you want to store them somewhere (e.g localStorage)
|
|
6
|
+
*/
|
|
7
|
+
onResizeChange?: (widths: number[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Divider color palette. Defaults to `primary`.
|
|
10
|
+
*/
|
|
11
|
+
"data-color"?: "primary" | "neutral";
|
|
12
|
+
};
|
|
13
|
+
export declare const SplitView: React.ForwardRefExoticComponent<Omit<SplitViewProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
//# sourceMappingURL=split-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-view.d.ts","sourceRoot":"","sources":["../../../../components/layout-components/split-view/split-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,OAAO,CAAC;AAOlE,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACnD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,SAAS,oGA0DrB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as v, Fragment as y } from "react";
|
|
4
|
+
import r from "./split-view.module.css.js";
|
|
5
|
+
import { SplitViewDivider as D } from "./split-view-divider.js";
|
|
6
|
+
import { useResize as g } from "./use-resize.js";
|
|
7
|
+
import { classNames as x } from "../../utils/class-names.js";
|
|
8
|
+
import { combineRefs as z } from "../../../utils/combine-refs.js";
|
|
9
|
+
const $ = v(
|
|
10
|
+
/**
|
|
11
|
+
* Divides its content into resizable panels arranged side by side, with a
|
|
12
|
+
* draggable/keyboard-operable divider between each pair. Use
|
|
13
|
+
* `SplitView.Panel` to define each panel's starting/min/max width.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <SplitView>
|
|
18
|
+
* <SplitView.Panel defaultWidth={30}>Sidebar</SplitView.Panel>
|
|
19
|
+
* <SplitView.Panel>Content</SplitView.Panel>
|
|
20
|
+
* </SplitView>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function({
|
|
24
|
+
onResizeChange: s,
|
|
25
|
+
children: t,
|
|
26
|
+
className: m,
|
|
27
|
+
"data-color": n = "primary",
|
|
28
|
+
...a
|
|
29
|
+
}, l) {
|
|
30
|
+
const { onKeyDown: p, onMouseDown: c, containerRef: d, panels: i, widths: f } = g({
|
|
31
|
+
onResizeChange: s,
|
|
32
|
+
children: t
|
|
33
|
+
}), w = z(d, l);
|
|
34
|
+
return /* @__PURE__ */ o(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
...a,
|
|
38
|
+
"data-color": n,
|
|
39
|
+
className: x(r["smudi-split-view"], m),
|
|
40
|
+
ref: w,
|
|
41
|
+
children: i.map((h, e) => (
|
|
42
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Will not change
|
|
43
|
+
/* @__PURE__ */ u(y, { children: [
|
|
44
|
+
/* @__PURE__ */ o(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
className: r["smudi-split-view-panel-wrapper"],
|
|
48
|
+
style: { width: `${f[e]}%` },
|
|
49
|
+
children: h
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
e < i.length - 1 && /* @__PURE__ */ o(
|
|
53
|
+
D,
|
|
54
|
+
{
|
|
55
|
+
handleDragResize: () => c(e),
|
|
56
|
+
handleKeyResize: (R) => p(R, e)
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] }, e)
|
|
60
|
+
))
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
export {
|
|
66
|
+
$ as SplitView
|
|
67
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { KeyboardEvent, ReactElement } from 'react';
|
|
2
|
+
import { SplitViewProps } from './split-view';
|
|
3
|
+
import { SplitViewPanelProps } from './split-view-panel';
|
|
4
|
+
type SplitViewPanelComponent = ReactElement<SplitViewPanelProps>;
|
|
5
|
+
/**
|
|
6
|
+
* Computes each panel's initial width percentage.
|
|
7
|
+
* Panels with an explicit `defaultWidth` keep it; any remaining percentage
|
|
8
|
+
* is split evenly across the panels that didn't specify one.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDefaultWidths(panels: SplitViewPanelComponent[]): number[];
|
|
11
|
+
/**
|
|
12
|
+
* Recalculates the widths of a panel pair (at `index` and `index + 1`) after
|
|
13
|
+
* a drag/keyboard resize, keeping their combined width constant and
|
|
14
|
+
* respecting each panel's min/max width constraints.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getClampedWidths(widths: number[], index: number, proposedLeftWidth: number, panels: SplitViewPanelComponent[]): number[];
|
|
17
|
+
/**
|
|
18
|
+
* Get whether the changing width on keydown should be positive or negative
|
|
19
|
+
*/
|
|
20
|
+
export declare function getKeyDelta(e: KeyboardEvent): number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Manages resizable panel state: widths, drag-to-resize, and keyboard resize.
|
|
23
|
+
* Returns the parsed panel elements alongside handlers to wire up to the
|
|
24
|
+
* container and each panel's resize handle.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useResize({ children, onResizeChange }: SplitViewProps): {
|
|
27
|
+
panels: SplitViewPanelComponent[];
|
|
28
|
+
widths: number[];
|
|
29
|
+
onKeyDown: (e: KeyboardEvent, index: number) => void;
|
|
30
|
+
onMouseDown: (index: number) => void;
|
|
31
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=use-resize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resize.d.ts","sourceRoot":"","sources":["../../../../components/layout-components/split-view/use-resize.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,YAAY,EAIlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQ9D,KAAK,uBAAuB,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,uBAAuB,EAAE,YAYjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,uBAAuB,EAAE,YAwBlC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,aAAa,sBAI3C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,cAAc;;;mBA+D9C,aAAa,SAAS,MAAM;yBAzCtB,MAAM;;EAmDnC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Children as I, useState as b, useRef as g, useEffect as w } from "react";
|
|
3
|
+
const S = 1, T = 10, h = 100, m = 5, L = h - m;
|
|
4
|
+
function A(n) {
|
|
5
|
+
const t = n.reduce(
|
|
6
|
+
(e, { props: u }) => e + (u.defaultWidth ?? 0),
|
|
7
|
+
0
|
|
8
|
+
), c = h - t, o = n.filter(
|
|
9
|
+
({ props: e }) => e.defaultWidth == null
|
|
10
|
+
).length, s = o > 0 ? c / o : 0;
|
|
11
|
+
return n.map(({ props: e }) => e.defaultWidth ?? s);
|
|
12
|
+
}
|
|
13
|
+
function M(n, t, c, o) {
|
|
14
|
+
const s = [...n], e = s[t] + s[t + 1], u = o[t].props.minWidth ?? m, l = o[t].props.maxWidth ?? L, a = o[t + 1].props.minWidth ?? m, r = o[t + 1].props.maxWidth ?? L, d = Math.max(
|
|
15
|
+
u,
|
|
16
|
+
e - r
|
|
17
|
+
), i = Math.min(
|
|
18
|
+
l,
|
|
19
|
+
e - a
|
|
20
|
+
);
|
|
21
|
+
return s[t] = Math.min(
|
|
22
|
+
i,
|
|
23
|
+
Math.max(d, c)
|
|
24
|
+
), s[t + 1] = e - s[t], s;
|
|
25
|
+
}
|
|
26
|
+
function P(n) {
|
|
27
|
+
if (n.key !== "ArrowLeft" && n.key !== "ArrowRight") return;
|
|
28
|
+
const t = n.shiftKey ? T : S;
|
|
29
|
+
return n.key === "ArrowLeft" ? -t : t;
|
|
30
|
+
}
|
|
31
|
+
function k({ children: n, onResizeChange: t }) {
|
|
32
|
+
const c = I.toArray(n).filter(
|
|
33
|
+
(r) => typeof r == "object" && r !== null && "props" in r
|
|
34
|
+
), [o, s] = b(A(c)), e = g(null), u = g(null);
|
|
35
|
+
w(() => {
|
|
36
|
+
t?.(o);
|
|
37
|
+
}, [o]);
|
|
38
|
+
function l(r) {
|
|
39
|
+
u.current = r, document.body.style.cursor = "ew-resize", document.body.style.userSelect = "none";
|
|
40
|
+
const d = o;
|
|
41
|
+
let i = null;
|
|
42
|
+
const f = ({ clientX: p }) => {
|
|
43
|
+
if (u.current === null || !e.current) return;
|
|
44
|
+
i === null && (i = p);
|
|
45
|
+
const y = u.current, E = e.current.offsetWidth, v = (p - i) / E * h, D = d[y] + v;
|
|
46
|
+
s(
|
|
47
|
+
(R) => M(R, y, D, c)
|
|
48
|
+
);
|
|
49
|
+
}, W = () => {
|
|
50
|
+
u.current = null, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", W);
|
|
51
|
+
};
|
|
52
|
+
document.addEventListener("mousemove", f), document.addEventListener("mouseup", W);
|
|
53
|
+
}
|
|
54
|
+
function a(r, d) {
|
|
55
|
+
const i = P(r);
|
|
56
|
+
i && (r.preventDefault(), s(
|
|
57
|
+
(f) => M(f, d, f[d] + i, c)
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
return { panels: c, widths: o, onKeyDown: a, onMouseDown: l, containerRef: e };
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
M as getClampedWidths,
|
|
64
|
+
A as getDefaultWidths,
|
|
65
|
+
P as getKeyDelta,
|
|
66
|
+
k as useResize
|
|
67
|
+
};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { Select as SelectRoot, SelectProps } from '@digdir/designsystemet-react';
|
|
2
|
+
declare module "react/jsx-runtime" {
|
|
3
|
+
namespace JSX {
|
|
4
|
+
interface IntrinsicElements {
|
|
5
|
+
selectedcontent: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
2
9
|
type Select = typeof SelectRoot;
|
|
3
10
|
declare const SelectComponent: Select;
|
|
4
11
|
export type { SelectProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../components/select/select.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../components/select/select.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,IAAI,UAAU,EACpB,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CACtC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,WAAW,CACZ,CAAC;SACH;KACF;CACF;AAED,KAAK,MAAM,GAAG,OAAO,UAAU,CAAC;AA0BhC,QAAA,MAAM,eAAe,EAAE,MAGA,CAAC;AAIxB,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,OAAO,EAAE,eAAe,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as p } from "react";
|
|
4
|
+
import { Select as t } from "@digdir/designsystemet-react";
|
|
5
|
+
const s = p(function({ children: n, ...o }, c) {
|
|
6
|
+
return /* @__PURE__ */ e("span", { className: "smudi-select-wrapper", children: /* @__PURE__ */ r(t, { ...o, ref: c, children: [
|
|
7
|
+
/* @__PURE__ */ e("button", { type: "button", tabIndex: -1, children: /* @__PURE__ */ e("selectedcontent", {}) }),
|
|
8
|
+
n
|
|
9
|
+
] }) });
|
|
10
|
+
}), l = Object.assign(s, {
|
|
11
|
+
Option: t.Option,
|
|
12
|
+
Optgroup: t.Optgroup
|
|
6
13
|
});
|
|
7
|
-
|
|
14
|
+
l.displayName = "Select";
|
|
8
15
|
export {
|
|
9
|
-
|
|
16
|
+
l as Select
|
|
10
17
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { SuggestionListProps } from '@digdir/designsystemet-react';
|
|
2
2
|
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* List of suggested options shown inside a `Suggestion`. Automatically
|
|
5
|
+
* renders a "select all" option when `Suggestion`'s `showToggleAll` is set.
|
|
6
|
+
*/
|
|
3
7
|
export declare const SmudiSuggestionList: ForwardRefExoticComponent<SuggestionListProps & RefAttributes<HTMLDataListElement>>;
|
|
4
8
|
//# sourceMappingURL=smudi-suggestion-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smudi-suggestion-list.d.ts","sourceRoot":"","sources":["../../../../components/suggestion/smudi-suggestion/smudi-suggestion-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAc,yBAAyB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI7E,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CACzD,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CA+BzD,CAAC"}
|
|
1
|
+
{"version":3,"file":"smudi-suggestion-list.d.ts","sourceRoot":"","sources":["../../../../components/suggestion/smudi-suggestion/smudi-suggestion-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAc,yBAAyB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI7E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CACzD,mBAAmB,GAAG,aAAa,CAAC,mBAAmB,CAAC,CA+BzD,CAAC"}
|
|
@@ -30,8 +30,25 @@ export type SuggestionComponentProps = {
|
|
|
30
30
|
* must provide them in the item prop.
|
|
31
31
|
*/
|
|
32
32
|
showToggleAll?: boolean | string;
|
|
33
|
+
/** The items that can be selected. */
|
|
33
34
|
items?: SuggestionItem[];
|
|
34
35
|
} & Omit<DigDirSuggestionProps, "multiple" | "selected" | "onSelectedChange"> & ToggleAllTypes;
|
|
36
|
+
/**
|
|
37
|
+
* Autocomplete input that suggests matching items as the user types. Wraps
|
|
38
|
+
* Digdir's experimental `Suggestion` and adds an optional "select all"
|
|
39
|
+
* toggle for multi-select usage.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Suggestion items={items} onSelectedChange={setSelected}>
|
|
44
|
+
* <Suggestion.Input aria-label="Search" />
|
|
45
|
+
* <Suggestion.Clear />
|
|
46
|
+
* <Suggestion.List>
|
|
47
|
+
* <Suggestion.Empty>No matches</Suggestion.Empty>
|
|
48
|
+
* </Suggestion.List>
|
|
49
|
+
* </Suggestion>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
35
52
|
export declare const SmudiSuggestion: React.FC<SuggestionComponentProps>;
|
|
36
53
|
export {};
|
|
37
54
|
//# sourceMappingURL=smudi-suggestion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smudi-suggestion.d.ts","sourceRoot":"","sources":["../../../../components/suggestion/smudi-suggestion/smudi-suggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"smudi-suggestion.d.ts","sourceRoot":"","sources":["../../../../components/suggestion/smudi-suggestion/smudi-suggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,eAAe,IAAI,qBAAqB,EAC9C,MAAM,8BAA8B,CAAC;AAKtC,eAAO,MAAM,gCAAgC,+BAA+B,CAAC;AAE7E,KAAK,cAAc,GACf;IACE,QAAQ,EAAE,IAAI,CAAC;IACf,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,IAAI,CAAC;IAC9C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CACtD,GACD;IACE,QAAQ,EAAE,IAAI,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,GAAG,IAAI,CAAC;IAC9C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CACtD,GACD;IACE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC;IAC1C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CACpD,CAAC;AAEN,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,sCAAsC;IACtC,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;CAC1B,GAAG,IAAI,CAAC,qBAAqB,EAAE,UAAU,GAAG,UAAU,GAAG,kBAAkB,CAAC,GAC3E,cAAc,CAAC;AAcjB;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAoF9D,CAAC"}
|