@danske/sapphire-react-lab 0.103.0 → 0.105.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.
- package/README.md +2 -1
- package/build/cjs/index.js +1970 -748
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/index.js +3 -1
- package/build/esm/Accordion/index.js.map +1 -1
- package/build/esm/Accordion/src/Accordion.js +28 -22
- package/build/esm/Accordion/src/Accordion.js.map +1 -1
- package/build/esm/Accordion/src/AccordionContext.js +2 -1
- package/build/esm/Accordion/src/AccordionContext.js.map +1 -1
- package/build/esm/Accordion/src/AccordionHeading.js +30 -10
- package/build/esm/Accordion/src/AccordionHeading.js.map +1 -1
- package/build/esm/Accordion/src/AccordionItem.js +54 -52
- package/build/esm/Accordion/src/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/src/AccordionPanel.js +58 -0
- package/build/esm/Accordion/src/AccordionPanel.js.map +1 -0
- package/build/esm/Accordion/src/utils.js +7 -0
- package/build/esm/Accordion/src/utils.js.map +1 -0
- package/build/esm/Amount/src/Amount.js +76 -0
- package/build/esm/Amount/src/Amount.js.map +1 -0
- package/build/esm/Amount/src/useGroupAmount.js +35 -0
- package/build/esm/Amount/src/useGroupAmount.js.map +1 -0
- package/build/esm/Autocomplete/src/Autocomplete.js +13 -3
- package/build/esm/Autocomplete/src/Autocomplete.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbItemStatic.js +31 -9
- package/build/esm/Breadcrumbs/src/BreadcrumbItemStatic.js.map +1 -1
- package/build/esm/Breadcrumbs/src/BreadcrumbOverflowMenu.js +1 -2
- package/build/esm/Breadcrumbs/src/BreadcrumbOverflowMenu.js.map +1 -1
- package/build/esm/Filtering/src/FilterDropdown.js +8 -3
- package/build/esm/Filtering/src/FilterDropdown.js.map +1 -1
- package/build/esm/Filtering/src/SearchableSelectFilter.js +3 -1
- package/build/esm/Filtering/src/SearchableSelectFilter.js.map +1 -1
- package/build/esm/NumberField/src/NumberField.js +53 -21
- package/build/esm/NumberField/src/NumberField.js.map +1 -1
- package/build/esm/NumberField/src/StepperButton.js +8 -4
- package/build/esm/NumberField/src/StepperButton.js.map +1 -1
- package/build/esm/NumberField/src/cursorHelpers.js +55 -0
- package/build/esm/NumberField/src/cursorHelpers.js.map +1 -0
- package/build/esm/NumberField/src/formatHelpers.js +81 -0
- package/build/esm/NumberField/src/formatHelpers.js.map +1 -0
- package/build/esm/NumberField/src/keyboardHelpers.js +120 -0
- package/build/esm/NumberField/src/keyboardHelpers.js.map +1 -0
- package/build/esm/NumberField/src/useNumberFieldFormatting.js +94 -0
- package/build/esm/NumberField/src/useNumberFieldFormatting.js.map +1 -0
- package/build/esm/NumberField/src/useSapphireNumberField.js +1 -1
- package/build/esm/NumberField/src/useSapphireNumberField.js.map +1 -1
- package/build/esm/Sidebar/index.js +23 -0
- package/build/esm/Sidebar/index.js.map +1 -0
- package/build/esm/Sidebar/src/Body.js +56 -0
- package/build/esm/Sidebar/src/Body.js.map +1 -0
- package/build/esm/Sidebar/src/ExpandableItem.js +133 -0
- package/build/esm/Sidebar/src/ExpandableItem.js.map +1 -0
- package/build/esm/Sidebar/src/Header.js +55 -0
- package/build/esm/Sidebar/src/Header.js.map +1 -0
- package/build/esm/Sidebar/src/Item.js +56 -0
- package/build/esm/Sidebar/src/Item.js.map +1 -0
- package/build/esm/Sidebar/src/List.js +52 -0
- package/build/esm/Sidebar/src/List.js.map +1 -0
- package/build/esm/Sidebar/src/Panel.js +104 -0
- package/build/esm/Sidebar/src/Panel.js.map +1 -0
- package/build/esm/Sidebar/src/ResponsiveSidebarContext.js +42 -0
- package/build/esm/Sidebar/src/ResponsiveSidebarContext.js.map +1 -0
- package/build/esm/Sidebar/src/SecondarySidebarContext.js +35 -0
- package/build/esm/Sidebar/src/SecondarySidebarContext.js.map +1 -0
- package/build/esm/Sidebar/src/Section.js +66 -0
- package/build/esm/Sidebar/src/Section.js.map +1 -0
- package/build/esm/Sidebar/src/Sidebar.js +114 -0
- package/build/esm/Sidebar/src/Sidebar.js.map +1 -0
- package/build/esm/Sidebar/src/useSidebar.js +29 -0
- package/build/esm/Sidebar/src/useSidebar.js.map +1 -0
- package/build/esm/TagGroup/src/Tag.js +31 -23
- package/build/esm/TagGroup/src/Tag.js.map +1 -1
- package/build/esm/index.js +2 -0
- package/build/esm/index.js.map +1 -1
- package/build/index.d.ts +238 -27
- package/package.json +35 -35
- package/build/esm/Accordion/src/useTreeState.js +0 -42
- package/build/esm/Accordion/src/useTreeState.js.map +0 -1
package/build/index.d.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode, ReactElement, RefObject
|
|
2
|
+
import React__default, { ReactNode, Key, ReactElement, RefObject } from 'react';
|
|
3
3
|
import * as _react_types_shared from '@react-types/shared';
|
|
4
|
-
import {
|
|
4
|
+
import { DOMProps, AriaLabelingProps, FocusableRefValue, PressEvents, CollectionBase, ItemProps } from '@react-types/shared';
|
|
5
5
|
import * as _danske_sapphire_react from '@danske/sapphire-react';
|
|
6
|
-
import { GlobalDomAttributes, SapphireStyleProps, TypographyHeadingProps, ListBoxProps, ButtonProps, PopoverTriggerProps, SearchFieldPropsWithRef, FieldProps } from '@danske/sapphire-react';
|
|
6
|
+
import { GlobalDomAttributes, SapphireStyleProps, TypographyHeadingProps, TypographyBodyProps, ListBoxProps, ButtonProps, PopoverTriggerProps, SearchFieldPropsWithRef, IconButtonProps, ThemeVariant, FieldProps } from '@danske/sapphire-react';
|
|
7
|
+
import { DisclosureGroupProps, DisclosureProps, DisclosurePanelProps, BreadcrumbsProps as BreadcrumbsProps$1, BreadcrumbProps, SliderProps as SliderProps$1, SliderThumbProps, TimeValue } from 'react-aria-components';
|
|
7
8
|
import { ComboBoxProps } from '@react-types/combobox';
|
|
8
|
-
import {
|
|
9
|
-
import { HoverProps } from '@react-aria/interactions';
|
|
9
|
+
import { HoverProps, FocusWithinProps } from '@react-aria/interactions';
|
|
10
10
|
import { DropOptions } from '@react-aria/dnd';
|
|
11
11
|
import { AriaNumberFieldProps } from '@react-aria/numberfield';
|
|
12
12
|
import { AriaTimeFieldProps } from '@react-aria/datepicker';
|
|
13
13
|
export { useLocale } from '@react-aria/i18n';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
interface AccordionProps<T> extends GlobalDomAttributes, SapphireStyleProps, CollectionBase<T>, DOMProps, Expandable {
|
|
18
|
-
/** Allow one or many expanded items
|
|
19
|
-
* @default 'multiple'
|
|
20
|
-
*/
|
|
21
|
-
expansionMode?: TreeExpansionMode;
|
|
15
|
+
interface AccordionProps extends GlobalDomAttributes, SapphireStyleProps, DOMProps, Pick<DisclosureGroupProps, 'allowsMultipleExpanded' | 'expandedKeys' | 'defaultExpandedKeys' | 'onExpandedChange' | 'children' | 'isDisabled'> {
|
|
22
16
|
/** Set aria-level attribute for item's header. Accessibility requirement.
|
|
23
17
|
* Defines the hierarchical level of an element within a page structure.
|
|
24
18
|
* @default 5
|
|
@@ -51,22 +45,25 @@ interface AccordionProps<T> extends GlobalDomAttributes, SapphireStyleProps, Col
|
|
|
51
45
|
|
|
52
46
|
interface AccordionHeadingProps extends DOMProps {
|
|
53
47
|
children?: ReactNode;
|
|
48
|
+
headerLevel?: TypographyHeadingProps['level'];
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
interface AccordionItemProps
|
|
57
|
-
heading: ReactNode;
|
|
51
|
+
interface AccordionItemProps extends DOMProps, Pick<DisclosureProps, 'children' | 'isDisabled'> {
|
|
58
52
|
}
|
|
59
53
|
|
|
60
54
|
interface AccordionContextProps {
|
|
61
55
|
sidePadding?: number | string;
|
|
56
|
+
headerLevel?: TypographyHeadingProps['level'];
|
|
62
57
|
}
|
|
63
58
|
declare const AccordionContext: React__default.Context<AccordionContextProps>;
|
|
64
59
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
interface AccordionPanelProps extends DOMProps, Pick<DisclosurePanelProps, 'children' | 'role'> {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare const _Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>> & {
|
|
64
|
+
Heading: React.ForwardRefExoticComponent<AccordionHeadingProps & React.RefAttributes<HTMLDivElement>>;
|
|
65
|
+
Item: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
Panel: React.ForwardRefExoticComponent<AccordionPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
70
67
|
};
|
|
71
68
|
|
|
72
69
|
interface SapphireAlertProps extends GlobalDomAttributes, SapphireStyleProps {
|
|
@@ -85,7 +82,50 @@ interface SapphireAlertProps extends GlobalDomAttributes, SapphireStyleProps {
|
|
|
85
82
|
}
|
|
86
83
|
declare function Alert({ children, title, variant, ...props }: SapphireAlertProps): React__default.JSX.Element;
|
|
87
84
|
|
|
88
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Format options for currency amounts.
|
|
87
|
+
* The style is always 'currency', so only currency-related options are exposed.
|
|
88
|
+
*/
|
|
89
|
+
declare type CurrencyFormatOptions = Pick<Intl.NumberFormatOptions, 'currency' | 'currencyDisplay' | 'currencySign' | 'signDisplay' | 'minimumFractionDigits' | 'maximumFractionDigits' | 'minimumSignificantDigits' | 'maximumSignificantDigits' | 'useGrouping' | 'notation'>;
|
|
90
|
+
declare type AmountProps = {
|
|
91
|
+
/**
|
|
92
|
+
* When displaying amounts, readability and visual hierarchy are key. Use medium weight for primary emphasis to highlight amounts or regular weight for secondary emphasis.
|
|
93
|
+
*
|
|
94
|
+
* @default 'regular'
|
|
95
|
+
*/
|
|
96
|
+
emphasis?: 'primary' | 'regular';
|
|
97
|
+
/**
|
|
98
|
+
* The variant of the Amount component. `positive` shows a green color, and should be used for amounts greater than zero.
|
|
99
|
+
*
|
|
100
|
+
* @default 'neutal'
|
|
101
|
+
*/
|
|
102
|
+
variant?: 'neutal' | 'positive';
|
|
103
|
+
/**
|
|
104
|
+
* The amount value to be formatted and displayed.
|
|
105
|
+
*
|
|
106
|
+
* If displaying the sign is a requirement, ensure the value is a string that starts with '+' or '-'.
|
|
107
|
+
* Alternatively, you can use the `signDisplay` option in `formatOptions` to control the display of the sign for numeric values.
|
|
108
|
+
*/
|
|
109
|
+
value: string | number;
|
|
110
|
+
/** Currency formatting options */
|
|
111
|
+
formatOptions?: CurrencyFormatOptions;
|
|
112
|
+
} & Pick<TypographyBodyProps, 'size'> & SapphireStyleProps & GlobalDomAttributes;
|
|
113
|
+
declare const Amount: ({ emphasis, variant, formatOptions, value, size, ...props }: AmountProps) => JSX.Element;
|
|
114
|
+
|
|
115
|
+
declare type AutocompleteProps<T extends object> = GlobalDomAttributes & SapphireStyleProps & Pick<ComboBoxProps<T>, 'items' | 'children' | 'inputValue' | 'defaultInputValue' | 'onInputChange' | 'isDisabled'> & Pick<ListBoxProps<T>, 'loadingState' | 'loadingSkeletonRowsCount'> & {
|
|
116
|
+
/**
|
|
117
|
+
* This prop is badly named. It is NOT related to a selection state being
|
|
118
|
+
* changed since there is no selection state in this component.
|
|
119
|
+
*
|
|
120
|
+
* This callback simply notifies you when the user filled in the text field
|
|
121
|
+
* by selecting an option from the autocomplete dropdown. Similar to an
|
|
122
|
+
* onClick.
|
|
123
|
+
*
|
|
124
|
+
* @deprecated
|
|
125
|
+
* Use `onSuggestionSelected` instead.
|
|
126
|
+
*/
|
|
127
|
+
onSelectionChange?: Pick<ComboBoxProps<T>, 'onSelectionChange'>['onSelectionChange'];
|
|
128
|
+
onSuggestionSelected?: (key: Key) => void;
|
|
89
129
|
/**
|
|
90
130
|
* Render function for the input element.
|
|
91
131
|
* Receives props that should be spread onto the input component.
|
|
@@ -125,7 +165,7 @@ declare type BreadcrumbsProps<T extends object> = Pick<BreadcrumbsProps$1<T>, 'a
|
|
|
125
165
|
* It was necessary to own the implementation to add support for
|
|
126
166
|
* handling the collection directly, as we need it for the overflow calculation logic.
|
|
127
167
|
*/
|
|
128
|
-
declare const Breadcrumbs: <T extends object>(props: Pick<BreadcrumbsProps$1<T>, "children" | "
|
|
168
|
+
declare const Breadcrumbs: <T extends object>(props: Pick<BreadcrumbsProps$1<T>, "children" | "isDisabled" | "aria-label"> & {
|
|
129
169
|
/**
|
|
130
170
|
* The size of the breadcrumbs component.
|
|
131
171
|
*
|
|
@@ -150,7 +190,7 @@ declare type BreadcrumbItemProps = {
|
|
|
150
190
|
*/
|
|
151
191
|
declare const BreadcrumbItem: (props: {
|
|
152
192
|
isDisabled?: boolean | undefined;
|
|
153
|
-
} & SapphireStyleProps & Pick<_react_types_shared.GlobalDOMAttributes<Element>, "translate" | "dir" | "lang" | "inert"> & Pick<_react_types_shared.DOMProps, "id"> & Pick<BreadcrumbProps, "children"> & Pick<_danske_sapphire_react.ButtonProps<"a">, "children" | "
|
|
193
|
+
} & SapphireStyleProps & Pick<_react_types_shared.GlobalDOMAttributes<Element>, "translate" | "dir" | "lang" | "inert"> & Pick<_react_types_shared.DOMProps, "id"> & Pick<BreadcrumbProps, "children"> & Pick<_danske_sapphire_react.ButtonProps<"a">, "children" | "isDisabled" | "icon" | "href" | "target" | "rel" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-details" | "hrefLang" | "UNSAFE_onClick"> & React__default.RefAttributes<HTMLLIElement>) => React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | null;
|
|
154
194
|
|
|
155
195
|
interface FileSelectProps {
|
|
156
196
|
/**
|
|
@@ -233,6 +273,10 @@ interface FilterDropdownProps extends GlobalDomAttributes, SapphireStyleProps, P
|
|
|
233
273
|
* Whether the 'Apply' button is disabled.
|
|
234
274
|
*/
|
|
235
275
|
isApplyDisabled?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Whether the 'Clear' button is hidden.
|
|
278
|
+
*/
|
|
279
|
+
hideClearButton?: boolean;
|
|
236
280
|
/**
|
|
237
281
|
* Whether the 'Clear' button is disabled.
|
|
238
282
|
*/
|
|
@@ -256,7 +300,7 @@ interface FilterDropdownProps extends GlobalDomAttributes, SapphireStyleProps, P
|
|
|
256
300
|
/**
|
|
257
301
|
* A button with a dropdown, used for filtering UI.
|
|
258
302
|
*/
|
|
259
|
-
declare function FilterDropdown({ children, label, value, isDisabled, isApplyDisabled, isClearDisabled, isOpen: isOpenProp, applyButtonLabel, clearButtonLabel, defaultOpen, hasApplyButton, noMaxWidth, onApply, onClear, onOpenChange, buttonSize, ...props }: FilterDropdownProps): JSX.Element;
|
|
303
|
+
declare function FilterDropdown({ children, label, value, isDisabled, isApplyDisabled, isClearDisabled, isOpen: isOpenProp, applyButtonLabel, clearButtonLabel, hideClearButton, defaultOpen, hasApplyButton, noMaxWidth, onApply, onClear, onOpenChange, buttonSize, ...props }: FilterDropdownProps): JSX.Element;
|
|
260
304
|
|
|
261
305
|
interface SearchableSelectFilterProps extends GlobalDomAttributes, SapphireStyleProps, Omit<FilterDropdownProps, 'children'> {
|
|
262
306
|
/**
|
|
@@ -348,8 +392,20 @@ declare type NumberFieldRef = FocusableRefValue<HTMLInputElement, HTMLDivElement
|
|
|
348
392
|
getInputElement(): HTMLInputElement | null;
|
|
349
393
|
};
|
|
350
394
|
interface NumberFieldProps extends SapphireNumberFieldProps, PressEvents, SapphireStyleProps, GlobalDomAttributes {
|
|
351
|
-
|
|
352
|
-
|
|
395
|
+
/**
|
|
396
|
+
* A string or element to show before / after the input value.
|
|
397
|
+
*
|
|
398
|
+
* By default (`'auto'`), the component will automatically extract currency/unit symbols
|
|
399
|
+
* from the locale formatter and display them as prefix/postfix.
|
|
400
|
+
* If you provide a custom prefix or postfix, those will be used instead and
|
|
401
|
+
* the extracted symbols will be ignored.
|
|
402
|
+
*
|
|
403
|
+
* @default 'auto' - automatically extracts currency/unit symbols from locale formatter
|
|
404
|
+
*/
|
|
405
|
+
affix?: 'auto' | {
|
|
406
|
+
prefix?: ReactNode;
|
|
407
|
+
postfix?: ReactNode;
|
|
408
|
+
};
|
|
353
409
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
354
410
|
/**
|
|
355
411
|
* A note to show below the input.
|
|
@@ -383,9 +439,164 @@ interface NumberFieldProps extends SapphireNumberFieldProps, PressEvents, Sapphi
|
|
|
383
439
|
* @default false
|
|
384
440
|
*/
|
|
385
441
|
showButtons?: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Enables automatic formatting of the input value as the user types, based on the provided formatter and affix.
|
|
444
|
+
*
|
|
445
|
+
* @default false
|
|
446
|
+
*/
|
|
447
|
+
autoFormat?: boolean;
|
|
386
448
|
}
|
|
387
449
|
declare const NumberField: React__default.ForwardRefExoticComponent<NumberFieldProps & React__default.RefAttributes<NumberFieldRef>>;
|
|
388
450
|
|
|
451
|
+
declare type SidebarSectionProps = DOMProps & SapphireStyleProps & {
|
|
452
|
+
/**
|
|
453
|
+
* Section title
|
|
454
|
+
* If not provided, please pass the `aria-label`
|
|
455
|
+
*/
|
|
456
|
+
title?: string;
|
|
457
|
+
/**
|
|
458
|
+
* Section aria title
|
|
459
|
+
*/
|
|
460
|
+
'aria-label'?: string;
|
|
461
|
+
children?: ReactNode;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
interface SidebarListProps extends DOMProps {
|
|
465
|
+
/**
|
|
466
|
+
* Wrapping element type.
|
|
467
|
+
* @default 'ul'
|
|
468
|
+
*/
|
|
469
|
+
elementType?: 'ul' | 'ol';
|
|
470
|
+
children?: ReactNode;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
interface SidebarBodyProps extends DOMProps {
|
|
474
|
+
/**
|
|
475
|
+
* Wrapping element type.
|
|
476
|
+
* @default 'nav'
|
|
477
|
+
*/
|
|
478
|
+
elementType?: string;
|
|
479
|
+
children?: ReactNode;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
interface SidebarHeaderProps extends DOMProps {
|
|
483
|
+
children: ReactNode;
|
|
484
|
+
/**
|
|
485
|
+
* Props for the close button
|
|
486
|
+
* If none provided, close button won't show
|
|
487
|
+
*/
|
|
488
|
+
closeButtonProps?: Omit<IconButtonProps<'button'>, 'children' | 'aria-label' | 'aria-hidden'>;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
declare type SidebarProps = DOMProps & SapphireStyleProps & {
|
|
492
|
+
/**
|
|
493
|
+
* Shorthand to wrap the sidebar in a ThemeRoot with a different theme variant
|
|
494
|
+
*/
|
|
495
|
+
themeVariant?: ThemeVariant;
|
|
496
|
+
/**
|
|
497
|
+
* The theme variant for the overflow sidebar
|
|
498
|
+
*/
|
|
499
|
+
secondarySidebarThemeVariant?: ThemeVariant;
|
|
500
|
+
/**
|
|
501
|
+
* Callback for when the sidebar's elements lose focus.
|
|
502
|
+
* Useful to know when to close the overflow sidebar.
|
|
503
|
+
*/
|
|
504
|
+
onBlurWithin?: FocusWithinProps['onBlurWithin'];
|
|
505
|
+
/**
|
|
506
|
+
* Callback for when one of the sidebar's elements first gains focus.
|
|
507
|
+
*/
|
|
508
|
+
onFocusWithin?: FocusWithinProps['onFocusWithin'];
|
|
509
|
+
/**
|
|
510
|
+
* Callback for when one of the sidebar's elements loses or gains focus
|
|
511
|
+
*/
|
|
512
|
+
onFocusWithinChange?: FocusWithinProps['onFocusWithinChange'];
|
|
513
|
+
/**
|
|
514
|
+
* Whether the overflow sidebar should close when all sidebar's elements
|
|
515
|
+
* lost focus
|
|
516
|
+
* @default true
|
|
517
|
+
*/
|
|
518
|
+
closeOnBlurWithin?: boolean;
|
|
519
|
+
/**
|
|
520
|
+
* The header of the sidebar
|
|
521
|
+
*/
|
|
522
|
+
header: ReactNode;
|
|
523
|
+
/**
|
|
524
|
+
* The header of the sidebar for small screens, when the sidebar is
|
|
525
|
+
* rendered as a panel
|
|
526
|
+
*/
|
|
527
|
+
panelHeader?: ReactNode;
|
|
528
|
+
/**
|
|
529
|
+
* The id of the opened secondary sidebar (controlled)
|
|
530
|
+
*/
|
|
531
|
+
openedSecondarySidebar?: string | null;
|
|
532
|
+
/**
|
|
533
|
+
* The id of the secondary sidebar opened by default (uncontrolled)
|
|
534
|
+
*/
|
|
535
|
+
defaultOpenedSecondarySidebar?: string | null;
|
|
536
|
+
/**
|
|
537
|
+
* Callback for when the secondary sidebar opens or closes
|
|
538
|
+
*/
|
|
539
|
+
onSecondarySidebarChange?: (id: string | null) => void;
|
|
540
|
+
children?: ReactNode;
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
declare type SidebarItemProps = Omit<ButtonProps<'a'>, 'variant' | 'size' | 'elementType'> & {
|
|
544
|
+
/**
|
|
545
|
+
* If the link is currently active
|
|
546
|
+
*/
|
|
547
|
+
isActive?: boolean;
|
|
548
|
+
children?: ReactNode;
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
declare type SidebarExpandableItemProps = Omit<ButtonProps<'button'>, 'variant' | 'size' | 'elementType'> & {
|
|
552
|
+
/**
|
|
553
|
+
* If the link is currently active
|
|
554
|
+
*/
|
|
555
|
+
isActive?: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* The id of the group.
|
|
558
|
+
* Used in `onSecondarySidebarChange` or when the sidebar is controlled
|
|
559
|
+
*/
|
|
560
|
+
id?: string;
|
|
561
|
+
/**
|
|
562
|
+
* Heading used for secondary sidebar
|
|
563
|
+
*/
|
|
564
|
+
header: ReactNode;
|
|
565
|
+
/**
|
|
566
|
+
* Subitems (secondary sidebar)
|
|
567
|
+
*/
|
|
568
|
+
body: ReactNode;
|
|
569
|
+
children?: ReactNode;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
declare const _Sidebar: (({ themeVariant, openedSecondarySidebar, defaultOpenedSecondarySidebar, onSecondarySidebarChange, secondarySidebarThemeVariant, children, ...props }: SidebarProps) => React.JSX.Element) & {
|
|
573
|
+
ResponsiveProvider: ({ collapsed, isPanelOpen, defaultIsPanelOpen, onPanelOpenChange, children, }: {
|
|
574
|
+
collapsed?: boolean | "lg" | "sm" | "md" | "xl" | "xs" | undefined;
|
|
575
|
+
isPanelOpen?: boolean | undefined;
|
|
576
|
+
defaultIsPanelOpen?: boolean | undefined;
|
|
577
|
+
onPanelOpenChange?: ((open: boolean) => void) | undefined;
|
|
578
|
+
children: React.ReactNode;
|
|
579
|
+
}) => React.JSX.Element;
|
|
580
|
+
Header: ({ children, closeButtonProps, ...props }: SidebarHeaderProps) => React.JSX.Element;
|
|
581
|
+
Body: ({ elementType, children, ...props }: SidebarBodyProps) => React.JSX.Element;
|
|
582
|
+
List: ({ elementType, children, ...props }: SidebarListProps) => React.JSX.Element;
|
|
583
|
+
Item: React.ForwardRefExoticComponent<Omit<_danske_sapphire_react.ButtonProps<"a">, "size" | "elementType" | "variant"> & {
|
|
584
|
+
isActive?: boolean | undefined;
|
|
585
|
+
children?: React.ReactNode;
|
|
586
|
+
} & React.RefAttributes<_react_types_shared.FocusableRefValue<HTMLAnchorElement, HTMLAnchorElement>>>;
|
|
587
|
+
ExpandableItem: React.ForwardRefExoticComponent<Omit<_danske_sapphire_react.ButtonProps<"button">, "size" | "elementType" | "variant"> & {
|
|
588
|
+
isActive?: boolean | undefined;
|
|
589
|
+
id?: string | undefined;
|
|
590
|
+
header: React.ReactNode;
|
|
591
|
+
body: React.ReactNode;
|
|
592
|
+
children?: React.ReactNode;
|
|
593
|
+
} & React.RefAttributes<_react_types_shared.FocusableRefValue<HTMLAnchorElement, HTMLAnchorElement>>>;
|
|
594
|
+
Section: ({ title, "aria-label": label, children, ...props }: SidebarSectionProps) => React.JSX.Element;
|
|
595
|
+
PanelTrigger: ({ children, }: {
|
|
596
|
+
children: (triggerProps: any) => JSX.Element;
|
|
597
|
+
}) => JSX.Element | null;
|
|
598
|
+
};
|
|
599
|
+
|
|
389
600
|
declare type ProgressIndicatorProps = {
|
|
390
601
|
/**
|
|
391
602
|
* The maximum value for the progress bar. Will be used as:
|
|
@@ -534,7 +745,7 @@ declare type TimeFieldProps<T extends TimeValue> = Pick<AriaTimeFieldProps<T>, '
|
|
|
534
745
|
*/
|
|
535
746
|
contextualHelp?: ReactNode;
|
|
536
747
|
};
|
|
537
|
-
declare const TimeField: <T extends TimeValue>(props: Pick<AriaTimeFieldProps<T>, "value" | "
|
|
748
|
+
declare const TimeField: <T extends TimeValue>(props: Pick<AriaTimeFieldProps<T>, "value" | "isDisabled" | "label" | "onFocus" | "onBlur" | "isReadOnly" | "isRequired" | "defaultValue" | "onChange" | "shouldForceLeadingZeros"> & SapphireStyleProps & Pick<_react_types_shared.GlobalDOMAttributes<Element>, "translate" | "dir" | "lang" | "inert"> & Pick<_react_types_shared.DOMProps, "id"> & {
|
|
538
749
|
/**
|
|
539
750
|
* @default 'lg'
|
|
540
751
|
*/
|
|
@@ -580,4 +791,4 @@ declare const TimeField: <T extends TimeValue>(props: Pick<AriaTimeFieldProps<T>
|
|
|
580
791
|
ref?: React__default.RefObject<HTMLDivElement> | undefined;
|
|
581
792
|
}) => React__default.ReactElement;
|
|
582
793
|
|
|
583
|
-
export { _Accordion as Accordion, AccordionContext, AccordionHeadingProps, AccordionItemProps, AccordionProps, Alert, Autocomplete, AutocompleteProps, BreadcrumbItem, 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, TimeField, TimeFieldProps };
|
|
794
|
+
export { _Accordion as Accordion, AccordionContext, AccordionHeadingProps, AccordionItemProps, AccordionPanelProps, AccordionProps, Alert, Amount, AmountProps, Autocomplete, AutocompleteProps, BreadcrumbItem, BreadcrumbItemProps, Breadcrumbs, BreadcrumbsProps, FileDropzone, FileDropzoneProps, FileTrigger, FileTriggerProps, FilterDropdown, FilterDropdownProps, Flag, FlagProps, LabeledValue, NumberField, NumberFieldProps, NumberFieldRef, ProgressIndicator, ProgressIndicatorProps, SapphireAlertProps, SearchableSelectFilter, SearchableSelectFilterProps, _Sidebar as Sidebar, SidebarBodyProps, SidebarExpandableItemProps, SidebarHeaderProps, SidebarItemProps, SidebarListProps, SidebarProps, SidebarSectionProps, _Slider as Slider, SliderProps, TagGroup, TagGroupProps, TagItem, TimeField, TimeFieldProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danske/sapphire-react-lab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.105.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,53 +25,53 @@
|
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@danske/sapphire-icons": "^3.1.0",
|
|
28
|
-
"@danske/sapphire-react": "^5.
|
|
28
|
+
"@danske/sapphire-react": "^5.12.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.
|
|
34
|
+
"@danske/sapphire-react": "^5.13.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": "^
|
|
40
|
-
"@internationalized/date": "^3.
|
|
39
|
+
"@danske/sapphire-css": "^50.1.0",
|
|
40
|
+
"@internationalized/date": "^3.11.0",
|
|
41
41
|
"@internationalized/string": "^3.2.7",
|
|
42
|
-
"@react-aria/
|
|
43
|
-
"@react-aria/
|
|
44
|
-
"@react-aria/
|
|
45
|
-
"@react-aria/
|
|
46
|
-
"@react-aria/
|
|
47
|
-
"@react-aria/
|
|
48
|
-
"@react-aria/
|
|
49
|
-
"@react-aria/
|
|
50
|
-
"@react-aria/
|
|
51
|
-
"@react-aria/
|
|
52
|
-
"@react-aria/
|
|
53
|
-
"@react-aria/
|
|
54
|
-
"@react-aria/numberfield": "^3.12.
|
|
55
|
-
"@react-aria/overlays": "^3.31.
|
|
56
|
-
"@react-aria/progress": "^3.4.
|
|
57
|
-
"@react-aria/tag": "^3.
|
|
58
|
-
"@react-aria/utils": "^3.
|
|
59
|
-
"@react-aria/visually-hidden": "^3.8.
|
|
42
|
+
"@react-aria/breadcrumbs": "^3.5.31",
|
|
43
|
+
"@react-aria/button": "^3.14.4",
|
|
44
|
+
"@react-aria/collections": "^3.0.2",
|
|
45
|
+
"@react-aria/combobox": "^3.14.2",
|
|
46
|
+
"@react-aria/datepicker": "^3.16.0",
|
|
47
|
+
"@react-aria/dialog": "^3.5.33",
|
|
48
|
+
"@react-aria/dnd": "^3.11.5",
|
|
49
|
+
"@react-aria/focus": "^3.21.4",
|
|
50
|
+
"@react-aria/i18n": "^3.12.15",
|
|
51
|
+
"@react-aria/interactions": "^3.27.0",
|
|
52
|
+
"@react-aria/label": "^3.7.24",
|
|
53
|
+
"@react-aria/listbox": "^3.15.2",
|
|
54
|
+
"@react-aria/numberfield": "^3.12.4",
|
|
55
|
+
"@react-aria/overlays": "^3.31.1",
|
|
56
|
+
"@react-aria/progress": "^3.4.29",
|
|
57
|
+
"@react-aria/tag": "^3.8.0",
|
|
58
|
+
"@react-aria/utils": "^3.33.0",
|
|
59
|
+
"@react-aria/visually-hidden": "^3.8.30",
|
|
60
60
|
"@react-spectrum/utils": "^3.12.5",
|
|
61
|
-
"@react-stately/collections": "^3.12.
|
|
62
|
-
"@react-stately/combobox": "^3.12.
|
|
63
|
-
"@react-stately/datepicker": "^3.
|
|
64
|
-
"@react-stately/list": "^3.13.
|
|
65
|
-
"@react-stately/numberfield": "^3.10.
|
|
66
|
-
"@react-stately/overlays": "^3.6.
|
|
67
|
-
"@react-stately/toggle": "^3.9.
|
|
68
|
-
"@react-stately/tree": "^3.9.
|
|
61
|
+
"@react-stately/collections": "^3.12.9",
|
|
62
|
+
"@react-stately/combobox": "^3.12.2",
|
|
63
|
+
"@react-stately/datepicker": "^3.16.0",
|
|
64
|
+
"@react-stately/list": "^3.13.3",
|
|
65
|
+
"@react-stately/numberfield": "^3.10.4",
|
|
66
|
+
"@react-stately/overlays": "^3.6.22",
|
|
67
|
+
"@react-stately/toggle": "^3.9.4",
|
|
68
|
+
"@react-stately/tree": "^3.9.5",
|
|
69
69
|
"@react-stately/utils": "^3.11.0",
|
|
70
|
-
"@react-types/dialog": "^3.5.
|
|
71
|
-
"@react-types/shared": "^3.
|
|
70
|
+
"@react-types/dialog": "^3.5.23",
|
|
71
|
+
"@react-types/shared": "^3.33.0",
|
|
72
72
|
"clsx": "^1.1.1",
|
|
73
|
-
"react-aria-components": "^1.
|
|
73
|
+
"react-aria-components": "^1.15.1",
|
|
74
74
|
"react-transition-group": "^4.4.5"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "6e7cb3028dc134adc624e161700df8cb3bc3bfb7"
|
|
77
77
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useTreeState as useTreeState$1 } from '@react-stately/tree';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __spreadValues = (a, b) => {
|
|
11
|
-
for (var prop in b || (b = {}))
|
|
12
|
-
if (__hasOwnProp.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
if (__getOwnPropSymbols)
|
|
15
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
-
if (__propIsEnum.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
}
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
-
function useTreeState(props) {
|
|
23
|
-
const state = useTreeState$1(props);
|
|
24
|
-
const onToggle = (key) => {
|
|
25
|
-
state.setExpandedKeys(toggleKey(state.expandedKeys, key, props.expansionMode));
|
|
26
|
-
};
|
|
27
|
-
return __spreadProps(__spreadValues({}, state), { toggleKey: onToggle });
|
|
28
|
-
}
|
|
29
|
-
function toggleKey(set, key, expansionMode = "multiple") {
|
|
30
|
-
const res = new Set(set);
|
|
31
|
-
if (res.has(key)) {
|
|
32
|
-
res.delete(key);
|
|
33
|
-
} else {
|
|
34
|
-
if (expansionMode === "single")
|
|
35
|
-
res.clear();
|
|
36
|
-
res.add(key);
|
|
37
|
-
}
|
|
38
|
-
return res;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { useTreeState };
|
|
42
|
-
//# sourceMappingURL=useTreeState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeState.js","sources":["../../../../src/Accordion/src/useTreeState.ts"],"sourcesContent":["import { Key } from 'react';\nimport {\n TreeProps as OriginalTreeProps,\n TreeState,\n useTreeState as useOriginalTreeState,\n} from '@react-stately/tree';\n\n/**\n * A wrapper for `useTreeState` to add support of single expanded item\n *\n * More details here\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/tree/src/useTreeState.ts\n */\n\nexport interface TreeProps<T> extends OriginalTreeProps<T> {\n expansionMode?: TreeExpansionMode;\n}\n\nexport type TreeExpansionMode = 'single' | 'multiple';\n\nexport function useTreeState<T extends object>(\n props: TreeProps<T>\n): TreeState<T> {\n const state = useOriginalTreeState(props);\n\n const onToggle = (key: Key) => {\n state.setExpandedKeys(\n toggleKey(state.expandedKeys, key, props.expansionMode)\n );\n };\n\n return { ...state, toggleKey: onToggle };\n}\n\nfunction toggleKey(\n set: Set<Key>,\n key: Key,\n expansionMode: TreeExpansionMode = 'multiple'\n): Set<Key> {\n const res = new Set(set);\n if (res.has(key)) {\n res.delete(key);\n } else {\n if (expansionMode === 'single') res.clear();\n res.add(key);\n }\n\n return res;\n}\n"],"names":["useOriginalTreeState"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBO,SAAA,YAAA,CACL,KACc,EAAA;AACd,EAAA,MAAM,QAAQA,cAAqB,CAAA,KAAA,CAAA,CAAA;AAEnC,EAAM,MAAA,QAAA,GAAW,CAAC,GAAa,KAAA;AAC7B,IAAA,KAAA,CAAM,eACJ,CAAA,SAAA,CAAU,KAAM,CAAA,YAAA,EAAc,KAAK,KAAM,CAAA,aAAA,CAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAI7C,EAAO,OAAA,aAAA,CAAA,cAAA,CAAA,EAAA,EAAK,KAAL,CAAA,EAAA,EAAY,SAAW,EAAA,QAAA,EAAA,CAAA,CAAA;AAAA,CAAA;AAGhC,SACE,SAAA,CAAA,GAAA,EACA,GACA,EAAA,aAAA,GAAmC,UACzB,EAAA;AACV,EAAM,MAAA,GAAA,GAAM,IAAI,GAAI,CAAA,GAAA,CAAA,CAAA;AACpB,EAAI,IAAA,GAAA,CAAI,IAAI,GAAM,CAAA,EAAA;AAChB,IAAA,GAAA,CAAI,MAAO,CAAA,GAAA,CAAA,CAAA;AAAA,GACN,MAAA;AACL,IAAA,IAAI,aAAkB,KAAA,QAAA;AAAU,MAAI,GAAA,CAAA,KAAA,EAAA,CAAA;AACpC,IAAA,GAAA,CAAI,GAAI,CAAA,GAAA,CAAA,CAAA;AAAA,GAAA;AAGV,EAAO,OAAA,GAAA,CAAA;AAAA;;;;"}
|