@danske/sapphire-react-lab 0.104.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 +728 -233
- package/build/cjs/index.js.map +1 -1
- 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/Filtering/src/FilterDropdown.js +8 -3
- package/build/esm/Filtering/src/FilterDropdown.js.map +1 -1
- package/build/esm/Filtering/src/SearchableSelectFilter.js +2 -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/TagGroup/src/Tag.js +31 -23
- package/build/esm/TagGroup/src/Tag.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/index.d.ts +72 -7
- package/package.json +35 -35
package/build/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
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, IconButtonProps, ThemeVariant, FieldProps } from '@danske/sapphire-react';
|
|
6
|
+
import { GlobalDomAttributes, SapphireStyleProps, TypographyHeadingProps, TypographyBodyProps, ListBoxProps, ButtonProps, PopoverTriggerProps, SearchFieldPropsWithRef, IconButtonProps, ThemeVariant, FieldProps } from '@danske/sapphire-react';
|
|
7
7
|
import { DisclosureGroupProps, DisclosureProps, DisclosurePanelProps, BreadcrumbsProps as BreadcrumbsProps$1, BreadcrumbProps, SliderProps as SliderProps$1, SliderThumbProps, TimeValue } from 'react-aria-components';
|
|
8
8
|
import { ComboBoxProps } from '@react-types/combobox';
|
|
9
9
|
import { HoverProps, FocusWithinProps } from '@react-aria/interactions';
|
|
@@ -82,7 +82,50 @@ interface SapphireAlertProps extends GlobalDomAttributes, SapphireStyleProps {
|
|
|
82
82
|
}
|
|
83
83
|
declare function Alert({ children, title, variant, ...props }: SapphireAlertProps): React__default.JSX.Element;
|
|
84
84
|
|
|
85
|
-
|
|
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;
|
|
86
129
|
/**
|
|
87
130
|
* Render function for the input element.
|
|
88
131
|
* Receives props that should be spread onto the input component.
|
|
@@ -230,6 +273,10 @@ interface FilterDropdownProps extends GlobalDomAttributes, SapphireStyleProps, P
|
|
|
230
273
|
* Whether the 'Apply' button is disabled.
|
|
231
274
|
*/
|
|
232
275
|
isApplyDisabled?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Whether the 'Clear' button is hidden.
|
|
278
|
+
*/
|
|
279
|
+
hideClearButton?: boolean;
|
|
233
280
|
/**
|
|
234
281
|
* Whether the 'Clear' button is disabled.
|
|
235
282
|
*/
|
|
@@ -253,7 +300,7 @@ interface FilterDropdownProps extends GlobalDomAttributes, SapphireStyleProps, P
|
|
|
253
300
|
/**
|
|
254
301
|
* A button with a dropdown, used for filtering UI.
|
|
255
302
|
*/
|
|
256
|
-
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;
|
|
257
304
|
|
|
258
305
|
interface SearchableSelectFilterProps extends GlobalDomAttributes, SapphireStyleProps, Omit<FilterDropdownProps, 'children'> {
|
|
259
306
|
/**
|
|
@@ -345,8 +392,20 @@ declare type NumberFieldRef = FocusableRefValue<HTMLInputElement, HTMLDivElement
|
|
|
345
392
|
getInputElement(): HTMLInputElement | null;
|
|
346
393
|
};
|
|
347
394
|
interface NumberFieldProps extends SapphireNumberFieldProps, PressEvents, SapphireStyleProps, GlobalDomAttributes {
|
|
348
|
-
|
|
349
|
-
|
|
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
|
+
};
|
|
350
409
|
inputRef?: RefObject<HTMLInputElement | null>;
|
|
351
410
|
/**
|
|
352
411
|
* A note to show below the input.
|
|
@@ -380,6 +439,12 @@ interface NumberFieldProps extends SapphireNumberFieldProps, PressEvents, Sapphi
|
|
|
380
439
|
* @default false
|
|
381
440
|
*/
|
|
382
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;
|
|
383
448
|
}
|
|
384
449
|
declare const NumberField: React__default.ForwardRefExoticComponent<NumberFieldProps & React__default.RefAttributes<NumberFieldRef>>;
|
|
385
450
|
|
|
@@ -726,4 +791,4 @@ declare const TimeField: <T extends TimeValue>(props: Pick<AriaTimeFieldProps<T>
|
|
|
726
791
|
ref?: React__default.RefObject<HTMLDivElement> | undefined;
|
|
727
792
|
}) => React__default.ReactElement;
|
|
728
793
|
|
|
729
|
-
export { _Accordion as Accordion, AccordionContext, AccordionHeadingProps, AccordionItemProps, AccordionPanelProps, 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, _Sidebar as Sidebar, SidebarBodyProps, SidebarExpandableItemProps, SidebarHeaderProps, SidebarItemProps, SidebarListProps, SidebarProps, SidebarSectionProps, _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/breadcrumbs": "^3.5.
|
|
43
|
-
"@react-aria/button": "^3.14.
|
|
44
|
-
"@react-aria/collections": "^3.0.
|
|
45
|
-
"@react-aria/combobox": "^3.14.
|
|
46
|
-
"@react-aria/datepicker": "^3.
|
|
47
|
-
"@react-aria/dialog": "^3.5.
|
|
48
|
-
"@react-aria/dnd": "^3.11.
|
|
49
|
-
"@react-aria/focus": "^3.21.
|
|
50
|
-
"@react-aria/i18n": "^3.12.
|
|
51
|
-
"@react-aria/interactions": "^3.
|
|
52
|
-
"@react-aria/label": "^3.7.
|
|
53
|
-
"@react-aria/listbox": "^3.15.
|
|
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
|
}
|