@danske/sapphire-react-lab 0.96.3 → 0.98.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.
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { useThemeCheck, useSapphireStyleProps, Icon, Typography } from '@danske/sapphire-react';
3
+ import { Information, Error, CheckmarkOutline, Warning } from '@danske/sapphire-icons/react';
4
+ import alertStyles from '@danske/sapphire-css/components/alert/alert.module.css';
5
+ import { clsx } from 'clsx';
6
+
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __objRest = (source, exclude) => {
11
+ var target = {};
12
+ for (var prop in source)
13
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
14
+ target[prop] = source[prop];
15
+ if (source != null && __getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(source)) {
17
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
18
+ target[prop] = source[prop];
19
+ }
20
+ return target;
21
+ };
22
+ function Alert(_a) {
23
+ var _b = _a, {
24
+ children,
25
+ title,
26
+ variant = "info"
27
+ } = _b, props = __objRest(_b, [
28
+ "children",
29
+ "title",
30
+ "variant"
31
+ ]);
32
+ useThemeCheck();
33
+ const {
34
+ styleProps: { style, className }
35
+ } = useSapphireStyleProps(props);
36
+ const getIcon = (variant2) => {
37
+ switch (variant2) {
38
+ case "warning":
39
+ return /* @__PURE__ */ React.createElement(Warning, null);
40
+ case "positive":
41
+ return /* @__PURE__ */ React.createElement(CheckmarkOutline, null);
42
+ case "negative":
43
+ return /* @__PURE__ */ React.createElement(Error, null);
44
+ default:
45
+ return /* @__PURE__ */ React.createElement(Information, null);
46
+ }
47
+ };
48
+ return /* @__PURE__ */ React.createElement("div", {
49
+ className: clsx(alertStyles["sapphire-alert"], {
50
+ [alertStyles["sapphire-alert--positive"]]: variant === "positive",
51
+ [alertStyles["sapphire-alert--negative"]]: variant === "negative",
52
+ [alertStyles["sapphire-alert--warning"]]: variant === "warning"
53
+ }, className),
54
+ style,
55
+ role: "alert"
56
+ }, /* @__PURE__ */ React.createElement("span", {
57
+ className: alertStyles["sapphire-alert__icon"]
58
+ }, /* @__PURE__ */ React.createElement(Icon, {
59
+ size: "sm"
60
+ }, getIcon(variant))), /* @__PURE__ */ React.createElement("div", {
61
+ className: alertStyles["sapphire-alert__title"]
62
+ }, /* @__PURE__ */ React.createElement(Typography.Body, {
63
+ size: "sm",
64
+ isSemibold: true
65
+ }, title)), /* @__PURE__ */ React.createElement("div", {
66
+ className: alertStyles["sapphire-alert__content"]
67
+ }, /* @__PURE__ */ React.createElement(Typography.Body, {
68
+ elementType: "section",
69
+ size: "md"
70
+ }, children)));
71
+ }
72
+
73
+ export { Alert };
74
+ //# sourceMappingURL=Alert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Alert.js","sources":["../../../../src/Alert/src/Alert.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport {\n SapphireStyleProps,\n useThemeCheck,\n useSapphireStyleProps,\n Typography,\n Icon,\n} from '@danske/sapphire-react';\nimport {\n CheckmarkOutline,\n Information,\n Warning,\n Error,\n} from '@danske/sapphire-icons/react';\nimport alertStyles from '@danske/sapphire-css/components/alert/alert.module.css';\nimport { clsx } from 'clsx';\n\nexport interface SapphireAlertProps extends SapphireStyleProps {\n /**\n * The content of the alert.\n */\n children?: ReactNode;\n\n /**\n * The title of the alert.\n */\n title?: ReactNode;\n\n /**\n * @default 'info'\n */\n variant?: 'info' | 'positive' | 'negative' | 'warning';\n}\n\nexport function Alert({\n children,\n title,\n variant = 'info',\n ...props\n}: SapphireAlertProps) {\n useThemeCheck();\n const {\n styleProps: { style, className },\n } = useSapphireStyleProps(props);\n\n const getIcon = (variant: string) => {\n switch (variant) {\n case 'warning':\n return <Warning />;\n case 'positive':\n return <CheckmarkOutline />;\n case 'negative':\n return <Error />;\n default:\n return <Information />;\n }\n };\n\n return (\n <div\n className={clsx(\n alertStyles['sapphire-alert'],\n {\n [alertStyles['sapphire-alert--positive']]: variant === 'positive',\n [alertStyles['sapphire-alert--negative']]: variant === 'negative',\n [alertStyles['sapphire-alert--warning']]: variant === 'warning',\n },\n className\n )}\n style={style}\n role=\"alert\"\n >\n <span className={alertStyles['sapphire-alert__icon']}>\n <Icon size=\"sm\">{getIcon(variant)}</Icon>\n </span>\n <div className={alertStyles['sapphire-alert__title']}>\n <Typography.Body size=\"sm\" isSemibold>\n {title}\n </Typography.Body>\n </div>\n <div className={alertStyles['sapphire-alert__content']}>\n <Typography.Body elementType=\"section\" size=\"md\">\n {children}\n </Typography.Body>\n </div>\n </div>\n );\n}\n"],"names":["Error2"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCO,SAAA,KAAA,CAAe,EAKC,EAAA;AALD,EACpB,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAU,GAAA,MAAA;AAAA,GAHU,GAAA,EAAA,EAIjB,kBAJiB,EAIjB,EAAA;AAAA,IAHH,UAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,GAAA,CAAA,CAAA;AAGA,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA;AAAA,IACJ,UAAA,EAAY,EAAE,KAAO,EAAA,SAAA,EAAA;AAAA,GAAA,GACnB,qBAAsB,CAAA,KAAA,CAAA,CAAA;AAE1B,EAAM,MAAA,OAAA,GAAU,CAAC,QAAoB,KAAA;AACnC,IAAQ,QAAA,QAAA;AAAA,MACD,KAAA,SAAA;AACH,QAAA,2CAAQ,OAAD,EAAA,IAAA,CAAA,CAAA;AAAA,MACJ,KAAA,UAAA;AACH,QAAA,2CAAQ,gBAAD,EAAA,IAAA,CAAA,CAAA;AAAA,MACJ,KAAA,UAAA;AACH,QAAA,2CAAQA,KAAD,EAAA,IAAA,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ag/src/Flag.js';
10
10
  import '../../NumberField/src/NumberField.js';
11
+ import 'clsx';
12
+ import '@danske/sapphire-css/components/progressIndicator/progressIndicator.module.css';
13
+ import '@react-aria/progress';
14
+ import '../../Slider/index.js';
11
15
  import '@react-aria/tag';
12
16
  import '@react-stately/list';
13
17
  import '@danske/sapphire-css/components/tag/tag.module.css';
14
- import 'clsx';
15
18
  import '@react-aria/button';
16
19
  import '@react-aria/interactions';
17
20
  import '@danske/sapphire-icons/react';
18
21
  import '@react-aria/focus';
19
22
  import '@react-stately/collections';
20
23
  import '@react-aria/label';
24
+ import '@danske/sapphire-css/components/alert/alert.module.css';
21
25
  import '@react-aria/i18n';
22
26
 
23
27
  var __defProp = Object.defineProperty;
@@ -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,sBAA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GZ,cAAA,EAAgB,QAAQ,UAAW,CAAA,OAAA,CAAA;AAAA,IAGnC,iBACE,UAAW,CAAA,eAAA,IAAoB,CAAC,YAAA,IAAgB,CAAC,UAAW,CAAA,KAAA;AAAA,GAAA,CAAA,sCAG7D,IAAD,EAAA;AAAA,IAAM,aAAc,EAAA,QAAA;AAAA,IAAS,MAAO,EAAA,MAAA;AAAA,GAAA,EACjC,aAAa,WAAa,EAAA;AAAA,IACzB,IAAM,EAAA,IAAA;AAAA,IACN,KAAA,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,q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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;;;;"}
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import styles from '@danske/sapphire-css/components/progressIndicator/progressIndicator.module.css';
4
+ import { useThemeCheck, useSapphireStyleProps } from '@danske/sapphire-react';
5
+ import { useProgressBar } from '@react-aria/progress';
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
+ const ProgressIndicator = (props) => {
27
+ const {
28
+ maxValue = 100,
29
+ value: realValue,
30
+ segments = 1,
31
+ "aria-valuetext": ariaValueText
32
+ } = props;
33
+ useThemeCheck();
34
+ const { styleProps } = useSapphireStyleProps(props);
35
+ const { progressBarProps } = useProgressBar(__spreadProps(__spreadValues({}, props), {
36
+ minValue: 0,
37
+ valueLabel: ariaValueText
38
+ }));
39
+ const minValue = 0;
40
+ const value = Math.min(Math.max(realValue, minValue), maxValue);
41
+ const widthPercentage = value / maxValue * 100;
42
+ return /* @__PURE__ */ React.createElement("div", {
43
+ className: clsx(styles["sapphire-progress"])
44
+ }, /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, progressBarProps), {
45
+ className: styles["sapphire-progress--indicator"],
46
+ style: __spreadProps(__spreadValues({}, styleProps), { width: `${widthPercentage}%` }),
47
+ "aria-label": "aria-label" in props ? props["aria-label"] : void 0,
48
+ "aria-labelledby": "aria-labelledby" in props ? props["aria-labelledby"] : void 0
49
+ })), segments > 1 && /* @__PURE__ */ React.createElement("div", {
50
+ className: styles["sapphire-progress--segments"]
51
+ }, Array.from({ length: segments }, (_, index) => /* @__PURE__ */ React.createElement("span", {
52
+ key: index
53
+ }))));
54
+ };
55
+
56
+ export { ProgressIndicator };
57
+ //# sourceMappingURL=ProgressIndicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressIndicator.js","sources":["../../../../src/ProgressIndicator/src/ProgressIndicator.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\nimport styles from '@danske/sapphire-css/components/progressIndicator/progressIndicator.module.css';\nimport {\n SapphireStyleProps,\n useThemeCheck,\n useSapphireStyleProps,\n} from '@danske/sapphire-react';\nimport { useProgressBar } from '@react-aria/progress';\n\nexport type ProgressIndicatorProps = {\n /**\n * The maximum value for the progress bar. Will be used as:\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-valuemax\n *\n * @default 100\n */\n maxValue?: number;\n\n /**\n * The current value of the progress bar. Will be used as:\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-valuenow\n */\n value: number;\n\n /**\n * Defines how many segments the progress bar will have.\n *\n * @default 1\n */\n segments?: number;\n\n /**\n * Human-readable text alternative for the current value of the progress bar. Will be used as:\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-valuetext\n */\n 'aria-valuetext'?: string;\n} & SapphireStyleProps &\n ({ 'aria-labelledby': string } | { 'aria-label': string });\n\nexport const ProgressIndicator = (\n props: ProgressIndicatorProps\n): JSX.Element => {\n const {\n maxValue = 100,\n value: realValue,\n segments = 1,\n 'aria-valuetext': ariaValueText,\n } = props;\n\n useThemeCheck();\n const { styleProps } = useSapphireStyleProps(props);\n const { progressBarProps } = useProgressBar({\n ...props,\n minValue: 0,\n valueLabel: ariaValueText,\n });\n\n const minValue = 0;\n\n const value = Math.min(Math.max(realValue, minValue), maxValue);\n const widthPercentage = (value / maxValue) * 100;\n\n return (\n <div className={clsx(styles['sapphire-progress'])}>\n <div\n {...progressBarProps}\n className={styles['sapphire-progress--indicator']}\n style={{ ...styleProps, width: `${widthPercentage}%` }}\n aria-label={'aria-label' in props ? props['aria-label'] : undefined}\n aria-labelledby={\n 'aria-labelledby' in props ? props['aria-labelledby'] : undefined\n }\n />\n {segments > 1 && (\n <div className={styles['sapphire-progress--segments']}>\n {Array.from({ length: segments }, (_, index) => (\n <span key={index}></span>\n ))}\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwCa,MAAA,iBAAA,GAAoB,CAC/B,KACgB,KAAA;AAChB,EAAM,MAAA;AAAA,IACJ,QAAW,GAAA,GAAA;AAAA,IACX,KAAO,EAAA,SAAA;AAAA,IACP,QAAW,GAAA,CAAA;AAAA,IACX,gBAAkB,EAAA,aAAA;AAAA,GAChB,GAAA,KAAA,CAAA;AAEJ,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA,EAAE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AY,CAAC,CAAA,EAAG,KACpC,qBAAA,KAAA,CAAA,aAAA,CAAC,MAAD,EAAA;AAAA,IAAM,GAAK,EAAA,KAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
@@ -0,0 +1,9 @@
1
+ import { Field } from '@danske/sapphire-react';
2
+ import { Slider } from './src/Slider.js';
3
+
4
+ const _Slider = Object.assign(Slider, {
5
+ Note: Field.Note
6
+ });
7
+
8
+ export { _Slider as Slider };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/Slider/index.ts"],"sourcesContent":["import { Field } from '@danske/sapphire-react';\nimport { Slider } from './src/Slider';\n\nconst _Slider = Object.assign(Slider, {\n Note: Field.Note,\n});\n\nexport { _Slider as Slider };\nexport { type SliderProps } from './src/Slider';\n"],"names":[],"mappings":";;;AAGM,MAAA,OAAA,GAAU,MAAO,CAAA,MAAA,CAAO,MAAQ,EAAA;AAAA,EACpC,MAAM,KAAM,CAAA,IAAA;AAAA,CAAA;;;;"}
@@ -0,0 +1,83 @@
1
+ import clsx from 'clsx';
2
+ import styles from '@danske/sapphire-css/components/slider/slider.module.css';
3
+ import { useThemeCheck, useSapphireStyleProps, Field, Label } from '@danske/sapphire-react';
4
+ import { Slider as Slider$1, SliderTrack, SliderThumb } from 'react-aria-components';
5
+ import React from 'react';
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 Slider = (_a) => {
39
+ var _b = _a, {
40
+ label,
41
+ labelPlacement = "above",
42
+ note,
43
+ name,
44
+ isDisabled
45
+ } = _b, props = __objRest(_b, [
46
+ "label",
47
+ "labelPlacement",
48
+ "note",
49
+ "name",
50
+ "isDisabled"
51
+ ]);
52
+ useThemeCheck();
53
+ const { styleProps } = useSapphireStyleProps(props);
54
+ return /* @__PURE__ */ React.createElement(Field, __spreadProps(__spreadValues({}, styleProps), {
55
+ labelPlacement
56
+ }), /* @__PURE__ */ React.createElement(Field.Context, null, label && /* @__PURE__ */ React.createElement(Field.Label, null, /* @__PURE__ */ React.createElement(Label, null, label)), /* @__PURE__ */ React.createElement(Field.Control, null, /* @__PURE__ */ React.createElement(Slider$1, __spreadProps(__spreadValues({}, props), {
57
+ style: { height: "100%" }
58
+ }), /* @__PURE__ */ React.createElement("div", {
59
+ className: clsx(styles["sapphire-slider"]),
60
+ role: "slider"
61
+ }, /* @__PURE__ */ React.createElement(SliderTrack, {
62
+ className: clsx(styles["sapphire-slider__track"])
63
+ }, ({ state }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
64
+ className: clsx(styles["sapphire-slider__track-remaining"])
65
+ }), /* @__PURE__ */ React.createElement("div", {
66
+ className: clsx(styles["sapphire-slider__track-fill"]),
67
+ style: { width: state.getThumbPercent(0) * 100 + "%" }
68
+ }), /* @__PURE__ */ React.createElement(SliderThumb, {
69
+ name,
70
+ className: (state2) => clsx(styles["sapphire-slider__thumb"], {
71
+ [styles["is-focus"]]: state2.isFocusVisible
72
+ }),
73
+ style: ({ state: state2 }) => {
74
+ const percent = Math.min(3 + state2.getThumbPercent(0) * 94, 100);
75
+ return {
76
+ left: `${percent}%`
77
+ };
78
+ }
79
+ })))))), note && /* @__PURE__ */ React.createElement(Field.Footer, null, note)));
80
+ };
81
+
82
+ export { Slider };
83
+ //# sourceMappingURL=Slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Slider.js","sources":["../../../../src/Slider/src/Slider.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport clsx from 'clsx';\nimport styles from '@danske/sapphire-css/components/slider/slider.module.css';\nimport {\n useThemeCheck,\n useSapphireStyleProps,\n Label,\n SapphireStyleProps,\n Field,\n FieldProps,\n} from '@danske/sapphire-react';\nimport {\n Slider as RACSlider,\n SliderProps as RACSliderProps,\n SliderThumb as RACSliderThumb,\n SliderThumbProps as RACSliderThumbProps,\n SliderTrack as RACSliderTrack,\n} from 'react-aria-components';\nimport React from 'react';\n\nexport type SliderProps = {\n label?: ReactNode;\n /**\n * A note to show below the slider.\n * Use {@Link Slider.Note} to render the note.\n */\n note?: ReactNode;\n} & SapphireStyleProps &\n Pick<FieldProps, 'isDisabled' | 'labelPlacement'> &\n Pick<\n RACSliderProps<number>, // We're only supporting sliders with one end\n | 'minValue'\n | 'maxValue'\n | 'step'\n | 'value'\n | 'defaultValue'\n | 'aria-label'\n | 'onChange'\n | 'onChangeEnd'\n > &\n Pick<RACSliderThumbProps, 'name'>;\n\nexport const Slider = ({\n label,\n labelPlacement = 'above',\n note,\n name,\n isDisabled,\n ...props\n}: SliderProps): JSX.Element => {\n useThemeCheck();\n const { styleProps } = useSapphireStyleProps(props);\n\n return (\n <Field {...styleProps} labelPlacement={labelPlacement}>\n <Field.Context>\n {label && (\n <Field.Label>\n <Label>{label}</Label>\n </Field.Label>\n )}\n\n <Field.Control>\n <RACSlider {...props} style={{ height: '100%' }}>\n <div className={clsx(styles['sapphire-slider'])} role=\"slider\">\n <RACSliderTrack\n className={clsx(styles['sapphire-slider__track'])}\n >\n {({ state }) => (\n <>\n <div\n className={clsx(\n styles['sapphire-slider__track-remaining']\n )}\n />\n <div\n className={clsx(styles['sapphire-slider__track-fill'])}\n style={{ width: state.getThumbPercent(0) * 100 + '%' }}\n />\n <RACSliderThumb\n name={name}\n className={(state) =>\n clsx(styles['sapphire-slider__thumb'], {\n [styles['is-focus']]: state.isFocusVisible,\n })\n }\n style={({ state }) => {\n // Pad the thumb position, so it doesn't go over the track\n const percent = Math.min(\n 3 + state.getThumbPercent(0) * 94,\n 100\n );\n return {\n left: `${percent}%`,\n };\n }}\n />\n </>\n )}\n </RACSliderTrack>\n </div>\n </RACSlider>\n </Field.Control>\n\n {note && <Field.Footer>{note}</Field.Footer>}\n </Field.Context>\n </Field>\n );\n};\n"],"names":["RACSlider","RACSliderTrack","RACSliderThumb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Ca,MAAA,MAAA,GAAS,CAAC,EAOS,KAAA;AAPT,EACrB,IAAA,EAAA,GAAA,EAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA,cAAiB,GAAA,OAAA;AAAA,IACjB,IAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,GALqB,GAAA,EAAA,EAMlB,kBANkB,EAMlB,EAAA;AAAA,IALH,OAAA;AAAA,IACA,gBAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,YAAA;AAAA,GAAA,CAAA,CAAA;AAGA,EAAA,aAAA,EAAA,CAAA;AACA,EAAM,MAAA,EAAE,eAAe,qBAAsB,CAAA,KAAA,CAAA,CA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MAAA,CAAO,cAAc,MAAM,CAAA,cAAA;AAAA,KAAA,CAAA;AAAA,IAGhC,KAAA,EAAO,CAAC,EAAE,KAAY,EAAA,MAAA,EAAA,KAAA;AAEpB,MAAA,MAAM,UAAU,IAAK,CAAA,GAAA,CACnB,IAAI,MAAM,CAAA,eAAA,CAAgB,KAAK,EAC/B,EAAA,GAAA,CAAA,CAAA;AAEF,MAAO,OAAA;AAAA,QACL,MAAM,CAAG,EAAA,OAAA,CAAA,CAAA,CAAA;AAAA,OAAA,CAAA;AAAA,KAAA;AAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAW1B,IAAQ,oBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,CAAA,MAAA,EAAP,IAAe,EAAA,IAAA,CAAA,CAAA,CAAA,CAAA;AAAA;;;;"}
@@ -5,9 +5,12 @@ export { FileDropzone } from './FileDropzone/src/FileDropzone.js';
5
5
  export { FileTrigger } from './FileDropzone/src/FileTrigger.js';
6
6
  export { Flag } from './Flag/src/Flag.js';
7
7
  export { NumberField } from './NumberField/src/NumberField.js';
8
+ export { ProgressIndicator } from './ProgressIndicator/src/ProgressIndicator.js';
9
+ export { Slider } from './Slider/index.js';
8
10
  export { TagGroup } from './TagGroup/src/TagGroup.js';
9
11
  export { TagItem } from './TagGroup/src/TagItem.js';
10
12
  export { LabeledValue } from './LabeledValue/src/LabeledValue.js';
13
+ export { Alert } from './Alert/src/Alert.js';
11
14
  export { useLocale } from '@react-aria/i18n';
12
15
  export { AccordionContext } from './Accordion/src/AccordionContext.js';
13
16
  //# sourceMappingURL=index.js.map
@@ -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,10 +1,11 @@
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 } from '@danske/sapphire-react';
3
+ import { SapphireStyleProps, PopoverTriggerProps, SearchFieldPropsWithRef, ListBoxProps, TypographyHeadingProps, FieldProps } from '@danske/sapphire-react';
4
4
  import { CollectionBase, DOMProps, Expandable, ItemProps, AriaLabelingProps, FocusableRefValue, PressEvents } from '@react-types/shared';
5
5
  import { HoverProps } from '@react-aria/interactions';
6
6
  import { DropOptions } from '@react-aria/dnd';
7
7
  import { AriaNumberFieldProps } from '@react-aria/numberfield';
8
+ import { SliderProps as SliderProps$1, SliderThumbProps } from 'react-aria-components';
8
9
  export { useLocale } from '@react-aria/i18n';
9
10
 
10
11
  interface FilterDropdownProps extends SapphireStyleProps, Pick<PopoverTriggerProps, 'defaultOpen' | 'isOpen' | 'onOpenChange' | 'noMaxWidth'> {
@@ -276,6 +277,54 @@ interface NumberFieldProps extends SapphireNumberFieldProps, PressEvents, Sapphi
276
277
  }
277
278
  declare const NumberField: React__default.ForwardRefExoticComponent<NumberFieldProps & React__default.RefAttributes<NumberFieldRef>>;
278
279
 
280
+ declare type ProgressIndicatorProps = {
281
+ /**
282
+ * The maximum value for the progress bar. Will be used as:
283
+ * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-valuemax
284
+ *
285
+ * @default 100
286
+ */
287
+ maxValue?: number;
288
+ /**
289
+ * The current value of the progress bar. Will be used as:
290
+ * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-valuenow
291
+ */
292
+ value: number;
293
+ /**
294
+ * Defines how many segments the progress bar will have.
295
+ *
296
+ * @default 1
297
+ */
298
+ segments?: number;
299
+ /**
300
+ * Human-readable text alternative for the current value of the progress bar. Will be used as:
301
+ * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-valuetext
302
+ */
303
+ 'aria-valuetext'?: string;
304
+ } & SapphireStyleProps & ({
305
+ 'aria-labelledby': string;
306
+ } | {
307
+ 'aria-label': string;
308
+ });
309
+ declare const ProgressIndicator: (props: ProgressIndicatorProps) => JSX.Element;
310
+
311
+ declare type SliderProps = {
312
+ label?: ReactNode;
313
+ /**
314
+ * A note to show below the slider.
315
+ * Use {@Link Slider.Note} to render the note.
316
+ */
317
+ note?: ReactNode;
318
+ } & SapphireStyleProps & Pick<FieldProps, 'isDisabled' | 'labelPlacement'> & Pick<SliderProps$1<number>, // We're only supporting sliders with one end
319
+ 'minValue' | 'maxValue' | 'step' | 'value' | 'defaultValue' | 'aria-label' | 'onChange' | 'onChangeEnd'> & Pick<SliderThumbProps, 'name'>;
320
+
321
+ declare const _Slider: (({ label, labelPlacement, note, name, isDisabled, ...props }: SliderProps) => JSX.Element) & {
322
+ Note: ({ children, variant, ...props }: {
323
+ children?: React.ReactNode;
324
+ variant?: "warning" | "error" | "success" | "neutral" | undefined;
325
+ } & React.HTMLAttributes<HTMLElement>) => React.JSX.Element;
326
+ };
327
+
279
328
  interface TagGroupProps<T> extends CollectionBase<T>, DOMProps, Pick<AriaLabelingProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-details'>, SapphireStyleProps {
280
329
  /**
281
330
  * A HelpButton element to place next to the label.
@@ -355,4 +404,20 @@ interface LabeledValueProps extends DOMProps, SapphireStyleProps {
355
404
  }
356
405
  declare function LabeledValue({ children, contextualHelp, label, labelPlacement, size, ...otherProps }: LabeledValueProps): React__default.JSX.Element;
357
406
 
358
- export { _Accordion as Accordion, AccordionContext, AccordionHeadingProps, AccordionItemProps, AccordionProps, FileDropzone, FileDropzoneProps, FileTrigger, FileTriggerProps, FilterDropdown, FilterDropdownProps, Flag, FlagProps, LabeledValue, NumberField, NumberFieldProps, NumberFieldRef, SearchableSelectFilter, SearchableSelectFilterProps, TagGroup, TagGroupProps, TagItem };
407
+ interface SapphireAlertProps extends SapphireStyleProps {
408
+ /**
409
+ * The content of the alert.
410
+ */
411
+ children?: ReactNode;
412
+ /**
413
+ * The title of the alert.
414
+ */
415
+ title?: ReactNode;
416
+ /**
417
+ * @default 'info'
418
+ */
419
+ variant?: 'info' | 'positive' | 'negative' | 'warning';
420
+ }
421
+ declare function Alert({ children, title, variant, ...props }: SapphireAlertProps): React__default.JSX.Element;
422
+
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danske/sapphire-react-lab",
3
- "version": "0.96.3",
3
+ "version": "0.98.0",
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,46 +25,48 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@danske/sapphire-icons": "^3.1.0",
28
- "@danske/sapphire-react": "^5.0.0",
28
+ "@danske/sapphire-react": "^5.4.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.2.2",
34
+ "@danske/sapphire-react": "^5.4.0",
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": "^41.0.0",
40
- "@internationalized/date": "^3.6.0",
41
- "@internationalized/string": "^3.2.5",
42
- "@react-aria/accordion": "^3.0.0-alpha.37",
43
- "@react-aria/button": "^3.14.0",
44
- "@react-aria/combobox": "^3.13.0",
45
- "@react-aria/dialog": "^3.5.28",
46
- "@react-aria/dnd": "^3.11.0",
47
- "@react-aria/focus": "^3.21.0",
48
- "@react-aria/i18n": "^3.12.11",
49
- "@react-aria/interactions": "^3.25.4",
50
- "@react-aria/label": "^3.7.20",
51
- "@react-aria/numberfield": "^3.12.0",
52
- "@react-aria/overlays": "^3.28.0",
53
- "@react-aria/tag": "^3.7.0",
54
- "@react-aria/utils": "^3.30.0",
55
- "@react-aria/visually-hidden": "^3.8.26",
39
+ "@danske/sapphire-css": "^42.1.0",
40
+ "@internationalized/date": "^3.9.0",
41
+ "@internationalized/string": "^3.2.7",
42
+ "@react-aria/accordion": "3.0.0-alpha.37",
43
+ "@react-aria/button": "^3.14.1",
44
+ "@react-aria/combobox": "^3.13.1",
45
+ "@react-aria/dialog": "^3.5.29",
46
+ "@react-aria/dnd": "^3.11.1",
47
+ "@react-aria/focus": "^3.21.1",
48
+ "@react-aria/i18n": "^3.12.12",
49
+ "@react-aria/interactions": "^3.25.5",
50
+ "@react-aria/label": "^3.7.21",
51
+ "@react-aria/numberfield": "^3.12.1",
52
+ "@react-aria/overlays": "^3.29.0",
53
+ "@react-aria/progress": "^3.4.26",
54
+ "@react-aria/tag": "^3.7.1",
55
+ "@react-aria/utils": "^3.30.1",
56
+ "@react-aria/visually-hidden": "^3.8.27",
56
57
  "@react-spectrum/utils": "^3.12.5",
57
- "@react-stately/collections": "^3.12.6",
58
- "@react-stately/combobox": "^3.11.0",
59
- "@react-stately/list": "^3.12.4",
60
- "@react-stately/numberfield": "^3.10.0",
61
- "@react-stately/toggle": "^3.9.0",
62
- "@react-stately/tree": "^3.9.1",
58
+ "@react-stately/collections": "^3.12.7",
59
+ "@react-stately/combobox": "^3.11.1",
60
+ "@react-stately/list": "^3.13.0",
61
+ "@react-stately/numberfield": "^3.10.1",
62
+ "@react-stately/toggle": "^3.9.1",
63
+ "@react-stately/tree": "^3.9.2",
63
64
  "@react-stately/utils": "^3.10.8",
64
- "@react-types/dialog": "^3.5.20",
65
- "@react-types/shared": "^3.31.0",
65
+ "@react-types/dialog": "^3.5.21",
66
+ "@react-types/shared": "^3.32.0",
66
67
  "clsx": "^1.1.1",
68
+ "react-aria-components": "^1.12.1",
67
69
  "react-transition-group": "^4.4.5"
68
70
  },
69
- "gitHead": "4cb9fa793fcb43b74fe8b925c7810d9cd76ba1f9"
71
+ "gitHead": "1eefb683b16687ab3fc99c15fffb03a3eca522c5"
70
72
  }