@danske/sapphire-react-lab 0.76.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.
Files changed (134) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +15 -0
  3. package/build/cjs/index.js +2876 -0
  4. package/build/cjs/index.js.map +1 -0
  5. package/build/esm/Accordion/index.js +11 -0
  6. package/build/esm/Accordion/index.js.map +1 -0
  7. package/build/esm/Accordion/src/Accordion.js +72 -0
  8. package/build/esm/Accordion/src/Accordion.js.map +1 -0
  9. package/build/esm/Accordion/src/AccordionHeading.js +49 -0
  10. package/build/esm/Accordion/src/AccordionHeading.js.map +1 -0
  11. package/build/esm/Accordion/src/AccordionItem.js +68 -0
  12. package/build/esm/Accordion/src/AccordionItem.js.map +1 -0
  13. package/build/esm/Accordion/src/useTreeState.js +42 -0
  14. package/build/esm/Accordion/src/useTreeState.js.map +1 -0
  15. package/build/esm/Avatar/src/Avatar.js +63 -0
  16. package/build/esm/Avatar/src/Avatar.js.map +1 -0
  17. package/build/esm/Calendar/i18n/da-DK.js +9 -0
  18. package/build/esm/Calendar/i18n/da-DK.js.map +1 -0
  19. package/build/esm/Calendar/i18n/de-DE.js +9 -0
  20. package/build/esm/Calendar/i18n/de-DE.js.map +1 -0
  21. package/build/esm/Calendar/i18n/en-US.js +9 -0
  22. package/build/esm/Calendar/i18n/en-US.js.map +1 -0
  23. package/build/esm/Calendar/i18n/fi-FI.js +9 -0
  24. package/build/esm/Calendar/i18n/fi-FI.js.map +1 -0
  25. package/build/esm/Calendar/i18n/index.js +20 -0
  26. package/build/esm/Calendar/i18n/index.js.map +1 -0
  27. package/build/esm/Calendar/i18n/nb-NO.js +9 -0
  28. package/build/esm/Calendar/i18n/nb-NO.js.map +1 -0
  29. package/build/esm/Calendar/i18n/pl-PL.js +9 -0
  30. package/build/esm/Calendar/i18n/pl-PL.js.map +1 -0
  31. package/build/esm/Calendar/i18n/sv-SE.js +9 -0
  32. package/build/esm/Calendar/i18n/sv-SE.js.map +1 -0
  33. package/build/esm/Calendar/src/Calendar.js +122 -0
  34. package/build/esm/Calendar/src/Calendar.js.map +1 -0
  35. package/build/esm/Calendar/src/CalendarButtons.js +96 -0
  36. package/build/esm/Calendar/src/CalendarButtons.js.map +1 -0
  37. package/build/esm/Calendar/src/CalendarDaysGrid.js +169 -0
  38. package/build/esm/Calendar/src/CalendarDaysGrid.js.map +1 -0
  39. package/build/esm/Calendar/src/CalendarHeader.js +58 -0
  40. package/build/esm/Calendar/src/CalendarHeader.js.map +1 -0
  41. package/build/esm/Calendar/src/CalendarMonthOrYearCell.js +79 -0
  42. package/build/esm/Calendar/src/CalendarMonthOrYearCell.js.map +1 -0
  43. package/build/esm/Calendar/src/CalendarMonthsGrid.js +58 -0
  44. package/build/esm/Calendar/src/CalendarMonthsGrid.js.map +1 -0
  45. package/build/esm/Calendar/src/CalendarPageAnimation.js +67 -0
  46. package/build/esm/Calendar/src/CalendarPageAnimation.js.map +1 -0
  47. package/build/esm/Calendar/src/CalendarYearsGrid.js +52 -0
  48. package/build/esm/Calendar/src/CalendarYearsGrid.js.map +1 -0
  49. package/build/esm/Calendar/src/RangeCalendar.js +119 -0
  50. package/build/esm/Calendar/src/RangeCalendar.js.map +1 -0
  51. package/build/esm/Calendar/src/useCustomDurationCalendarGrid.js +57 -0
  52. package/build/esm/Calendar/src/useCustomDurationCalendarGrid.js.map +1 -0
  53. package/build/esm/Calendar/src/useRangeCalendarState.js +57 -0
  54. package/build/esm/Calendar/src/useRangeCalendarState.js.map +1 -0
  55. package/build/esm/Calendar/src/useSapphireCalendarState.js +86 -0
  56. package/build/esm/Calendar/src/useSapphireCalendarState.js.map +1 -0
  57. package/build/esm/Calendar/src/utils.js +12 -0
  58. package/build/esm/Calendar/src/utils.js.map +1 -0
  59. package/build/esm/DateField/i18n/da-DK.js +7 -0
  60. package/build/esm/DateField/i18n/da-DK.js.map +1 -0
  61. package/build/esm/DateField/i18n/de-DE.js +7 -0
  62. package/build/esm/DateField/i18n/de-DE.js.map +1 -0
  63. package/build/esm/DateField/i18n/en-US.js +7 -0
  64. package/build/esm/DateField/i18n/en-US.js.map +1 -0
  65. package/build/esm/DateField/i18n/fi-FI.js +7 -0
  66. package/build/esm/DateField/i18n/fi-FI.js.map +1 -0
  67. package/build/esm/DateField/i18n/index.js +20 -0
  68. package/build/esm/DateField/i18n/index.js.map +1 -0
  69. package/build/esm/DateField/i18n/nb-NO.js +7 -0
  70. package/build/esm/DateField/i18n/nb-NO.js.map +1 -0
  71. package/build/esm/DateField/i18n/pl-PL.js +7 -0
  72. package/build/esm/DateField/i18n/pl-PL.js.map +1 -0
  73. package/build/esm/DateField/i18n/sv-SE.js +7 -0
  74. package/build/esm/DateField/i18n/sv-SE.js.map +1 -0
  75. package/build/esm/DateField/src/DateField.js +126 -0
  76. package/build/esm/DateField/src/DateField.js.map +1 -0
  77. package/build/esm/DateField/src/DateFieldButton.js +44 -0
  78. package/build/esm/DateField/src/DateFieldButton.js.map +1 -0
  79. package/build/esm/DateField/src/DateInput.js +81 -0
  80. package/build/esm/DateField/src/DateInput.js.map +1 -0
  81. package/build/esm/DateField/src/DateRangeField.js +151 -0
  82. package/build/esm/DateField/src/DateRangeField.js.map +1 -0
  83. package/build/esm/DateField/src/DateRangeInput.js +90 -0
  84. package/build/esm/DateField/src/DateRangeInput.js.map +1 -0
  85. package/build/esm/DateField/src/DateSegment.js +52 -0
  86. package/build/esm/DateField/src/DateSegment.js.map +1 -0
  87. package/build/esm/DateField/src/helpers.js +14 -0
  88. package/build/esm/DateField/src/helpers.js.map +1 -0
  89. package/build/esm/DateField/src/useDateRangePickerState.js +57 -0
  90. package/build/esm/DateField/src/useDateRangePickerState.js.map +1 -0
  91. package/build/esm/DateField/src/utils/placeholders.js +91 -0
  92. package/build/esm/DateField/src/utils/placeholders.js.map +1 -0
  93. package/build/esm/DateField/src/utils/segments.js +46 -0
  94. package/build/esm/DateField/src/utils/segments.js.map +1 -0
  95. package/build/esm/FeedbackMessage/src/FeedbackMessage.js +55 -0
  96. package/build/esm/FeedbackMessage/src/FeedbackMessage.js.map +1 -0
  97. package/build/esm/Fieldset/src/Fieldset.js +77 -0
  98. package/build/esm/Fieldset/src/Fieldset.js.map +1 -0
  99. package/build/esm/Filtering/src/FilterDropdown.js +61 -0
  100. package/build/esm/Filtering/src/FilterDropdown.js.map +1 -0
  101. package/build/esm/NotificationBadge/src/NotificationBadge.js +72 -0
  102. package/build/esm/NotificationBadge/src/NotificationBadge.js.map +1 -0
  103. package/build/esm/SearchField/src/SearchField.js +115 -0
  104. package/build/esm/SearchField/src/SearchField.js.map +1 -0
  105. package/build/esm/SearchField/src/useComboBoxState.js +42 -0
  106. package/build/esm/SearchField/src/useComboBoxState.js.map +1 -0
  107. package/build/esm/Spinner/src/Spinner.js +46 -0
  108. package/build/esm/Spinner/src/Spinner.js.map +1 -0
  109. package/build/esm/Toast/src/Toast.js +66 -0
  110. package/build/esm/Toast/src/Toast.js.map +1 -0
  111. package/build/esm/Toast/src/ToastProvider.js +53 -0
  112. package/build/esm/Toast/src/ToastProvider.js.map +1 -0
  113. package/build/esm/Toast/src/ToastRegion.js +56 -0
  114. package/build/esm/Toast/src/ToastRegion.js.map +1 -0
  115. package/build/esm/Toast/src/context.js +10 -0
  116. package/build/esm/Toast/src/context.js.map +1 -0
  117. package/build/esm/Toast/src/useShowToast.js +15 -0
  118. package/build/esm/Toast/src/useShowToast.js.map +1 -0
  119. package/build/esm/ToggleButton/src/ToggleButton.js +85 -0
  120. package/build/esm/ToggleButton/src/ToggleButton.js.map +1 -0
  121. package/build/esm/Typography/index.js +14 -0
  122. package/build/esm/Typography/index.js.map +1 -0
  123. package/build/esm/Typography/src/Body.js +66 -0
  124. package/build/esm/Typography/src/Body.js.map +1 -0
  125. package/build/esm/Typography/src/Caption.js +59 -0
  126. package/build/esm/Typography/src/Caption.js.map +1 -0
  127. package/build/esm/Typography/src/Heading.js +55 -0
  128. package/build/esm/Typography/src/Heading.js.map +1 -0
  129. package/build/esm/Typography/src/Subheading.js +63 -0
  130. package/build/esm/Typography/src/Subheading.js.map +1 -0
  131. package/build/esm/index.js +21 -0
  132. package/build/esm/index.js.map +1 -0
  133. package/build/index.d.ts +746 -0
  134. package/package.json +65 -0
@@ -0,0 +1,746 @@
1
+ import * as _react_types_shared from '@react-types/shared';
2
+ import { PressEvents, Validation, RangeValue, HelpTextProps, LabelableProps, CollectionBase, DOMProps, Expandable, ItemProps } from '@react-types/shared';
3
+ import * as React from 'react';
4
+ import React__default, { ReactNode, ComponentType } from 'react';
5
+ import { AriaToggleButtonProps } from '@react-aria/button';
6
+ import { SapphireStyleProps, PopoverTriggerProps, HeadingProps, TextStyleProps } from '@danske/sapphire-react';
7
+ import { DateValue } from '@internationalized/date';
8
+ import { AriaCalendarProps, AriaRangeCalendarProps } from '@react-aria/calendar';
9
+ import { RangeCalendarStateOptions as RangeCalendarStateOptions$1 } from '@react-stately/calendar';
10
+ import { DateValue as DateValue$1, AriaDatePickerProps, AriaDateRangePickerProps } from '@react-aria/datepicker';
11
+ import { DateRangePickerStateOptions as DateRangePickerStateOptions$1 } from '@react-stately/datepicker';
12
+ import { ComboBoxProps } from '@react-types/combobox';
13
+ import { AriaSearchFieldProps } from '@react-aria/searchfield';
14
+ import { AriaToastRegionProps } from '@react-aria/toast';
15
+ import { ToastState } from '@react-stately/toast';
16
+ export { useLocale } from '@react-aria/i18n';
17
+
18
+ declare type SapphireToggleButtonProps = Omit<AriaToggleButtonProps<'button'>, 'elementType' | 'type'> & SapphireStyleProps & PressEvents & {
19
+ /**
20
+ * @default 'medium'
21
+ */
22
+ size?: 'large' | 'medium' | 'small';
23
+ onChange?: (selected: boolean) => void;
24
+ isSelected?: boolean;
25
+ defaultSelected?: boolean;
26
+ } & (ButtonWithIconProps | ButtonWithoutIconProps);
27
+ declare type ButtonWithIconProps = {
28
+ /**
29
+ * The icon placed either before or after the `label`, based on `iconAlign` prop.
30
+ * */
31
+ icon: React__default.ReactNode;
32
+ /**
33
+ * The icon placement relative to the `label`.
34
+ * */
35
+ iconAlign?: 'left' | 'right';
36
+ };
37
+ declare type ButtonWithoutIconProps = {
38
+ icon?: never;
39
+ iconAlign?: never;
40
+ };
41
+ /**
42
+ * A button with a toggleable `isSelected` state. By default, the selection is toggled when the
43
+ * button is pressed, allowing user to switch between two states or modes.
44
+ */
45
+ declare const ToggleButton: React__default.ForwardRefExoticComponent<SapphireToggleButtonProps & React__default.RefAttributes<_react_types_shared.FocusableRefValue<HTMLButtonElement, HTMLButtonElement>>>;
46
+
47
+ declare type CalendarView = 'days' | 'months' | 'years';
48
+ declare type SapphireCalendarStateOptions = {
49
+ /**
50
+ * Controls the calendar's view (day, month, year).
51
+ */
52
+ view?: CalendarView;
53
+ /**
54
+ * The view of the calendar when it first mounts (uncontrolled).
55
+ */
56
+ defaultView?: CalendarView;
57
+ /**
58
+ * Handler that is called when the view is changed.
59
+ */
60
+ onViewChange?: (value: CalendarView) => void;
61
+ };
62
+
63
+ interface SapphireCalendarProps extends SapphireStyleProps, Omit<AriaCalendarProps<DateValue>, 'validationState' | 'errorMessage'>, SapphireCalendarStateOptions {
64
+ /**
65
+ * Whether week numbers are visible as a first column
66
+ */
67
+ showWeekNumbers?: boolean;
68
+ }
69
+ /**
70
+ * Displays a calendar and allows users to select a single date. It displays a grid of days in one
71
+ * month, by default, and the user can navigate to previous and next months. It's also possible
72
+ * to navigate to months and years view, to quickly jump to a date far away from the focused date.
73
+ */
74
+ declare const Calendar: ({ showWeekNumbers, ...props }: Omit<SapphireCalendarProps, 'locale'>) => JSX.Element;
75
+
76
+ declare type OriginalOnChange$1<T extends DateValue> = NonNullable<RangeCalendarStateOptions$1<T>['onChange']>;
77
+ declare type RangeCalendarStateOptions<T extends DateValue, P extends string> = Omit<RangeCalendarStateOptions$1<T>, 'onChange'> & {
78
+ onChange?: (value: Parameters<OriginalOnChange$1<T>>[0], predefinedRange?: P) => ReturnType<OriginalOnChange$1<T>>;
79
+ };
80
+
81
+ declare type PredefinedDateRange = {
82
+ label: string;
83
+ dateRange: {
84
+ start: DateValue;
85
+ end: DateValue;
86
+ };
87
+ };
88
+ interface SapphireRangeCalendarProps<P extends string = string> extends SapphireStyleProps, Omit<AriaRangeCalendarProps<DateValue>, 'validationState' | 'errorMessage' | 'allowsNonContiguousRanges' | 'onChange'> {
89
+ /**
90
+ * This callback also gives you the information if the selected range was a
91
+ * predefined date according to the `predefinedRanges` prop.
92
+ */
93
+ onChange?: RangeCalendarStateOptions<DateValue, P>['onChange'];
94
+ /**
95
+ * Whether week numbers are visible as a first column
96
+ */
97
+ showWeekNumbers?: boolean;
98
+ /**
99
+ * Whether to show two months at the same time.
100
+ */
101
+ showTwoMonths?: boolean;
102
+ /**
103
+ * A set of predefined date ranges the user can more conveniently select.
104
+ */
105
+ predefinedRanges?: Record<P, PredefinedDateRange>;
106
+ /**
107
+ * Whether range is allowed to span unavailable dates.
108
+ */
109
+ allowUnavailableDatesWithinRange?: boolean;
110
+ }
111
+ /**
112
+ * Displays a calendar and allow users to select a consecutive range of dates.
113
+ * One or two months can be visible at the same time.
114
+ */
115
+ declare const _RangeCalendar: <T extends string>({ showWeekNumbers, showTwoMonths, allowUnavailableDatesWithinRange, predefinedRanges, ...props }: SapphireRangeCalendarProps<T>, forwardedRef: React__default.ForwardedRef<HTMLDivElement>) => JSX.Element;
116
+ declare const RangeCalendar: <T extends string>(props: SapphireRangeCalendarProps<T> & {
117
+ ref?: React__default.ForwardedRef<HTMLDivElement> | undefined;
118
+ }) => ReturnType<typeof _RangeCalendar>;
119
+
120
+ declare type SpinnerProps = {
121
+ /**
122
+ * @default 'm'
123
+ */
124
+ size?: 'xxxs' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
125
+ } & SapphireStyleProps & ({
126
+ 'aria-labelledby': string;
127
+ } | {
128
+ 'aria-label': string;
129
+ });
130
+ /**
131
+ * Animated element that show that some data is still loading or some process
132
+ * is in progress. The hidden label is required for accessibility reasons.
133
+ */
134
+ declare const Spinner: ({ size, ...props }: SpinnerProps) => JSX.Element;
135
+
136
+ declare type NotificationBadgeProps = {
137
+ /**
138
+ * Badge will be added relative to the children. It is rendered inline if there is no children provided
139
+ * */
140
+ children?: React__default.ReactNode;
141
+ /**
142
+ * The shape of the container, based on which badge should be positioned. Badge is positioned on the border of the container
143
+ * @default 'circle'
144
+ * */
145
+ containerType?: 'circle' | 'rectangle';
146
+ /**
147
+ * Number to show in badge
148
+ * */
149
+ count: number;
150
+ /**
151
+ * The variation of badge which determines the badge's color.
152
+ *
153
+ * @default 'primary'
154
+ */
155
+ variant?: 'primary' | 'secondary';
156
+ /**
157
+ * @default 'medium'
158
+ */
159
+ size?: 'large' | 'medium' | 'small';
160
+ /**
161
+ * Boolean to show/hide the badge
162
+ *
163
+ * @default true
164
+ */
165
+ show?: boolean;
166
+ } & SapphireStyleProps & ({
167
+ 'aria-labelledby': string;
168
+ } | {
169
+ 'aria-label': string;
170
+ });
171
+ declare const NotificationBadge: (props: NotificationBadgeProps) => JSX.Element;
172
+
173
+ interface SapphireFilterDropdownProps extends SapphireStyleProps, Pick<PopoverTriggerProps, 'defaultOpen' | 'isOpen' | 'onOpenChange' | 'noMaxWidth'> {
174
+ /**
175
+ * "Filter by" label, shown inside the trigger button.
176
+ */
177
+ label: ReactNode;
178
+ /**
179
+ * Filter value, shown inside the trigger button. `null`, `undefined` and empty string are
180
+ * considered as unset value.
181
+ */
182
+ value: ReactNode;
183
+ /**
184
+ * Filtering UI controls, rendered in a popover.
185
+ */
186
+ children: ReactNode;
187
+ /**
188
+ * Called when:
189
+ * - `Enter` is pressed on form fields rendered inside the popover.
190
+ * - 'Apply' button is pressed (if `hasApplyButton` is true)
191
+ */
192
+ onApply?: () => void;
193
+ /**
194
+ * Whether to show the 'Apply' button.
195
+ */
196
+ hasApplyButton?: boolean;
197
+ /**
198
+ * Called when 'Clear' button is pressed.
199
+ */
200
+ onClear?: () => void;
201
+ /**
202
+ * Wheter the button is disabled.
203
+ */
204
+ isDisabled?: boolean;
205
+ /**
206
+ * The label of the 'Clear' button.
207
+ * @default "Clear"
208
+ */
209
+ clearButtonLabel?: ReactNode;
210
+ /**
211
+ * The label of the 'Apply' button.
212
+ * @default "Apply"
213
+ */
214
+ applyButtonLabel?: ReactNode;
215
+ }
216
+ /**
217
+ * A button with a dropdown, used for filtering UI.
218
+ */
219
+ declare function FilterDropdown({ children, label, value, isOpen: isOpenProp, clearButtonLabel, applyButtonLabel, defaultOpen, onOpenChange, hasApplyButton, onApply, onClear, noMaxWidth, isDisabled, }: SapphireFilterDropdownProps): JSX.Element;
220
+
221
+ declare type DateFieldProps<T extends DateValue$1> = Omit<AriaDatePickerProps<T>, keyof Omit<Validation<unknown>, 'isRequired'> | 'errorMessage' | 'description' | 'granularity' | 'hourCycle' | 'hideTimeZone'> & SapphireStyleProps & {
222
+ /**
223
+ * Whether week numbers are visible as a first column
224
+ */
225
+ showWeekNumbers?: boolean;
226
+ /**
227
+ * Whether the input should render as having an error and an error message.
228
+ * This also sets the appropriate `aria` attributes on the input.
229
+ *
230
+ * A `boolean` sets the error state.
231
+ * A `string` sets the error state with an additional error message.
232
+
233
+ * **An error message is strongly recommended because an error should
234
+ * always have an explanation about how to fix it.**
235
+ */
236
+ error?: boolean | string;
237
+ /**
238
+ * A note to show below the input.
239
+ * If the input has an error message, this note will be replaced by that.
240
+ */
241
+ note?: ReactNode;
242
+ /**
243
+ * A ContextualHelp to render next to the label.
244
+ */
245
+ contextualHelp?: ReactNode;
246
+ /**
247
+ * If it should hide the "clear" button when input is not empty.
248
+ *
249
+ * @default false
250
+ */
251
+ noClearButton?: boolean;
252
+ /**
253
+ * @default 'large'
254
+ */
255
+ size?: 'large' | 'medium';
256
+ /**
257
+ * To visually indicate if this field is required or optional.
258
+ * @default false
259
+ */
260
+ necessityIndicator?: boolean;
261
+ };
262
+ /**
263
+ * A date field allows users to enter or edit date values using the keyboard
264
+ * and/or mouse.
265
+ */
266
+ declare const DateField: <T extends DateValue$1>(props: Omit<AriaDatePickerProps<T>, "isInvalid" | "validationState" | "validationBehavior" | "validate" | "errorMessage" | "hourCycle" | "granularity" | "hideTimeZone" | "description"> & SapphireStyleProps & {
267
+ /**
268
+ * Whether week numbers are visible as a first column
269
+ */
270
+ showWeekNumbers?: boolean | undefined;
271
+ /**
272
+ * Whether the input should render as having an error and an error message.
273
+ * This also sets the appropriate `aria` attributes on the input.
274
+ *
275
+ * A `boolean` sets the error state.
276
+ * A `string` sets the error state with an additional error message.
277
+
278
+ * **An error message is strongly recommended because an error should
279
+ * always have an explanation about how to fix it.**
280
+ */
281
+ error?: string | boolean | undefined;
282
+ /**
283
+ * A note to show below the input.
284
+ * If the input has an error message, this note will be replaced by that.
285
+ */
286
+ note?: ReactNode;
287
+ /**
288
+ * A ContextualHelp to render next to the label.
289
+ */
290
+ contextualHelp?: ReactNode;
291
+ /**
292
+ * If it should hide the "clear" button when input is not empty.
293
+ *
294
+ * @default false
295
+ */
296
+ noClearButton?: boolean | undefined;
297
+ /**
298
+ * @default 'large'
299
+ */
300
+ size?: "large" | "medium" | undefined;
301
+ /**
302
+ * To visually indicate if this field is required or optional.
303
+ * @default false
304
+ */
305
+ necessityIndicator?: boolean | undefined;
306
+ } & {
307
+ ref?: React__default.RefObject<HTMLDivElement> | undefined;
308
+ }) => React__default.ReactElement;
309
+
310
+ declare type OriginalOnChange<T extends DateValue> = NonNullable<DateRangePickerStateOptions$1<T>['onChange']>;
311
+ declare type DateRangePickerStateOptions<T extends DateValue, P extends string, O extends OriginalOnChange<T> = OriginalOnChange<T>> = Omit<DateRangePickerStateOptions$1<T>, 'onChange'> & {
312
+ onChange?: (value: Parameters<O>[0] | null, predefinedRange?: P) => ReturnType<O>;
313
+ };
314
+
315
+ declare type DateRangeFieldProps<T extends DateValue$1, P extends string> = Omit<AriaDateRangePickerProps<T>, keyof Omit<Validation<unknown>, 'isRequired'> | 'errorMessage' | 'description' | 'granularity' | 'hourCycle' | 'hideTimeZone' | 'allowsNonContiguousRanges' | 'onChange'> & SapphireStyleProps & {
316
+ /**
317
+ * Handler that is called when the value changes.
318
+ */
319
+ onChange?: DateRangePickerStateOptions<DateValue$1, P>['onChange'];
320
+ /**
321
+ * Whether week numbers are visible as a first column
322
+ */
323
+ showWeekNumbers?: boolean;
324
+ /**
325
+ * Whether to show two months at the same time.
326
+ */
327
+ showTwoMonths?: boolean;
328
+ /**
329
+ * A set of predefined date ranges the user can more conveniently select.
330
+ */
331
+ predefinedRanges?: Record<P, PredefinedDateRange>;
332
+ /**
333
+ * Whether range is allowed to span unavailable dates.
334
+ */
335
+ allowUnavailableDatesWithinRange?: boolean;
336
+ /**
337
+ * Whether the input should render as having an error and an error message.
338
+ * This also sets the appropriate `aria` attributes on the input.
339
+ *
340
+ * A `boolean` sets the error state.
341
+ * A `string` sets the error state with an additional error message.
342
+
343
+ * **An error message is strongly recommended because an error should
344
+ * always have an explanation about how to fix it.**
345
+ */
346
+ error?: boolean | string;
347
+ /**
348
+ * A note to show below the input.
349
+ * If the input has an error message, this note will be replaced by that.
350
+ */
351
+ note?: ReactNode;
352
+ /**
353
+ * A ContextualHelp to render next to the label.
354
+ */
355
+ contextualHelp?: ReactNode;
356
+ /**
357
+ * If it should hide the "clear" button when input is not empty.
358
+ *
359
+ * @default false
360
+ */
361
+ noClearButton?: boolean;
362
+ /**
363
+ * Locale (eg. "da-DK", "en-US", "sv-SE" etc.)
364
+ *
365
+ * THIS IS A TEMPORARY SOLUTION FOR THE INTERFACE OF LOCALIZATION. THIS API
366
+ * MAY CHANGE OR EVEN BE REPLACED WITH SOMETHING DIFFERENT IN A FUTURE VERSION.
367
+ */
368
+ locale?: string;
369
+ /**
370
+ * @default 'large'
371
+ */
372
+ size?: 'large' | 'medium';
373
+ /**
374
+ * To visually indicate if this field is required or optional.
375
+ * @default false
376
+ */
377
+ necessityIndicator?: boolean;
378
+ };
379
+ /**
380
+ * A date range field allows users to select a range of dates by selecting a to and a from date with keyboard and/or mouse.
381
+ */
382
+ declare const DateRangeField: <T extends DateValue$1, P extends string>(props: Omit<AriaDateRangePickerProps<T>, "onChange" | "isInvalid" | "validationState" | "validationBehavior" | "validate" | "errorMessage" | "allowsNonContiguousRanges" | "hourCycle" | "granularity" | "hideTimeZone" | "description"> & SapphireStyleProps & {
383
+ /**
384
+ * Handler that is called when the value changes.
385
+ */
386
+ onChange?: ((value: _react_types_shared.RangeValue<DateValue$1> | null, predefinedRange?: P | undefined) => void) | undefined;
387
+ /**
388
+ * Whether week numbers are visible as a first column
389
+ */
390
+ showWeekNumbers?: boolean | undefined;
391
+ /**
392
+ * Whether to show two months at the same time.
393
+ */
394
+ showTwoMonths?: boolean | undefined;
395
+ /**
396
+ * A set of predefined date ranges the user can more conveniently select.
397
+ */
398
+ predefinedRanges?: Record<P, PredefinedDateRange> | undefined;
399
+ /**
400
+ * Whether range is allowed to span unavailable dates.
401
+ */
402
+ allowUnavailableDatesWithinRange?: boolean | undefined;
403
+ /**
404
+ * Whether the input should render as having an error and an error message.
405
+ * This also sets the appropriate `aria` attributes on the input.
406
+ *
407
+ * A `boolean` sets the error state.
408
+ * A `string` sets the error state with an additional error message.
409
+
410
+ * **An error message is strongly recommended because an error should
411
+ * always have an explanation about how to fix it.**
412
+ */
413
+ error?: string | boolean | undefined;
414
+ /**
415
+ * A note to show below the input.
416
+ * If the input has an error message, this note will be replaced by that.
417
+ */
418
+ note?: ReactNode;
419
+ /**
420
+ * A ContextualHelp to render next to the label.
421
+ */
422
+ contextualHelp?: ReactNode;
423
+ /**
424
+ * If it should hide the "clear" button when input is not empty.
425
+ *
426
+ * @default false
427
+ */
428
+ noClearButton?: boolean | undefined;
429
+ /**
430
+ * Locale (eg. "da-DK", "en-US", "sv-SE" etc.)
431
+ *
432
+ * THIS IS A TEMPORARY SOLUTION FOR THE INTERFACE OF LOCALIZATION. THIS API
433
+ * MAY CHANGE OR EVEN BE REPLACED WITH SOMETHING DIFFERENT IN A FUTURE VERSION.
434
+ */
435
+ locale?: string | undefined;
436
+ /**
437
+ * @default 'large'
438
+ */
439
+ size?: "large" | "medium" | undefined;
440
+ /**
441
+ * To visually indicate if this field is required or optional.
442
+ * @default false
443
+ */
444
+ necessityIndicator?: boolean | undefined;
445
+ } & {
446
+ ref?: React__default.RefObject<HTMLDivElement> | undefined;
447
+ }) => React__default.ReactElement;
448
+
449
+ /**
450
+ * The helpers in this file are meant for external use.
451
+ * We're exporting these.
452
+ */
453
+
454
+ declare const isEndDateBeforeStartDate: (dateRange?: RangeValue<DateValue$1> | null) => boolean | null | undefined;
455
+ declare const isDateOutsideValidRange: (value?: DateValue$1 | null, minValue?: DateValue$1 | null, maxValue?: DateValue$1 | null) => "after" | "before" | undefined;
456
+
457
+ interface SapphireFeedbackMessageProps extends SapphireStyleProps {
458
+ /**
459
+ * Heading content, rendered in a sapphire Heading component.
460
+ */
461
+ heading: React__default.ReactNode;
462
+ /**
463
+ * The type of message.
464
+ * The 'error' and 'success' are meant to attract more attention.
465
+ *
466
+ * @default 'neutral'
467
+ */
468
+ type?: 'error' | 'success' | 'neutral';
469
+ /**
470
+ * Optional description, rendered as a section below heading.
471
+ */
472
+ body?: React__default.ReactNode;
473
+ /**
474
+ * Optional actions, rendered at the bottom. Use {@link ButtonGroup}
475
+ * for the content.
476
+ */
477
+ actions?: React__default.ReactNode;
478
+ }
479
+ /**
480
+ * Implements layout and style of a feedback message.
481
+ */
482
+ declare const FeedbackMessage: ({ heading, body, actions, type, ...otherProps }: SapphireFeedbackMessageProps) => JSX.Element;
483
+
484
+ declare type SapphireSearchFieldProps<T extends object> = SapphireStyleProps & Omit<AriaSearchFieldProps, keyof HelpTextProps | keyof Validation<unknown> | keyof LabelableProps> & AutocompleteProps<T> & {
485
+ /**
486
+ * @default 'large'
487
+ */
488
+ size?: 'large' | 'medium';
489
+ /**
490
+ * Adjusts the style for the type of surface it is rendered on.
491
+ * @default 'primary'
492
+ */
493
+ surface?: 'primary' | 'secondary';
494
+ } & ({
495
+ 'aria-labelledby': string;
496
+ } | {
497
+ 'aria-label': string;
498
+ });
499
+ declare type AutocompleteProps<T extends object> = {
500
+ items?: ComboBoxProps<T>['items'];
501
+ defaultItems?: ComboBoxProps<T>['defaultItems'];
502
+ children?: ComboBoxProps<T>['children'];
503
+ onOpenChange?: ComboBoxProps<T>['onOpenChange'];
504
+ defaultFilter?: (textValue: string, inputValue: string) => boolean;
505
+ };
506
+ /**
507
+ * Sapphire search input field.
508
+ */
509
+ declare const SearchField: React__default.ForwardRefExoticComponent<SapphireSearchFieldProps<object> & React__default.RefAttributes<HTMLInputElement>>;
510
+
511
+ declare type ToastRegionProps<T> = AriaToastRegionProps & SapphireStyleProps & {
512
+ state: ToastState<T>;
513
+ };
514
+
515
+ declare type ToastProviderProps = Omit<ToastRegionProps<ReactNode>, 'state'> & {
516
+ children: React__default.ReactNode;
517
+ };
518
+ /**
519
+ * Sapphire toast provider.
520
+ * Render this at the root of your app.
521
+ */
522
+ declare const ToastProvider: ({ children, ...props }: ToastProviderProps) => React__default.JSX.Element;
523
+
524
+ declare type ShowToastFn = (content: ReactNode, options?: ShowToastOptions) => void;
525
+ declare type ShowToastOptions = {
526
+ /**
527
+ * Handler that is called when the toast is closed, either by the user
528
+ * or after a timeout.
529
+ */
530
+ onClose?: () => void;
531
+ /**
532
+ * A timeout to automatically close the toast after, in milliseconds.
533
+ * Note that if the toast is hovered or interacted with, the timeout is
534
+ * paused.
535
+ *
536
+ * @default 3000
537
+ */
538
+ timeout?: number;
539
+ };
540
+ declare const useShowToast: () => ShowToastFn;
541
+
542
+ declare type TreeExpansionMode = 'single' | 'multiple';
543
+
544
+ interface SapphireAccordionProps<T> extends SapphireStyleProps, CollectionBase<T>, DOMProps, Expandable {
545
+ /** Allow one or many expanded items
546
+ * @default 'multiple'
547
+ */
548
+ expansionMode?: TreeExpansionMode;
549
+ /** Set aria-level attribute for item's header. Accessibility requirement.
550
+ * Defines the hierarchical level of an element within a page structure.
551
+ * @default 5
552
+ */
553
+ headerLevel?: HeadingProps['level'];
554
+ /**
555
+ * Removes the divider after the last list item.
556
+ * Useful when rendered in a container which already has borders.
557
+ */
558
+ hideLastDivider?: boolean;
559
+ }
560
+
561
+ interface SapphireAccordionHeadingProps extends DOMProps {
562
+ children?: ReactNode;
563
+ }
564
+
565
+ interface SapphireAccordionItemProps<T> extends Omit<ItemProps<T>, 'title'> {
566
+ heading: ReactNode;
567
+ }
568
+
569
+ declare const _Accordion: (<T extends object>(props: SapphireAccordionProps<T> & {
570
+ ref?: React.Ref<HTMLDivElement> | undefined;
571
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
572
+ Heading: ({ children, ...props }: SapphireAccordionHeadingProps) => React.JSX.Element;
573
+ Item: <T_1>(props: SapphireAccordionItemProps<T_1>) => JSX.Element;
574
+ };
575
+
576
+ declare type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
577
+ declare type TypographyHeadingProps = DOMProps & TextStyleProps & SapphireStyleProps & {
578
+ children: React__default.ReactNode;
579
+ /**
580
+ * The level of the heading.
581
+ */
582
+ level: HeadingLevel;
583
+ elementType?: `h${HeadingLevel}`;
584
+ fontVariant?: 'default' | 'alternative';
585
+ };
586
+
587
+ declare type TypographySubheadingProps = DOMProps & TextStyleProps & SapphireStyleProps & {
588
+ children: React__default.ReactNode;
589
+ /**
590
+ * The actual DOM element to render.
591
+ * @default 'div'
592
+ */
593
+ elementType?: string;
594
+ /**
595
+ * Sets level of the hierarchy of the subheading.
596
+ * @default 1
597
+ */
598
+ level?: 1 | 2;
599
+ /**
600
+ * If text is bold
601
+ * @default false
602
+ */
603
+ isBold?: boolean;
604
+ };
605
+
606
+ declare type TypographyBodyProps = DOMProps & TextStyleProps & SapphireStyleProps & {
607
+ children: React__default.ReactNode;
608
+ /**
609
+ * The actual DOM element to render.
610
+ * @default 'p'
611
+ */
612
+ elementType?: string;
613
+ /**
614
+ * Sets the level of the hierarchy of the text.
615
+ * @default 1
616
+ */
617
+ level?: 1 | 2 | 3;
618
+ /**
619
+ * If text should be underlined.
620
+ * @default false
621
+ */
622
+ isUnderlined?: boolean;
623
+ /**
624
+ * If text is bold.
625
+ * @default false
626
+ */
627
+ isBold?: boolean;
628
+ };
629
+
630
+ declare type TypographyCaptionProps = DOMProps & TextStyleProps & SapphireStyleProps & {
631
+ children: React__default.ReactNode;
632
+ /**
633
+ * The actual DOM element to render.
634
+ * @default 'div'
635
+ */
636
+ elementType?: string;
637
+ /**
638
+ * Sets the level of the hierarchy of the caption.
639
+ * @default 1
640
+ */
641
+ level?: 1 | 2;
642
+ };
643
+
644
+ declare const Typography: {
645
+ Heading: ComponentType<TypographyHeadingProps>;
646
+ Subheading: ComponentType<TypographySubheadingProps>;
647
+ Body: ComponentType<TypographyBodyProps>;
648
+ Caption: ComponentType<TypographyCaptionProps>;
649
+ };
650
+
651
+ declare type FieldsetProps = SapphireStyleProps & {
652
+ /**
653
+ * A label that describes the groups of fields.
654
+ * The label is required because a fieldset that is not labelled is not
655
+ * better than separate labelled fields.
656
+ */
657
+ label: ReactNode;
658
+ /**
659
+ * Whether the input is disabled.
660
+ * */
661
+ isDisabled?: boolean;
662
+ /**
663
+ * Whether the input is disabled.
664
+ * */
665
+ isRequired?: boolean;
666
+ /**
667
+ * Whether the input should render as having an error and an error message.
668
+ * This also sets the appropriate `aria` attributes on the input.
669
+ *
670
+ * A `boolean` sets the error state.
671
+ * A `string` sets the error state with an additional error message.
672
+ *
673
+ * **An error message is strongly recommended because an error should
674
+ * always have an explanation about how to fix it.**
675
+ */
676
+ error?: boolean | string;
677
+ /**
678
+ * A note to show below the input.
679
+ * If the input has an error message, this note will be replaced by that.
680
+ */
681
+ note?: ReactNode;
682
+ /**
683
+ * A ContextualHelp to render next to the label.
684
+ */
685
+ contextualHelp?: ReactNode;
686
+ /**
687
+ * @default 'large'
688
+ */
689
+ size?: 'large' | 'medium';
690
+ /**
691
+ * To visually indicate if this field is required or optional.
692
+ * @default false
693
+ */
694
+ necessityIndicator?: boolean;
695
+ /**
696
+ * Children should be two or more form controls without labels, notes or
697
+ * error messages.
698
+ *
699
+ * We recommend you only use these fields inside: `<TextField>`, `<Select> `,
700
+ * `<SearchableSelect>`, `<MultiSelect>`, `<SearchableMultiSelect>`,
701
+ * `<DateField>` or `<DateRangeField>`.
702
+ *
703
+ * Example:
704
+ * ```jsx
705
+ * <Fieldset label="Phone Number">
706
+ * <Select aria-label="Country code" placeholder="+00" width={90}>
707
+ * <SelectItem>+40</SelectItem>
708
+ * <SelectItem>+42</SelectItem>
709
+ * <SelectItem>+45</SelectItem>
710
+ * </Select>
711
+ * <TextField
712
+ * aria-label="Phone number"
713
+ * placeholder="000-000-0000"
714
+ * ></TextField>
715
+ * </Fieldset>
716
+ * ```
717
+ */
718
+ children: ReactNode;
719
+ };
720
+ /**
721
+ * Sapphire search input field.
722
+ */
723
+ declare const Fieldset: ({ label, contextualHelp, note, error, isDisabled, isRequired, necessityIndicator, children, size, ...props }: FieldsetProps) => React__default.JSX.Element;
724
+
725
+ declare type SapphireAvatarProps = SapphireStyleProps & {
726
+ /**
727
+ * @default 'medium'
728
+ */
729
+ size?: 'large' | 'medium' | 'small' | 'extraSmall';
730
+ /**
731
+ * The background color of the avatar.
732
+ * Can either be semantic or one of the named decorative colors.
733
+ *
734
+ * @default 'informative'
735
+ */
736
+ color?: 'positive' | 'negative' | 'warning' | 'informative' | 'passive' | 'aqua' | 'copper' | 'electro' | 'indigo' | 'lime' | 'pink' | 'violet' | 'gold' | 'beige' | 'orchid' | 'gray' | 'cobalt' | 'forestGreen' | 'teal' | 'orange';
737
+ } & ({
738
+ monogram: ReactNode;
739
+ icon?: never;
740
+ } | {
741
+ monogram?: never;
742
+ icon: ReactNode;
743
+ });
744
+ declare const Avatar: ({ monogram, icon, color, size, ...props }: SapphireAvatarProps) => React__default.ReactElement;
745
+
746
+ export { _Accordion as Accordion, Avatar, Calendar, CalendarView, DateField, DateFieldProps, DateRangeField, DateRangeFieldProps, FeedbackMessage, Fieldset, FieldsetProps, FilterDropdown, NotificationBadge, NotificationBadgeProps, PredefinedDateRange, RangeCalendar, SapphireAccordionHeadingProps, SapphireAccordionItemProps, SapphireAccordionProps, SapphireAvatarProps, SapphireCalendarProps, SapphireFeedbackMessageProps, SapphireFilterDropdownProps, SapphireRangeCalendarProps, SapphireSearchFieldProps, SapphireToggleButtonProps, SearchField, ShowToastFn, ShowToastOptions, Spinner, SpinnerProps, ToastProvider, ToastProviderProps, ToggleButton, Typography, TypographyBodyProps, TypographyCaptionProps, TypographyHeadingProps, TypographySubheadingProps, isDateOutsideValidRange, isEndDateBeforeStartDate, useShowToast };