@vinyasa/button 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/button.cjs +274 -247
- package/dist/cjs/button.css +4 -2
- package/dist/cjs/index.cjs +27 -13
- package/dist/cjs/index.css +4 -2
- package/dist/esm/button.css +4 -2
- package/dist/esm/button.js +15 -10
- package/dist/esm/components/button/Button.d.ts +7 -2
- package/dist/esm/components/button/index.d.ts +3 -2
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/package.json +5 -5
package/dist/cjs/button.cjs
CHANGED
|
@@ -1,5 +1,267 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
639 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
+
a: ()=>ButtonIcon,
|
|
6
|
+
A: ()=>button_Button
|
|
7
|
+
});
|
|
8
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
9
|
+
const external_react_namespaceObject = require("react");
|
|
10
|
+
function toPrimitive(t, r) {
|
|
11
|
+
if ("object" != typeof t || !t) return t;
|
|
12
|
+
var e = t[Symbol.toPrimitive];
|
|
13
|
+
if (void 0 !== e) {
|
|
14
|
+
var i = e.call(t, r || "default");
|
|
15
|
+
if ("object" != typeof i) return i;
|
|
16
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
17
|
+
}
|
|
18
|
+
return ("string" === r ? String : Number)(t);
|
|
19
|
+
}
|
|
20
|
+
function toPropertyKey(t) {
|
|
21
|
+
var i = toPrimitive(t, "string");
|
|
22
|
+
return "symbol" == typeof i ? i : String(i);
|
|
23
|
+
}
|
|
24
|
+
function _defineProperty(obj, key, value) {
|
|
25
|
+
key = toPropertyKey(key);
|
|
26
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
27
|
+
value: value,
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true
|
|
31
|
+
});
|
|
32
|
+
else obj[key] = value;
|
|
33
|
+
return obj;
|
|
34
|
+
}
|
|
35
|
+
function createRuntimeFn_62c9670f_esm_ownKeys(e, r) {
|
|
36
|
+
var t = Object.keys(e);
|
|
37
|
+
if (Object.getOwnPropertySymbols) {
|
|
38
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
39
|
+
r && (o = o.filter(function(r) {
|
|
40
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
41
|
+
})), t.push.apply(t, o);
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
}
|
|
45
|
+
function _objectSpread2(e) {
|
|
46
|
+
for(var r = 1; r < arguments.length; r++){
|
|
47
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
48
|
+
r % 2 ? createRuntimeFn_62c9670f_esm_ownKeys(Object(t), !0).forEach(function(r) {
|
|
49
|
+
_defineProperty(e, r, t[r]);
|
|
50
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : createRuntimeFn_62c9670f_esm_ownKeys(Object(t)).forEach(function(r) {
|
|
51
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return e;
|
|
55
|
+
}
|
|
56
|
+
function mapValues(input, fn) {
|
|
57
|
+
var result = {};
|
|
58
|
+
for(var _key in input)result[_key] = fn(input[_key], _key);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants)=>{
|
|
62
|
+
for (var key of Object.keys(compoundCheck)){
|
|
63
|
+
var _selections$key;
|
|
64
|
+
if (compoundCheck[key] !== (null != (_selections$key = selections[key]) ? _selections$key : defaultVariants[key])) return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
};
|
|
68
|
+
var createRuntimeFn = (config)=>{
|
|
69
|
+
var runtimeFn = (options)=>{
|
|
70
|
+
var className = config.defaultClassName;
|
|
71
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
72
|
+
for(var variantName in selections){
|
|
73
|
+
var _selections$variantNa;
|
|
74
|
+
var variantSelection = null != (_selections$variantNa = selections[variantName]) ? _selections$variantNa : config.defaultVariants[variantName];
|
|
75
|
+
if (null != variantSelection) {
|
|
76
|
+
var selection = variantSelection;
|
|
77
|
+
if ('boolean' == typeof selection) selection = true === selection ? 'true' : 'false';
|
|
78
|
+
var selectionClassName = config.variantClassNames[variantName][selection];
|
|
79
|
+
if (selectionClassName) className += ' ' + selectionClassName;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants)if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) className += ' ' + compoundClassName;
|
|
83
|
+
return className;
|
|
84
|
+
};
|
|
85
|
+
runtimeFn.variants = ()=>Object.keys(config.variantClassNames);
|
|
86
|
+
runtimeFn.classNames = {
|
|
87
|
+
get base () {
|
|
88
|
+
return config.defaultClassName.split(' ')[0];
|
|
89
|
+
},
|
|
90
|
+
get variants () {
|
|
91
|
+
return mapValues(config.variantClassNames, (classNames)=>mapValues(classNames, (className)=>className.split(' ')[0]));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return runtimeFn;
|
|
95
|
+
};
|
|
96
|
+
var Button_css_button = createRuntimeFn({
|
|
97
|
+
defaultClassName: '_1bwnrav0',
|
|
98
|
+
variantClassNames: {
|
|
99
|
+
variant: {
|
|
100
|
+
primary: '_1bwnrav1',
|
|
101
|
+
secondary: '_1bwnrav2',
|
|
102
|
+
tertiary: '_1bwnrav3',
|
|
103
|
+
danger: '_1bwnrav4',
|
|
104
|
+
outline: '_1bwnrav5',
|
|
105
|
+
ghost: '_1bwnrav6'
|
|
106
|
+
},
|
|
107
|
+
size: {
|
|
108
|
+
sm: '_1bwnrav7',
|
|
109
|
+
md: '_1bwnrav8',
|
|
110
|
+
lg: '_1bwnrav9'
|
|
111
|
+
},
|
|
112
|
+
radius: {
|
|
113
|
+
sm: '_1bwnrava',
|
|
114
|
+
md: '_1bwnravb',
|
|
115
|
+
full: '_1bwnravc'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
defaultVariants: {
|
|
119
|
+
variant: 'primary',
|
|
120
|
+
size: 'md',
|
|
121
|
+
radius: 'full'
|
|
122
|
+
},
|
|
123
|
+
compoundVariants: []
|
|
124
|
+
});
|
|
125
|
+
var spinner = '_18kjv2i1';
|
|
126
|
+
const Spinner = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
127
|
+
className: spinner,
|
|
128
|
+
"aria-hidden": "true"
|
|
129
|
+
});
|
|
130
|
+
const button_Spinner = Spinner;
|
|
131
|
+
function _define_property(obj, key, value) {
|
|
132
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
133
|
+
value: value,
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true,
|
|
136
|
+
writable: true
|
|
137
|
+
});
|
|
138
|
+
else obj[key] = value;
|
|
139
|
+
return obj;
|
|
140
|
+
}
|
|
141
|
+
function _object_spread(target) {
|
|
142
|
+
for(var i = 1; i < arguments.length; i++){
|
|
143
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
144
|
+
var ownKeys = Object.keys(source);
|
|
145
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
146
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
147
|
+
}));
|
|
148
|
+
ownKeys.forEach(function(key) {
|
|
149
|
+
_define_property(target, key, source[key]);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return target;
|
|
153
|
+
}
|
|
154
|
+
function Button_ownKeys(object, enumerableOnly) {
|
|
155
|
+
var keys = Object.keys(object);
|
|
156
|
+
if (Object.getOwnPropertySymbols) {
|
|
157
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
158
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
159
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
160
|
+
});
|
|
161
|
+
keys.push.apply(keys, symbols);
|
|
162
|
+
}
|
|
163
|
+
return keys;
|
|
164
|
+
}
|
|
165
|
+
function _object_spread_props(target, source) {
|
|
166
|
+
source = null != source ? source : {};
|
|
167
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
168
|
+
else Button_ownKeys(Object(source)).forEach(function(key) {
|
|
169
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
170
|
+
});
|
|
171
|
+
return target;
|
|
172
|
+
}
|
|
173
|
+
function _object_without_properties(source, excluded) {
|
|
174
|
+
if (null == source) return {};
|
|
175
|
+
var target = {}, sourceKeys, key, i;
|
|
176
|
+
if ("u" > typeof Reflect && Reflect.ownKeys) {
|
|
177
|
+
sourceKeys = Reflect.ownKeys(Object(source));
|
|
178
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
179
|
+
key = sourceKeys[i];
|
|
180
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
181
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return target;
|
|
185
|
+
}
|
|
186
|
+
target = _object_without_properties_loose(source, excluded);
|
|
187
|
+
if (Object.getOwnPropertySymbols) {
|
|
188
|
+
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
189
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
190
|
+
key = sourceKeys[i];
|
|
191
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
192
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return target;
|
|
197
|
+
}
|
|
198
|
+
function _object_without_properties_loose(source, excluded) {
|
|
199
|
+
if (null == source) return {};
|
|
200
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
201
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
202
|
+
key = sourceKeys[i];
|
|
203
|
+
if (!(excluded.indexOf(key) >= 0)) {
|
|
204
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return target;
|
|
208
|
+
}
|
|
209
|
+
const ButtonIcon = ({ children })=>children;
|
|
210
|
+
ButtonIcon.displayName = 'ButtonIcon';
|
|
211
|
+
const isButtonIcon = (node)=>/*#__PURE__*/ (0, external_react_namespaceObject.isValidElement)(node) && node.type === ButtonIcon;
|
|
212
|
+
const Button = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((_0, _1)=>{
|
|
213
|
+
let _ref = [
|
|
214
|
+
_0,
|
|
215
|
+
_1
|
|
216
|
+
], [_ref1, ..._rest] = _ref, { children, variant, size, radius, loading = false, disabled = false, type = 'button', className } = _ref1, rest = _object_without_properties(_ref1, [
|
|
217
|
+
"children",
|
|
218
|
+
"variant",
|
|
219
|
+
"size",
|
|
220
|
+
"radius",
|
|
221
|
+
"loading",
|
|
222
|
+
"disabled",
|
|
223
|
+
"type",
|
|
224
|
+
"className"
|
|
225
|
+
]), [ref] = _rest;
|
|
226
|
+
const classes = className ? `${Button_css_button({
|
|
227
|
+
variant,
|
|
228
|
+
size,
|
|
229
|
+
radius
|
|
230
|
+
})} ${className}` : Button_css_button({
|
|
231
|
+
variant,
|
|
232
|
+
size,
|
|
233
|
+
radius
|
|
234
|
+
});
|
|
235
|
+
const childArray = external_react_namespaceObject.Children.toArray(children);
|
|
236
|
+
const hasLeadingIcon = isButtonIcon(childArray[0]);
|
|
237
|
+
const content = loading ? [
|
|
238
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_Spinner, {}, "spinner"),
|
|
239
|
+
...childArray.slice(hasLeadingIcon ? 1 : 0).filter((child)=>!isButtonIcon(child))
|
|
240
|
+
] : children;
|
|
241
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", _object_spread_props(_object_spread({
|
|
242
|
+
ref: ref,
|
|
243
|
+
type: type,
|
|
244
|
+
disabled: disabled || loading,
|
|
245
|
+
"aria-busy": loading || void 0,
|
|
246
|
+
className: classes
|
|
247
|
+
}, rest), {
|
|
248
|
+
children: content
|
|
249
|
+
}));
|
|
250
|
+
});
|
|
251
|
+
Button.displayName = 'Button';
|
|
252
|
+
const button_Button = Button;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
var __webpack_module_cache__ = {};
|
|
256
|
+
function __webpack_require__(moduleId) {
|
|
257
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
258
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
259
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
260
|
+
exports: {}
|
|
261
|
+
};
|
|
262
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
263
|
+
return module.exports;
|
|
264
|
+
}
|
|
3
265
|
(()=>{
|
|
4
266
|
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
267
|
var define = (defs, kind)=>{
|
|
@@ -26,255 +288,20 @@ var __webpack_require__ = {};
|
|
|
26
288
|
};
|
|
27
289
|
})();
|
|
28
290
|
var __webpack_exports__ = {};
|
|
29
|
-
|
|
30
|
-
__webpack_require__.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var e = t[Symbol.toPrimitive];
|
|
38
|
-
if (void 0 !== e) {
|
|
39
|
-
var i = e.call(t, r || "default");
|
|
40
|
-
if ("object" != typeof i) return i;
|
|
41
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
42
|
-
}
|
|
43
|
-
return ("string" === r ? String : Number)(t);
|
|
44
|
-
}
|
|
45
|
-
function toPropertyKey(t) {
|
|
46
|
-
var i = toPrimitive(t, "string");
|
|
47
|
-
return "symbol" == typeof i ? i : String(i);
|
|
48
|
-
}
|
|
49
|
-
function _defineProperty(obj, key, value) {
|
|
50
|
-
key = toPropertyKey(key);
|
|
51
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
52
|
-
value: value,
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: true,
|
|
55
|
-
writable: true
|
|
56
|
-
});
|
|
57
|
-
else obj[key] = value;
|
|
58
|
-
return obj;
|
|
59
|
-
}
|
|
60
|
-
function createRuntimeFn_62c9670f_esm_ownKeys(e, r) {
|
|
61
|
-
var t = Object.keys(e);
|
|
62
|
-
if (Object.getOwnPropertySymbols) {
|
|
63
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
64
|
-
r && (o = o.filter(function(r) {
|
|
65
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
66
|
-
})), t.push.apply(t, o);
|
|
67
|
-
}
|
|
68
|
-
return t;
|
|
69
|
-
}
|
|
70
|
-
function _objectSpread2(e) {
|
|
71
|
-
for(var r = 1; r < arguments.length; r++){
|
|
72
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
73
|
-
r % 2 ? createRuntimeFn_62c9670f_esm_ownKeys(Object(t), !0).forEach(function(r) {
|
|
74
|
-
_defineProperty(e, r, t[r]);
|
|
75
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : createRuntimeFn_62c9670f_esm_ownKeys(Object(t)).forEach(function(r) {
|
|
76
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return e;
|
|
80
|
-
}
|
|
81
|
-
function mapValues(input, fn) {
|
|
82
|
-
var result = {};
|
|
83
|
-
for(var _key in input)result[_key] = fn(input[_key], _key);
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
var shouldApplyCompound = (compoundCheck, selections, defaultVariants)=>{
|
|
87
|
-
for (var key of Object.keys(compoundCheck)){
|
|
88
|
-
var _selections$key;
|
|
89
|
-
if (compoundCheck[key] !== (null != (_selections$key = selections[key]) ? _selections$key : defaultVariants[key])) return false;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
};
|
|
93
|
-
var createRuntimeFn = (config)=>{
|
|
94
|
-
var runtimeFn = (options)=>{
|
|
95
|
-
var className = config.defaultClassName;
|
|
96
|
-
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
97
|
-
for(var variantName in selections){
|
|
98
|
-
var _selections$variantNa;
|
|
99
|
-
var variantSelection = null != (_selections$variantNa = selections[variantName]) ? _selections$variantNa : config.defaultVariants[variantName];
|
|
100
|
-
if (null != variantSelection) {
|
|
101
|
-
var selection = variantSelection;
|
|
102
|
-
if ('boolean' == typeof selection) selection = true === selection ? 'true' : 'false';
|
|
103
|
-
var selectionClassName = config.variantClassNames[variantName][selection];
|
|
104
|
-
if (selectionClassName) className += ' ' + selectionClassName;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
for (var [compoundCheck, compoundClassName] of config.compoundVariants)if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) className += ' ' + compoundClassName;
|
|
108
|
-
return className;
|
|
109
|
-
};
|
|
110
|
-
runtimeFn.variants = ()=>Object.keys(config.variantClassNames);
|
|
111
|
-
runtimeFn.classNames = {
|
|
112
|
-
get base () {
|
|
113
|
-
return config.defaultClassName.split(' ')[0];
|
|
114
|
-
},
|
|
115
|
-
get variants () {
|
|
116
|
-
return mapValues(config.variantClassNames, (classNames)=>mapValues(classNames, (className)=>className.split(' ')[0]));
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
return runtimeFn;
|
|
120
|
-
};
|
|
121
|
-
var Button_css_button = createRuntimeFn({
|
|
122
|
-
defaultClassName: '_1bwnrav0',
|
|
123
|
-
variantClassNames: {
|
|
124
|
-
variant: {
|
|
125
|
-
primary: '_1bwnrav1',
|
|
126
|
-
secondary: '_1bwnrav2',
|
|
127
|
-
tertiary: '_1bwnrav3',
|
|
128
|
-
danger: '_1bwnrav4',
|
|
129
|
-
outline: '_1bwnrav5',
|
|
130
|
-
ghost: '_1bwnrav6'
|
|
131
|
-
},
|
|
132
|
-
size: {
|
|
133
|
-
sm: '_1bwnrav7',
|
|
134
|
-
md: '_1bwnrav8',
|
|
135
|
-
lg: '_1bwnrav9'
|
|
136
|
-
},
|
|
137
|
-
radius: {
|
|
138
|
-
sm: '_1bwnrava',
|
|
139
|
-
md: '_1bwnravb',
|
|
140
|
-
full: '_1bwnravc'
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
defaultVariants: {
|
|
144
|
-
variant: 'primary',
|
|
145
|
-
size: 'md',
|
|
146
|
-
radius: 'full'
|
|
147
|
-
},
|
|
148
|
-
compoundVariants: []
|
|
149
|
-
});
|
|
150
|
-
var spinner = '_18kjv2i1';
|
|
151
|
-
const Spinner = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
152
|
-
className: spinner,
|
|
153
|
-
"aria-hidden": "true"
|
|
154
|
-
});
|
|
155
|
-
const button_Spinner = Spinner;
|
|
156
|
-
function _define_property(obj, key, value) {
|
|
157
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
158
|
-
value: value,
|
|
159
|
-
enumerable: true,
|
|
160
|
-
configurable: true,
|
|
161
|
-
writable: true
|
|
162
|
-
});
|
|
163
|
-
else obj[key] = value;
|
|
164
|
-
return obj;
|
|
165
|
-
}
|
|
166
|
-
function _object_spread(target) {
|
|
167
|
-
for(var i = 1; i < arguments.length; i++){
|
|
168
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
169
|
-
var ownKeys = Object.keys(source);
|
|
170
|
-
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
171
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
172
|
-
}));
|
|
173
|
-
ownKeys.forEach(function(key) {
|
|
174
|
-
_define_property(target, key, source[key]);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
return target;
|
|
178
|
-
}
|
|
179
|
-
function Button_ownKeys(object, enumerableOnly) {
|
|
180
|
-
var keys = Object.keys(object);
|
|
181
|
-
if (Object.getOwnPropertySymbols) {
|
|
182
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
183
|
-
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
184
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
185
|
-
});
|
|
186
|
-
keys.push.apply(keys, symbols);
|
|
187
|
-
}
|
|
188
|
-
return keys;
|
|
189
|
-
}
|
|
190
|
-
function _object_spread_props(target, source) {
|
|
191
|
-
source = null != source ? source : {};
|
|
192
|
-
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
193
|
-
else Button_ownKeys(Object(source)).forEach(function(key) {
|
|
194
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
195
|
-
});
|
|
196
|
-
return target;
|
|
197
|
-
}
|
|
198
|
-
function _object_without_properties(source, excluded) {
|
|
199
|
-
if (null == source) return {};
|
|
200
|
-
var target = {}, sourceKeys, key, i;
|
|
201
|
-
if ("u" > typeof Reflect && Reflect.ownKeys) {
|
|
202
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
203
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
204
|
-
key = sourceKeys[i];
|
|
205
|
-
if (!(excluded.indexOf(key) >= 0)) {
|
|
206
|
-
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return target;
|
|
210
|
-
}
|
|
211
|
-
target = _object_without_properties_loose(source, excluded);
|
|
212
|
-
if (Object.getOwnPropertySymbols) {
|
|
213
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
214
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
215
|
-
key = sourceKeys[i];
|
|
216
|
-
if (!(excluded.indexOf(key) >= 0)) {
|
|
217
|
-
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return target;
|
|
222
|
-
}
|
|
223
|
-
function _object_without_properties_loose(source, excluded) {
|
|
224
|
-
if (null == source) return {};
|
|
225
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
226
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
227
|
-
key = sourceKeys[i];
|
|
228
|
-
if (!(excluded.indexOf(key) >= 0)) {
|
|
229
|
-
if (Object.prototype.propertyIsEnumerable.call(source, key)) target[key] = source[key];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return target;
|
|
233
|
-
}
|
|
234
|
-
const Button = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((_0, _1)=>{
|
|
235
|
-
let _ref = [
|
|
236
|
-
_0,
|
|
237
|
-
_1
|
|
238
|
-
], [_ref1, ..._rest] = _ref, { children, variant, size, radius, loading = false, leadingIcon, trailingIcon, disabled = false, type = 'button', className } = _ref1, rest = _object_without_properties(_ref1, [
|
|
239
|
-
"children",
|
|
240
|
-
"variant",
|
|
241
|
-
"size",
|
|
242
|
-
"radius",
|
|
243
|
-
"loading",
|
|
244
|
-
"leadingIcon",
|
|
245
|
-
"trailingIcon",
|
|
246
|
-
"disabled",
|
|
247
|
-
"type",
|
|
248
|
-
"className"
|
|
249
|
-
]), [ref] = _rest;
|
|
250
|
-
const classes = className ? `${Button_css_button({
|
|
251
|
-
variant,
|
|
252
|
-
size,
|
|
253
|
-
radius
|
|
254
|
-
})} ${className}` : Button_css_button({
|
|
255
|
-
variant,
|
|
256
|
-
size,
|
|
257
|
-
radius
|
|
291
|
+
(()=>{
|
|
292
|
+
__webpack_require__.r(__webpack_exports__);
|
|
293
|
+
var _Button__rspack_import_0 = __webpack_require__(639);
|
|
294
|
+
const __rspack_default_export = _Button__rspack_import_0.A;
|
|
295
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
296
|
+
ButtonIcon: ()=>_Button__rspack_import_0.a
|
|
297
|
+
}, {
|
|
298
|
+
default: __rspack_default_export
|
|
258
299
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
type: type,
|
|
262
|
-
disabled: disabled || loading,
|
|
263
|
-
"aria-busy": loading || void 0,
|
|
264
|
-
className: classes
|
|
265
|
-
}, rest), {
|
|
266
|
-
children: [
|
|
267
|
-
loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_Spinner, {}) : leadingIcon,
|
|
268
|
-
children,
|
|
269
|
-
!loading && trailingIcon
|
|
270
|
-
]
|
|
271
|
-
}));
|
|
272
|
-
});
|
|
273
|
-
Button.displayName = 'Button';
|
|
274
|
-
const button_Button = Button;
|
|
275
|
-
const components_button = button_Button;
|
|
300
|
+
})();
|
|
301
|
+
exports.ButtonIcon = __webpack_exports__.ButtonIcon;
|
|
276
302
|
exports["default"] = __webpack_exports__["default"];
|
|
277
303
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
304
|
+
"ButtonIcon",
|
|
278
305
|
"default"
|
|
279
306
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
280
307
|
Object.defineProperty(exports, '__esModule', {
|
package/dist/cjs/button.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
justify-content: center;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--vinyasa-space2);
|
|
5
|
+
font-family: var(--vinyasa-font-family-sans);
|
|
5
6
|
font-weight: var(--vinyasa-font-weight-semibold);
|
|
6
7
|
line-height: var(--vinyasa-line-height-tight);
|
|
7
8
|
cursor: pointer;
|
|
@@ -15,8 +16,9 @@
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
._1bwnrav0:focus-visible {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
border-color: var(--vinyasa-focus);
|
|
20
|
+
box-shadow: 0 0 0 1px var(--vinyasa-focus), 0 0 0 4px color-mix(in srgb, var(--vinyasa-focus) 16%, transparent);
|
|
21
|
+
outline: none;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
._1bwnrav0:disabled {
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
639 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
4
|
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
-
|
|
5
|
+
a: ()=>ButtonIcon,
|
|
6
|
+
A: ()=>button_Button
|
|
6
7
|
});
|
|
7
8
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
8
9
|
const external_react_namespaceObject = require("react");
|
|
@@ -205,18 +206,19 @@ var __webpack_modules__ = {
|
|
|
205
206
|
}
|
|
206
207
|
return target;
|
|
207
208
|
}
|
|
209
|
+
const ButtonIcon = ({ children })=>children;
|
|
210
|
+
ButtonIcon.displayName = 'ButtonIcon';
|
|
211
|
+
const isButtonIcon = (node)=>/*#__PURE__*/ (0, external_react_namespaceObject.isValidElement)(node) && node.type === ButtonIcon;
|
|
208
212
|
const Button = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((_0, _1)=>{
|
|
209
213
|
let _ref = [
|
|
210
214
|
_0,
|
|
211
215
|
_1
|
|
212
|
-
], [_ref1, ..._rest] = _ref, { children, variant, size, radius, loading = false,
|
|
216
|
+
], [_ref1, ..._rest] = _ref, { children, variant, size, radius, loading = false, disabled = false, type = 'button', className } = _ref1, rest = _object_without_properties(_ref1, [
|
|
213
217
|
"children",
|
|
214
218
|
"variant",
|
|
215
219
|
"size",
|
|
216
220
|
"radius",
|
|
217
221
|
"loading",
|
|
218
|
-
"leadingIcon",
|
|
219
|
-
"trailingIcon",
|
|
220
222
|
"disabled",
|
|
221
223
|
"type",
|
|
222
224
|
"className"
|
|
@@ -230,23 +232,31 @@ var __webpack_modules__ = {
|
|
|
230
232
|
size,
|
|
231
233
|
radius
|
|
232
234
|
});
|
|
233
|
-
|
|
235
|
+
const childArray = external_react_namespaceObject.Children.toArray(children);
|
|
236
|
+
const hasLeadingIcon = isButtonIcon(childArray[0]);
|
|
237
|
+
const content = loading ? [
|
|
238
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_Spinner, {}, "spinner"),
|
|
239
|
+
...childArray.slice(hasLeadingIcon ? 1 : 0).filter((child)=>!isButtonIcon(child))
|
|
240
|
+
] : children;
|
|
241
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", _object_spread_props(_object_spread({
|
|
234
242
|
ref: ref,
|
|
235
243
|
type: type,
|
|
236
244
|
disabled: disabled || loading,
|
|
237
245
|
"aria-busy": loading || void 0,
|
|
238
246
|
className: classes
|
|
239
247
|
}, rest), {
|
|
240
|
-
children:
|
|
241
|
-
loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(button_Spinner, {}) : leadingIcon,
|
|
242
|
-
children,
|
|
243
|
-
!loading && trailingIcon
|
|
244
|
-
]
|
|
248
|
+
children: content
|
|
245
249
|
}));
|
|
246
250
|
});
|
|
247
251
|
Button.displayName = 'Button';
|
|
248
252
|
const button_Button = Button;
|
|
249
|
-
|
|
253
|
+
},
|
|
254
|
+
294 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
255
|
+
var _Button__rspack_import_0 = __webpack_require__(639);
|
|
256
|
+
const __rspack_default_export = _Button__rspack_import_0.A;
|
|
257
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
258
|
+
default: __rspack_default_export
|
|
259
|
+
});
|
|
250
260
|
}
|
|
251
261
|
};
|
|
252
262
|
var __webpack_module_cache__ = {};
|
|
@@ -287,16 +297,20 @@ function __webpack_require__(moduleId) {
|
|
|
287
297
|
var __webpack_exports__ = {};
|
|
288
298
|
(()=>{
|
|
289
299
|
__webpack_require__.r(__webpack_exports__);
|
|
290
|
-
var _components_button__rspack_import_0 = __webpack_require__(
|
|
300
|
+
var _components_button__rspack_import_0 = __webpack_require__(294);
|
|
301
|
+
var _components_button__rspack_import_1 = __webpack_require__(639);
|
|
291
302
|
__webpack_require__.d(__webpack_exports__, {
|
|
292
303
|
Button: ()=>_components_button__rspack_import_0["default"],
|
|
304
|
+
ButtonIcon: ()=>_components_button__rspack_import_1.a,
|
|
293
305
|
default: ()=>_components_button__rspack_import_0["default"]
|
|
294
306
|
});
|
|
295
307
|
})();
|
|
296
308
|
exports.Button = __webpack_exports__.Button;
|
|
309
|
+
exports.ButtonIcon = __webpack_exports__.ButtonIcon;
|
|
297
310
|
exports["default"] = __webpack_exports__["default"];
|
|
298
311
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
299
312
|
"Button",
|
|
313
|
+
"ButtonIcon",
|
|
300
314
|
"default"
|
|
301
315
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
302
316
|
Object.defineProperty(exports, '__esModule', {
|
package/dist/cjs/index.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
justify-content: center;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--vinyasa-space2);
|
|
5
|
+
font-family: var(--vinyasa-font-family-sans);
|
|
5
6
|
font-weight: var(--vinyasa-font-weight-semibold);
|
|
6
7
|
line-height: var(--vinyasa-line-height-tight);
|
|
7
8
|
cursor: pointer;
|
|
@@ -15,8 +16,9 @@
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
._1bwnrav0:focus-visible {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
border-color: var(--vinyasa-focus);
|
|
20
|
+
box-shadow: 0 0 0 1px var(--vinyasa-focus), 0 0 0 4px color-mix(in srgb, var(--vinyasa-focus) 16%, transparent);
|
|
21
|
+
outline: none;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
._1bwnrav0:disabled {
|
package/dist/esm/button.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
justify-content: center;
|
|
3
3
|
align-items: center;
|
|
4
4
|
gap: var(--vinyasa-space2);
|
|
5
|
+
font-family: var(--vinyasa-font-family-sans);
|
|
5
6
|
font-weight: var(--vinyasa-font-weight-semibold);
|
|
6
7
|
line-height: var(--vinyasa-line-height-tight);
|
|
7
8
|
cursor: pointer;
|
|
@@ -15,8 +16,9 @@
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
._1bwnrav0:focus-visible {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
border-color: var(--vinyasa-focus);
|
|
20
|
+
box-shadow: 0 0 0 1px var(--vinyasa-focus), 0 0 0 4px color-mix(in srgb, var(--vinyasa-focus) 16%, transparent);
|
|
21
|
+
outline: none;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
._1bwnrav0:disabled {
|
package/dist/esm/button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./button.css";
|
|
2
|
-
import { jsx
|
|
3
|
-
import { forwardRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Children, forwardRef, isValidElement } from "react";
|
|
4
4
|
function toPrimitive(t, r) {
|
|
5
5
|
if ("object" != typeof t || !t) return t;
|
|
6
6
|
var e = t[Symbol.toPrimitive];
|
|
@@ -122,7 +122,10 @@ const Spinner = ()=>/*#__PURE__*/ jsx("span", {
|
|
|
122
122
|
"aria-hidden": "true"
|
|
123
123
|
});
|
|
124
124
|
const button_Spinner = Spinner;
|
|
125
|
-
const
|
|
125
|
+
const ButtonIcon = ({ children })=>children;
|
|
126
|
+
ButtonIcon.displayName = 'ButtonIcon';
|
|
127
|
+
const isButtonIcon = (node)=>/*#__PURE__*/ isValidElement(node) && node.type === ButtonIcon;
|
|
128
|
+
const Button = /*#__PURE__*/ forwardRef(({ children, variant, size, radius, loading = false, disabled = false, type = 'button', className, ...rest }, ref)=>{
|
|
126
129
|
const classes = className ? `${Button_css_button({
|
|
127
130
|
variant,
|
|
128
131
|
size,
|
|
@@ -132,22 +135,24 @@ const Button = /*#__PURE__*/ forwardRef(({ children, variant, size, radius, load
|
|
|
132
135
|
size,
|
|
133
136
|
radius
|
|
134
137
|
});
|
|
135
|
-
|
|
138
|
+
const childArray = Children.toArray(children);
|
|
139
|
+
const hasLeadingIcon = isButtonIcon(childArray[0]);
|
|
140
|
+
const content = loading ? [
|
|
141
|
+
/*#__PURE__*/ jsx(button_Spinner, {}, "spinner"),
|
|
142
|
+
...childArray.slice(hasLeadingIcon ? 1 : 0).filter((child)=>!isButtonIcon(child))
|
|
143
|
+
] : children;
|
|
144
|
+
return /*#__PURE__*/ jsx("button", {
|
|
136
145
|
ref: ref,
|
|
137
146
|
type: type,
|
|
138
147
|
disabled: disabled || loading,
|
|
139
148
|
"aria-busy": loading || void 0,
|
|
140
149
|
className: classes,
|
|
141
150
|
...rest,
|
|
142
|
-
children:
|
|
143
|
-
loading ? /*#__PURE__*/ jsx(button_Spinner, {}) : leadingIcon,
|
|
144
|
-
children,
|
|
145
|
-
!loading && trailingIcon
|
|
146
|
-
]
|
|
151
|
+
children: content
|
|
147
152
|
});
|
|
148
153
|
});
|
|
149
154
|
Button.displayName = 'Button';
|
|
150
155
|
const button_Button = Button;
|
|
151
156
|
const components_button = button_Button;
|
|
152
157
|
export default components_button;
|
|
153
|
-
export { components_button as Button };
|
|
158
|
+
export { ButtonIcon, components_button as Button };
|
|
@@ -8,8 +8,13 @@ export interface ButtonProps extends Omit<ComponentPropsWithoutRef<'button'>, 'c
|
|
|
8
8
|
size?: ButtonSize;
|
|
9
9
|
radius?: ButtonRadius;
|
|
10
10
|
loading?: boolean;
|
|
11
|
-
leadingIcon?: ReactNode;
|
|
12
|
-
trailingIcon?: ReactNode;
|
|
13
11
|
}
|
|
12
|
+
export interface ButtonIconProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const ButtonIcon: {
|
|
16
|
+
({ children }: ButtonIconProps): ReactNode;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
14
19
|
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
15
20
|
export default Button;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import Button from './Button';
|
|
1
|
+
import Button, { ButtonIcon } from './Button';
|
|
2
2
|
export default Button;
|
|
3
|
-
export
|
|
3
|
+
export { ButtonIcon };
|
|
4
|
+
export type { ButtonIconProps, ButtonProps, ButtonRadius, ButtonSize, ButtonVariant, } from './Button';
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as Button } from './components/button';
|
|
1
|
+
export { default as Button, ButtonIcon } from './components/button';
|
|
2
2
|
export { default } from './components/button';
|
|
3
|
-
export type { ButtonProps, ButtonRadius, ButtonSize, ButtonVariant } from './components/button';
|
|
3
|
+
export type { ButtonIconProps, ButtonProps, ButtonRadius, ButtonSize, ButtonVariant, } from './components/button';
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Button, Button as default } from "./button.js";
|
|
1
|
+
export { Button, Button as default, ButtonIcon } from "./button.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinyasa/button",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": "^18.0.0 || ^19.0.0",
|
|
43
43
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
44
|
-
"@vinyasa/tokens": "^1.0.
|
|
44
|
+
"@vinyasa/tokens": "^1.0.23"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@rsbuild/plugin-react": "^2.1.0",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@vanilla-extract/vite-plugin": "^5.2.3",
|
|
55
55
|
"@vanilla-extract/webpack-plugin": "^2.3.27",
|
|
56
56
|
"typescript": "^5.7.3",
|
|
57
|
-
"@vinyasa/layout": "1.0.
|
|
58
|
-
"@vinyasa/tokens": "1.0.
|
|
59
|
-
"@vinyasa/icons": "1.0.
|
|
57
|
+
"@vinyasa/layout": "1.0.23",
|
|
58
|
+
"@vinyasa/tokens": "1.0.23",
|
|
59
|
+
"@vinyasa/icons": "1.0.23"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "rslib build && node ../../scripts/postbuild-package.mjs",
|