@pismo/marola 0.0.1-alpha.6 → 0.0.1-alpha.7
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/{Button-W6tM-_IT.js → Button-B1umG8kJ.js} +2 -2
- package/dist/ClickAwayListener-BKznXF1d.js +106 -0
- package/dist/Portal-BcdMtRGF.js +73 -0
- package/dist/assets/Input.css +1 -0
- package/dist/assets/Snackbar.css +1 -0
- package/dist/assets/Toggle.css +1 -0
- package/dist/components/Advice/Advice.d.ts +6 -3
- package/dist/components/Advice/Advice.js +15 -15
- package/dist/components/Button/Button.d.ts +8 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.stories.d.ts +60 -0
- package/dist/components/Button/Button.stories.js +40 -0
- package/dist/components/Dialog/CloseIconButton.js +9 -9
- package/dist/components/Dialog/Dialog.d.ts +3 -2
- package/dist/components/Dialog/Dialog.js +10 -9
- package/dist/components/Dialog/Dialog.stories.d.ts +343 -0
- package/dist/components/Dialog/Dialog.stories.js +59 -0
- package/dist/components/Icon/Icon.d.ts +15 -4
- package/dist/components/Icon/Icon.js +92 -6
- package/dist/components/IconButton/IconButton.js +1 -1
- package/dist/components/Input/Input.d.ts +44 -0
- package/dist/components/Input/Input.js +497 -0
- package/dist/components/Input/Input.stories.d.ts +43 -0
- package/dist/components/Input/Input.stories.js +106 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +2 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.d.ts +14 -0
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +38 -0
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Pagination/Pagination.js +10 -10
- package/dist/components/Snackbar/Snackbar.d.ts +13 -0
- package/dist/components/Snackbar/Snackbar.js +622 -0
- package/dist/components/SortTooltip/SortTooltip.d.ts +1 -1
- package/dist/components/SortTooltip/SortTooltip.js +8 -8
- package/dist/components/Table/Table.js +12 -12
- package/dist/components/Tabs/Tab.js +2 -2
- package/dist/components/Tabs/TabPanel.js +1 -1
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Toggle/Toggle.d.ts +14 -0
- package/dist/components/Toggle/Toggle.js +256 -0
- package/dist/components/Tooltip/Tooltip.js +558 -655
- package/dist/components/Typography/Typography.d.ts +5 -5
- package/dist/components/Typography/Typography.stories.d.ts +13 -0
- package/dist/components/Typography/Typography.stories.js +15 -15
- package/dist/components/Typography/typography.test.js +5 -8
- package/dist/{Portal-P3fPvS3-.js → index-BNWbc5Kh.js} +5709 -5776
- package/dist/{index-D2P7y2mE.js → index-CqjC7P5Y.js} +4 -3
- package/dist/main.d.ts +16 -8
- package/dist/main.js +47 -27
- package/dist/useButton-Bc8IAgyk.js +106 -0
- package/dist/useIsFocusVisible-BH4IAdcw.js +69 -0
- package/dist/useTimeout-DxF9kiZL.js +36 -0
- package/package.json +5 -4
- package/dist/react-CGNQ6M5x.js +0 -117
- package/dist/useButton-JpyBo5M4.js +0 -187
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import '../../assets/Input.css';
|
|
2
|
+
import { jsxs as H, jsx as B } from "react/jsx-runtime";
|
|
3
|
+
import * as f from "react";
|
|
4
|
+
import { useState as pe, useId as ce } from "react";
|
|
5
|
+
import { c as F } from "../../clsx-DB4S2d7J.js";
|
|
6
|
+
import { Typography as L } from "../Typography/Typography.js";
|
|
7
|
+
import { a as _, _ as me } from "../../objectWithoutPropertiesLoose-D7Cp0Pg_.js";
|
|
8
|
+
import { g as fe, a as _e, u as he, e as z, b as Q, i as be, P as e, c as ge, d as Ce } from "../../index-CqjC7P5Y.js";
|
|
9
|
+
function ye(s) {
|
|
10
|
+
let l = "https://mui.com/production-error/?code=" + s;
|
|
11
|
+
for (let a = 1; a < arguments.length; a += 1)
|
|
12
|
+
l += "&args[]=" + encodeURIComponent(arguments[a]);
|
|
13
|
+
return "Minified MUI error #" + s + "; visit " + l + " for the full message.";
|
|
14
|
+
}
|
|
15
|
+
const X = /* @__PURE__ */ f.createContext(void 0);
|
|
16
|
+
process.env.NODE_ENV !== "production" && (X.displayName = "FormControlContext");
|
|
17
|
+
function we() {
|
|
18
|
+
return f.useContext(X);
|
|
19
|
+
}
|
|
20
|
+
const Z = "Input";
|
|
21
|
+
function ve(s) {
|
|
22
|
+
return fe(Z, s);
|
|
23
|
+
}
|
|
24
|
+
_e(Z, ["root", "formControl", "focused", "disabled", "error", "multiline", "input", "inputMultiline", "inputTypeSearch", "adornedStart", "adornedEnd"]);
|
|
25
|
+
function Ne(s = {}) {
|
|
26
|
+
const {
|
|
27
|
+
defaultValue: l,
|
|
28
|
+
disabled: a = !1,
|
|
29
|
+
error: h = !1,
|
|
30
|
+
onBlur: u,
|
|
31
|
+
onChange: b,
|
|
32
|
+
onFocus: P,
|
|
33
|
+
required: x = !1,
|
|
34
|
+
value: C,
|
|
35
|
+
inputRef: V
|
|
36
|
+
} = s, n = we();
|
|
37
|
+
let E, m, y, w, g;
|
|
38
|
+
if (n) {
|
|
39
|
+
var I, d, q;
|
|
40
|
+
if (E = void 0, m = (I = n.disabled) != null ? I : !1, y = (d = n.error) != null ? d : !1, w = (q = n.required) != null ? q : !1, g = n.value, process.env.NODE_ENV !== "production") {
|
|
41
|
+
const t = ["defaultValue", "disabled", "error", "required", "value"].filter((r) => s[r] !== void 0);
|
|
42
|
+
t.length > 0 && console.warn(["MUI: You have set props on an input that is inside a FormControl.", "Set these props on a FormControl instead. Otherwise they will be ignored.", `Ignored props: ${t.join(", ")}`].join(`
|
|
43
|
+
`));
|
|
44
|
+
}
|
|
45
|
+
} else
|
|
46
|
+
E = l, m = a, y = h, w = x, g = C;
|
|
47
|
+
const {
|
|
48
|
+
current: U
|
|
49
|
+
} = f.useRef(g != null), M = f.useCallback((t) => {
|
|
50
|
+
process.env.NODE_ENV !== "production" && t && t.nodeName !== "INPUT" && !t.focus && console.error(["MUI: You have provided a `slots.input` to the input component", "that does not correctly handle the `ref` prop.", "Make sure the `ref` prop is called with a HTMLInputElement."].join(`
|
|
51
|
+
`));
|
|
52
|
+
}, []), v = f.useRef(null), O = he(v, V, M), [N, R] = f.useState(!1);
|
|
53
|
+
f.useEffect(() => {
|
|
54
|
+
!n && m && N && (R(!1), u == null || u());
|
|
55
|
+
}, [n, m, N, u]);
|
|
56
|
+
const k = (t) => (r) => {
|
|
57
|
+
var o;
|
|
58
|
+
if (n != null && n.disabled) {
|
|
59
|
+
r.stopPropagation();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if ((o = t.onFocus) == null || o.call(t, r), n && n.onFocus) {
|
|
63
|
+
var c;
|
|
64
|
+
n == null || (c = n.onFocus) == null || c.call(n);
|
|
65
|
+
} else
|
|
66
|
+
R(!0);
|
|
67
|
+
}, A = (t) => (r) => {
|
|
68
|
+
var o;
|
|
69
|
+
(o = t.onBlur) == null || o.call(t, r), n && n.onBlur ? n.onBlur() : R(!1);
|
|
70
|
+
}, T = (t) => (r, ...o) => {
|
|
71
|
+
var c, j;
|
|
72
|
+
if (!U && (r.target || v.current) == null)
|
|
73
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." : ye(17));
|
|
74
|
+
n == null || (c = n.onChange) == null || c.call(n, r), (j = t.onChange) == null || j.call(t, r, ...o);
|
|
75
|
+
}, D = (t) => (r) => {
|
|
76
|
+
var o;
|
|
77
|
+
v.current && r.currentTarget === r.target && v.current.focus(), (o = t.onClick) == null || o.call(t, r);
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
disabled: m,
|
|
81
|
+
error: y,
|
|
82
|
+
focused: N,
|
|
83
|
+
formControlContext: n,
|
|
84
|
+
getInputProps: (t = {}) => {
|
|
85
|
+
const o = _({}, {
|
|
86
|
+
onBlur: u,
|
|
87
|
+
onChange: b,
|
|
88
|
+
onFocus: P
|
|
89
|
+
}, z(t)), c = _({}, o, {
|
|
90
|
+
onBlur: A(o),
|
|
91
|
+
onChange: T(o),
|
|
92
|
+
onFocus: k(o)
|
|
93
|
+
});
|
|
94
|
+
return _({}, c, {
|
|
95
|
+
"aria-invalid": y || void 0,
|
|
96
|
+
defaultValue: E,
|
|
97
|
+
value: g,
|
|
98
|
+
required: w,
|
|
99
|
+
disabled: m
|
|
100
|
+
}, t, {
|
|
101
|
+
ref: O
|
|
102
|
+
}, c);
|
|
103
|
+
},
|
|
104
|
+
getRootProps: (t = {}) => {
|
|
105
|
+
const r = z(s, ["onBlur", "onChange", "onFocus"]), o = _({}, r, z(t));
|
|
106
|
+
return _({}, t, o, {
|
|
107
|
+
onClick: D(o)
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
inputRef: O,
|
|
111
|
+
required: w,
|
|
112
|
+
value: g
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const Pe = ["aria-describedby", "aria-label", "aria-labelledby", "autoComplete", "autoFocus", "className", "defaultValue", "disabled", "endAdornment", "error", "id", "multiline", "name", "onClick", "onChange", "onKeyDown", "onKeyUp", "onFocus", "onBlur", "placeholder", "readOnly", "required", "startAdornment", "value", "type", "rows", "slotProps", "slots", "minRows", "maxRows"], xe = (s) => {
|
|
116
|
+
const {
|
|
117
|
+
disabled: l,
|
|
118
|
+
error: a,
|
|
119
|
+
focused: h,
|
|
120
|
+
formControlContext: u,
|
|
121
|
+
multiline: b,
|
|
122
|
+
startAdornment: P,
|
|
123
|
+
endAdornment: x
|
|
124
|
+
} = s;
|
|
125
|
+
return ge({
|
|
126
|
+
root: ["root", l && "disabled", a && "error", h && "focused", !!u && "formControl", b && "multiline", !!P && "adornedStart", !!x && "adornedEnd"],
|
|
127
|
+
input: ["input", l && "disabled", b && "multiline"]
|
|
128
|
+
}, Ce(ve));
|
|
129
|
+
}, ee = /* @__PURE__ */ f.forwardRef(function(l, a) {
|
|
130
|
+
var h, u, b;
|
|
131
|
+
const {
|
|
132
|
+
"aria-describedby": P,
|
|
133
|
+
"aria-label": x,
|
|
134
|
+
"aria-labelledby": C,
|
|
135
|
+
autoComplete: V,
|
|
136
|
+
autoFocus: n,
|
|
137
|
+
className: E,
|
|
138
|
+
defaultValue: m,
|
|
139
|
+
disabled: y,
|
|
140
|
+
endAdornment: w,
|
|
141
|
+
error: g,
|
|
142
|
+
id: I,
|
|
143
|
+
multiline: d = !1,
|
|
144
|
+
name: q,
|
|
145
|
+
onClick: U,
|
|
146
|
+
onChange: M,
|
|
147
|
+
onKeyDown: v,
|
|
148
|
+
onKeyUp: O,
|
|
149
|
+
onFocus: N,
|
|
150
|
+
onBlur: R,
|
|
151
|
+
placeholder: k,
|
|
152
|
+
readOnly: A,
|
|
153
|
+
required: T,
|
|
154
|
+
startAdornment: D,
|
|
155
|
+
value: p,
|
|
156
|
+
type: S,
|
|
157
|
+
rows: t,
|
|
158
|
+
slotProps: r = {},
|
|
159
|
+
slots: o = {},
|
|
160
|
+
minRows: c,
|
|
161
|
+
maxRows: j
|
|
162
|
+
} = l, Y = me(l, Pe), {
|
|
163
|
+
getRootProps: te,
|
|
164
|
+
getInputProps: ne,
|
|
165
|
+
focused: oe,
|
|
166
|
+
formControlContext: re,
|
|
167
|
+
error: se,
|
|
168
|
+
disabled: ae
|
|
169
|
+
} = Ne({
|
|
170
|
+
disabled: y,
|
|
171
|
+
defaultValue: m,
|
|
172
|
+
error: g,
|
|
173
|
+
onBlur: R,
|
|
174
|
+
onClick: U,
|
|
175
|
+
onChange: M,
|
|
176
|
+
onFocus: N,
|
|
177
|
+
required: T,
|
|
178
|
+
value: p
|
|
179
|
+
}), W = d ? void 0 : S ?? "text", $ = _({}, l, {
|
|
180
|
+
disabled: ae,
|
|
181
|
+
error: se,
|
|
182
|
+
focused: oe,
|
|
183
|
+
formControlContext: re,
|
|
184
|
+
multiline: d,
|
|
185
|
+
type: W
|
|
186
|
+
}), G = xe($), le = {
|
|
187
|
+
"aria-describedby": P,
|
|
188
|
+
"aria-label": x,
|
|
189
|
+
"aria-labelledby": C,
|
|
190
|
+
autoComplete: V,
|
|
191
|
+
autoFocus: n,
|
|
192
|
+
id: I,
|
|
193
|
+
onKeyDown: v,
|
|
194
|
+
onKeyUp: O,
|
|
195
|
+
name: q,
|
|
196
|
+
placeholder: k,
|
|
197
|
+
readOnly: A,
|
|
198
|
+
type: W
|
|
199
|
+
}, J = (h = o.root) != null ? h : "div", ie = Q({
|
|
200
|
+
elementType: J,
|
|
201
|
+
getSlotProps: te,
|
|
202
|
+
externalSlotProps: r.root,
|
|
203
|
+
externalForwardedProps: Y,
|
|
204
|
+
additionalProps: {
|
|
205
|
+
ref: a
|
|
206
|
+
},
|
|
207
|
+
ownerState: $,
|
|
208
|
+
className: [G.root, E]
|
|
209
|
+
}), K = d ? (u = o.textarea) != null ? u : "textarea" : (b = o.input) != null ? b : "input", ue = Q({
|
|
210
|
+
elementType: K,
|
|
211
|
+
getSlotProps: (de) => ne(_({}, le, de)),
|
|
212
|
+
externalSlotProps: r.input,
|
|
213
|
+
additionalProps: _({
|
|
214
|
+
rows: d ? t : void 0
|
|
215
|
+
}, d && !be(K) && {
|
|
216
|
+
minRows: t || c,
|
|
217
|
+
maxRows: t || j
|
|
218
|
+
}),
|
|
219
|
+
ownerState: $,
|
|
220
|
+
className: G.input
|
|
221
|
+
});
|
|
222
|
+
return process.env.NODE_ENV !== "production" && d && t && (c || j) && console.warn("MUI: You can not use the `minRows` or `maxRows` props when the input `rows` prop is set."), /* @__PURE__ */ H(J, _({}, ie, {
|
|
223
|
+
children: [D, /* @__PURE__ */ B(K, _({}, ue)), w]
|
|
224
|
+
}));
|
|
225
|
+
});
|
|
226
|
+
process.env.NODE_ENV !== "production" && (ee.propTypes = {
|
|
227
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
228
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
229
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
230
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
231
|
+
/**
|
|
232
|
+
* @ignore
|
|
233
|
+
*/
|
|
234
|
+
"aria-describedby": e.string,
|
|
235
|
+
/**
|
|
236
|
+
* @ignore
|
|
237
|
+
*/
|
|
238
|
+
"aria-label": e.string,
|
|
239
|
+
/**
|
|
240
|
+
* @ignore
|
|
241
|
+
*/
|
|
242
|
+
"aria-labelledby": e.string,
|
|
243
|
+
/**
|
|
244
|
+
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
245
|
+
* The name can be confusing, as it's more like an autofill.
|
|
246
|
+
* You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
|
|
247
|
+
*/
|
|
248
|
+
autoComplete: e.string,
|
|
249
|
+
/**
|
|
250
|
+
* If `true`, the `input` element is focused during the first mount.
|
|
251
|
+
*/
|
|
252
|
+
autoFocus: e.bool,
|
|
253
|
+
/**
|
|
254
|
+
* Class name applied to the root element.
|
|
255
|
+
*/
|
|
256
|
+
className: e.string,
|
|
257
|
+
/**
|
|
258
|
+
* The default value. Use when the component is not controlled.
|
|
259
|
+
*/
|
|
260
|
+
defaultValue: e.any,
|
|
261
|
+
/**
|
|
262
|
+
* If `true`, the component is disabled.
|
|
263
|
+
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
|
|
264
|
+
*/
|
|
265
|
+
disabled: e.bool,
|
|
266
|
+
/**
|
|
267
|
+
* Trailing adornment for this input.
|
|
268
|
+
*/
|
|
269
|
+
endAdornment: e.node,
|
|
270
|
+
/**
|
|
271
|
+
* If `true`, the `input` will indicate an error by setting the `aria-invalid` attribute on the input and the `baseui--error` class on the root element.
|
|
272
|
+
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
|
|
273
|
+
*/
|
|
274
|
+
error: e.bool,
|
|
275
|
+
/**
|
|
276
|
+
* The id of the `input` element.
|
|
277
|
+
*/
|
|
278
|
+
id: e.string,
|
|
279
|
+
/**
|
|
280
|
+
* @ignore
|
|
281
|
+
*/
|
|
282
|
+
inputRef: e.oneOfType([e.func, e.shape({
|
|
283
|
+
current: e.object
|
|
284
|
+
})]),
|
|
285
|
+
/**
|
|
286
|
+
* Maximum number of rows to display when multiline option is set to true.
|
|
287
|
+
*/
|
|
288
|
+
maxRows: e.number,
|
|
289
|
+
/**
|
|
290
|
+
* Minimum number of rows to display when multiline option is set to true.
|
|
291
|
+
*/
|
|
292
|
+
minRows: e.number,
|
|
293
|
+
/**
|
|
294
|
+
* If `true`, a `textarea` element is rendered.
|
|
295
|
+
* @default false
|
|
296
|
+
*/
|
|
297
|
+
multiline: e.bool,
|
|
298
|
+
/**
|
|
299
|
+
* Name attribute of the `input` element.
|
|
300
|
+
*/
|
|
301
|
+
name: e.string,
|
|
302
|
+
/**
|
|
303
|
+
* @ignore
|
|
304
|
+
*/
|
|
305
|
+
onBlur: e.func,
|
|
306
|
+
/**
|
|
307
|
+
* @ignore
|
|
308
|
+
*/
|
|
309
|
+
onChange: e.func,
|
|
310
|
+
/**
|
|
311
|
+
* @ignore
|
|
312
|
+
*/
|
|
313
|
+
onClick: e.func,
|
|
314
|
+
/**
|
|
315
|
+
* @ignore
|
|
316
|
+
*/
|
|
317
|
+
onFocus: e.func,
|
|
318
|
+
/**
|
|
319
|
+
* @ignore
|
|
320
|
+
*/
|
|
321
|
+
onKeyDown: e.func,
|
|
322
|
+
/**
|
|
323
|
+
* @ignore
|
|
324
|
+
*/
|
|
325
|
+
onKeyUp: e.func,
|
|
326
|
+
/**
|
|
327
|
+
* The short hint displayed in the `input` before the user enters a value.
|
|
328
|
+
*/
|
|
329
|
+
placeholder: e.string,
|
|
330
|
+
/**
|
|
331
|
+
* It prevents the user from changing the value of the field
|
|
332
|
+
* (not from interacting with the field).
|
|
333
|
+
*/
|
|
334
|
+
readOnly: e.bool,
|
|
335
|
+
/**
|
|
336
|
+
* If `true`, the `input` element is required.
|
|
337
|
+
* The prop defaults to the value (`false`) inherited from the parent FormControl component.
|
|
338
|
+
*/
|
|
339
|
+
required: e.bool,
|
|
340
|
+
/**
|
|
341
|
+
* Number of rows to display when multiline option is set to true.
|
|
342
|
+
*/
|
|
343
|
+
rows: e.number,
|
|
344
|
+
/**
|
|
345
|
+
* The props used for each slot inside the Input.
|
|
346
|
+
* @default {}
|
|
347
|
+
*/
|
|
348
|
+
slotProps: e.shape({
|
|
349
|
+
input: e.oneOfType([e.func, e.object]),
|
|
350
|
+
root: e.oneOfType([e.func, e.object])
|
|
351
|
+
}),
|
|
352
|
+
/**
|
|
353
|
+
* The components used for each slot inside the InputBase.
|
|
354
|
+
* Either a string to use a HTML element or a component.
|
|
355
|
+
* @default {}
|
|
356
|
+
*/
|
|
357
|
+
slots: e.shape({
|
|
358
|
+
input: e.elementType,
|
|
359
|
+
root: e.elementType,
|
|
360
|
+
textarea: e.elementType
|
|
361
|
+
}),
|
|
362
|
+
/**
|
|
363
|
+
* Leading adornment for this input.
|
|
364
|
+
*/
|
|
365
|
+
startAdornment: e.node,
|
|
366
|
+
/**
|
|
367
|
+
* Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
|
|
368
|
+
* @default 'text'
|
|
369
|
+
*/
|
|
370
|
+
type: e.oneOf(["button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week"]),
|
|
371
|
+
/**
|
|
372
|
+
* The value of the `input` element, required for a controlled component.
|
|
373
|
+
*/
|
|
374
|
+
value: e.any
|
|
375
|
+
});
|
|
376
|
+
const Ee = (s) => /* @__PURE__ */ f.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", "data-waves-icon": "fa/solid/circle-exclamation", fill: "currentColor", color: "currentColor", width: "1em", height: "1em", style: {
|
|
377
|
+
fill: "currentcolor",
|
|
378
|
+
color: "currentcolor",
|
|
379
|
+
width: "1em",
|
|
380
|
+
height: "1em"
|
|
381
|
+
}, ...s }, /* @__PURE__ */ f.createElement("path", { d: "M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM232 152C232 138.8 242.8 128 256 128s24 10.75 24 24v128c0 13.25-10.75 24-24 24S232 293.3 232 280V152zM256 400c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 385.9 273.4 400 256 400z" })), Re = "_input_hm5q2_1", Fe = "_input__label_hm5q2_4", i = {
|
|
382
|
+
input: Re,
|
|
383
|
+
input__label: Fe,
|
|
384
|
+
"input__input-el-wrapper": "_input__input-el-wrapper_hm5q2_9",
|
|
385
|
+
"input__input-el": "_input__input-el_hm5q2_9",
|
|
386
|
+
"input__left-icon": "_input__left-icon_hm5q2_30",
|
|
387
|
+
"input__right-icon": "_input__right-icon_hm5q2_33",
|
|
388
|
+
"input__messages-wrapper": "_input__messages-wrapper_hm5q2_36",
|
|
389
|
+
"input__info-message": "_input__info-message_hm5q2_44",
|
|
390
|
+
"input__error-message": "_input__error-message_hm5q2_44",
|
|
391
|
+
"input__chars-counter": "_input__chars-counter_hm5q2_55",
|
|
392
|
+
"input--disabled": "_input--disabled_hm5q2_59",
|
|
393
|
+
"input--focused": "_input--focused_hm5q2_65",
|
|
394
|
+
"input--error": "_input--error_hm5q2_68"
|
|
395
|
+
}, Ve = ({
|
|
396
|
+
label: s,
|
|
397
|
+
infoMessage: l,
|
|
398
|
+
errorMessage: a,
|
|
399
|
+
leftIcon: h,
|
|
400
|
+
rightIcon: u,
|
|
401
|
+
id: b,
|
|
402
|
+
disabled: P,
|
|
403
|
+
type: x = "text",
|
|
404
|
+
maxLength: C,
|
|
405
|
+
hideCharsCounter: V = !1,
|
|
406
|
+
onChange: n,
|
|
407
|
+
classNameWrapper: E,
|
|
408
|
+
classNameLabel: m,
|
|
409
|
+
classNameInput: y,
|
|
410
|
+
classNameInfoMessage: w,
|
|
411
|
+
classNameErrorMessage: g,
|
|
412
|
+
classNameCharsCounter: I,
|
|
413
|
+
"data-testid-wrapper": d,
|
|
414
|
+
"data-testid-label": q,
|
|
415
|
+
"data-testid-input": U,
|
|
416
|
+
"data-testid-infoMessage": M,
|
|
417
|
+
"data-testid-errorMessage": v,
|
|
418
|
+
"data-testid-charsCounter": O,
|
|
419
|
+
...N
|
|
420
|
+
}) => {
|
|
421
|
+
const [R, k] = pe(0), A = ce(), T = b || `input_${A}`;
|
|
422
|
+
Object.assign(N, { "data-testid": U });
|
|
423
|
+
const D = (p) => {
|
|
424
|
+
var S, t;
|
|
425
|
+
k((t = (S = p == null ? void 0 : p.target) == null ? void 0 : S.value) == null ? void 0 : t.length), n && n(p);
|
|
426
|
+
};
|
|
427
|
+
return /* @__PURE__ */ H("div", { className: F(i.input, E), "data-testid": d, children: [
|
|
428
|
+
s && /* @__PURE__ */ B(
|
|
429
|
+
L,
|
|
430
|
+
{
|
|
431
|
+
element: "label",
|
|
432
|
+
variant: "form-label",
|
|
433
|
+
elementProps: { htmlFor: T },
|
|
434
|
+
className: F(i.input__label, m),
|
|
435
|
+
"data-testid": q,
|
|
436
|
+
children: s
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
/* @__PURE__ */ B(
|
|
440
|
+
ee,
|
|
441
|
+
{
|
|
442
|
+
id: T,
|
|
443
|
+
type: x,
|
|
444
|
+
disabled: P,
|
|
445
|
+
error: !!a,
|
|
446
|
+
"aria-label": s,
|
|
447
|
+
slotProps: {
|
|
448
|
+
root: (p) => ({
|
|
449
|
+
className: F(i["input__input-el-wrapper"], {
|
|
450
|
+
[i["input--disabled"]]: p.disabled,
|
|
451
|
+
[i["input--focused"]]: p.focused,
|
|
452
|
+
[i["input--error"]]: p.error
|
|
453
|
+
})
|
|
454
|
+
}),
|
|
455
|
+
input: {
|
|
456
|
+
className: F(i["input__input-el"], y),
|
|
457
|
+
maxLength: C,
|
|
458
|
+
onChange: D,
|
|
459
|
+
...N
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
startAdornment: h && /* @__PURE__ */ B("span", { className: i["input__left-icon"], children: h }),
|
|
463
|
+
endAdornment: u && /* @__PURE__ */ B("span", { className: i["input__right-icon"], children: u })
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ H("div", { className: i["input__messages-wrapper"], children: [
|
|
467
|
+
(a || l) && /* @__PURE__ */ H(
|
|
468
|
+
L,
|
|
469
|
+
{
|
|
470
|
+
variant: "form-hint",
|
|
471
|
+
className: a ? F(i["input__error-message"], g) : F(i["input__info-message"], w),
|
|
472
|
+
"data-testid": a ? v : M,
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ B(Ee, {}),
|
|
475
|
+
a || l
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
),
|
|
479
|
+
C && !V && /* @__PURE__ */ H(
|
|
480
|
+
L,
|
|
481
|
+
{
|
|
482
|
+
variant: "form-hint",
|
|
483
|
+
className: F(i["input__chars-counter"], I),
|
|
484
|
+
"data-testid": O,
|
|
485
|
+
children: [
|
|
486
|
+
R,
|
|
487
|
+
" / ",
|
|
488
|
+
C
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
)
|
|
492
|
+
] })
|
|
493
|
+
] });
|
|
494
|
+
};
|
|
495
|
+
export {
|
|
496
|
+
Ve as Input
|
|
497
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ label, infoMessage, errorMessage, leftIcon, rightIcon, id, disabled, type, maxLength, hideCharsCounter, onChange, classNameWrapper, classNameLabel, classNameInput, classNameInfoMessage, classNameErrorMessage, classNameCharsCounter, "data-testid-wrapper": testIdWrapper, "data-testid-label": testIdLabel, "data-testid-input": testIdInput, "data-testid-infoMessage": testIdInfoMessage, "data-testid-errorMessage": testIdErrorMessage, "data-testid-charsCounter": testIdCharsCounter, ...rest }: import('react').InputHTMLAttributes<HTMLInputElement> & {
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
infoMessage?: string | undefined;
|
|
8
|
+
errorMessage?: string | undefined;
|
|
9
|
+
leftIcon?: import('react').ReactNode;
|
|
10
|
+
rightIcon?: import('react').ReactNode;
|
|
11
|
+
type?: "text" | "password" | undefined;
|
|
12
|
+
hideCharsCounter?: boolean | undefined;
|
|
13
|
+
classNameWrapper?: string | undefined;
|
|
14
|
+
classNameLabel?: string | undefined;
|
|
15
|
+
classNameInput?: string | undefined;
|
|
16
|
+
classNameInfoMessage?: string | undefined;
|
|
17
|
+
classNameErrorMessage?: string | undefined;
|
|
18
|
+
classNameCharsCounter?: string | undefined;
|
|
19
|
+
'data-testid-wrapper'?: string | undefined;
|
|
20
|
+
'data-testid-label'?: string | undefined;
|
|
21
|
+
'data-testid-input'?: string | undefined;
|
|
22
|
+
'data-testid-infoMessage'?: string | undefined;
|
|
23
|
+
'data-testid-errorMessage'?: string | undefined;
|
|
24
|
+
'data-testid-charsCounter'?: string | undefined;
|
|
25
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
tags: string[];
|
|
27
|
+
parameters: {
|
|
28
|
+
layout: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<typeof meta>;
|
|
33
|
+
export declare const Simple: Story;
|
|
34
|
+
export declare const WithLabel: Story;
|
|
35
|
+
export declare const WithPlaceholder: Story;
|
|
36
|
+
export declare const Disabled: Story;
|
|
37
|
+
export declare const WithMaxLength: Story;
|
|
38
|
+
export declare const WithMaxLengthAndHideCharsCounter: Story;
|
|
39
|
+
export declare const WithLeftIcon: Story;
|
|
40
|
+
export declare const WithRightIconAndClickEvent: Story;
|
|
41
|
+
export declare const WithBothIcons: Story;
|
|
42
|
+
export declare const WithInfoMessage: Story;
|
|
43
|
+
export declare const WithErrorMessage: Story;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { Input as n } from "./Input.js";
|
|
4
|
+
const m = {
|
|
5
|
+
title: "Components/Input",
|
|
6
|
+
component: n,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "padded"
|
|
10
|
+
}
|
|
11
|
+
}, g = {
|
|
12
|
+
args: {}
|
|
13
|
+
}, u = {
|
|
14
|
+
name: "With label",
|
|
15
|
+
args: {
|
|
16
|
+
label: "What is your name?"
|
|
17
|
+
}
|
|
18
|
+
}, W = {
|
|
19
|
+
name: "With placeholder",
|
|
20
|
+
args: {
|
|
21
|
+
label: "What is your name?",
|
|
22
|
+
placeholder: "What is your name?"
|
|
23
|
+
}
|
|
24
|
+
}, d = {
|
|
25
|
+
args: {
|
|
26
|
+
label: "What is your name?",
|
|
27
|
+
value: "Marola DS",
|
|
28
|
+
disabled: !0
|
|
29
|
+
}
|
|
30
|
+
}, p = {
|
|
31
|
+
name: "With max length",
|
|
32
|
+
args: {
|
|
33
|
+
label: "What is your name?",
|
|
34
|
+
infoMessage: "Text length counter",
|
|
35
|
+
maxLength: 10
|
|
36
|
+
}
|
|
37
|
+
}, y = {
|
|
38
|
+
name: "With max length and no chars counter",
|
|
39
|
+
args: {
|
|
40
|
+
label: "What is your name?",
|
|
41
|
+
infoMessage: "Text length counter",
|
|
42
|
+
maxLength: 10,
|
|
43
|
+
hideCharsCounter: !0
|
|
44
|
+
}
|
|
45
|
+
}, f = {
|
|
46
|
+
name: "With left icon",
|
|
47
|
+
args: {
|
|
48
|
+
label: "What is your name?",
|
|
49
|
+
placeholder: "Hey, I have an icon!",
|
|
50
|
+
leftIcon: "😁"
|
|
51
|
+
}
|
|
52
|
+
}, b = {
|
|
53
|
+
name: "With right icon and click event",
|
|
54
|
+
render: () => {
|
|
55
|
+
const [o, s] = t(""), [r, h] = t(!1);
|
|
56
|
+
return /* @__PURE__ */ a(
|
|
57
|
+
n,
|
|
58
|
+
{
|
|
59
|
+
label: "What is your name?",
|
|
60
|
+
placeholder: "What is your name?",
|
|
61
|
+
type: r ? "text" : "password",
|
|
62
|
+
rightIcon: /* @__PURE__ */ a("span", { style: { cursor: "pointer" }, onClick: () => h((e) => !e), children: "😁" }),
|
|
63
|
+
value: o,
|
|
64
|
+
onChange: (e) => s(e.target.value),
|
|
65
|
+
infoMessage: "Type something and click on the icon"
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}, x = {
|
|
70
|
+
name: "With both icons",
|
|
71
|
+
args: {
|
|
72
|
+
label: "What is your name?",
|
|
73
|
+
placeholder: "Hey, I have icons!",
|
|
74
|
+
leftIcon: "😁",
|
|
75
|
+
rightIcon: "😁"
|
|
76
|
+
}
|
|
77
|
+
}, I = {
|
|
78
|
+
name: "With info message",
|
|
79
|
+
args: {
|
|
80
|
+
label: "What is your name?",
|
|
81
|
+
placeholder: "What is your name?",
|
|
82
|
+
infoMessage: "The name must have less than 50 chars"
|
|
83
|
+
}
|
|
84
|
+
}, M = {
|
|
85
|
+
name: "With error message",
|
|
86
|
+
args: {
|
|
87
|
+
label: "What is your name?",
|
|
88
|
+
placeholder: "What is your name?",
|
|
89
|
+
infoMessage: "The name must have less than 50 chars",
|
|
90
|
+
errorMessage: "Invalid name"
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
d as Disabled,
|
|
95
|
+
g as Simple,
|
|
96
|
+
x as WithBothIcons,
|
|
97
|
+
M as WithErrorMessage,
|
|
98
|
+
I as WithInfoMessage,
|
|
99
|
+
u as WithLabel,
|
|
100
|
+
f as WithLeftIcon,
|
|
101
|
+
p as WithMaxLength,
|
|
102
|
+
y as WithMaxLengthAndHideCharsCounter,
|
|
103
|
+
W as WithPlaceholder,
|
|
104
|
+
b as WithRightIconAndClickEvent,
|
|
105
|
+
m as default
|
|
106
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export interface LoadingSpinnerProps {
|
|
2
|
+
/** Whether to invert colours or not */
|
|
2
3
|
invert?: boolean;
|
|
4
|
+
/** Space seperated list of CSS classes to apply */
|
|
3
5
|
classNames?: string;
|
|
4
6
|
}
|
|
5
7
|
export declare const LoadingSpinner: ({ invert, classNames }: LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ invert, classNames }: import('./LoadingSpinner').LoadingSpinnerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
tags: string[];
|
|
7
|
+
decorators: ((Story: import('@storybook/types').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
8
|
+
invert?: boolean | undefined;
|
|
9
|
+
classNames?: string | undefined;
|
|
10
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
export declare const Simple: Story;
|