@pismo/marola 2.0.0 → 2.0.2
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/RadioButton.module-B4kmS66R.js +292 -0
- package/dist/assets/RadioButton.css +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/Autocomplete/Autocomplete.js +248 -246
- package/dist/components/Autocomplete/Autocomplete.stories.d.ts +3 -1
- package/dist/components/Autocomplete/Autocomplete.test.d.ts +1 -0
- package/dist/components/RadioButton/RadioButton.d.ts +7 -4
- package/dist/components/RadioButton/RadioButton.js +911 -33
- package/dist/components/RadioButton/RadioButton.stories.d.ts +7 -12
- package/dist/components/RadioButton/RadioOption.d.ts +13 -0
- package/dist/components/RadioButton/RadioOption.js +438 -0
- package/package.json +2 -1
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { P as _ } from "./useSlotProps-DSnfx453.js";
|
|
4
|
+
import './assets/RadioButton.css';const y = () => {
|
|
5
|
+
};
|
|
6
|
+
function w(e, t) {
|
|
7
|
+
let n = {};
|
|
8
|
+
return Object.entries(e).forEach(([o, r]) => {
|
|
9
|
+
if (t != null && t.hasOwnProperty(o)) {
|
|
10
|
+
const d = t[o](r);
|
|
11
|
+
d != null && (n = {
|
|
12
|
+
...n,
|
|
13
|
+
...d
|
|
14
|
+
});
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
r === !0 ? n[`data-${o.toLowerCase()}`] = "" : r && (n[`data-${o.toLowerCase()}`] = r.toString());
|
|
18
|
+
}), n;
|
|
19
|
+
}
|
|
20
|
+
function O(e, t) {
|
|
21
|
+
return typeof e == "function" ? e(t) : e;
|
|
22
|
+
}
|
|
23
|
+
function V(e, ...t) {
|
|
24
|
+
let n = t[0];
|
|
25
|
+
for (let o = 1; o < t.length; o += 1)
|
|
26
|
+
n = b(n, t[o]);
|
|
27
|
+
return b(e, n);
|
|
28
|
+
}
|
|
29
|
+
function b(e, t) {
|
|
30
|
+
return e ? Object.entries(e).reduce((n, [o, r]) => (// This approach is more efficient than using a regex.
|
|
31
|
+
o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= 65 && o.charCodeAt(2) <= 90 && typeof r == "function" ? n[o] = (d) => {
|
|
32
|
+
let u = !1;
|
|
33
|
+
const f = r, l = t[o], c = d;
|
|
34
|
+
c.preventBaseUIHandler = () => {
|
|
35
|
+
u = !0;
|
|
36
|
+
};
|
|
37
|
+
const m = f(c);
|
|
38
|
+
return u || l == null || l(c), m;
|
|
39
|
+
} : o === "style" ? (r || t.style) && (n[o] = {
|
|
40
|
+
...t.style,
|
|
41
|
+
...r || {}
|
|
42
|
+
}) : o === "className" ? r ? t.className ? n[o] = r + " " + t.className : n[o] = r : n[o] = t.className : n[o] = r, n), {
|
|
43
|
+
...t
|
|
44
|
+
}) : t;
|
|
45
|
+
}
|
|
46
|
+
function L(e, t, n) {
|
|
47
|
+
return typeof e == "function" ? e(t, n) : /* @__PURE__ */ s.cloneElement(e, {
|
|
48
|
+
...V(e.props, t),
|
|
49
|
+
ref: t.ref
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function T(...e) {
|
|
53
|
+
return s.useMemo(() => e.every((t) => t == null) ? null : (t) => {
|
|
54
|
+
e.forEach((n) => {
|
|
55
|
+
P(n, t);
|
|
56
|
+
});
|
|
57
|
+
}, e);
|
|
58
|
+
}
|
|
59
|
+
function P(e, t) {
|
|
60
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
61
|
+
}
|
|
62
|
+
const j = parseInt(s.version, 10);
|
|
63
|
+
function D(e) {
|
|
64
|
+
return j >= e;
|
|
65
|
+
}
|
|
66
|
+
function F(e, ...t) {
|
|
67
|
+
let n;
|
|
68
|
+
return typeof e != "function" ? n = D(19) ? e.props.ref : e.ref : n = null, T(n, ...t);
|
|
69
|
+
}
|
|
70
|
+
const M = {
|
|
71
|
+
button: (e) => /* @__PURE__ */ i("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
...e
|
|
74
|
+
}),
|
|
75
|
+
div: (e) => /* @__PURE__ */ i("div", {
|
|
76
|
+
...e
|
|
77
|
+
}),
|
|
78
|
+
h2: (e) => /* @__PURE__ */ i("h2", {
|
|
79
|
+
...e
|
|
80
|
+
}),
|
|
81
|
+
h3: (e) => /* @__PURE__ */ i("h3", {
|
|
82
|
+
...e
|
|
83
|
+
}),
|
|
84
|
+
output: (e) => /* @__PURE__ */ i("output", {
|
|
85
|
+
...e
|
|
86
|
+
}),
|
|
87
|
+
p: (e) => /* @__PURE__ */ i("p", {
|
|
88
|
+
...e
|
|
89
|
+
}),
|
|
90
|
+
span: (e) => /* @__PURE__ */ i("span", {
|
|
91
|
+
...e
|
|
92
|
+
}),
|
|
93
|
+
a: (e) => /* @__PURE__ */ i("a", {
|
|
94
|
+
...e
|
|
95
|
+
}),
|
|
96
|
+
label: (e) => /* @__PURE__ */ i("label", {
|
|
97
|
+
...e
|
|
98
|
+
}),
|
|
99
|
+
input: (e) => /* @__PURE__ */ i("input", {
|
|
100
|
+
...e
|
|
101
|
+
}),
|
|
102
|
+
fieldset: (e) => /* @__PURE__ */ i("fieldset", {
|
|
103
|
+
...e
|
|
104
|
+
}),
|
|
105
|
+
form: (e) => /* @__PURE__ */ i("form", {
|
|
106
|
+
...e
|
|
107
|
+
}),
|
|
108
|
+
img: (e) => /* @__PURE__ */ i("img", {
|
|
109
|
+
alt: "",
|
|
110
|
+
...e
|
|
111
|
+
})
|
|
112
|
+
};
|
|
113
|
+
function W(e) {
|
|
114
|
+
const {
|
|
115
|
+
render: t,
|
|
116
|
+
className: n,
|
|
117
|
+
state: o,
|
|
118
|
+
ref: r,
|
|
119
|
+
propGetter: d = (I) => I,
|
|
120
|
+
extraProps: u,
|
|
121
|
+
customStyleHookMapping: f
|
|
122
|
+
} = e, l = O(n, o), m = {
|
|
123
|
+
...s.useMemo(() => w(o, f), [o, f]),
|
|
124
|
+
...u
|
|
125
|
+
};
|
|
126
|
+
let p;
|
|
127
|
+
typeof t == "string" ? p = M[t] : p = t;
|
|
128
|
+
const C = d(m), x = {
|
|
129
|
+
...C,
|
|
130
|
+
ref: F(p, r, C.ref)
|
|
131
|
+
};
|
|
132
|
+
return l !== void 0 && (x.className = l), {
|
|
133
|
+
renderElement: () => L(p, x, o)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const R = typeof window < "u" ? s.useLayoutEffect : s.useEffect, g = /* @__PURE__ */ s.createContext({
|
|
137
|
+
register: () => {
|
|
138
|
+
},
|
|
139
|
+
unregister: () => {
|
|
140
|
+
},
|
|
141
|
+
map: /* @__PURE__ */ new Map(),
|
|
142
|
+
elementsRef: {
|
|
143
|
+
current: []
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
process.env.NODE_ENV !== "production" && (g.displayName = "CompositeListContext");
|
|
147
|
+
function Y() {
|
|
148
|
+
return s.useContext(g);
|
|
149
|
+
}
|
|
150
|
+
function z(e) {
|
|
151
|
+
const t = s.useRef(e);
|
|
152
|
+
return R(() => {
|
|
153
|
+
t.current = e;
|
|
154
|
+
}), s.useCallback((...n) => {
|
|
155
|
+
var o;
|
|
156
|
+
return (o = t.current) == null ? void 0 : o.call(t, ...n);
|
|
157
|
+
}, []);
|
|
158
|
+
}
|
|
159
|
+
const A = _.oneOfType([_.func, _.object]);
|
|
160
|
+
function J(e) {
|
|
161
|
+
const t = s.useRef(e);
|
|
162
|
+
return R(() => {
|
|
163
|
+
t.current = e;
|
|
164
|
+
}), t;
|
|
165
|
+
}
|
|
166
|
+
let h = /* @__PURE__ */ function(e) {
|
|
167
|
+
return e.disabled = "data-disabled", e.valid = "data-valid", e.invalid = "data-invalid", e.touched = "data-touched", e.dirty = "data-dirty", e.filled = "data-filled", e.focused = "data-focused", e;
|
|
168
|
+
}({});
|
|
169
|
+
const U = {
|
|
170
|
+
badInput: !1,
|
|
171
|
+
customError: !1,
|
|
172
|
+
patternMismatch: !1,
|
|
173
|
+
rangeOverflow: !1,
|
|
174
|
+
rangeUnderflow: !1,
|
|
175
|
+
stepMismatch: !1,
|
|
176
|
+
tooLong: !1,
|
|
177
|
+
tooShort: !1,
|
|
178
|
+
typeMismatch: !1,
|
|
179
|
+
valid: null,
|
|
180
|
+
valueMissing: !1
|
|
181
|
+
}, K = {
|
|
182
|
+
valid(e) {
|
|
183
|
+
return e === null ? null : e ? {
|
|
184
|
+
[h.valid]: ""
|
|
185
|
+
} : {
|
|
186
|
+
[h.invalid]: ""
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}, a = () => {
|
|
190
|
+
}, v = /* @__PURE__ */ s.createContext({
|
|
191
|
+
invalid: void 0,
|
|
192
|
+
controlId: void 0,
|
|
193
|
+
setControlId: a,
|
|
194
|
+
labelId: void 0,
|
|
195
|
+
setLabelId: a,
|
|
196
|
+
messageIds: [],
|
|
197
|
+
setMessageIds: a,
|
|
198
|
+
name: void 0,
|
|
199
|
+
validityData: {
|
|
200
|
+
state: U,
|
|
201
|
+
errors: [],
|
|
202
|
+
error: "",
|
|
203
|
+
value: "",
|
|
204
|
+
initialValue: null
|
|
205
|
+
},
|
|
206
|
+
setValidityData: a,
|
|
207
|
+
disabled: void 0,
|
|
208
|
+
touched: !1,
|
|
209
|
+
setTouched: a,
|
|
210
|
+
dirty: !1,
|
|
211
|
+
setDirty: a,
|
|
212
|
+
filled: !1,
|
|
213
|
+
setFilled: a,
|
|
214
|
+
focused: !1,
|
|
215
|
+
setFocused: a,
|
|
216
|
+
validate: () => null,
|
|
217
|
+
validationMode: "onBlur",
|
|
218
|
+
validationDebounceTime: 0,
|
|
219
|
+
state: {
|
|
220
|
+
disabled: !1,
|
|
221
|
+
valid: null,
|
|
222
|
+
touched: !1,
|
|
223
|
+
dirty: !1,
|
|
224
|
+
filled: !1,
|
|
225
|
+
focused: !1
|
|
226
|
+
},
|
|
227
|
+
markedDirtyRef: {
|
|
228
|
+
current: !1
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
process.env.NODE_ENV !== "production" && (v.displayName = "FieldRootContext");
|
|
232
|
+
function Q(e = !0) {
|
|
233
|
+
const t = s.useContext(v);
|
|
234
|
+
if (t.setControlId === a && !e)
|
|
235
|
+
throw new Error("Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.");
|
|
236
|
+
return t;
|
|
237
|
+
}
|
|
238
|
+
const E = /* @__PURE__ */ s.createContext({
|
|
239
|
+
disabled: void 0,
|
|
240
|
+
readOnly: void 0,
|
|
241
|
+
required: void 0,
|
|
242
|
+
checkedValue: "",
|
|
243
|
+
setCheckedValue: y,
|
|
244
|
+
onValueChange: y,
|
|
245
|
+
touched: !1,
|
|
246
|
+
setTouched: y
|
|
247
|
+
});
|
|
248
|
+
process.env.NODE_ENV !== "production" && (E.displayName = "RadioGroupContext");
|
|
249
|
+
function X() {
|
|
250
|
+
return s.useContext(E);
|
|
251
|
+
}
|
|
252
|
+
const N = /* @__PURE__ */ s.createContext(void 0);
|
|
253
|
+
process.env.NODE_ENV !== "production" && (N.displayName = "CompositeRootContext");
|
|
254
|
+
function Z() {
|
|
255
|
+
const e = s.useContext(N);
|
|
256
|
+
if (e === void 0)
|
|
257
|
+
throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");
|
|
258
|
+
return e;
|
|
259
|
+
}
|
|
260
|
+
const H = "_option_1xyfv_9", S = "_radio_1xyfv_1", B = "_indicator_1xyfv_43", k = {
|
|
261
|
+
"radio-label": "_radio-label_1xyfv_1",
|
|
262
|
+
"radio-label__disabled": "_radio-label__disabled_1xyfv_4",
|
|
263
|
+
option: H,
|
|
264
|
+
radio: S,
|
|
265
|
+
indicator: B,
|
|
266
|
+
"legacy-radio": "_legacy-radio_1xyfv_59",
|
|
267
|
+
"legacy-radio--label": "_legacy-radio--label_1xyfv_67",
|
|
268
|
+
"legacy-radio--label__disabled": "_legacy-radio--label__disabled_1xyfv_70",
|
|
269
|
+
"legacy-radio--input": "_legacy-radio--input_1xyfv_74",
|
|
270
|
+
"legacy-radio--input__disabled": "_legacy-radio--input__disabled_1xyfv_84",
|
|
271
|
+
"legacy-radio--disabled": "_legacy-radio--disabled_1xyfv_95"
|
|
272
|
+
};
|
|
273
|
+
export {
|
|
274
|
+
g as C,
|
|
275
|
+
U as D,
|
|
276
|
+
y as N,
|
|
277
|
+
E as R,
|
|
278
|
+
Y as a,
|
|
279
|
+
z as b,
|
|
280
|
+
J as c,
|
|
281
|
+
X as d,
|
|
282
|
+
Q as e,
|
|
283
|
+
Z as f,
|
|
284
|
+
T as g,
|
|
285
|
+
W as h,
|
|
286
|
+
K as i,
|
|
287
|
+
N as j,
|
|
288
|
+
V as m,
|
|
289
|
+
A as r,
|
|
290
|
+
k as s,
|
|
291
|
+
R as u
|
|
292
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._radio-label_1xyfv_1{margin-left:8px}._radio-label__disabled_1xyfv_4{color:var(--gray-95);opacity:.25}._option_1xyfv_9{display:flex;align-items:center}._radio_1xyfv_1{display:flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--accent);border:none;border-radius:100%}._radio_1xyfv_1[data-unchecked]{background-color:transparent;border:1px solid var(--gray-95)}._radio_1xyfv_1[data-disabled]{color:var(--gray-95);opacity:.25}._radio_1xyfv_1[data-checked]{border:solid 1px var(--accent)}._radio_1xyfv_1:not(._radio__disabled_1xyfv_35):hover{border:solid 1px var(--accent)}._radio_1xyfv_1:not(._radio__disabled_1xyfv_35):focus{border:solid 1px var(--accent);box-shadow:0 0 0 2px #1778ff26}._indicator_1xyfv_43{display:flex;align-items:center;justify-content:center}._indicator_1xyfv_43[data-unchecked]{display:none}._indicator_1xyfv_43:before{width:.5rem;height:.5rem;content:"";background-color:var(--accent);border-radius:100%}._legacy-radio_1xyfv_59{display:flex;align-items:center;cursor:pointer}._legacy-radio_1xyfv_59 input[type=radio]{display:none}._legacy-radio--label_1xyfv_67{margin-left:8px}._legacy-radio--label__disabled_1xyfv_70{color:var(--gray-95);opacity:.25}._legacy-radio--input_1xyfv_74{display:flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--accent);border:solid 1px var(--border);border-radius:8px}._legacy-radio--input__disabled_1xyfv_84{color:var(--gray-95);opacity:.25}._legacy-radio--input_1xyfv_74:not(._legacy-radio--input__disabled_1xyfv_84):hover{border:solid 1px var(--accent)}._legacy-radio--input_1xyfv_74:not(._legacy-radio--input__disabled_1xyfv_84):focus{border:solid 1px var(--accent);box-shadow:0 0 0 2px var(--accent)}._legacy-radio--disabled_1xyfv_95{cursor:default}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { SyntheticEvent } from 'react';
|
|
1
|
+
import { default as React, SyntheticEvent } from 'react';
|
|
2
2
|
import { InputProps } from '../Input/Input.tsx';
|
|
3
3
|
export type AutocompleteProps<T> = Omit<InputProps, 'onChange' | 'value'> & {
|
|
4
4
|
/** Object key to be used as label when options are an array of object */
|
|
5
5
|
labelKey?: T extends object ? keyof T : never;
|
|
6
6
|
/** Object key to be used as value when options are an array of object */
|
|
7
7
|
valueKey?: T extends object ? keyof T : never;
|
|
8
|
+
/** Method which returns a custom label for options */
|
|
9
|
+
renderOption?: (option: T) => React.ReactNode;
|
|
10
|
+
/** Method which returns a custom label for the selected */
|
|
11
|
+
customSelectedOptionLabel?: (option: T) => string;
|
|
8
12
|
/** Value */
|
|
9
13
|
value?: T;
|
|
10
14
|
/** Options array */
|
|
@@ -16,4 +20,4 @@ export type AutocompleteProps<T> = Omit<InputProps, 'onChange' | 'value'> & {
|
|
|
16
20
|
/** callback when characters are entered into the input box */
|
|
17
21
|
onInputChange?: (event: SyntheticEvent<Element, Event>, newValue: string) => void;
|
|
18
22
|
};
|
|
19
|
-
export declare const Autocomplete: <T extends string | object>({ labelKey, valueKey, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, ...props }: AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Autocomplete: <T extends string | object>({ labelKey, valueKey, renderOption, customSelectedOptionLabel, options, type, value, onChange, onInputChange, classNameWrapper, "data-testid-wrapper": dataTestId, classNameInputWrapper, ...props }: AutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|