@norges-domstoler/dds-components 0.0.14 → 0.0.15
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/dist/components/Button/Button.styles.d.ts +17 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +420 -112
- package/dist/index.js +437 -129
- package/package.json +2 -1
- package/dist/assets/svg/DDS-logo.svg +0 -5
- package/dist/assets/svg/bullets/jordskifterett_bullet1.svg +0 -3
- package/dist/assets/svg/bullets/lagmannsrett_bullet2.svg +0 -3
- package/dist/assets/svg/bullets/tingrett_bullet3.svg +0 -3
- package/dist/assets/svg/code-brackets.svg +0 -1
- package/dist/assets/svg/colors.svg +0 -1
- package/dist/assets/svg/comments.svg +0 -1
- package/dist/assets/svg/direction.svg +0 -1
- package/dist/assets/svg/flow.svg +0 -1
- package/dist/assets/svg/plugin.svg +0 -1
- package/dist/assets/svg/repo.svg +0 -1
- package/dist/assets/svg/stackalt.svg +0 -1
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { ButtonAppearance, ButtonPurpose, ButtonProps } from './Button.types';
|
|
2
|
-
import { OverridableComponent } from '@material-ui/core/OverridableComponent';
|
|
3
1
|
import { IconWrapper } from '../../helpers/IconWrapper';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { ButtonAppearance, ButtonPurpose, ButtonSize, IconPosition } from './Button.types';
|
|
3
|
+
declare type ButtonWrapperProps = {
|
|
4
|
+
appearance: ButtonAppearance;
|
|
5
|
+
purpose: ButtonPurpose;
|
|
6
|
+
size: ButtonSize;
|
|
7
|
+
fullWidth: boolean;
|
|
8
|
+
hasIcon: boolean;
|
|
9
|
+
hasLabel: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
};
|
|
9
12
|
export declare const ButtonWrapper: import("styled-components").StyledComponent<"button", any, ButtonWrapperProps, never>;
|
|
10
|
-
declare type IconWithTextWrapperProps =
|
|
13
|
+
declare type IconWithTextWrapperProps = {
|
|
14
|
+
iconPosition: IconPosition;
|
|
15
|
+
size: ButtonSize;
|
|
16
|
+
};
|
|
11
17
|
export declare const IconWithTextWrapper: import("styled-components").StyledComponent<typeof IconWrapper, any, IconWithTextWrapperProps, never>;
|
|
12
|
-
declare type JustIconWrapperProps =
|
|
18
|
+
declare type JustIconWrapperProps = {
|
|
19
|
+
size: ButtonSize;
|
|
20
|
+
};
|
|
13
21
|
export declare const JustIconWrapper: import("styled-components").StyledComponent<"span", any, JustIconWrapperProps, never>;
|
|
14
22
|
export declare const Label: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
15
23
|
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -3,6 +3,344 @@ import React__default, { useRef, useDebugValue, useContext, createElement, forwa
|
|
|
3
3
|
import * as ReactDOM from 'react-dom';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
|
+
|
|
8
|
+
function getDefaultExportFromCjs (x) {
|
|
9
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getAugmentedNamespace(n) {
|
|
13
|
+
if (n.__esModule) return n;
|
|
14
|
+
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
15
|
+
Object.keys(n).forEach(function (k) {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
17
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return n[k];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
return a;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function createCommonjsModule(fn) {
|
|
28
|
+
var module = { exports: {} };
|
|
29
|
+
return fn(module, module.exports), module.exports;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
createCommonjsModule(function (module, exports) {
|
|
33
|
+
(function (global, factory) {
|
|
34
|
+
factory() ;
|
|
35
|
+
}(commonjsGlobal, (function () {
|
|
36
|
+
/**
|
|
37
|
+
* Applies the :focus-visible polyfill at the given scope.
|
|
38
|
+
* A scope in this case is either the top-level Document or a Shadow Root.
|
|
39
|
+
*
|
|
40
|
+
* @param {(Document|ShadowRoot)} scope
|
|
41
|
+
* @see https://github.com/WICG/focus-visible
|
|
42
|
+
*/
|
|
43
|
+
function applyFocusVisiblePolyfill(scope) {
|
|
44
|
+
var hadKeyboardEvent = true;
|
|
45
|
+
var hadFocusVisibleRecently = false;
|
|
46
|
+
var hadFocusVisibleRecentlyTimeout = null;
|
|
47
|
+
|
|
48
|
+
var inputTypesAllowlist = {
|
|
49
|
+
text: true,
|
|
50
|
+
search: true,
|
|
51
|
+
url: true,
|
|
52
|
+
tel: true,
|
|
53
|
+
email: true,
|
|
54
|
+
password: true,
|
|
55
|
+
number: true,
|
|
56
|
+
date: true,
|
|
57
|
+
month: true,
|
|
58
|
+
week: true,
|
|
59
|
+
time: true,
|
|
60
|
+
datetime: true,
|
|
61
|
+
'datetime-local': true
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Helper function for legacy browsers and iframes which sometimes focus
|
|
66
|
+
* elements like document, body, and non-interactive SVG.
|
|
67
|
+
* @param {Element} el
|
|
68
|
+
*/
|
|
69
|
+
function isValidFocusTarget(el) {
|
|
70
|
+
if (
|
|
71
|
+
el &&
|
|
72
|
+
el !== document &&
|
|
73
|
+
el.nodeName !== 'HTML' &&
|
|
74
|
+
el.nodeName !== 'BODY' &&
|
|
75
|
+
'classList' in el &&
|
|
76
|
+
'contains' in el.classList
|
|
77
|
+
) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Computes whether the given element should automatically trigger the
|
|
85
|
+
* `focus-visible` class being added, i.e. whether it should always match
|
|
86
|
+
* `:focus-visible` when focused.
|
|
87
|
+
* @param {Element} el
|
|
88
|
+
* @return {boolean}
|
|
89
|
+
*/
|
|
90
|
+
function focusTriggersKeyboardModality(el) {
|
|
91
|
+
var type = el.type;
|
|
92
|
+
var tagName = el.tagName;
|
|
93
|
+
|
|
94
|
+
if (tagName === 'INPUT' && inputTypesAllowlist[type] && !el.readOnly) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (tagName === 'TEXTAREA' && !el.readOnly) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (el.isContentEditable) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Add the `focus-visible` class to the given element if it was not added by
|
|
111
|
+
* the author.
|
|
112
|
+
* @param {Element} el
|
|
113
|
+
*/
|
|
114
|
+
function addFocusVisibleClass(el) {
|
|
115
|
+
if (el.classList.contains('focus-visible')) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
el.classList.add('focus-visible');
|
|
119
|
+
el.setAttribute('data-focus-visible-added', '');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Remove the `focus-visible` class from the given element if it was not
|
|
124
|
+
* originally added by the author.
|
|
125
|
+
* @param {Element} el
|
|
126
|
+
*/
|
|
127
|
+
function removeFocusVisibleClass(el) {
|
|
128
|
+
if (!el.hasAttribute('data-focus-visible-added')) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
el.classList.remove('focus-visible');
|
|
132
|
+
el.removeAttribute('data-focus-visible-added');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* If the most recent user interaction was via the keyboard;
|
|
137
|
+
* and the key press did not include a meta, alt/option, or control key;
|
|
138
|
+
* then the modality is keyboard. Otherwise, the modality is not keyboard.
|
|
139
|
+
* Apply `focus-visible` to any current active element and keep track
|
|
140
|
+
* of our keyboard modality state with `hadKeyboardEvent`.
|
|
141
|
+
* @param {KeyboardEvent} e
|
|
142
|
+
*/
|
|
143
|
+
function onKeyDown(e) {
|
|
144
|
+
if (e.metaKey || e.altKey || e.ctrlKey) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (isValidFocusTarget(scope.activeElement)) {
|
|
149
|
+
addFocusVisibleClass(scope.activeElement);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
hadKeyboardEvent = true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* If at any point a user clicks with a pointing device, ensure that we change
|
|
157
|
+
* the modality away from keyboard.
|
|
158
|
+
* This avoids the situation where a user presses a key on an already focused
|
|
159
|
+
* element, and then clicks on a different element, focusing it with a
|
|
160
|
+
* pointing device, while we still think we're in keyboard modality.
|
|
161
|
+
* @param {Event} e
|
|
162
|
+
*/
|
|
163
|
+
function onPointerDown(e) {
|
|
164
|
+
hadKeyboardEvent = false;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* On `focus`, add the `focus-visible` class to the target if:
|
|
169
|
+
* - the target received focus as a result of keyboard navigation, or
|
|
170
|
+
* - the event target is an element that will likely require interaction
|
|
171
|
+
* via the keyboard (e.g. a text box)
|
|
172
|
+
* @param {Event} e
|
|
173
|
+
*/
|
|
174
|
+
function onFocus(e) {
|
|
175
|
+
// Prevent IE from focusing the document or HTML element.
|
|
176
|
+
if (!isValidFocusTarget(e.target)) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
|
|
181
|
+
addFocusVisibleClass(e.target);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* On `blur`, remove the `focus-visible` class from the target.
|
|
187
|
+
* @param {Event} e
|
|
188
|
+
*/
|
|
189
|
+
function onBlur(e) {
|
|
190
|
+
if (!isValidFocusTarget(e.target)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (
|
|
195
|
+
e.target.classList.contains('focus-visible') ||
|
|
196
|
+
e.target.hasAttribute('data-focus-visible-added')
|
|
197
|
+
) {
|
|
198
|
+
// To detect a tab/window switch, we look for a blur event followed
|
|
199
|
+
// rapidly by a visibility change.
|
|
200
|
+
// If we don't see a visibility change within 100ms, it's probably a
|
|
201
|
+
// regular focus change.
|
|
202
|
+
hadFocusVisibleRecently = true;
|
|
203
|
+
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
|
204
|
+
hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
|
|
205
|
+
hadFocusVisibleRecently = false;
|
|
206
|
+
}, 100);
|
|
207
|
+
removeFocusVisibleClass(e.target);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* If the user changes tabs, keep track of whether or not the previously
|
|
213
|
+
* focused element had .focus-visible.
|
|
214
|
+
* @param {Event} e
|
|
215
|
+
*/
|
|
216
|
+
function onVisibilityChange(e) {
|
|
217
|
+
if (document.visibilityState === 'hidden') {
|
|
218
|
+
// If the tab becomes active again, the browser will handle calling focus
|
|
219
|
+
// on the element (Safari actually calls it twice).
|
|
220
|
+
// If this tab change caused a blur on an element with focus-visible,
|
|
221
|
+
// re-apply the class when the user switches back to the tab.
|
|
222
|
+
if (hadFocusVisibleRecently) {
|
|
223
|
+
hadKeyboardEvent = true;
|
|
224
|
+
}
|
|
225
|
+
addInitialPointerMoveListeners();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Add a group of listeners to detect usage of any pointing devices.
|
|
231
|
+
* These listeners will be added when the polyfill first loads, and anytime
|
|
232
|
+
* the window is blurred, so that they are active when the window regains
|
|
233
|
+
* focus.
|
|
234
|
+
*/
|
|
235
|
+
function addInitialPointerMoveListeners() {
|
|
236
|
+
document.addEventListener('mousemove', onInitialPointerMove);
|
|
237
|
+
document.addEventListener('mousedown', onInitialPointerMove);
|
|
238
|
+
document.addEventListener('mouseup', onInitialPointerMove);
|
|
239
|
+
document.addEventListener('pointermove', onInitialPointerMove);
|
|
240
|
+
document.addEventListener('pointerdown', onInitialPointerMove);
|
|
241
|
+
document.addEventListener('pointerup', onInitialPointerMove);
|
|
242
|
+
document.addEventListener('touchmove', onInitialPointerMove);
|
|
243
|
+
document.addEventListener('touchstart', onInitialPointerMove);
|
|
244
|
+
document.addEventListener('touchend', onInitialPointerMove);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function removeInitialPointerMoveListeners() {
|
|
248
|
+
document.removeEventListener('mousemove', onInitialPointerMove);
|
|
249
|
+
document.removeEventListener('mousedown', onInitialPointerMove);
|
|
250
|
+
document.removeEventListener('mouseup', onInitialPointerMove);
|
|
251
|
+
document.removeEventListener('pointermove', onInitialPointerMove);
|
|
252
|
+
document.removeEventListener('pointerdown', onInitialPointerMove);
|
|
253
|
+
document.removeEventListener('pointerup', onInitialPointerMove);
|
|
254
|
+
document.removeEventListener('touchmove', onInitialPointerMove);
|
|
255
|
+
document.removeEventListener('touchstart', onInitialPointerMove);
|
|
256
|
+
document.removeEventListener('touchend', onInitialPointerMove);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* When the polfyill first loads, assume the user is in keyboard modality.
|
|
261
|
+
* If any event is received from a pointing device (e.g. mouse, pointer,
|
|
262
|
+
* touch), turn off keyboard modality.
|
|
263
|
+
* This accounts for situations where focus enters the page from the URL bar.
|
|
264
|
+
* @param {Event} e
|
|
265
|
+
*/
|
|
266
|
+
function onInitialPointerMove(e) {
|
|
267
|
+
// Work around a Safari quirk that fires a mousemove on <html> whenever the
|
|
268
|
+
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
|
|
269
|
+
if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
hadKeyboardEvent = false;
|
|
274
|
+
removeInitialPointerMoveListeners();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// For some kinds of state, we are interested in changes at the global scope
|
|
278
|
+
// only. For example, global pointer input, global key presses and global
|
|
279
|
+
// visibility change should affect the state at every scope:
|
|
280
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
281
|
+
document.addEventListener('mousedown', onPointerDown, true);
|
|
282
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
283
|
+
document.addEventListener('touchstart', onPointerDown, true);
|
|
284
|
+
document.addEventListener('visibilitychange', onVisibilityChange, true);
|
|
285
|
+
|
|
286
|
+
addInitialPointerMoveListeners();
|
|
287
|
+
|
|
288
|
+
// For focus and blur, we specifically care about state changes in the local
|
|
289
|
+
// scope. This is because focus / blur events that originate from within a
|
|
290
|
+
// shadow root are not re-dispatched from the host element if it was already
|
|
291
|
+
// the active element in its own scope:
|
|
292
|
+
scope.addEventListener('focus', onFocus, true);
|
|
293
|
+
scope.addEventListener('blur', onBlur, true);
|
|
294
|
+
|
|
295
|
+
// We detect that a node is a ShadowRoot by ensuring that it is a
|
|
296
|
+
// DocumentFragment and also has a host property. This check covers native
|
|
297
|
+
// implementation and polyfill implementation transparently. If we only cared
|
|
298
|
+
// about the native implementation, we could just check if the scope was
|
|
299
|
+
// an instance of a ShadowRoot.
|
|
300
|
+
if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {
|
|
301
|
+
// Since a ShadowRoot is a special kind of DocumentFragment, it does not
|
|
302
|
+
// have a root element to add a class to. So, we add this attribute to the
|
|
303
|
+
// host element instead:
|
|
304
|
+
scope.host.setAttribute('data-js-focus-visible', '');
|
|
305
|
+
} else if (scope.nodeType === Node.DOCUMENT_NODE) {
|
|
306
|
+
document.documentElement.classList.add('js-focus-visible');
|
|
307
|
+
document.documentElement.setAttribute('data-js-focus-visible', '');
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// It is important to wrap all references to global window and document in
|
|
312
|
+
// these checks to support server-side rendering use cases
|
|
313
|
+
// @see https://github.com/WICG/focus-visible/issues/199
|
|
314
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
315
|
+
// Make the polyfill helper globally available. This can be used as a signal
|
|
316
|
+
// to interested libraries that wish to coordinate with the polyfill for e.g.,
|
|
317
|
+
// applying the polyfill to a shadow root:
|
|
318
|
+
window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
|
|
319
|
+
|
|
320
|
+
// Notify interested libraries of the polyfill's presence, in case the
|
|
321
|
+
// polyfill was loaded lazily:
|
|
322
|
+
var event;
|
|
323
|
+
|
|
324
|
+
try {
|
|
325
|
+
event = new CustomEvent('focus-visible-polyfill-ready');
|
|
326
|
+
} catch (error) {
|
|
327
|
+
// IE11 does not support using CustomEvent as a constructor directly:
|
|
328
|
+
event = document.createEvent('CustomEvent');
|
|
329
|
+
event.initCustomEvent('focus-visible-polyfill-ready', false, false, {});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
window.dispatchEvent(event);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (typeof document !== 'undefined') {
|
|
336
|
+
// Apply the polyfill to the global document, so that no JavaScript
|
|
337
|
+
// coordination is required to use the polyfill in the top-level document:
|
|
338
|
+
applyFocusVisiblePolyfill(document);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
})));
|
|
342
|
+
});
|
|
343
|
+
|
|
6
344
|
/*! *****************************************************************************
|
|
7
345
|
Copyright (c) Microsoft Corporation.
|
|
8
346
|
|
|
@@ -56,30 +394,6 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
56
394
|
return cooked;
|
|
57
395
|
}
|
|
58
396
|
|
|
59
|
-
function getDefaultExportFromCjs (x) {
|
|
60
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function getAugmentedNamespace(n) {
|
|
64
|
-
if (n.__esModule) return n;
|
|
65
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
66
|
-
Object.keys(n).forEach(function (k) {
|
|
67
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
68
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
get: function () {
|
|
71
|
-
return n[k];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
return a;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function createCommonjsModule(fn) {
|
|
79
|
-
var module = { exports: {} };
|
|
80
|
-
return fn(module, module.exports), module.exports;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
397
|
/*
|
|
84
398
|
object-assign
|
|
85
399
|
(c) Sindre Sorhus
|
|
@@ -19495,23 +19809,23 @@ function useIsFocusVisible() {
|
|
|
19495
19809
|
}
|
|
19496
19810
|
|
|
19497
19811
|
var utils = /*#__PURE__*/Object.freeze({
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
|
|
19503
|
-
|
|
19504
|
-
|
|
19505
|
-
|
|
19506
|
-
|
|
19507
|
-
|
|
19508
|
-
|
|
19509
|
-
|
|
19510
|
-
|
|
19511
|
-
|
|
19512
|
-
|
|
19513
|
-
|
|
19514
|
-
|
|
19812
|
+
__proto__: null,
|
|
19813
|
+
capitalize: capitalize,
|
|
19814
|
+
createChainedFunction: createChainedFunction,
|
|
19815
|
+
createSvgIcon: createSvgIcon$1,
|
|
19816
|
+
debounce: debounce,
|
|
19817
|
+
deprecatedPropType: deprecatedPropType,
|
|
19818
|
+
isMuiElement: isMuiElement,
|
|
19819
|
+
ownerDocument: ownerDocument,
|
|
19820
|
+
ownerWindow: ownerWindow,
|
|
19821
|
+
requirePropFactory: requirePropFactory,
|
|
19822
|
+
setRef: setRef,
|
|
19823
|
+
unsupportedProp: unsupportedProp,
|
|
19824
|
+
useControlled: useControlled,
|
|
19825
|
+
useEventCallback: useEventCallback,
|
|
19826
|
+
useForkRef: useForkRef,
|
|
19827
|
+
unstable_useId: useId,
|
|
19828
|
+
useIsFocusVisible: useIsFocusVisible
|
|
19515
19829
|
});
|
|
19516
19830
|
|
|
19517
19831
|
var _utils = /*@__PURE__*/getAugmentedNamespace(utils);
|
|
@@ -20914,56 +21228,53 @@ function Spinner(_a) {
|
|
|
20914
21228
|
}
|
|
20915
21229
|
var templateObject_1$w, templateObject_2$m;
|
|
20916
21230
|
|
|
20917
|
-
var
|
|
20918
|
-
|
|
20919
|
-
};
|
|
20920
|
-
var ButtonContent = styled.span.withConfig({
|
|
20921
|
-
displayName: "Buttonstyles__ButtonContent",
|
|
21231
|
+
var ButtonWrapper$1 = styled.button.withConfig({
|
|
21232
|
+
displayName: "Buttonstyles__ButtonWrapper",
|
|
20922
21233
|
componentId: "sc-14dutqk-0"
|
|
20923
|
-
})(
|
|
20924
|
-
var
|
|
20925
|
-
|
|
20926
|
-
appearance = _a.appearance,
|
|
20927
|
-
Icon = _a.Icon;
|
|
20928
|
-
return purpose && appearance && buttonContentStyle(purpose, appearance, label, Icon);
|
|
21234
|
+
})(templateObject_7$7 || (templateObject_7$7 = __makeTemplateObject(["\n ", "\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: fit-content;\n width: ", ";\n cursor: pointer;\n box-shadow: none;\n text-decoration: none;\n transition: background-color 0.2s, text-decoration-color 0.2s, box-shadow 0.2s,\n border-color 0.2s, color 0.2s;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n\n\n\n &:focus-visible, &.focus-visible {\n outline: ", " solid ", ";\n outline-offset: 2px;\n }\n\n *::selection {\n ", "\n }\n"], ["\n ", "\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: fit-content;\n width: ", ";\n cursor: pointer;\n box-shadow: none;\n text-decoration: none;\n transition: background-color 0.2s, text-decoration-color 0.2s, box-shadow 0.2s,\n border-color 0.2s, color 0.2s;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n\n\n\n &:focus-visible, &.focus-visible {\n outline: ", " solid ", ";\n outline-offset: 2px;\n }\n\n *::selection {\n ", "\n }\n"])), buttonTokens.base, function (_a) {
|
|
21235
|
+
var fullWidth = _a.fullWidth;
|
|
21236
|
+
return fullWidth ? '100%' : 'fit-content';
|
|
20929
21237
|
}, function (_a) {
|
|
20930
|
-
var
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
21238
|
+
var appearance = _a.appearance,
|
|
21239
|
+
purpose = _a.purpose;
|
|
21240
|
+
return Ae(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n ", "\n ", "\n\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n "], ["\n ", "\n ", "\n\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n "])), buttonTokens.appearance[appearance].base, buttonTokens.appearance[appearance][purpose].base, buttonTokens.appearance[appearance][purpose].hover.base, buttonTokens.appearance[appearance][purpose].active.base);
|
|
21241
|
+
}, function (_a) {
|
|
21242
|
+
var hasIcon = _a.hasIcon,
|
|
21243
|
+
hasLabel = _a.hasLabel,
|
|
21244
|
+
appearance = _a.appearance,
|
|
21245
|
+
purpose = _a.purpose;
|
|
21246
|
+
return hasIcon && !hasLabel && appearance === 'borderless' && Ae(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n &:hover {\n ", "\n }\n &:active {\n ", "\n }\n "], ["\n &:hover {\n ", "\n }\n &:active {\n ", "\n }\n "])), buttonTokens.appearance[appearance][purpose].justIcon.hover.base, buttonTokens.appearance[appearance][purpose].justIcon.active.base);
|
|
20935
21247
|
}, function (_a) {
|
|
20936
21248
|
var size = _a.size,
|
|
20937
|
-
|
|
20938
|
-
return
|
|
20939
|
-
})
|
|
20940
|
-
var
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
}, ButtonContent, buttonTokens.focusOutline.width, buttonTokens.focusOutline.color);
|
|
21249
|
+
hasLabel = _a.hasLabel;
|
|
21250
|
+
return hasLabel ? Ae(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), buttonTokens.sizes[size].text.base) : Ae(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), buttonTokens.sizes[size].justIcon.base);
|
|
21251
|
+
}, function (_a) {
|
|
21252
|
+
var fullWidth = _a.fullWidth,
|
|
21253
|
+
hasIcon = _a.hasIcon,
|
|
21254
|
+
hasLabel = _a.hasLabel,
|
|
21255
|
+
isLoading = _a.isLoading;
|
|
21256
|
+
return fullWidth && (!hasIcon || !hasLabel || isLoading ? Ae(templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["\n justify-content: center;\n "], ["\n justify-content: center;\n "]))) : Ae(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n justify-content: space-between;\n "], ["\n justify-content: space-between;\n "]))));
|
|
21257
|
+
}, buttonTokens.focusOutline.width, buttonTokens.focusOutline.color, typographyTokens.selection.base);
|
|
20947
21258
|
var IconWithTextWrapper = styled(IconWrapper$1).withConfig({
|
|
20948
21259
|
displayName: "Buttonstyles__IconWithTextWrapper",
|
|
20949
|
-
componentId: "sc-14dutqk-
|
|
20950
|
-
})(
|
|
21260
|
+
componentId: "sc-14dutqk-1"
|
|
21261
|
+
})(templateObject_10$2 || (templateObject_10$2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
20951
21262
|
var size = _a.size,
|
|
20952
21263
|
iconPosition = _a.iconPosition;
|
|
20953
|
-
return
|
|
21264
|
+
return iconPosition === 'left' ? Ae(templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["\n margin-inline-end: ", ";\n "], ["\n margin-inline-end: ", ";\n "])), buttonTokens.sizes[size].iconWithTextMargin) : iconPosition === 'right' ? Ae(templateObject_9$4 || (templateObject_9$4 = __makeTemplateObject(["\n margin-inline-start: ", ";\n "], ["\n margin-inline-start: ", ";\n "])), buttonTokens.sizes[size].iconWithTextMargin) : '';
|
|
20954
21265
|
});
|
|
20955
21266
|
var JustIconWrapper = styled.span.withConfig({
|
|
20956
21267
|
displayName: "Buttonstyles__JustIconWrapper",
|
|
20957
|
-
componentId: "sc-14dutqk-
|
|
20958
|
-
})(
|
|
21268
|
+
componentId: "sc-14dutqk-2"
|
|
21269
|
+
})(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n ", "\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n ", "\n"])), function (_a) {
|
|
20959
21270
|
var size = _a.size;
|
|
20960
|
-
return
|
|
21271
|
+
return Ae(templateObject_11$1 || (templateObject_11$1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), buttonTokens.sizes[size].justIconWrapper.base);
|
|
20961
21272
|
});
|
|
20962
21273
|
var Label$2 = styled.span.withConfig({
|
|
20963
21274
|
displayName: "Buttonstyles__Label",
|
|
20964
|
-
componentId: "sc-14dutqk-
|
|
20965
|
-
})(
|
|
20966
|
-
var templateObject_1$v, templateObject_2$l, templateObject_3$f, templateObject_4$d, templateObject_5$a, templateObject_6$9, templateObject_7$7, templateObject_8$4, templateObject_9$4, templateObject_10$2, templateObject_11$1, templateObject_12, templateObject_13
|
|
21275
|
+
componentId: "sc-14dutqk-3"
|
|
21276
|
+
})(templateObject_13 || (templateObject_13 = __makeTemplateObject([""], [""])));
|
|
21277
|
+
var templateObject_1$v, templateObject_2$l, templateObject_3$f, templateObject_4$d, templateObject_5$a, templateObject_6$9, templateObject_7$7, templateObject_8$4, templateObject_9$4, templateObject_10$2, templateObject_11$1, templateObject_12, templateObject_13;
|
|
20967
21278
|
|
|
20968
21279
|
var Button = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
20969
21280
|
var label = _a.label,
|
|
@@ -20978,8 +21289,10 @@ var Button = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
20978
21289
|
appearance = _e === void 0 ? 'filled' : _e,
|
|
20979
21290
|
href = _a.href,
|
|
20980
21291
|
target = _a.target,
|
|
20981
|
-
|
|
20982
|
-
|
|
21292
|
+
_f = _a.loading,
|
|
21293
|
+
loading = _f === void 0 ? false : _f,
|
|
21294
|
+
_g = _a.fullWidth,
|
|
21295
|
+
fullWidth = _g === void 0 ? false : _g,
|
|
20983
21296
|
className = _a.className,
|
|
20984
21297
|
style = _a.style,
|
|
20985
21298
|
Icon = _a.Icon,
|
|
@@ -20994,23 +21307,18 @@ var Button = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
20994
21307
|
rel: href ? 'noreferrer noopener' : undefined,
|
|
20995
21308
|
target: href && target ? target : undefined,
|
|
20996
21309
|
ref: ref,
|
|
20997
|
-
fullWidth: fullWidth,
|
|
20998
|
-
disabled: disabled
|
|
20999
|
-
}, rest);
|
|
21000
|
-
|
|
21001
|
-
var contentProps = {
|
|
21002
|
-
iconPosition: iconPosition,
|
|
21003
21310
|
appearance: appearance,
|
|
21004
21311
|
purpose: purpose,
|
|
21005
|
-
|
|
21006
|
-
size: size,
|
|
21007
|
-
Icon: Icon,
|
|
21312
|
+
iconPosition: iconPosition,
|
|
21008
21313
|
fullWidth: fullWidth,
|
|
21009
|
-
|
|
21010
|
-
|
|
21314
|
+
hasLabel: !!label,
|
|
21315
|
+
hasIcon: !!Icon,
|
|
21316
|
+
isLoading: loading,
|
|
21317
|
+
disabled: disabled,
|
|
21318
|
+
size: size,
|
|
21011
21319
|
className: className,
|
|
21012
21320
|
style: style
|
|
21013
|
-
};
|
|
21321
|
+
}, rest);
|
|
21014
21322
|
|
|
21015
21323
|
var iconElement = Icon && iconPosition && size && jsxRuntime.jsx(IconWithTextWrapper, {
|
|
21016
21324
|
Icon: Icon,
|
|
@@ -21019,28 +21327,28 @@ var Button = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
21019
21327
|
size: size
|
|
21020
21328
|
}, void 0);
|
|
21021
21329
|
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
}
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
}
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
}, void 0)
|
|
21043
|
-
}
|
|
21330
|
+
var hasLabel = !!label;
|
|
21331
|
+
var isIconButton = !hasLabel && !!Icon;
|
|
21332
|
+
return jsxRuntime.jsxs(ButtonWrapper$1, __assign({}, wrapperProps, {
|
|
21333
|
+
children: [loading && jsxRuntime.jsx(JustIconWrapper, __assign({
|
|
21334
|
+
size: size
|
|
21335
|
+
}, {
|
|
21336
|
+
children: jsxRuntime.jsx(Spinner, {
|
|
21337
|
+
color: buttonTokens.appearance[appearance][purpose].base.color,
|
|
21338
|
+
size: buttonTokens.sizes[size].justIcon.base.fontSize
|
|
21339
|
+
}, void 0)
|
|
21340
|
+
}), void 0), isIconButton && !loading && jsxRuntime.jsx(JustIconWrapper, __assign({
|
|
21341
|
+
size: size
|
|
21342
|
+
}, {
|
|
21343
|
+
children: jsxRuntime.jsx(IconWrapper$1, {
|
|
21344
|
+
Icon: Icon,
|
|
21345
|
+
iconSize: "inline"
|
|
21346
|
+
}, void 0)
|
|
21347
|
+
}), void 0), hasLabel && !loading && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
21348
|
+
children: [iconPosition === 'left' && iconElement, jsxRuntime.jsx(Label$2, {
|
|
21349
|
+
children: label
|
|
21350
|
+
}, void 0), iconPosition === 'right' && iconElement]
|
|
21351
|
+
}, void 0)]
|
|
21044
21352
|
}), void 0);
|
|
21045
21353
|
});
|
|
21046
21354
|
|