@danske/sapphire-react-lab 0.98.0 → 0.99.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbItem.js","sources":["../../../../src/Breadcrumbs/src/BreadcrumbItem.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport {\n Breadcrumb as RACBreadcrumb,\n BreadcrumbProps as RACBreadcrumbProps,\n BreadcrumbRenderProps as RACBreadcrumbRenderProps,\n} from 'react-aria-components';\nimport {\n useSapphireStyleProps,\n useThemeCheck,\n SapphireStyleProps,\n Typography,\n} from '@danske/sapphire-react';\nimport { BreadcrumbsSeparator } from './BreadcrumbsSeparator';\nimport clsx from 'clsx';\nimport styles from '@danske/sapphire-css/components/breadcrumbs/breadcrumbs.module.css';\nimport { BreadcrumbsContext } from './Breadcrumbs';\n\nexport const BreadcrumbItemContext = createContext<\n Pick<RACBreadcrumbRenderProps, 'isDisabled'>\n>({\n isDisabled: false,\n});\n\nexport type BreadcrumbItemProps = {\n isDisabled?: boolean;\n} & SapphireStyleProps &\n Pick<RACBreadcrumbProps, 'children'>;\n\nexport const BreadcrumbItem = ({\n children,\n isDisabled: individualDisabled = false,\n ...props\n}: BreadcrumbItemProps): JSX.Element => {\n useThemeCheck();\n const { styleProps } = useSapphireStyleProps(props);\n const { size } = useContext(BreadcrumbsContext);\n\n return (\n <RACBreadcrumb\n className={clsx(styles['sapphire-breadcrumbs__item'])}\n style={{ ...styleProps.style }}\n >\n {({ isCurrent, isDisabled }) => (\n <BreadcrumbItemContext.Provider\n value={{ isDisabled: isDisabled || individualDisabled }}\n >\n {isCurrent ? (\n <Typography.Body\n elementType=\"span\"\n isSemibold\n size={size === 'lg' ? 'md' : size === 'md' ? 'sm' : 'xs'}\n >\n {children}\n </Typography.Body>\n ) : (\n children\n )}\n {!isCurrent && <BreadcrumbsSeparator />}\n </BreadcrumbItemContext.Provider>\n )}\n </R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A,CAAA;AAAA;;;;"}
@@ -0,0 +1,53 @@
1
+ import React, { forwardRef, useContext } from 'react';
2
+ import { useThemeCheck, useSapphireStyleProps, Button } from '@danske/sapphire-react';
3
+ import { BreadcrumbsContext } from './Breadcrumbs.js';
4
+ import { BreadcrumbItemContext } from './BreadcrumbItem.js';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __defProps = Object.defineProperties;
8
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
9
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ const BreadcrumbItemLink = forwardRef(function BreadcrumbItemLink2(_a, ref) {
38
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
39
+ useThemeCheck();
40
+ const { styleProps } = useSapphireStyleProps(props);
41
+ const { size } = useContext(BreadcrumbsContext);
42
+ const { isDisabled } = useContext(BreadcrumbItemContext);
43
+ return /* @__PURE__ */ React.createElement(Button, __spreadProps(__spreadValues(__spreadValues({}, props), styleProps), {
44
+ ref,
45
+ size,
46
+ variant: "tertiary",
47
+ isDisabled
48
+ }), children);
49
+ });
50
+ BreadcrumbItemLink.displayName = "BreadcrumbItemLink";
51
+
52
+ export { BreadcrumbItemLink };
53
+ //# sourceMappingURL=BreadcrumbItemLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbItemLink.js","sources":["../../../../src/Breadcrumbs/src/BreadcrumbItemLink.tsx"],"sourcesContent":["import React, { useContext, forwardRef } from 'react';\nimport {\n Button,\n ButtonProps,\n SapphireStyleProps,\n useSapphireStyleProps,\n useThemeCheck,\n} from '@danske/sapphire-react';\nimport { FocusableRef } from '@react-types/shared';\nimport { BreadcrumbsContext } from './Breadcrumbs';\nimport { BreadcrumbItemContext } from './BreadcrumbItem';\n\nexport type BreadcrumbItemLinkProps = Omit<\n ButtonProps<'a'>,\n 'variant' | 'iconAlign'\n> &\n SapphireStyleProps;\n\nexport const BreadcrumbItemLink = forwardRef(function BreadcrumbItemLink(\n { children, ...props }: BreadcrumbItemLinkProps,\n ref: FocusableRef<HTMLAnchorElement>\n): JSX.Element {\n useThemeCheck();\n const { styleProps } = useSapphireStyleProps(props);\n const { size } = useContext(BreadcrumbsContext);\n const { isDisabled } = useContext(BreadcrumbItemContext);\n\n return (\n <Button\n {...props}\n {...styleProps}\n ref={ref}\n size={size}\n variant=\"tertiary\"\n isDisabled={isDisabled}\n >\n {children}\n </Button>\n );\n});\n\nBreadcrumbItemLink.displayName = 'BreadcrumbItemLink';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,kBAAqB,GAAA,UAAA,CAAW,SAC3C,mBAAA,CAAA,EAAA,EACA,GACa,EAAA;AAFb,EAAA,IAAA,EAAA,GAAA,EAAA,EAAE,EAAF,QAAA,EAAA,GAAA,EAAA,EAAe,KAAf,GAAA,SAAA,CAAA,EAAA,EAAe,CAAb,UAAA,CAAA,CAAA,CAAA;AAGF,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA,EAAE,eAAe,qBAAsB,CAAA,KAAA,CAAA,CAAA;AAC7C,EAAM,MAAA,EAAE,SAAS,UAAW,CAAA,kBAAA,CAAA,CAAA;AAC5B,EAAM,MAAA,EAAE,eAAe,UAAW,CAAA,qBAAA,CAAA,CAAA;AAElC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,MAAA,EAAD,aACM,CAAA,cAAA,CAAA,cAAA,CAAA,EAAA,EAAA,KAAA,CAAA,EACA,UAFN,CAAA,EAAA;AAAA,IAGE,GAAA;AAAA,IACA,IAAA;AAAA,IACA,OAAQ,EAAA,UAAA;AAAA,IACR,UAAA;AAAA,GAEC,CAAA,EAAA,QAAA,CAAA,CAAA;AAAA,CAAA,EAAA;AAKP,kBAAA,CAAmB,WAAc,GAAA,oBAAA;;;;"}
@@ -0,0 +1,71 @@
1
+ import React, { createContext, useRef } from 'react';
2
+ import clsx from 'clsx';
3
+ import styles from '@danske/sapphire-css/components/breadcrumbs/breadcrumbs.module.css';
4
+ import { useThemeCheck, useSapphireStyleProps } from '@danske/sapphire-react';
5
+ import { Breadcrumbs as Breadcrumbs$1 } from 'react-aria-components';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __defProps = Object.defineProperties;
9
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
38
+ const BreadcrumbsContext = createContext({ size: "md" });
39
+ const Breadcrumbs = (_a) => {
40
+ var _b = _a, {
41
+ size = "md",
42
+ children,
43
+ maxWidth
44
+ } = _b, props = __objRest(_b, [
45
+ "size",
46
+ "children",
47
+ "maxWidth"
48
+ ]);
49
+ useThemeCheck();
50
+ const { styleProps } = useSapphireStyleProps(props);
51
+ const containerRef = useRef(null);
52
+ const breadcrumbRef = useRef(null);
53
+ return /* @__PURE__ */ React.createElement(BreadcrumbsContext.Provider, {
54
+ value: { size }
55
+ }, /* @__PURE__ */ React.createElement("div", {
56
+ ref: containerRef,
57
+ style: __spreadProps(__spreadValues({}, styleProps.style), {
58
+ maxWidth,
59
+ display: "flex"
60
+ })
61
+ }, /* @__PURE__ */ React.createElement(Breadcrumbs$1, __spreadProps(__spreadValues({}, props), {
62
+ ref: breadcrumbRef,
63
+ className: clsx(styles["sapphire-breadcrumbs"], {
64
+ [styles["sapphire-breadcrumbs--sm"]]: size === "sm",
65
+ [styles["sapphire-breadcrumbs--lg"]]: size === "lg"
66
+ })
67
+ }), children)));
68
+ };
69
+
70
+ export { Breadcrumbs, BreadcrumbsContext };
71
+ //# sourceMappingURL=Breadcrumbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumbs.js","sources":["../../../../src/Breadcrumbs/src/Breadcrumbs.tsx"],"sourcesContent":["import React, { createContext, useRef } from 'react';\nimport clsx from 'clsx';\nimport styles from '@danske/sapphire-css/components/breadcrumbs/breadcrumbs.module.css';\nimport {\n SapphireStyleProps,\n useThemeCheck,\n useSapphireStyleProps,\n} from '@danske/sapphire-react';\nimport {\n Breadcrumbs as RACBreadcrumbs,\n BreadcrumbsProps as RACBreadcrumbsProps,\n} from 'react-aria-components';\nimport { BreadcrumbItemProps } from './BreadcrumbItem';\n\nexport type BreadcrumbsProps<T extends object> = Pick<\n RACBreadcrumbsProps<T>,\n 'aria-label' | 'isDisabled'\n> & {\n children: React.ReactElement<BreadcrumbItemProps>[];\n /**\n * The size of the breadcrumbs component.\n *\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n /**\n * Maximum width for the breadcrumbs container. When content overflows,\n * it will show an overflow menu with the first and last items.\n */\n maxWidth?: React.CSSProperties['maxWidth'];\n} & SapphireStyleProps;\n\nexport const BreadcrumbsContext = createContext<{\n size: 'sm' | 'md' | 'lg';\n}>({ size: 'md' });\n\n/**\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nexport const Breadcrumbs = <T extends object>({\n size = 'md',\n children,\n maxWidth,\n ...props\n}: BreadcrumbsProps<T>): JSX.Element => {\n useThemeCheck();\n const { styleProps } = useSapphireStyleProps(props);\n const containerRef = useRef<HTMLDivElement>(null);\n const breadcrumbRef = useRef<HTMLOListElement>(null);\n\n // TODO UC-4667 - re-enable computation of overflow\n // const { shouldRenderOverflow, maxVisibleTailChildren } =\n // useBreadcrumbThreshold(children, containerRef, breadcrumbRef);\n\n return (\n <BreadcrumbsContext.Provider value={{ size }}>\n <div\n ref={containerRef}\n style={{\n ...styleProps.style,\n maxWidth,\n display: 'flex',\n }}\n >\n <RACBreadcrumbs\n {...props}\n ref={breadcrumbRef}\n className={clsx(styles['sapphire-breadcrumbs'], {\n [styles['sapphire-breadcrumbs--sm']]: size === 'sm',\n [styles['sapphire-breadcrumbs--lg']]: size === 'lg',\n })}\n >\n {/* TODO UC-4667 - do not manipulate children directly */}\n {/* {shouldRenderOverflow ? (\n <>\n {children[0]}\n {children.length > 2 ? (\n <OverflowBreadcrumbItem size={size}>\n {children.slice(1, children.length - maxVisibleTailChildren)}\n </OverflowBreadcrumbItem>\n ) : null}\n {children\n .slice(\n children.length -\n (maxVisibleTailChildren > 1 ? maxVisibleTailChildren : 1)\n )\n .map((child) => (\n <React.Fragment key={child.key}>{child}</React.Fragment>\n ))}\n </>\n ) : (\n children\n )} */}\n {children}\n </RACBreadcrumbs>\n </div>\n </BreadcrumbsContext.Provider>\n );\n};\n"],"names":["RACBreadcrumbs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCa,MAAA,kBAAA,GAAqB,aAE/B,CAAA,EAAE,IAAM,EAAA,IAAA,EAAA,EAAA;AAKE,MAAA,WAAA,GAAc,CAAmB,EAKN,KAAA;AALM,EAC5C,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAO,IAAA,GAAA,IAAA;AAAA,IACP,QAAA;AAAA,IACA,QAAA;AAAA,GAH4C,GAAA,EAAA,EAIzC,kBAJyC,EAIzC,EAAA;AAAA,IAHH,MAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,GAAA,CAAA,CAAA;AAGA,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA,EAAE,eAAe,qBAAsB,CAAA,KAAA,CAAA,CAAA;AAC7C,EAAA,MAAM,eAAe,MAAuB,CAAA,IAAA,CAAA,CAAA;AAC5C,EAAA,MAAM,gBAAgB,MAAyB,CAAA,IAAA,CAAA,CAAA;AAM/C,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,mBAAmB,QAApB,EAAA;AAAA,IAA6B,OAAO,EAAE,IAAA,EAAA;AAAA,GAAA,sCACnC,KAAD,EAAA;AAAA,IACE,GAAK,EAAA,YAAA;AAAA,IACL,KAAA,EAAO,aACF,CAAA,cAAA,CAAA,EAAA,EAAA,UAAA,CAAW,KADT,CAAA,EAAA;AAAA,MAEL,QAAA;AAAA,MACA,OAAS,EAAA,MAAA;AAAA,KAAA,CAAA;AAAA,GAGX,kBAAA,KAAA,CAAA,aAAA,CAACA,aAAD,EAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EACM,KADN,CAAA,EAAA;AAAA,IAEE,GAAK,EAAA,aAAA;AAAA,IACL,SAAA,EAAW,IAAK,CAAA,MAAA,CAAO,sBAAyB,CAAA,EAAA;AAAA,MAC7C,CAAA,MAAA,CAAO,8BAA8B,IAAS,KAAA,IAAA;AAAA,MAC9C,CAAA,MAAA,CAAO,8BAA8B,IAAS,KAAA,IAAA;AAAA,KAAA,CAAA;AAAA,GAwBhD,CAAA,EAAA,QAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
@@ -0,0 +1,20 @@
1
+ import clsx from 'clsx';
2
+ import React, { useContext } from 'react';
3
+ import styles from '@danske/sapphire-css/components/breadcrumbs/breadcrumbs.module.css';
4
+ import { ChevronRight } from '@danske/sapphire-icons/react';
5
+ import { Icon } from '@danske/sapphire-react';
6
+ import { BreadcrumbsContext } from './Breadcrumbs.js';
7
+
8
+ const BreadcrumbsSeparator = () => {
9
+ const { size } = useContext(BreadcrumbsContext);
10
+ const iconSize = size === "lg" ? "md" : "sm";
11
+ return /* @__PURE__ */ React.createElement("span", {
12
+ className: clsx(styles["sapphire-breadcrumbs__separator"]),
13
+ "aria-hidden": "true"
14
+ }, /* @__PURE__ */ React.createElement(Icon, {
15
+ size: iconSize
16
+ }, /* @__PURE__ */ React.createElement(ChevronRight, null)));
17
+ };
18
+
19
+ export { BreadcrumbsSeparator };
20
+ //# sourceMappingURL=BreadcrumbsSeparator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbsSeparator.js","sources":["../../../../src/Breadcrumbs/src/BreadcrumbsSeparator.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport styles from '@danske/sapphire-css/components/breadcrumbs/breadcrumbs.module.css';\nimport { ChevronRight } from '@danske/sapphire-icons/react';\nimport { Icon } from '@danske/sapphire-react';\nimport { BreadcrumbsContext } from './Breadcrumbs';\n\nexport const BreadcrumbsSeparator = (): JSX.Element => {\n const { size } = useContext(BreadcrumbsContext);\n\n // Based on the design\n const iconSize = size === 'lg' ? 'md' : 'sm';\n\n return (\n <span\n className={clsx(styles['sapphire-breadcrumbs__separator'])}\n aria-hidden=\"true\"\n >\n <Icon size={iconSize}>\n <ChevronRight />\n </Icon>\n </span>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAOO,MAAM,uBAAuB,MAAmB;AACrD,EAAM,MAAA,EAAE,SAAS,UAAW,CAAA,kBAAA,CAAA,CAAA;AAG5B,EAAM,MAAA,QAAA,GAAW,IAAS,KAAA,IAAA,GAAO,IAAO,GAAA,IAAA,CAAA;AAExC,EAAA,2CACG,MAAD,EAAA;AAAA,IACE,SAAA,EAAW,KAAK,MAAO,CAAA,iCAAA,CAAA,CAAA;AAAA,IACvB,aAAY,EAAA,MAAA;AAAA,GAAA,sCAEX,IAAD,EAAA;AAAA,IAAM,IAAM,EAAA,QAAA;AAAA,GAAA,sCACT,YAAD,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
@@ -101,7 +101,9 @@ const FileDropzone = React.forwardRef(function DropzoneWrapper(props, forwardedR
101
101
  className: clsx(styles["sapphire-dropzone__content"])
102
102
  }, /* @__PURE__ */ React.createElement("div", {
103
103
  className: clsx(styles["sapphire-dropzone__icon"])
104
- }, /* @__PURE__ */ React.createElement(Icon, null, /* @__PURE__ */ React.createElement(Upload, null))), /* @__PURE__ */ React.createElement("div", {
104
+ }, /* @__PURE__ */ React.createElement(Icon, {
105
+ size: "lg"
106
+ }, /* @__PURE__ */ React.createElement(Upload, null))), /* @__PURE__ */ React.createElement("div", {
105
107
  className: clsx(styles["sapphire-dropzone__heading"])
106
108
  }, /* @__PURE__ */ React.createElement(Typography.Heading, {
107
109
  level: 6
@@ -109,7 +111,8 @@ const FileDropzone = React.forwardRef(function DropzoneWrapper(props, forwardedR
109
111
  id: paragraphId,
110
112
  className: clsx(styles["sapphire-dropzone__paragraph"])
111
113
  }, /* @__PURE__ */ React.createElement(Typography.Body, {
112
- size: "sm"
114
+ size: "sm",
115
+ color: "secondary"
113
116
  }, renderInstruction(isDropping)))))));
114
117
  });
115
118
 
@@ -1 +1 @@
1
- {"version":3,"file":"FileDropzone.js","sources":["../../../../src/FileDropzone/src/FileDropzone.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport clsx from 'clsx';\nimport {\n Typography,\n Icon,\n SapphireStyleProps,\n useButton,\n useSapphireStyleProps,\n} from '@danske/sapphire-react';\nimport styles from '@danske/sapphire-css/components/dropzone/dropzone.module.css';\nimport { Upload } from '@danske/sapphire-icons/react';\nimport { HoverProps, Pressable, useHover } from '@react-aria/interactions';\nimport { mergeProps, useId, useObjectRef } from '@react-aria/utils';\nimport { FileSelectProps, FileTrigger } from './FileTrigger';\nimport { DropOptions, useClipboard, useDrop } from '@react-aria/dnd';\nimport { convertFileListToFileDropItems } from './utils';\nimport { useFocusRing } from '@react-aria/focus';\nimport { AriaLabelingProps } from '@react-types/shared';\nimport { useMessageFormatter } from '@react-aria/i18n';\nimport intlMessages from '../i18n';\n\nexport interface FileDropzoneProps\n extends SapphireStyleProps,\n Pick<\n DropOptions,\n | 'getDropOperation'\n | 'onDropEnter'\n | 'onDropActivate'\n | 'onDropMove'\n | 'onDropExit'\n | 'onDrop'\n >,\n HoverProps,\n FileSelectProps,\n // TODO when moving to \"core\", use types under `types.ts` instead of plain strings\n Pick<\n AriaLabelingProps,\n 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-details'\n > {\n /**\n * Whether the dropzone has an error\n * @default false\n */\n hasError?: boolean;\n /**\n * The body text of the dropzone which can contain the instructions for the files to be uploaded.\n * Can be rendered differently based on the `isDropping` parameter, which is true if a file is about to be dropped in the zone.\n * @param isDropping - boolean that marks whether a payload is about to be dropped in the dropzone.\n */\n renderInstruction: (isDropping: boolean) => string;\n /**\n * Function that is called when the file select is opened on press, before any file is selected.\n * @default \"() => null\"\n */\n onFileSelectOpen?: () => void;\n}\n\nexport const FileDropzone = React.forwardRef(function DropzoneWrapper(\n props: FileDropzoneProps,\n forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n const {\n isDisabled = false,\n hasError,\n renderInstruction,\n onFileSelectOpen = () => null,\n acceptedFileTypes,\n allowsMultiple,\n onDrop = () => null,\n getDropOperation = () => 'copy',\n } = props;\n\n const id = useId();\n const paragraphId = props['aria-label'] ? undefined : id;\n const format = useMessageFormatter(intlMessages);\n const pressableRef = useObjectRef(forwardedRef);\n const { hoverProps, isHovered } = useHover({ isDisabled });\n const { styleProps } = useSapphireStyleProps(props);\n const { dropProps, isDropTarget: isDropping } = useDrop({\n ...props,\n ref: pressableRef,\n hasDropButton: true,\n isDisabled,\n getDropOperation,\n });\n const { buttonProps, isPressed } = useButton(\n { elementType: 'div' },\n pressableRef as React.RefObject<Element>\n );\n const { focusProps, isFocusVisible } = useFocusRing();\n\n const { clipboardProps } = useClipboard({\n isDisabled,\n onPaste: (items) =>\n onDrop({\n type: 'drop',\n items,\n x: 0,\n y: 0,\n dropOperation: 'copy',\n }),\n });\n\n const ariaLabel: string = props['aria-label'] || 'Dropzone';\n\n const onFileTriggerSelect = (files: FileList | null) => {\n onDrop({\n type: 'drop',\n items: convertFileListToFileDropItems(files),\n x: 0,\n y: 0,\n dropOperation: 'copy',\n });\n };\n\n return (\n <FileTrigger\n acceptedFileTypes={acceptedFileTypes}\n allowsMultiple={allowsMultiple}\n onSelect={onFileTriggerSelect}\n isDisabled={isDisabled}\n >\n <Pressable ref={pressableRef} onPress={onFileSelectOpen}>\n <div\n {...mergeProps(\n dropProps,\n hoverProps,\n clipboardProps,\n focusProps,\n buttonProps\n )}\n style={{ ...styleProps.style }}\n className={clsx(\n styles['sapphire-dropzone'],\n styles['js-focus'],\n styles['js-hover'],\n {\n [styles['is-hover']]: isHovered && !isDropping,\n [styles['is-active']]: isPressed,\n [styles['is-disabled']]: isDisabled,\n [styles['is-focus']]: isFocusVisible,\n [styles['sapphire-dropzone--dropping']]: isDropping,\n [styles['sapphire-dropzone--error']]: hasError,\n },\n styleProps.className\n )}\n aria-label={ariaLabel}\n aria-invalid={hasError}\n aria-describedby={paragraphId}\n >\n <div className={clsx(styles['sapphire-dropzone__content'])}>\n <div className={clsx(styles['sapphire-dropzone__icon'])}>\n <Icon>\n <Upload />\n </Icon>\n </div>\n <div className={clsx(styles['sapphire-dropzone__heading'])}>\n <Typography.Heading level={6}>\n {isDropping\n ? format('dropzone-heading-dropping')\n : format('dropzone-heading-default')}\n </Typography.Heading>\n </div>\n <div\n id={paragraphId}\n className={clsx(styles['sapphire-dropzone__paragraph'])}\n >\n <Typography.Body size=\"sm\">\n {renderInstruction(isDropping)}\n </Typography.Body>\n </div>\n </div>\n </div>\n </Pressable>\n </FileTrigger>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDO,MAAM,YAAe,GAAA,KAAA,CAAM,UAAW,CAAA,SAAA,eAAA,CAC3C,OACA,YACA,EAAA;AACA,EAAM,MAAA;AAAA,IACJ,UAAa,GAAA,KAAA;AAAA,IACb,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAmB,MAAM,IAAA;AAAA,IACzB,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,SAAS,MAAM,IAAA;AAAA,IACf,mBAAmB,MAAM,MAAA;AAAA,GACvB,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,EAAK,GAAA,KAAA,EAAA,CAAA;AACX,EAAM,MAAA,WAAA,GAAc,KAAM,CAAA,YAAA,CAAA,GAAgB,KAAY,CAAA,GAAA,EAAA,CAAA;AACtD,EAAA,MAAM,SAAS,mBAAoB,CAAA,YAAA,CAAA,CAAA;AACnC,EA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IAAA,CAAA,CAAA,CAAA,sCAGH,KAAD,EAAA;AAAA,IAAK,SAAA,EAAW,KAAK,MAAO,CAAA,4BAAA,CAAA,CAAA;AAAA,GAC1B,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAW,OAAZ,EAAA;AAAA,IAAoB,KAAO,EAAA,CAAA;AAAA,GAAA,EACxB,aACG,MAAO,CAAA,2BAAA,CAAA,GACP,MAAO,CAAA,0BAAA,CAAA,CAAA,CAAA,sCAGd,KAAD,EAAA;AAAA,IACE,EAAI,EAAA,WAAA;AAAA,IACJ,SAAA,EAAW,KAAK,MAAO,CAAA,8BAAA,CAAA,CAAA;AAAA,GAEvB,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAW,IAAZ,EAAA;AAAA,IAAiB,IAAK,EAAA,IAAA;AAAA,GAAA,EACnB,iBAAkB,CAAA,UAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA;;;;"}
1
+ {"version":3,"file":"FileDropzone.js","sources":["../../../../src/FileDropzone/src/FileDropzone.tsx"],"sourcesContent":["import React, { ForwardedRef } from 'react';\nimport clsx from 'clsx';\nimport {\n Typography,\n Icon,\n SapphireStyleProps,\n useButton,\n useSapphireStyleProps,\n} from '@danske/sapphire-react';\nimport styles from '@danske/sapphire-css/components/dropzone/dropzone.module.css';\nimport { Upload } from '@danske/sapphire-icons/react';\nimport { HoverProps, Pressable, useHover } from '@react-aria/interactions';\nimport { mergeProps, useId, useObjectRef } from '@react-aria/utils';\nimport { FileSelectProps, FileTrigger } from './FileTrigger';\nimport { DropOptions, useClipboard, useDrop } from '@react-aria/dnd';\nimport { convertFileListToFileDropItems } from './utils';\nimport { useFocusRing } from '@react-aria/focus';\nimport { AriaLabelingProps } from '@react-types/shared';\nimport { useMessageFormatter } from '@react-aria/i18n';\nimport intlMessages from '../i18n';\n\nexport interface FileDropzoneProps\n extends SapphireStyleProps,\n Pick<\n DropOptions,\n | 'getDropOperation'\n | 'onDropEnter'\n | 'onDropActivate'\n | 'onDropMove'\n | 'onDropExit'\n | 'onDrop'\n >,\n HoverProps,\n FileSelectProps,\n // TODO when moving to \"core\", use types under `types.ts` instead of plain strings\n Pick<\n AriaLabelingProps,\n 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-details'\n > {\n /**\n * Whether the dropzone has an error\n * @default false\n */\n hasError?: boolean;\n /**\n * The body text of the dropzone which can contain the instructions for the files to be uploaded.\n * Can be rendered differently based on the `isDropping` parameter, which is true if a file is about to be dropped in the zone.\n * @param isDropping - boolean that marks whether a payload is about to be dropped in the dropzone.\n */\n renderInstruction: (isDropping: boolean) => string;\n /**\n * Function that is called when the file select is opened on press, before any file is selected.\n * @default \"() => null\"\n */\n onFileSelectOpen?: () => void;\n}\n\nexport const FileDropzone = React.forwardRef(function DropzoneWrapper(\n props: FileDropzoneProps,\n forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n const {\n isDisabled = false,\n hasError,\n renderInstruction,\n onFileSelectOpen = () => null,\n acceptedFileTypes,\n allowsMultiple,\n onDrop = () => null,\n getDropOperation = () => 'copy',\n } = props;\n\n const id = useId();\n const paragraphId = props['aria-label'] ? undefined : id;\n const format = useMessageFormatter(intlMessages);\n const pressableRef = useObjectRef(forwardedRef);\n const { hoverProps, isHovered } = useHover({ isDisabled });\n const { styleProps } = useSapphireStyleProps(props);\n const { dropProps, isDropTarget: isDropping } = useDrop({\n ...props,\n ref: pressableRef,\n hasDropButton: true,\n isDisabled,\n getDropOperation,\n });\n const { buttonProps, isPressed } = useButton(\n { elementType: 'div' },\n pressableRef as React.RefObject<Element>\n );\n const { focusProps, isFocusVisible } = useFocusRing();\n\n const { clipboardProps } = useClipboard({\n isDisabled,\n onPaste: (items) =>\n onDrop({\n type: 'drop',\n items,\n x: 0,\n y: 0,\n dropOperation: 'copy',\n }),\n });\n\n const ariaLabel: string = props['aria-label'] || 'Dropzone';\n\n const onFileTriggerSelect = (files: FileList | null) => {\n onDrop({\n type: 'drop',\n items: convertFileListToFileDropItems(files),\n x: 0,\n y: 0,\n dropOperation: 'copy',\n });\n };\n\n return (\n <FileTrigger\n acceptedFileTypes={acceptedFileTypes}\n allowsMultiple={allowsMultiple}\n onSelect={onFileTriggerSelect}\n isDisabled={isDisabled}\n >\n <Pressable ref={pressableRef} onPress={onFileSelectOpen}>\n <div\n {...mergeProps(\n dropProps,\n hoverProps,\n clipboardProps,\n focusProps,\n buttonProps\n )}\n style={{ ...styleProps.style }}\n className={clsx(\n styles['sapphire-dropzone'],\n styles['js-focus'],\n styles['js-hover'],\n {\n [styles['is-hover']]: isHovered && !isDropping,\n [styles['is-active']]: isPressed,\n [styles['is-disabled']]: isDisabled,\n [styles['is-focus']]: isFocusVisible,\n [styles['sapphire-dropzone--dropping']]: isDropping,\n [styles['sapphire-dropzone--error']]: hasError,\n },\n styleProps.className\n )}\n aria-label={ariaLabel}\n aria-invalid={hasError}\n aria-describedby={paragraphId}\n >\n <div className={clsx(styles['sapphire-dropzone__content'])}>\n <div className={clsx(styles['sapphire-dropzone__icon'])}>\n <Icon size=\"lg\">\n <Upload />\n </Icon>\n </div>\n <div className={clsx(styles['sapphire-dropzone__heading'])}>\n <Typography.Heading level={6}>\n {isDropping\n ? format('dropzone-heading-dropping')\n : format('dropzone-heading-default')}\n </Typography.Heading>\n </div>\n <div\n id={paragraphId}\n className={clsx(styles['sapphire-dropzone__paragraph'])}\n >\n <Typography.Body size=\"sm\" color=\"secondary\">\n {renderInstruction(isDropping)}\n </Typography.Body>\n </div>\n </div>\n </div>\n </Pressable>\n </FileTrigger>\n );\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDO,MAAM,YAAe,GAAA,KAAA,CAAM,UAAW,CAAA,SAAA,eAAA,CAC3C,OACA,YACA,EAAA;AACA,EAAM,MAAA;AAAA,IACJ,UAAa,GAAA,KAAA;AAAA,IACb,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAmB,MAAM,IAAA;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Eb,YAAY,EAAA,SAAA;AAAA,IACZ,cAAc,EAAA,QAAA;AAAA,IACd,kBAAkB,EAAA,WAAA;AAAA,GAAA,CAAA,sCAEjB,KAAD,EAAA;AAAA,IAAK,SAAA,EAAW,KAAK,MAAO,CAAA,4BAAA,CAAA,CAAA;AAAA,GAAA,sCACzB,KAAD,EAAA;AAAA,IAAK,SAAA,EAAW,KAAK,MAAO,CAAA,yBAAA,CAAA,CAAA;AAAA,GAAA,sCACzB,IAAD,EAAA;AAAA,IAAM,IAAK,EAAA,IAAA;AAAA,GAAA,kBACR,KAAA,CAAA,aAAA,CAAA,MAAA,EAAD,IAGJ,CAAA,CAAA,CAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA;AAAA,IAAK,SAAA,EAAW,KAAK,MAAO,CAAA,4BAAA,CAAA,CAAA;AAAA,GAC1B,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAW,OAAZ,EAAA;AAAA,IAAoB,KAAO,EAAA,CAAA;AAAA,GAAA,EACxB,aACG,MAAO,CAAA,2BAAA,CAAA,GACP,MAAO,CAAA,0BAAA,CAAA,CAAA,CAAA,sCAGd,KAAD,EAAA;AAAA,IACE,EAAI,EAAA,WAAA;AAAA,IACJ,SAAA,EAAW,KAAK,MAAO,CAAA,8BAAA,CAAA,CAAA;AAAA,GAEvB,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAW,IAAZ,EAAA;AAAA,IAAiB,IAAK,EAAA,IAAA;AAAA,IAAK,KAAM,EAAA,WAAA;AAAA,GAAA,EAC9B,iBAAkB,CAAA,UAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA;;;;"}
@@ -12,6 +12,9 @@ import 'clsx';
12
12
  import '@danske/sapphire-css/components/progressIndicator/progressIndicator.module.css';
13
13
  import '@react-aria/progress';
14
14
  import '../../Slider/index.js';
15
+ import '../../Breadcrumbs/src/Breadcrumbs.js';
16
+ import '../../Breadcrumbs/src/BreadcrumbItem.js';
17
+ import '../../Breadcrumbs/src/BreadcrumbItemLink.js';
15
18
  import '@react-aria/tag';
16
19
  import '@react-stately/list';
17
20
  import '@danske/sapphire-css/components/tag/tag.module.css';
@@ -1 +1 @@
1
- {"version":3,"file":"SearchableSelectFilter.js","sources":["../../../../src/Filtering/src/SearchableSelectFilter.tsx"],"sourcesContent":["import React, { cloneElement, ReactElement, useRef } from 'react';\nimport {\n Flex,\n ListBoxProps,\n SapphireStyleProps,\n SearchFieldPropsWithRef,\n tokens,\n} from '@danske/sapphire-react';\nimport { FilterDropdown, FilterDropdownProps } from '../..';\nimport { mergeRefs } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\n\nexport interface SearchableSelectFilterProps\n extends SapphireStyleProps,\n Omit<FilterDropdownProps, 'children'> {\n /**\n * The SearchField to search items with.\n */\n searchField: ReactElement<SearchFieldPropsWithRef<object>>;\n /**\n * The ListBox to select items from.\n */\n listBox: ReactElement<ListBoxProps<object>>;\n /**\n * The Button size of the trigger\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * A button with a dropdown, used for filtering UI.\n */\nexport function SearchableSelectFilter(\n props: SearchableSelectFilterProps\n): JSX.Element {\n const { searchField, listBox, size = 'md', ...otherProps } = props;\n const searchFieldRef = useRef<HTMLInputElement>(null);\n\n const searchFieldProps = searchField.props;\n const listBoxProps = listBox.props;\n\n const [searchQuery, setSearchQuery] = useControlledState(\n searchFieldProps?.value,\n '',\n searchFieldProps.onChange\n );\n\n if (\n listBoxProps.connectedInputRef &&\n typeof process !== 'undefined' &&\n process.env?.NODE_ENV === 'development'\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'The connectedInputRef prop on the ListBox in the SearchableSelectFilter component is not needed and will be ignored. The connectedInputRef is set automatically (to the passed SearchField) and should not be set manually.'\n );\n }\n\n const hasSelection =\n listBoxProps.selectedKeys === 'all' ||\n Array.from(listBoxProps.selectedKeys || []).length > 0;\n\n return (\n <FilterDropdown\n {...otherProps}\n noMaxWidth={otherProps.noMaxWidth ?? true}\n buttonSize={size}\n // Since useCollectionFocusProxy disables normal form submission behaviour on \"Enter\"\n // the apply button is the only way to submit, which is why we add it if an onApply function is passed\n hasApplyButton={Boolean(otherProps.onApply)}\n // In scenarios where selections are not applied immediately we want to allow cancelling\n // the filter selection via 'Clear' button as soon as at least 1 item is selected\n isClearDisabled={\n otherProps.isClearDisabled || (!hasSelection && !otherProps.value)\n }\n >\n <Flex flexDirection=\"column\" height=\"100%\">\n {cloneElement(searchField, {\n size: 'md',\n value: searchFieldProps.value || searchQuery,\n inputRef: mergeRefs(searchFieldRef, searchFieldProps.inputRef),\n width: searchFieldProps.width || '100%',\n marginBottom: searchFieldProps.marginBottom || tokens.size.spacingSm,\n onChange: setSearchQuery,\n })}\n {cloneElement(listBox, {\n connectedInputRef: searchFieldRef,\n selectionMode: listBoxProps.selectionMode || 'multiple',\n marginX: `calc(${tokens.size.spacingContainerHorizontalSm.value} * -1)`,\n hasScrollDividers: true,\n filter:\n // This is a way to also allow opting out of the internal filter with filter={undefined}\n // without us having to allow for more values on the ListBox filter prop\n 'filter' in listBoxProps\n ? listBoxProps.filter\n : (textValue: string) =>\n textValue.toLowerCase().includes(searchQuery.toLowerCase()),\n })}\n </Flex>\n </FilterDropdown>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAA,sBAAA,CACL,KACa,EAAA;AAnCf,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoCE,EAA6D,MAAA,EAAA,GAAA,KAAA,EAArD,EAAa,WAAA,EAAA,OAAA,EAAS,IAAO,GAAA,IAAA,EAAA,GAAwB,IAAf,UAAe,GAAA,SAAA,CAAA,EAAA,EAAf,CAAtC,aAAA,EAAa,SAAS,EAAA,MAAA,CAAA,CAAA,CAAA;AAC9B,EAAA,MAAM,iBAAiB,MAAyB,CAAA,IAAA,CAAA,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,EAAO,iBAAiB,KAAS,IAAA,WAAA;AAAA,IACjC,QAAA,EAAU,SAAU,CAAA,cAAA,EAAgB,gBAAiB,CAAA,QAAA,CAAA;AAAA,IACrD,KAAA,EAAO,iBAAiB,KAAS,IAAA,MAAA;AAAA,IACjC,YAAc,EAAA,gBAAA,CAAiB,YAAgB,IAAA,MAAA,CAAO,IAAK,CAAA,SAAA;AAAA,IAC3D,QAAU,EAAA,cAAA;AAAA,GAAA,CAAA,EAEX,aAAa,OAAS,EAAA;AAAA,IACrB,iBAAmB,EAAA,cAAA;AAAA,IACnB,aAAA,EAAe,aAAa,aAAiB,IAAA,UAAA;AAAA,IAC7C,OAAS,EAAA,CAAA,KAAA,EAAQ,MAAO,CAAA,IAAA,CAAK,4BAA6B,CAAA,KAAA,CAAA,MAAA,CAAA;AAAA,IAC1D,iBAAmB,EAAA,IAAA;AAAA,IACnB,MAAA,EAGE,QAAY,IAAA,YAAA,GACR,YAAa,CAAA,MAAA,GACb,CAAC,SACC,KAAA,SAAA,CAAU,WAAc,EAAA,CAAA,QAAA,CAAS,WAAY,CAAA,WAAA,EAAA,CAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"SearchableSelectFilter.js","sources":["../../../../src/Filtering/src/SearchableSelectFilter.tsx"],"sourcesContent":["import React, { cloneElement, ReactElement, useRef } from 'react';\nimport {\n Flex,\n ListBoxProps,\n SapphireStyleProps,\n SearchFieldPropsWithRef,\n tokens,\n} from '@danske/sapphire-react';\nimport { FilterDropdown, FilterDropdownProps } from '../..';\nimport { mergeRefs } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\n\nexport interface SearchableSelectFilterProps\n extends SapphireStyleProps,\n Omit<FilterDropdownProps, 'children'> {\n /**\n * The SearchField to search items with.\n */\n searchField: ReactElement<SearchFieldPropsWithRef<object>>;\n /**\n * The ListBox to select items from.\n */\n listBox: ReactElement<ListBoxProps<object>>;\n /**\n * The Button size of the trigger\n * @default 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n}\n\n/**\n * A button with a dropdown, used for filtering UI.\n */\nexport function SearchableSelectFilter(\n props: SearchableSelectFilterProps\n): JSX.Element {\n const { searchField, listBox, size = 'md', ...otherProps } = props;\n const searchFieldRef = useRef<HTMLInputElement>(null);\n\n const searchFieldProps = searchField.props;\n const listBoxProps = listBox.props;\n\n const [searchQuery, setSearchQuery] = useControlledState(\n searchFieldProps?.value,\n '',\n searchFieldProps.onChange\n );\n\n if (\n listBoxProps.connectedInputRef &&\n typeof process !== 'undefined' &&\n process.env?.NODE_ENV === 'development'\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'The connectedInputRef prop on the ListBox in the SearchableSelectFilter component is not needed and will be ignored. The connectedInputRef is set automatically (to the passed SearchField) and should not be set manually.'\n );\n }\n\n const hasSelection =\n listBoxProps.selectedKeys === 'all' ||\n Array.from(listBoxProps.selectedKeys || []).length > 0;\n\n return (\n <FilterDropdown\n {...otherProps}\n noMaxWidth={otherProps.noMaxWidth ?? true}\n buttonSize={size}\n // Since useCollectionFocusProxy disables normal form submission behaviour on \"Enter\"\n // the apply button is the only way to submit, which is why we add it if an onApply function is passed\n hasApplyButton={Boolean(otherProps.onApply)}\n // In scenarios where selections are not applied immediately we want to allow cancelling\n // the filter selection via 'Clear' button as soon as at least 1 item is selected\n isClearDisabled={\n otherProps.isClearDisabled || (!hasSelection && !otherProps.value)\n }\n >\n <Flex flexDirection=\"column\" height=\"100%\">\n {cloneElement(searchField, {\n size: 'md',\n value: searchFieldProps.value || searchQuery,\n inputRef: mergeRefs(searchFieldRef, searchFieldProps.inputRef),\n width: searchFieldProps.width || '100%',\n marginBottom: searchFieldProps.marginBottom || tokens.size.spacingSm,\n onChange: setSearchQuery,\n })}\n {cloneElement(listBox, {\n connectedInputRef: searchFieldRef,\n selectionMode: listBoxProps.selectionMode || 'multiple',\n marginX: `calc(${tokens.size.spacingContainerHorizontalSm.value} * -1)`,\n hasScrollDividers: true,\n filter:\n // This is a way to also allow opting out of the internal filter with filter={undefined}\n // without us having to allow for more values on the ListBox filter prop\n 'filter' in listBoxProps\n ? listBoxProps.filter\n : (textValue: string) =>\n textValue.toLowerCase().includes(searchQuery.toLowerCase()),\n })}\n </Flex>\n </FilterDropdown>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAA,sBAAA,CACL,KACa,EAAA;AAnCf,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoCE,EAA6D,MAAA,EAAA,GAAA,KAAA,EAArD,EAAa,WAAA,EAAA,OAAA,EAAS,IAAO,GAAA,IAAA,EAAA,GAAwB,IAAf,UAAe,GAAA,SAAA,CAAA,EAAA,EAAf,CAAtC,aAAA,EAAa,SAAS,EAAA,MAAA,CAAA,CAAA,CAAA;AAC9B,EAAA,MAAM,iBAAiB,MAAyB,CAAA,IAAA,CAAA,CAAA;AAEhD,EAAA,MAAM,mBAAmB,WAAY,CAAA,KAAA,CAAA;AACrC,EAAA,MAAM,eAAe,OAAQ,CAAA,KAAA,CAAA;AAE7B,EAAA,MAAM,CAAC,WAAa,EAAA,cAAA,CAAA,GAAkB,mBACpC,gBAAkB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,gBAAA,CAAA,KAAA,EAClB,IACA,gBAAiB,CAAA,QAAA,CAAA,CAAA;AAGnB,EACE,IAAA,YAAA,CAAa,qBACb,OAAO,OAAA,KAAY,eACnB,CAAQ,CAAA,EAAA,GAAA,OAAA,CAAA,GAAA,KAAR,IAAa,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,QAAA,MAAa,aAC1B,EAAA;AAEA,IAAA,OAAA,CAAQ,IACN,CAAA,6NAAA,CAAA,CAAA;AAAA,GAAA;AAIJ,EAAM,MAAA,YAAA,GACJ,aAAa,YAAiB,KAAA,KAAA,IAC9B,MAAM,IAAK,CAAA,YAAA,CAAa,YAAgB,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,SAAA,CAAU,WAAc,EAAA,CAAA,QAAA,CAAS,WAAY,CAAA,WAAA,EAAA,CAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
@@ -100,7 +100,6 @@ const NumberField = forwardRef(function NumberField2(props, ref) {
100
100
  }));
101
101
  return /* @__PURE__ */ React.createElement(Field, __spreadProps(__spreadValues({}, removeUniqueDOMProps(otherProps)), {
102
102
  ref: containerRef,
103
- isDisabled,
104
103
  size,
105
104
  labelPlacement
106
105
  }), /* @__PURE__ */ React.createElement(Field.Context, {
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.js","sources":["../../../../src/NumberField/src/NumberField.tsx"],"sourcesContent":["import React, {\n forwardRef,\n ForwardedRef,\n ReactNode,\n RefObject,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport clsx from 'clsx';\nimport { useFocusRing } from '@react-aria/focus';\nimport { useMessageFormatter } from '@react-aria/i18n';\nimport { mergeProps, useObjectRef } from '@react-aria/utils';\nimport { createFocusableRef } from '@react-spectrum/utils';\nimport { FocusableRefValue, PressEvents } from '@react-types/shared';\nimport textFieldStyles from '@danske/sapphire-css/components/textField/textField.module.css';\nimport {\n Field,\n Label,\n SapphireStyleProps,\n useThemeCheck,\n} from '@danske/sapphire-react';\n\nimport intlMessages from '../i18n';\nimport { StepperButton } from './StepperButton';\nimport { useAutofillStyle } from './useAutofillStyle';\nimport {\n SapphireNumberFieldProps,\n useSapphireNumberField,\n} from './useSapphireNumberField';\n\nexport type NumberFieldRef = FocusableRefValue<\n HTMLInputElement,\n HTMLDivElement\n> & {\n getInputElement(): HTMLInputElement | null;\n};\n\nexport interface NumberFieldProps\n extends SapphireNumberFieldProps,\n PressEvents,\n SapphireStyleProps {\n prefix?: ReactNode;\n postfix?: ReactNode;\n inputRef?: RefObject<HTMLInputElement | null>;\n /**\n * A note to show below the input.\n * If the input has an error message, this note will be replaced by that.\n */\n note?: ReactNode;\n /**\n * A HelpButton to render next to the label.\n */\n contextualHelp?: ReactNode;\n /**\n * To visually indicate if this field is required or optional.\n * @default false\n */\n necessityIndicator?: boolean;\n /**\n * @default 'lg'\n */\n size?: 'lg' | 'md';\n /**\n * Aligns the text inside the input fields without affecting the positioning of the label of the field.\n */\n alignInputRight?: boolean;\n /**\n * Places the label either above (default) or on the side of the control.\n * @default 'above'\n */\n labelPlacement?: 'side' | 'above';\n /**\n * To show the buttons for incrementing and decrementing the value.\n * @default false\n */\n showButtons?: boolean;\n}\n\nexport const NumberField = forwardRef(function NumberField(\n props: NumberFieldProps,\n ref: ForwardedRef<NumberFieldRef>\n) {\n const {\n label,\n isDisabled,\n error,\n note,\n isRequired,\n contextualHelp,\n prefix,\n postfix,\n size = 'lg',\n labelPlacement = 'above',\n necessityIndicator = false,\n alignInputRight,\n showButtons = false,\n incrementAriaLabel,\n decrementAriaLabel,\n ...otherProps\n } = props;\n useThemeCheck();\n const inputRef = useObjectRef<HTMLInputElement>(props.inputRef);\n const formatMessage = useMessageFormatter(intlMessages);\n const {\n inputProps,\n labelProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n } = useSapphireNumberField(\n {\n ...props,\n incrementAriaLabel: incrementAriaLabel ?? formatMessage('increment'),\n decrementAriaLabel: decrementAriaLabel ?? formatMessage('decrement'),\n },\n inputRef\n );\n const { focusProps, isFocusVisible } = useFocusRing();\n const { autofillStyles, updateStyle } = useAutofillStyle<'input'>(inputRef);\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(containerRef, inputRef),\n /**\n * (This function is deprecated. Use `inputRef` prop)\n * @deprecated\n */\n getInputElement() {\n return inputRef.current;\n },\n }));\n\n return (\n <Field\n // otherProps contains some of the same props as inputProps. That is\n // intended, but some DOM props, like \"id\", should not be repeated\n {...removeUniqueDOMProps(otherProps)}\n ref={containerRef}\n isDisabled={isDisabled}\n size={size}\n labelPlacement={labelPlacement}\n >\n <Field.Context\n descriptionProps={error ? errorMessageProps : descriptionProps}\n >\n {label && (\n <Field.Label>\n <Label\n {...labelProps}\n size={size}\n necessityIndicator={\n isRequired && necessityIndicator\n ? 'required'\n : !isRequired && necessityIndicator\n ? 'optional'\n : undefined\n }\n contextualHelp={contextualHelp}\n >\n {label}\n </Label>\n </Field.Label>\n )}\n <Field.Control>\n <div\n className={clsx(textFieldStyles['sapphire-text-field'], {\n [textFieldStyles['is-focus']]: isFocusVisible,\n [textFieldStyles['sapphire-text-field--error']]:\n error === true || typeof error === 'string',\n [textFieldStyles['sapphire-text-field--md']]: size === 'md',\n })}\n >\n {prefix && (\n <span\n className={clsx(\n textFieldStyles['sapphire-text-field__prefix'],\n {\n [textFieldStyles['sapphire-text-field__prefix--icon']]:\n typeof prefix !== 'string',\n }\n )}\n >\n {prefix}\n </span>\n )}\n <input\n {...mergeProps(inputProps, focusProps, {\n onChange: updateStyle,\n onBlur: updateStyle,\n })}\n ref={inputRef}\n className={clsx(textFieldStyles['sapphire-text-field__input'], {\n [textFieldStyles['sapphire-text-field__input--align-right']]:\n !!alignInputRight,\n })}\n style={autofillStyles}\n />\n {postfix && (\n <span\n className={clsx(\n textFieldStyles['sapphire-text-field__postfix'],\n {\n [textFieldStyles['sapphire-text-field__postfix--icon']]:\n typeof postfix !== 'string',\n }\n )}\n >\n {postfix}\n </span>\n )}\n {showButtons && (\n <div\n className={clsx(\n textFieldStyles['sapphire-text-field__stepper']\n )}\n >\n <StepperButton\n variant=\"increment\"\n size={size}\n {...incrementButtonProps}\n />\n <StepperButton\n variant=\"decrement\"\n size={size}\n {...decrementButtonProps}\n />\n </div>\n )}\n </div>\n </Field.Control>\n {((error && typeof error !== 'boolean') || note) && (\n <Field.Footer>\n {error && typeof error !== 'boolean' ? (\n <Field.Note variant=\"error\">{error}</Field.Note>\n ) : note ? (\n note\n ) : (\n <></>\n )}\n </Field.Footer>\n )}\n </Field.Context>\n </Field>\n );\n});\n\n// Once moved to the core package, this function should be removed and instead consume the one from TextFieldBase.\nconst removeUniqueDOMProps = (props: Record<any, any>): Record<any, any> =>\n Object.fromEntries(\n Object.entries(props).filter(\n ([name]) => name !== 'id' && !name.startsWith('data-')\n )\n );\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EO,MAAM,WAAc,GAAA,UAAA,CAAW,SACpC,YAAA,CAAA,KAAA,EACA,GACA,EAAA;AACA,EAAA,MAiBI,EAhBF,GAAA,KAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAO,GAAA,IAAA;AAAA,IACP,cAAiB,GAAA,OAAA;AAAA,IACjB,kBAAqB,GAAA,KAAA;AAAA,IACrB,eAAA;AAAA,IACA,WAAc,GAAA,KAAA;AAAA,IACd,kBAAA;AAAA,IACA,kBAAA;AAAA,GAEE,GAAA,EAAA,EADC,uBACD,EADC,EAAA;AAAA,IAfH,OAAA;AAAA,IACA,YAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA,YAAA;AAAA,IACA,gBAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,oBAAA;AAAA,IACA,iBAAA;AAAA,IACA,aAAA;AAAA,IACA,oBAAA;AAAA,IACA,oBAAA;AAAA,GAAA,CAAA,CAAA;AAGF,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA,QAAA,GAAW,aAA+B,KAAM,CAAA,QAAA,CAAA,CAAA;AACtD,EAAA,MAAM,gBAAgB,mBAAoB,CAAA,YAAA,CAAA,CAAA;AAC1C,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,UAAA;AAAA,IACA,oBAAA;AAAA,IACA,oBAAA;AAAA,IACA,gBAAA;AAAA,IACA,iBAAA;AAAA,GACE,GAAA,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CAAA;AAAA,GAIxB,EAAA,OAAA,CAAA,EAGJ,WACC,oBAAA,KAAA,CAAA,aAAA,CAAC,KAAD,EAAA;AAAA,IACE,SAAA,EAAW,KACT,eAAgB,CAAA,8BAAA,CAAA,CAAA;AAAA,GAAA,sCAGjB,aAAD,EAAA,cAAA,CAAA;AAAA,IACE,OAAQ,EAAA,WAAA;AAAA,IACR,IAAA;AAAA,GACI,EAAA,oBAAA,CAAA,CAAA,sCAEL,aAAD,EAAA,cAAA,CAAA;AAAA,IACE,OAAQ,EAAA,WAAA;AAAA,IACR,IAAA;AAAA,GAAA,EACI,2BAMX,CAAS,KAAA,IAAA,OAAO,KAAU,KAAA,SAAA,IAAc,yBACxC,KAAA,CAAA,aAAA,CAAA,KAAA,CAAM,MAAP,EAAA,IAAA,EACG,SAAS,OAAO,KAAA,KAAU,SACzB,mBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,IAAP,EAAA;AAAA,IAAY,OAAQ,EAAA,OAAA;AAAA,GAAS,EAAA,KAAA,CAAA,GAC3B,OACF,IAEA,mBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,EAAA;AAUd,MAAM,uBAAuB,CAAC,KAAA,KAC5B,MAAO,CAAA,WAAA,CACL,OAAO,OAAQ,CAAA,KAAA,CAAA,CAAO,MACpB,CAAA,CAAC,CAAC,IAAU,CAAA,KAAA,IAAA,KAAS,IAAQ,IAAA,CAAC,KAAK,UAAW,CAAA,OAAA,CAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"NumberField.js","sources":["../../../../src/NumberField/src/NumberField.tsx"],"sourcesContent":["import React, {\n forwardRef,\n ForwardedRef,\n ReactNode,\n RefObject,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport clsx from 'clsx';\nimport { useFocusRing } from '@react-aria/focus';\nimport { useMessageFormatter } from '@react-aria/i18n';\nimport { mergeProps, useObjectRef } from '@react-aria/utils';\nimport { createFocusableRef } from '@react-spectrum/utils';\nimport { FocusableRefValue, PressEvents } from '@react-types/shared';\nimport textFieldStyles from '@danske/sapphire-css/components/textField/textField.module.css';\nimport {\n Field,\n Label,\n SapphireStyleProps,\n useThemeCheck,\n} from '@danske/sapphire-react';\n\nimport intlMessages from '../i18n';\nimport { StepperButton } from './StepperButton';\nimport { useAutofillStyle } from './useAutofillStyle';\nimport {\n SapphireNumberFieldProps,\n useSapphireNumberField,\n} from './useSapphireNumberField';\n\nexport type NumberFieldRef = FocusableRefValue<\n HTMLInputElement,\n HTMLDivElement\n> & {\n getInputElement(): HTMLInputElement | null;\n};\n\nexport interface NumberFieldProps\n extends SapphireNumberFieldProps,\n PressEvents,\n SapphireStyleProps {\n prefix?: ReactNode;\n postfix?: ReactNode;\n inputRef?: RefObject<HTMLInputElement | null>;\n /**\n * A note to show below the input.\n * If the input has an error message, this note will be replaced by that.\n */\n note?: ReactNode;\n /**\n * A HelpButton to render next to the label.\n */\n contextualHelp?: ReactNode;\n /**\n * To visually indicate if this field is required or optional.\n * @default false\n */\n necessityIndicator?: boolean;\n /**\n * @default 'lg'\n */\n size?: 'lg' | 'md';\n /**\n * Aligns the text inside the input fields without affecting the positioning of the label of the field.\n */\n alignInputRight?: boolean;\n /**\n * Places the label either above (default) or on the side of the control.\n * @default 'above'\n */\n labelPlacement?: 'side' | 'above';\n /**\n * To show the buttons for incrementing and decrementing the value.\n * @default false\n */\n showButtons?: boolean;\n}\n\nexport const NumberField = forwardRef(function NumberField(\n props: NumberFieldProps,\n ref: ForwardedRef<NumberFieldRef>\n) {\n const {\n label,\n isDisabled,\n error,\n note,\n isRequired,\n contextualHelp,\n prefix,\n postfix,\n size = 'lg',\n labelPlacement = 'above',\n necessityIndicator = false,\n alignInputRight,\n showButtons = false,\n incrementAriaLabel,\n decrementAriaLabel,\n ...otherProps\n } = props;\n useThemeCheck();\n const inputRef = useObjectRef<HTMLInputElement>(props.inputRef);\n const formatMessage = useMessageFormatter(intlMessages);\n const {\n inputProps,\n labelProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n } = useSapphireNumberField(\n {\n ...props,\n incrementAriaLabel: incrementAriaLabel ?? formatMessage('increment'),\n decrementAriaLabel: decrementAriaLabel ?? formatMessage('decrement'),\n },\n inputRef\n );\n const { focusProps, isFocusVisible } = useFocusRing();\n const { autofillStyles, updateStyle } = useAutofillStyle<'input'>(inputRef);\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(containerRef, inputRef),\n /**\n * (This function is deprecated. Use `inputRef` prop)\n * @deprecated\n */\n getInputElement() {\n return inputRef.current;\n },\n }));\n\n return (\n <Field\n // otherProps contains some of the same props as inputProps. That is\n // intended, but some DOM props, like \"id\", should not be repeated\n {...removeUniqueDOMProps(otherProps)}\n ref={containerRef}\n size={size}\n labelPlacement={labelPlacement}\n >\n <Field.Context\n descriptionProps={error ? errorMessageProps : descriptionProps}\n >\n {label && (\n <Field.Label>\n <Label\n {...labelProps}\n size={size}\n necessityIndicator={\n isRequired && necessityIndicator\n ? 'required'\n : !isRequired && necessityIndicator\n ? 'optional'\n : undefined\n }\n contextualHelp={contextualHelp}\n >\n {label}\n </Label>\n </Field.Label>\n )}\n <Field.Control>\n <div\n className={clsx(textFieldStyles['sapphire-text-field'], {\n [textFieldStyles['is-focus']]: isFocusVisible,\n [textFieldStyles['sapphire-text-field--error']]:\n error === true || typeof error === 'string',\n [textFieldStyles['sapphire-text-field--md']]: size === 'md',\n })}\n >\n {prefix && (\n <span\n className={clsx(\n textFieldStyles['sapphire-text-field__prefix'],\n {\n [textFieldStyles['sapphire-text-field__prefix--icon']]:\n typeof prefix !== 'string',\n }\n )}\n >\n {prefix}\n </span>\n )}\n <input\n {...mergeProps(inputProps, focusProps, {\n onChange: updateStyle,\n onBlur: updateStyle,\n })}\n ref={inputRef}\n className={clsx(textFieldStyles['sapphire-text-field__input'], {\n [textFieldStyles['sapphire-text-field__input--align-right']]:\n !!alignInputRight,\n })}\n style={autofillStyles}\n />\n {postfix && (\n <span\n className={clsx(\n textFieldStyles['sapphire-text-field__postfix'],\n {\n [textFieldStyles['sapphire-text-field__postfix--icon']]:\n typeof postfix !== 'string',\n }\n )}\n >\n {postfix}\n </span>\n )}\n {showButtons && (\n <div\n className={clsx(\n textFieldStyles['sapphire-text-field__stepper']\n )}\n >\n <StepperButton\n variant=\"increment\"\n size={size}\n {...incrementButtonProps}\n />\n <StepperButton\n variant=\"decrement\"\n size={size}\n {...decrementButtonProps}\n />\n </div>\n )}\n </div>\n </Field.Control>\n {((error && typeof error !== 'boolean') || note) && (\n <Field.Footer>\n {error && typeof error !== 'boolean' ? (\n <Field.Note variant=\"error\">{error}</Field.Note>\n ) : note ? (\n note\n ) : (\n <></>\n )}\n </Field.Footer>\n )}\n </Field.Context>\n </Field>\n );\n});\n\n// Once moved to the core package, this function should be removed and instead consume the one from TextFieldBase.\nconst removeUniqueDOMProps = (props: Record<any, any>): Record<any, any> =>\n Object.fromEntries(\n Object.entries(props).filter(\n ([name]) => name !== 'id' && !name.startsWith('data-')\n )\n );\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EO,MAAM,WAAc,GAAA,UAAA,CAAW,SACpC,YAAA,CAAA,KAAA,EACA,GACA,EAAA;AACA,EAAA,MAiBI,EAhBF,GAAA,KAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAO,GAAA,IAAA;AAAA,IACP,cAAiB,GAAA,OAAA;AAAA,IACjB,kBAAqB,GAAA,KAAA;AAAA,IACrB,eAAA;AAAA,IACA,WAAc,GAAA,KAAA;AAAA,IACd,kBAAA;AAAA,IACA,kBAAA;AAAA,GAEE,GAAA,EA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C3B,OACF,IAEA,mBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,EAAA;AAUd,MAAM,uBAAuB,CAAC,KAAA,KAC5B,MAAO,CAAA,WAAA,CACL,OAAO,OAAQ,CAAA,KAAA,CAAA,CAAO,MACpB,CAAA,CAAC,CAAC,IAAU,CAAA,KAAA,IAAA,KAAS,IAAQ,IAAA,CAAC,KAAK,UAAW,CAAA,OAAA,CAAA,CAAA,CAAA;;;;"}
@@ -7,6 +7,9 @@ export { Flag } from './Flag/src/Flag.js';
7
7
  export { NumberField } from './NumberField/src/NumberField.js';
8
8
  export { ProgressIndicator } from './ProgressIndicator/src/ProgressIndicator.js';
9
9
  export { Slider } from './Slider/index.js';
10
+ export { Breadcrumbs } from './Breadcrumbs/src/Breadcrumbs.js';
11
+ export { BreadcrumbItem } from './Breadcrumbs/src/BreadcrumbItem.js';
12
+ export { BreadcrumbItemLink } from './Breadcrumbs/src/BreadcrumbItemLink.js';
10
13
  export { TagGroup } from './TagGroup/src/TagGroup.js';
11
14
  export { TagItem } from './TagGroup/src/TagItem.js';
12
15
  export { LabeledValue } from './LabeledValue/src/LabeledValue.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
package/build/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode, ReactElement, RefObject, Key } from 'react';
3
- import { SapphireStyleProps, PopoverTriggerProps, SearchFieldPropsWithRef, ListBoxProps, TypographyHeadingProps, FieldProps } from '@danske/sapphire-react';
3
+ import { SapphireStyleProps, PopoverTriggerProps, SearchFieldPropsWithRef, ListBoxProps, TypographyHeadingProps, FieldProps, ButtonProps } from '@danske/sapphire-react';
4
+ import * as _react_types_shared from '@react-types/shared';
4
5
  import { CollectionBase, DOMProps, Expandable, ItemProps, AriaLabelingProps, FocusableRefValue, PressEvents } from '@react-types/shared';
5
6
  import { HoverProps } from '@react-aria/interactions';
6
7
  import { DropOptions } from '@react-aria/dnd';
7
8
  import { AriaNumberFieldProps } from '@react-aria/numberfield';
8
- import { SliderProps as SliderProps$1, SliderThumbProps } from 'react-aria-components';
9
+ import { SliderProps as SliderProps$1, SliderThumbProps, BreadcrumbProps, BreadcrumbsProps as BreadcrumbsProps$1 } from 'react-aria-components';
9
10
  export { useLocale } from '@react-aria/i18n';
10
11
 
11
12
  interface FilterDropdownProps extends SapphireStyleProps, Pick<PopoverTriggerProps, 'defaultOpen' | 'isOpen' | 'onOpenChange' | 'noMaxWidth'> {
@@ -325,6 +326,33 @@ declare const _Slider: (({ label, labelPlacement, note, name, isDisabled, ...pro
325
326
  } & React.HTMLAttributes<HTMLElement>) => React.JSX.Element;
326
327
  };
327
328
 
329
+ declare type BreadcrumbItemProps = {
330
+ isDisabled?: boolean;
331
+ } & SapphireStyleProps & Pick<BreadcrumbProps, 'children'>;
332
+ declare const BreadcrumbItem: ({ children, isDisabled: individualDisabled, ...props }: BreadcrumbItemProps) => JSX.Element;
333
+
334
+ declare type BreadcrumbsProps<T extends object> = Pick<BreadcrumbsProps$1<T>, 'aria-label' | 'isDisabled'> & {
335
+ children: React__default.ReactElement<BreadcrumbItemProps>[];
336
+ /**
337
+ * The size of the breadcrumbs component.
338
+ *
339
+ * @default 'md'
340
+ */
341
+ size?: 'sm' | 'md' | 'lg';
342
+ /**
343
+ * Maximum width for the breadcrumbs container. When content overflows,
344
+ * it will show an overflow menu with the first and last items.
345
+ */
346
+ maxWidth?: React__default.CSSProperties['maxWidth'];
347
+ } & SapphireStyleProps;
348
+ /**
349
+ * Breadcrumbs display a hierarchy of links to the current page or resource in an application.
350
+ */
351
+ declare const Breadcrumbs: <T extends object>({ size, children, maxWidth, ...props }: BreadcrumbsProps<T>) => JSX.Element;
352
+
353
+ declare type BreadcrumbItemLinkProps = Omit<ButtonProps<'a'>, 'variant' | 'iconAlign'> & SapphireStyleProps;
354
+ declare const BreadcrumbItemLink: React__default.ForwardRefExoticComponent<Omit<ButtonProps<"a">, "variant" | "iconAlign"> & SapphireStyleProps & React__default.RefAttributes<_react_types_shared.FocusableRefValue<HTMLAnchorElement, HTMLAnchorElement>>>;
355
+
328
356
  interface TagGroupProps<T> extends CollectionBase<T>, DOMProps, Pick<AriaLabelingProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-details'>, SapphireStyleProps {
329
357
  /**
330
358
  * A HelpButton element to place next to the label.
@@ -420,4 +448,4 @@ interface SapphireAlertProps extends SapphireStyleProps {
420
448
  }
421
449
  declare function Alert({ children, title, variant, ...props }: SapphireAlertProps): React__default.JSX.Element;
422
450
 
423
- export { _Accordion as Accordion, AccordionContext, AccordionHeadingProps, AccordionItemProps, AccordionProps, Alert, FileDropzone, FileDropzoneProps, FileTrigger, FileTriggerProps, FilterDropdown, FilterDropdownProps, Flag, FlagProps, LabeledValue, NumberField, NumberFieldProps, NumberFieldRef, ProgressIndicator, ProgressIndicatorProps, SapphireAlertProps, SearchableSelectFilter, SearchableSelectFilterProps, _Slider as Slider, SliderProps, TagGroup, TagGroupProps, TagItem };
451
+ export { _Accordion as Accordion, AccordionContext, AccordionHeadingProps, AccordionItemProps, AccordionProps, Alert, BreadcrumbItem, BreadcrumbItemLink, BreadcrumbItemLinkProps, BreadcrumbItemProps, Breadcrumbs, BreadcrumbsProps, FileDropzone, FileDropzoneProps, FileTrigger, FileTriggerProps, FilterDropdown, FilterDropdownProps, Flag, FlagProps, LabeledValue, NumberField, NumberFieldProps, NumberFieldRef, ProgressIndicator, ProgressIndicatorProps, SapphireAlertProps, SearchableSelectFilter, SearchableSelectFilterProps, _Slider as Slider, SliderProps, TagGroup, TagGroupProps, TagItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danske/sapphire-react-lab",
3
- "version": "0.98.0",
3
+ "version": "0.99.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Experimental React components of the Sapphire Design System from Danske Bank A/S",
6
6
  "exports": {
@@ -25,18 +25,18 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@danske/sapphire-icons": "^3.1.0",
28
- "@danske/sapphire-react": "^5.4.0",
28
+ "@danske/sapphire-react": "^5.5.0",
29
29
  "react": ">=16.8.0",
30
30
  "react-dom": ">=16.8.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@danske/sapphire-icons": "^3.1.0",
34
- "@danske/sapphire-react": "^5.4.0",
34
+ "@danske/sapphire-react": "^5.5.1",
35
35
  "@types/react-transition-group": "^4.4.5",
36
36
  "cross-env": "^7.0.3"
37
37
  },
38
38
  "dependencies": {
39
- "@danske/sapphire-css": "^42.1.0",
39
+ "@danske/sapphire-css": "^43.1.0",
40
40
  "@internationalized/date": "^3.9.0",
41
41
  "@internationalized/string": "^3.2.7",
42
42
  "@react-aria/accordion": "3.0.0-alpha.37",
@@ -65,8 +65,8 @@
65
65
  "@react-types/dialog": "^3.5.21",
66
66
  "@react-types/shared": "^3.32.0",
67
67
  "clsx": "^1.1.1",
68
- "react-aria-components": "^1.12.1",
68
+ "react-aria-components": "^1.12.2",
69
69
  "react-transition-group": "^4.4.5"
70
70
  },
71
- "gitHead": "1eefb683b16687ab3fc99c15fffb03a3eca522c5"
71
+ "gitHead": "fcf8d5c8a3962dcc624ffd02cc607673cb91bd96"
72
72
  }