@equinor/roma-ui 0.2.2 → 1.0.1-beta.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.
- package/lib/select/select.d.ts +1 -1
- package/lib/select/styled-comps.d.ts +9 -360
- package/number.js +1 -1
- package/number.mjs +285 -278
- package/package.json +20 -5
- package/select.js +8 -8
- package/select.mjs +44 -44
- package/switch.js +1 -1
- package/switch.mjs +43 -41
- package/useControlledState-C9slZcZW.js +1 -0
- package/useControlledState-DFqdVpDc.mjs +30 -0
- package/useControlledState-D0L6S_5r.js +0 -1
- package/useControlledState-u436Wbp1.mjs +0 -30
package/lib/select/select.d.ts
CHANGED
|
@@ -23,6 +23,6 @@ export declare const Select: import('react').ForwardRefExoticComponent<Partial<{
|
|
|
23
23
|
disabled: boolean;
|
|
24
24
|
readOnly: boolean;
|
|
25
25
|
showClearButton: boolean;
|
|
26
|
-
}> & SelectProps<any> & import('react').RefAttributes<unknown>>;
|
|
26
|
+
}> & SelectProps<any, "single"> & import('react').RefAttributes<unknown>>;
|
|
27
27
|
export declare const Option: <T>({ value, children, item, ...rest }: EdsOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export { Styled };
|
|
@@ -1,371 +1,20 @@
|
|
|
1
1
|
import { InputProps } from '@equinor/eds-core-react';
|
|
2
2
|
declare const _default: {
|
|
3
|
-
ListBox: import('styled-components').
|
|
4
|
-
|
|
5
|
-
defaultStyle: import('react').CSSProperties;
|
|
6
|
-
}) => import('react').CSSProperties | undefined) | undefined;
|
|
7
|
-
slot?: string | null | undefined;
|
|
8
|
-
className?: string | ((values: import('react-aria-components').ListBoxRenderProps & {
|
|
9
|
-
defaultClassName: string | undefined;
|
|
10
|
-
}) => string) | undefined;
|
|
11
|
-
id?: string | undefined;
|
|
12
|
-
orientation?: import('react-aria').Orientation | undefined;
|
|
13
|
-
'aria-describedby'?: string | undefined;
|
|
14
|
-
'aria-details'?: string | undefined;
|
|
15
|
-
'aria-label'?: string | undefined;
|
|
16
|
-
'aria-labelledby'?: string | undefined;
|
|
17
|
-
children?: import('react').ReactNode | ((item: object) => import('react').ReactNode);
|
|
18
|
-
onFocus?: ((e: import('react').FocusEvent<Element, Element>) => void) | undefined;
|
|
19
|
-
onBlur?: ((e: import('react').FocusEvent<Element, Element>) => void) | undefined;
|
|
20
|
-
onScroll?: ((e: import('react').UIEvent<HTMLDivElement, UIEvent>) => void) | undefined;
|
|
21
|
-
key?: import('react').Key | null | undefined;
|
|
22
|
-
autoFocus?: (boolean | import('@react-types/shared').FocusStrategy) | undefined;
|
|
23
|
-
items?: Iterable<object> | undefined;
|
|
24
|
-
disallowEmptySelection?: boolean | undefined;
|
|
25
|
-
onSelectionChange?: ((keys: import('react-aria-components').Selection) => void) | undefined;
|
|
26
|
-
disabledKeys?: Iterable<import('react-aria-components').Key> | undefined;
|
|
27
|
-
onFocusChange?: ((isFocused: boolean) => void) | undefined;
|
|
28
|
-
selectionBehavior?: import('react-stately').SelectionBehavior | undefined;
|
|
29
|
-
shouldSelectOnPressUp?: boolean | undefined;
|
|
30
|
-
shouldFocusOnHover?: boolean | undefined;
|
|
31
|
-
onAction?: ((key: import('react-aria-components').Key) => void) | undefined;
|
|
32
|
-
escapeKeyBehavior?: "clearSelection" | "none" | undefined;
|
|
33
|
-
shouldFocusWrap?: boolean | undefined;
|
|
34
|
-
selectionMode?: import('react-aria-components').SelectionMode | undefined;
|
|
35
|
-
selectedKeys?: ("all" | Iterable<import('react-aria-components').Key>) | undefined;
|
|
36
|
-
defaultSelectedKeys?: ("all" | Iterable<import('react-aria-components').Key>) | undefined;
|
|
37
|
-
dragAndDropHooks?: import('react-aria-components').DragAndDropHooks | undefined;
|
|
38
|
-
renderEmptyState?: ((props: import('react-aria-components').ListBoxRenderProps) => import('react').ReactNode) | undefined;
|
|
39
|
-
layout?: "stack" | "grid" | undefined;
|
|
40
|
-
dependencies?: any[] | undefined;
|
|
41
|
-
ref?: ((instance: HTMLDivElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLDivElement> | null | undefined;
|
|
42
|
-
}> & (<T extends object>(props: import('react-aria-components').ListBoxProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null);
|
|
43
|
-
ListBoxItem: import('styled-components').IStyledComponent<"web", import('styled-components/dist/types').Substitute<Omit<import('react-aria-components').ListBoxItemProps<object> & import('react').RefAttributes<object>, "ref"> & {
|
|
44
|
-
ref?: ((instance: object | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<object> | null | undefined;
|
|
45
|
-
}, {
|
|
3
|
+
ListBox: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react-aria-components').ListBoxProps<object> & import('react').RefAttributes<HTMLDivElement>, never>> & string & Omit<(<T extends object>(props: import('react-aria-components').ListBoxProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null), keyof import('react').Component<any, {}, any>>;
|
|
4
|
+
ListBoxItem: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react-aria-components').ListBoxItemProps<object> & import('react').RefAttributes<HTMLDivElement>, {
|
|
46
5
|
$density: "compact" | "comfortable";
|
|
47
|
-
}>> & (<T extends object>(props: import('react-aria-components').ListBoxItemProps<T> & React.RefAttributes<
|
|
48
|
-
Trigger: import('styled-components').
|
|
49
|
-
ref?: ((instance: HTMLButtonElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLButtonElement> | null | undefined;
|
|
50
|
-
}, {
|
|
6
|
+
}>> & string & Omit<(<T extends object>(props: import('react-aria-components').ListBoxItemProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null), keyof import('react').Component<any, {}, any>>;
|
|
7
|
+
Trigger: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react-aria-components').ButtonProps & import('react').RefAttributes<HTMLButtonElement>, {
|
|
51
8
|
$variant?: InputProps["variant"];
|
|
52
9
|
$hasLabel: boolean;
|
|
53
10
|
$readonly: boolean;
|
|
54
11
|
$density: "compact" | "comfortable";
|
|
55
|
-
}>> & (
|
|
56
|
-
Wrapper: import('styled-components').
|
|
57
|
-
ref?: ((instance: HTMLDivElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLDivElement> | null | undefined;
|
|
58
|
-
}, {
|
|
12
|
+
}>> & string & Omit<(props: import('react-aria-components').ButtonProps & React.RefAttributes<HTMLButtonElement>) => React.ReactElement | null, keyof import('react').Component<any, {}, any>>;
|
|
13
|
+
Wrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react-aria-components').SelectProps<object, "single" | "multiple"> & import('react').RefAttributes<HTMLDivElement>, {
|
|
59
14
|
$variant?: InputProps["variant"];
|
|
60
|
-
}>> & (<T extends object>(props: import('react-aria-components').SelectProps<T> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null)
|
|
61
|
-
Label: import('styled-components').
|
|
62
|
-
|
|
63
|
-
style?: import('react').CSSProperties | undefined;
|
|
64
|
-
slot?: string | undefined | undefined;
|
|
65
|
-
title?: string | undefined | undefined;
|
|
66
|
-
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
67
|
-
className?: string | undefined | undefined;
|
|
68
|
-
color?: string | undefined | undefined;
|
|
69
|
-
id?: string | undefined | undefined;
|
|
70
|
-
lang?: string | undefined | undefined;
|
|
71
|
-
role?: import('react').AriaRole | undefined;
|
|
72
|
-
tabIndex?: number | undefined | undefined;
|
|
73
|
-
"aria-activedescendant"?: string | undefined | undefined;
|
|
74
|
-
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
75
|
-
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
76
|
-
"aria-braillelabel"?: string | undefined | undefined;
|
|
77
|
-
"aria-brailleroledescription"?: string | undefined | undefined;
|
|
78
|
-
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
79
|
-
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
80
|
-
"aria-colcount"?: number | undefined | undefined;
|
|
81
|
-
"aria-colindex"?: number | undefined | undefined;
|
|
82
|
-
"aria-colindextext"?: string | undefined | undefined;
|
|
83
|
-
"aria-colspan"?: number | undefined | undefined;
|
|
84
|
-
"aria-controls"?: string | undefined | undefined;
|
|
85
|
-
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
|
|
86
|
-
"aria-describedby"?: string | undefined | undefined;
|
|
87
|
-
"aria-description"?: string | undefined | undefined;
|
|
88
|
-
"aria-details"?: string | undefined | undefined;
|
|
89
|
-
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
90
|
-
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
91
|
-
"aria-errormessage"?: string | undefined | undefined;
|
|
92
|
-
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
93
|
-
"aria-flowto"?: string | undefined | undefined;
|
|
94
|
-
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
95
|
-
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
|
|
96
|
-
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
97
|
-
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
|
|
98
|
-
"aria-keyshortcuts"?: string | undefined | undefined;
|
|
99
|
-
"aria-label"?: string | undefined | undefined;
|
|
100
|
-
"aria-labelledby"?: string | undefined | undefined;
|
|
101
|
-
"aria-level"?: number | undefined | undefined;
|
|
102
|
-
"aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
|
|
103
|
-
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
104
|
-
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
105
|
-
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
106
|
-
"aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
|
|
107
|
-
"aria-owns"?: string | undefined | undefined;
|
|
108
|
-
"aria-placeholder"?: string | undefined | undefined;
|
|
109
|
-
"aria-posinset"?: number | undefined | undefined;
|
|
110
|
-
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
111
|
-
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
112
|
-
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
113
|
-
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
114
|
-
"aria-roledescription"?: string | undefined | undefined;
|
|
115
|
-
"aria-rowcount"?: number | undefined | undefined;
|
|
116
|
-
"aria-rowindex"?: number | undefined | undefined;
|
|
117
|
-
"aria-rowindextext"?: string | undefined | undefined;
|
|
118
|
-
"aria-rowspan"?: number | undefined | undefined;
|
|
119
|
-
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
120
|
-
"aria-setsize"?: number | undefined | undefined;
|
|
121
|
-
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
|
|
122
|
-
"aria-valuemax"?: number | undefined | undefined;
|
|
123
|
-
"aria-valuemin"?: number | undefined | undefined;
|
|
124
|
-
"aria-valuenow"?: number | undefined | undefined;
|
|
125
|
-
"aria-valuetext"?: string | undefined | undefined;
|
|
126
|
-
children?: import('react').ReactNode;
|
|
127
|
-
dangerouslySetInnerHTML?: {
|
|
128
|
-
__html: string | TrustedHTML;
|
|
129
|
-
} | undefined | undefined;
|
|
130
|
-
onCopy?: import('react').ClipboardEventHandler<HTMLLabelElement> | undefined;
|
|
131
|
-
onCopyCapture?: import('react').ClipboardEventHandler<HTMLLabelElement> | undefined;
|
|
132
|
-
onCut?: import('react').ClipboardEventHandler<HTMLLabelElement> | undefined;
|
|
133
|
-
onCutCapture?: import('react').ClipboardEventHandler<HTMLLabelElement> | undefined;
|
|
134
|
-
onPaste?: import('react').ClipboardEventHandler<HTMLLabelElement> | undefined;
|
|
135
|
-
onPasteCapture?: import('react').ClipboardEventHandler<HTMLLabelElement> | undefined;
|
|
136
|
-
onCompositionEnd?: import('react').CompositionEventHandler<HTMLLabelElement> | undefined;
|
|
137
|
-
onCompositionEndCapture?: import('react').CompositionEventHandler<HTMLLabelElement> | undefined;
|
|
138
|
-
onCompositionStart?: import('react').CompositionEventHandler<HTMLLabelElement> | undefined;
|
|
139
|
-
onCompositionStartCapture?: import('react').CompositionEventHandler<HTMLLabelElement> | undefined;
|
|
140
|
-
onCompositionUpdate?: import('react').CompositionEventHandler<HTMLLabelElement> | undefined;
|
|
141
|
-
onCompositionUpdateCapture?: import('react').CompositionEventHandler<HTMLLabelElement> | undefined;
|
|
142
|
-
onFocus?: import('react').FocusEventHandler<HTMLLabelElement> | undefined;
|
|
143
|
-
onFocusCapture?: import('react').FocusEventHandler<HTMLLabelElement> | undefined;
|
|
144
|
-
onBlur?: import('react').FocusEventHandler<HTMLLabelElement> | undefined;
|
|
145
|
-
onBlurCapture?: import('react').FocusEventHandler<HTMLLabelElement> | undefined;
|
|
146
|
-
onChange?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
147
|
-
onChangeCapture?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
148
|
-
onBeforeInput?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
149
|
-
onBeforeInputCapture?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
150
|
-
onInput?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
151
|
-
onInputCapture?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
152
|
-
onReset?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
153
|
-
onResetCapture?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
154
|
-
onSubmit?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
155
|
-
onSubmitCapture?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
156
|
-
onInvalid?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
157
|
-
onInvalidCapture?: import('react').FormEventHandler<HTMLLabelElement> | undefined;
|
|
158
|
-
onLoad?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
159
|
-
onLoadCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
160
|
-
onError?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
161
|
-
onErrorCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
162
|
-
onKeyDown?: import('react').KeyboardEventHandler<HTMLLabelElement> | undefined;
|
|
163
|
-
onKeyDownCapture?: import('react').KeyboardEventHandler<HTMLLabelElement> | undefined;
|
|
164
|
-
onKeyPress?: import('react').KeyboardEventHandler<HTMLLabelElement> | undefined;
|
|
165
|
-
onKeyPressCapture?: import('react').KeyboardEventHandler<HTMLLabelElement> | undefined;
|
|
166
|
-
onKeyUp?: import('react').KeyboardEventHandler<HTMLLabelElement> | undefined;
|
|
167
|
-
onKeyUpCapture?: import('react').KeyboardEventHandler<HTMLLabelElement> | undefined;
|
|
168
|
-
onAbort?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
169
|
-
onAbortCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
170
|
-
onCanPlay?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
171
|
-
onCanPlayCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
172
|
-
onCanPlayThrough?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
173
|
-
onCanPlayThroughCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
174
|
-
onDurationChange?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
175
|
-
onDurationChangeCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
176
|
-
onEmptied?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
177
|
-
onEmptiedCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
178
|
-
onEncrypted?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
179
|
-
onEncryptedCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
180
|
-
onEnded?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
181
|
-
onEndedCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
182
|
-
onLoadedData?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
183
|
-
onLoadedDataCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
184
|
-
onLoadedMetadata?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
185
|
-
onLoadedMetadataCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
186
|
-
onLoadStart?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
187
|
-
onLoadStartCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
188
|
-
onPause?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
189
|
-
onPauseCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
190
|
-
onPlay?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
191
|
-
onPlayCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
192
|
-
onPlaying?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
193
|
-
onPlayingCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
194
|
-
onProgress?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
195
|
-
onProgressCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
196
|
-
onRateChange?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
197
|
-
onRateChangeCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
198
|
-
onResize?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
199
|
-
onResizeCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
200
|
-
onSeeked?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
201
|
-
onSeekedCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
202
|
-
onSeeking?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
203
|
-
onSeekingCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
204
|
-
onStalled?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
205
|
-
onStalledCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
206
|
-
onSuspend?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
207
|
-
onSuspendCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
208
|
-
onTimeUpdate?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
209
|
-
onTimeUpdateCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
210
|
-
onVolumeChange?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
211
|
-
onVolumeChangeCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
212
|
-
onWaiting?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
213
|
-
onWaitingCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
214
|
-
onAuxClick?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
215
|
-
onAuxClickCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
216
|
-
onClick?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
217
|
-
onClickCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
218
|
-
onContextMenu?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
219
|
-
onContextMenuCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
220
|
-
onDoubleClick?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
221
|
-
onDoubleClickCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
222
|
-
onDrag?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
223
|
-
onDragCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
224
|
-
onDragEnd?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
225
|
-
onDragEndCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
226
|
-
onDragEnter?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
227
|
-
onDragEnterCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
228
|
-
onDragExit?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
229
|
-
onDragExitCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
230
|
-
onDragLeave?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
231
|
-
onDragLeaveCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
232
|
-
onDragOver?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
233
|
-
onDragOverCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
234
|
-
onDragStart?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
235
|
-
onDragStartCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
236
|
-
onDrop?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
237
|
-
onDropCapture?: import('react').DragEventHandler<HTMLLabelElement> | undefined;
|
|
238
|
-
onMouseDown?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
239
|
-
onMouseDownCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
240
|
-
onMouseEnter?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
241
|
-
onMouseLeave?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
242
|
-
onMouseMove?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
243
|
-
onMouseMoveCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
244
|
-
onMouseOut?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
245
|
-
onMouseOutCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
246
|
-
onMouseOver?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
247
|
-
onMouseOverCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
248
|
-
onMouseUp?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
249
|
-
onMouseUpCapture?: import('react').MouseEventHandler<HTMLLabelElement> | undefined;
|
|
250
|
-
onSelect?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
251
|
-
onSelectCapture?: import('react').ReactEventHandler<HTMLLabelElement> | undefined;
|
|
252
|
-
onTouchCancel?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
253
|
-
onTouchCancelCapture?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
254
|
-
onTouchEnd?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
255
|
-
onTouchEndCapture?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
256
|
-
onTouchMove?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
257
|
-
onTouchMoveCapture?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
258
|
-
onTouchStart?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
259
|
-
onTouchStartCapture?: import('react').TouchEventHandler<HTMLLabelElement> | undefined;
|
|
260
|
-
onPointerDown?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
261
|
-
onPointerDownCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
262
|
-
onPointerMove?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
263
|
-
onPointerMoveCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
264
|
-
onPointerUp?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
265
|
-
onPointerUpCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
266
|
-
onPointerCancel?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
267
|
-
onPointerCancelCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
268
|
-
onPointerEnter?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
269
|
-
onPointerLeave?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
270
|
-
onPointerOver?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
271
|
-
onPointerOverCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
272
|
-
onPointerOut?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
273
|
-
onPointerOutCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
274
|
-
onGotPointerCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
275
|
-
onGotPointerCaptureCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
276
|
-
onLostPointerCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
277
|
-
onLostPointerCaptureCapture?: import('react').PointerEventHandler<HTMLLabelElement> | undefined;
|
|
278
|
-
onScroll?: import('react').UIEventHandler<HTMLLabelElement> | undefined;
|
|
279
|
-
onScrollCapture?: import('react').UIEventHandler<HTMLLabelElement> | undefined;
|
|
280
|
-
onWheel?: import('react').WheelEventHandler<HTMLLabelElement> | undefined;
|
|
281
|
-
onWheelCapture?: import('react').WheelEventHandler<HTMLLabelElement> | undefined;
|
|
282
|
-
onAnimationStart?: import('react').AnimationEventHandler<HTMLLabelElement> | undefined;
|
|
283
|
-
onAnimationStartCapture?: import('react').AnimationEventHandler<HTMLLabelElement> | undefined;
|
|
284
|
-
onAnimationEnd?: import('react').AnimationEventHandler<HTMLLabelElement> | undefined;
|
|
285
|
-
onAnimationEndCapture?: import('react').AnimationEventHandler<HTMLLabelElement> | undefined;
|
|
286
|
-
onAnimationIteration?: import('react').AnimationEventHandler<HTMLLabelElement> | undefined;
|
|
287
|
-
onAnimationIterationCapture?: import('react').AnimationEventHandler<HTMLLabelElement> | undefined;
|
|
288
|
-
onTransitionEnd?: import('react').TransitionEventHandler<HTMLLabelElement> | undefined;
|
|
289
|
-
onTransitionEndCapture?: import('react').TransitionEventHandler<HTMLLabelElement> | undefined;
|
|
290
|
-
key?: import('react').Key | null | undefined;
|
|
291
|
-
defaultChecked?: boolean | undefined | undefined;
|
|
292
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
293
|
-
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
294
|
-
accessKey?: string | undefined | undefined;
|
|
295
|
-
autoFocus?: boolean | undefined | undefined;
|
|
296
|
-
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
297
|
-
contextMenu?: string | undefined | undefined;
|
|
298
|
-
dir?: string | undefined | undefined;
|
|
299
|
-
draggable?: (boolean | "true" | "false") | undefined;
|
|
300
|
-
hidden?: boolean | undefined | undefined;
|
|
301
|
-
nonce?: string | undefined | undefined;
|
|
302
|
-
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
303
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
304
|
-
radioGroup?: string | undefined | undefined;
|
|
305
|
-
about?: string | undefined | undefined;
|
|
306
|
-
content?: string | undefined | undefined;
|
|
307
|
-
datatype?: string | undefined | undefined;
|
|
308
|
-
inlist?: any;
|
|
309
|
-
prefix?: string | undefined | undefined;
|
|
310
|
-
property?: string | undefined | undefined;
|
|
311
|
-
rel?: string | undefined | undefined;
|
|
312
|
-
resource?: string | undefined | undefined;
|
|
313
|
-
rev?: string | undefined | undefined;
|
|
314
|
-
typeof?: string | undefined | undefined;
|
|
315
|
-
vocab?: string | undefined | undefined;
|
|
316
|
-
autoCapitalize?: string | undefined | undefined;
|
|
317
|
-
autoCorrect?: string | undefined | undefined;
|
|
318
|
-
autoSave?: string | undefined | undefined;
|
|
319
|
-
itemProp?: string | undefined | undefined;
|
|
320
|
-
itemScope?: boolean | undefined | undefined;
|
|
321
|
-
itemType?: string | undefined | undefined;
|
|
322
|
-
itemID?: string | undefined | undefined;
|
|
323
|
-
itemRef?: string | undefined | undefined;
|
|
324
|
-
results?: number | undefined | undefined;
|
|
325
|
-
security?: string | undefined | undefined;
|
|
326
|
-
unselectable?: "on" | "off" | undefined | undefined;
|
|
327
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
328
|
-
is?: string | undefined | undefined;
|
|
329
|
-
htmlFor?: string | undefined | undefined;
|
|
330
|
-
elementType?: string | undefined;
|
|
331
|
-
ref?: ((instance: HTMLLabelElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLLabelElement> | null | undefined;
|
|
332
|
-
}> & ((props: import('react-aria-components').LabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null);
|
|
333
|
-
Popover: import('styled-components').IStyledComponent<"web", {
|
|
334
|
-
style?: import('react').CSSProperties | ((values: import('react-aria-components').PopoverRenderProps & {
|
|
335
|
-
defaultStyle: import('react').CSSProperties;
|
|
336
|
-
}) => import('react').CSSProperties | undefined) | undefined;
|
|
337
|
-
slot?: string | null | undefined;
|
|
338
|
-
className?: string | ((values: import('react-aria-components').PopoverRenderProps & {
|
|
339
|
-
defaultClassName: string | undefined;
|
|
340
|
-
}) => string) | undefined;
|
|
341
|
-
offset?: number | undefined;
|
|
342
|
-
children?: import('react').ReactNode | ((values: import('react-aria-components').PopoverRenderProps & {
|
|
343
|
-
defaultChildren: import('react').ReactNode | undefined;
|
|
344
|
-
}) => import('react').ReactNode);
|
|
345
|
-
key?: import('react').Key | null | undefined;
|
|
346
|
-
isOpen?: boolean | undefined;
|
|
347
|
-
defaultOpen?: boolean | undefined;
|
|
348
|
-
onOpenChange?: ((isOpen: boolean) => void) | undefined;
|
|
349
|
-
placement?: import('react-aria').Placement | undefined;
|
|
350
|
-
containerPadding?: number | undefined;
|
|
351
|
-
crossOffset?: number | undefined;
|
|
352
|
-
shouldFlip?: boolean | undefined;
|
|
353
|
-
triggerRef?: import('@react-types/shared').RefObject<Element | null> | undefined;
|
|
354
|
-
boundaryElement?: Element | undefined;
|
|
355
|
-
scrollRef?: import('@react-types/shared').RefObject<Element | null> | undefined;
|
|
356
|
-
shouldUpdatePosition?: boolean | undefined;
|
|
357
|
-
maxHeight?: number | undefined;
|
|
358
|
-
arrowBoundaryOffset?: number | undefined;
|
|
359
|
-
groupRef?: import('@react-types/shared').RefObject<Element | null> | undefined;
|
|
360
|
-
isNonModal?: boolean | undefined;
|
|
361
|
-
isKeyboardDismissDisabled?: boolean | undefined;
|
|
362
|
-
shouldCloseOnInteractOutside?: ((element: Element) => boolean) | undefined;
|
|
363
|
-
trigger?: string | undefined;
|
|
364
|
-
isEntering?: boolean | undefined;
|
|
365
|
-
isExiting?: boolean | undefined;
|
|
366
|
-
UNSTABLE_portalContainer?: Element | undefined;
|
|
367
|
-
ref?: ((instance: HTMLElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLElement> | null | undefined;
|
|
368
|
-
}> & ((props: import('react-aria-components').PopoverProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null);
|
|
15
|
+
}>> & string & Omit<(<T extends object = {}, M extends "single" | "multiple" = "single">(props: import('react-aria-components').SelectProps<T, M> & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null), keyof import('react').Component<any, {}, any>>;
|
|
16
|
+
Label: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react-aria-components').LabelProps & import('react').RefAttributes<HTMLLabelElement>, never>> & string & Omit<(props: import('react-aria-components').LabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null, keyof import('react').Component<any, {}, any>>;
|
|
17
|
+
Popover: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react-aria-components').PopoverProps & import('react').RefAttributes<HTMLElement>, never>> & string & Omit<(props: import('react-aria-components').PopoverProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null, keyof import('react').Component<any, {}, any>>;
|
|
369
18
|
HelperText: ({ helperText }: {
|
|
370
19
|
helperText?: import('react').ReactNode;
|
|
371
20
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
package/number.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce=require("react/jsx-runtime"),u=require("react"),de=require("react-aria"),fe=require("@equinor/eds-core-react"),pe=require("./useControlledState-D0L6S_5r.js");function L(r,e=-1/0,t=1/0){return Math.min(Math.max(r,e),t)}function A(r,e){let t=r,i=e.toString(),n=i.indexOf("."),a=n>=0?i.length-n:0;if(a>0){let l=Math.pow(10,a);t=Math.round(t*l)/l}return t}function M(r,e,t,i){e=Number(e),t=Number(t);let n=(r-(isNaN(e)?0:e))%i,a=A(Math.abs(n)*2>=i?r+Math.sign(n)*(i-Math.abs(n)):r-n,i);return isNaN(e)?!isNaN(t)&&a>t&&(a=Math.floor(A(t/i,i))*i):a<e?a=e:!isNaN(t)&&a>t&&(a=e+Math.floor(A((t-e)/i,i))*i),a=A(a,i),a}const ee={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},te={...ee,customError:!0,valid:!1},O={isInvalid:!1,validationDetails:ee,validationErrors:[]},be=u.createContext({}),Y="__formValidationState"+Date.now();function he(r){if(r[Y]){let{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}=r[Y];return{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}}return ge(r)}function ge(r){let{isInvalid:e,validationState:t,name:i,value:n,builtinValidation:a,validate:l,validationBehavior:o="aria"}=r;t&&(e||(e=t==="invalid"));let c=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:te}:null,V=u.useMemo(()=>{if(!l||n==null)return null;let s=$e(l,n);return k(s)},[l,n]);a!=null&&a.validationDetails.valid&&(a=void 0);let b=u.useContext(be),f=u.useMemo(()=>i?Array.isArray(i)?i.flatMap(s=>G(b[s])):G(b[i]):[],[b,i]),[h,g]=u.useState(b),[p,$]=u.useState(!1);b!==h&&(g(b),$(!1));let D=u.useMemo(()=>k(p?[]:f),[p,f]),w=u.useRef(O),[x,y]=u.useState(O),v=u.useRef(O),d=()=>{if(!P)return;S(!1);let s=V||a||w.current;q(s,v.current)||(v.current=s,y(s))},[P,S]=u.useState(!1);return u.useEffect(d),{realtimeValidation:c||D||V||a||O,displayValidation:o==="native"?c||D||x:c||D||V||a||x,updateValidation(s){o==="aria"&&!q(x,s)?y(s):w.current=s},resetValidation(){let s=O;q(s,v.current)||(v.current=s,y(s)),o==="native"&&S(!1),$(!0)},commitValidation(){o==="native"&&S(!0),$(!0)}}}function G(r){return r?Array.isArray(r)?r:[r]:[]}function $e(r,e){if(typeof r=="function"){let t=r(e);if(t&&typeof t!="boolean")return G(t)}return[]}function k(r){return r.length?{isInvalid:!0,validationErrors:r,validationDetails:te}:null}function q(r,e){return r===e?!0:!!r&&!!e&&r.isInvalid===e.isInvalid&&r.validationErrors.length===e.validationErrors.length&&r.validationErrors.every((t,i)=>t===e.validationErrors[i])&&Object.entries(r.validationDetails).every(([t,i])=>e.validationDetails[t]===i)}let z=new Map,U=!1;try{U=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch{}let j=!1;try{j=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch{}const ie={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class Z{format(e){let t="";if(!U&&this.options.signDisplay!=null?t=ve(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!j){var i;let{unit:n,unitDisplay:a="short",locale:l}=this.resolvedOptions();if(!n)return t;let o=(i=ie[n])===null||i===void 0?void 0:i[a];t+=o[l]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw new RangeError("End date must be >= start date");let i=this.numberFormatter.formatToParts(e),n=this.numberFormatter.formatToParts(t);return[...i.map(a=>({...a,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...n.map(a=>({...a,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!U&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!j&&this.options.style==="unit"&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=ye(e,t),this.options=t}}function ye(r,e={}){let{numberingSystem:t}=e;if(t&&r.includes("-nu-")&&(r.includes("-u-")||(r+="-u-"),r+=`-nu-${t}`),e.style==="unit"&&!j){var i;let{unit:l,unitDisplay:o="short"}=e;if(!l)throw new Error('unit option must be provided with style: "unit"');if(!(!((i=ie[l])===null||i===void 0)&&i[o]))throw new Error(`Unsupported unit ${l} with unitDisplay = ${o}`);e={...e,style:"decimal"}}let n=r+(e?Object.entries(e).sort((l,o)=>l[0]<o[0]?-1:1).join():"");if(z.has(n))return z.get(n);let a=new Intl.NumberFormat(r,e);return z.set(n,a),a}function ve(r,e,t){if(e==="auto")return r.format(t);if(e==="never")return r.format(Math.abs(t));{let i=!1;if(e==="always"?i=t>0||Object.is(t,0):e==="exceptZero"&&(Object.is(t,-0)||Object.is(t,0)?t=Math.abs(t):i=t>0),i){let n=r.format(-t),a=r.format(t),l=n.replace(a,"").replace(/\u200e|\u061C/,"");return[...l].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),n.replace(a,"!!!").replace(l,"+").replace("!!!",a)}else return r.format(t)}}const Ne=new RegExp("^.*\\(.*\\).*$"),Ve=["latn","arab","hanidec","deva","beng"];class re{parse(e){return W(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,i){return W(this.locale,this.options,e).isValidPartialNumber(e,t,i)}getNumberingSystem(e){return W(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}}const Q=new Map;function W(r,e,t){let i=J(r,e);if(!r.includes("-nu-")&&!i.isValidPartialNumber(t)){for(let n of Ve)if(n!==i.options.numberingSystem){let a=J(r+(r.includes("-u-")?"-nu-":"-u-nu-")+n,e);if(a.isValidPartialNumber(t))return a}}return i}function J(r,e){let t=r+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():""),i=Q.get(t);return i||(i=new Se(r,e),Q.set(t,i)),i}class Se{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=T(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let l=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let o=t.indexOf(".");o===-1&&(o=t.length),t=t.replace(".",""),o-2===0?t=`0.${t}`:o-2===-1?t=`0.0${t}`:o-2===-2?t="0.00":t=`${t.slice(0,o-2)}.${t.slice(o-2)}`,l>-1&&(t=`-${t}`)}let i=t?+t:NaN;if(isNaN(i))return NaN;if(this.options.style==="percent"){var n,a;let l={...this.options,style:"decimal",minimumFractionDigits:Math.min(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)+2,20),maximumFractionDigits:Math.min(((a=this.options.maximumFractionDigits)!==null&&a!==void 0?a:0)+2,20)};return new re(this.locale,l).parse(new Z(this.locale,l).format(i))}return this.options.currencySign==="accounting"&&Ne.test(e)&&(i=-1*i),i}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("،",this.symbols.decimal)),this.symbols.group&&(e=T(e,".",this.symbols.group))),this.options.locale==="fr-FR"&&this.symbols.group&&(e=T(e," ",this.symbols.group),e=T(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,i=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&i>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=T(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=we(e,this.formatter,this.options,t);var i,n;this.options.style==="percent"&&(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)>18||((n=this.options.maximumFractionDigits)!==null&&n!==void 0?n:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}}const X=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),De=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function we(r,e,t,i){var n,a,l,o;let c=new Intl.NumberFormat(r,{...t,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:"auto",roundingMode:"halfExpand"}),V=c.formatToParts(-10000.111),b=c.formatToParts(10000.111),f=De.map(s=>c.formatToParts(s));var h;let g=(h=(n=V.find(s=>s.type==="minusSign"))===null||n===void 0?void 0:n.value)!==null&&h!==void 0?h:"-",p=(a=b.find(s=>s.type==="plusSign"))===null||a===void 0?void 0:a.value;!p&&((i==null?void 0:i.signDisplay)==="exceptZero"||(i==null?void 0:i.signDisplay)==="always")&&(p="+");let D=(l=new Intl.NumberFormat(r,{...t,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(s=>s.type==="decimal"))===null||l===void 0?void 0:l.value,w=(o=V.find(s=>s.type==="group"))===null||o===void 0?void 0:o.value,x=V.filter(s=>!X.has(s.type)).map(s=>H(s.value)),y=f.flatMap(s=>s.filter(E=>!X.has(E.type)).map(E=>H(E.value))),v=[...new Set([...x,...y])].sort((s,E)=>E.length-s.length),d=v.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${v.join("|")}|[\\p{White_Space}]`,"gu"),P=[...new Intl.NumberFormat(t.locale,{useGrouping:!1}).format(9876543210)].reverse(),S=new Map(P.map((s,E)=>[s,E])),F=new RegExp(`[${P.join("")}]`,"g");return{minusSign:g,plusSign:p,decimal:D,group:w,literals:d,numeral:F,index:s=>String(S.get(s))}}function T(r,e,t){return r.replaceAll?r.replaceAll(e,t):r.split(e).join(t)}function H(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xe(r){let{minValue:e,maxValue:t,step:i,formatOptions:n,value:a,defaultValue:l=NaN,onChange:o,locale:c,isDisabled:V,isReadOnly:b}=r;a===null&&(a=NaN),a!==void 0&&!isNaN(a)&&(i!==void 0&&!isNaN(i)?a=M(a,e,t,i):a=L(a,e,t)),isNaN(l)||(i!==void 0&&!isNaN(i)?l=M(l,e,t,i):l=L(l,e,t));let[f,h]=pe.$458b0a5536c1a7cf$export$40bfa8c7b0832715(a,isNaN(l)?NaN:l,o),[g,p]=u.useState(()=>isNaN(f)?"":new Z(c,n).format(f)),$=u.useMemo(()=>new re(c,n),[c,n]),D=u.useMemo(()=>$.getNumberingSystem(g),[$,g]),w=u.useMemo(()=>new Z(c,{...n,numberingSystem:D}),[c,n,D]),x=u.useMemo(()=>w.resolvedOptions(),[w]),y=u.useCallback(m=>isNaN(m)||m===null?"":w.format(m),[w]),v=he({...r,value:f}),d=i!==void 0&&!isNaN(i)?i:1;x.style==="percent"&&(i===void 0||isNaN(i))&&(d=.01);let[P,S]=u.useState(f),[F,I]=u.useState(c),[s,E]=u.useState(n);(!Object.is(f,P)||c!==F||n!==s)&&(p(y(f)),S(f),I(c),E(n));let N=u.useMemo(()=>$.parse(g),[$,g]),ae=()=>{if(!g.length){h(NaN),p(a===void 0?"":y(f));return}if(isNaN(N)){p(y(f));return}let m;i===void 0||isNaN(i)?m=L(N,e,t):m=M(N,e,t,i),m=$.parse(y(m)),h(m),p(y(a===void 0?m:f))},B=(m,K=0)=>{let R=N;if(isNaN(R)){let C=isNaN(K)?0:K;return M(C,e,t,d)}else{let C=M(R,e,t,d);return m==="+"&&C>R||m==="-"&&C<R?C:M(_(m,R,d),e,t,d)}},ne=()=>{let m=B("+",e);m===f&&p(y(m)),h(m),v.commitValidation()},se=()=>{let m=B("-",t);m===f&&p(y(m)),h(m),v.commitValidation()},le=()=>{t!=null&&(h(M(t,e,t,d)),v.commitValidation())},oe=()=>{e!=null&&(h(e),v.commitValidation())},ue=u.useMemo(()=>!V&&!b&&(isNaN(N)||t===void 0||isNaN(t)||M(N,e,t,d)>N||_("+",N,d)<=t),[V,b,e,t,d,N]),me=u.useMemo(()=>!V&&!b&&(isNaN(N)||e===void 0||isNaN(e)||M(N,e,t,d)<N||_("-",N,d)>=e),[V,b,e,t,d,N]);return{...v,validate:m=>$.isValidPartialNumber(m,e,t),increment:ne,incrementToMax:le,decrement:se,decrementToMin:oe,canIncrement:ue,canDecrement:me,minValue:e,maxValue:t,numberValue:N,setNumberValue:h,setInputValue:p,inputValue:g,commit:ae}}function _(r,e,t){let i=r==="+"?e+t:e-t;if(e%1!==0||t%1!==0){const n=e.toString().split("."),a=t.toString().split("."),l=n[1]&&n[1].length||0,o=a[1]&&a[1].length||0,c=Math.pow(10,Math.max(l,o));e=Math.round(e*c),t=Math.round(t*c),i=r==="+"?e+t:e-t,i/=c}return i}const Pe=u.forwardRef(({placeholder:r,variant:e,disabled:t,type:i,readOnly:n,leftAdornments:a,rightAdornments:l,leftAdornmentsProps:o,rightAdornmentsProps:c,leftAdornmentsWidth:V,rightAdornmentsWidth:b,className:f,style:h,label:g,value:p,locale:$,...D},w)=>{$=$??"nb-NO";const x=xe({...D,label:g??"number-field",value:p,onChange:d=>{D.onChange&&D.onChange(d)},locale:$}),y=u.useRef(null),{inputProps:v}=de.useNumberField({...D,isReadOnly:n,isDisabled:t,label:g??"number-field",value:p},x,y);return ce.jsx(fe.Input,{placeholder:r,variant:e,type:i,leftAdornments:a,rightAdornments:l,leftAdornmentsProps:o,rightAdornmentsProps:c,leftAdornmentsWidth:V,rightAdornmentsWidth:b,className:f,style:h,"data-testid":`number-field-${g}`,...v,onKeyDown:d=>{var P;if(d.key==="."){d.preventDefault();const S=d.target;if((P=S.value)!=null&&P.includes(","))return;const F=S.selectionStart||0,I=S.selectionEnd||0;S.value=S.value.substring(0,F)+","+S.value.substring(I)}},ref:w,"aria-label":g})});exports.NumberField=Pe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("react/jsx-runtime"),u=require("react"),fe=require("react-aria"),pe=require("@equinor/eds-core-react"),be=require("./useControlledState-C9slZcZW.js");function q(r,e=-1/0,t=1/0){return Math.min(Math.max(r,e),t)}function A(r,e){let t=r,i=0,n=e.toString(),a=n.toLowerCase().indexOf("e-");if(a>0)i=Math.abs(Math.floor(Math.log10(Math.abs(e))))+a;else{let s=n.indexOf(".");s>=0&&(i=n.length-s)}if(i>0){let s=Math.pow(10,i);t=Math.round(t*s)/s}return t}function I(r,e,t,i){e=Number(e),t=Number(t);let n=(r-(isNaN(e)?0:e))%i,a=A(Math.abs(n)*2>=i?r+Math.sign(n)*(i-Math.abs(n)):r-n,i);return isNaN(e)?!isNaN(t)&&a>t&&(a=Math.floor(A(t/i,i))*i):a<e?a=e:!isNaN(t)&&a>t&&(a=e+Math.floor(A((t-e)/i,i))*i),a=A(a,i),a}let z=new Map,G=!1;try{G=new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay==="exceptZero"}catch{}let j=!1;try{j=new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style==="unit"}catch{}const ee={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class U{format(e){let t="";if(!G&&this.options.signDisplay!=null?t=ge(this.numberFormatter,this.options.signDisplay,e):t=this.numberFormatter.format(e),this.options.style==="unit"&&!j){var i;let{unit:n,unitDisplay:a="short",locale:s}=this.resolvedOptions();if(!n)return t;let o=(i=ee[n])===null||i===void 0?void 0:i[a];t+=o[s]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange=="function")return this.numberFormatter.formatRange(e,t);if(t<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts=="function")return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw new RangeError("End date must be >= start date");let i=this.numberFormatter.formatToParts(e),n=this.numberFormatter.formatToParts(t);return[...i.map(a=>({...a,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...n.map(a=>({...a,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!G&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!j&&this.options.style==="unit"&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=he(e,t),this.options=t}}function he(r,e={}){let{numberingSystem:t}=e;if(t&&r.includes("-nu-")&&(r.includes("-u-")||(r+="-u-"),r+=`-nu-${t}`),e.style==="unit"&&!j){var i;let{unit:s,unitDisplay:o="short"}=e;if(!s)throw new Error('unit option must be provided with style: "unit"');if(!(!((i=ee[s])===null||i===void 0)&&i[o]))throw new Error(`Unsupported unit ${s} with unitDisplay = ${o}`);e={...e,style:"decimal"}}let n=r+(e?Object.entries(e).sort((s,o)=>s[0]<o[0]?-1:1).join():"");if(z.has(n))return z.get(n);let a=new Intl.NumberFormat(r,e);return z.set(n,a),a}function ge(r,e,t){if(e==="auto")return r.format(t);if(e==="never")return r.format(Math.abs(t));{let i=!1;if(e==="always"?i=t>0||Object.is(t,0):e==="exceptZero"&&(Object.is(t,-0)||Object.is(t,0)?t=Math.abs(t):i=t>0),i){let n=r.format(-t),a=r.format(t),s=n.replace(a,"").replace(/\u200e|\u061C/,"");return[...s].length!==1&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),n.replace(a,"!!!").replace(s,"+").replace("!!!",a)}else return r.format(t)}}const ye=new RegExp("^.*\\(.*\\).*$"),$e=["latn","arab","hanidec","deva","beng","fullwide"];class te{parse(e){return W(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,i){return W(this.locale,this.options,e).isValidPartialNumber(e,t,i)}getNumberingSystem(e){return W(this.locale,this.options,e).options.numberingSystem}constructor(e,t={}){this.locale=e,this.options=t}}const Y=new Map;function W(r,e,t){let i=k(r,e);if(!r.includes("-nu-")&&!i.isValidPartialNumber(t)){for(let n of $e)if(n!==i.options.numberingSystem){let a=k(r+(r.includes("-u-")?"-nu-":"-u-nu-")+n,e);if(a.isValidPartialNumber(t))return a}}return i}function k(r,e){let t=r+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():""),i=Y.get(t);return i||(i=new Ne(r,e),Y.set(t,i)),i}class Ne{parse(e){let t=this.sanitize(e);if(this.symbols.group&&(t=C(t,this.symbols.group,"")),this.symbols.decimal&&(t=t.replace(this.symbols.decimal,".")),this.symbols.minusSign&&(t=t.replace(this.symbols.minusSign,"-")),t=t.replace(this.symbols.numeral,this.symbols.index),this.options.style==="percent"){let s=t.indexOf("-");t=t.replace("-",""),t=t.replace("+","");let o=t.indexOf(".");o===-1&&(o=t.length),t=t.replace(".",""),o-2===0?t=`0.${t}`:o-2===-1?t=`0.0${t}`:o-2===-2?t="0.00":t=`${t.slice(0,o-2)}.${t.slice(o-2)}`,s>-1&&(t=`-${t}`)}let i=t?+t:NaN;if(isNaN(i))return NaN;if(this.options.style==="percent"){var n,a;let s={...this.options,style:"decimal",minimumFractionDigits:Math.min(((n=this.options.minimumFractionDigits)!==null&&n!==void 0?n:0)+2,20),maximumFractionDigits:Math.min(((a=this.options.maximumFractionDigits)!==null&&a!==void 0?a:0)+2,20)};return new te(this.locale,s).parse(new U(this.locale,s).format(i))}return this.options.currencySign==="accounting"&&ye.test(e)&&(i=-1*i),i}sanitize(e){return e=e.replace(this.symbols.literals,""),this.symbols.minusSign&&(e=e.replace("-",this.symbols.minusSign)),this.options.numberingSystem==="arab"&&(this.symbols.decimal&&(e=e.replace(",",this.symbols.decimal),e=e.replace("،",this.symbols.decimal)),this.symbols.group&&(e=C(e,".",this.symbols.group))),this.symbols.group==="’"&&e.includes("'")&&(e=C(e,"'",this.symbols.group)),this.options.locale==="fr-FR"&&this.symbols.group&&(e=C(e," ",this.symbols.group),e=C(e,/\u00A0/g,this.symbols.group)),e}isValidPartialNumber(e,t=-1/0,i=1/0){return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&i>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.group&&e.startsWith(this.symbols.group)||this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&(e=C(e,this.symbols.group,"")),e=e.replace(this.symbols.numeral,""),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,"")),e.length===0)}constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits==null&&(t.minimumFractionDigits=t.maximumFractionDigits)),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=Ve(e,this.formatter,this.options,t);var i,n;this.options.style==="percent"&&(((i=this.options.minimumFractionDigits)!==null&&i!==void 0?i:0)>18||((n=this.options.maximumFractionDigits)!==null&&n!==void 0?n:0)>18)&&console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.")}}const Q=new Set(["decimal","fraction","integer","minusSign","plusSign","group"]),ve=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function Ve(r,e,t,i){var n,a,s,o;let c=new Intl.NumberFormat(r,{...t,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:"auto",roundingMode:"halfExpand"}),v=c.formatToParts(-10000.111),$=c.formatToParts(10000.111),f=ve.map(l=>c.formatToParts(l));var N;let D=(N=(n=v.find(l=>l.type==="minusSign"))===null||n===void 0?void 0:n.value)!==null&&N!==void 0?N:"-",g=(a=$.find(l=>l.type==="plusSign"))===null||a===void 0?void 0:a.value;!g&&(i?.signDisplay==="exceptZero"||i?.signDisplay==="always")&&(g="+");let b=(s=new Intl.NumberFormat(r,{...t,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(l=>l.type==="decimal"))===null||s===void 0?void 0:s.value,M=(o=v.find(l=>l.type==="group"))===null||o===void 0?void 0:o.value,S=v.filter(l=>!Q.has(l.type)).map(l=>J(l.value)),P=f.flatMap(l=>l.filter(F=>!Q.has(F.type)).map(F=>J(F.value))),p=[...new Set([...S,...P])].sort((l,F)=>F.length-l.length),h=p.length===0?new RegExp("[\\p{White_Space}]","gu"):new RegExp(`${p.join("|")}|[\\p{White_Space}]`,"gu"),m=[...new Intl.NumberFormat(t.locale,{useGrouping:!1}).format(9876543210)].reverse(),E=new Map(m.map((l,F)=>[l,F])),R=new RegExp(`[${m.join("")}]`,"g");return{minusSign:D,plusSign:g,decimal:b,group:M,literals:h,numeral:R,index:l=>String(E.get(l))}}function C(r,e,t){return r.replaceAll?r.replaceAll(e,t):r.split(e).join(t)}function J(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const ie={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},re={...ie,customError:!0,valid:!1},T={isInvalid:!1,validationDetails:ie,validationErrors:[]},Se=u.createContext({}),X="__formValidationState"+Date.now();function we(r){if(r[X]){let{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}=r[X];return{realtimeValidation:e,displayValidation:t,updateValidation:i,resetValidation:n,commitValidation:a}}return De(r)}function De(r){let{isInvalid:e,validationState:t,name:i,value:n,builtinValidation:a,validate:s,validationBehavior:o="aria"}=r;t&&(e||(e=t==="invalid"));let c=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:re}:null,v=u.useMemo(()=>{if(!s||n==null)return null;let l=xe(s,n);return H(l)},[s,n]);a?.validationDetails.valid&&(a=void 0);let $=u.useContext(Se),f=u.useMemo(()=>i?Array.isArray(i)?i.flatMap(l=>Z($[l])):Z($[i]):[],[$,i]),[N,D]=u.useState($),[g,y]=u.useState(!1);$!==N&&(D($),y(!1));let b=u.useMemo(()=>H(g?[]:f),[g,f]),M=u.useRef(T),[S,P]=u.useState(T),p=u.useRef(T),h=()=>{if(!m)return;E(!1);let l=v||a||M.current;_(l,p.current)||(p.current=l,P(l))},[m,E]=u.useState(!1);return u.useEffect(h),{realtimeValidation:c||b||v||a||T,displayValidation:o==="native"?c||b||S:c||b||v||a||S,updateValidation(l){o==="aria"&&!_(S,l)?P(l):M.current=l},resetValidation(){let l=T;_(l,p.current)||(p.current=l,P(l)),o==="native"&&E(!1),y(!0)},commitValidation(){o==="native"&&E(!0),y(!0)}}}function Z(r){return r?Array.isArray(r)?r:[r]:[]}function xe(r,e){if(typeof r=="function"){let t=r(e);if(t&&typeof t!="boolean")return Z(t)}return[]}function H(r){return r.length?{isInvalid:!0,validationErrors:r,validationDetails:re}:null}function _(r,e){return r===e?!0:!!r&&!!e&&r.isInvalid===e.isInvalid&&r.validationErrors.length===e.validationErrors.length&&r.validationErrors.every((t,i)=>t===e.validationErrors[i])&&Object.entries(r.validationDetails).every(([t,i])=>e.validationDetails[t]===i)}function Me(r){let{minValue:e,maxValue:t,step:i,formatOptions:n,value:a,defaultValue:s=NaN,onChange:o,locale:c,isDisabled:v,isReadOnly:$}=r;a===null&&(a=NaN),a!==void 0&&!isNaN(a)&&(i!==void 0&&!isNaN(i)?a=I(a,e,t,i):a=q(a,e,t)),isNaN(s)||(i!==void 0&&!isNaN(i)?s=I(s,e,t,i):s=q(s,e,t));let[f,N]=be.$458b0a5536c1a7cf$export$40bfa8c7b0832715(a,isNaN(s)?NaN:s,o),[D]=u.useState(f),[g,y]=u.useState(()=>isNaN(f)?"":new U(c,n).format(f)),b=u.useMemo(()=>new te(c,n),[c,n]),M=u.useMemo(()=>b.getNumberingSystem(g),[b,g]),S=u.useMemo(()=>new U(c,{...n,numberingSystem:M}),[c,n,M]),P=u.useMemo(()=>S.resolvedOptions(),[S]),p=u.useCallback(d=>isNaN(d)||d===null?"":S.format(d),[S]),h=we({...r,value:f}),m=i!==void 0&&!isNaN(i)?i:1;P.style==="percent"&&(i===void 0||isNaN(i))&&(m=.01);let[E,R]=u.useState(f),[L,l]=u.useState(c),[F,ae]=u.useState(n);(!Object.is(f,E)||c!==L||n!==F)&&(y(p(f)),R(f),l(c),ae(n));let V=u.useMemo(()=>b.parse(g),[b,g]),ne=d=>{let O=d===void 0?g:d,x=V;if(d!==void 0&&(x=b.parse(O)),!O.length){N(NaN),y(a===void 0?"":p(f));return}if(isNaN(x)){y(p(f));return}let w;i===void 0||isNaN(i)?w=q(x,e,t):w=I(x,e,t,i),w=b.parse(p(w)),N(w),y(p(a===void 0?w:f)),h.commitValidation()},B=(d,O=0)=>{let x=V;if(isNaN(x)){let w=isNaN(O)?0:O;return I(w,e,t,m)}else{let w=I(x,e,t,m);return d==="+"&&w>x||d==="-"&&w<x?w:I(K(d,x,m),e,t,m)}},se=()=>{let d=B("+",e);d===f&&y(p(d)),N(d),h.commitValidation()},le=()=>{let d=B("-",t);d===f&&y(p(d)),N(d),h.commitValidation()},oe=()=>{t!=null&&(N(I(t,e,t,m)),h.commitValidation())},ue=()=>{e!=null&&(N(e),h.commitValidation())},me=u.useMemo(()=>!v&&!$&&(isNaN(V)||t===void 0||isNaN(t)||I(V,e,t,m)>V||K("+",V,m)<=t),[v,$,e,t,m,V]),ce=u.useMemo(()=>!v&&!$&&(isNaN(V)||e===void 0||isNaN(e)||I(V,e,t,m)<V||K("-",V,m)>=e),[v,$,e,t,m,V]);return{...h,validate:d=>b.isValidPartialNumber(d,e,t),increment:se,incrementToMax:oe,decrement:le,decrementToMin:ue,canIncrement:me,canDecrement:ce,minValue:e,maxValue:t,numberValue:V,defaultNumberValue:isNaN(s)?D:s,setNumberValue:N,setInputValue:y,inputValue:g,commit:ne}}function K(r,e,t){let i=r==="+"?e+t:e-t;if(e%1!==0||t%1!==0){const n=e.toString().split("."),a=t.toString().split("."),s=n[1]&&n[1].length||0,o=a[1]&&a[1].length||0,c=Math.pow(10,Math.max(s,o));e=Math.round(e*c),t=Math.round(t*c),i=r==="+"?e+t:e-t,i/=c}return i}const Pe=u.forwardRef(({placeholder:r,variant:e,disabled:t,type:i,readOnly:n,leftAdornments:a,rightAdornments:s,leftAdornmentsProps:o,rightAdornmentsProps:c,leftAdornmentsWidth:v,rightAdornmentsWidth:$,className:f,style:N,label:D,value:g,locale:y,...b},M)=>{y=y??"nb-NO";const S=Me({...b,label:D??"number-field",value:g,onChange:h=>{b.onChange&&b.onChange(h)},locale:y}),P=u.useRef(null),{inputProps:p}=fe.useNumberField({...b,isReadOnly:n,isDisabled:t,label:D??"number-field",value:g},S,P);return de.jsx(pe.Input,{placeholder:r,variant:e,type:i,leftAdornments:a,rightAdornments:s,leftAdornmentsProps:o,rightAdornmentsProps:c,leftAdornmentsWidth:v,rightAdornmentsWidth:$,className:f,style:N,"data-testid":`number-field-${D}`,...p,onKeyDown:h=>{if(h.key==="."){h.preventDefault();const m=h.target;if(m.value?.includes(","))return;const E=m.selectionStart||0,R=m.selectionEnd||0;m.value=m.value.substring(0,E)+","+m.value.substring(R)}else p.onKeyDown&&p.onKeyDown(h)},ref:M,"aria-label":D})});exports.NumberField=Pe;
|