pge-front-common 2.0.0 → 3.0.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/README.md +1 -1
- package/lib/components/Button/Button.d.ts +7 -27
- package/lib/components/Button/Button.stories.d.ts +4 -19
- package/lib/components/Button/styles.d.ts +3 -0
- package/lib/components/Input/Input.stories.d.ts +8 -0
- package/lib/components/Input/index.d.ts +4 -0
- package/lib/components/Input/index.types.d.ts +11 -0
- package/lib/components/Input/styles.d.ts +15 -0
- package/lib/components/Modal/Modal.d.ts +8 -0
- package/lib/components/Modal/Modal.stories.d.ts +31 -0
- package/lib/components/Modal/ModalConfirm/ModalConfirm.stories.d.ts +17 -0
- package/lib/components/Modal/ModalConfirm/index.d.ts +8 -0
- package/lib/components/Modal/ModalConfirm/styles.d.ts +1 -0
- package/lib/components/Modal/styles.d.ts +8 -0
- package/lib/components/Select/Select.stories.d.ts +8 -0
- package/lib/components/Select/index.d.ts +4 -0
- package/lib/components/Select/index.types.d.ts +22 -0
- package/lib/components/Select/styles.d.ts +25 -0
- package/lib/components/theme.d.ts +3 -0
- package/lib/icons/add-cell-icon.d.ts +2 -0
- package/lib/icons/add-icon.d.ts +2 -0
- package/lib/icons/arrow-expland-icon.d.ts +2 -0
- package/lib/icons/arrow-to-recall-icon.d.ts +2 -0
- package/lib/icons/calendar-icon.d.ts +2 -0
- package/lib/icons/check-circle-icon.d.ts +2 -0
- package/lib/icons/circle-expland-icon.d.ts +2 -0
- package/lib/icons/circle-to-recall-icon.d.ts +2 -0
- package/lib/icons/close-icon.d.ts +2 -0
- package/lib/icons/delete-icon.d.ts +2 -0
- package/lib/icons/download-icon.d.ts +2 -0
- package/lib/icons/edit-icon.d.ts +2 -0
- package/lib/icons/event-avaliable-icon.d.ts +2 -0
- package/lib/icons/icons.stories.d.ts +5 -0
- package/{src/icons/index.ts → lib/icons/index.d.ts} +24 -49
- package/lib/icons/logout-icon.d.ts +2 -0
- package/lib/icons/new-tab-icon.d.ts +2 -0
- package/lib/icons/pdf-icon.d.ts +2 -0
- package/lib/icons/profile-icon.d.ts +2 -0
- package/lib/icons/remove-icon.d.ts +2 -0
- package/lib/icons/swap-icon.d.ts +2 -0
- package/lib/icons/triangle-expand-icon.d.ts +2 -0
- package/lib/icons/triangle-to-recall-icon.d.ts +2 -0
- package/lib/icons/upload-icon.d.ts +2 -0
- package/lib/icons/visibillity-icon.d.ts +2 -0
- package/lib/icons/warning-icon.d.ts +2 -0
- package/lib/index.d.ts +62 -28
- package/lib/index.esm.js +3138 -28
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3178 -26
- package/lib/index.js.map +1 -1
- package/package.json +9 -3
- package/.storybook/main.ts +0 -22
- package/.storybook/preview.ts +0 -25
- package/rollup.config.mjs +0 -46
- package/src/components/Button/Button.stories.tsx +0 -50
- package/src/components/Button/Button.tsx +0 -28
- package/src/components/Button/styles.tsx +0 -39
- package/src/components/Modal/Modal.stories.tsx +0 -62
- package/src/components/Modal/Modal.tsx +0 -42
- package/src/components/Modal/ModalConfirm/ModalConfirm.stories.tsx +0 -48
- package/src/components/Modal/ModalConfirm/index.tsx +0 -32
- package/src/components/Modal/ModalConfirm/styles.tsx +0 -9
- package/src/components/Modal/styles.tsx +0 -75
- package/src/components/theme.ts +0 -24
- package/src/icons/add-cell-icon.tsx +0 -17
- package/src/icons/add-icon.tsx +0 -17
- package/src/icons/arrow-expland-icon.tsx +0 -17
- package/src/icons/arrow-to-recall-icon.tsx +0 -17
- package/src/icons/calendar-icon.tsx +0 -17
- package/src/icons/check-circle-icon.tsx +0 -17
- package/src/icons/circle-expland-icon.tsx +0 -17
- package/src/icons/circle-to-recall-icon.tsx +0 -17
- package/src/icons/close-icon.tsx +0 -17
- package/src/icons/delete-icon.tsx +0 -17
- package/src/icons/download-icon.tsx +0 -17
- package/src/icons/edit-icon.tsx +0 -17
- package/src/icons/event-avaliable-icon.tsx +0 -17
- package/src/icons/icons.stories.tsx +0 -92
- package/src/icons/logout-icon.tsx +0 -17
- package/src/icons/new-tab-icon.tsx +0 -17
- package/src/icons/pdf-icon.tsx +0 -17
- package/src/icons/profile-icon.tsx +0 -17
- package/src/icons/remove-icon.tsx +0 -14
- package/src/icons/swap-icon.tsx +0 -17
- package/src/icons/triangle-expand-icon.tsx +0 -14
- package/src/icons/triangle-to-recall-icon.tsx +0 -14
- package/src/icons/upload-icon.tsx +0 -17
- package/src/icons/visibillity-icon.tsx +0 -17
- package/src/icons/warning-icon.tsx +0 -17
- package/src/index.ts +0 -56
- package/src/styled-components.d.ts +0 -25
- package/tsconfig.json +0 -23
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { useRef, useDebugValue, createElement, useContext, useState } from 'react';
|
|
3
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
|
+
import ReactDOM__default from 'react-dom';
|
|
2
6
|
|
|
3
7
|
/*! *****************************************************************************
|
|
4
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -38,48 +42,3154 @@ function __rest(s, e) {
|
|
|
38
42
|
t[p[i]] = s[p[i]];
|
|
39
43
|
}
|
|
40
44
|
return t;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function __spreadArray(to, from, pack) {
|
|
48
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
49
|
+
if (ar || !(i in from)) {
|
|
50
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
51
|
+
ar[i] = from[i];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function __makeTemplateObject(cooked, raw) {
|
|
58
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
59
|
+
return cooked;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function memoize(fn) {
|
|
63
|
+
var cache = Object.create(null);
|
|
64
|
+
return function (arg) {
|
|
65
|
+
if (cache[arg] === undefined) cache[arg] = fn(arg);
|
|
66
|
+
return cache[arg];
|
|
67
|
+
};
|
|
41
68
|
}
|
|
42
69
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
71
|
+
|
|
72
|
+
var isPropValid = /* #__PURE__ */memoize(function (prop) {
|
|
73
|
+
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
74
|
+
/* o */
|
|
75
|
+
&& prop.charCodeAt(1) === 110
|
|
76
|
+
/* n */
|
|
77
|
+
&& prop.charCodeAt(2) < 91;
|
|
78
|
+
}
|
|
79
|
+
/* Z+1 */
|
|
80
|
+
);
|
|
46
81
|
|
|
47
|
-
|
|
82
|
+
var MS = '-ms-';
|
|
83
|
+
var MOZ = '-moz-';
|
|
84
|
+
var WEBKIT = '-webkit-';
|
|
48
85
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
86
|
+
var COMMENT = 'comm';
|
|
87
|
+
var RULESET = 'rule';
|
|
88
|
+
var DECLARATION = 'decl';
|
|
89
|
+
var IMPORT = '@import';
|
|
90
|
+
var KEYFRAMES = '@keyframes';
|
|
91
|
+
var LAYER = '@layer';
|
|
52
92
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
93
|
+
/**
|
|
94
|
+
* @param {number}
|
|
95
|
+
* @return {number}
|
|
96
|
+
*/
|
|
97
|
+
var abs = Math.abs;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param {number}
|
|
101
|
+
* @return {string}
|
|
102
|
+
*/
|
|
103
|
+
var from = String.fromCharCode;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {object}
|
|
107
|
+
* @return {object}
|
|
108
|
+
*/
|
|
109
|
+
var assign = Object.assign;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @param {string} value
|
|
113
|
+
* @param {number} length
|
|
114
|
+
* @return {number}
|
|
115
|
+
*/
|
|
116
|
+
function hash (value, length) {
|
|
117
|
+
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @param {string} value
|
|
122
|
+
* @return {string}
|
|
123
|
+
*/
|
|
124
|
+
function trim (value) {
|
|
125
|
+
return value.trim()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {string} value
|
|
130
|
+
* @param {RegExp} pattern
|
|
131
|
+
* @return {string?}
|
|
132
|
+
*/
|
|
133
|
+
function match (value, pattern) {
|
|
134
|
+
return (value = pattern.exec(value)) ? value[0] : value
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @param {string} value
|
|
139
|
+
* @param {(string|RegExp)} pattern
|
|
140
|
+
* @param {string} replacement
|
|
141
|
+
* @return {string}
|
|
142
|
+
*/
|
|
143
|
+
function replace (value, pattern, replacement) {
|
|
144
|
+
return value.replace(pattern, replacement)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {string} value
|
|
149
|
+
* @param {string} search
|
|
150
|
+
* @param {number} position
|
|
151
|
+
* @return {number}
|
|
152
|
+
*/
|
|
153
|
+
function indexof (value, search, position) {
|
|
154
|
+
return value.indexOf(search, position)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @param {string} value
|
|
159
|
+
* @param {number} index
|
|
160
|
+
* @return {number}
|
|
161
|
+
*/
|
|
162
|
+
function charat (value, index) {
|
|
163
|
+
return value.charCodeAt(index) | 0
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param {string} value
|
|
168
|
+
* @param {number} begin
|
|
169
|
+
* @param {number} end
|
|
170
|
+
* @return {string}
|
|
171
|
+
*/
|
|
172
|
+
function substr (value, begin, end) {
|
|
173
|
+
return value.slice(begin, end)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @param {string} value
|
|
178
|
+
* @return {number}
|
|
179
|
+
*/
|
|
180
|
+
function strlen (value) {
|
|
181
|
+
return value.length
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @param {any[]} value
|
|
186
|
+
* @return {number}
|
|
187
|
+
*/
|
|
188
|
+
function sizeof (value) {
|
|
189
|
+
return value.length
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @param {any} value
|
|
194
|
+
* @param {any[]} array
|
|
195
|
+
* @return {any}
|
|
196
|
+
*/
|
|
197
|
+
function append (value, array) {
|
|
198
|
+
return array.push(value), value
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @param {string[]} array
|
|
203
|
+
* @param {function} callback
|
|
204
|
+
* @return {string}
|
|
205
|
+
*/
|
|
206
|
+
function combine (array, callback) {
|
|
207
|
+
return array.map(callback).join('')
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @param {string[]} array
|
|
212
|
+
* @param {RegExp} pattern
|
|
213
|
+
* @return {string[]}
|
|
214
|
+
*/
|
|
215
|
+
function filter (array, pattern) {
|
|
216
|
+
return array.filter(function (value) { return !match(value, pattern) })
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
var line = 1;
|
|
220
|
+
var column = 1;
|
|
221
|
+
var length = 0;
|
|
222
|
+
var position = 0;
|
|
223
|
+
var character = 0;
|
|
224
|
+
var characters = '';
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @param {string} value
|
|
228
|
+
* @param {object | null} root
|
|
229
|
+
* @param {object | null} parent
|
|
230
|
+
* @param {string} type
|
|
231
|
+
* @param {string[] | string} props
|
|
232
|
+
* @param {object[] | string} children
|
|
233
|
+
* @param {object[]} siblings
|
|
234
|
+
* @param {number} length
|
|
235
|
+
*/
|
|
236
|
+
function node (value, root, parent, type, props, children, length, siblings) {
|
|
237
|
+
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @param {object} root
|
|
242
|
+
* @param {object} props
|
|
243
|
+
* @return {object}
|
|
244
|
+
*/
|
|
245
|
+
function copy (root, props) {
|
|
246
|
+
return assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @param {object} root
|
|
251
|
+
*/
|
|
252
|
+
function lift (root) {
|
|
253
|
+
while (root.root)
|
|
254
|
+
root = copy(root.root, {children: [root]});
|
|
255
|
+
|
|
256
|
+
append(root, root.siblings);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @return {number}
|
|
261
|
+
*/
|
|
262
|
+
function char () {
|
|
263
|
+
return character
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @return {number}
|
|
268
|
+
*/
|
|
269
|
+
function prev () {
|
|
270
|
+
character = position > 0 ? charat(characters, --position) : 0;
|
|
271
|
+
|
|
272
|
+
if (column--, character === 10)
|
|
273
|
+
column = 1, line--;
|
|
274
|
+
|
|
275
|
+
return character
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @return {number}
|
|
280
|
+
*/
|
|
281
|
+
function next () {
|
|
282
|
+
character = position < length ? charat(characters, position++) : 0;
|
|
283
|
+
|
|
284
|
+
if (column++, character === 10)
|
|
285
|
+
column = 1, line++;
|
|
286
|
+
|
|
287
|
+
return character
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @return {number}
|
|
292
|
+
*/
|
|
293
|
+
function peek () {
|
|
294
|
+
return charat(characters, position)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @return {number}
|
|
299
|
+
*/
|
|
300
|
+
function caret () {
|
|
301
|
+
return position
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @param {number} begin
|
|
306
|
+
* @param {number} end
|
|
307
|
+
* @return {string}
|
|
308
|
+
*/
|
|
309
|
+
function slice (begin, end) {
|
|
310
|
+
return substr(characters, begin, end)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @param {number} type
|
|
315
|
+
* @return {number}
|
|
316
|
+
*/
|
|
317
|
+
function token (type) {
|
|
318
|
+
switch (type) {
|
|
319
|
+
// \0 \t \n \r \s whitespace token
|
|
320
|
+
case 0: case 9: case 10: case 13: case 32:
|
|
321
|
+
return 5
|
|
322
|
+
// ! + , / > @ ~ isolate token
|
|
323
|
+
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
|
|
324
|
+
// ; { } breakpoint token
|
|
325
|
+
case 59: case 123: case 125:
|
|
326
|
+
return 4
|
|
327
|
+
// : accompanied token
|
|
328
|
+
case 58:
|
|
329
|
+
return 3
|
|
330
|
+
// " ' ( [ opening delimit token
|
|
331
|
+
case 34: case 39: case 40: case 91:
|
|
332
|
+
return 2
|
|
333
|
+
// ) ] closing delimit token
|
|
334
|
+
case 41: case 93:
|
|
335
|
+
return 1
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return 0
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @param {string} value
|
|
343
|
+
* @return {any[]}
|
|
344
|
+
*/
|
|
345
|
+
function alloc (value) {
|
|
346
|
+
return line = column = 1, length = strlen(characters = value), position = 0, []
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @param {any} value
|
|
351
|
+
* @return {any}
|
|
352
|
+
*/
|
|
353
|
+
function dealloc (value) {
|
|
354
|
+
return characters = '', value
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @param {number} type
|
|
359
|
+
* @return {string}
|
|
360
|
+
*/
|
|
361
|
+
function delimit (type) {
|
|
362
|
+
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* @param {number} type
|
|
367
|
+
* @return {string}
|
|
368
|
+
*/
|
|
369
|
+
function whitespace (type) {
|
|
370
|
+
while (character = peek())
|
|
371
|
+
if (character < 33)
|
|
372
|
+
next();
|
|
373
|
+
else
|
|
374
|
+
break
|
|
375
|
+
|
|
376
|
+
return token(type) > 2 || token(character) > 3 ? '' : ' '
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @param {number} index
|
|
381
|
+
* @param {number} count
|
|
382
|
+
* @return {string}
|
|
383
|
+
*/
|
|
384
|
+
function escaping (index, count) {
|
|
385
|
+
while (--count && next())
|
|
386
|
+
// not 0-9 A-F a-f
|
|
387
|
+
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
|
|
388
|
+
break
|
|
389
|
+
|
|
390
|
+
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* @param {number} type
|
|
395
|
+
* @return {number}
|
|
396
|
+
*/
|
|
397
|
+
function delimiter (type) {
|
|
398
|
+
while (next())
|
|
399
|
+
switch (character) {
|
|
400
|
+
// ] ) " '
|
|
401
|
+
case type:
|
|
402
|
+
return position
|
|
403
|
+
// " '
|
|
404
|
+
case 34: case 39:
|
|
405
|
+
if (type !== 34 && type !== 39)
|
|
406
|
+
delimiter(character);
|
|
407
|
+
break
|
|
408
|
+
// (
|
|
409
|
+
case 40:
|
|
410
|
+
if (type === 41)
|
|
411
|
+
delimiter(type);
|
|
412
|
+
break
|
|
413
|
+
// \
|
|
414
|
+
case 92:
|
|
415
|
+
next();
|
|
416
|
+
break
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return position
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @param {number} type
|
|
424
|
+
* @param {number} index
|
|
425
|
+
* @return {number}
|
|
426
|
+
*/
|
|
427
|
+
function commenter (type, index) {
|
|
428
|
+
while (next())
|
|
429
|
+
// //
|
|
430
|
+
if (type + character === 47 + 10)
|
|
431
|
+
break
|
|
432
|
+
// /*
|
|
433
|
+
else if (type + character === 42 + 42 && peek() === 47)
|
|
434
|
+
break
|
|
435
|
+
|
|
436
|
+
return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @param {number} index
|
|
441
|
+
* @return {string}
|
|
442
|
+
*/
|
|
443
|
+
function identifier (index) {
|
|
444
|
+
while (!token(peek()))
|
|
445
|
+
next();
|
|
446
|
+
|
|
447
|
+
return slice(index, position)
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* @param {string} value
|
|
452
|
+
* @return {object[]}
|
|
453
|
+
*/
|
|
454
|
+
function compile (value) {
|
|
455
|
+
return dealloc(parse$1('', null, null, null, [''], value = alloc(value), 0, [0], value))
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* @param {string} value
|
|
460
|
+
* @param {object} root
|
|
461
|
+
* @param {object?} parent
|
|
462
|
+
* @param {string[]} rule
|
|
463
|
+
* @param {string[]} rules
|
|
464
|
+
* @param {string[]} rulesets
|
|
465
|
+
* @param {number[]} pseudo
|
|
466
|
+
* @param {number[]} points
|
|
467
|
+
* @param {string[]} declarations
|
|
468
|
+
* @return {object}
|
|
469
|
+
*/
|
|
470
|
+
function parse$1 (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
|
471
|
+
var index = 0;
|
|
472
|
+
var offset = 0;
|
|
473
|
+
var length = pseudo;
|
|
474
|
+
var atrule = 0;
|
|
475
|
+
var property = 0;
|
|
476
|
+
var previous = 0;
|
|
477
|
+
var variable = 1;
|
|
478
|
+
var scanning = 1;
|
|
479
|
+
var ampersand = 1;
|
|
480
|
+
var character = 0;
|
|
481
|
+
var type = '';
|
|
482
|
+
var props = rules;
|
|
483
|
+
var children = rulesets;
|
|
484
|
+
var reference = rule;
|
|
485
|
+
var characters = type;
|
|
486
|
+
|
|
487
|
+
while (scanning)
|
|
488
|
+
switch (previous = character, character = next()) {
|
|
489
|
+
// (
|
|
490
|
+
case 40:
|
|
491
|
+
if (previous != 108 && charat(characters, length - 1) == 58) {
|
|
492
|
+
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f', abs(index ? points[index - 1] : 0)) != -1)
|
|
493
|
+
ampersand = -1;
|
|
494
|
+
break
|
|
495
|
+
}
|
|
496
|
+
// " ' [
|
|
497
|
+
case 34: case 39: case 91:
|
|
498
|
+
characters += delimit(character);
|
|
499
|
+
break
|
|
500
|
+
// \t \n \r \s
|
|
501
|
+
case 9: case 10: case 13: case 32:
|
|
502
|
+
characters += whitespace(previous);
|
|
503
|
+
break
|
|
504
|
+
// \
|
|
505
|
+
case 92:
|
|
506
|
+
characters += escaping(caret() - 1, 7);
|
|
507
|
+
continue
|
|
508
|
+
// /
|
|
509
|
+
case 47:
|
|
510
|
+
switch (peek()) {
|
|
511
|
+
case 42: case 47:
|
|
512
|
+
append(comment(commenter(next(), caret()), root, parent, declarations), declarations);
|
|
513
|
+
break
|
|
514
|
+
default:
|
|
515
|
+
characters += '/';
|
|
516
|
+
}
|
|
517
|
+
break
|
|
518
|
+
// {
|
|
519
|
+
case 123 * variable:
|
|
520
|
+
points[index++] = strlen(characters) * ampersand;
|
|
521
|
+
// } ; \0
|
|
522
|
+
case 125 * variable: case 59: case 0:
|
|
523
|
+
switch (character) {
|
|
524
|
+
// \0 }
|
|
525
|
+
case 0: case 125: scanning = 0;
|
|
526
|
+
// ;
|
|
527
|
+
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '');
|
|
528
|
+
if (property > 0 && (strlen(characters) - length))
|
|
529
|
+
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations);
|
|
530
|
+
break
|
|
531
|
+
// @ ;
|
|
532
|
+
case 59: characters += ';';
|
|
533
|
+
// { rule/at-rule
|
|
534
|
+
default:
|
|
535
|
+
append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets);
|
|
536
|
+
|
|
537
|
+
if (character === 123)
|
|
538
|
+
if (offset === 0)
|
|
539
|
+
parse$1(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
540
|
+
else
|
|
541
|
+
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
542
|
+
// d l m s
|
|
543
|
+
case 100: case 108: case 109: case 115:
|
|
544
|
+
parse$1(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children);
|
|
545
|
+
break
|
|
546
|
+
default:
|
|
547
|
+
parse$1(characters, reference, reference, reference, [''], children, 0, points, children);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo;
|
|
552
|
+
break
|
|
553
|
+
// :
|
|
554
|
+
case 58:
|
|
555
|
+
length = 1 + strlen(characters), property = previous;
|
|
556
|
+
default:
|
|
557
|
+
if (variable < 1)
|
|
558
|
+
if (character == 123)
|
|
559
|
+
--variable;
|
|
560
|
+
else if (character == 125 && variable++ == 0 && prev() == 125)
|
|
561
|
+
continue
|
|
562
|
+
|
|
563
|
+
switch (characters += from(character), character * variable) {
|
|
564
|
+
// &
|
|
565
|
+
case 38:
|
|
566
|
+
ampersand = offset > 0 ? 1 : (characters += '\f', -1);
|
|
567
|
+
break
|
|
568
|
+
// ,
|
|
569
|
+
case 44:
|
|
570
|
+
points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
|
|
571
|
+
break
|
|
572
|
+
// @
|
|
573
|
+
case 64:
|
|
574
|
+
// -
|
|
575
|
+
if (peek() === 45)
|
|
576
|
+
characters += delimit(next());
|
|
577
|
+
|
|
578
|
+
atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
|
|
579
|
+
break
|
|
580
|
+
// -
|
|
581
|
+
case 45:
|
|
582
|
+
if (previous === 45 && strlen(characters) == 2)
|
|
583
|
+
variable = 0;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
return rulesets
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* @param {string} value
|
|
592
|
+
* @param {object} root
|
|
593
|
+
* @param {object?} parent
|
|
594
|
+
* @param {number} index
|
|
595
|
+
* @param {number} offset
|
|
596
|
+
* @param {string[]} rules
|
|
597
|
+
* @param {number[]} points
|
|
598
|
+
* @param {string} type
|
|
599
|
+
* @param {string[]} props
|
|
600
|
+
* @param {string[]} children
|
|
601
|
+
* @param {number} length
|
|
602
|
+
* @param {object[]} siblings
|
|
603
|
+
* @return {object}
|
|
604
|
+
*/
|
|
605
|
+
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {
|
|
606
|
+
var post = offset - 1;
|
|
607
|
+
var rule = offset === 0 ? rules : [''];
|
|
608
|
+
var size = sizeof(rule);
|
|
609
|
+
|
|
610
|
+
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
|
611
|
+
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
|
612
|
+
if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
|
|
613
|
+
props[k++] = z;
|
|
614
|
+
|
|
615
|
+
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* @param {number} value
|
|
620
|
+
* @param {object} root
|
|
621
|
+
* @param {object?} parent
|
|
622
|
+
* @param {object[]} siblings
|
|
623
|
+
* @return {object}
|
|
624
|
+
*/
|
|
625
|
+
function comment (value, root, parent, siblings) {
|
|
626
|
+
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* @param {string} value
|
|
631
|
+
* @param {object} root
|
|
632
|
+
* @param {object?} parent
|
|
633
|
+
* @param {number} length
|
|
634
|
+
* @param {object[]} siblings
|
|
635
|
+
* @return {object}
|
|
636
|
+
*/
|
|
637
|
+
function declaration (value, root, parent, length, siblings) {
|
|
638
|
+
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* @param {string} value
|
|
643
|
+
* @param {number} length
|
|
644
|
+
* @param {object[]} children
|
|
645
|
+
* @return {string}
|
|
646
|
+
*/
|
|
647
|
+
function prefix (value, length, children) {
|
|
648
|
+
switch (hash(value, length)) {
|
|
649
|
+
// color-adjust
|
|
650
|
+
case 5103:
|
|
651
|
+
return WEBKIT + 'print-' + value + value
|
|
652
|
+
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
|
653
|
+
case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
|
|
654
|
+
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
|
655
|
+
case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
|
|
656
|
+
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
|
657
|
+
case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
|
|
658
|
+
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
|
659
|
+
case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
|
|
660
|
+
return WEBKIT + value + value
|
|
661
|
+
// tab-size
|
|
662
|
+
case 4789:
|
|
663
|
+
return MOZ + value + value
|
|
664
|
+
// appearance, user-select, transform, hyphens, text-size-adjust
|
|
665
|
+
case 5349: case 4246: case 4810: case 6968: case 2756:
|
|
666
|
+
return WEBKIT + value + MOZ + value + MS + value + value
|
|
667
|
+
// writing-mode
|
|
668
|
+
case 5936:
|
|
669
|
+
switch (charat(value, length + 11)) {
|
|
670
|
+
// vertical-l(r)
|
|
671
|
+
case 114:
|
|
672
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
|
|
673
|
+
// vertical-r(l)
|
|
674
|
+
case 108:
|
|
675
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
|
|
676
|
+
// horizontal(-)tb
|
|
677
|
+
case 45:
|
|
678
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
|
|
679
|
+
// default: fallthrough to below
|
|
680
|
+
}
|
|
681
|
+
// flex, flex-direction, scroll-snap-type, writing-mode
|
|
682
|
+
case 6828: case 4268: case 2903:
|
|
683
|
+
return WEBKIT + value + MS + value + value
|
|
684
|
+
// order
|
|
685
|
+
case 6165:
|
|
686
|
+
return WEBKIT + value + MS + 'flex-' + value + value
|
|
687
|
+
// align-items
|
|
688
|
+
case 5187:
|
|
689
|
+
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
|
|
690
|
+
// align-self
|
|
691
|
+
case 5443:
|
|
692
|
+
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/g, '') + (!match(value, /flex-|baseline/) ? MS + 'grid-row-' + replace(value, /flex-|-self/g, '') : '') + value
|
|
693
|
+
// align-content
|
|
694
|
+
case 4675:
|
|
695
|
+
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/g, '') + value
|
|
696
|
+
// flex-shrink
|
|
697
|
+
case 5548:
|
|
698
|
+
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
|
|
699
|
+
// flex-basis
|
|
700
|
+
case 5292:
|
|
701
|
+
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
|
|
702
|
+
// flex-grow
|
|
703
|
+
case 6060:
|
|
704
|
+
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
|
|
705
|
+
// transition
|
|
706
|
+
case 4554:
|
|
707
|
+
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
|
|
708
|
+
// cursor
|
|
709
|
+
case 6187:
|
|
710
|
+
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
|
|
711
|
+
// background, background-image
|
|
712
|
+
case 5495: case 3959:
|
|
713
|
+
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
|
|
714
|
+
// justify-content
|
|
715
|
+
case 4968:
|
|
716
|
+
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
|
|
717
|
+
// justify-self
|
|
718
|
+
case 4200:
|
|
719
|
+
if (!match(value, /flex-|baseline/)) return MS + 'grid-column-align' + substr(value, length) + value
|
|
720
|
+
break
|
|
721
|
+
// grid-template-(columns|rows)
|
|
722
|
+
case 2592: case 3360:
|
|
723
|
+
return MS + replace(value, 'template-', '') + value
|
|
724
|
+
// grid-(row|column)-start
|
|
725
|
+
case 4384: case 3616:
|
|
726
|
+
if (children && children.some(function (element, index) { return length = index, match(element.props, /grid-\w+-end/) })) {
|
|
727
|
+
return ~indexof(value + (children = children[length].value), 'span', 0) ? value : (MS + replace(value, '-start', '') + value + MS + 'grid-row-span:' + (~indexof(children, 'span', 0) ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ';')
|
|
728
|
+
}
|
|
729
|
+
return MS + replace(value, '-start', '') + value
|
|
730
|
+
// grid-(row|column)-end
|
|
731
|
+
case 4896: case 4128:
|
|
732
|
+
return (children && children.some(function (element) { return match(element.props, /grid-\w+-start/) })) ? value : MS + replace(replace(value, '-end', '-span'), 'span ', '') + value
|
|
733
|
+
// (margin|padding)-inline-(start|end)
|
|
734
|
+
case 4095: case 3583: case 4068: case 2532:
|
|
735
|
+
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
|
|
736
|
+
// (min|max)?(width|height|inline-size|block-size)
|
|
737
|
+
case 8116: case 7059: case 5753: case 5535:
|
|
738
|
+
case 5445: case 5701: case 4933: case 4677:
|
|
739
|
+
case 5533: case 5789: case 5021: case 4765:
|
|
740
|
+
// stretch, max-content, min-content, fill-available
|
|
741
|
+
if (strlen(value) - 1 - length > 6)
|
|
742
|
+
switch (charat(value, length + 1)) {
|
|
743
|
+
// (m)ax-content, (m)in-content
|
|
744
|
+
case 109:
|
|
745
|
+
// -
|
|
746
|
+
if (charat(value, length + 4) !== 45)
|
|
747
|
+
break
|
|
748
|
+
// (f)ill-available, (f)it-content
|
|
749
|
+
case 102:
|
|
750
|
+
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
|
|
751
|
+
// (s)tretch
|
|
752
|
+
case 115:
|
|
753
|
+
return ~indexof(value, 'stretch', 0) ? prefix(replace(value, 'stretch', 'fill-available'), length, children) + value : value
|
|
754
|
+
}
|
|
755
|
+
break
|
|
756
|
+
// grid-(column|row)
|
|
757
|
+
case 5152: case 5920:
|
|
758
|
+
return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (MS + a + ':' + b + f) + (c ? (MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })
|
|
759
|
+
// position: sticky
|
|
760
|
+
case 4949:
|
|
761
|
+
// stick(y)?
|
|
762
|
+
if (charat(value, length + 6) === 121)
|
|
763
|
+
return replace(value, ':', ':' + WEBKIT) + value
|
|
764
|
+
break
|
|
765
|
+
// display: (flex|inline-flex|grid|inline-grid)
|
|
766
|
+
case 6444:
|
|
767
|
+
switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
|
|
768
|
+
// (inline-)?fle(x)
|
|
769
|
+
case 120:
|
|
770
|
+
return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
|
|
771
|
+
// (inline-)?gri(d)
|
|
772
|
+
case 100:
|
|
773
|
+
return replace(value, ':', ':' + MS) + value
|
|
774
|
+
}
|
|
775
|
+
break
|
|
776
|
+
// scroll-margin, scroll-margin-(top|right|bottom|left)
|
|
777
|
+
case 5719: case 2647: case 2135: case 3927: case 2391:
|
|
778
|
+
return replace(value, 'scroll-', 'scroll-snap-') + value
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
return value
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* @param {object[]} children
|
|
786
|
+
* @param {function} callback
|
|
787
|
+
* @return {string}
|
|
788
|
+
*/
|
|
789
|
+
function serialize (children, callback) {
|
|
790
|
+
var output = '';
|
|
791
|
+
|
|
792
|
+
for (var i = 0; i < children.length; i++)
|
|
793
|
+
output += callback(children[i], i, children, callback) || '';
|
|
794
|
+
|
|
795
|
+
return output
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* @param {object} element
|
|
800
|
+
* @param {number} index
|
|
801
|
+
* @param {object[]} children
|
|
802
|
+
* @param {function} callback
|
|
803
|
+
* @return {string}
|
|
804
|
+
*/
|
|
805
|
+
function stringify (element, index, children, callback) {
|
|
806
|
+
switch (element.type) {
|
|
807
|
+
case LAYER: if (element.children.length) break
|
|
808
|
+
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
|
809
|
+
case COMMENT: return ''
|
|
810
|
+
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
|
811
|
+
case RULESET: if (!strlen(element.value = element.props.join(','))) return ''
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* @param {function[]} collection
|
|
819
|
+
* @return {function}
|
|
820
|
+
*/
|
|
821
|
+
function middleware (collection) {
|
|
822
|
+
var length = sizeof(collection);
|
|
823
|
+
|
|
824
|
+
return function (element, index, children, callback) {
|
|
825
|
+
var output = '';
|
|
826
|
+
|
|
827
|
+
for (var i = 0; i < length; i++)
|
|
828
|
+
output += collection[i](element, index, children, callback) || '';
|
|
829
|
+
|
|
830
|
+
return output
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* @param {function} callback
|
|
836
|
+
* @return {function}
|
|
837
|
+
*/
|
|
838
|
+
function rulesheet (callback) {
|
|
839
|
+
return function (element) {
|
|
840
|
+
if (!element.root)
|
|
841
|
+
if (element = element.return)
|
|
842
|
+
callback(element);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* @param {object} element
|
|
848
|
+
* @param {number} index
|
|
849
|
+
* @param {object[]} children
|
|
850
|
+
* @param {function} callback
|
|
851
|
+
*/
|
|
852
|
+
function prefixer (element, index, children, callback) {
|
|
853
|
+
if (element.length > -1)
|
|
854
|
+
if (!element.return)
|
|
855
|
+
switch (element.type) {
|
|
856
|
+
case DECLARATION: element.return = prefix(element.value, element.length, children);
|
|
857
|
+
return
|
|
858
|
+
case KEYFRAMES:
|
|
859
|
+
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
|
|
860
|
+
case RULESET:
|
|
861
|
+
if (element.length)
|
|
862
|
+
return combine(children = element.props, function (value) {
|
|
863
|
+
switch (match(value, callback = /(::plac\w+|:read-\w+)/)) {
|
|
864
|
+
// :read-(only|write)
|
|
865
|
+
case ':read-only': case ':read-write':
|
|
866
|
+
lift(copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]}));
|
|
867
|
+
lift(copy(element, {props: [value]}));
|
|
868
|
+
assign(element, {props: filter(children, callback)});
|
|
869
|
+
break
|
|
870
|
+
// :placeholder
|
|
871
|
+
case '::placeholder':
|
|
872
|
+
lift(copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}));
|
|
873
|
+
lift(copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}));
|
|
874
|
+
lift(copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]}));
|
|
875
|
+
lift(copy(element, {props: [value]}));
|
|
876
|
+
assign(element, {props: filter(children, callback)});
|
|
877
|
+
break
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
return ''
|
|
881
|
+
})
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
var unitlessKeys = {
|
|
886
|
+
animationIterationCount: 1,
|
|
887
|
+
aspectRatio: 1,
|
|
888
|
+
borderImageOutset: 1,
|
|
889
|
+
borderImageSlice: 1,
|
|
890
|
+
borderImageWidth: 1,
|
|
891
|
+
boxFlex: 1,
|
|
892
|
+
boxFlexGroup: 1,
|
|
893
|
+
boxOrdinalGroup: 1,
|
|
894
|
+
columnCount: 1,
|
|
895
|
+
columns: 1,
|
|
896
|
+
flex: 1,
|
|
897
|
+
flexGrow: 1,
|
|
898
|
+
flexPositive: 1,
|
|
899
|
+
flexShrink: 1,
|
|
900
|
+
flexNegative: 1,
|
|
901
|
+
flexOrder: 1,
|
|
902
|
+
gridRow: 1,
|
|
903
|
+
gridRowEnd: 1,
|
|
904
|
+
gridRowSpan: 1,
|
|
905
|
+
gridRowStart: 1,
|
|
906
|
+
gridColumn: 1,
|
|
907
|
+
gridColumnEnd: 1,
|
|
908
|
+
gridColumnSpan: 1,
|
|
909
|
+
gridColumnStart: 1,
|
|
910
|
+
msGridRow: 1,
|
|
911
|
+
msGridRowSpan: 1,
|
|
912
|
+
msGridColumn: 1,
|
|
913
|
+
msGridColumnSpan: 1,
|
|
914
|
+
fontWeight: 1,
|
|
915
|
+
lineHeight: 1,
|
|
916
|
+
opacity: 1,
|
|
917
|
+
order: 1,
|
|
918
|
+
orphans: 1,
|
|
919
|
+
tabSize: 1,
|
|
920
|
+
widows: 1,
|
|
921
|
+
zIndex: 1,
|
|
922
|
+
zoom: 1,
|
|
923
|
+
WebkitLineClamp: 1,
|
|
924
|
+
// SVG-related properties
|
|
925
|
+
fillOpacity: 1,
|
|
926
|
+
floodOpacity: 1,
|
|
927
|
+
stopOpacity: 1,
|
|
928
|
+
strokeDasharray: 1,
|
|
929
|
+
strokeDashoffset: 1,
|
|
930
|
+
strokeMiterlimit: 1,
|
|
931
|
+
strokeOpacity: 1,
|
|
932
|
+
strokeWidth: 1
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
var f="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",m="active",y="data-styled-version",v="6.1.11",g="/*!sc*/\n",S="undefined"!=typeof window&&"HTMLElement"in window,w=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),E=/invalid hook call/i,N=new Set,P=function(t,n){if("production"!==process.env.NODE_ENV){var o=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];E.test(t)?(a=!1,N.delete(s)):i.apply(void 0,__spreadArray([t],n,!1));},useRef(),a&&!N.has(s)&&(console.warn(s),N.add(s));}catch(e){E.test(e.message)&&N.delete(s);}finally{console.error=i;}}},_=Object.freeze([]),C=Object.freeze({});function I(e,t,n){return void 0===n&&(n=C),e.theme!==n.theme&&e.theme||t||n.theme}var A=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),O=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,D=/(^-|-$)/g;function R(e){return e.replace(O,"-").replace(D,"")}var T=/(a)(d)/gi,k=52,j=function(e){return String.fromCharCode(e+(e>25?39:97))};function x(e){var t,n="";for(t=Math.abs(e);t>k;t=t/k|0)n=j(t%k)+n;return (j(t%k)+n).replace(T,"$1-$2")}var V,F=5381,M=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},z=function(e){return M(F,e)};function $(e){return x(z(e)>>>0)}function B(e){return "production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function L(e){return "string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var G="function"==typeof Symbol&&Symbol.for,Y=G?Symbol.for("react.memo"):60115,q=G?Symbol.for("react.forward_ref"):60112,W={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J=((V={})[q]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[Y]=U,V);function X(e){return ("type"in(t=e)&&t.type.$$typeof)===Y?U:"$$typeof"in e?J[e.$$typeof]:W;var t;}var Z=Object.defineProperty,K=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,ee=Object.getOwnPropertyDescriptor,te=Object.getPrototypeOf,ne=Object.prototype;function oe(e,t,n){if("string"!=typeof t){if(ne){var o=te(t);o&&o!==ne&&oe(e,o,n);}var r=K(t);Q&&(r=r.concat(Q(t)));for(var s=X(e),i=X(t),a=0;a<r.length;++a){var c=r[a];if(!(c in H||n&&n[c]||i&&c in i||s&&c in s)){var l=ee(t,c);try{Z(e,c,l);}catch(e){}}}}return e}function re(e){return "function"==typeof e}function se(e){return "object"==typeof e&&"styledComponentId"in e}function ie(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ae(e,t){if(0===e.length)return "";for(var n=e[0],o=1;o<e.length;o++)n+=e[o];return n}function ce(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function le(e,t,n){if(void 0===n&&(n=!1),!n&&!ce(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=le(e[o],t[o]);else if(ce(t))for(var o in t)e[o]=le(e[o],t[o]);return e}function ue(e,t){Object.defineProperty(e,"toString",{value:t});}var pe="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function de(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e);}),n}function he(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return "production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(de.apply(void 0,__spreadArray([pe[t]],n,!1)).trim())}var fe=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e;}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw he(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0;}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++);},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n);}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat(g);return t},e}(),me=1<<30,ye=new Map,ve=new Map,ge=1,Se=function(e){if(ye.has(e))return ye.get(e);for(;ve.has(ge);)ge++;var t=ge++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>me))throw he(16,"".concat(t));return ye.set(e,t),ve.set(t,e),t},we=function(e,t){ge=t+1,ye.set(e,t),ve.set(t,e);},be="style[".concat(f,"][").concat(y,'="').concat(v,'"]'),Ee=new RegExp("^".concat(f,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Ne=function(e,t,n){for(var o,r=n.split(","),s=0,i=r.length;s<i;s++)(o=r[s])&&e.registerName(t,o);},Pe=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split(g),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(Ee);if(c){var l=0|parseInt(c[1],10),u=c[2];0!==l&&(we(u,l),Ne(e,u,c[3]),e.getTag().insertRules(l,r)),r.length=0;}else r.push(a);}}};function _e(){return "undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var Ce=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(f,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(f,m),o.setAttribute(y,v);var i=_e();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},Ie=function(){function e(e){this.element=Ce(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw he(17)}(this.element),this.length=0;}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return !1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--;},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),Ae=function(){function e(e){this.element=Ce(e),this.nodes=this.element.childNodes,this.length=0;}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return !1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Oe=function(){function e(e){this.rules=[],this.length=0;}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),De=S,Re={isServer:!S,useCSSOMInjection:!w},Te=function(){function e(e,n,o){void 0===e&&(e=C),void 0===n&&(n={});var r=this;this.options=__assign(__assign({},Re),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,!this.server&&S&&De&&(De=!1,function(e){for(var t=document.querySelectorAll(be),n=0,o=t.length;n<o;n++){var r=t[n];r&&r.getAttribute(f)!==m&&(Pe(e,r),r.parentNode&&r.parentNode.removeChild(r));}}(this)),ue(this,function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return ve.get(e)}(n);if(void 0===r)return "continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||0===i.length)return "continue";var a="".concat(f,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","));}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat(g);},s=0;s<n;s++)r(s);return o}(r)});}return e.registerId=function(e){return Se(e)},e.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new e(__assign(__assign({},this.options),n),this.gs,o&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Oe(n):t?new Ie(n):new Ae(n)}(this.options),new fe(e)));var e;},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(Se(e),this.names.has(e))this.names.get(e).add(t);else {var n=new Set;n.add(t),this.names.set(e,n);}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(Se(e),n);},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear();},e.prototype.clearRules=function(e){this.getTag().clearGroup(Se(e)),this.clearNames(e);},e.prototype.clearTag=function(){this.tag=void 0;},e}(),ke=/&/g,je=/^\s*\/\/.*$/gm;function xe(e,t){return e.map(function(e){return "rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return "".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=xe(e.children,t)),e})}function Ve(e){var t,n,o,r=C,s=r.options,i=void 0===s?C:s,a=r.plugins,c=void 0===a?_:a,l=function(e,o,r){return r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},u=c.slice();u.push(function(e){e.type===RULESET&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(ke,n).replace(o,l));}),i.prefix&&u.push(prefixer),u.push(stringify);var p=function(e,r,s,a){void 0===r&&(r=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=r,o=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(je,""),l=compile(s||r?"".concat(s," ").concat(r," { ").concat(c," }"):c);i.namespace&&(l=xe(l,i.namespace));var p=[];return serialize(l,middleware(u.concat(rulesheet(function(e){return p.push(e)})))),p};return p.hash=c.length?c.reduce(function(e,t){return t.name||he(15),M(e,t.name)},F).toString():"",p}var Fe=new Te,Me=Ve(),ze=React__default.createContext({shouldForwardProp:void 0,styleSheet:Fe,stylis:Me});ze.Consumer;React__default.createContext(void 0);function Le(){return useContext(ze)}var Ye=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Me);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"));},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ue(this,function(){throw he(12,String(n.name))});}return e.prototype.getName=function(e){return void 0===e&&(e=Me),this.name+e.hash},e}(),qe=function(e){return e>="A"&&e<="Z"};function We(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;qe(o)?t+="-"+o.toLowerCase():t+=o;}return t.startsWith("ms-")?"-"+t:t}var He=function(e){return null==e||!1===e||""===e},Ue=function(t){var n,o,r=[];for(var s in t){var i=t[s];t.hasOwnProperty(s)&&!He(i)&&(Array.isArray(i)&&i.isCss||re(i)?r.push("".concat(We(s),":"),i,";"):ce(i)?r.push.apply(r,__spreadArray(__spreadArray(["".concat(s," {")],Ue(i),!1),["}"],!1)):r.push("".concat(We(s),": ").concat((n=s,null==(o=i)||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||n in unitlessKeys||n.startsWith("--")?String(o).trim():"".concat(o,"px")),";")));}return r};function Je(e,t,n,o){if(He(e))return [];if(se(e))return [".".concat(e.styledComponentId)];if(re(e)){if(!re(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return [e];var r=e(t);return "production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof Ye||ce(r)||null===r||console.error("".concat(B(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Je(r,t,n,o)}var s;return e instanceof Ye?n?(e.inject(n,o),[e.getName(o)]):[e]:ce(e)?Ue(e):Array.isArray(e)?Array.prototype.concat.apply(_,e.map(function(e){return Je(e,t,n,o)})):[e.toString()]}function Xe(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(re(n)&&!se(n))return !1}return !0}var Ze=z(v),Ke=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Xe(e),this.componentId=t,this.baseHash=M(Ze,t),this.baseStyle=n,Te.registerId(t);}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ie(o,this.staticRulesId);else {var r=ae(Je(this.rules,e,t,n)),s=x(M(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i);}o=ie(o,s),this.staticRulesId=s;}else {for(var a=M(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(a=M(a,u));else if(u){var p=ae(Je(u,e,t,n));a=M(a,p+l),c+=p;}}if(c){var d=x(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,".".concat(d),void 0,this.componentId)),o=ie(o,d);}}return o},e}(),Qe=React__default.createContext(void 0);Qe.Consumer;var ot={},rt=new Set;function st(e,r,s){var i=se(e),a=e,c=!L(e),p=r.attrs,d=void 0===p?_:p,h=r.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":R(e);ot[n]=(ot[n]||0)+1;var o="".concat(n,"-").concat($(v+n+ot[n]));return t?"".concat(t,"-").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return L(e)?"styled.".concat(e):"Styled(".concat(B(e),")")}(e):m,g=r.displayName&&r.componentId?"".concat(R(r.displayName),"-").concat(r.componentId):r.componentId||f,S=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,w=r.shouldForwardProp;if(i&&a.shouldForwardProp){var b=a.shouldForwardProp;if(r.shouldForwardProp){var E=r.shouldForwardProp;w=function(e,t){return b(e,t)&&E(e,t)};}else w=b;}var N=new Ke(s,g,i?a.componentStyle:void 0);function O(e,r){return function(e,r,s){var i=e.attrs,a=e.componentStyle,c=e.defaultProps,p=e.foldedComponentIds,d=e.styledComponentId,h=e.target,f=React__default.useContext(Qe),m=Le(),y=e.shouldForwardProp||m.shouldForwardProp;"production"!==process.env.NODE_ENV&&useDebugValue(d);var v=I(r,f,c)||C,g=function(e,n,o){for(var r,s=__assign(__assign({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=re(r=e[i])?r(s):r;for(var c in a)s[c]="className"===c?ie(s[c],a[c]):"style"===c?__assign(__assign({},s[c]),a[c]):a[c];}return n.className&&(s.className=ie(s.className,n.className)),s}(i,r,v),S=g.as||h,w={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b&&g.theme===v||("forwardedAs"===b?w.as=g.forwardedAs:y&&!y(b,S)||(w[b]=g[b],y||"development"!==process.env.NODE_ENV||isPropValid(b)||rt.has(b)||!A.has(S)||(rt.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var E=function(e,t){var n=Le(),o=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return "production"!==process.env.NODE_ENV&&useDebugValue(o),o}(a,g);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(E);var N=ie(p,d);return E&&(N+=" "+E),g.className&&(N+=" "+g.className),w[L(S)&&!A.has(S)?"class":"className"]=N,w.ref=s,createElement(S,w)}(D,e,r)}O.displayName=y;var D=React__default.forwardRef(O);return D.attrs=S,D.componentStyle=N,D.displayName=y,D.shouldForwardProp=w,D.foldedComponentIds=i?ie(a.foldedComponentIds,a.styledComponentId):"",D.styledComponentId=g,D.target=i?a.target:e,Object.defineProperty(D,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)le(e,r[o],!0);return e}({},a.defaultProps,e):e;}}),"production"!==process.env.NODE_ENV&&(P(y,g),D.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={};}}}(y,g)),ue(D,function(){return ".".concat(D.styledComponentId)}),c&&oe(D,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),D}function it(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var at=function(e){return Object.assign(e,{isCss:!0})};function ct(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(re(t)||ce(t))return at(Je(it(_,__spreadArray([t],n,!0))));var r=t;return 0===n.length&&1===r.length&&"string"==typeof r[0]?Je(r):at(Je(it(r,n)))}function lt(n,o,r){if(void 0===r&&(r=C),!o)throw he(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,ct.apply(void 0,__spreadArray([t],s,!1)))};return s.attrs=function(e){return lt(n,o,__assign(__assign({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return lt(n,o,__assign(__assign({},r),e))},s}var ut=function(e){return lt(st,e)},pt=ut;A.forEach(function(e){pt[e]=ut(e);});function ft(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var r=ae(ct.apply(void 0,__spreadArray([t],n,!1))),s=$(r);return new Ye(s,r)}"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var St="__sc-".concat(f,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[St]||(window[St]=0),1===window[St]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[St]+=1);
|
|
936
|
+
|
|
937
|
+
// Estilos base compartilhados
|
|
938
|
+
var BaseButton = pt.button(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n all: unset;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n cursor: pointer;\n\n &:disabled {\n cursor: not-allowed;\n }\n"], ["\n all: unset;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n cursor: pointer;\n\n &:disabled {\n cursor: not-allowed;\n }\n"])));
|
|
939
|
+
// Estilos do botão primário
|
|
940
|
+
var PrimaryButton = ct(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n width: fit-content;\n height: fit-content;\n padding: 12px 16px;\n border-radius: 8px;\n border: 1px solid ", ";\n color: #fff;\n font-weight: 700;\n background: ", ";\n"], ["\n width: fit-content;\n height: fit-content;\n padding: 12px 16px;\n border-radius: 8px;\n border: 1px solid ", ";\n color: #fff;\n font-weight: 700;\n background: ", ";\n"])), function (_a) {
|
|
941
|
+
var theme = _a.theme;
|
|
942
|
+
return theme.colors.primary;
|
|
943
|
+
}, function (_a) {
|
|
944
|
+
var theme = _a.theme;
|
|
945
|
+
return theme.colors.primary;
|
|
946
|
+
});
|
|
947
|
+
// Estilos do botão secundário
|
|
948
|
+
var SecondaryButton = ct(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n width: fit-content;\n height: fit-content;\n padding: 12px 8px;\n border-radius: 8px;\n border: 1px solid ", ";\n font-weight: 700;\n color: ", ";\n background: transparent;\n"], ["\n width: fit-content;\n height: fit-content;\n padding: 12px 8px;\n border-radius: 8px;\n border: 1px solid ", ";\n font-weight: 700;\n color: ", ";\n background: transparent;\n"])), function (_a) {
|
|
949
|
+
var theme = _a.theme;
|
|
950
|
+
return theme.colors.primary;
|
|
951
|
+
}, function (_a) {
|
|
952
|
+
var theme = _a.theme;
|
|
953
|
+
return theme.colors.primary;
|
|
954
|
+
});
|
|
955
|
+
var templateObject_1$2, templateObject_2$1, templateObject_3$1;
|
|
956
|
+
|
|
957
|
+
var StyledButton = pt(BaseButton)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
958
|
+
var variant = _a.variant;
|
|
959
|
+
return variant === "primary" ? PrimaryButton : SecondaryButton;
|
|
960
|
+
});
|
|
961
|
+
function Button(_a) {
|
|
962
|
+
var variant = _a.variant, _b = _a.text, text = _b === void 0 ? "" : _b, leftIcon = _a.leftIcon, props = __rest(_a, ["variant", "text", "leftIcon"]);
|
|
963
|
+
return (React__default.createElement(StyledButton, __assign({ variant: variant }, props),
|
|
964
|
+
leftIcon,
|
|
965
|
+
text));
|
|
966
|
+
}
|
|
967
|
+
var templateObject_1$1;
|
|
968
|
+
|
|
969
|
+
// packages/react/context/src/createContext.tsx
|
|
970
|
+
function createContext2(rootComponentName, defaultContext) {
|
|
971
|
+
const Context = React.createContext(defaultContext);
|
|
972
|
+
function Provider(props) {
|
|
973
|
+
const { children, ...context } = props;
|
|
974
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
975
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
976
|
+
}
|
|
977
|
+
function useContext2(consumerName) {
|
|
978
|
+
const context = React.useContext(Context);
|
|
979
|
+
if (context) return context;
|
|
980
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
981
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
982
|
+
}
|
|
983
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
984
|
+
return [Provider, useContext2];
|
|
985
|
+
}
|
|
986
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
987
|
+
let defaultContexts = [];
|
|
988
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
989
|
+
const BaseContext = React.createContext(defaultContext);
|
|
990
|
+
const index = defaultContexts.length;
|
|
991
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
992
|
+
function Provider(props) {
|
|
993
|
+
const { scope, children, ...context } = props;
|
|
994
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
995
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
996
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
58
997
|
}
|
|
59
|
-
|
|
60
|
-
|
|
998
|
+
function useContext2(consumerName, scope) {
|
|
999
|
+
const Context = scope?.[scopeName][index] || BaseContext;
|
|
1000
|
+
const context = React.useContext(Context);
|
|
1001
|
+
if (context) return context;
|
|
1002
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
1003
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1004
|
+
}
|
|
1005
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
1006
|
+
return [Provider, useContext2];
|
|
1007
|
+
}
|
|
1008
|
+
const createScope = () => {
|
|
1009
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
1010
|
+
return React.createContext(defaultContext);
|
|
1011
|
+
});
|
|
1012
|
+
return function useScope(scope) {
|
|
1013
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
1014
|
+
return React.useMemo(
|
|
1015
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
1016
|
+
[scope, contexts]
|
|
1017
|
+
);
|
|
1018
|
+
};
|
|
1019
|
+
};
|
|
1020
|
+
createScope.scopeName = scopeName;
|
|
1021
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1022
|
+
}
|
|
1023
|
+
function composeContextScopes(...scopes) {
|
|
1024
|
+
const baseScope = scopes[0];
|
|
1025
|
+
if (scopes.length === 1) return baseScope;
|
|
1026
|
+
const createScope = () => {
|
|
1027
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
1028
|
+
useScope: createScope2(),
|
|
1029
|
+
scopeName: createScope2.scopeName
|
|
1030
|
+
}));
|
|
1031
|
+
return function useComposedScopes(overrideScopes) {
|
|
1032
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
1033
|
+
const scopeProps = useScope(overrideScopes);
|
|
1034
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
1035
|
+
return { ...nextScopes2, ...currentScope };
|
|
1036
|
+
}, {});
|
|
1037
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
1038
|
+
};
|
|
1039
|
+
};
|
|
1040
|
+
createScope.scopeName = baseScope.scopeName;
|
|
1041
|
+
return createScope;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// packages/react/compose-refs/src/composeRefs.tsx
|
|
1045
|
+
function setRef(ref, value) {
|
|
1046
|
+
if (typeof ref === "function") {
|
|
1047
|
+
ref(value);
|
|
1048
|
+
} else if (ref !== null && ref !== void 0) {
|
|
1049
|
+
ref.current = value;
|
|
61
1050
|
}
|
|
1051
|
+
}
|
|
1052
|
+
function composeRefs(...refs) {
|
|
1053
|
+
return (node) => refs.forEach((ref) => setRef(ref, node));
|
|
1054
|
+
}
|
|
1055
|
+
function useComposedRefs(...refs) {
|
|
1056
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
// packages/core/primitive/src/primitive.tsx
|
|
1060
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
1061
|
+
return function handleEvent(event) {
|
|
1062
|
+
originalEventHandler?.(event);
|
|
1063
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
1064
|
+
return ourEventHandler?.(event);
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
62
1068
|
|
|
63
|
-
|
|
64
|
-
|
|
1069
|
+
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
1070
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
// packages/react/id/src/id.tsx
|
|
1074
|
+
var useReactId = React["useId".toString()] || (() => void 0);
|
|
1075
|
+
var count$1 = 0;
|
|
1076
|
+
function useId(deterministicId) {
|
|
1077
|
+
const [id, setId] = React.useState(useReactId());
|
|
1078
|
+
useLayoutEffect2(() => {
|
|
1079
|
+
if (!deterministicId) setId((reactId) => reactId ?? String(count$1++));
|
|
1080
|
+
}, [deterministicId]);
|
|
1081
|
+
return deterministicId || (id ? `radix-${id}` : "");
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
1085
|
+
function useCallbackRef$1(callback) {
|
|
1086
|
+
const callbackRef = React.useRef(callback);
|
|
1087
|
+
React.useEffect(() => {
|
|
1088
|
+
callbackRef.current = callback;
|
|
1089
|
+
});
|
|
1090
|
+
return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
1094
|
+
function useControllableState({
|
|
1095
|
+
prop,
|
|
1096
|
+
defaultProp,
|
|
1097
|
+
onChange = () => {
|
|
1098
|
+
}
|
|
1099
|
+
}) {
|
|
1100
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
1101
|
+
const isControlled = prop !== void 0;
|
|
1102
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
1103
|
+
const handleChange = useCallbackRef$1(onChange);
|
|
1104
|
+
const setValue = React.useCallback(
|
|
1105
|
+
(nextValue) => {
|
|
1106
|
+
if (isControlled) {
|
|
1107
|
+
const setter = nextValue;
|
|
1108
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
1109
|
+
if (value2 !== prop) handleChange(value2);
|
|
1110
|
+
} else {
|
|
1111
|
+
setUncontrolledProp(nextValue);
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
1115
|
+
);
|
|
1116
|
+
return [value, setValue];
|
|
1117
|
+
}
|
|
1118
|
+
function useUncontrolledState({
|
|
1119
|
+
defaultProp,
|
|
1120
|
+
onChange
|
|
1121
|
+
}) {
|
|
1122
|
+
const uncontrolledState = React.useState(defaultProp);
|
|
1123
|
+
const [value] = uncontrolledState;
|
|
1124
|
+
const prevValueRef = React.useRef(value);
|
|
1125
|
+
const handleChange = useCallbackRef$1(onChange);
|
|
1126
|
+
React.useEffect(() => {
|
|
1127
|
+
if (prevValueRef.current !== value) {
|
|
1128
|
+
handleChange(value);
|
|
1129
|
+
prevValueRef.current = value;
|
|
1130
|
+
}
|
|
1131
|
+
}, [value, prevValueRef, handleChange]);
|
|
1132
|
+
return uncontrolledState;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
// packages/react/slot/src/Slot.tsx
|
|
1136
|
+
var Slot = React.forwardRef((props, forwardedRef) => {
|
|
1137
|
+
const { children, ...slotProps } = props;
|
|
1138
|
+
const childrenArray = React.Children.toArray(children);
|
|
1139
|
+
const slottable = childrenArray.find(isSlottable);
|
|
1140
|
+
if (slottable) {
|
|
1141
|
+
const newElement = slottable.props.children;
|
|
1142
|
+
const newChildren = childrenArray.map((child) => {
|
|
1143
|
+
if (child === slottable) {
|
|
1144
|
+
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
1145
|
+
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
1146
|
+
} else {
|
|
1147
|
+
return child;
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
1151
|
+
}
|
|
1152
|
+
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
1153
|
+
});
|
|
1154
|
+
Slot.displayName = "Slot";
|
|
1155
|
+
var SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
1156
|
+
const { children, ...slotProps } = props;
|
|
1157
|
+
if (React.isValidElement(children)) {
|
|
1158
|
+
const childrenRef = getElementRef$1(children);
|
|
1159
|
+
return React.cloneElement(children, {
|
|
1160
|
+
...mergeProps(slotProps, children.props),
|
|
1161
|
+
// @ts-ignore
|
|
1162
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
1166
|
+
});
|
|
1167
|
+
SlotClone.displayName = "SlotClone";
|
|
1168
|
+
var Slottable = ({ children }) => {
|
|
1169
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1170
|
+
};
|
|
1171
|
+
function isSlottable(child) {
|
|
1172
|
+
return React.isValidElement(child) && child.type === Slottable;
|
|
1173
|
+
}
|
|
1174
|
+
function mergeProps(slotProps, childProps) {
|
|
1175
|
+
const overrideProps = { ...childProps };
|
|
1176
|
+
for (const propName in childProps) {
|
|
1177
|
+
const slotPropValue = slotProps[propName];
|
|
1178
|
+
const childPropValue = childProps[propName];
|
|
1179
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
1180
|
+
if (isHandler) {
|
|
1181
|
+
if (slotPropValue && childPropValue) {
|
|
1182
|
+
overrideProps[propName] = (...args) => {
|
|
1183
|
+
childPropValue(...args);
|
|
1184
|
+
slotPropValue(...args);
|
|
1185
|
+
};
|
|
1186
|
+
} else if (slotPropValue) {
|
|
1187
|
+
overrideProps[propName] = slotPropValue;
|
|
1188
|
+
}
|
|
1189
|
+
} else if (propName === "style") {
|
|
1190
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
1191
|
+
} else if (propName === "className") {
|
|
1192
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
return { ...slotProps, ...overrideProps };
|
|
1196
|
+
}
|
|
1197
|
+
function getElementRef$1(element) {
|
|
1198
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1199
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1200
|
+
if (mayWarn) {
|
|
1201
|
+
return element.ref;
|
|
1202
|
+
}
|
|
1203
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1204
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1205
|
+
if (mayWarn) {
|
|
1206
|
+
return element.props.ref;
|
|
1207
|
+
}
|
|
1208
|
+
return element.props.ref || element.ref;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
// packages/react/primitive/src/Primitive.tsx
|
|
1212
|
+
var NODES = [
|
|
1213
|
+
"a",
|
|
1214
|
+
"button",
|
|
1215
|
+
"div",
|
|
1216
|
+
"form",
|
|
1217
|
+
"h2",
|
|
1218
|
+
"h3",
|
|
1219
|
+
"img",
|
|
1220
|
+
"input",
|
|
1221
|
+
"label",
|
|
1222
|
+
"li",
|
|
1223
|
+
"nav",
|
|
1224
|
+
"ol",
|
|
1225
|
+
"p",
|
|
1226
|
+
"span",
|
|
1227
|
+
"svg",
|
|
1228
|
+
"ul"
|
|
1229
|
+
];
|
|
1230
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
1231
|
+
const Node = React.forwardRef((props, forwardedRef) => {
|
|
1232
|
+
const { asChild, ...primitiveProps } = props;
|
|
1233
|
+
const Comp = asChild ? Slot : node;
|
|
1234
|
+
if (typeof window !== "undefined") {
|
|
1235
|
+
window[Symbol.for("radix-ui")] = true;
|
|
1236
|
+
}
|
|
1237
|
+
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
1238
|
+
});
|
|
1239
|
+
Node.displayName = `Primitive.${node}`;
|
|
1240
|
+
return { ...primitive, [node]: Node };
|
|
1241
|
+
}, {});
|
|
1242
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
1243
|
+
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx
|
|
1247
|
+
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
1248
|
+
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
1249
|
+
React.useEffect(() => {
|
|
1250
|
+
const handleKeyDown = (event) => {
|
|
1251
|
+
if (event.key === "Escape") {
|
|
1252
|
+
onEscapeKeyDown(event);
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
1256
|
+
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
1257
|
+
}, [onEscapeKeyDown, ownerDocument]);
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
1261
|
+
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
1262
|
+
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
1263
|
+
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
1264
|
+
var originalBodyPointerEvents;
|
|
1265
|
+
var DismissableLayerContext = React.createContext({
|
|
1266
|
+
layers: /* @__PURE__ */ new Set(),
|
|
1267
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
1268
|
+
branches: /* @__PURE__ */ new Set()
|
|
1269
|
+
});
|
|
1270
|
+
var DismissableLayer = React.forwardRef(
|
|
1271
|
+
(props, forwardedRef) => {
|
|
1272
|
+
const {
|
|
1273
|
+
disableOutsidePointerEvents = false,
|
|
1274
|
+
onEscapeKeyDown,
|
|
1275
|
+
onPointerDownOutside,
|
|
1276
|
+
onFocusOutside,
|
|
1277
|
+
onInteractOutside,
|
|
1278
|
+
onDismiss,
|
|
1279
|
+
...layerProps
|
|
1280
|
+
} = props;
|
|
1281
|
+
const context = React.useContext(DismissableLayerContext);
|
|
1282
|
+
const [node, setNode] = React.useState(null);
|
|
1283
|
+
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
1284
|
+
const [, force] = React.useState({});
|
|
1285
|
+
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
1286
|
+
const layers = Array.from(context.layers);
|
|
1287
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
1288
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
1289
|
+
const index = node ? layers.indexOf(node) : -1;
|
|
1290
|
+
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
1291
|
+
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
1292
|
+
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
1293
|
+
const target = event.target;
|
|
1294
|
+
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
1295
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
1296
|
+
onPointerDownOutside?.(event);
|
|
1297
|
+
onInteractOutside?.(event);
|
|
1298
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
1299
|
+
}, ownerDocument);
|
|
1300
|
+
const focusOutside = useFocusOutside((event) => {
|
|
1301
|
+
const target = event.target;
|
|
1302
|
+
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
1303
|
+
if (isFocusInBranch) return;
|
|
1304
|
+
onFocusOutside?.(event);
|
|
1305
|
+
onInteractOutside?.(event);
|
|
1306
|
+
if (!event.defaultPrevented) onDismiss?.();
|
|
1307
|
+
}, ownerDocument);
|
|
1308
|
+
useEscapeKeydown((event) => {
|
|
1309
|
+
const isHighestLayer = index === context.layers.size - 1;
|
|
1310
|
+
if (!isHighestLayer) return;
|
|
1311
|
+
onEscapeKeyDown?.(event);
|
|
1312
|
+
if (!event.defaultPrevented && onDismiss) {
|
|
1313
|
+
event.preventDefault();
|
|
1314
|
+
onDismiss();
|
|
1315
|
+
}
|
|
1316
|
+
}, ownerDocument);
|
|
1317
|
+
React.useEffect(() => {
|
|
1318
|
+
if (!node) return;
|
|
1319
|
+
if (disableOutsidePointerEvents) {
|
|
1320
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
1321
|
+
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
1322
|
+
ownerDocument.body.style.pointerEvents = "none";
|
|
1323
|
+
}
|
|
1324
|
+
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
1325
|
+
}
|
|
1326
|
+
context.layers.add(node);
|
|
1327
|
+
dispatchUpdate();
|
|
1328
|
+
return () => {
|
|
1329
|
+
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
1330
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
1334
|
+
React.useEffect(() => {
|
|
1335
|
+
return () => {
|
|
1336
|
+
if (!node) return;
|
|
1337
|
+
context.layers.delete(node);
|
|
1338
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
1339
|
+
dispatchUpdate();
|
|
1340
|
+
};
|
|
1341
|
+
}, [node, context]);
|
|
1342
|
+
React.useEffect(() => {
|
|
1343
|
+
const handleUpdate = () => force({});
|
|
1344
|
+
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
1345
|
+
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
1346
|
+
}, []);
|
|
1347
|
+
return /* @__PURE__ */ jsx(
|
|
1348
|
+
Primitive.div,
|
|
1349
|
+
{
|
|
1350
|
+
...layerProps,
|
|
1351
|
+
ref: composedRefs,
|
|
1352
|
+
style: {
|
|
1353
|
+
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
1354
|
+
...props.style
|
|
1355
|
+
},
|
|
1356
|
+
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
1357
|
+
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
1358
|
+
onPointerDownCapture: composeEventHandlers(
|
|
1359
|
+
props.onPointerDownCapture,
|
|
1360
|
+
pointerDownOutside.onPointerDownCapture
|
|
1361
|
+
)
|
|
1362
|
+
}
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
);
|
|
1366
|
+
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
1367
|
+
var BRANCH_NAME = "DismissableLayerBranch";
|
|
1368
|
+
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
1369
|
+
const context = React.useContext(DismissableLayerContext);
|
|
1370
|
+
const ref = React.useRef(null);
|
|
1371
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
1372
|
+
React.useEffect(() => {
|
|
1373
|
+
const node = ref.current;
|
|
1374
|
+
if (node) {
|
|
1375
|
+
context.branches.add(node);
|
|
1376
|
+
return () => {
|
|
1377
|
+
context.branches.delete(node);
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
}, [context.branches]);
|
|
1381
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
1382
|
+
});
|
|
1383
|
+
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
1384
|
+
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
1385
|
+
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
1386
|
+
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
1387
|
+
const handleClickRef = React.useRef(() => {
|
|
1388
|
+
});
|
|
1389
|
+
React.useEffect(() => {
|
|
1390
|
+
const handlePointerDown = (event) => {
|
|
1391
|
+
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
1392
|
+
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
1393
|
+
handleAndDispatchCustomEvent(
|
|
1394
|
+
POINTER_DOWN_OUTSIDE,
|
|
1395
|
+
handlePointerDownOutside,
|
|
1396
|
+
eventDetail,
|
|
1397
|
+
{ discrete: true }
|
|
1398
|
+
);
|
|
1399
|
+
};
|
|
1400
|
+
const eventDetail = { originalEvent: event };
|
|
1401
|
+
if (event.pointerType === "touch") {
|
|
1402
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
1403
|
+
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
1404
|
+
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
1405
|
+
} else {
|
|
1406
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
1407
|
+
}
|
|
1408
|
+
} else {
|
|
1409
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
1410
|
+
}
|
|
1411
|
+
isPointerInsideReactTreeRef.current = false;
|
|
1412
|
+
};
|
|
1413
|
+
const timerId = window.setTimeout(() => {
|
|
1414
|
+
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
1415
|
+
}, 0);
|
|
1416
|
+
return () => {
|
|
1417
|
+
window.clearTimeout(timerId);
|
|
1418
|
+
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
1419
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
1420
|
+
};
|
|
1421
|
+
}, [ownerDocument, handlePointerDownOutside]);
|
|
1422
|
+
return {
|
|
1423
|
+
// ensures we check React component tree (not just DOM tree)
|
|
1424
|
+
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
1428
|
+
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
1429
|
+
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
1430
|
+
React.useEffect(() => {
|
|
1431
|
+
const handleFocus = (event) => {
|
|
1432
|
+
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
1433
|
+
const eventDetail = { originalEvent: event };
|
|
1434
|
+
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
1435
|
+
discrete: false
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
};
|
|
1439
|
+
ownerDocument.addEventListener("focusin", handleFocus);
|
|
1440
|
+
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
1441
|
+
}, [ownerDocument, handleFocusOutside]);
|
|
1442
|
+
return {
|
|
1443
|
+
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
1444
|
+
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
function dispatchUpdate() {
|
|
1448
|
+
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
1449
|
+
document.dispatchEvent(event);
|
|
1450
|
+
}
|
|
1451
|
+
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
1452
|
+
const target = detail.originalEvent.target;
|
|
1453
|
+
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
1454
|
+
if (handler) target.addEventListener(name, handler, { once: true });
|
|
1455
|
+
if (discrete) {
|
|
1456
|
+
dispatchDiscreteCustomEvent(target, event);
|
|
65
1457
|
} else {
|
|
66
|
-
|
|
1458
|
+
target.dispatchEvent(event);
|
|
67
1459
|
}
|
|
68
1460
|
}
|
|
69
1461
|
|
|
70
|
-
var
|
|
71
|
-
|
|
1462
|
+
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
1463
|
+
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
1464
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
1465
|
+
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
1466
|
+
var FocusScope = React.forwardRef((props, forwardedRef) => {
|
|
1467
|
+
const {
|
|
1468
|
+
loop = false,
|
|
1469
|
+
trapped = false,
|
|
1470
|
+
onMountAutoFocus: onMountAutoFocusProp,
|
|
1471
|
+
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
1472
|
+
...scopeProps
|
|
1473
|
+
} = props;
|
|
1474
|
+
const [container, setContainer] = React.useState(null);
|
|
1475
|
+
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
1476
|
+
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
1477
|
+
const lastFocusedElementRef = React.useRef(null);
|
|
1478
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
1479
|
+
const focusScope = React.useRef({
|
|
1480
|
+
paused: false,
|
|
1481
|
+
pause() {
|
|
1482
|
+
this.paused = true;
|
|
1483
|
+
},
|
|
1484
|
+
resume() {
|
|
1485
|
+
this.paused = false;
|
|
1486
|
+
}
|
|
1487
|
+
}).current;
|
|
1488
|
+
React.useEffect(() => {
|
|
1489
|
+
if (trapped) {
|
|
1490
|
+
let handleFocusIn2 = function(event) {
|
|
1491
|
+
if (focusScope.paused || !container) return;
|
|
1492
|
+
const target = event.target;
|
|
1493
|
+
if (container.contains(target)) {
|
|
1494
|
+
lastFocusedElementRef.current = target;
|
|
1495
|
+
} else {
|
|
1496
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
1497
|
+
}
|
|
1498
|
+
}, handleFocusOut2 = function(event) {
|
|
1499
|
+
if (focusScope.paused || !container) return;
|
|
1500
|
+
const relatedTarget = event.relatedTarget;
|
|
1501
|
+
if (relatedTarget === null) return;
|
|
1502
|
+
if (!container.contains(relatedTarget)) {
|
|
1503
|
+
focus(lastFocusedElementRef.current, { select: true });
|
|
1504
|
+
}
|
|
1505
|
+
}, handleMutations2 = function(mutations) {
|
|
1506
|
+
const focusedElement = document.activeElement;
|
|
1507
|
+
if (focusedElement !== document.body) return;
|
|
1508
|
+
for (const mutation of mutations) {
|
|
1509
|
+
if (mutation.removedNodes.length > 0) focus(container);
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
document.addEventListener("focusin", handleFocusIn2);
|
|
1513
|
+
document.addEventListener("focusout", handleFocusOut2);
|
|
1514
|
+
const mutationObserver = new MutationObserver(handleMutations2);
|
|
1515
|
+
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
1516
|
+
return () => {
|
|
1517
|
+
document.removeEventListener("focusin", handleFocusIn2);
|
|
1518
|
+
document.removeEventListener("focusout", handleFocusOut2);
|
|
1519
|
+
mutationObserver.disconnect();
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
}, [trapped, container, focusScope.paused]);
|
|
1523
|
+
React.useEffect(() => {
|
|
1524
|
+
if (container) {
|
|
1525
|
+
focusScopesStack.add(focusScope);
|
|
1526
|
+
const previouslyFocusedElement = document.activeElement;
|
|
1527
|
+
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
1528
|
+
if (!hasFocusedCandidate) {
|
|
1529
|
+
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
1530
|
+
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
1531
|
+
container.dispatchEvent(mountEvent);
|
|
1532
|
+
if (!mountEvent.defaultPrevented) {
|
|
1533
|
+
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
1534
|
+
if (document.activeElement === previouslyFocusedElement) {
|
|
1535
|
+
focus(container);
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return () => {
|
|
1540
|
+
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
1541
|
+
setTimeout(() => {
|
|
1542
|
+
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
1543
|
+
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
1544
|
+
container.dispatchEvent(unmountEvent);
|
|
1545
|
+
if (!unmountEvent.defaultPrevented) {
|
|
1546
|
+
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
1547
|
+
}
|
|
1548
|
+
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
1549
|
+
focusScopesStack.remove(focusScope);
|
|
1550
|
+
}, 0);
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
1554
|
+
const handleKeyDown = React.useCallback(
|
|
1555
|
+
(event) => {
|
|
1556
|
+
if (!loop && !trapped) return;
|
|
1557
|
+
if (focusScope.paused) return;
|
|
1558
|
+
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
1559
|
+
const focusedElement = document.activeElement;
|
|
1560
|
+
if (isTabKey && focusedElement) {
|
|
1561
|
+
const container2 = event.currentTarget;
|
|
1562
|
+
const [first, last] = getTabbableEdges(container2);
|
|
1563
|
+
const hasTabbableElementsInside = first && last;
|
|
1564
|
+
if (!hasTabbableElementsInside) {
|
|
1565
|
+
if (focusedElement === container2) event.preventDefault();
|
|
1566
|
+
} else {
|
|
1567
|
+
if (!event.shiftKey && focusedElement === last) {
|
|
1568
|
+
event.preventDefault();
|
|
1569
|
+
if (loop) focus(first, { select: true });
|
|
1570
|
+
} else if (event.shiftKey && focusedElement === first) {
|
|
1571
|
+
event.preventDefault();
|
|
1572
|
+
if (loop) focus(last, { select: true });
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
[loop, trapped, focusScope.paused]
|
|
1578
|
+
);
|
|
1579
|
+
return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
1580
|
+
});
|
|
1581
|
+
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
1582
|
+
function focusFirst(candidates, { select = false } = {}) {
|
|
1583
|
+
const previouslyFocusedElement = document.activeElement;
|
|
1584
|
+
for (const candidate of candidates) {
|
|
1585
|
+
focus(candidate, { select });
|
|
1586
|
+
if (document.activeElement !== previouslyFocusedElement) return;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
function getTabbableEdges(container) {
|
|
1590
|
+
const candidates = getTabbableCandidates(container);
|
|
1591
|
+
const first = findVisible(candidates, container);
|
|
1592
|
+
const last = findVisible(candidates.reverse(), container);
|
|
1593
|
+
return [first, last];
|
|
1594
|
+
}
|
|
1595
|
+
function getTabbableCandidates(container) {
|
|
1596
|
+
const nodes = [];
|
|
1597
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
1598
|
+
acceptNode: (node) => {
|
|
1599
|
+
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
1600
|
+
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
1601
|
+
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
1605
|
+
return nodes;
|
|
1606
|
+
}
|
|
1607
|
+
function findVisible(elements, container) {
|
|
1608
|
+
for (const element of elements) {
|
|
1609
|
+
if (!isHidden(element, { upTo: container })) return element;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
function isHidden(node, { upTo }) {
|
|
1613
|
+
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
1614
|
+
while (node) {
|
|
1615
|
+
if (upTo !== void 0 && node === upTo) return false;
|
|
1616
|
+
if (getComputedStyle(node).display === "none") return true;
|
|
1617
|
+
node = node.parentElement;
|
|
1618
|
+
}
|
|
1619
|
+
return false;
|
|
1620
|
+
}
|
|
1621
|
+
function isSelectableInput(element) {
|
|
1622
|
+
return element instanceof HTMLInputElement && "select" in element;
|
|
1623
|
+
}
|
|
1624
|
+
function focus(element, { select = false } = {}) {
|
|
1625
|
+
if (element && element.focus) {
|
|
1626
|
+
const previouslyFocusedElement = document.activeElement;
|
|
1627
|
+
element.focus({ preventScroll: true });
|
|
1628
|
+
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
1629
|
+
element.select();
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
var focusScopesStack = createFocusScopesStack();
|
|
1633
|
+
function createFocusScopesStack() {
|
|
1634
|
+
let stack = [];
|
|
1635
|
+
return {
|
|
1636
|
+
add(focusScope) {
|
|
1637
|
+
const activeFocusScope = stack[0];
|
|
1638
|
+
if (focusScope !== activeFocusScope) {
|
|
1639
|
+
activeFocusScope?.pause();
|
|
1640
|
+
}
|
|
1641
|
+
stack = arrayRemove(stack, focusScope);
|
|
1642
|
+
stack.unshift(focusScope);
|
|
1643
|
+
},
|
|
1644
|
+
remove(focusScope) {
|
|
1645
|
+
stack = arrayRemove(stack, focusScope);
|
|
1646
|
+
stack[0]?.resume();
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
function arrayRemove(array, item) {
|
|
1651
|
+
const updatedArray = [...array];
|
|
1652
|
+
const index = updatedArray.indexOf(item);
|
|
1653
|
+
if (index !== -1) {
|
|
1654
|
+
updatedArray.splice(index, 1);
|
|
1655
|
+
}
|
|
1656
|
+
return updatedArray;
|
|
1657
|
+
}
|
|
1658
|
+
function removeLinks(items) {
|
|
1659
|
+
return items.filter((item) => item.tagName !== "A");
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
var PORTAL_NAME$2 = "Portal";
|
|
1663
|
+
var Portal$1 = React.forwardRef((props, forwardedRef) => {
|
|
1664
|
+
const { container: containerProp, ...portalProps } = props;
|
|
1665
|
+
const [mounted, setMounted] = React.useState(false);
|
|
1666
|
+
useLayoutEffect2(() => setMounted(true), []);
|
|
1667
|
+
const container = containerProp || mounted && globalThis?.document?.body;
|
|
1668
|
+
return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
1669
|
+
});
|
|
1670
|
+
Portal$1.displayName = PORTAL_NAME$2;
|
|
1671
|
+
|
|
1672
|
+
function useStateMachine(initialState, machine) {
|
|
1673
|
+
return React.useReducer((state, event) => {
|
|
1674
|
+
const nextState = machine[state][event];
|
|
1675
|
+
return nextState ?? state;
|
|
1676
|
+
}, initialState);
|
|
1677
|
+
}
|
|
72
1678
|
|
|
1679
|
+
// packages/react/presence/src/Presence.tsx
|
|
1680
|
+
var Presence = (props) => {
|
|
1681
|
+
const { present, children } = props;
|
|
1682
|
+
const presence = usePresence(present);
|
|
1683
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
1684
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
1685
|
+
const forceMount = typeof children === "function";
|
|
1686
|
+
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
1687
|
+
};
|
|
1688
|
+
Presence.displayName = "Presence";
|
|
1689
|
+
function usePresence(present) {
|
|
1690
|
+
const [node, setNode] = React.useState();
|
|
1691
|
+
const stylesRef = React.useRef({});
|
|
1692
|
+
const prevPresentRef = React.useRef(present);
|
|
1693
|
+
const prevAnimationNameRef = React.useRef("none");
|
|
1694
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
1695
|
+
const [state, send] = useStateMachine(initialState, {
|
|
1696
|
+
mounted: {
|
|
1697
|
+
UNMOUNT: "unmounted",
|
|
1698
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
1699
|
+
},
|
|
1700
|
+
unmountSuspended: {
|
|
1701
|
+
MOUNT: "mounted",
|
|
1702
|
+
ANIMATION_END: "unmounted"
|
|
1703
|
+
},
|
|
1704
|
+
unmounted: {
|
|
1705
|
+
MOUNT: "mounted"
|
|
1706
|
+
}
|
|
1707
|
+
});
|
|
1708
|
+
React.useEffect(() => {
|
|
1709
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1710
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1711
|
+
}, [state]);
|
|
1712
|
+
useLayoutEffect2(() => {
|
|
1713
|
+
const styles = stylesRef.current;
|
|
1714
|
+
const wasPresent = prevPresentRef.current;
|
|
1715
|
+
const hasPresentChanged = wasPresent !== present;
|
|
1716
|
+
if (hasPresentChanged) {
|
|
1717
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
1718
|
+
const currentAnimationName = getAnimationName(styles);
|
|
1719
|
+
if (present) {
|
|
1720
|
+
send("MOUNT");
|
|
1721
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
1722
|
+
send("UNMOUNT");
|
|
1723
|
+
} else {
|
|
1724
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
1725
|
+
if (wasPresent && isAnimating) {
|
|
1726
|
+
send("ANIMATION_OUT");
|
|
1727
|
+
} else {
|
|
1728
|
+
send("UNMOUNT");
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
prevPresentRef.current = present;
|
|
1732
|
+
}
|
|
1733
|
+
}, [present, send]);
|
|
1734
|
+
useLayoutEffect2(() => {
|
|
1735
|
+
if (node) {
|
|
1736
|
+
const handleAnimationEnd = (event) => {
|
|
1737
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
1738
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
1739
|
+
if (event.target === node && isCurrentAnimation) {
|
|
1740
|
+
ReactDOM.flushSync(() => send("ANIMATION_END"));
|
|
1741
|
+
}
|
|
1742
|
+
};
|
|
1743
|
+
const handleAnimationStart = (event) => {
|
|
1744
|
+
if (event.target === node) {
|
|
1745
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
1749
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
1750
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
1751
|
+
return () => {
|
|
1752
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
1753
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1754
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
1755
|
+
};
|
|
1756
|
+
} else {
|
|
1757
|
+
send("ANIMATION_END");
|
|
1758
|
+
}
|
|
1759
|
+
}, [node, send]);
|
|
1760
|
+
return {
|
|
1761
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
1762
|
+
ref: React.useCallback((node2) => {
|
|
1763
|
+
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
1764
|
+
setNode(node2);
|
|
1765
|
+
}, [])
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
function getAnimationName(styles) {
|
|
1769
|
+
return styles?.animationName || "none";
|
|
1770
|
+
}
|
|
1771
|
+
function getElementRef(element) {
|
|
1772
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
1773
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1774
|
+
if (mayWarn) {
|
|
1775
|
+
return element.ref;
|
|
1776
|
+
}
|
|
1777
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
1778
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1779
|
+
if (mayWarn) {
|
|
1780
|
+
return element.props.ref;
|
|
1781
|
+
}
|
|
1782
|
+
return element.props.ref || element.ref;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
var count = 0;
|
|
1786
|
+
function useFocusGuards() {
|
|
1787
|
+
React.useEffect(() => {
|
|
1788
|
+
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
1789
|
+
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
1790
|
+
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
1791
|
+
count++;
|
|
1792
|
+
return () => {
|
|
1793
|
+
if (count === 1) {
|
|
1794
|
+
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
1795
|
+
}
|
|
1796
|
+
count--;
|
|
1797
|
+
};
|
|
1798
|
+
}, []);
|
|
1799
|
+
}
|
|
1800
|
+
function createFocusGuard() {
|
|
1801
|
+
const element = document.createElement("span");
|
|
1802
|
+
element.setAttribute("data-radix-focus-guard", "");
|
|
1803
|
+
element.tabIndex = 0;
|
|
1804
|
+
element.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none";
|
|
1805
|
+
return element;
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
var zeroRightClassName = 'right-scroll-bar-position';
|
|
1809
|
+
var fullWidthClassName = 'width-before-scroll-bar';
|
|
1810
|
+
var noScrollbarsClassName = 'with-scroll-bars-hidden';
|
|
73
1811
|
/**
|
|
74
|
-
*
|
|
1812
|
+
* Name of a CSS variable containing the amount of "hidden" scrollbar
|
|
1813
|
+
* ! might be undefined ! use will fallback!
|
|
75
1814
|
*/
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1815
|
+
var removedBarSizeVariable = '--removed-body-scroll-bar-size';
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Assigns a value for a given ref, no matter of the ref format
|
|
1819
|
+
* @param {RefObject} ref - a callback function or ref object
|
|
1820
|
+
* @param value - a new value
|
|
1821
|
+
*
|
|
1822
|
+
* @see https://github.com/theKashey/use-callback-ref#assignref
|
|
1823
|
+
* @example
|
|
1824
|
+
* const refObject = useRef();
|
|
1825
|
+
* const refFn = (ref) => {....}
|
|
1826
|
+
*
|
|
1827
|
+
* assignRef(refObject, "refValue");
|
|
1828
|
+
* assignRef(refFn, "refValue");
|
|
1829
|
+
*/
|
|
1830
|
+
function assignRef(ref, value) {
|
|
1831
|
+
if (typeof ref === 'function') {
|
|
1832
|
+
ref(value);
|
|
1833
|
+
}
|
|
1834
|
+
else if (ref) {
|
|
1835
|
+
ref.current = value;
|
|
1836
|
+
}
|
|
1837
|
+
return ref;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* creates a MutableRef with ref change callback
|
|
1842
|
+
* @param initialValue - initial ref value
|
|
1843
|
+
* @param {Function} callback - a callback to run when value changes
|
|
1844
|
+
*
|
|
1845
|
+
* @example
|
|
1846
|
+
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
|
|
1847
|
+
* ref.current = 1;
|
|
1848
|
+
* // prints 0 -> 1
|
|
1849
|
+
*
|
|
1850
|
+
* @see https://reactjs.org/docs/hooks-reference.html#useref
|
|
1851
|
+
* @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
|
|
1852
|
+
* @returns {MutableRefObject}
|
|
1853
|
+
*/
|
|
1854
|
+
function useCallbackRef(initialValue, callback) {
|
|
1855
|
+
var ref = useState(function () { return ({
|
|
1856
|
+
// value
|
|
1857
|
+
value: initialValue,
|
|
1858
|
+
// last callback
|
|
1859
|
+
callback: callback,
|
|
1860
|
+
// "memoized" public interface
|
|
1861
|
+
facade: {
|
|
1862
|
+
get current() {
|
|
1863
|
+
return ref.value;
|
|
1864
|
+
},
|
|
1865
|
+
set current(value) {
|
|
1866
|
+
var last = ref.value;
|
|
1867
|
+
if (last !== value) {
|
|
1868
|
+
ref.value = value;
|
|
1869
|
+
ref.callback(value, last);
|
|
1870
|
+
}
|
|
1871
|
+
},
|
|
1872
|
+
},
|
|
1873
|
+
}); })[0];
|
|
1874
|
+
// update callback
|
|
1875
|
+
ref.callback = callback;
|
|
1876
|
+
return ref.facade;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1880
|
+
var currentValues = new WeakMap();
|
|
1881
|
+
/**
|
|
1882
|
+
* Merges two or more refs together providing a single interface to set their value
|
|
1883
|
+
* @param {RefObject|Ref} refs
|
|
1884
|
+
* @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
|
|
1885
|
+
*
|
|
1886
|
+
* @see {@link mergeRefs} a version without buit-in memoization
|
|
1887
|
+
* @see https://github.com/theKashey/use-callback-ref#usemergerefs
|
|
1888
|
+
* @example
|
|
1889
|
+
* const Component = React.forwardRef((props, ref) => {
|
|
1890
|
+
* const ownRef = useRef();
|
|
1891
|
+
* const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
|
|
1892
|
+
* return <div ref={domRef}>...</div>
|
|
1893
|
+
* }
|
|
1894
|
+
*/
|
|
1895
|
+
function useMergeRefs(refs, defaultValue) {
|
|
1896
|
+
var callbackRef = useCallbackRef(null, function (newValue) {
|
|
1897
|
+
return refs.forEach(function (ref) { return assignRef(ref, newValue); });
|
|
1898
|
+
});
|
|
1899
|
+
// handle refs changes - added or removed
|
|
1900
|
+
useIsomorphicLayoutEffect(function () {
|
|
1901
|
+
var oldValue = currentValues.get(callbackRef);
|
|
1902
|
+
if (oldValue) {
|
|
1903
|
+
var prevRefs_1 = new Set(oldValue);
|
|
1904
|
+
var nextRefs_1 = new Set(refs);
|
|
1905
|
+
var current_1 = callbackRef.current;
|
|
1906
|
+
prevRefs_1.forEach(function (ref) {
|
|
1907
|
+
if (!nextRefs_1.has(ref)) {
|
|
1908
|
+
assignRef(ref, null);
|
|
1909
|
+
}
|
|
1910
|
+
});
|
|
1911
|
+
nextRefs_1.forEach(function (ref) {
|
|
1912
|
+
if (!prevRefs_1.has(ref)) {
|
|
1913
|
+
assignRef(ref, current_1);
|
|
1914
|
+
}
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
currentValues.set(callbackRef, refs);
|
|
1918
|
+
}, [refs]);
|
|
1919
|
+
return callbackRef;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
function ItoI(a) {
|
|
1923
|
+
return a;
|
|
1924
|
+
}
|
|
1925
|
+
function innerCreateMedium(defaults, middleware) {
|
|
1926
|
+
if (middleware === void 0) { middleware = ItoI; }
|
|
1927
|
+
var buffer = [];
|
|
1928
|
+
var assigned = false;
|
|
1929
|
+
var medium = {
|
|
1930
|
+
read: function () {
|
|
1931
|
+
if (assigned) {
|
|
1932
|
+
throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
|
|
1933
|
+
}
|
|
1934
|
+
if (buffer.length) {
|
|
1935
|
+
return buffer[buffer.length - 1];
|
|
1936
|
+
}
|
|
1937
|
+
return defaults;
|
|
1938
|
+
},
|
|
1939
|
+
useMedium: function (data) {
|
|
1940
|
+
var item = middleware(data, assigned);
|
|
1941
|
+
buffer.push(item);
|
|
1942
|
+
return function () {
|
|
1943
|
+
buffer = buffer.filter(function (x) { return x !== item; });
|
|
1944
|
+
};
|
|
1945
|
+
},
|
|
1946
|
+
assignSyncMedium: function (cb) {
|
|
1947
|
+
assigned = true;
|
|
1948
|
+
while (buffer.length) {
|
|
1949
|
+
var cbs = buffer;
|
|
1950
|
+
buffer = [];
|
|
1951
|
+
cbs.forEach(cb);
|
|
1952
|
+
}
|
|
1953
|
+
buffer = {
|
|
1954
|
+
push: function (x) { return cb(x); },
|
|
1955
|
+
filter: function () { return buffer; },
|
|
1956
|
+
};
|
|
1957
|
+
},
|
|
1958
|
+
assignMedium: function (cb) {
|
|
1959
|
+
assigned = true;
|
|
1960
|
+
var pendingQueue = [];
|
|
1961
|
+
if (buffer.length) {
|
|
1962
|
+
var cbs = buffer;
|
|
1963
|
+
buffer = [];
|
|
1964
|
+
cbs.forEach(cb);
|
|
1965
|
+
pendingQueue = buffer;
|
|
1966
|
+
}
|
|
1967
|
+
var executeQueue = function () {
|
|
1968
|
+
var cbs = pendingQueue;
|
|
1969
|
+
pendingQueue = [];
|
|
1970
|
+
cbs.forEach(cb);
|
|
1971
|
+
};
|
|
1972
|
+
var cycle = function () { return Promise.resolve().then(executeQueue); };
|
|
1973
|
+
cycle();
|
|
1974
|
+
buffer = {
|
|
1975
|
+
push: function (x) {
|
|
1976
|
+
pendingQueue.push(x);
|
|
1977
|
+
cycle();
|
|
1978
|
+
},
|
|
1979
|
+
filter: function (filter) {
|
|
1980
|
+
pendingQueue = pendingQueue.filter(filter);
|
|
1981
|
+
return buffer;
|
|
1982
|
+
},
|
|
1983
|
+
};
|
|
1984
|
+
},
|
|
1985
|
+
};
|
|
1986
|
+
return medium;
|
|
1987
|
+
}
|
|
1988
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1989
|
+
function createSidecarMedium(options) {
|
|
1990
|
+
if (options === void 0) { options = {}; }
|
|
1991
|
+
var medium = innerCreateMedium(null);
|
|
1992
|
+
medium.options = __assign({ async: true, ssr: false }, options);
|
|
1993
|
+
return medium;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
var SideCar$1 = function (_a) {
|
|
1997
|
+
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
1998
|
+
if (!sideCar) {
|
|
1999
|
+
throw new Error('Sidecar: please provide `sideCar` property to import the right car');
|
|
2000
|
+
}
|
|
2001
|
+
var Target = sideCar.read();
|
|
2002
|
+
if (!Target) {
|
|
2003
|
+
throw new Error('Sidecar medium not found');
|
|
2004
|
+
}
|
|
2005
|
+
return React.createElement(Target, __assign({}, rest));
|
|
2006
|
+
};
|
|
2007
|
+
SideCar$1.isSideCarExport = true;
|
|
2008
|
+
function exportSidecar(medium, exported) {
|
|
2009
|
+
medium.useMedium(exported);
|
|
2010
|
+
return SideCar$1;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
var effectCar = createSidecarMedium();
|
|
2014
|
+
|
|
2015
|
+
var nothing = function () {
|
|
2016
|
+
return;
|
|
2017
|
+
};
|
|
2018
|
+
/**
|
|
2019
|
+
* Removes scrollbar from the page and contain the scroll within the Lock
|
|
2020
|
+
*/
|
|
2021
|
+
var RemoveScroll = React.forwardRef(function (props, parentRef) {
|
|
2022
|
+
var ref = React.useRef(null);
|
|
2023
|
+
var _a = React.useState({
|
|
2024
|
+
onScrollCapture: nothing,
|
|
2025
|
+
onWheelCapture: nothing,
|
|
2026
|
+
onTouchMoveCapture: nothing,
|
|
2027
|
+
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
2028
|
+
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
2029
|
+
var SideCar = sideCar;
|
|
2030
|
+
var containerRef = useMergeRefs([ref, parentRef]);
|
|
2031
|
+
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
2032
|
+
return (React.createElement(React.Fragment, null,
|
|
2033
|
+
enabled && (React.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
|
|
2034
|
+
forwardProps ? (React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
|
|
2035
|
+
});
|
|
2036
|
+
RemoveScroll.defaultProps = {
|
|
2037
|
+
enabled: true,
|
|
2038
|
+
removeScrollBar: true,
|
|
2039
|
+
inert: false,
|
|
2040
|
+
};
|
|
2041
|
+
RemoveScroll.classNames = {
|
|
2042
|
+
fullWidth: fullWidthClassName,
|
|
2043
|
+
zeroRight: zeroRightClassName,
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
var getNonce = function () {
|
|
2047
|
+
if (typeof __webpack_nonce__ !== 'undefined') {
|
|
2048
|
+
return __webpack_nonce__;
|
|
2049
|
+
}
|
|
2050
|
+
return undefined;
|
|
82
2051
|
};
|
|
83
2052
|
|
|
84
|
-
|
|
2053
|
+
function makeStyleTag() {
|
|
2054
|
+
if (!document)
|
|
2055
|
+
return null;
|
|
2056
|
+
var tag = document.createElement('style');
|
|
2057
|
+
tag.type = 'text/css';
|
|
2058
|
+
var nonce = getNonce();
|
|
2059
|
+
if (nonce) {
|
|
2060
|
+
tag.setAttribute('nonce', nonce);
|
|
2061
|
+
}
|
|
2062
|
+
return tag;
|
|
2063
|
+
}
|
|
2064
|
+
function injectStyles(tag, css) {
|
|
2065
|
+
// @ts-ignore
|
|
2066
|
+
if (tag.styleSheet) {
|
|
2067
|
+
// @ts-ignore
|
|
2068
|
+
tag.styleSheet.cssText = css;
|
|
2069
|
+
}
|
|
2070
|
+
else {
|
|
2071
|
+
tag.appendChild(document.createTextNode(css));
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
function insertStyleTag(tag) {
|
|
2075
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
2076
|
+
head.appendChild(tag);
|
|
2077
|
+
}
|
|
2078
|
+
var stylesheetSingleton = function () {
|
|
2079
|
+
var counter = 0;
|
|
2080
|
+
var stylesheet = null;
|
|
2081
|
+
return {
|
|
2082
|
+
add: function (style) {
|
|
2083
|
+
if (counter == 0) {
|
|
2084
|
+
if ((stylesheet = makeStyleTag())) {
|
|
2085
|
+
injectStyles(stylesheet, style);
|
|
2086
|
+
insertStyleTag(stylesheet);
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
counter++;
|
|
2090
|
+
},
|
|
2091
|
+
remove: function () {
|
|
2092
|
+
counter--;
|
|
2093
|
+
if (!counter && stylesheet) {
|
|
2094
|
+
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
2095
|
+
stylesheet = null;
|
|
2096
|
+
}
|
|
2097
|
+
},
|
|
2098
|
+
};
|
|
2099
|
+
};
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* creates a hook to control style singleton
|
|
2103
|
+
* @see {@link styleSingleton} for a safer component version
|
|
2104
|
+
* @example
|
|
2105
|
+
* ```tsx
|
|
2106
|
+
* const useStyle = styleHookSingleton();
|
|
2107
|
+
* ///
|
|
2108
|
+
* useStyle('body { overflow: hidden}');
|
|
2109
|
+
*/
|
|
2110
|
+
var styleHookSingleton = function () {
|
|
2111
|
+
var sheet = stylesheetSingleton();
|
|
2112
|
+
return function (styles, isDynamic) {
|
|
2113
|
+
React.useEffect(function () {
|
|
2114
|
+
sheet.add(styles);
|
|
2115
|
+
return function () {
|
|
2116
|
+
sheet.remove();
|
|
2117
|
+
};
|
|
2118
|
+
}, [styles && isDynamic]);
|
|
2119
|
+
};
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* create a Component to add styles on demand
|
|
2124
|
+
* - styles are added when first instance is mounted
|
|
2125
|
+
* - styles are removed when the last instance is unmounted
|
|
2126
|
+
* - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
|
|
2127
|
+
*/
|
|
2128
|
+
var styleSingleton = function () {
|
|
2129
|
+
var useStyle = styleHookSingleton();
|
|
2130
|
+
var Sheet = function (_a) {
|
|
2131
|
+
var styles = _a.styles, dynamic = _a.dynamic;
|
|
2132
|
+
useStyle(styles, dynamic);
|
|
2133
|
+
return null;
|
|
2134
|
+
};
|
|
2135
|
+
return Sheet;
|
|
2136
|
+
};
|
|
2137
|
+
|
|
2138
|
+
var zeroGap = {
|
|
2139
|
+
left: 0,
|
|
2140
|
+
top: 0,
|
|
2141
|
+
right: 0,
|
|
2142
|
+
gap: 0,
|
|
2143
|
+
};
|
|
2144
|
+
var parse = function (x) { return parseInt(x || '', 10) || 0; };
|
|
2145
|
+
var getOffset = function (gapMode) {
|
|
2146
|
+
var cs = window.getComputedStyle(document.body);
|
|
2147
|
+
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
|
|
2148
|
+
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
|
|
2149
|
+
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
|
|
2150
|
+
return [parse(left), parse(top), parse(right)];
|
|
2151
|
+
};
|
|
2152
|
+
var getGapWidth = function (gapMode) {
|
|
2153
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
2154
|
+
if (typeof window === 'undefined') {
|
|
2155
|
+
return zeroGap;
|
|
2156
|
+
}
|
|
2157
|
+
var offsets = getOffset(gapMode);
|
|
2158
|
+
var documentWidth = document.documentElement.clientWidth;
|
|
2159
|
+
var windowWidth = window.innerWidth;
|
|
2160
|
+
return {
|
|
2161
|
+
left: offsets[0],
|
|
2162
|
+
top: offsets[1],
|
|
2163
|
+
right: offsets[2],
|
|
2164
|
+
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
|
|
2165
|
+
};
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
var Style = styleSingleton();
|
|
2169
|
+
var lockAttribute = 'data-scroll-locked';
|
|
2170
|
+
// important tip - once we measure scrollBar width and remove them
|
|
2171
|
+
// we could not repeat this operation
|
|
2172
|
+
// thus we are using style-singleton - only the first "yet correct" style will be applied.
|
|
2173
|
+
var getStyles = function (_a, allowRelative, gapMode, important) {
|
|
2174
|
+
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
2175
|
+
if (gapMode === void 0) { gapMode = 'margin'; }
|
|
2176
|
+
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
2177
|
+
allowRelative && "position: relative ".concat(important, ";"),
|
|
2178
|
+
gapMode === 'margin' &&
|
|
2179
|
+
"\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
2180
|
+
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
|
|
2181
|
+
]
|
|
2182
|
+
.filter(Boolean)
|
|
2183
|
+
.join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
2184
|
+
};
|
|
2185
|
+
var getCurrentUseCounter = function () {
|
|
2186
|
+
var counter = parseInt(document.body.getAttribute(lockAttribute) || '0', 10);
|
|
2187
|
+
return isFinite(counter) ? counter : 0;
|
|
2188
|
+
};
|
|
2189
|
+
var useLockAttribute = function () {
|
|
2190
|
+
React.useEffect(function () {
|
|
2191
|
+
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
2192
|
+
return function () {
|
|
2193
|
+
var newCounter = getCurrentUseCounter() - 1;
|
|
2194
|
+
if (newCounter <= 0) {
|
|
2195
|
+
document.body.removeAttribute(lockAttribute);
|
|
2196
|
+
}
|
|
2197
|
+
else {
|
|
2198
|
+
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
}, []);
|
|
2202
|
+
};
|
|
2203
|
+
/**
|
|
2204
|
+
* Removes page scrollbar and blocks page scroll when mounted
|
|
2205
|
+
*/
|
|
2206
|
+
var RemoveScrollBar = function (_a) {
|
|
2207
|
+
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? 'margin' : _b;
|
|
2208
|
+
useLockAttribute();
|
|
2209
|
+
/*
|
|
2210
|
+
gap will be measured on every component mount
|
|
2211
|
+
however it will be used only by the "first" invocation
|
|
2212
|
+
due to singleton nature of <Style
|
|
2213
|
+
*/
|
|
2214
|
+
var gap = React.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
|
|
2215
|
+
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
|
|
2216
|
+
};
|
|
2217
|
+
|
|
2218
|
+
var passiveSupported = false;
|
|
2219
|
+
if (typeof window !== 'undefined') {
|
|
2220
|
+
try {
|
|
2221
|
+
var options = Object.defineProperty({}, 'passive', {
|
|
2222
|
+
get: function () {
|
|
2223
|
+
passiveSupported = true;
|
|
2224
|
+
return true;
|
|
2225
|
+
},
|
|
2226
|
+
});
|
|
2227
|
+
// @ts-ignore
|
|
2228
|
+
window.addEventListener('test', options, options);
|
|
2229
|
+
// @ts-ignore
|
|
2230
|
+
window.removeEventListener('test', options, options);
|
|
2231
|
+
}
|
|
2232
|
+
catch (err) {
|
|
2233
|
+
passiveSupported = false;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
2237
|
+
|
|
2238
|
+
var alwaysContainsScroll = function (node) {
|
|
2239
|
+
// textarea will always _contain_ scroll inside self. It only can be hidden
|
|
2240
|
+
return node.tagName === 'TEXTAREA';
|
|
2241
|
+
};
|
|
2242
|
+
var elementCanBeScrolled = function (node, overflow) {
|
|
2243
|
+
var styles = window.getComputedStyle(node);
|
|
2244
|
+
return (
|
|
2245
|
+
// not-not-scrollable
|
|
2246
|
+
styles[overflow] !== 'hidden' &&
|
|
2247
|
+
// contains scroll inside self
|
|
2248
|
+
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === 'visible'));
|
|
2249
|
+
};
|
|
2250
|
+
var elementCouldBeVScrolled = function (node) { return elementCanBeScrolled(node, 'overflowY'); };
|
|
2251
|
+
var elementCouldBeHScrolled = function (node) { return elementCanBeScrolled(node, 'overflowX'); };
|
|
2252
|
+
var locationCouldBeScrolled = function (axis, node) {
|
|
2253
|
+
var ownerDocument = node.ownerDocument;
|
|
2254
|
+
var current = node;
|
|
2255
|
+
do {
|
|
2256
|
+
// Skip over shadow root
|
|
2257
|
+
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
|
|
2258
|
+
current = current.host;
|
|
2259
|
+
}
|
|
2260
|
+
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
2261
|
+
if (isScrollable) {
|
|
2262
|
+
var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
|
|
2263
|
+
if (s > d) {
|
|
2264
|
+
return true;
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
current = current.parentNode;
|
|
2268
|
+
} while (current && current !== ownerDocument.body);
|
|
2269
|
+
return false;
|
|
2270
|
+
};
|
|
2271
|
+
var getVScrollVariables = function (_a) {
|
|
2272
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
2273
|
+
return [
|
|
2274
|
+
scrollTop,
|
|
2275
|
+
scrollHeight,
|
|
2276
|
+
clientHeight,
|
|
2277
|
+
];
|
|
2278
|
+
};
|
|
2279
|
+
var getHScrollVariables = function (_a) {
|
|
2280
|
+
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
2281
|
+
return [
|
|
2282
|
+
scrollLeft,
|
|
2283
|
+
scrollWidth,
|
|
2284
|
+
clientWidth,
|
|
2285
|
+
];
|
|
2286
|
+
};
|
|
2287
|
+
var elementCouldBeScrolled = function (axis, node) {
|
|
2288
|
+
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
2289
|
+
};
|
|
2290
|
+
var getScrollVariables = function (axis, node) {
|
|
2291
|
+
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
2292
|
+
};
|
|
2293
|
+
var getDirectionFactor = function (axis, direction) {
|
|
2294
|
+
/**
|
|
2295
|
+
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
|
|
2296
|
+
* and then increasingly negative as you scroll towards the end of the content.
|
|
2297
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
|
|
2298
|
+
*/
|
|
2299
|
+
return axis === 'h' && direction === 'rtl' ? -1 : 1;
|
|
2300
|
+
};
|
|
2301
|
+
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
2302
|
+
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
2303
|
+
var delta = directionFactor * sourceDelta;
|
|
2304
|
+
// find scrollable target
|
|
2305
|
+
var target = event.target;
|
|
2306
|
+
var targetInLock = endTarget.contains(target);
|
|
2307
|
+
var shouldCancelScroll = false;
|
|
2308
|
+
var isDeltaPositive = delta > 0;
|
|
2309
|
+
var availableScroll = 0;
|
|
2310
|
+
var availableScrollTop = 0;
|
|
2311
|
+
do {
|
|
2312
|
+
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
2313
|
+
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
2314
|
+
if (position || elementScroll) {
|
|
2315
|
+
if (elementCouldBeScrolled(axis, target)) {
|
|
2316
|
+
availableScroll += elementScroll;
|
|
2317
|
+
availableScrollTop += position;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
if (target instanceof ShadowRoot) {
|
|
2321
|
+
target = target.host;
|
|
2322
|
+
}
|
|
2323
|
+
else {
|
|
2324
|
+
target = target.parentNode;
|
|
2325
|
+
}
|
|
2326
|
+
} while (
|
|
2327
|
+
// portaled content
|
|
2328
|
+
(!targetInLock && target !== document.body) ||
|
|
2329
|
+
// self content
|
|
2330
|
+
(targetInLock && (endTarget.contains(target) || endTarget === target)));
|
|
2331
|
+
// handle epsilon around 0 (non standard zoom levels)
|
|
2332
|
+
if (isDeltaPositive &&
|
|
2333
|
+
((Math.abs(availableScroll) < 1) || (!noOverscroll ))) {
|
|
2334
|
+
shouldCancelScroll = true;
|
|
2335
|
+
}
|
|
2336
|
+
else if (!isDeltaPositive &&
|
|
2337
|
+
((Math.abs(availableScrollTop) < 1) || (!noOverscroll ))) {
|
|
2338
|
+
shouldCancelScroll = true;
|
|
2339
|
+
}
|
|
2340
|
+
return shouldCancelScroll;
|
|
2341
|
+
};
|
|
2342
|
+
|
|
2343
|
+
var getTouchXY = function (event) {
|
|
2344
|
+
return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
2345
|
+
};
|
|
2346
|
+
var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
|
|
2347
|
+
var extractRef = function (ref) {
|
|
2348
|
+
return ref && 'current' in ref ? ref.current : ref;
|
|
2349
|
+
};
|
|
2350
|
+
var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
|
|
2351
|
+
var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
|
|
2352
|
+
var idCounter = 0;
|
|
2353
|
+
var lockStack = [];
|
|
2354
|
+
function RemoveScrollSideCar(props) {
|
|
2355
|
+
var shouldPreventQueue = React.useRef([]);
|
|
2356
|
+
var touchStartRef = React.useRef([0, 0]);
|
|
2357
|
+
var activeAxis = React.useRef();
|
|
2358
|
+
var id = React.useState(idCounter++)[0];
|
|
2359
|
+
var Style = React.useState(styleSingleton)[0];
|
|
2360
|
+
var lastProps = React.useRef(props);
|
|
2361
|
+
React.useEffect(function () {
|
|
2362
|
+
lastProps.current = props;
|
|
2363
|
+
}, [props]);
|
|
2364
|
+
React.useEffect(function () {
|
|
2365
|
+
if (props.inert) {
|
|
2366
|
+
document.body.classList.add("block-interactivity-".concat(id));
|
|
2367
|
+
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
2368
|
+
allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
|
|
2369
|
+
return function () {
|
|
2370
|
+
document.body.classList.remove("block-interactivity-".concat(id));
|
|
2371
|
+
allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
return;
|
|
2375
|
+
}, [props.inert, props.lockRef.current, props.shards]);
|
|
2376
|
+
var shouldCancelEvent = React.useCallback(function (event, parent) {
|
|
2377
|
+
if ('touches' in event && event.touches.length === 2) {
|
|
2378
|
+
return !lastProps.current.allowPinchZoom;
|
|
2379
|
+
}
|
|
2380
|
+
var touch = getTouchXY(event);
|
|
2381
|
+
var touchStart = touchStartRef.current;
|
|
2382
|
+
var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
|
|
2383
|
+
var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
|
|
2384
|
+
var currentAxis;
|
|
2385
|
+
var target = event.target;
|
|
2386
|
+
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
|
|
2387
|
+
// allow horizontal touch move on Range inputs. They will not cause any scroll
|
|
2388
|
+
if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
|
|
2389
|
+
return false;
|
|
2390
|
+
}
|
|
2391
|
+
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
2392
|
+
if (!canBeScrolledInMainDirection) {
|
|
2393
|
+
return true;
|
|
2394
|
+
}
|
|
2395
|
+
if (canBeScrolledInMainDirection) {
|
|
2396
|
+
currentAxis = moveDirection;
|
|
2397
|
+
}
|
|
2398
|
+
else {
|
|
2399
|
+
currentAxis = moveDirection === 'v' ? 'h' : 'v';
|
|
2400
|
+
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
2401
|
+
// other axis might be not scrollable
|
|
2402
|
+
}
|
|
2403
|
+
if (!canBeScrolledInMainDirection) {
|
|
2404
|
+
return false;
|
|
2405
|
+
}
|
|
2406
|
+
if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
|
|
2407
|
+
activeAxis.current = currentAxis;
|
|
2408
|
+
}
|
|
2409
|
+
if (!currentAxis) {
|
|
2410
|
+
return true;
|
|
2411
|
+
}
|
|
2412
|
+
var cancelingAxis = activeAxis.current || currentAxis;
|
|
2413
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
|
|
2414
|
+
}, []);
|
|
2415
|
+
var shouldPrevent = React.useCallback(function (_event) {
|
|
2416
|
+
var event = _event;
|
|
2417
|
+
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
|
|
2418
|
+
// not the last active
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2421
|
+
var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
|
|
2422
|
+
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];
|
|
2423
|
+
// self event, and should be canceled
|
|
2424
|
+
if (sourceEvent && sourceEvent.should) {
|
|
2425
|
+
if (event.cancelable) {
|
|
2426
|
+
event.preventDefault();
|
|
2427
|
+
}
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
// outside or shard event
|
|
2431
|
+
if (!sourceEvent) {
|
|
2432
|
+
var shardNodes = (lastProps.current.shards || [])
|
|
2433
|
+
.map(extractRef)
|
|
2434
|
+
.filter(Boolean)
|
|
2435
|
+
.filter(function (node) { return node.contains(event.target); });
|
|
2436
|
+
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
2437
|
+
if (shouldStop) {
|
|
2438
|
+
if (event.cancelable) {
|
|
2439
|
+
event.preventDefault();
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}, []);
|
|
2444
|
+
var shouldCancel = React.useCallback(function (name, delta, target, should) {
|
|
2445
|
+
var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };
|
|
2446
|
+
shouldPreventQueue.current.push(event);
|
|
2447
|
+
setTimeout(function () {
|
|
2448
|
+
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
|
|
2449
|
+
}, 1);
|
|
2450
|
+
}, []);
|
|
2451
|
+
var scrollTouchStart = React.useCallback(function (event) {
|
|
2452
|
+
touchStartRef.current = getTouchXY(event);
|
|
2453
|
+
activeAxis.current = undefined;
|
|
2454
|
+
}, []);
|
|
2455
|
+
var scrollWheel = React.useCallback(function (event) {
|
|
2456
|
+
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
2457
|
+
}, []);
|
|
2458
|
+
var scrollTouchMove = React.useCallback(function (event) {
|
|
2459
|
+
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
2460
|
+
}, []);
|
|
2461
|
+
React.useEffect(function () {
|
|
2462
|
+
lockStack.push(Style);
|
|
2463
|
+
props.setCallbacks({
|
|
2464
|
+
onScrollCapture: scrollWheel,
|
|
2465
|
+
onWheelCapture: scrollWheel,
|
|
2466
|
+
onTouchMoveCapture: scrollTouchMove,
|
|
2467
|
+
});
|
|
2468
|
+
document.addEventListener('wheel', shouldPrevent, nonPassive);
|
|
2469
|
+
document.addEventListener('touchmove', shouldPrevent, nonPassive);
|
|
2470
|
+
document.addEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
2471
|
+
return function () {
|
|
2472
|
+
lockStack = lockStack.filter(function (inst) { return inst !== Style; });
|
|
2473
|
+
document.removeEventListener('wheel', shouldPrevent, nonPassive);
|
|
2474
|
+
document.removeEventListener('touchmove', shouldPrevent, nonPassive);
|
|
2475
|
+
document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
|
|
2476
|
+
};
|
|
2477
|
+
}, []);
|
|
2478
|
+
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
2479
|
+
return (React.createElement(React.Fragment, null,
|
|
2480
|
+
inert ? React.createElement(Style, { styles: generateStyle(id) }) : null,
|
|
2481
|
+
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null));
|
|
2482
|
+
}
|
|
2483
|
+
function getOutermostShadowParent(node) {
|
|
2484
|
+
var shadowParent = null;
|
|
2485
|
+
while (node !== null) {
|
|
2486
|
+
if (node instanceof ShadowRoot) {
|
|
2487
|
+
shadowParent = node.host;
|
|
2488
|
+
node = node.host;
|
|
2489
|
+
}
|
|
2490
|
+
node = node.parentNode;
|
|
2491
|
+
}
|
|
2492
|
+
return shadowParent;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
2496
|
+
|
|
2497
|
+
var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
2498
|
+
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
2499
|
+
|
|
2500
|
+
var getDefaultParent = function (originalTarget) {
|
|
2501
|
+
if (typeof document === 'undefined') {
|
|
2502
|
+
return null;
|
|
2503
|
+
}
|
|
2504
|
+
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
2505
|
+
return sampleTarget.ownerDocument.body;
|
|
2506
|
+
};
|
|
2507
|
+
var counterMap = new WeakMap();
|
|
2508
|
+
var uncontrolledNodes = new WeakMap();
|
|
2509
|
+
var markerMap = {};
|
|
2510
|
+
var lockCount = 0;
|
|
2511
|
+
var unwrapHost = function (node) {
|
|
2512
|
+
return node && (node.host || unwrapHost(node.parentNode));
|
|
2513
|
+
};
|
|
2514
|
+
var correctTargets = function (parent, targets) {
|
|
2515
|
+
return targets
|
|
2516
|
+
.map(function (target) {
|
|
2517
|
+
if (parent.contains(target)) {
|
|
2518
|
+
return target;
|
|
2519
|
+
}
|
|
2520
|
+
var correctedTarget = unwrapHost(target);
|
|
2521
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
2522
|
+
return correctedTarget;
|
|
2523
|
+
}
|
|
2524
|
+
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
|
|
2525
|
+
return null;
|
|
2526
|
+
})
|
|
2527
|
+
.filter(function (x) { return Boolean(x); });
|
|
2528
|
+
};
|
|
2529
|
+
/**
|
|
2530
|
+
* Marks everything except given node(or nodes) as aria-hidden
|
|
2531
|
+
* @param {Element | Element[]} originalTarget - elements to keep on the page
|
|
2532
|
+
* @param [parentNode] - top element, defaults to document.body
|
|
2533
|
+
* @param {String} [markerName] - a special attribute to mark every node
|
|
2534
|
+
* @param {String} [controlAttribute] - html Attribute to control
|
|
2535
|
+
* @return {Undo} undo command
|
|
2536
|
+
*/
|
|
2537
|
+
var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
|
|
2538
|
+
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
2539
|
+
if (!markerMap[markerName]) {
|
|
2540
|
+
markerMap[markerName] = new WeakMap();
|
|
2541
|
+
}
|
|
2542
|
+
var markerCounter = markerMap[markerName];
|
|
2543
|
+
var hiddenNodes = [];
|
|
2544
|
+
var elementsToKeep = new Set();
|
|
2545
|
+
var elementsToStop = new Set(targets);
|
|
2546
|
+
var keep = function (el) {
|
|
2547
|
+
if (!el || elementsToKeep.has(el)) {
|
|
2548
|
+
return;
|
|
2549
|
+
}
|
|
2550
|
+
elementsToKeep.add(el);
|
|
2551
|
+
keep(el.parentNode);
|
|
2552
|
+
};
|
|
2553
|
+
targets.forEach(keep);
|
|
2554
|
+
var deep = function (parent) {
|
|
2555
|
+
if (!parent || elementsToStop.has(parent)) {
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
Array.prototype.forEach.call(parent.children, function (node) {
|
|
2559
|
+
if (elementsToKeep.has(node)) {
|
|
2560
|
+
deep(node);
|
|
2561
|
+
}
|
|
2562
|
+
else {
|
|
2563
|
+
try {
|
|
2564
|
+
var attr = node.getAttribute(controlAttribute);
|
|
2565
|
+
var alreadyHidden = attr !== null && attr !== 'false';
|
|
2566
|
+
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
2567
|
+
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
2568
|
+
counterMap.set(node, counterValue);
|
|
2569
|
+
markerCounter.set(node, markerValue);
|
|
2570
|
+
hiddenNodes.push(node);
|
|
2571
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
2572
|
+
uncontrolledNodes.set(node, true);
|
|
2573
|
+
}
|
|
2574
|
+
if (markerValue === 1) {
|
|
2575
|
+
node.setAttribute(markerName, 'true');
|
|
2576
|
+
}
|
|
2577
|
+
if (!alreadyHidden) {
|
|
2578
|
+
node.setAttribute(controlAttribute, 'true');
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
catch (e) {
|
|
2582
|
+
console.error('aria-hidden: cannot operate on ', node, e);
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
});
|
|
2586
|
+
};
|
|
2587
|
+
deep(parentNode);
|
|
2588
|
+
elementsToKeep.clear();
|
|
2589
|
+
lockCount++;
|
|
2590
|
+
return function () {
|
|
2591
|
+
hiddenNodes.forEach(function (node) {
|
|
2592
|
+
var counterValue = counterMap.get(node) - 1;
|
|
2593
|
+
var markerValue = markerCounter.get(node) - 1;
|
|
2594
|
+
counterMap.set(node, counterValue);
|
|
2595
|
+
markerCounter.set(node, markerValue);
|
|
2596
|
+
if (!counterValue) {
|
|
2597
|
+
if (!uncontrolledNodes.has(node)) {
|
|
2598
|
+
node.removeAttribute(controlAttribute);
|
|
2599
|
+
}
|
|
2600
|
+
uncontrolledNodes.delete(node);
|
|
2601
|
+
}
|
|
2602
|
+
if (!markerValue) {
|
|
2603
|
+
node.removeAttribute(markerName);
|
|
2604
|
+
}
|
|
2605
|
+
});
|
|
2606
|
+
lockCount--;
|
|
2607
|
+
if (!lockCount) {
|
|
2608
|
+
// clear
|
|
2609
|
+
counterMap = new WeakMap();
|
|
2610
|
+
counterMap = new WeakMap();
|
|
2611
|
+
uncontrolledNodes = new WeakMap();
|
|
2612
|
+
markerMap = {};
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
};
|
|
2616
|
+
/**
|
|
2617
|
+
* Marks everything except given node(or nodes) as aria-hidden
|
|
2618
|
+
* @param {Element | Element[]} originalTarget - elements to keep on the page
|
|
2619
|
+
* @param [parentNode] - top element, defaults to document.body
|
|
2620
|
+
* @param {String} [markerName] - a special attribute to mark every node
|
|
2621
|
+
* @return {Undo} undo command
|
|
2622
|
+
*/
|
|
2623
|
+
var hideOthers = function (originalTarget, parentNode, markerName) {
|
|
2624
|
+
if (markerName === void 0) { markerName = 'data-aria-hidden'; }
|
|
2625
|
+
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
2626
|
+
var activeParentNode = getDefaultParent(originalTarget);
|
|
2627
|
+
if (!activeParentNode) {
|
|
2628
|
+
return function () { return null; };
|
|
2629
|
+
}
|
|
2630
|
+
// we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
|
|
2631
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
|
|
2632
|
+
return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2635
|
+
var DIALOG_NAME = "Dialog";
|
|
2636
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
2637
|
+
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
2638
|
+
var Dialog = (props) => {
|
|
2639
|
+
const {
|
|
2640
|
+
__scopeDialog,
|
|
2641
|
+
children,
|
|
2642
|
+
open: openProp,
|
|
2643
|
+
defaultOpen,
|
|
2644
|
+
onOpenChange,
|
|
2645
|
+
modal = true
|
|
2646
|
+
} = props;
|
|
2647
|
+
const triggerRef = React.useRef(null);
|
|
2648
|
+
const contentRef = React.useRef(null);
|
|
2649
|
+
const [open = false, setOpen] = useControllableState({
|
|
2650
|
+
prop: openProp,
|
|
2651
|
+
defaultProp: defaultOpen,
|
|
2652
|
+
onChange: onOpenChange
|
|
2653
|
+
});
|
|
2654
|
+
return /* @__PURE__ */ jsx(
|
|
2655
|
+
DialogProvider,
|
|
2656
|
+
{
|
|
2657
|
+
scope: __scopeDialog,
|
|
2658
|
+
triggerRef,
|
|
2659
|
+
contentRef,
|
|
2660
|
+
contentId: useId(),
|
|
2661
|
+
titleId: useId(),
|
|
2662
|
+
descriptionId: useId(),
|
|
2663
|
+
open,
|
|
2664
|
+
onOpenChange: setOpen,
|
|
2665
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
2666
|
+
modal,
|
|
2667
|
+
children
|
|
2668
|
+
}
|
|
2669
|
+
);
|
|
2670
|
+
};
|
|
2671
|
+
Dialog.displayName = DIALOG_NAME;
|
|
2672
|
+
var TRIGGER_NAME$1 = "DialogTrigger";
|
|
2673
|
+
var DialogTrigger = React.forwardRef(
|
|
2674
|
+
(props, forwardedRef) => {
|
|
2675
|
+
const { __scopeDialog, ...triggerProps } = props;
|
|
2676
|
+
const context = useDialogContext(TRIGGER_NAME$1, __scopeDialog);
|
|
2677
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
2678
|
+
return /* @__PURE__ */ jsx(
|
|
2679
|
+
Primitive.button,
|
|
2680
|
+
{
|
|
2681
|
+
type: "button",
|
|
2682
|
+
"aria-haspopup": "dialog",
|
|
2683
|
+
"aria-expanded": context.open,
|
|
2684
|
+
"aria-controls": context.contentId,
|
|
2685
|
+
"data-state": getState(context.open),
|
|
2686
|
+
...triggerProps,
|
|
2687
|
+
ref: composedTriggerRef,
|
|
2688
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
2689
|
+
}
|
|
2690
|
+
);
|
|
2691
|
+
}
|
|
2692
|
+
);
|
|
2693
|
+
DialogTrigger.displayName = TRIGGER_NAME$1;
|
|
2694
|
+
var PORTAL_NAME$1 = "DialogPortal";
|
|
2695
|
+
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME$1, {
|
|
2696
|
+
forceMount: void 0
|
|
2697
|
+
});
|
|
2698
|
+
var DialogPortal = (props) => {
|
|
2699
|
+
const { __scopeDialog, forceMount, children, container } = props;
|
|
2700
|
+
const context = useDialogContext(PORTAL_NAME$1, __scopeDialog);
|
|
2701
|
+
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: React.Children.map(children, (child) => /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children: child }) })) });
|
|
2702
|
+
};
|
|
2703
|
+
DialogPortal.displayName = PORTAL_NAME$1;
|
|
2704
|
+
var OVERLAY_NAME$1 = "DialogOverlay";
|
|
2705
|
+
var DialogOverlay = React.forwardRef(
|
|
2706
|
+
(props, forwardedRef) => {
|
|
2707
|
+
const portalContext = usePortalContext(OVERLAY_NAME$1, props.__scopeDialog);
|
|
2708
|
+
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
2709
|
+
const context = useDialogContext(OVERLAY_NAME$1, props.__scopeDialog);
|
|
2710
|
+
return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
2711
|
+
}
|
|
2712
|
+
);
|
|
2713
|
+
DialogOverlay.displayName = OVERLAY_NAME$1;
|
|
2714
|
+
var DialogOverlayImpl = React.forwardRef(
|
|
2715
|
+
(props, forwardedRef) => {
|
|
2716
|
+
const { __scopeDialog, ...overlayProps } = props;
|
|
2717
|
+
const context = useDialogContext(OVERLAY_NAME$1, __scopeDialog);
|
|
2718
|
+
return (
|
|
2719
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
2720
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
2721
|
+
/* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
|
|
2722
|
+
Primitive.div,
|
|
2723
|
+
{
|
|
2724
|
+
"data-state": getState(context.open),
|
|
2725
|
+
...overlayProps,
|
|
2726
|
+
ref: forwardedRef,
|
|
2727
|
+
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
2728
|
+
}
|
|
2729
|
+
) })
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2732
|
+
);
|
|
2733
|
+
var CONTENT_NAME$1 = "DialogContent";
|
|
2734
|
+
var DialogContent = React.forwardRef(
|
|
2735
|
+
(props, forwardedRef) => {
|
|
2736
|
+
const portalContext = usePortalContext(CONTENT_NAME$1, props.__scopeDialog);
|
|
2737
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
2738
|
+
const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
|
|
2739
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
2740
|
+
}
|
|
2741
|
+
);
|
|
2742
|
+
DialogContent.displayName = CONTENT_NAME$1;
|
|
2743
|
+
var DialogContentModal = React.forwardRef(
|
|
2744
|
+
(props, forwardedRef) => {
|
|
2745
|
+
const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
|
|
2746
|
+
const contentRef = React.useRef(null);
|
|
2747
|
+
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
2748
|
+
React.useEffect(() => {
|
|
2749
|
+
const content = contentRef.current;
|
|
2750
|
+
if (content) return hideOthers(content);
|
|
2751
|
+
}, []);
|
|
2752
|
+
return /* @__PURE__ */ jsx(
|
|
2753
|
+
DialogContentImpl,
|
|
2754
|
+
{
|
|
2755
|
+
...props,
|
|
2756
|
+
ref: composedRefs,
|
|
2757
|
+
trapFocus: context.open,
|
|
2758
|
+
disableOutsidePointerEvents: true,
|
|
2759
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
2760
|
+
event.preventDefault();
|
|
2761
|
+
context.triggerRef.current?.focus();
|
|
2762
|
+
}),
|
|
2763
|
+
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
2764
|
+
const originalEvent = event.detail.originalEvent;
|
|
2765
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
2766
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
2767
|
+
if (isRightClick) event.preventDefault();
|
|
2768
|
+
}),
|
|
2769
|
+
onFocusOutside: composeEventHandlers(
|
|
2770
|
+
props.onFocusOutside,
|
|
2771
|
+
(event) => event.preventDefault()
|
|
2772
|
+
)
|
|
2773
|
+
}
|
|
2774
|
+
);
|
|
2775
|
+
}
|
|
2776
|
+
);
|
|
2777
|
+
var DialogContentNonModal = React.forwardRef(
|
|
2778
|
+
(props, forwardedRef) => {
|
|
2779
|
+
const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
|
|
2780
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
2781
|
+
const hasPointerDownOutsideRef = React.useRef(false);
|
|
2782
|
+
return /* @__PURE__ */ jsx(
|
|
2783
|
+
DialogContentImpl,
|
|
2784
|
+
{
|
|
2785
|
+
...props,
|
|
2786
|
+
ref: forwardedRef,
|
|
2787
|
+
trapFocus: false,
|
|
2788
|
+
disableOutsidePointerEvents: false,
|
|
2789
|
+
onCloseAutoFocus: (event) => {
|
|
2790
|
+
props.onCloseAutoFocus?.(event);
|
|
2791
|
+
if (!event.defaultPrevented) {
|
|
2792
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
2793
|
+
event.preventDefault();
|
|
2794
|
+
}
|
|
2795
|
+
hasInteractedOutsideRef.current = false;
|
|
2796
|
+
hasPointerDownOutsideRef.current = false;
|
|
2797
|
+
},
|
|
2798
|
+
onInteractOutside: (event) => {
|
|
2799
|
+
props.onInteractOutside?.(event);
|
|
2800
|
+
if (!event.defaultPrevented) {
|
|
2801
|
+
hasInteractedOutsideRef.current = true;
|
|
2802
|
+
if (event.detail.originalEvent.type === "pointerdown") {
|
|
2803
|
+
hasPointerDownOutsideRef.current = true;
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
const target = event.target;
|
|
2807
|
+
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
2808
|
+
if (targetIsTrigger) event.preventDefault();
|
|
2809
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
2810
|
+
event.preventDefault();
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2815
|
+
}
|
|
2816
|
+
);
|
|
2817
|
+
var DialogContentImpl = React.forwardRef(
|
|
2818
|
+
(props, forwardedRef) => {
|
|
2819
|
+
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
2820
|
+
const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
|
|
2821
|
+
const contentRef = React.useRef(null);
|
|
2822
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2823
|
+
useFocusGuards();
|
|
2824
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2825
|
+
/* @__PURE__ */ jsx(
|
|
2826
|
+
FocusScope,
|
|
2827
|
+
{
|
|
2828
|
+
asChild: true,
|
|
2829
|
+
loop: true,
|
|
2830
|
+
trapped: trapFocus,
|
|
2831
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
2832
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
2833
|
+
children: /* @__PURE__ */ jsx(
|
|
2834
|
+
DismissableLayer,
|
|
2835
|
+
{
|
|
2836
|
+
role: "dialog",
|
|
2837
|
+
id: context.contentId,
|
|
2838
|
+
"aria-describedby": context.descriptionId,
|
|
2839
|
+
"aria-labelledby": context.titleId,
|
|
2840
|
+
"data-state": getState(context.open),
|
|
2841
|
+
...contentProps,
|
|
2842
|
+
ref: composedRefs,
|
|
2843
|
+
onDismiss: () => context.onOpenChange(false)
|
|
2844
|
+
}
|
|
2845
|
+
)
|
|
2846
|
+
}
|
|
2847
|
+
),
|
|
2848
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2849
|
+
/* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
|
|
2850
|
+
/* @__PURE__ */ jsx(DescriptionWarning$1, { contentRef, descriptionId: context.descriptionId })
|
|
2851
|
+
] })
|
|
2852
|
+
] });
|
|
2853
|
+
}
|
|
2854
|
+
);
|
|
2855
|
+
var TITLE_NAME$1 = "DialogTitle";
|
|
2856
|
+
var DialogTitle = React.forwardRef(
|
|
2857
|
+
(props, forwardedRef) => {
|
|
2858
|
+
const { __scopeDialog, ...titleProps } = props;
|
|
2859
|
+
const context = useDialogContext(TITLE_NAME$1, __scopeDialog);
|
|
2860
|
+
return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
2861
|
+
}
|
|
2862
|
+
);
|
|
2863
|
+
DialogTitle.displayName = TITLE_NAME$1;
|
|
2864
|
+
var DESCRIPTION_NAME$1 = "DialogDescription";
|
|
2865
|
+
var DialogDescription = React.forwardRef(
|
|
2866
|
+
(props, forwardedRef) => {
|
|
2867
|
+
const { __scopeDialog, ...descriptionProps } = props;
|
|
2868
|
+
const context = useDialogContext(DESCRIPTION_NAME$1, __scopeDialog);
|
|
2869
|
+
return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
2870
|
+
}
|
|
2871
|
+
);
|
|
2872
|
+
DialogDescription.displayName = DESCRIPTION_NAME$1;
|
|
2873
|
+
var CLOSE_NAME = "DialogClose";
|
|
2874
|
+
var DialogClose = React.forwardRef(
|
|
2875
|
+
(props, forwardedRef) => {
|
|
2876
|
+
const { __scopeDialog, ...closeProps } = props;
|
|
2877
|
+
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
2878
|
+
return /* @__PURE__ */ jsx(
|
|
2879
|
+
Primitive.button,
|
|
2880
|
+
{
|
|
2881
|
+
type: "button",
|
|
2882
|
+
...closeProps,
|
|
2883
|
+
ref: forwardedRef,
|
|
2884
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
2885
|
+
}
|
|
2886
|
+
);
|
|
2887
|
+
}
|
|
2888
|
+
);
|
|
2889
|
+
DialogClose.displayName = CLOSE_NAME;
|
|
2890
|
+
function getState(open) {
|
|
2891
|
+
return open ? "open" : "closed";
|
|
2892
|
+
}
|
|
2893
|
+
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
2894
|
+
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
2895
|
+
contentName: CONTENT_NAME$1,
|
|
2896
|
+
titleName: TITLE_NAME$1,
|
|
2897
|
+
docsSlug: "dialog"
|
|
2898
|
+
});
|
|
2899
|
+
var TitleWarning = ({ titleId }) => {
|
|
2900
|
+
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
2901
|
+
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
2902
|
+
|
|
2903
|
+
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
2904
|
+
|
|
2905
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
2906
|
+
React.useEffect(() => {
|
|
2907
|
+
if (titleId) {
|
|
2908
|
+
const hasTitle = document.getElementById(titleId);
|
|
2909
|
+
if (!hasTitle) console.error(MESSAGE);
|
|
2910
|
+
}
|
|
2911
|
+
}, [MESSAGE, titleId]);
|
|
2912
|
+
return null;
|
|
2913
|
+
};
|
|
2914
|
+
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
2915
|
+
var DescriptionWarning$1 = ({ contentRef, descriptionId }) => {
|
|
2916
|
+
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
2917
|
+
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
2918
|
+
React.useEffect(() => {
|
|
2919
|
+
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
2920
|
+
if (descriptionId && describedById) {
|
|
2921
|
+
const hasDescription = document.getElementById(descriptionId);
|
|
2922
|
+
if (!hasDescription) console.warn(MESSAGE);
|
|
2923
|
+
}
|
|
2924
|
+
}, [MESSAGE, contentRef, descriptionId]);
|
|
2925
|
+
return null;
|
|
2926
|
+
};
|
|
2927
|
+
var Root = Dialog;
|
|
2928
|
+
var Trigger = DialogTrigger;
|
|
2929
|
+
var Portal = DialogPortal;
|
|
2930
|
+
var Overlay = DialogOverlay;
|
|
2931
|
+
var Content = DialogContent;
|
|
2932
|
+
var Title = DialogTitle;
|
|
2933
|
+
var Description = DialogDescription;
|
|
2934
|
+
var Close = DialogClose;
|
|
2935
|
+
|
|
2936
|
+
var ROOT_NAME = "AlertDialog";
|
|
2937
|
+
var [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
|
|
2938
|
+
createDialogScope
|
|
2939
|
+
]);
|
|
2940
|
+
var useDialogScope = createDialogScope();
|
|
2941
|
+
var AlertDialog = (props) => {
|
|
2942
|
+
const { __scopeAlertDialog, ...alertDialogProps } = props;
|
|
2943
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2944
|
+
return /* @__PURE__ */ jsx(Root, { ...dialogScope, ...alertDialogProps, modal: true });
|
|
2945
|
+
};
|
|
2946
|
+
AlertDialog.displayName = ROOT_NAME;
|
|
2947
|
+
var TRIGGER_NAME = "AlertDialogTrigger";
|
|
2948
|
+
var AlertDialogTrigger = React.forwardRef(
|
|
2949
|
+
(props, forwardedRef) => {
|
|
2950
|
+
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
2951
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2952
|
+
return /* @__PURE__ */ jsx(Trigger, { ...dialogScope, ...triggerProps, ref: forwardedRef });
|
|
2953
|
+
}
|
|
2954
|
+
);
|
|
2955
|
+
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
2956
|
+
var PORTAL_NAME = "AlertDialogPortal";
|
|
2957
|
+
var AlertDialogPortal = (props) => {
|
|
2958
|
+
const { __scopeAlertDialog, ...portalProps } = props;
|
|
2959
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2960
|
+
return /* @__PURE__ */ jsx(Portal, { ...dialogScope, ...portalProps });
|
|
2961
|
+
};
|
|
2962
|
+
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
2963
|
+
var OVERLAY_NAME = "AlertDialogOverlay";
|
|
2964
|
+
var AlertDialogOverlay = React.forwardRef(
|
|
2965
|
+
(props, forwardedRef) => {
|
|
2966
|
+
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
2967
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2968
|
+
return /* @__PURE__ */ jsx(Overlay, { ...dialogScope, ...overlayProps, ref: forwardedRef });
|
|
2969
|
+
}
|
|
2970
|
+
);
|
|
2971
|
+
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
2972
|
+
var CONTENT_NAME = "AlertDialogContent";
|
|
2973
|
+
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
2974
|
+
var AlertDialogContent = React.forwardRef(
|
|
2975
|
+
(props, forwardedRef) => {
|
|
2976
|
+
const { __scopeAlertDialog, children, ...contentProps } = props;
|
|
2977
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
2978
|
+
const contentRef = React.useRef(null);
|
|
2979
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
2980
|
+
const cancelRef = React.useRef(null);
|
|
2981
|
+
return /* @__PURE__ */ jsx(
|
|
2982
|
+
WarningProvider,
|
|
2983
|
+
{
|
|
2984
|
+
contentName: CONTENT_NAME,
|
|
2985
|
+
titleName: TITLE_NAME,
|
|
2986
|
+
docsSlug: "alert-dialog",
|
|
2987
|
+
children: /* @__PURE__ */ jsx(AlertDialogContentProvider, { scope: __scopeAlertDialog, cancelRef, children: /* @__PURE__ */ jsxs(
|
|
2988
|
+
Content,
|
|
2989
|
+
{
|
|
2990
|
+
role: "alertdialog",
|
|
2991
|
+
...dialogScope,
|
|
2992
|
+
...contentProps,
|
|
2993
|
+
ref: composedRefs,
|
|
2994
|
+
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
2995
|
+
event.preventDefault();
|
|
2996
|
+
cancelRef.current?.focus({ preventScroll: true });
|
|
2997
|
+
}),
|
|
2998
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
2999
|
+
onInteractOutside: (event) => event.preventDefault(),
|
|
3000
|
+
children: [
|
|
3001
|
+
/* @__PURE__ */ jsx(Slottable, { children }),
|
|
3002
|
+
/* @__PURE__ */ jsx(DescriptionWarning, { contentRef })
|
|
3003
|
+
]
|
|
3004
|
+
}
|
|
3005
|
+
) })
|
|
3006
|
+
}
|
|
3007
|
+
);
|
|
3008
|
+
}
|
|
3009
|
+
);
|
|
3010
|
+
AlertDialogContent.displayName = CONTENT_NAME;
|
|
3011
|
+
var TITLE_NAME = "AlertDialogTitle";
|
|
3012
|
+
var AlertDialogTitle = React.forwardRef(
|
|
3013
|
+
(props, forwardedRef) => {
|
|
3014
|
+
const { __scopeAlertDialog, ...titleProps } = props;
|
|
3015
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
3016
|
+
return /* @__PURE__ */ jsx(Title, { ...dialogScope, ...titleProps, ref: forwardedRef });
|
|
3017
|
+
}
|
|
3018
|
+
);
|
|
3019
|
+
AlertDialogTitle.displayName = TITLE_NAME;
|
|
3020
|
+
var DESCRIPTION_NAME = "AlertDialogDescription";
|
|
3021
|
+
var AlertDialogDescription = React.forwardRef((props, forwardedRef) => {
|
|
3022
|
+
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
3023
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
3024
|
+
return /* @__PURE__ */ jsx(Description, { ...dialogScope, ...descriptionProps, ref: forwardedRef });
|
|
3025
|
+
});
|
|
3026
|
+
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
3027
|
+
var ACTION_NAME = "AlertDialogAction";
|
|
3028
|
+
var AlertDialogAction = React.forwardRef(
|
|
3029
|
+
(props, forwardedRef) => {
|
|
3030
|
+
const { __scopeAlertDialog, ...actionProps } = props;
|
|
3031
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
3032
|
+
return /* @__PURE__ */ jsx(Close, { ...dialogScope, ...actionProps, ref: forwardedRef });
|
|
3033
|
+
}
|
|
3034
|
+
);
|
|
3035
|
+
AlertDialogAction.displayName = ACTION_NAME;
|
|
3036
|
+
var CANCEL_NAME = "AlertDialogCancel";
|
|
3037
|
+
var AlertDialogCancel = React.forwardRef(
|
|
3038
|
+
(props, forwardedRef) => {
|
|
3039
|
+
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
3040
|
+
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
3041
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
3042
|
+
const ref = useComposedRefs(forwardedRef, cancelRef);
|
|
3043
|
+
return /* @__PURE__ */ jsx(Close, { ...dialogScope, ...cancelProps, ref });
|
|
3044
|
+
}
|
|
3045
|
+
);
|
|
3046
|
+
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
3047
|
+
var DescriptionWarning = ({ contentRef }) => {
|
|
3048
|
+
const MESSAGE = `\`${CONTENT_NAME}\` requires a description for the component to be accessible for screen reader users.
|
|
3049
|
+
|
|
3050
|
+
You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTION_NAME}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
3051
|
+
|
|
3052
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
3053
|
+
|
|
3054
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;
|
|
3055
|
+
React.useEffect(() => {
|
|
3056
|
+
const hasDescription = document.getElementById(
|
|
3057
|
+
contentRef.current?.getAttribute("aria-describedby")
|
|
3058
|
+
);
|
|
3059
|
+
if (!hasDescription) console.warn(MESSAGE);
|
|
3060
|
+
}, [MESSAGE, contentRef]);
|
|
3061
|
+
return null;
|
|
3062
|
+
};
|
|
3063
|
+
var Root2 = AlertDialog;
|
|
3064
|
+
var Portal2 = AlertDialogPortal;
|
|
3065
|
+
|
|
3066
|
+
var overlayShow = ft(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"], ["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"])));
|
|
3067
|
+
var AlertOverlay = pt.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: rgb(61 62 63 / 0.5);\n position: fixed;\n inset: 0;\n animation: ", " 300ms cubic-bezier(0.16, 1, 0.3, 1);\n"], ["\n background: rgb(61 62 63 / 0.5);\n position: fixed;\n inset: 0;\n animation: ", " 300ms cubic-bezier(0.16, 1, 0.3, 1);\n"])), overlayShow);
|
|
3068
|
+
var ModalHeaderContainer = pt.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 410px;\n height: 56px;\n border-radius: 6px 6px 0 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: ", ";\n padding-left: 24px;\n padding-right: 24px;\n"], ["\n width: 410px;\n height: 56px;\n border-radius: 6px 6px 0 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n background: ", ";\n padding-left: 24px;\n padding-right: 24px;\n"])), function (_a) {
|
|
3069
|
+
var theme = _a.theme;
|
|
3070
|
+
return theme.colors.primary;
|
|
3071
|
+
});
|
|
3072
|
+
var ModalHeaderText = pt.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 20px;\n font-weight: 700;\n line-height: 24px;\n text-align: left;\n color: ", ";\n"], ["\n font-size: 20px;\n font-weight: 700;\n line-height: 24px;\n text-align: left;\n color: ", ";\n"])), function (_a) {
|
|
3073
|
+
var theme = _a.theme;
|
|
3074
|
+
return theme.colors.base.white;
|
|
3075
|
+
});
|
|
3076
|
+
var CloseBtn = pt.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n all: unset;\n cursor: pointer;\n"], ["\n all: unset;\n cursor: pointer;\n"])));
|
|
3077
|
+
pt.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) {
|
|
3078
|
+
var theme = _a.theme;
|
|
3079
|
+
return theme.colors.base.white;
|
|
3080
|
+
});
|
|
3081
|
+
var ContentContainer = pt.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n border-radius: 6px;\n box-shadow:\n hsl(206 22% 7% / 35%) 0px 10px 38px -10px,\n hsl(206 22% 7% / 20%) 0px 10px 20px -15px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n max-width: 500px;\n height: auto;\n background: ", ";\n"], ["\n border-radius: 6px;\n box-shadow:\n hsl(206 22% 7% / 35%) 0px 10px 38px -10px,\n hsl(206 22% 7% / 20%) 0px 10px 20px -15px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n max-width: 500px;\n height: auto;\n background: ", ";\n"])), function (_a) {
|
|
3082
|
+
var theme = _a.theme;
|
|
3083
|
+
return theme.colors.base.white;
|
|
3084
|
+
});
|
|
3085
|
+
var ContentChildren = pt.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding: 20px;\n"], ["\n padding: 20px;\n"])));
|
|
3086
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
3087
|
+
|
|
3088
|
+
var IconCLose = function (props) {
|
|
3089
|
+
var _a;
|
|
3090
|
+
return (React__default.createElement("svg", __assign({ width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3091
|
+
React__default.createElement("path", { d: "M2.0665 14.5L0.666504 13.1L6.2665 7.5L0.666504 1.9L2.0665 0.5L7.6665 6.1L13.2665 0.5L14.6665 1.9L9.0665 7.5L14.6665 13.1L13.2665 14.5L7.6665 8.9L2.0665 14.5Z", fill: (_a = props === null || props === void 0 ? void 0 : props.fill) !== null && _a !== void 0 ? _a : "black" })));
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
var theme = {
|
|
3095
|
+
colors: {
|
|
3096
|
+
primary: "#005a92",
|
|
3097
|
+
secondary: "",
|
|
3098
|
+
hover: "#005A92",
|
|
3099
|
+
textSecondary: "",
|
|
3100
|
+
iconColor: "#4A4A4B",
|
|
3101
|
+
success: "#198754",
|
|
3102
|
+
warning: "#CB8700",
|
|
3103
|
+
alert: "#CB0A0A",
|
|
3104
|
+
information: "#1A95B0",
|
|
3105
|
+
border: "#D9D9D9",
|
|
3106
|
+
lightGrey: "#C3C3C3",
|
|
3107
|
+
grey: "#A0A0A0",
|
|
3108
|
+
base: {
|
|
3109
|
+
white: "#FFFFFF",
|
|
3110
|
+
black: "#303030",
|
|
3111
|
+
},
|
|
3112
|
+
},
|
|
3113
|
+
};
|
|
3114
|
+
|
|
3115
|
+
var Modal = function (_a) {
|
|
3116
|
+
var isModalOpen = _a.isModalOpen, onOpenChange = _a.onOpenChange, children = _a.children, title = _a.title;
|
|
3117
|
+
return (React__default.createElement(Root2, { open: isModalOpen, onOpenChange: onOpenChange },
|
|
3118
|
+
React__default.createElement(Portal2, null,
|
|
3119
|
+
React__default.createElement(AlertOverlay, null),
|
|
3120
|
+
React__default.createElement(ContentContainer, null,
|
|
3121
|
+
React__default.createElement(ModalHeaderContainer, null,
|
|
3122
|
+
React__default.createElement(ModalHeaderText, null, title),
|
|
3123
|
+
React__default.createElement(CloseBtn, { onClick: function () { return onOpenChange(!isModalOpen); } },
|
|
3124
|
+
React__default.createElement(IconCLose, { fill: theme.colors.base.white }))),
|
|
3125
|
+
React__default.createElement(ContentChildren, null, children)))));
|
|
3126
|
+
};
|
|
3127
|
+
|
|
3128
|
+
var IconDownload = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "17", viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3129
|
+
React__default.createElement("path", { d: "M8.6665 12.5L3.6665 7.5L5.0665 6.05L7.6665 8.65V0.5H9.6665V8.65L12.2665 6.05L13.6665 7.5L8.6665 12.5ZM2.6665 16.5C2.1165 16.5 1.64567 16.3042 1.254 15.9125C0.862337 15.5208 0.666504 15.05 0.666504 14.5V11.5H2.6665V14.5H14.6665V11.5H16.6665V14.5C16.6665 15.05 16.4707 15.5208 16.079 15.9125C15.6873 16.3042 15.2165 16.5 14.6665 16.5H2.6665Z", fill: "#4A4A4B" }))); };
|
|
3130
|
+
|
|
3131
|
+
var IconVisibillity = function (props) { return (React__default.createElement("svg", __assign({ width: "23", height: "15", viewBox: "0 0 23 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3132
|
+
React__default.createElement("path", { d: "M11.6665 12C12.9165 12 13.979 11.5625 14.854 10.6875C15.729 9.8125 16.1665 8.75 16.1665 7.5C16.1665 6.25 15.729 5.1875 14.854 4.3125C13.979 3.4375 12.9165 3 11.6665 3C10.4165 3 9.354 3.4375 8.479 4.3125C7.604 5.1875 7.1665 6.25 7.1665 7.5C7.1665 8.75 7.604 9.8125 8.479 10.6875C9.354 11.5625 10.4165 12 11.6665 12ZM11.6665 10.2C10.9165 10.2 10.279 9.9375 9.754 9.4125C9.229 8.8875 8.9665 8.25 8.9665 7.5C8.9665 6.75 9.229 6.1125 9.754 5.5875C10.279 5.0625 10.9165 4.8 11.6665 4.8C12.4165 4.8 13.054 5.0625 13.579 5.5875C14.104 6.1125 14.3665 6.75 14.3665 7.5C14.3665 8.25 14.104 8.8875 13.579 9.4125C13.054 9.9375 12.4165 10.2 11.6665 10.2ZM11.6665 15C9.23317 15 7.0165 14.3208 5.0165 12.9625C3.0165 11.6042 1.5665 9.78333 0.666504 7.5C1.5665 5.21667 3.0165 3.39583 5.0165 2.0375C7.0165 0.679167 9.23317 0 11.6665 0C14.0998 0 16.3165 0.679167 18.3165 2.0375C20.3165 3.39583 21.7665 5.21667 22.6665 7.5C21.7665 9.78333 20.3165 11.6042 18.3165 12.9625C16.3165 14.3208 14.0998 15 11.6665 15ZM11.6665 13C13.5498 13 15.279 12.5042 16.854 11.5125C18.429 10.5208 19.6332 9.18333 20.4665 7.5C19.6332 5.81667 18.429 4.47917 16.854 3.4875C15.279 2.49583 13.5498 2 11.6665 2C9.78317 2 8.054 2.49583 6.479 3.4875C4.904 4.47917 3.69984 5.81667 2.8665 7.5C3.69984 9.18333 4.904 10.5208 6.479 11.5125C8.054 12.5042 9.78317 13 11.6665 13Z", fill: "#4A4A4B" }))); };
|
|
3133
|
+
|
|
3134
|
+
var IconEdit = function (props) { return (React__default.createElement("svg", __assign({ width: "19", height: "19", viewBox: "0 0 19 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3135
|
+
React__default.createElement("path", { d: "M2.6665 16.5H4.0915L13.8665 6.725L12.4415 5.3L2.6665 15.075V16.5ZM0.666504 18.5V14.25L13.8665 1.075C14.0665 0.891667 14.2873 0.75 14.529 0.65C14.7707 0.55 15.0248 0.5 15.2915 0.5C15.5582 0.5 15.8165 0.55 16.0665 0.65C16.3165 0.75 16.5332 0.9 16.7165 1.1L18.0915 2.5C18.2915 2.68333 18.4373 2.9 18.529 3.15C18.6207 3.4 18.6665 3.65 18.6665 3.9C18.6665 4.16667 18.6207 4.42083 18.529 4.6625C18.4373 4.90417 18.2915 5.125 18.0915 5.325L4.9165 18.5H0.666504ZM13.1415 6.025L12.4415 5.3L13.8665 6.725L13.1415 6.025Z", fill: "#4A4A4B" }))); };
|
|
3136
|
+
|
|
3137
|
+
var IconDelete = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "19", viewBox: "0 0 17 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3138
|
+
React__default.createElement("path", { d: "M3.6665 18.5C3.1165 18.5 2.64567 18.3042 2.254 17.9125C1.86234 17.5208 1.6665 17.05 1.6665 16.5V3.5H0.666504V1.5H5.6665V0.5H11.6665V1.5H16.6665V3.5H15.6665V16.5C15.6665 17.05 15.4707 17.5208 15.079 17.9125C14.6873 18.3042 14.2165 18.5 13.6665 18.5H3.6665ZM13.6665 3.5H3.6665V16.5H13.6665V3.5ZM5.6665 14.5H7.6665V5.5H5.6665V14.5ZM9.6665 14.5H11.6665V5.5H9.6665V14.5Z", fill: "#4A4A4B" }))); };
|
|
3139
|
+
|
|
3140
|
+
var IconCalendar = function (props) { return (React__default.createElement("svg", __assign({ width: "19", height: "21", viewBox: "0 0 19 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3141
|
+
React__default.createElement("path", { d: "M2.6665 20.5C2.1165 20.5 1.64567 20.3042 1.254 19.9125C0.862337 19.5208 0.666504 19.05 0.666504 18.5V4.5C0.666504 3.95 0.862337 3.47917 1.254 3.0875C1.64567 2.69583 2.1165 2.5 2.6665 2.5H3.6665V0.5H5.6665V2.5H13.6665V0.5H15.6665V2.5H16.6665C17.2165 2.5 17.6873 2.69583 18.079 3.0875C18.4707 3.47917 18.6665 3.95 18.6665 4.5V18.5C18.6665 19.05 18.4707 19.5208 18.079 19.9125C17.6873 20.3042 17.2165 20.5 16.6665 20.5H2.6665ZM2.6665 18.5H16.6665V8.5H2.6665V18.5ZM2.6665 6.5H16.6665V4.5H2.6665V6.5ZM9.6665 12.5C9.38317 12.5 9.14567 12.4042 8.954 12.2125C8.76234 12.0208 8.6665 11.7833 8.6665 11.5C8.6665 11.2167 8.76234 10.9792 8.954 10.7875C9.14567 10.5958 9.38317 10.5 9.6665 10.5C9.94984 10.5 10.1873 10.5958 10.379 10.7875C10.5707 10.9792 10.6665 11.2167 10.6665 11.5C10.6665 11.7833 10.5707 12.0208 10.379 12.2125C10.1873 12.4042 9.94984 12.5 9.6665 12.5ZM5.6665 12.5C5.38317 12.5 5.14567 12.4042 4.954 12.2125C4.76234 12.0208 4.6665 11.7833 4.6665 11.5C4.6665 11.2167 4.76234 10.9792 4.954 10.7875C5.14567 10.5958 5.38317 10.5 5.6665 10.5C5.94984 10.5 6.18734 10.5958 6.379 10.7875C6.57067 10.9792 6.6665 11.2167 6.6665 11.5C6.6665 11.7833 6.57067 12.0208 6.379 12.2125C6.18734 12.4042 5.94984 12.5 5.6665 12.5ZM13.6665 12.5C13.3832 12.5 13.1457 12.4042 12.954 12.2125C12.7623 12.0208 12.6665 11.7833 12.6665 11.5C12.6665 11.2167 12.7623 10.9792 12.954 10.7875C13.1457 10.5958 13.3832 10.5 13.6665 10.5C13.9498 10.5 14.1873 10.5958 14.379 10.7875C14.5707 10.9792 14.6665 11.2167 14.6665 11.5C14.6665 11.7833 14.5707 12.0208 14.379 12.2125C14.1873 12.4042 13.9498 12.5 13.6665 12.5ZM9.6665 16.5C9.38317 16.5 9.14567 16.4042 8.954 16.2125C8.76234 16.0208 8.6665 15.7833 8.6665 15.5C8.6665 15.2167 8.76234 14.9792 8.954 14.7875C9.14567 14.5958 9.38317 14.5 9.6665 14.5C9.94984 14.5 10.1873 14.5958 10.379 14.7875C10.5707 14.9792 10.6665 15.2167 10.6665 15.5C10.6665 15.7833 10.5707 16.0208 10.379 16.2125C10.1873 16.4042 9.94984 16.5 9.6665 16.5ZM5.6665 16.5C5.38317 16.5 5.14567 16.4042 4.954 16.2125C4.76234 16.0208 4.6665 15.7833 4.6665 15.5C4.6665 15.2167 4.76234 14.9792 4.954 14.7875C5.14567 14.5958 5.38317 14.5 5.6665 14.5C5.94984 14.5 6.18734 14.5958 6.379 14.7875C6.57067 14.9792 6.6665 15.2167 6.6665 15.5C6.6665 15.7833 6.57067 16.0208 6.379 16.2125C6.18734 16.4042 5.94984 16.5 5.6665 16.5ZM13.6665 16.5C13.3832 16.5 13.1457 16.4042 12.954 16.2125C12.7623 16.0208 12.6665 15.7833 12.6665 15.5C12.6665 15.2167 12.7623 14.9792 12.954 14.7875C13.1457 14.5958 13.3832 14.5 13.6665 14.5C13.9498 14.5 14.1873 14.5958 14.379 14.7875C14.5707 14.9792 14.6665 15.2167 14.6665 15.5C14.6665 15.7833 14.5707 16.0208 14.379 16.2125C14.1873 16.4042 13.9498 16.5 13.6665 16.5Z", fill: "#4A4A4B" }))); };
|
|
3142
|
+
|
|
3143
|
+
var IconProfile = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "17", viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3144
|
+
React__default.createElement("path", { d: "M8.6665 8.5C7.5665 8.5 6.62484 8.10833 5.8415 7.325C5.05817 6.54167 4.6665 5.6 4.6665 4.5C4.6665 3.4 5.05817 2.45833 5.8415 1.675C6.62484 0.891667 7.5665 0.5 8.6665 0.5C9.7665 0.5 10.7082 0.891667 11.4915 1.675C12.2748 2.45833 12.6665 3.4 12.6665 4.5C12.6665 5.6 12.2748 6.54167 11.4915 7.325C10.7082 8.10833 9.7665 8.5 8.6665 8.5ZM0.666504 16.5V13.7C0.666504 13.1333 0.812337 12.6125 1.104 12.1375C1.39567 11.6625 1.78317 11.3 2.2665 11.05C3.29984 10.5333 4.34984 10.1458 5.4165 9.8875C6.48317 9.62917 7.5665 9.5 8.6665 9.5C9.7665 9.5 10.8498 9.62917 11.9165 9.8875C12.9832 10.1458 14.0332 10.5333 15.0665 11.05C15.5498 11.3 15.9373 11.6625 16.229 12.1375C16.5207 12.6125 16.6665 13.1333 16.6665 13.7V16.5H0.666504ZM2.6665 14.5H14.6665V13.7C14.6665 13.5167 14.6207 13.35 14.529 13.2C14.4373 13.05 14.3165 12.9333 14.1665 12.85C13.2665 12.4 12.3582 12.0625 11.4415 11.8375C10.5248 11.6125 9.59984 11.5 8.6665 11.5C7.73317 11.5 6.80817 11.6125 5.8915 11.8375C4.97484 12.0625 4.0665 12.4 3.1665 12.85C3.0165 12.9333 2.89567 13.05 2.804 13.2C2.71234 13.35 2.6665 13.5167 2.6665 13.7V14.5ZM8.6665 6.5C9.2165 6.5 9.68734 6.30417 10.079 5.9125C10.4707 5.52083 10.6665 5.05 10.6665 4.5C10.6665 3.95 10.4707 3.47917 10.079 3.0875C9.68734 2.69583 9.2165 2.5 8.6665 2.5C8.1165 2.5 7.64567 2.69583 7.254 3.0875C6.86234 3.47917 6.6665 3.95 6.6665 4.5C6.6665 5.05 6.86234 5.52083 7.254 5.9125C7.64567 6.30417 8.1165 6.5 8.6665 6.5Z", fill: "#4A4A4B" }))); };
|
|
3145
|
+
|
|
3146
|
+
var IconUpload = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "17", viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3147
|
+
React__default.createElement("path", { d: "M7.6665 16.5V8.35L5.0665 10.95L3.6665 9.5L8.6665 4.5L13.6665 9.5L12.2665 10.95L9.6665 8.35V16.5H7.6665ZM0.666504 5.5V2.5C0.666504 1.95 0.862337 1.47917 1.254 1.0875C1.64567 0.695833 2.1165 0.5 2.6665 0.5H14.6665C15.2165 0.5 15.6873 0.695833 16.079 1.0875C16.4707 1.47917 16.6665 1.95 16.6665 2.5V5.5H14.6665V2.5H2.6665V5.5H0.666504Z", fill: "#4A4A4B" }))); };
|
|
3148
|
+
|
|
3149
|
+
var IconNewTab = function (props) { return (React__default.createElement("svg", __assign({ width: "19", height: "19", viewBox: "0 0 19 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3150
|
+
React__default.createElement("path", { d: "M2.6665 18.5C2.1165 18.5 1.64567 18.3042 1.254 17.9125C0.862337 17.5208 0.666504 17.05 0.666504 16.5V2.5C0.666504 1.95 0.862337 1.47917 1.254 1.0875C1.64567 0.695833 2.1165 0.5 2.6665 0.5H9.6665V2.5H2.6665V16.5H16.6665V9.5H18.6665V16.5C18.6665 17.05 18.4707 17.5208 18.079 17.9125C17.6873 18.3042 17.2165 18.5 16.6665 18.5H2.6665ZM7.3665 13.2L5.9665 11.8L15.2665 2.5H11.6665V0.5H18.6665V7.5H16.6665V3.9L7.3665 13.2Z", fill: "#4A4A4B" }))); };
|
|
3151
|
+
|
|
3152
|
+
var IconWarning = function (props) { return (React__default.createElement("svg", __assign({ width: "23", height: "20", viewBox: "0 0 23 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3153
|
+
React__default.createElement("path", { d: "M0.666504 19.5L11.6665 0.5L22.6665 19.5H0.666504ZM4.1165 17.5H19.2165L11.6665 4.5L4.1165 17.5ZM11.6665 16.5C11.9498 16.5 12.1873 16.4042 12.379 16.2125C12.5707 16.0208 12.6665 15.7833 12.6665 15.5C12.6665 15.2167 12.5707 14.9792 12.379 14.7875C12.1873 14.5958 11.9498 14.5 11.6665 14.5C11.3832 14.5 11.1457 14.5958 10.954 14.7875C10.7623 14.9792 10.6665 15.2167 10.6665 15.5C10.6665 15.7833 10.7623 16.0208 10.954 16.2125C11.1457 16.4042 11.3832 16.5 11.6665 16.5ZM10.6665 13.5H12.6665V8.5H10.6665V13.5Z", fill: "#4A4A4B" }))); };
|
|
3154
|
+
|
|
3155
|
+
var IconCheckCircle = function (props) { return (React__default.createElement("svg", __assign({ width: "21", height: "21", viewBox: "0 0 21 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3156
|
+
React__default.createElement("path", { d: "M9.2665 15.1L16.3165 8.05L14.9165 6.65L9.2665 12.3L6.4165 9.45L5.0165 10.85L9.2665 15.1ZM10.6665 20.5C9.28317 20.5 7.98317 20.2375 6.7665 19.7125C5.54984 19.1875 4.4915 18.475 3.5915 17.575C2.6915 16.675 1.979 15.6167 1.454 14.4C0.929004 13.1833 0.666504 11.8833 0.666504 10.5C0.666504 9.11667 0.929004 7.81667 1.454 6.6C1.979 5.38333 2.6915 4.325 3.5915 3.425C4.4915 2.525 5.54984 1.8125 6.7665 1.2875C7.98317 0.7625 9.28317 0.5 10.6665 0.5C12.0498 0.5 13.3498 0.7625 14.5665 1.2875C15.7832 1.8125 16.8415 2.525 17.7415 3.425C18.6415 4.325 19.354 5.38333 19.879 6.6C20.404 7.81667 20.6665 9.11667 20.6665 10.5C20.6665 11.8833 20.404 13.1833 19.879 14.4C19.354 15.6167 18.6415 16.675 17.7415 17.575C16.8415 18.475 15.7832 19.1875 14.5665 19.7125C13.3498 20.2375 12.0498 20.5 10.6665 20.5ZM10.6665 18.5C12.8998 18.5 14.7915 17.725 16.3415 16.175C17.8915 14.625 18.6665 12.7333 18.6665 10.5C18.6665 8.26667 17.8915 6.375 16.3415 4.825C14.7915 3.275 12.8998 2.5 10.6665 2.5C8.43317 2.5 6.5415 3.275 4.9915 4.825C3.4415 6.375 2.6665 8.26667 2.6665 10.5C2.6665 12.7333 3.4415 14.625 4.9915 16.175C6.5415 17.725 8.43317 18.5 10.6665 18.5Z", fill: "black" }))); };
|
|
3157
|
+
|
|
3158
|
+
var IconEventAvaliable = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "21", viewBox: "0 0 17 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3159
|
+
React__default.createElement("path", { d: "M7.74775 16.85L4.6415 13.3L5.91025 11.85L7.74775 13.95L11.4228 9.75L12.6915 11.2L7.74775 16.85ZM2.5415 20.5C2.06025 20.5 1.64827 20.3042 1.30557 19.9125C0.962858 19.5208 0.791504 19.05 0.791504 18.5V4.5C0.791504 3.95 0.962858 3.47917 1.30557 3.0875C1.64827 2.69583 2.06025 2.5 2.5415 2.5H3.4165V0.5H5.1665V2.5H12.1665V0.5H13.9165V2.5H14.7915C15.2728 2.5 15.6847 2.69583 16.0274 3.0875C16.3701 3.47917 16.5415 3.95 16.5415 4.5V18.5C16.5415 19.05 16.3701 19.5208 16.0274 19.9125C15.6847 20.3042 15.2728 20.5 14.7915 20.5H2.5415ZM2.5415 18.5H14.7915V8.5H2.5415V18.5ZM2.5415 6.5H14.7915V4.5H2.5415V6.5Z", fill: "black" }))); };
|
|
3160
|
+
|
|
3161
|
+
var IconLogout = function (props) { return (React__default.createElement("svg", __assign({ width: "19", height: "19", viewBox: "0 0 19 19", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3162
|
+
React__default.createElement("path", { d: "M2.6665 18.5C2.1165 18.5 1.64567 18.3042 1.254 17.9125C0.862337 17.5208 0.666504 17.05 0.666504 16.5V2.5C0.666504 1.95 0.862337 1.47917 1.254 1.0875C1.64567 0.695833 2.1165 0.5 2.6665 0.5H9.6665V2.5H2.6665V16.5H9.6665V18.5H2.6665ZM13.6665 14.5L12.2915 13.05L14.8415 10.5H6.6665V8.5H14.8415L12.2915 5.95L13.6665 4.5L18.6665 9.5L13.6665 14.5Z", fill: "#4A4A4B" }))); };
|
|
3163
|
+
|
|
3164
|
+
var IconAdd = function (props) { return (React__default.createElement("svg", __assign({ width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3165
|
+
React__default.createElement("path", { d: "M6.6665 8.5H0.666504V6.5H6.6665V0.5H8.6665V6.5H14.6665V8.5H8.6665V14.5H6.6665V8.5Z", fill: "black" }))); };
|
|
3166
|
+
|
|
3167
|
+
var IconRemove = function (props) { return (React__default.createElement("svg", __assign({ width: "15", height: "3", viewBox: "0 0 15 3", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3168
|
+
React__default.createElement("path", { d: "M0.666504 2.5V0.5H14.6665V2.5H0.666504Z", fill: "black" }))); };
|
|
3169
|
+
|
|
3170
|
+
var IconCircleExpland = function (props) { return (React__default.createElement("svg", __assign({ width: "21", height: "21", viewBox: "0 0 21 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3171
|
+
React__default.createElement("path", { d: "M10.6665 14L15.1665 9.5L13.7415 8.1L10.6665 11.175L7.5915 8.1L6.1665 9.5L10.6665 14ZM10.6665 20.5C9.28317 20.5 7.98317 20.2375 6.7665 19.7125C5.54984 19.1875 4.4915 18.475 3.5915 17.575C2.6915 16.675 1.979 15.6167 1.454 14.4C0.929004 13.1833 0.666504 11.8833 0.666504 10.5C0.666504 9.11667 0.929004 7.81667 1.454 6.6C1.979 5.38333 2.6915 4.325 3.5915 3.425C4.4915 2.525 5.54984 1.8125 6.7665 1.2875C7.98317 0.7625 9.28317 0.5 10.6665 0.5C12.0498 0.5 13.3498 0.7625 14.5665 1.2875C15.7832 1.8125 16.8415 2.525 17.7415 3.425C18.6415 4.325 19.354 5.38333 19.879 6.6C20.404 7.81667 20.6665 9.11667 20.6665 10.5C20.6665 11.8833 20.404 13.1833 19.879 14.4C19.354 15.6167 18.6415 16.675 17.7415 17.575C16.8415 18.475 15.7832 19.1875 14.5665 19.7125C13.3498 20.2375 12.0498 20.5 10.6665 20.5ZM10.6665 18.5C12.8998 18.5 14.7915 17.725 16.3415 16.175C17.8915 14.625 18.6665 12.7333 18.6665 10.5C18.6665 8.26667 17.8915 6.375 16.3415 4.825C14.7915 3.275 12.8998 2.5 10.6665 2.5C8.43317 2.5 6.5415 3.275 4.9915 4.825C3.4415 6.375 2.6665 8.26667 2.6665 10.5C2.6665 12.7333 3.4415 14.625 4.9915 16.175C6.5415 17.725 8.43317 18.5 10.6665 18.5Z", fill: "black" }))); };
|
|
3172
|
+
|
|
3173
|
+
var IconCircleRecall = function (props) { return (React__default.createElement("svg", __assign({ width: "21", height: "21", viewBox: "0 0 21 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3174
|
+
React__default.createElement("path", { d: "M7.5915 12.9L10.6665 9.825L13.7415 12.9L15.1665 11.5L10.6665 7L6.1665 11.5L7.5915 12.9ZM10.6665 20.5C9.28317 20.5 7.98317 20.2375 6.7665 19.7125C5.54984 19.1875 4.4915 18.475 3.5915 17.575C2.6915 16.675 1.979 15.6167 1.454 14.4C0.929004 13.1833 0.666504 11.8833 0.666504 10.5C0.666504 9.11667 0.929004 7.81667 1.454 6.6C1.979 5.38333 2.6915 4.325 3.5915 3.425C4.4915 2.525 5.54984 1.8125 6.7665 1.2875C7.98317 0.7625 9.28317 0.5 10.6665 0.5C12.0498 0.5 13.3498 0.7625 14.5665 1.2875C15.7832 1.8125 16.8415 2.525 17.7415 3.425C18.6415 4.325 19.354 5.38333 19.879 6.6C20.404 7.81667 20.6665 9.11667 20.6665 10.5C20.6665 11.8833 20.404 13.1833 19.879 14.4C19.354 15.6167 18.6415 16.675 17.7415 17.575C16.8415 18.475 15.7832 19.1875 14.5665 19.7125C13.3498 20.2375 12.0498 20.5 10.6665 20.5ZM10.6665 18.5C12.8998 18.5 14.7915 17.725 16.3415 16.175C17.8915 14.625 18.6665 12.7333 18.6665 10.5C18.6665 8.26667 17.8915 6.375 16.3415 4.825C14.7915 3.275 12.8998 2.5 10.6665 2.5C8.43317 2.5 6.5415 3.275 4.9915 4.825C3.4415 6.375 2.6665 8.26667 2.6665 10.5C2.6665 12.7333 3.4415 14.625 4.9915 16.175C6.5415 17.725 8.43317 18.5 10.6665 18.5Z", fill: "black" }))); };
|
|
3175
|
+
|
|
3176
|
+
var IconArrowExpland = function (props) { return (React__default.createElement("svg", __assign({ width: "13", height: "8", viewBox: "0 0 13 8", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3177
|
+
React__default.createElement("path", { d: "M2.0665 7.87498L0.666504 6.47498L6.6665 0.474976L12.6665 6.47498L11.2665 7.87498L6.6665 3.27498L2.0665 7.87498Z", fill: "black" }))); };
|
|
3178
|
+
|
|
3179
|
+
var IconArrowRecall = function (props) { return (React__default.createElement("svg", __assign({ width: "13", height: "8", viewBox: "0 0 13 8", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3180
|
+
React__default.createElement("path", { d: "M6.6665 7.87498L0.666504 1.87498L2.0665 0.474976L6.6665 5.07498L11.2665 0.474976L12.6665 1.87498L6.6665 7.87498Z", fill: "#4A4A4B" }))); };
|
|
3181
|
+
|
|
3182
|
+
var IconTriangleExpand = function (props) { return (React__default.createElement("svg", __assign({ width: "11", height: "6", viewBox: "0 0 11 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3183
|
+
React__default.createElement("path", { d: "M0.666504 5.5L5.6665 0.5L10.6665 5.5H0.666504Z", fill: "black" }))); };
|
|
3184
|
+
|
|
3185
|
+
var IconTriangleRecall = function (props) { return (React__default.createElement("svg", __assign({ width: "11", height: "6", viewBox: "0 0 11 6", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3186
|
+
React__default.createElement("path", { d: "M5.6665 5.5L0.666504 0.5H10.6665L5.6665 5.5Z", fill: "#4A4A4B" }))); };
|
|
3187
|
+
|
|
3188
|
+
var IconSwap = function (props) { return (React__default.createElement("svg", __assign({ width: "17", height: "21", viewBox: "0 0 17 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3189
|
+
React__default.createElement("path", { d: "M4.6665 11.5V4.325L2.0915 6.9L0.666504 5.5L5.6665 0.5L10.6665 5.5L9.2415 6.9L6.6665 4.325V11.5H4.6665ZM11.6665 20.5L6.6665 15.5L8.0915 14.1L10.6665 16.675V9.5H12.6665V16.675L15.2415 14.1L16.6665 15.5L11.6665 20.5Z", fill: "black" }))); };
|
|
3190
|
+
|
|
3191
|
+
var IconAddCell = function (props) { return (React__default.createElement("svg", __assign({ width: "21", height: "21", viewBox: "0 0 21 21", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
3192
|
+
React__default.createElement("path", { d: "M9.6665 15.5H11.6665V11.5H15.6665V9.5H11.6665V5.5H9.6665V9.5H5.6665V11.5H9.6665V15.5ZM10.6665 20.5C9.28317 20.5 7.98317 20.2375 6.7665 19.7125C5.54984 19.1875 4.4915 18.475 3.5915 17.575C2.6915 16.675 1.979 15.6167 1.454 14.4C0.929004 13.1833 0.666504 11.8833 0.666504 10.5C0.666504 9.11667 0.929004 7.81667 1.454 6.6C1.979 5.38333 2.6915 4.325 3.5915 3.425C4.4915 2.525 5.54984 1.8125 6.7665 1.2875C7.98317 0.7625 9.28317 0.5 10.6665 0.5C12.0498 0.5 13.3498 0.7625 14.5665 1.2875C15.7832 1.8125 16.8415 2.525 17.7415 3.425C18.6415 4.325 19.354 5.38333 19.879 6.6C20.404 7.81667 20.6665 9.11667 20.6665 10.5C20.6665 11.8833 20.404 13.1833 19.879 14.4C19.354 15.6167 18.6415 16.675 17.7415 17.575C16.8415 18.475 15.7832 19.1875 14.5665 19.7125C13.3498 20.2375 12.0498 20.5 10.6665 20.5ZM10.6665 18.5C12.8998 18.5 14.7915 17.725 16.3415 16.175C17.8915 14.625 18.6665 12.7333 18.6665 10.5C18.6665 8.26667 17.8915 6.375 16.3415 4.825C14.7915 3.275 12.8998 2.5 10.6665 2.5C8.43317 2.5 6.5415 3.275 4.9915 4.825C3.4415 6.375 2.6665 8.26667 2.6665 10.5C2.6665 12.7333 3.4415 14.625 4.9915 16.175C6.5415 17.725 8.43317 18.5 10.6665 18.5Z", fill: "#4A4A4B" }))); };
|
|
3193
|
+
|
|
3194
|
+
export { Button, IconAdd, IconAddCell, IconArrowExpland, IconArrowRecall, IconCLose, IconCalendar, IconCheckCircle, IconCircleExpland, IconCircleRecall, IconDelete, IconDownload, IconEdit, IconEventAvaliable, IconLogout, IconNewTab, IconProfile, IconRemove, IconSwap, IconTriangleExpand, IconTriangleRecall, IconUpload, IconVisibillity, IconWarning, Modal };
|
|
85
3195
|
//# sourceMappingURL=index.esm.js.map
|