santosp-rslib-project 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/components/button.d.ts +8 -0
- package/dist/components/button.recipe.d.ts +1 -0
- package/dist/components/button.stories.d.ts +53 -0
- package/dist/components/date-picker.d.ts +8 -0
- package/dist/components/date-picker.recipe.d.ts +1 -0
- package/dist/components/flex.d.ts +19 -0
- package/dist/components/grid.d.ts +39 -0
- package/dist/components/link.d.ts +34 -0
- package/dist/components/link.recipe.d.ts +1 -0
- package/dist/components/link.stories.d.ts +28 -0
- package/dist/components/text.d.ts +25 -0
- package/dist/components/text.recipe.d.ts +1 -0
- package/dist/components/text.stories.d.ts +46 -0
- package/dist/index.css +832 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1387 -0
- package/dist/index.js.LICENSE.txt +19 -0
- package/dist/rslib-runtime.js +18 -0
- package/package.json +54 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1387 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
__webpack_require__.add({
|
|
6
|
+
"./node_modules/react/cjs/react-jsx-runtime.development.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.development.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/ "production" !== process.env.NODE_ENV && function() {
|
|
16
|
+
function getComponentNameFromType(type) {
|
|
17
|
+
if (null == type) return null;
|
|
18
|
+
if ("function" == typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
19
|
+
if ("string" == typeof type) return type;
|
|
20
|
+
switch(type){
|
|
21
|
+
case REACT_FRAGMENT_TYPE:
|
|
22
|
+
return "Fragment";
|
|
23
|
+
case REACT_PROFILER_TYPE:
|
|
24
|
+
return "Profiler";
|
|
25
|
+
case REACT_STRICT_MODE_TYPE:
|
|
26
|
+
return "StrictMode";
|
|
27
|
+
case REACT_SUSPENSE_TYPE:
|
|
28
|
+
return "Suspense";
|
|
29
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
30
|
+
return "SuspenseList";
|
|
31
|
+
case REACT_ACTIVITY_TYPE:
|
|
32
|
+
return "Activity";
|
|
33
|
+
}
|
|
34
|
+
if ("object" == typeof type) switch("number" == typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof){
|
|
35
|
+
case REACT_PORTAL_TYPE:
|
|
36
|
+
return "Portal";
|
|
37
|
+
case REACT_CONTEXT_TYPE:
|
|
38
|
+
return type.displayName || "Context";
|
|
39
|
+
case REACT_CONSUMER_TYPE:
|
|
40
|
+
return (type._context.displayName || "Context") + ".Consumer";
|
|
41
|
+
case REACT_FORWARD_REF_TYPE:
|
|
42
|
+
var innerType = type.render;
|
|
43
|
+
type = type.displayName;
|
|
44
|
+
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
45
|
+
return type;
|
|
46
|
+
case REACT_MEMO_TYPE:
|
|
47
|
+
return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
48
|
+
case REACT_LAZY_TYPE:
|
|
49
|
+
innerType = type._payload;
|
|
50
|
+
type = type._init;
|
|
51
|
+
try {
|
|
52
|
+
return getComponentNameFromType(type(innerType));
|
|
53
|
+
} catch (x) {}
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function testStringCoercion(value) {
|
|
58
|
+
return "" + value;
|
|
59
|
+
}
|
|
60
|
+
function checkKeyStringCoercion(value) {
|
|
61
|
+
try {
|
|
62
|
+
testStringCoercion(value);
|
|
63
|
+
var JSCompiler_inline_result = !1;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
JSCompiler_inline_result = !0;
|
|
66
|
+
}
|
|
67
|
+
if (JSCompiler_inline_result) {
|
|
68
|
+
JSCompiler_inline_result = console;
|
|
69
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
70
|
+
var JSCompiler_inline_result$jscomp$0 = "function" == typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
71
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
72
|
+
return testStringCoercion(value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function getTaskName(type) {
|
|
76
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
77
|
+
if ("object" == typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
78
|
+
try {
|
|
79
|
+
var name = getComponentNameFromType(type);
|
|
80
|
+
return name ? "<" + name + ">" : "<...>";
|
|
81
|
+
} catch (x) {
|
|
82
|
+
return "<...>";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function getOwner() {
|
|
86
|
+
var dispatcher = ReactSharedInternals.A;
|
|
87
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
88
|
+
}
|
|
89
|
+
function UnknownOwner() {
|
|
90
|
+
return Error("react-stack-top-frame");
|
|
91
|
+
}
|
|
92
|
+
function hasValidKey(config) {
|
|
93
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
94
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
95
|
+
if (getter && getter.isReactWarning) return !1;
|
|
96
|
+
}
|
|
97
|
+
return void 0 !== config.key;
|
|
98
|
+
}
|
|
99
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
100
|
+
function warnAboutAccessingKey() {
|
|
101
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
102
|
+
}
|
|
103
|
+
warnAboutAccessingKey.isReactWarning = !0;
|
|
104
|
+
Object.defineProperty(props, "key", {
|
|
105
|
+
get: warnAboutAccessingKey,
|
|
106
|
+
configurable: !0
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
110
|
+
var componentName = getComponentNameFromType(this.type);
|
|
111
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
112
|
+
componentName = this.props.ref;
|
|
113
|
+
return void 0 !== componentName ? componentName : null;
|
|
114
|
+
}
|
|
115
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
116
|
+
var refProp = props.ref;
|
|
117
|
+
type = {
|
|
118
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
119
|
+
type: type,
|
|
120
|
+
key: key,
|
|
121
|
+
props: props,
|
|
122
|
+
_owner: owner
|
|
123
|
+
};
|
|
124
|
+
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
125
|
+
enumerable: !1,
|
|
126
|
+
get: elementRefGetterWithDeprecationWarning
|
|
127
|
+
}) : Object.defineProperty(type, "ref", {
|
|
128
|
+
enumerable: !1,
|
|
129
|
+
value: null
|
|
130
|
+
});
|
|
131
|
+
type._store = {};
|
|
132
|
+
Object.defineProperty(type._store, "validated", {
|
|
133
|
+
configurable: !1,
|
|
134
|
+
enumerable: !1,
|
|
135
|
+
writable: !0,
|
|
136
|
+
value: 0
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
139
|
+
configurable: !1,
|
|
140
|
+
enumerable: !1,
|
|
141
|
+
writable: !0,
|
|
142
|
+
value: null
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(type, "_debugStack", {
|
|
145
|
+
configurable: !1,
|
|
146
|
+
enumerable: !1,
|
|
147
|
+
writable: !0,
|
|
148
|
+
value: debugStack
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(type, "_debugTask", {
|
|
151
|
+
configurable: !1,
|
|
152
|
+
enumerable: !1,
|
|
153
|
+
writable: !0,
|
|
154
|
+
value: debugTask
|
|
155
|
+
});
|
|
156
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
157
|
+
return type;
|
|
158
|
+
}
|
|
159
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
160
|
+
var children = config.children;
|
|
161
|
+
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
162
|
+
for(isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)validateChildKeys(children[isStaticChildren]);
|
|
163
|
+
Object.freeze && Object.freeze(children);
|
|
164
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
165
|
+
else validateChildKeys(children);
|
|
166
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
167
|
+
children = getComponentNameFromType(type);
|
|
168
|
+
var keys = Object.keys(config).filter(function(k) {
|
|
169
|
+
return "key" !== k;
|
|
170
|
+
});
|
|
171
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
172
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
173
|
+
}
|
|
174
|
+
children = null;
|
|
175
|
+
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
176
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
177
|
+
if ("key" in config) {
|
|
178
|
+
maybeKey = {};
|
|
179
|
+
for(var propName in config)"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
180
|
+
} else maybeKey = config;
|
|
181
|
+
children && defineKeyPropWarningGetter(maybeKey, "function" == typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
182
|
+
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
183
|
+
}
|
|
184
|
+
function validateChildKeys(node) {
|
|
185
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" == typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
186
|
+
}
|
|
187
|
+
function isValidElement(object) {
|
|
188
|
+
return "object" == typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
189
|
+
}
|
|
190
|
+
var React = __webpack_require__("react"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
191
|
+
return null;
|
|
192
|
+
};
|
|
193
|
+
React = {
|
|
194
|
+
react_stack_bottom_frame: function(callStackForError) {
|
|
195
|
+
return callStackForError();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var specialPropKeyWarningShown;
|
|
199
|
+
var didWarnAboutElementRef = {};
|
|
200
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
201
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
202
|
+
var didWarnAboutKeySpread = {};
|
|
203
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
204
|
+
exports.jsx = function(type, config, maybeKey) {
|
|
205
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
206
|
+
return jsxDEVImpl(type, config, maybeKey, !1, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
207
|
+
};
|
|
208
|
+
exports.jsxs = function(type, config, maybeKey) {
|
|
209
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
210
|
+
return jsxDEVImpl(type, config, maybeKey, !0, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
211
|
+
};
|
|
212
|
+
}();
|
|
213
|
+
},
|
|
214
|
+
"./node_modules/react/cjs/react-jsx-runtime.production.js" (__unused_rspack_module, exports) {
|
|
215
|
+
/**
|
|
216
|
+
* @license React
|
|
217
|
+
* react-jsx-runtime.production.js
|
|
218
|
+
*
|
|
219
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
220
|
+
*
|
|
221
|
+
* This source code is licensed under the MIT license found in the
|
|
222
|
+
* LICENSE file in the root directory of this source tree.
|
|
223
|
+
*/ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
224
|
+
function jsxProd(type, config, maybeKey) {
|
|
225
|
+
var key = null;
|
|
226
|
+
void 0 !== maybeKey && (key = "" + maybeKey);
|
|
227
|
+
void 0 !== config.key && (key = "" + config.key);
|
|
228
|
+
if ("key" in config) {
|
|
229
|
+
maybeKey = {};
|
|
230
|
+
for(var propName in config)"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
231
|
+
} else maybeKey = config;
|
|
232
|
+
config = maybeKey.ref;
|
|
233
|
+
return {
|
|
234
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
235
|
+
type: type,
|
|
236
|
+
key: key,
|
|
237
|
+
ref: void 0 !== config ? config : null,
|
|
238
|
+
props: maybeKey
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
242
|
+
exports.jsx = jsxProd;
|
|
243
|
+
exports.jsxs = jsxProd;
|
|
244
|
+
},
|
|
245
|
+
"./node_modules/react/jsx-runtime.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
246
|
+
if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("./node_modules/react/cjs/react-jsx-runtime.production.js");
|
|
247
|
+
else module.exports = __webpack_require__("./node_modules/react/cjs/react-jsx-runtime.development.js");
|
|
248
|
+
},
|
|
249
|
+
react (module) {
|
|
250
|
+
module.exports = __rspack_external_react;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
function isObject(value) {
|
|
254
|
+
return "object" == typeof value && null != value && !Array.isArray(value);
|
|
255
|
+
}
|
|
256
|
+
var isObjectOrArray = (obj)=>"object" == typeof obj && null !== obj;
|
|
257
|
+
function helpers_compact(value) {
|
|
258
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2])=>void 0 !== value2));
|
|
259
|
+
}
|
|
260
|
+
var isBaseCondition = (v)=>"base" === v;
|
|
261
|
+
function filterBaseConditions(c) {
|
|
262
|
+
return c.slice().filter((v)=>!isBaseCondition(v));
|
|
263
|
+
}
|
|
264
|
+
function toChar(code) {
|
|
265
|
+
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
266
|
+
}
|
|
267
|
+
function toName(code) {
|
|
268
|
+
let name = "";
|
|
269
|
+
let x;
|
|
270
|
+
for(x = Math.abs(code); x > 52; x = x / 52 | 0)name = toChar(x % 52) + name;
|
|
271
|
+
return toChar(x % 52) + name;
|
|
272
|
+
}
|
|
273
|
+
function toPhash(h, x) {
|
|
274
|
+
let i = x.length;
|
|
275
|
+
while(i)h = 33 * h ^ x.charCodeAt(--i);
|
|
276
|
+
return h;
|
|
277
|
+
}
|
|
278
|
+
function toHash(value) {
|
|
279
|
+
return toName(toPhash(5381, value) >>> 0);
|
|
280
|
+
}
|
|
281
|
+
var importantRegex = /\s*!(important)?/i;
|
|
282
|
+
function isImportant(value) {
|
|
283
|
+
return "string" == typeof value ? importantRegex.test(value) : false;
|
|
284
|
+
}
|
|
285
|
+
function withoutImportant(value) {
|
|
286
|
+
return "string" == typeof value ? value.replace(importantRegex, "").trim() : value;
|
|
287
|
+
}
|
|
288
|
+
function withoutSpace(str) {
|
|
289
|
+
return "string" == typeof str ? str.replaceAll(" ", "_") : str;
|
|
290
|
+
}
|
|
291
|
+
var helpers_memo = (fn)=>{
|
|
292
|
+
const cache = /* @__PURE__ */ new Map();
|
|
293
|
+
const get = (...args)=>{
|
|
294
|
+
const key = JSON.stringify(args);
|
|
295
|
+
if (cache.has(key)) return cache.get(key);
|
|
296
|
+
const result = fn(...args);
|
|
297
|
+
cache.set(key, result);
|
|
298
|
+
return result;
|
|
299
|
+
};
|
|
300
|
+
return get;
|
|
301
|
+
};
|
|
302
|
+
var MERGE_OMIT = /* @__PURE__ */ new Set([
|
|
303
|
+
"__proto__",
|
|
304
|
+
"constructor",
|
|
305
|
+
"prototype"
|
|
306
|
+
]);
|
|
307
|
+
function helpers_mergeProps(...sources) {
|
|
308
|
+
return sources.reduce((prev, obj)=>{
|
|
309
|
+
if (!obj) return prev;
|
|
310
|
+
Object.keys(obj).forEach((key)=>{
|
|
311
|
+
if (MERGE_OMIT.has(key)) return;
|
|
312
|
+
const prevValue = prev[key];
|
|
313
|
+
const value = obj[key];
|
|
314
|
+
if (isObject(prevValue) && isObject(value)) prev[key] = helpers_mergeProps(prevValue, value);
|
|
315
|
+
else prev[key] = value;
|
|
316
|
+
});
|
|
317
|
+
return prev;
|
|
318
|
+
}, {});
|
|
319
|
+
}
|
|
320
|
+
var isNotNullish = (element)=>null != element;
|
|
321
|
+
function walkObject(target, predicate, options = {}) {
|
|
322
|
+
const { stop, getKey } = options;
|
|
323
|
+
function inner(value, path = []) {
|
|
324
|
+
if (isObjectOrArray(value)) {
|
|
325
|
+
const result = {};
|
|
326
|
+
for (const [prop, child] of Object.entries(value)){
|
|
327
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
328
|
+
const childPath = [
|
|
329
|
+
...path,
|
|
330
|
+
key
|
|
331
|
+
];
|
|
332
|
+
if (stop?.(value, childPath)) return predicate(value, path);
|
|
333
|
+
const next = inner(child, childPath);
|
|
334
|
+
if (isNotNullish(next)) result[key] = next;
|
|
335
|
+
}
|
|
336
|
+
return result;
|
|
337
|
+
}
|
|
338
|
+
return predicate(value, path);
|
|
339
|
+
}
|
|
340
|
+
return inner(target);
|
|
341
|
+
}
|
|
342
|
+
function mapObject(obj, fn) {
|
|
343
|
+
if (Array.isArray(obj)) return obj.map((value)=>fn(value));
|
|
344
|
+
if (!isObject(obj)) return fn(obj);
|
|
345
|
+
return walkObject(obj, (value)=>fn(value));
|
|
346
|
+
}
|
|
347
|
+
function toResponsiveObject(values, breakpoints) {
|
|
348
|
+
return values.reduce((acc, current, index)=>{
|
|
349
|
+
const key = breakpoints[index];
|
|
350
|
+
if (null != current) acc[key] = current;
|
|
351
|
+
return acc;
|
|
352
|
+
}, {});
|
|
353
|
+
}
|
|
354
|
+
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
355
|
+
const { utility, conditions } = context;
|
|
356
|
+
const { hasShorthand, resolveShorthand } = utility;
|
|
357
|
+
return walkObject(styles, (value)=>Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value, {
|
|
358
|
+
stop: (value)=>Array.isArray(value),
|
|
359
|
+
getKey: shorthand ? (prop)=>hasShorthand ? resolveShorthand(prop) : prop : void 0
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
var fallbackCondition = {
|
|
363
|
+
shift: (v)=>v,
|
|
364
|
+
finalize: (v)=>v,
|
|
365
|
+
breakpoints: {
|
|
366
|
+
keys: []
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
var sanitize = (value)=>"string" == typeof value ? value.replaceAll(/[\n\s]+/g, " ") : value;
|
|
370
|
+
function createCss(context) {
|
|
371
|
+
const { utility, hash, conditions: conds = fallbackCondition } = context;
|
|
372
|
+
const formatClassName = (str)=>[
|
|
373
|
+
utility.prefix,
|
|
374
|
+
str
|
|
375
|
+
].filter(Boolean).join("-");
|
|
376
|
+
const hashFn = (conditions, className)=>{
|
|
377
|
+
let result;
|
|
378
|
+
if (hash) {
|
|
379
|
+
const baseArray = [
|
|
380
|
+
...conds.finalize(conditions),
|
|
381
|
+
className
|
|
382
|
+
];
|
|
383
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
384
|
+
} else {
|
|
385
|
+
const baseArray = [
|
|
386
|
+
...conds.finalize(conditions),
|
|
387
|
+
formatClassName(className)
|
|
388
|
+
];
|
|
389
|
+
result = baseArray.join(":");
|
|
390
|
+
}
|
|
391
|
+
return result;
|
|
392
|
+
};
|
|
393
|
+
return helpers_memo(({ base, ...styles } = {})=>{
|
|
394
|
+
const styleObject = Object.assign(styles, base);
|
|
395
|
+
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
396
|
+
const classNames = /* @__PURE__ */ new Set();
|
|
397
|
+
walkObject(normalizedObject, (value, paths)=>{
|
|
398
|
+
if (null == value) return;
|
|
399
|
+
const important = isImportant(value);
|
|
400
|
+
const [prop, ...allConditions] = conds.shift(paths);
|
|
401
|
+
const conditions = filterBaseConditions(allConditions);
|
|
402
|
+
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
403
|
+
let className = hashFn(conditions, transformed.className);
|
|
404
|
+
if (important) className = `${className}!`;
|
|
405
|
+
classNames.add(className);
|
|
406
|
+
});
|
|
407
|
+
return Array.from(classNames).join(" ");
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function compactStyles(...styles) {
|
|
411
|
+
return styles.flat().filter((style)=>isObject(style) && Object.keys(helpers_compact(style)).length > 0);
|
|
412
|
+
}
|
|
413
|
+
function createMergeCss(context) {
|
|
414
|
+
function resolve(styles) {
|
|
415
|
+
const allStyles = compactStyles(...styles);
|
|
416
|
+
if (1 === allStyles.length) return allStyles;
|
|
417
|
+
return allStyles.map((style)=>normalizeStyleObject(style, context));
|
|
418
|
+
}
|
|
419
|
+
function mergeCss(...styles) {
|
|
420
|
+
return helpers_mergeProps(...resolve(styles));
|
|
421
|
+
}
|
|
422
|
+
function assignCss(...styles) {
|
|
423
|
+
return Object.assign({}, ...resolve(styles));
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
mergeCss: helpers_memo(mergeCss),
|
|
427
|
+
assignCss
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
var wordRegex = /([A-Z])/g;
|
|
431
|
+
var msRegex = /^ms-/;
|
|
432
|
+
var hypenateProperty = helpers_memo((property)=>{
|
|
433
|
+
if (property.startsWith("--")) return property;
|
|
434
|
+
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
435
|
+
});
|
|
436
|
+
var fns = [
|
|
437
|
+
"min",
|
|
438
|
+
"max",
|
|
439
|
+
"clamp",
|
|
440
|
+
"calc"
|
|
441
|
+
];
|
|
442
|
+
var fnRegExp = new RegExp(`^(${fns.join("|")})\\(.*\\)`);
|
|
443
|
+
var isCssFunction = (v)=>"string" == typeof v && fnRegExp.test(v);
|
|
444
|
+
var lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";
|
|
445
|
+
var lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;
|
|
446
|
+
var lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);
|
|
447
|
+
var helpers_isCssUnit = (v)=>"string" == typeof v && lengthRegExp.test(v);
|
|
448
|
+
var helpers_isCssVar = (v)=>"string" == typeof v && /^var\(--.+\)$/.test(v);
|
|
449
|
+
var patternFns = {
|
|
450
|
+
map: mapObject,
|
|
451
|
+
isCssFunction: isCssFunction,
|
|
452
|
+
isCssVar: helpers_isCssVar,
|
|
453
|
+
isCssUnit: helpers_isCssUnit
|
|
454
|
+
};
|
|
455
|
+
var getPatternStyles = (pattern, styles)=>{
|
|
456
|
+
if (!pattern?.defaultValues) return styles;
|
|
457
|
+
const defaults = "function" == typeof pattern.defaultValues ? pattern.defaultValues(styles) : pattern.defaultValues;
|
|
458
|
+
return Object.assign({}, defaults, helpers_compact(styles));
|
|
459
|
+
};
|
|
460
|
+
function helpers_splitProps(props, ...keys) {
|
|
461
|
+
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
462
|
+
const dKeys = Object.keys(descriptors);
|
|
463
|
+
const split = (k)=>{
|
|
464
|
+
const clone = {};
|
|
465
|
+
for(let i = 0; i < k.length; i++){
|
|
466
|
+
const key = k[i];
|
|
467
|
+
if (descriptors[key]) {
|
|
468
|
+
Object.defineProperty(clone, key, descriptors[key]);
|
|
469
|
+
delete descriptors[key];
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return clone;
|
|
473
|
+
};
|
|
474
|
+
const fn = (key)=>split(Array.isArray(key) ? key : dKeys.filter(key));
|
|
475
|
+
return keys.map(fn).concat(split(dKeys));
|
|
476
|
+
}
|
|
477
|
+
var helpers_uniq = (...items)=>{
|
|
478
|
+
const set = items.reduce((acc, currItems)=>{
|
|
479
|
+
if (currItems) currItems.forEach((item)=>acc.add(item));
|
|
480
|
+
return acc;
|
|
481
|
+
}, /* @__PURE__ */ new Set([]));
|
|
482
|
+
return Array.from(set);
|
|
483
|
+
};
|
|
484
|
+
var htmlProps = [
|
|
485
|
+
"htmlSize",
|
|
486
|
+
"htmlTranslate",
|
|
487
|
+
"htmlWidth",
|
|
488
|
+
"htmlHeight"
|
|
489
|
+
];
|
|
490
|
+
function convert(key) {
|
|
491
|
+
return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;
|
|
492
|
+
}
|
|
493
|
+
function normalizeHTMLProps(props) {
|
|
494
|
+
return Object.fromEntries(Object.entries(props).map(([key, value])=>[
|
|
495
|
+
convert(key),
|
|
496
|
+
value
|
|
497
|
+
]));
|
|
498
|
+
}
|
|
499
|
+
normalizeHTMLProps.keys = htmlProps;
|
|
500
|
+
const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_noscript,_invertedColors,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,@/xs,@/sm,@/md,@/lg,@/xl,@/2xl,@/3xl,@/4xl,@/5xl,@/6xl,@/7xl,@/8xl,base";
|
|
501
|
+
const conditions_conditions = new Set(conditionsStr.split(','));
|
|
502
|
+
const conditionRegex = /^@|&|&$/;
|
|
503
|
+
function isCondition(value) {
|
|
504
|
+
return conditions_conditions.has(value) || conditionRegex.test(value);
|
|
505
|
+
}
|
|
506
|
+
const underscoreRegex = /^_/;
|
|
507
|
+
const conditionsSelectorRegex = /&|@/;
|
|
508
|
+
function finalizeConditions(paths) {
|
|
509
|
+
return paths.map((path)=>{
|
|
510
|
+
if (conditions_conditions.has(path)) return path.replace(underscoreRegex, '');
|
|
511
|
+
if (conditionsSelectorRegex.test(path)) return `[${withoutSpace(path.trim())}]`;
|
|
512
|
+
return path;
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
function sortConditions(paths) {
|
|
516
|
+
return paths.sort((a, b)=>{
|
|
517
|
+
const aa = isCondition(a);
|
|
518
|
+
const bb = isCondition(b);
|
|
519
|
+
if (aa && !bb) return 1;
|
|
520
|
+
if (!aa && bb) return -1;
|
|
521
|
+
return 0;
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
const utilities = "aspectRatio:asp,boxDecorationBreak:bx-db,zIndex:z,boxSizing:bx-s,objectPosition:obj-p,objectFit:obj-f,overscrollBehavior:ovs-b,overscrollBehaviorX:ovs-bx,overscrollBehaviorY:ovs-by,position:pos/1,top:top,left:left,inset:inset,insetInline:inset-x/insetX,insetBlock:inset-y/insetY,insetBlockEnd:inset-be,insetBlockStart:inset-bs,insetInlineEnd:inset-e/insetEnd/end,insetInlineStart:inset-s/insetStart/start,right:right,bottom:bottom,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:flex-b,flex:flex,flexDirection:flex-d/flexDir,flexGrow:flex-g,flexShrink:flex-sh,gridTemplateColumns:grid-tc,gridTemplateRows:grid-tr,gridColumn:grid-c,gridRow:grid-r,gridColumnStart:grid-cs,gridColumnEnd:grid-ce,gridAutoFlow:grid-af,gridAutoColumns:grid-ac,gridAutoRows:grid-ar,gap:gap,gridGap:grid-g,gridRowGap:grid-rg,gridColumnGap:grid-cg,rowGap:rg,columnGap:cg,justifyContent:jc,alignContent:ac,alignItems:ai,alignSelf:as,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pbe,paddingBlockStart:pbs,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mbe,marginBlockStart:mbs,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,spaceX:sx,spaceY:sy,outlineWidth:ring-w/ringWidth,outlineColor:ring-c/ringColor,outline:ring/1,outlineOffset:ring-o/ringOffset,focusRing:focus-ring,focusVisibleRing:focus-v-ring,focusRingColor:focus-ring-c,focusRingOffset:focus-ring-o,focusRingWidth:focus-ring-w,focusRingStyle:focus-ring-s,divideX:dvd-x,divideY:dvd-y,divideColor:dvd-c,divideStyle:dvd-s,width:w/1,inlineSize:w-is,minWidth:min-w/minW,minInlineSize:min-w-is,maxWidth:max-w/maxW,maxInlineSize:max-w-is,height:h/1,blockSize:h-bs,minHeight:min-h/minH,minBlockSize:min-h-bs,maxHeight:max-h/maxH,maxBlockSize:max-b,boxSize:size,color:c,fontFamily:ff,fontSize:fs,fontSizeAdjust:fs-a,fontPalette:fp,fontKerning:fk,fontFeatureSettings:ff-s,fontWeight:fw,fontSmoothing:fsmt,fontVariant:fv,fontVariantAlternates:fv-alt,fontVariantCaps:fv-caps,fontVariationSettings:fv-s,fontVariantNumeric:fv-num,letterSpacing:ls,lineHeight:lh,textAlign:ta,textDecoration:td,textDecorationColor:td-c,textEmphasisColor:te-c,textDecorationStyle:td-s,textDecorationThickness:td-t,textUnderlineOffset:tu-o,textTransform:tt,textIndent:ti,textShadow:tsh,textShadowColor:tsh-c/textShadowColor,WebkitTextFillColor:wktf-c,textOverflow:tov,verticalAlign:va,wordBreak:wb,textWrap:tw,truncate:trunc,lineClamp:lc,listStyleType:li-t,listStylePosition:li-pos,listStyleImage:li-img,listStyle:li-s,backgroundPosition:bg-p/bgPosition,backgroundPositionX:bg-p-x/bgPositionX,backgroundPositionY:bg-p-y/bgPositionY,backgroundAttachment:bg-a/bgAttachment,backgroundClip:bg-cp/bgClip,background:bg/1,backgroundColor:bg-c/bgColor,backgroundOrigin:bg-o/bgOrigin,backgroundImage:bg-i/bgImage,backgroundRepeat:bg-r/bgRepeat,backgroundBlendMode:bg-bm/bgBlendMode,backgroundSize:bg-s/bgSize,backgroundGradient:bg-grad/bgGradient,backgroundLinear:bg-linear/bgLinear,backgroundRadial:bg-radial/bgRadial,backgroundConic:bg-conic/bgConic,textGradient:txt-grad,gradientFromPosition:grad-from-pos,gradientToPosition:grad-to-pos,gradientFrom:grad-from,gradientTo:grad-to,gradientVia:grad-via,gradientViaPosition:grad-via-pos,borderRadius:bdr/rounded,borderTopLeftRadius:bdr-tl/roundedTopLeft,borderTopRightRadius:bdr-tr/roundedTopRight,borderBottomRightRadius:bdr-br/roundedBottomRight,borderBottomLeftRadius:bdr-bl/roundedBottomLeft,borderTopRadius:bdr-t/roundedTop,borderRightRadius:bdr-r/roundedRight,borderBottomRadius:bdr-b/roundedBottom,borderLeftRadius:bdr-l/roundedLeft,borderStartStartRadius:bdr-ss/roundedStartStart,borderStartEndRadius:bdr-se/roundedStartEnd,borderStartRadius:bdr-s/roundedStart,borderEndStartRadius:bdr-es/roundedEndStart,borderEndEndRadius:bdr-ee/roundedEndEnd,borderEndRadius:bdr-e/roundedEnd,border:bd,borderWidth:bd-w,borderTopWidth:bd-t-w,borderLeftWidth:bd-l-w,borderRightWidth:bd-r-w,borderBottomWidth:bd-b-w,borderBlockStartWidth:bd-bs-w,borderBlockEndWidth:bd-be-w,borderColor:bd-c,borderInline:bd-x/borderX,borderInlineWidth:bd-x-w/borderXWidth,borderInlineColor:bd-x-c/borderXColor,borderBlock:bd-y/borderY,borderBlockWidth:bd-y-w/borderYWidth,borderBlockColor:bd-y-c/borderYColor,borderLeft:bd-l,borderLeftColor:bd-l-c,borderInlineStart:bd-s/borderStart,borderInlineStartWidth:bd-s-w/borderStartWidth,borderInlineStartColor:bd-s-c/borderStartColor,borderRight:bd-r,borderRightColor:bd-r-c,borderInlineEnd:bd-e/borderEnd,borderInlineEndWidth:bd-e-w/borderEndWidth,borderInlineEndColor:bd-e-c/borderEndColor,borderTop:bd-t,borderTopColor:bd-t-c,borderBottom:bd-b,borderBottomColor:bd-b-c,borderBlockEnd:bd-be,borderBlockEndColor:bd-be-c,borderBlockStart:bd-bs,borderBlockStartColor:bd-bs-c,opacity:op,boxShadow:bx-sh/shadow,boxShadowColor:bx-sh-c/shadowColor,mixBlendMode:mix-bm,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:bkdp,backdropBlur:bkdp-blur,backdropBrightness:bkdp-brightness,backdropContrast:bkdp-contrast,backdropGrayscale:bkdp-grayscale,backdropHueRotate:bkdp-hue-rotate,backdropInvert:bkdp-invert,backdropOpacity:bkdp-opacity,backdropSaturate:bkdp-saturate,backdropSepia:bkdp-sepia,borderCollapse:bd-cl,borderSpacing:bd-sp,borderSpacingX:bd-sx,borderSpacingY:bd-sy,tableLayout:tbl,transitionTimingFunction:trs-tmf,transitionDelay:trs-dly,transitionDuration:trs-dur,transitionProperty:trs-prop,transition:trs,animation:anim,animationName:anim-n,animationTimingFunction:anim-tmf,animationDuration:anim-dur,animationDelay:anim-dly,animationPlayState:anim-ps,animationComposition:anim-comp,animationFillMode:anim-fm,animationDirection:anim-dir,animationIterationCount:anim-ic,animationRange:anim-r,animationState:anim-s,animationRangeStart:anim-rs,animationRangeEnd:anim-re,animationTimeline:anim-tl,transformOrigin:trf-o,transformBox:trf-b,transformStyle:trf-s,transform:trf,rotate:rotate,rotateX:rotate-x,rotateY:rotate-y,rotateZ:rotate-z,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate-x/x,translateY:translate-y/y,translateZ:translate-z/z,accentColor:ac-c,caretColor:ca-c,scrollBehavior:scr-bhv,scrollbar:scr-bar,scrollbarColor:scr-bar-c,scrollbarGutter:scr-bar-g,scrollbarWidth:scr-bar-w,scrollMargin:scr-m,scrollMarginLeft:scr-ml,scrollMarginRight:scr-mr,scrollMarginTop:scr-mt,scrollMarginBottom:scr-mb,scrollMarginBlock:scr-my/scrollMarginY,scrollMarginBlockEnd:scr-mbe,scrollMarginBlockStart:scr-mbt,scrollMarginInline:scr-mx/scrollMarginX,scrollMarginInlineEnd:scr-me,scrollMarginInlineStart:scr-ms,scrollPadding:scr-p,scrollPaddingBlock:scr-py/scrollPaddingY,scrollPaddingBlockStart:scr-pbs,scrollPaddingBlockEnd:scr-pbe,scrollPaddingInline:scr-px/scrollPaddingX,scrollPaddingInlineEnd:scr-pe,scrollPaddingInlineStart:scr-ps,scrollPaddingLeft:scr-pl,scrollPaddingRight:scr-pr,scrollPaddingTop:scr-pt,scrollPaddingBottom:scr-pb,scrollSnapAlign:scr-sa,scrollSnapStop:scrs-s,scrollSnapType:scrs-t,scrollSnapStrictness:scrs-strt,scrollSnapMargin:scrs-m,scrollSnapMarginTop:scrs-mt,scrollSnapMarginBottom:scrs-mb,scrollSnapMarginLeft:scrs-ml,scrollSnapMarginRight:scrs-mr,scrollSnapCoordinate:scrs-c,scrollSnapDestination:scrs-d,scrollSnapPointsX:scrs-px,scrollSnapPointsY:scrs-py,scrollSnapTypeX:scrs-tx,scrollSnapTypeY:scrs-ty,scrollTimeline:scrtl,scrollTimelineAxis:scrtl-a,scrollTimelineName:scrtl-n,touchAction:tch-a,userSelect:us,overflow:ov,overflowWrap:ov-wrap,overflowX:ov-x,overflowY:ov-y,overflowAnchor:ov-a,overflowBlock:ov-b,overflowInline:ov-i,overflowClipBox:ovcp-bx,overflowClipMargin:ovcp-m,overscrollBehaviorBlock:ovs-bb,overscrollBehaviorInline:ovs-bi,fill:fill,stroke:stk,strokeWidth:stk-w,strokeDasharray:stk-dsh,strokeDashoffset:stk-do,strokeLinecap:stk-lc,strokeLinejoin:stk-lj,strokeMiterlimit:stk-ml,strokeOpacity:stk-op,srOnly:sr,debug:debug,appearance:ap,backfaceVisibility:bfv,clipPath:cp-path,hyphens:hy,mask:msk,maskImage:msk-i,maskSize:msk-s,textSizeAdjust:txt-adj,container:cq,containerName:cq-n,containerType:cq-t,cursor:cursor,textStyle:textStyle";
|
|
525
|
+
const classNameByProp = new Map();
|
|
526
|
+
const shorthands = new Map();
|
|
527
|
+
utilities.split(',').forEach((utility)=>{
|
|
528
|
+
const [prop, meta] = utility.split(':');
|
|
529
|
+
const [className, ...shorthandList] = meta.split('/');
|
|
530
|
+
classNameByProp.set(prop, className);
|
|
531
|
+
if (shorthandList.length) shorthandList.forEach((shorthand)=>{
|
|
532
|
+
shorthands.set('1' === shorthand ? className : shorthand, prop);
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
const css_resolveShorthand = (prop)=>shorthands.get(prop) || prop;
|
|
536
|
+
const css_context = {
|
|
537
|
+
conditions: {
|
|
538
|
+
shift: sortConditions,
|
|
539
|
+
finalize: finalizeConditions,
|
|
540
|
+
breakpoints: {
|
|
541
|
+
keys: [
|
|
542
|
+
"base",
|
|
543
|
+
"sm",
|
|
544
|
+
"md",
|
|
545
|
+
"lg",
|
|
546
|
+
"xl",
|
|
547
|
+
"2xl"
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
utility: {
|
|
552
|
+
prefix: "leve",
|
|
553
|
+
transform: (prop, value)=>{
|
|
554
|
+
const key = css_resolveShorthand(prop);
|
|
555
|
+
const propKey = classNameByProp.get(key) || hypenateProperty(key);
|
|
556
|
+
return {
|
|
557
|
+
className: `${propKey}_${withoutSpace(value)}`
|
|
558
|
+
};
|
|
559
|
+
},
|
|
560
|
+
hasShorthand: true,
|
|
561
|
+
toHash: (path, hashFn)=>hashFn(path.join(":")),
|
|
562
|
+
resolveShorthand: css_resolveShorthand
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
const cssFn = createCss(css_context);
|
|
566
|
+
const css_css = (...styles)=>cssFn(css_mergeCss(...styles));
|
|
567
|
+
css_css.raw = (...styles)=>css_mergeCss(...styles);
|
|
568
|
+
const { mergeCss: css_mergeCss, assignCss: css_assignCss } = createMergeCss(css_context);
|
|
569
|
+
function getCompoundVariantCss(compoundVariants, variantMap) {
|
|
570
|
+
let result = {};
|
|
571
|
+
compoundVariants.forEach((compoundVariant)=>{
|
|
572
|
+
const isMatching = Object.entries(compoundVariant).every(([key, value])=>{
|
|
573
|
+
if ('css' === key) return true;
|
|
574
|
+
const values = Array.isArray(value) ? value : [
|
|
575
|
+
value
|
|
576
|
+
];
|
|
577
|
+
return values.some((value)=>variantMap[key] === value);
|
|
578
|
+
});
|
|
579
|
+
if (isMatching) result = css_mergeCss(result, compoundVariant.css);
|
|
580
|
+
});
|
|
581
|
+
return result;
|
|
582
|
+
}
|
|
583
|
+
function assertCompoundVariant(name, compoundVariants, variants, prop) {
|
|
584
|
+
if (compoundVariants.length > 0 && 'object' == typeof variants?.[prop]) throw new Error(`[recipe:${name}:${prop}] Conditions are not supported when using compound variants.`);
|
|
585
|
+
}
|
|
586
|
+
function cx_cx() {
|
|
587
|
+
let str = '', i = 0, arg;
|
|
588
|
+
for(; i < arguments.length;)if ((arg = arguments[i++]) && 'string' == typeof arg) {
|
|
589
|
+
str && (str += ' ');
|
|
590
|
+
str += arg;
|
|
591
|
+
}
|
|
592
|
+
return str;
|
|
593
|
+
}
|
|
594
|
+
const createRecipe = (name, defaultVariants, compoundVariants)=>{
|
|
595
|
+
const getVariantProps = (variants)=>({
|
|
596
|
+
[name]: '__ignore__',
|
|
597
|
+
...defaultVariants,
|
|
598
|
+
...helpers_compact(variants)
|
|
599
|
+
});
|
|
600
|
+
const recipeFn = (variants, withCompoundVariants = true)=>{
|
|
601
|
+
const transform = (prop, value)=>{
|
|
602
|
+
assertCompoundVariant(name, compoundVariants, variants, prop);
|
|
603
|
+
if ('__ignore__' === value) return {
|
|
604
|
+
className: name
|
|
605
|
+
};
|
|
606
|
+
value = withoutSpace(value);
|
|
607
|
+
return {
|
|
608
|
+
className: `${name}--${prop}_${value}`
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
const recipeCss = createCss({
|
|
612
|
+
conditions: {
|
|
613
|
+
shift: sortConditions,
|
|
614
|
+
finalize: finalizeConditions,
|
|
615
|
+
breakpoints: {
|
|
616
|
+
keys: [
|
|
617
|
+
"base",
|
|
618
|
+
"sm",
|
|
619
|
+
"md",
|
|
620
|
+
"lg",
|
|
621
|
+
"xl",
|
|
622
|
+
"2xl"
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
utility: {
|
|
627
|
+
prefix: "leve",
|
|
628
|
+
toHash: (path, hashFn)=>hashFn(path.join(":")),
|
|
629
|
+
transform
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
const recipeStyles = getVariantProps(variants);
|
|
633
|
+
if (withCompoundVariants) {
|
|
634
|
+
const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles);
|
|
635
|
+
return cx_cx(recipeCss(recipeStyles), css_css(compoundVariantStyles));
|
|
636
|
+
}
|
|
637
|
+
return recipeCss(recipeStyles);
|
|
638
|
+
};
|
|
639
|
+
return {
|
|
640
|
+
recipeFn,
|
|
641
|
+
getVariantProps,
|
|
642
|
+
__getCompoundVariantCss__: (variants)=>getCompoundVariantCss(compoundVariants, getVariantProps(variants))
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
const mergeRecipes = (recipeA, recipeB)=>{
|
|
646
|
+
if (recipeA && !recipeB) return recipeA;
|
|
647
|
+
if (!recipeA && recipeB) return recipeB;
|
|
648
|
+
const recipeFn = (...args)=>cx_cx(recipeA(...args), recipeB(...args));
|
|
649
|
+
const variantKeys = helpers_uniq(recipeA.variantKeys, recipeB.variantKeys);
|
|
650
|
+
const variantMap = variantKeys.reduce((acc, key)=>{
|
|
651
|
+
acc[key] = helpers_uniq(recipeA.variantMap[key], recipeB.variantMap[key]);
|
|
652
|
+
return acc;
|
|
653
|
+
}, {});
|
|
654
|
+
return Object.assign(recipeFn, {
|
|
655
|
+
__recipe__: true,
|
|
656
|
+
__name__: `${recipeA.__name__} ${recipeB.__name__}`,
|
|
657
|
+
raw: (props)=>props,
|
|
658
|
+
variantKeys,
|
|
659
|
+
variantMap,
|
|
660
|
+
splitVariantProps (props) {
|
|
661
|
+
return helpers_splitProps(props, variantKeys);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
};
|
|
665
|
+
const textRecipeFn = /* @__PURE__ */ createRecipe('leve-text', {
|
|
666
|
+
color: "dark",
|
|
667
|
+
size: "h6",
|
|
668
|
+
bold: false
|
|
669
|
+
}, []);
|
|
670
|
+
const textRecipeVariantMap = {
|
|
671
|
+
color: [
|
|
672
|
+
"primary",
|
|
673
|
+
"secondary",
|
|
674
|
+
"dark",
|
|
675
|
+
"light",
|
|
676
|
+
"purple",
|
|
677
|
+
"orange",
|
|
678
|
+
"red",
|
|
679
|
+
"yellow",
|
|
680
|
+
"sand",
|
|
681
|
+
"petrol",
|
|
682
|
+
"olive",
|
|
683
|
+
"lead",
|
|
684
|
+
"pink",
|
|
685
|
+
"neutral",
|
|
686
|
+
"green"
|
|
687
|
+
],
|
|
688
|
+
size: [
|
|
689
|
+
"xxs",
|
|
690
|
+
"xs",
|
|
691
|
+
"sm",
|
|
692
|
+
"md",
|
|
693
|
+
"lg",
|
|
694
|
+
"h6",
|
|
695
|
+
"h5",
|
|
696
|
+
"h4",
|
|
697
|
+
"h3",
|
|
698
|
+
"h2",
|
|
699
|
+
"h1"
|
|
700
|
+
],
|
|
701
|
+
bold: [
|
|
702
|
+
"true",
|
|
703
|
+
"false"
|
|
704
|
+
],
|
|
705
|
+
truncate: [
|
|
706
|
+
"true",
|
|
707
|
+
"false"
|
|
708
|
+
]
|
|
709
|
+
};
|
|
710
|
+
const textRecipeVariantKeys = Object.keys(textRecipeVariantMap);
|
|
711
|
+
const textRecipe = /* @__PURE__ */ Object.assign(helpers_memo(textRecipeFn.recipeFn), {
|
|
712
|
+
__recipe__: true,
|
|
713
|
+
__name__: 'textRecipe',
|
|
714
|
+
__getCompoundVariantCss__: textRecipeFn.__getCompoundVariantCss__,
|
|
715
|
+
raw: (props)=>props,
|
|
716
|
+
variantKeys: textRecipeVariantKeys,
|
|
717
|
+
variantMap: textRecipeVariantMap,
|
|
718
|
+
merge (recipe) {
|
|
719
|
+
return mergeRecipes(this, recipe);
|
|
720
|
+
},
|
|
721
|
+
splitVariantProps (props) {
|
|
722
|
+
return helpers_splitProps(props, textRecipeVariantKeys);
|
|
723
|
+
},
|
|
724
|
+
getVariantProps: textRecipeFn.getVariantProps
|
|
725
|
+
});
|
|
726
|
+
const linkRecipeFn = /* @__PURE__ */ createRecipe('leve-link', {
|
|
727
|
+
color: "primary"
|
|
728
|
+
}, []);
|
|
729
|
+
const linkRecipeVariantMap = {
|
|
730
|
+
color: [
|
|
731
|
+
"primary",
|
|
732
|
+
"secondary",
|
|
733
|
+
"dark",
|
|
734
|
+
"light",
|
|
735
|
+
"purple",
|
|
736
|
+
"orange",
|
|
737
|
+
"red",
|
|
738
|
+
"yellow",
|
|
739
|
+
"sand",
|
|
740
|
+
"petrol",
|
|
741
|
+
"olive",
|
|
742
|
+
"lead",
|
|
743
|
+
"pink",
|
|
744
|
+
"neutral",
|
|
745
|
+
"green"
|
|
746
|
+
],
|
|
747
|
+
disabled: [
|
|
748
|
+
"true"
|
|
749
|
+
]
|
|
750
|
+
};
|
|
751
|
+
const linkRecipeVariantKeys = Object.keys(linkRecipeVariantMap);
|
|
752
|
+
const linkRecipe = /* @__PURE__ */ Object.assign(helpers_memo(linkRecipeFn.recipeFn), {
|
|
753
|
+
__recipe__: true,
|
|
754
|
+
__name__: 'linkRecipe',
|
|
755
|
+
__getCompoundVariantCss__: linkRecipeFn.__getCompoundVariantCss__,
|
|
756
|
+
raw: (props)=>props,
|
|
757
|
+
variantKeys: linkRecipeVariantKeys,
|
|
758
|
+
variantMap: linkRecipeVariantMap,
|
|
759
|
+
merge (recipe) {
|
|
760
|
+
return mergeRecipes(this, recipe);
|
|
761
|
+
},
|
|
762
|
+
splitVariantProps (props) {
|
|
763
|
+
return helpers_splitProps(props, linkRecipeVariantKeys);
|
|
764
|
+
},
|
|
765
|
+
getVariantProps: linkRecipeFn.getVariantProps
|
|
766
|
+
});
|
|
767
|
+
const buttonRecipeFn = /* @__PURE__ */ createRecipe('leve-button', {
|
|
768
|
+
variant: "solid",
|
|
769
|
+
color: "primary",
|
|
770
|
+
size: "md"
|
|
771
|
+
}, [
|
|
772
|
+
{
|
|
773
|
+
size: "sm",
|
|
774
|
+
icon: true,
|
|
775
|
+
css: {
|
|
776
|
+
width: "40px"
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
size: "md",
|
|
781
|
+
icon: true,
|
|
782
|
+
css: {
|
|
783
|
+
width: "48px",
|
|
784
|
+
_icon: {
|
|
785
|
+
width: "30px",
|
|
786
|
+
height: "30px"
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
]);
|
|
791
|
+
const buttonRecipeVariantMap = {
|
|
792
|
+
variant: [
|
|
793
|
+
"solid",
|
|
794
|
+
"outline",
|
|
795
|
+
"ghost"
|
|
796
|
+
],
|
|
797
|
+
size: [
|
|
798
|
+
"sm",
|
|
799
|
+
"md"
|
|
800
|
+
],
|
|
801
|
+
color: [
|
|
802
|
+
"primary",
|
|
803
|
+
"secondary",
|
|
804
|
+
"dark",
|
|
805
|
+
"light",
|
|
806
|
+
"purple",
|
|
807
|
+
"orange",
|
|
808
|
+
"red",
|
|
809
|
+
"yellow",
|
|
810
|
+
"sand",
|
|
811
|
+
"petrol",
|
|
812
|
+
"olive",
|
|
813
|
+
"lead",
|
|
814
|
+
"pink",
|
|
815
|
+
"neutral",
|
|
816
|
+
"green"
|
|
817
|
+
],
|
|
818
|
+
icon: [
|
|
819
|
+
"true"
|
|
820
|
+
]
|
|
821
|
+
};
|
|
822
|
+
const buttonRecipeVariantKeys = Object.keys(buttonRecipeVariantMap);
|
|
823
|
+
const buttonRecipe = /* @__PURE__ */ Object.assign(helpers_memo(buttonRecipeFn.recipeFn), {
|
|
824
|
+
__recipe__: true,
|
|
825
|
+
__name__: 'buttonRecipe',
|
|
826
|
+
__getCompoundVariantCss__: buttonRecipeFn.__getCompoundVariantCss__,
|
|
827
|
+
raw: (props)=>props,
|
|
828
|
+
variantKeys: buttonRecipeVariantKeys,
|
|
829
|
+
variantMap: buttonRecipeVariantMap,
|
|
830
|
+
merge (recipe) {
|
|
831
|
+
return mergeRecipes(this, recipe);
|
|
832
|
+
},
|
|
833
|
+
splitVariantProps (props) {
|
|
834
|
+
return helpers_splitProps(props, buttonRecipeVariantKeys);
|
|
835
|
+
},
|
|
836
|
+
getVariantProps: buttonRecipeFn.getVariantProps
|
|
837
|
+
});
|
|
838
|
+
const jsx_runtime = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
839
|
+
const Button = (props)=>{
|
|
840
|
+
const { children, type = 'button', className, rightIcon, leftIcon, color, icon, size, variant, ...rest } = props;
|
|
841
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)("button", {
|
|
842
|
+
...rest,
|
|
843
|
+
type: type,
|
|
844
|
+
className: clsx(buttonRecipe({
|
|
845
|
+
color,
|
|
846
|
+
icon,
|
|
847
|
+
size,
|
|
848
|
+
variant
|
|
849
|
+
}), className),
|
|
850
|
+
children: [
|
|
851
|
+
!icon && leftIcon,
|
|
852
|
+
children,
|
|
853
|
+
!icon && rightIcon
|
|
854
|
+
]
|
|
855
|
+
});
|
|
856
|
+
};
|
|
857
|
+
const Text = (props)=>{
|
|
858
|
+
const { children, className, tag = 'h1', bold, color, size, truncate, ...rest } = props;
|
|
859
|
+
const Tag = tag;
|
|
860
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(Tag, {
|
|
861
|
+
...rest,
|
|
862
|
+
className: clsx(textRecipe({
|
|
863
|
+
bold,
|
|
864
|
+
color,
|
|
865
|
+
size,
|
|
866
|
+
truncate
|
|
867
|
+
}), className),
|
|
868
|
+
children: children
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
const boxConfig = {
|
|
872
|
+
transform (props) {
|
|
873
|
+
return props;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
const getBoxStyle = (styles = {})=>{
|
|
877
|
+
const _styles = getPatternStyles(boxConfig, styles);
|
|
878
|
+
return boxConfig.transform(_styles, patternFns);
|
|
879
|
+
};
|
|
880
|
+
const box = (styles)=>css_css(getBoxStyle(styles));
|
|
881
|
+
box.raw = getBoxStyle;
|
|
882
|
+
const flexConfig = {
|
|
883
|
+
transform (props) {
|
|
884
|
+
const { direction, align, justify, wrap: wrap2, basis, grow, shrink, ...rest } = props;
|
|
885
|
+
return {
|
|
886
|
+
display: "flex",
|
|
887
|
+
flexDirection: direction,
|
|
888
|
+
alignItems: align,
|
|
889
|
+
justifyContent: justify,
|
|
890
|
+
flexWrap: wrap2,
|
|
891
|
+
flexBasis: basis,
|
|
892
|
+
flexGrow: grow,
|
|
893
|
+
flexShrink: shrink,
|
|
894
|
+
...rest
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
const getFlexStyle = (styles = {})=>{
|
|
899
|
+
const _styles = getPatternStyles(flexConfig, styles);
|
|
900
|
+
return flexConfig.transform(_styles, patternFns);
|
|
901
|
+
};
|
|
902
|
+
const flex = (styles)=>css_css(getFlexStyle(styles));
|
|
903
|
+
flex.raw = getFlexStyle;
|
|
904
|
+
const stackConfig = {
|
|
905
|
+
transform (props) {
|
|
906
|
+
const { align, justify, direction, gap, ...rest } = props;
|
|
907
|
+
return {
|
|
908
|
+
display: "flex",
|
|
909
|
+
flexDirection: direction,
|
|
910
|
+
alignItems: align,
|
|
911
|
+
justifyContent: justify,
|
|
912
|
+
gap,
|
|
913
|
+
...rest
|
|
914
|
+
};
|
|
915
|
+
},
|
|
916
|
+
defaultValues: {
|
|
917
|
+
direction: 'column',
|
|
918
|
+
gap: '8px'
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
const getStackStyle = (styles = {})=>{
|
|
922
|
+
const _styles = getPatternStyles(stackConfig, styles);
|
|
923
|
+
return stackConfig.transform(_styles, patternFns);
|
|
924
|
+
};
|
|
925
|
+
const stack = (styles)=>css_css(getStackStyle(styles));
|
|
926
|
+
stack.raw = getStackStyle;
|
|
927
|
+
const vstackConfig = {
|
|
928
|
+
transform (props) {
|
|
929
|
+
const { justify, gap, ...rest } = props;
|
|
930
|
+
return {
|
|
931
|
+
display: "flex",
|
|
932
|
+
alignItems: "center",
|
|
933
|
+
justifyContent: justify,
|
|
934
|
+
gap,
|
|
935
|
+
flexDirection: "column",
|
|
936
|
+
...rest
|
|
937
|
+
};
|
|
938
|
+
},
|
|
939
|
+
defaultValues: {
|
|
940
|
+
gap: '8px'
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
const getVstackStyle = (styles = {})=>{
|
|
944
|
+
const _styles = getPatternStyles(vstackConfig, styles);
|
|
945
|
+
return vstackConfig.transform(_styles, patternFns);
|
|
946
|
+
};
|
|
947
|
+
const vstack = (styles)=>css_css(getVstackStyle(styles));
|
|
948
|
+
vstack.raw = getVstackStyle;
|
|
949
|
+
const hstackConfig = {
|
|
950
|
+
transform (props) {
|
|
951
|
+
const { justify, gap, ...rest } = props;
|
|
952
|
+
return {
|
|
953
|
+
display: "flex",
|
|
954
|
+
alignItems: "center",
|
|
955
|
+
justifyContent: justify,
|
|
956
|
+
gap,
|
|
957
|
+
flexDirection: "row",
|
|
958
|
+
...rest
|
|
959
|
+
};
|
|
960
|
+
},
|
|
961
|
+
defaultValues: {
|
|
962
|
+
gap: '8px'
|
|
963
|
+
}
|
|
964
|
+
};
|
|
965
|
+
const getHstackStyle = (styles = {})=>{
|
|
966
|
+
const _styles = getPatternStyles(hstackConfig, styles);
|
|
967
|
+
return hstackConfig.transform(_styles, patternFns);
|
|
968
|
+
};
|
|
969
|
+
const hstack = (styles)=>css_css(getHstackStyle(styles));
|
|
970
|
+
hstack.raw = getHstackStyle;
|
|
971
|
+
const spacerConfig = {
|
|
972
|
+
transform (props, { map }) {
|
|
973
|
+
const { size, ...rest } = props;
|
|
974
|
+
return {
|
|
975
|
+
alignSelf: "stretch",
|
|
976
|
+
justifySelf: "stretch",
|
|
977
|
+
flex: map(size, (v)=>null == v ? "1" : `0 0 ${v}`),
|
|
978
|
+
...rest
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
const getSpacerStyle = (styles = {})=>{
|
|
983
|
+
const _styles = getPatternStyles(spacerConfig, styles);
|
|
984
|
+
return spacerConfig.transform(_styles, patternFns);
|
|
985
|
+
};
|
|
986
|
+
const spacer = (styles)=>css_css(getSpacerStyle(styles));
|
|
987
|
+
spacer.raw = getSpacerStyle;
|
|
988
|
+
const squareConfig = {
|
|
989
|
+
transform (props) {
|
|
990
|
+
const { size, ...rest } = props;
|
|
991
|
+
return {
|
|
992
|
+
display: "flex",
|
|
993
|
+
alignItems: "center",
|
|
994
|
+
justifyContent: "center",
|
|
995
|
+
flex: "0 0 auto",
|
|
996
|
+
width: size,
|
|
997
|
+
height: size,
|
|
998
|
+
...rest
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
const getSquareStyle = (styles = {})=>{
|
|
1003
|
+
const _styles = getPatternStyles(squareConfig, styles);
|
|
1004
|
+
return squareConfig.transform(_styles, patternFns);
|
|
1005
|
+
};
|
|
1006
|
+
const square = (styles)=>css_css(getSquareStyle(styles));
|
|
1007
|
+
square.raw = getSquareStyle;
|
|
1008
|
+
const circleConfig = {
|
|
1009
|
+
transform (props) {
|
|
1010
|
+
const { size, ...rest } = props;
|
|
1011
|
+
return {
|
|
1012
|
+
display: "flex",
|
|
1013
|
+
alignItems: "center",
|
|
1014
|
+
justifyContent: "center",
|
|
1015
|
+
flex: "0 0 auto",
|
|
1016
|
+
width: size,
|
|
1017
|
+
height: size,
|
|
1018
|
+
borderRadius: "9999px",
|
|
1019
|
+
...rest
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
};
|
|
1023
|
+
const getCircleStyle = (styles = {})=>{
|
|
1024
|
+
const _styles = getPatternStyles(circleConfig, styles);
|
|
1025
|
+
return circleConfig.transform(_styles, patternFns);
|
|
1026
|
+
};
|
|
1027
|
+
const circle = (styles)=>css_css(getCircleStyle(styles));
|
|
1028
|
+
circle.raw = getCircleStyle;
|
|
1029
|
+
const centerConfig = {
|
|
1030
|
+
transform (props) {
|
|
1031
|
+
const { inline, ...rest } = props;
|
|
1032
|
+
return {
|
|
1033
|
+
display: inline ? "inline-flex" : "flex",
|
|
1034
|
+
alignItems: "center",
|
|
1035
|
+
justifyContent: "center",
|
|
1036
|
+
...rest
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
const getCenterStyle = (styles = {})=>{
|
|
1041
|
+
const _styles = getPatternStyles(centerConfig, styles);
|
|
1042
|
+
return centerConfig.transform(_styles, patternFns);
|
|
1043
|
+
};
|
|
1044
|
+
const center = (styles)=>css_css(getCenterStyle(styles));
|
|
1045
|
+
center.raw = getCenterStyle;
|
|
1046
|
+
const linkOverlayConfig = {
|
|
1047
|
+
transform (props) {
|
|
1048
|
+
return {
|
|
1049
|
+
_before: {
|
|
1050
|
+
content: '""',
|
|
1051
|
+
position: "absolute",
|
|
1052
|
+
inset: "0",
|
|
1053
|
+
zIndex: "0",
|
|
1054
|
+
...props["_before"]
|
|
1055
|
+
},
|
|
1056
|
+
...props
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
const getLinkOverlayStyle = (styles = {})=>{
|
|
1061
|
+
const _styles = getPatternStyles(linkOverlayConfig, styles);
|
|
1062
|
+
return linkOverlayConfig.transform(_styles, patternFns);
|
|
1063
|
+
};
|
|
1064
|
+
const linkOverlay = (styles)=>css_css(getLinkOverlayStyle(styles));
|
|
1065
|
+
linkOverlay.raw = getLinkOverlayStyle;
|
|
1066
|
+
const aspectRatioConfig = {
|
|
1067
|
+
transform (props, { map }) {
|
|
1068
|
+
const { ratio = 4 / 3, ...rest } = props;
|
|
1069
|
+
return {
|
|
1070
|
+
position: "relative",
|
|
1071
|
+
_before: {
|
|
1072
|
+
content: '""',
|
|
1073
|
+
display: "block",
|
|
1074
|
+
height: "0",
|
|
1075
|
+
paddingBottom: map(ratio, (r)=>`${1 / r * 100}%`)
|
|
1076
|
+
},
|
|
1077
|
+
"&>*": {
|
|
1078
|
+
display: "flex",
|
|
1079
|
+
justifyContent: "center",
|
|
1080
|
+
alignItems: "center",
|
|
1081
|
+
overflow: "hidden",
|
|
1082
|
+
position: "absolute",
|
|
1083
|
+
inset: "0",
|
|
1084
|
+
width: "100%",
|
|
1085
|
+
height: "100%"
|
|
1086
|
+
},
|
|
1087
|
+
"&>img, &>video": {
|
|
1088
|
+
objectFit: "cover"
|
|
1089
|
+
},
|
|
1090
|
+
...rest
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
const getAspectRatioStyle = (styles = {})=>{
|
|
1095
|
+
const _styles = getPatternStyles(aspectRatioConfig, styles);
|
|
1096
|
+
return aspectRatioConfig.transform(_styles, patternFns);
|
|
1097
|
+
};
|
|
1098
|
+
const aspectRatio = (styles)=>css_css(getAspectRatioStyle(styles));
|
|
1099
|
+
aspectRatio.raw = getAspectRatioStyle;
|
|
1100
|
+
const gridConfig = {
|
|
1101
|
+
transform (props, { map, isCssUnit }) {
|
|
1102
|
+
const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
|
|
1103
|
+
const getValue = (v)=>isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
|
|
1104
|
+
return {
|
|
1105
|
+
display: "grid",
|
|
1106
|
+
gridTemplateColumns: null != columns ? map(columns, (v)=>`repeat(${v}, minmax(0, 1fr))`) : null != minChildWidth ? map(minChildWidth, (v)=>`repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
|
|
1107
|
+
gap,
|
|
1108
|
+
columnGap,
|
|
1109
|
+
rowGap,
|
|
1110
|
+
...rest
|
|
1111
|
+
};
|
|
1112
|
+
},
|
|
1113
|
+
defaultValues (props) {
|
|
1114
|
+
return {
|
|
1115
|
+
gap: props.columnGap || props.rowGap ? void 0 : "8px"
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
const getGridStyle = (styles = {})=>{
|
|
1120
|
+
const _styles = getPatternStyles(gridConfig, styles);
|
|
1121
|
+
return gridConfig.transform(_styles, patternFns);
|
|
1122
|
+
};
|
|
1123
|
+
const grid = (styles)=>css_css(getGridStyle(styles));
|
|
1124
|
+
grid.raw = getGridStyle;
|
|
1125
|
+
const gridItemConfig = {
|
|
1126
|
+
transform (props, { map }) {
|
|
1127
|
+
const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props;
|
|
1128
|
+
const spanFn = (v)=>"auto" === v ? v : `span ${v}`;
|
|
1129
|
+
return {
|
|
1130
|
+
gridColumn: null != colSpan ? map(colSpan, spanFn) : void 0,
|
|
1131
|
+
gridRow: null != rowSpan ? map(rowSpan, spanFn) : void 0,
|
|
1132
|
+
gridColumnStart: colStart,
|
|
1133
|
+
gridColumnEnd: colEnd,
|
|
1134
|
+
gridRowStart: rowStart,
|
|
1135
|
+
gridRowEnd: rowEnd,
|
|
1136
|
+
...rest
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
const getGridItemStyle = (styles = {})=>{
|
|
1141
|
+
const _styles = getPatternStyles(gridItemConfig, styles);
|
|
1142
|
+
return gridItemConfig.transform(_styles, patternFns);
|
|
1143
|
+
};
|
|
1144
|
+
const gridItem = (styles)=>css_css(getGridItemStyle(styles));
|
|
1145
|
+
gridItem.raw = getGridItemStyle;
|
|
1146
|
+
const wrapConfig = {
|
|
1147
|
+
transform (props) {
|
|
1148
|
+
const { columnGap, rowGap, gap = columnGap || rowGap ? void 0 : "8px", align, justify, ...rest } = props;
|
|
1149
|
+
return {
|
|
1150
|
+
display: "flex",
|
|
1151
|
+
flexWrap: "wrap",
|
|
1152
|
+
alignItems: align,
|
|
1153
|
+
justifyContent: justify,
|
|
1154
|
+
gap,
|
|
1155
|
+
columnGap,
|
|
1156
|
+
rowGap,
|
|
1157
|
+
...rest
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
const getWrapStyle = (styles = {})=>{
|
|
1162
|
+
const _styles = getPatternStyles(wrapConfig, styles);
|
|
1163
|
+
return wrapConfig.transform(_styles, patternFns);
|
|
1164
|
+
};
|
|
1165
|
+
const wrap = (styles)=>css_css(getWrapStyle(styles));
|
|
1166
|
+
wrap.raw = getWrapStyle;
|
|
1167
|
+
const containerConfig = {
|
|
1168
|
+
transform (props) {
|
|
1169
|
+
return {
|
|
1170
|
+
position: "relative",
|
|
1171
|
+
maxWidth: "8xl",
|
|
1172
|
+
mx: "auto",
|
|
1173
|
+
px: {
|
|
1174
|
+
base: "4",
|
|
1175
|
+
md: "6",
|
|
1176
|
+
lg: "8"
|
|
1177
|
+
},
|
|
1178
|
+
...props
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
const getContainerStyle = (styles = {})=>{
|
|
1183
|
+
const _styles = getPatternStyles(containerConfig, styles);
|
|
1184
|
+
return containerConfig.transform(_styles, patternFns);
|
|
1185
|
+
};
|
|
1186
|
+
const container = (styles)=>css_css(getContainerStyle(styles));
|
|
1187
|
+
container.raw = getContainerStyle;
|
|
1188
|
+
const dividerConfig = {
|
|
1189
|
+
transform (props, { map }) {
|
|
1190
|
+
const { orientation, thickness, color, ...rest } = props;
|
|
1191
|
+
return {
|
|
1192
|
+
"--thickness": thickness,
|
|
1193
|
+
width: map(orientation, (v)=>"vertical" === v ? void 0 : "100%"),
|
|
1194
|
+
height: map(orientation, (v)=>"horizontal" === v ? void 0 : "100%"),
|
|
1195
|
+
borderBlockEndWidth: map(orientation, (v)=>"horizontal" === v ? "var(--thickness)" : void 0),
|
|
1196
|
+
borderInlineEndWidth: map(orientation, (v)=>"vertical" === v ? "var(--thickness)" : void 0),
|
|
1197
|
+
borderColor: color,
|
|
1198
|
+
...rest
|
|
1199
|
+
};
|
|
1200
|
+
},
|
|
1201
|
+
defaultValues: {
|
|
1202
|
+
orientation: 'horizontal',
|
|
1203
|
+
thickness: '1px'
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
const getDividerStyle = (styles = {})=>{
|
|
1207
|
+
const _styles = getPatternStyles(dividerConfig, styles);
|
|
1208
|
+
return dividerConfig.transform(_styles, patternFns);
|
|
1209
|
+
};
|
|
1210
|
+
const divider = (styles)=>css_css(getDividerStyle(styles));
|
|
1211
|
+
divider.raw = getDividerStyle;
|
|
1212
|
+
const floatConfig = {
|
|
1213
|
+
transform (props, { map }) {
|
|
1214
|
+
const { offset, offsetX, offsetY, placement, ...rest } = props;
|
|
1215
|
+
return {
|
|
1216
|
+
display: "inline-flex",
|
|
1217
|
+
justifyContent: "center",
|
|
1218
|
+
alignItems: "center",
|
|
1219
|
+
position: "absolute",
|
|
1220
|
+
insetBlockStart: map(placement, (v)=>{
|
|
1221
|
+
const [side] = v.split("-");
|
|
1222
|
+
const map2 = {
|
|
1223
|
+
top: offsetY,
|
|
1224
|
+
middle: "50%",
|
|
1225
|
+
bottom: "auto"
|
|
1226
|
+
};
|
|
1227
|
+
return map2[side];
|
|
1228
|
+
}),
|
|
1229
|
+
insetBlockEnd: map(placement, (v)=>{
|
|
1230
|
+
const [side] = v.split("-");
|
|
1231
|
+
const map2 = {
|
|
1232
|
+
top: "auto",
|
|
1233
|
+
middle: "50%",
|
|
1234
|
+
bottom: offsetY
|
|
1235
|
+
};
|
|
1236
|
+
return map2[side];
|
|
1237
|
+
}),
|
|
1238
|
+
insetInlineStart: map(placement, (v)=>{
|
|
1239
|
+
const [, align] = v.split("-");
|
|
1240
|
+
const map2 = {
|
|
1241
|
+
start: offsetX,
|
|
1242
|
+
center: "50%",
|
|
1243
|
+
end: "auto"
|
|
1244
|
+
};
|
|
1245
|
+
return map2[align];
|
|
1246
|
+
}),
|
|
1247
|
+
insetInlineEnd: map(placement, (v)=>{
|
|
1248
|
+
const [, align] = v.split("-");
|
|
1249
|
+
const map2 = {
|
|
1250
|
+
start: "auto",
|
|
1251
|
+
center: "50%",
|
|
1252
|
+
end: offsetX
|
|
1253
|
+
};
|
|
1254
|
+
return map2[align];
|
|
1255
|
+
}),
|
|
1256
|
+
translate: map(placement, (v)=>{
|
|
1257
|
+
const [side, align] = v.split("-");
|
|
1258
|
+
const mapX = {
|
|
1259
|
+
start: "-50%",
|
|
1260
|
+
center: "-50%",
|
|
1261
|
+
end: "50%"
|
|
1262
|
+
};
|
|
1263
|
+
const mapY = {
|
|
1264
|
+
top: "-50%",
|
|
1265
|
+
middle: "-50%",
|
|
1266
|
+
bottom: "50%"
|
|
1267
|
+
};
|
|
1268
|
+
return `${mapX[align]} ${mapY[side]}`;
|
|
1269
|
+
}),
|
|
1270
|
+
...rest
|
|
1271
|
+
};
|
|
1272
|
+
},
|
|
1273
|
+
defaultValues (props) {
|
|
1274
|
+
const offset = props.offset || "0";
|
|
1275
|
+
return {
|
|
1276
|
+
offset,
|
|
1277
|
+
offsetX: offset,
|
|
1278
|
+
offsetY: offset,
|
|
1279
|
+
placement: "top-end"
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
};
|
|
1283
|
+
const getFloatStyle = (styles = {})=>{
|
|
1284
|
+
const _styles = getPatternStyles(floatConfig, styles);
|
|
1285
|
+
return floatConfig.transform(_styles, patternFns);
|
|
1286
|
+
};
|
|
1287
|
+
const float_float = (styles)=>css_css(getFloatStyle(styles));
|
|
1288
|
+
float_float.raw = getFloatStyle;
|
|
1289
|
+
const bleedConfig = {
|
|
1290
|
+
transform (props, { map, isCssUnit, isCssVar }) {
|
|
1291
|
+
const { inline, block, ...rest } = props;
|
|
1292
|
+
const valueFn = (v)=>isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
|
|
1293
|
+
return {
|
|
1294
|
+
"--bleed-x": map(inline, valueFn),
|
|
1295
|
+
"--bleed-y": map(block, valueFn),
|
|
1296
|
+
marginInline: "calc(var(--bleed-x, 0) * -1)",
|
|
1297
|
+
marginBlock: "calc(var(--bleed-y, 0) * -1)",
|
|
1298
|
+
...rest
|
|
1299
|
+
};
|
|
1300
|
+
},
|
|
1301
|
+
defaultValues: {
|
|
1302
|
+
inline: '0',
|
|
1303
|
+
block: '0'
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
const getBleedStyle = (styles = {})=>{
|
|
1307
|
+
const _styles = getPatternStyles(bleedConfig, styles);
|
|
1308
|
+
return bleedConfig.transform(_styles, patternFns);
|
|
1309
|
+
};
|
|
1310
|
+
const bleed = (styles)=>css_css(getBleedStyle(styles));
|
|
1311
|
+
bleed.raw = getBleedStyle;
|
|
1312
|
+
const visuallyHiddenConfig = {
|
|
1313
|
+
transform (props) {
|
|
1314
|
+
return {
|
|
1315
|
+
srOnly: true,
|
|
1316
|
+
...props
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
const getVisuallyHiddenStyle = (styles = {})=>{
|
|
1321
|
+
const _styles = getPatternStyles(visuallyHiddenConfig, styles);
|
|
1322
|
+
return visuallyHiddenConfig.transform(_styles, patternFns);
|
|
1323
|
+
};
|
|
1324
|
+
const visuallyHidden = (styles)=>css_css(getVisuallyHiddenStyle(styles));
|
|
1325
|
+
visuallyHidden.raw = getVisuallyHiddenStyle;
|
|
1326
|
+
const cqConfig = {
|
|
1327
|
+
transform (props) {
|
|
1328
|
+
const { name, type, ...rest } = props;
|
|
1329
|
+
return {
|
|
1330
|
+
containerType: type,
|
|
1331
|
+
containerName: name,
|
|
1332
|
+
...rest
|
|
1333
|
+
};
|
|
1334
|
+
},
|
|
1335
|
+
defaultValues: {
|
|
1336
|
+
type: 'inline-size'
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
const getCqStyle = (styles = {})=>{
|
|
1340
|
+
const _styles = getPatternStyles(cqConfig, styles);
|
|
1341
|
+
return cqConfig.transform(_styles, patternFns);
|
|
1342
|
+
};
|
|
1343
|
+
const cq = (styles)=>css_css(getCqStyle(styles));
|
|
1344
|
+
cq.raw = getCqStyle;
|
|
1345
|
+
const Flex = (props)=>{
|
|
1346
|
+
const { children, className, ...variants } = props;
|
|
1347
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
1348
|
+
className: clsx(flex(variants), className),
|
|
1349
|
+
children: children
|
|
1350
|
+
});
|
|
1351
|
+
};
|
|
1352
|
+
const Link = (props)=>{
|
|
1353
|
+
const { children, href, className, leftIcon, rightIcon, color, disabled, ...rest } = props;
|
|
1354
|
+
function handleClick(e) {
|
|
1355
|
+
if (disabled) {
|
|
1356
|
+
e.preventDefault();
|
|
1357
|
+
e.stopPropagation();
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
function handleKeyDown(e) {
|
|
1361
|
+
if (disabled) {
|
|
1362
|
+
e.preventDefault();
|
|
1363
|
+
e.stopPropagation();
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
1367
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsxs)("a", {
|
|
1368
|
+
href: href,
|
|
1369
|
+
onClick: handleClick,
|
|
1370
|
+
onKeyDown: handleKeyDown,
|
|
1371
|
+
tabIndex: disabled ? -1 : 1,
|
|
1372
|
+
...rest,
|
|
1373
|
+
className: clsx(linkRecipe({
|
|
1374
|
+
color,
|
|
1375
|
+
disabled
|
|
1376
|
+
}), className),
|
|
1377
|
+
children: [
|
|
1378
|
+
leftIcon,
|
|
1379
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)("span", {
|
|
1380
|
+
children: children
|
|
1381
|
+
}),
|
|
1382
|
+
rightIcon
|
|
1383
|
+
]
|
|
1384
|
+
})
|
|
1385
|
+
});
|
|
1386
|
+
};
|
|
1387
|
+
export { Button, Flex, Link, Text };
|