@loopr-ai/craft 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ButtonBase-750a4103.js +832 -0
- package/dist/TransitionGroupContext-e16207d6.js +127 -0
- package/dist/assets/theme.css +1 -0
- package/dist/chainPropTypes-004bf492.js +8 -0
- package/dist/components/cell/AvatarGroup/index.d.ts +31 -0
- package/dist/components/cell/AvatarGroup/index.js +390 -0
- package/dist/components/cell/Button/index.d.ts +19 -4
- package/dist/components/cell/Button/index.js +383 -4
- package/dist/components/cell/Chip/index.d.ts +27 -0
- package/dist/components/cell/Chip/index.js +483 -0
- package/dist/components/cell/ProgressBar/index.d.ts +27 -0
- package/dist/components/cell/ProgressBar/index.js +326 -0
- package/dist/components/cell/Search/index.d.ts +25 -0
- package/dist/components/cell/Search/index.js +26358 -0
- package/dist/components/cell/Typography/index.d.ts +20 -0
- package/dist/components/cell/Typography/index.js +217 -0
- package/dist/createSvgIcon-5dcb7caa.js +184 -0
- package/dist/createTheme-95c30431.js +2221 -0
- package/dist/emotion-react.browser.esm-ff33c213.js +439 -0
- package/dist/exactProp-a28c53c1.js +13 -0
- package/dist/global/colors.d.ts +16 -0
- package/dist/global/colors.js +22 -0
- package/dist/global/constants.js +1 -0
- package/dist/global/enums.js +1 -0
- package/dist/global/interfaces.d.ts +6 -0
- package/dist/global/interfaces.js +1 -0
- package/dist/global/theme.d.ts +35 -0
- package/dist/global/theme.js +76 -0
- package/dist/main.d.ts +8 -2
- package/dist/main.js +14 -4
- package/dist/providers/CraftThemeProvider.d.ts +16 -0
- package/dist/providers/CraftThemeProvider.js +135 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +4 -0
- package/dist/styled-05df7dc6.js +699 -0
- package/dist/unsupportedProp-3dbf01f6.js +9 -0
- package/dist/useTheme-462e5dc6.js +10 -0
- package/dist/useThemeWithoutDefault-188598a8.js +950 -0
- package/package.json +24 -3
- package/dist/components/cell/Input/index.d.ts +0 -5
- package/dist/components/cell/Input/index.js +0 -6
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
import { _ as Y, a as ie, P as e, g as Xe } from "./createTheme-95c30431.js";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import W, { Children as Ye, isValidElement as G, cloneElement as J } from "react";
|
|
4
|
+
import { c as x, g as Te, s as re, a as ye, b as Ae } from "./styled-05df7dc6.js";
|
|
5
|
+
import { jsx as I, jsxs as qe } from "react/jsx-runtime";
|
|
6
|
+
import { k as se } from "./emotion-react.browser.esm-ff33c213.js";
|
|
7
|
+
import { _ as We, T as de, u as he, a as He, b as H, r as Ge, e as Je } from "./TransitionGroupContext-e16207d6.js";
|
|
8
|
+
function Qe(t) {
|
|
9
|
+
if (t === void 0)
|
|
10
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
function ae(t, s) {
|
|
14
|
+
var a = function(n) {
|
|
15
|
+
return s && G(n) ? s(n) : n;
|
|
16
|
+
}, l = /* @__PURE__ */ Object.create(null);
|
|
17
|
+
return t && Ye.map(t, function(o) {
|
|
18
|
+
return o;
|
|
19
|
+
}).forEach(function(o) {
|
|
20
|
+
l[o.key] = a(o);
|
|
21
|
+
}), l;
|
|
22
|
+
}
|
|
23
|
+
function Ze(t, s) {
|
|
24
|
+
t = t || {}, s = s || {};
|
|
25
|
+
function a(h) {
|
|
26
|
+
return h in s ? s[h] : t[h];
|
|
27
|
+
}
|
|
28
|
+
var l = /* @__PURE__ */ Object.create(null), o = [];
|
|
29
|
+
for (var n in t)
|
|
30
|
+
n in s ? o.length && (l[n] = o, o = []) : o.push(n);
|
|
31
|
+
var i, p = {};
|
|
32
|
+
for (var u in s) {
|
|
33
|
+
if (l[u])
|
|
34
|
+
for (i = 0; i < l[u].length; i++) {
|
|
35
|
+
var f = l[u][i];
|
|
36
|
+
p[l[u][i]] = a(f);
|
|
37
|
+
}
|
|
38
|
+
p[u] = a(u);
|
|
39
|
+
}
|
|
40
|
+
for (i = 0; i < o.length; i++)
|
|
41
|
+
p[o[i]] = a(o[i]);
|
|
42
|
+
return p;
|
|
43
|
+
}
|
|
44
|
+
function F(t, s, a) {
|
|
45
|
+
return a[s] != null ? a[s] : t.props[s];
|
|
46
|
+
}
|
|
47
|
+
function et(t, s) {
|
|
48
|
+
return ae(t.children, function(a) {
|
|
49
|
+
return J(a, {
|
|
50
|
+
onExited: s.bind(null, a),
|
|
51
|
+
in: !0,
|
|
52
|
+
appear: F(a, "appear", t),
|
|
53
|
+
enter: F(a, "enter", t),
|
|
54
|
+
exit: F(a, "exit", t)
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function tt(t, s, a) {
|
|
59
|
+
var l = ae(t.children), o = Ze(s, l);
|
|
60
|
+
return Object.keys(o).forEach(function(n) {
|
|
61
|
+
var i = o[n];
|
|
62
|
+
if (G(i)) {
|
|
63
|
+
var p = n in s, u = n in l, f = s[n], h = G(f) && !f.props.in;
|
|
64
|
+
u && (!p || h) ? o[n] = J(i, {
|
|
65
|
+
onExited: a.bind(null, i),
|
|
66
|
+
in: !0,
|
|
67
|
+
exit: F(i, "exit", t),
|
|
68
|
+
enter: F(i, "enter", t)
|
|
69
|
+
}) : !u && p && !h ? o[n] = J(i, {
|
|
70
|
+
in: !1
|
|
71
|
+
}) : u && p && G(f) && (o[n] = J(i, {
|
|
72
|
+
onExited: a.bind(null, i),
|
|
73
|
+
in: f.props.in,
|
|
74
|
+
exit: F(i, "exit", t),
|
|
75
|
+
enter: F(i, "enter", t)
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
}), o;
|
|
79
|
+
}
|
|
80
|
+
var nt = Object.values || function(t) {
|
|
81
|
+
return Object.keys(t).map(function(s) {
|
|
82
|
+
return t[s];
|
|
83
|
+
});
|
|
84
|
+
}, ot = {
|
|
85
|
+
component: "div",
|
|
86
|
+
childFactory: function(s) {
|
|
87
|
+
return s;
|
|
88
|
+
}
|
|
89
|
+
}, le = /* @__PURE__ */ function(t) {
|
|
90
|
+
We(s, t);
|
|
91
|
+
function s(l, o) {
|
|
92
|
+
var n;
|
|
93
|
+
n = t.call(this, l, o) || this;
|
|
94
|
+
var i = n.handleExited.bind(Qe(n));
|
|
95
|
+
return n.state = {
|
|
96
|
+
contextValue: {
|
|
97
|
+
isMounting: !0
|
|
98
|
+
},
|
|
99
|
+
handleExited: i,
|
|
100
|
+
firstRender: !0
|
|
101
|
+
}, n;
|
|
102
|
+
}
|
|
103
|
+
var a = s.prototype;
|
|
104
|
+
return a.componentDidMount = function() {
|
|
105
|
+
this.mounted = !0, this.setState({
|
|
106
|
+
contextValue: {
|
|
107
|
+
isMounting: !1
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}, a.componentWillUnmount = function() {
|
|
111
|
+
this.mounted = !1;
|
|
112
|
+
}, s.getDerivedStateFromProps = function(o, n) {
|
|
113
|
+
var i = n.children, p = n.handleExited, u = n.firstRender;
|
|
114
|
+
return {
|
|
115
|
+
children: u ? et(o, p) : tt(o, i, p),
|
|
116
|
+
firstRender: !1
|
|
117
|
+
};
|
|
118
|
+
}, a.handleExited = function(o, n) {
|
|
119
|
+
var i = ae(this.props.children);
|
|
120
|
+
o.key in i || (o.props.onExited && o.props.onExited(n), this.mounted && this.setState(function(p) {
|
|
121
|
+
var u = Y({}, p.children);
|
|
122
|
+
return delete u[o.key], {
|
|
123
|
+
children: u
|
|
124
|
+
};
|
|
125
|
+
}));
|
|
126
|
+
}, a.render = function() {
|
|
127
|
+
var o = this.props, n = o.component, i = o.childFactory, p = ie(o, ["component", "childFactory"]), u = this.state.contextValue, f = nt(this.state.children).map(i);
|
|
128
|
+
return delete p.appear, delete p.enter, delete p.exit, n === null ? /* @__PURE__ */ W.createElement(de.Provider, {
|
|
129
|
+
value: u
|
|
130
|
+
}, f) : /* @__PURE__ */ W.createElement(de.Provider, {
|
|
131
|
+
value: u
|
|
132
|
+
}, /* @__PURE__ */ W.createElement(n, p, f));
|
|
133
|
+
}, s;
|
|
134
|
+
}(W.Component);
|
|
135
|
+
le.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
136
|
+
/**
|
|
137
|
+
* `<TransitionGroup>` renders a `<div>` by default. You can change this
|
|
138
|
+
* behavior by providing a `component` prop.
|
|
139
|
+
* If you use React v16+ and would like to avoid a wrapping `<div>` element
|
|
140
|
+
* you can pass in `component={null}`. This is useful if the wrapping div
|
|
141
|
+
* borks your css styles.
|
|
142
|
+
*/
|
|
143
|
+
component: e.any,
|
|
144
|
+
/**
|
|
145
|
+
* A set of `<Transition>` components, that are toggled `in` and out as they
|
|
146
|
+
* leave. the `<TransitionGroup>` will inject specific transition props, so
|
|
147
|
+
* remember to spread them through if you are wrapping the `<Transition>` as
|
|
148
|
+
* with our `<Fade>` example.
|
|
149
|
+
*
|
|
150
|
+
* While this component is meant for multiple `Transition` or `CSSTransition`
|
|
151
|
+
* children, sometimes you may want to have a single transition child with
|
|
152
|
+
* content that you want to be transitioned out and in when you change it
|
|
153
|
+
* (e.g. routes, images etc.) In that case you can change the `key` prop of
|
|
154
|
+
* the transition child as you change its content, this will cause
|
|
155
|
+
* `TransitionGroup` to transition the child out and back in.
|
|
156
|
+
*/
|
|
157
|
+
children: e.node,
|
|
158
|
+
/**
|
|
159
|
+
* A convenience prop that enables or disables appear animations
|
|
160
|
+
* for all children. Note that specifying this will override any defaults set
|
|
161
|
+
* on individual children Transitions.
|
|
162
|
+
*/
|
|
163
|
+
appear: e.bool,
|
|
164
|
+
/**
|
|
165
|
+
* A convenience prop that enables or disables enter animations
|
|
166
|
+
* for all children. Note that specifying this will override any defaults set
|
|
167
|
+
* on individual children Transitions.
|
|
168
|
+
*/
|
|
169
|
+
enter: e.bool,
|
|
170
|
+
/**
|
|
171
|
+
* A convenience prop that enables or disables exit animations
|
|
172
|
+
* for all children. Note that specifying this will override any defaults set
|
|
173
|
+
* on individual children Transitions.
|
|
174
|
+
*/
|
|
175
|
+
exit: e.bool,
|
|
176
|
+
/**
|
|
177
|
+
* You may need to apply reactive updates to a child as it is exiting.
|
|
178
|
+
* This is generally done by using `cloneElement` however in the case of an exiting
|
|
179
|
+
* child the element has already been removed and not accessible to the consumer.
|
|
180
|
+
*
|
|
181
|
+
* If you do need to update a child as it leaves you can provide a `childFactory`
|
|
182
|
+
* to wrap every child, even the ones that are leaving.
|
|
183
|
+
*
|
|
184
|
+
* @type Function(child: ReactElement) -> ReactElement
|
|
185
|
+
*/
|
|
186
|
+
childFactory: e.func
|
|
187
|
+
} : {};
|
|
188
|
+
le.defaultProps = ot;
|
|
189
|
+
const it = le;
|
|
190
|
+
function Me(t) {
|
|
191
|
+
const {
|
|
192
|
+
className: s,
|
|
193
|
+
classes: a,
|
|
194
|
+
pulsate: l = !1,
|
|
195
|
+
rippleX: o,
|
|
196
|
+
rippleY: n,
|
|
197
|
+
rippleSize: i,
|
|
198
|
+
in: p,
|
|
199
|
+
onExited: u,
|
|
200
|
+
timeout: f
|
|
201
|
+
} = t, [h, T] = c.useState(!1), g = x(s, a.ripple, a.rippleVisible, l && a.ripplePulsate), v = {
|
|
202
|
+
width: i,
|
|
203
|
+
height: i,
|
|
204
|
+
top: -(i / 2) + n,
|
|
205
|
+
left: -(i / 2) + o
|
|
206
|
+
}, m = x(a.child, h && a.childLeaving, l && a.childPulsate);
|
|
207
|
+
return !p && !h && T(!0), c.useEffect(() => {
|
|
208
|
+
if (!p && u != null) {
|
|
209
|
+
const y = setTimeout(u, f);
|
|
210
|
+
return () => {
|
|
211
|
+
clearTimeout(y);
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}, [u, p, f]), /* @__PURE__ */ I("span", {
|
|
215
|
+
className: g,
|
|
216
|
+
style: v,
|
|
217
|
+
children: /* @__PURE__ */ I("span", {
|
|
218
|
+
className: m
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
process.env.NODE_ENV !== "production" && (Me.propTypes = {
|
|
223
|
+
/**
|
|
224
|
+
* Override or extend the styles applied to the component.
|
|
225
|
+
* See [CSS API](#css) below for more details.
|
|
226
|
+
*/
|
|
227
|
+
classes: e.object.isRequired,
|
|
228
|
+
className: e.string,
|
|
229
|
+
/**
|
|
230
|
+
* @ignore - injected from TransitionGroup
|
|
231
|
+
*/
|
|
232
|
+
in: e.bool,
|
|
233
|
+
/**
|
|
234
|
+
* @ignore - injected from TransitionGroup
|
|
235
|
+
*/
|
|
236
|
+
onExited: e.func,
|
|
237
|
+
/**
|
|
238
|
+
* If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
|
|
239
|
+
*/
|
|
240
|
+
pulsate: e.bool,
|
|
241
|
+
/**
|
|
242
|
+
* Diameter of the ripple.
|
|
243
|
+
*/
|
|
244
|
+
rippleSize: e.number,
|
|
245
|
+
/**
|
|
246
|
+
* Horizontal position of the ripple center.
|
|
247
|
+
*/
|
|
248
|
+
rippleX: e.number,
|
|
249
|
+
/**
|
|
250
|
+
* Vertical position of the ripple center.
|
|
251
|
+
*/
|
|
252
|
+
rippleY: e.number,
|
|
253
|
+
/**
|
|
254
|
+
* exit delay
|
|
255
|
+
*/
|
|
256
|
+
timeout: e.number.isRequired
|
|
257
|
+
});
|
|
258
|
+
const rt = Te("MuiTouchRipple", ["root", "ripple", "rippleVisible", "ripplePulsate", "child", "childLeaving", "childPulsate"]), b = rt, st = ["center", "classes", "className"];
|
|
259
|
+
let Q = (t) => t, me, be, ge, Re;
|
|
260
|
+
const oe = 550, at = 80, lt = se(me || (me = Q`
|
|
261
|
+
0% {
|
|
262
|
+
transform: scale(0);
|
|
263
|
+
opacity: 0.1;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
100% {
|
|
267
|
+
transform: scale(1);
|
|
268
|
+
opacity: 0.3;
|
|
269
|
+
}
|
|
270
|
+
`)), ut = se(be || (be = Q`
|
|
271
|
+
0% {
|
|
272
|
+
opacity: 1;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
100% {
|
|
276
|
+
opacity: 0;
|
|
277
|
+
}
|
|
278
|
+
`)), ct = se(ge || (ge = Q`
|
|
279
|
+
0% {
|
|
280
|
+
transform: scale(1);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
50% {
|
|
284
|
+
transform: scale(0.92);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
100% {
|
|
288
|
+
transform: scale(1);
|
|
289
|
+
}
|
|
290
|
+
`)), pt = re("span", {
|
|
291
|
+
name: "MuiTouchRipple",
|
|
292
|
+
slot: "Root"
|
|
293
|
+
})({
|
|
294
|
+
overflow: "hidden",
|
|
295
|
+
pointerEvents: "none",
|
|
296
|
+
position: "absolute",
|
|
297
|
+
zIndex: 0,
|
|
298
|
+
top: 0,
|
|
299
|
+
right: 0,
|
|
300
|
+
bottom: 0,
|
|
301
|
+
left: 0,
|
|
302
|
+
borderRadius: "inherit"
|
|
303
|
+
}), ft = re(Me, {
|
|
304
|
+
name: "MuiTouchRipple",
|
|
305
|
+
slot: "Ripple"
|
|
306
|
+
})(Re || (Re = Q`
|
|
307
|
+
opacity: 0;
|
|
308
|
+
position: absolute;
|
|
309
|
+
|
|
310
|
+
&.${0} {
|
|
311
|
+
opacity: 0.3;
|
|
312
|
+
transform: scale(1);
|
|
313
|
+
animation-name: ${0};
|
|
314
|
+
animation-duration: ${0}ms;
|
|
315
|
+
animation-timing-function: ${0};
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&.${0} {
|
|
319
|
+
animation-duration: ${0}ms;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
& .${0} {
|
|
323
|
+
opacity: 1;
|
|
324
|
+
display: block;
|
|
325
|
+
width: 100%;
|
|
326
|
+
height: 100%;
|
|
327
|
+
border-radius: 50%;
|
|
328
|
+
background-color: currentColor;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
& .${0} {
|
|
332
|
+
opacity: 0;
|
|
333
|
+
animation-name: ${0};
|
|
334
|
+
animation-duration: ${0}ms;
|
|
335
|
+
animation-timing-function: ${0};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
& .${0} {
|
|
339
|
+
position: absolute;
|
|
340
|
+
/* @noflip */
|
|
341
|
+
left: 0px;
|
|
342
|
+
top: 0;
|
|
343
|
+
animation-name: ${0};
|
|
344
|
+
animation-duration: 2500ms;
|
|
345
|
+
animation-timing-function: ${0};
|
|
346
|
+
animation-iteration-count: infinite;
|
|
347
|
+
animation-delay: 200ms;
|
|
348
|
+
}
|
|
349
|
+
`), b.rippleVisible, lt, oe, ({
|
|
350
|
+
theme: t
|
|
351
|
+
}) => t.transitions.easing.easeInOut, b.ripplePulsate, ({
|
|
352
|
+
theme: t
|
|
353
|
+
}) => t.transitions.duration.shorter, b.child, b.childLeaving, ut, oe, ({
|
|
354
|
+
theme: t
|
|
355
|
+
}) => t.transitions.easing.easeInOut, b.childPulsate, ct, ({
|
|
356
|
+
theme: t
|
|
357
|
+
}) => t.transitions.easing.easeInOut), Ce = /* @__PURE__ */ c.forwardRef(function(s, a) {
|
|
358
|
+
const l = ye({
|
|
359
|
+
props: s,
|
|
360
|
+
name: "MuiTouchRipple"
|
|
361
|
+
}), {
|
|
362
|
+
center: o = !1,
|
|
363
|
+
classes: n = {},
|
|
364
|
+
className: i
|
|
365
|
+
} = l, p = ie(l, st), [u, f] = c.useState([]), h = c.useRef(0), T = c.useRef(null);
|
|
366
|
+
c.useEffect(() => {
|
|
367
|
+
T.current && (T.current(), T.current = null);
|
|
368
|
+
}, [u]);
|
|
369
|
+
const g = c.useRef(!1), v = c.useRef(0), m = c.useRef(null), y = c.useRef(null);
|
|
370
|
+
c.useEffect(() => () => {
|
|
371
|
+
v.current && clearTimeout(v.current);
|
|
372
|
+
}, []);
|
|
373
|
+
const U = c.useCallback((d) => {
|
|
374
|
+
const {
|
|
375
|
+
pulsate: M,
|
|
376
|
+
rippleX: C,
|
|
377
|
+
rippleY: k,
|
|
378
|
+
rippleSize: O,
|
|
379
|
+
cb: z
|
|
380
|
+
} = d;
|
|
381
|
+
f((E) => [...E, /* @__PURE__ */ I(ft, {
|
|
382
|
+
classes: {
|
|
383
|
+
ripple: x(n.ripple, b.ripple),
|
|
384
|
+
rippleVisible: x(n.rippleVisible, b.rippleVisible),
|
|
385
|
+
ripplePulsate: x(n.ripplePulsate, b.ripplePulsate),
|
|
386
|
+
child: x(n.child, b.child),
|
|
387
|
+
childLeaving: x(n.childLeaving, b.childLeaving),
|
|
388
|
+
childPulsate: x(n.childPulsate, b.childPulsate)
|
|
389
|
+
},
|
|
390
|
+
timeout: oe,
|
|
391
|
+
pulsate: M,
|
|
392
|
+
rippleX: C,
|
|
393
|
+
rippleY: k,
|
|
394
|
+
rippleSize: O
|
|
395
|
+
}, h.current)]), h.current += 1, T.current = z;
|
|
396
|
+
}, [n]), $ = c.useCallback((d = {}, M = {}, C = () => {
|
|
397
|
+
}) => {
|
|
398
|
+
const {
|
|
399
|
+
pulsate: k = !1,
|
|
400
|
+
center: O = o || M.pulsate,
|
|
401
|
+
fakeElement: z = !1
|
|
402
|
+
// For test purposes
|
|
403
|
+
} = M;
|
|
404
|
+
if ((d == null ? void 0 : d.type) === "mousedown" && g.current) {
|
|
405
|
+
g.current = !1;
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
(d == null ? void 0 : d.type) === "touchstart" && (g.current = !0);
|
|
409
|
+
const E = z ? null : y.current, P = E ? E.getBoundingClientRect() : {
|
|
410
|
+
width: 0,
|
|
411
|
+
height: 0,
|
|
412
|
+
left: 0,
|
|
413
|
+
top: 0
|
|
414
|
+
};
|
|
415
|
+
let V, D, S;
|
|
416
|
+
if (O || d === void 0 || d.clientX === 0 && d.clientY === 0 || !d.clientX && !d.touches)
|
|
417
|
+
V = Math.round(P.width / 2), D = Math.round(P.height / 2);
|
|
418
|
+
else {
|
|
419
|
+
const {
|
|
420
|
+
clientX: w,
|
|
421
|
+
clientY: N
|
|
422
|
+
} = d.touches && d.touches.length > 0 ? d.touches[0] : d;
|
|
423
|
+
V = Math.round(w - P.left), D = Math.round(N - P.top);
|
|
424
|
+
}
|
|
425
|
+
if (O)
|
|
426
|
+
S = Math.sqrt((2 * P.width ** 2 + P.height ** 2) / 3), S % 2 === 0 && (S += 1);
|
|
427
|
+
else {
|
|
428
|
+
const w = Math.max(Math.abs((E ? E.clientWidth : 0) - V), V) * 2 + 2, N = Math.max(Math.abs((E ? E.clientHeight : 0) - D), D) * 2 + 2;
|
|
429
|
+
S = Math.sqrt(w ** 2 + N ** 2);
|
|
430
|
+
}
|
|
431
|
+
d != null && d.touches ? m.current === null && (m.current = () => {
|
|
432
|
+
U({
|
|
433
|
+
pulsate: k,
|
|
434
|
+
rippleX: V,
|
|
435
|
+
rippleY: D,
|
|
436
|
+
rippleSize: S,
|
|
437
|
+
cb: C
|
|
438
|
+
});
|
|
439
|
+
}, v.current = setTimeout(() => {
|
|
440
|
+
m.current && (m.current(), m.current = null);
|
|
441
|
+
}, at)) : U({
|
|
442
|
+
pulsate: k,
|
|
443
|
+
rippleX: V,
|
|
444
|
+
rippleY: D,
|
|
445
|
+
rippleSize: S,
|
|
446
|
+
cb: C
|
|
447
|
+
});
|
|
448
|
+
}, [o, U]), j = c.useCallback(() => {
|
|
449
|
+
$({}, {
|
|
450
|
+
pulsate: !0
|
|
451
|
+
});
|
|
452
|
+
}, [$]), _ = c.useCallback((d, M) => {
|
|
453
|
+
if (clearTimeout(v.current), (d == null ? void 0 : d.type) === "touchend" && m.current) {
|
|
454
|
+
m.current(), m.current = null, v.current = setTimeout(() => {
|
|
455
|
+
_(d, M);
|
|
456
|
+
});
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
m.current = null, f((C) => C.length > 0 ? C.slice(1) : C), T.current = M;
|
|
460
|
+
}, []);
|
|
461
|
+
return c.useImperativeHandle(a, () => ({
|
|
462
|
+
pulsate: j,
|
|
463
|
+
start: $,
|
|
464
|
+
stop: _
|
|
465
|
+
}), [j, $, _]), /* @__PURE__ */ I(pt, Y({
|
|
466
|
+
className: x(b.root, n.root, i),
|
|
467
|
+
ref: y
|
|
468
|
+
}, p, {
|
|
469
|
+
children: /* @__PURE__ */ I(it, {
|
|
470
|
+
component: null,
|
|
471
|
+
exit: !0,
|
|
472
|
+
children: u
|
|
473
|
+
})
|
|
474
|
+
}));
|
|
475
|
+
});
|
|
476
|
+
process.env.NODE_ENV !== "production" && (Ce.propTypes = {
|
|
477
|
+
/**
|
|
478
|
+
* If `true`, the ripple starts at the center of the component
|
|
479
|
+
* rather than at the point of interaction.
|
|
480
|
+
*/
|
|
481
|
+
center: e.bool,
|
|
482
|
+
/**
|
|
483
|
+
* Override or extend the styles applied to the component.
|
|
484
|
+
* See [CSS API](#css) below for more details.
|
|
485
|
+
*/
|
|
486
|
+
classes: e.object,
|
|
487
|
+
/**
|
|
488
|
+
* @ignore
|
|
489
|
+
*/
|
|
490
|
+
className: e.string
|
|
491
|
+
});
|
|
492
|
+
const dt = Ce;
|
|
493
|
+
function ht(t) {
|
|
494
|
+
return Xe("MuiButtonBase", t);
|
|
495
|
+
}
|
|
496
|
+
const mt = Te("MuiButtonBase", ["root", "disabled", "focusVisible"]), bt = mt, gt = ["action", "centerRipple", "children", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "LinkComponent", "onBlur", "onClick", "onContextMenu", "onDragLeave", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "tabIndex", "TouchRippleProps", "touchRippleRef", "type"], Rt = (t) => {
|
|
497
|
+
const {
|
|
498
|
+
disabled: s,
|
|
499
|
+
focusVisible: a,
|
|
500
|
+
focusVisibleClassName: l,
|
|
501
|
+
classes: o
|
|
502
|
+
} = t, i = Ae({
|
|
503
|
+
root: ["root", s && "disabled", a && "focusVisible"]
|
|
504
|
+
}, ht, o);
|
|
505
|
+
return a && l && (i.root += ` ${l}`), i;
|
|
506
|
+
}, Tt = re("button", {
|
|
507
|
+
name: "MuiButtonBase",
|
|
508
|
+
slot: "Root",
|
|
509
|
+
overridesResolver: (t, s) => s.root
|
|
510
|
+
})({
|
|
511
|
+
display: "inline-flex",
|
|
512
|
+
alignItems: "center",
|
|
513
|
+
justifyContent: "center",
|
|
514
|
+
position: "relative",
|
|
515
|
+
boxSizing: "border-box",
|
|
516
|
+
WebkitTapHighlightColor: "transparent",
|
|
517
|
+
backgroundColor: "transparent",
|
|
518
|
+
// Reset default value
|
|
519
|
+
// We disable the focus ring for mouse, touch and keyboard users.
|
|
520
|
+
outline: 0,
|
|
521
|
+
border: 0,
|
|
522
|
+
margin: 0,
|
|
523
|
+
// Remove the margin in Safari
|
|
524
|
+
borderRadius: 0,
|
|
525
|
+
padding: 0,
|
|
526
|
+
// Remove the padding in Firefox
|
|
527
|
+
cursor: "pointer",
|
|
528
|
+
userSelect: "none",
|
|
529
|
+
verticalAlign: "middle",
|
|
530
|
+
MozAppearance: "none",
|
|
531
|
+
// Reset
|
|
532
|
+
WebkitAppearance: "none",
|
|
533
|
+
// Reset
|
|
534
|
+
textDecoration: "none",
|
|
535
|
+
// So we take precedent over the style of a native <a /> element.
|
|
536
|
+
color: "inherit",
|
|
537
|
+
"&::-moz-focus-inner": {
|
|
538
|
+
borderStyle: "none"
|
|
539
|
+
// Remove Firefox dotted outline.
|
|
540
|
+
},
|
|
541
|
+
[`&.${bt.disabled}`]: {
|
|
542
|
+
pointerEvents: "none",
|
|
543
|
+
// Disable link interactions
|
|
544
|
+
cursor: "default"
|
|
545
|
+
},
|
|
546
|
+
"@media print": {
|
|
547
|
+
colorAdjust: "exact"
|
|
548
|
+
}
|
|
549
|
+
}), Ee = /* @__PURE__ */ c.forwardRef(function(s, a) {
|
|
550
|
+
const l = ye({
|
|
551
|
+
props: s,
|
|
552
|
+
name: "MuiButtonBase"
|
|
553
|
+
}), {
|
|
554
|
+
action: o,
|
|
555
|
+
centerRipple: n = !1,
|
|
556
|
+
children: i,
|
|
557
|
+
className: p,
|
|
558
|
+
component: u = "button",
|
|
559
|
+
disabled: f = !1,
|
|
560
|
+
disableRipple: h = !1,
|
|
561
|
+
disableTouchRipple: T = !1,
|
|
562
|
+
focusRipple: g = !1,
|
|
563
|
+
LinkComponent: v = "a",
|
|
564
|
+
onBlur: m,
|
|
565
|
+
onClick: y,
|
|
566
|
+
onContextMenu: U,
|
|
567
|
+
onDragLeave: $,
|
|
568
|
+
onFocus: j,
|
|
569
|
+
onFocusVisible: _,
|
|
570
|
+
onKeyDown: d,
|
|
571
|
+
onKeyUp: M,
|
|
572
|
+
onMouseDown: C,
|
|
573
|
+
onMouseLeave: k,
|
|
574
|
+
onMouseUp: O,
|
|
575
|
+
onTouchEnd: z,
|
|
576
|
+
onTouchMove: E,
|
|
577
|
+
onTouchStart: P,
|
|
578
|
+
tabIndex: V = 0,
|
|
579
|
+
TouchRippleProps: D,
|
|
580
|
+
touchRippleRef: S,
|
|
581
|
+
type: w
|
|
582
|
+
} = l, N = ie(l, gt), K = c.useRef(null), R = c.useRef(null), xe = he(R, S), {
|
|
583
|
+
isFocusVisibleRef: ue,
|
|
584
|
+
onFocus: ve,
|
|
585
|
+
onBlur: Ve,
|
|
586
|
+
ref: Ne
|
|
587
|
+
} = He(), [L, A] = c.useState(!1);
|
|
588
|
+
f && L && A(!1), c.useImperativeHandle(o, () => ({
|
|
589
|
+
focusVisible: () => {
|
|
590
|
+
A(!0), K.current.focus();
|
|
591
|
+
}
|
|
592
|
+
}), []);
|
|
593
|
+
const [Z, Be] = c.useState(!1);
|
|
594
|
+
c.useEffect(() => {
|
|
595
|
+
Be(!0);
|
|
596
|
+
}, []);
|
|
597
|
+
const ee = Z && !h && !f;
|
|
598
|
+
c.useEffect(() => {
|
|
599
|
+
L && g && !h && Z && R.current.pulsate();
|
|
600
|
+
}, [h, g, L, Z]);
|
|
601
|
+
function B(r, pe, Ke = T) {
|
|
602
|
+
return H((fe) => (pe && pe(fe), !Ke && R.current && R.current[r](fe), !0));
|
|
603
|
+
}
|
|
604
|
+
const Pe = B("start", C), De = B("stop", U), Se = B("stop", $), ke = B("stop", O), we = B("stop", (r) => {
|
|
605
|
+
L && r.preventDefault(), k && k(r);
|
|
606
|
+
}), Le = B("start", P), Fe = B("stop", z), $e = B("stop", E), _e = B("stop", (r) => {
|
|
607
|
+
Ve(r), ue.current === !1 && A(!1), m && m(r);
|
|
608
|
+
}, !1), Oe = H((r) => {
|
|
609
|
+
K.current || (K.current = r.currentTarget), ve(r), ue.current === !0 && (A(!0), _ && _(r)), j && j(r);
|
|
610
|
+
}), te = () => {
|
|
611
|
+
const r = K.current;
|
|
612
|
+
return u && u !== "button" && !(r.tagName === "A" && r.href);
|
|
613
|
+
}, ne = c.useRef(!1), Ie = H((r) => {
|
|
614
|
+
g && !ne.current && L && R.current && r.key === " " && (ne.current = !0, R.current.stop(r, () => {
|
|
615
|
+
R.current.start(r);
|
|
616
|
+
})), r.target === r.currentTarget && te() && r.key === " " && r.preventDefault(), d && d(r), r.target === r.currentTarget && te() && r.key === "Enter" && !f && (r.preventDefault(), y && y(r));
|
|
617
|
+
}), Ue = H((r) => {
|
|
618
|
+
g && r.key === " " && R.current && L && !r.defaultPrevented && (ne.current = !1, R.current.stop(r, () => {
|
|
619
|
+
R.current.pulsate(r);
|
|
620
|
+
})), M && M(r), y && r.target === r.currentTarget && te() && r.key === " " && !r.defaultPrevented && y(r);
|
|
621
|
+
});
|
|
622
|
+
let q = u;
|
|
623
|
+
q === "button" && (N.href || N.to) && (q = v);
|
|
624
|
+
const X = {};
|
|
625
|
+
q === "button" ? (X.type = w === void 0 ? "button" : w, X.disabled = f) : (!N.href && !N.to && (X.role = "button"), f && (X["aria-disabled"] = f));
|
|
626
|
+
const je = he(a, Ne, K);
|
|
627
|
+
process.env.NODE_ENV !== "production" && c.useEffect(() => {
|
|
628
|
+
ee && !R.current && console.error(["MUI: The `component` prop provided to ButtonBase is invalid.", "Please make sure the children prop is rendered in this custom component."].join(`
|
|
629
|
+
`));
|
|
630
|
+
}, [ee]);
|
|
631
|
+
const ce = Y({}, l, {
|
|
632
|
+
centerRipple: n,
|
|
633
|
+
component: u,
|
|
634
|
+
disabled: f,
|
|
635
|
+
disableRipple: h,
|
|
636
|
+
disableTouchRipple: T,
|
|
637
|
+
focusRipple: g,
|
|
638
|
+
tabIndex: V,
|
|
639
|
+
focusVisible: L
|
|
640
|
+
}), ze = Rt(ce);
|
|
641
|
+
return /* @__PURE__ */ qe(Tt, Y({
|
|
642
|
+
as: q,
|
|
643
|
+
className: x(ze.root, p),
|
|
644
|
+
ownerState: ce,
|
|
645
|
+
onBlur: _e,
|
|
646
|
+
onClick: y,
|
|
647
|
+
onContextMenu: De,
|
|
648
|
+
onFocus: Oe,
|
|
649
|
+
onKeyDown: Ie,
|
|
650
|
+
onKeyUp: Ue,
|
|
651
|
+
onMouseDown: Pe,
|
|
652
|
+
onMouseLeave: we,
|
|
653
|
+
onMouseUp: ke,
|
|
654
|
+
onDragLeave: Se,
|
|
655
|
+
onTouchEnd: Fe,
|
|
656
|
+
onTouchMove: $e,
|
|
657
|
+
onTouchStart: Le,
|
|
658
|
+
ref: je,
|
|
659
|
+
tabIndex: f ? -1 : V,
|
|
660
|
+
type: w
|
|
661
|
+
}, X, N, {
|
|
662
|
+
children: [i, ee ? (
|
|
663
|
+
/* TouchRipple is only needed client-side, x2 boost on the server. */
|
|
664
|
+
/* @__PURE__ */ I(dt, Y({
|
|
665
|
+
ref: xe,
|
|
666
|
+
center: n
|
|
667
|
+
}, D))
|
|
668
|
+
) : null]
|
|
669
|
+
}));
|
|
670
|
+
});
|
|
671
|
+
process.env.NODE_ENV !== "production" && (Ee.propTypes = {
|
|
672
|
+
// ----------------------------- Warning --------------------------------
|
|
673
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
674
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
675
|
+
// ----------------------------------------------------------------------
|
|
676
|
+
/**
|
|
677
|
+
* A ref for imperative actions.
|
|
678
|
+
* It currently only supports `focusVisible()` action.
|
|
679
|
+
*/
|
|
680
|
+
action: Ge,
|
|
681
|
+
/**
|
|
682
|
+
* If `true`, the ripples are centered.
|
|
683
|
+
* They won't start at the cursor interaction position.
|
|
684
|
+
* @default false
|
|
685
|
+
*/
|
|
686
|
+
centerRipple: e.bool,
|
|
687
|
+
/**
|
|
688
|
+
* The content of the component.
|
|
689
|
+
*/
|
|
690
|
+
children: e.node,
|
|
691
|
+
/**
|
|
692
|
+
* Override or extend the styles applied to the component.
|
|
693
|
+
*/
|
|
694
|
+
classes: e.object,
|
|
695
|
+
/**
|
|
696
|
+
* @ignore
|
|
697
|
+
*/
|
|
698
|
+
className: e.string,
|
|
699
|
+
/**
|
|
700
|
+
* The component used for the root node.
|
|
701
|
+
* Either a string to use a HTML element or a component.
|
|
702
|
+
*/
|
|
703
|
+
component: Je,
|
|
704
|
+
/**
|
|
705
|
+
* If `true`, the component is disabled.
|
|
706
|
+
* @default false
|
|
707
|
+
*/
|
|
708
|
+
disabled: e.bool,
|
|
709
|
+
/**
|
|
710
|
+
* If `true`, the ripple effect is disabled.
|
|
711
|
+
*
|
|
712
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
713
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
714
|
+
* @default false
|
|
715
|
+
*/
|
|
716
|
+
disableRipple: e.bool,
|
|
717
|
+
/**
|
|
718
|
+
* If `true`, the touch ripple effect is disabled.
|
|
719
|
+
* @default false
|
|
720
|
+
*/
|
|
721
|
+
disableTouchRipple: e.bool,
|
|
722
|
+
/**
|
|
723
|
+
* If `true`, the base button will have a keyboard focus ripple.
|
|
724
|
+
* @default false
|
|
725
|
+
*/
|
|
726
|
+
focusRipple: e.bool,
|
|
727
|
+
/**
|
|
728
|
+
* This prop can help identify which element has keyboard focus.
|
|
729
|
+
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
730
|
+
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
731
|
+
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
732
|
+
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
733
|
+
* if needed.
|
|
734
|
+
*/
|
|
735
|
+
focusVisibleClassName: e.string,
|
|
736
|
+
/**
|
|
737
|
+
* @ignore
|
|
738
|
+
*/
|
|
739
|
+
href: e.any,
|
|
740
|
+
/**
|
|
741
|
+
* The component used to render a link when the `href` prop is provided.
|
|
742
|
+
* @default 'a'
|
|
743
|
+
*/
|
|
744
|
+
LinkComponent: e.elementType,
|
|
745
|
+
/**
|
|
746
|
+
* @ignore
|
|
747
|
+
*/
|
|
748
|
+
onBlur: e.func,
|
|
749
|
+
/**
|
|
750
|
+
* @ignore
|
|
751
|
+
*/
|
|
752
|
+
onClick: e.func,
|
|
753
|
+
/**
|
|
754
|
+
* @ignore
|
|
755
|
+
*/
|
|
756
|
+
onContextMenu: e.func,
|
|
757
|
+
/**
|
|
758
|
+
* @ignore
|
|
759
|
+
*/
|
|
760
|
+
onDragLeave: e.func,
|
|
761
|
+
/**
|
|
762
|
+
* @ignore
|
|
763
|
+
*/
|
|
764
|
+
onFocus: e.func,
|
|
765
|
+
/**
|
|
766
|
+
* Callback fired when the component is focused with a keyboard.
|
|
767
|
+
* We trigger a `onFocus` callback too.
|
|
768
|
+
*/
|
|
769
|
+
onFocusVisible: e.func,
|
|
770
|
+
/**
|
|
771
|
+
* @ignore
|
|
772
|
+
*/
|
|
773
|
+
onKeyDown: e.func,
|
|
774
|
+
/**
|
|
775
|
+
* @ignore
|
|
776
|
+
*/
|
|
777
|
+
onKeyUp: e.func,
|
|
778
|
+
/**
|
|
779
|
+
* @ignore
|
|
780
|
+
*/
|
|
781
|
+
onMouseDown: e.func,
|
|
782
|
+
/**
|
|
783
|
+
* @ignore
|
|
784
|
+
*/
|
|
785
|
+
onMouseLeave: e.func,
|
|
786
|
+
/**
|
|
787
|
+
* @ignore
|
|
788
|
+
*/
|
|
789
|
+
onMouseUp: e.func,
|
|
790
|
+
/**
|
|
791
|
+
* @ignore
|
|
792
|
+
*/
|
|
793
|
+
onTouchEnd: e.func,
|
|
794
|
+
/**
|
|
795
|
+
* @ignore
|
|
796
|
+
*/
|
|
797
|
+
onTouchMove: e.func,
|
|
798
|
+
/**
|
|
799
|
+
* @ignore
|
|
800
|
+
*/
|
|
801
|
+
onTouchStart: e.func,
|
|
802
|
+
/**
|
|
803
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
804
|
+
*/
|
|
805
|
+
sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object]),
|
|
806
|
+
/**
|
|
807
|
+
* @default 0
|
|
808
|
+
*/
|
|
809
|
+
tabIndex: e.number,
|
|
810
|
+
/**
|
|
811
|
+
* Props applied to the `TouchRipple` element.
|
|
812
|
+
*/
|
|
813
|
+
TouchRippleProps: e.object,
|
|
814
|
+
/**
|
|
815
|
+
* A ref that points to the `TouchRipple` element.
|
|
816
|
+
*/
|
|
817
|
+
touchRippleRef: e.oneOfType([e.func, e.shape({
|
|
818
|
+
current: e.shape({
|
|
819
|
+
pulsate: e.func.isRequired,
|
|
820
|
+
start: e.func.isRequired,
|
|
821
|
+
stop: e.func.isRequired
|
|
822
|
+
})
|
|
823
|
+
})]),
|
|
824
|
+
/**
|
|
825
|
+
* @ignore
|
|
826
|
+
*/
|
|
827
|
+
type: e.oneOfType([e.oneOf(["button", "reset", "submit"]), e.string])
|
|
828
|
+
});
|
|
829
|
+
const Nt = Ee;
|
|
830
|
+
export {
|
|
831
|
+
Nt as B
|
|
832
|
+
};
|