@yr3/ui 1.0.19 → 1.0.20
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/components/Collapse/collapse.css +0 -1
- package/dist/components/Collapse/collapse.css.map +1 -1
- package/dist/components/Date/month.css +16 -2
- package/dist/components/Date/month.css.map +1 -1
- package/dist/components/Picker/picker.css +124 -0
- package/dist/components/Picker/picker.css.map +1 -0
- package/dist/index.cjs +274 -98
- package/dist/index.d.cts +70 -13
- package/dist/index.d.ts +70 -13
- package/dist/index.js +273 -98
- package/dist/styles/index.css +139 -3
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,6 +29,8 @@ var bemMerge = (...args) => {
|
|
|
29
29
|
|
|
30
30
|
// src/utils/calendar.ts
|
|
31
31
|
import dayjs from "dayjs";
|
|
32
|
+
import updatelocale from "dayjs/plugin/updateLocale";
|
|
33
|
+
dayjs.extend(updatelocale);
|
|
32
34
|
function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
33
35
|
const today = dayjs().startOf("day");
|
|
34
36
|
const startOfMonth = dayjs().year(year).month(month).startOf("month");
|
|
@@ -102,17 +104,23 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
102
104
|
currentDay: dayCurrent
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
|
-
function getMonthCalendarProps({ year,
|
|
107
|
+
function getMonthCalendarProps({ year, data, value, daysFormat }) {
|
|
106
108
|
const startIndex = dayjs().year(year).month().valueOf();
|
|
109
|
+
dayjs.updateLocale("en", {
|
|
110
|
+
months: daysFormat?.months || ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]
|
|
111
|
+
});
|
|
107
112
|
return {
|
|
108
|
-
month: dayjs().set("m", month).format(formatMonth || "MMM"),
|
|
109
113
|
year,
|
|
110
114
|
startIndex,
|
|
111
|
-
years,
|
|
115
|
+
years: data.years,
|
|
116
|
+
value,
|
|
117
|
+
last: !value ? "" : dayjs().year(Number(value?.split("-")[1])).month(Number(value?.split("-")[0]) - 2).format("MM-YYYY"),
|
|
118
|
+
prev: !value ? "" : dayjs().year(Number(value?.split("-")[1])).month(Number(value?.split("-")[0])).format("MM-YYYY"),
|
|
112
119
|
months: Array.from({ length: 12 }, (_, i) => ({
|
|
113
|
-
label: dayjs().month(i).format(
|
|
114
|
-
value: dayjs().month(i).format("MM"),
|
|
115
|
-
disabled: dayjs().year(year).month(i).isAfter(dayjs(), "month") ||
|
|
120
|
+
label: dayjs().month(i).format(daysFormat?.month || "MMM"),
|
|
121
|
+
value: dayjs().month(i).format(daysFormat?.value || "MM"),
|
|
122
|
+
disabled: dayjs().year(year).month(i).isAfter(dayjs(), "month") || data.exclude.find((e) => e.year === year)?.months.includes(i),
|
|
123
|
+
selected: !data.selected ? false : dayjs().year(year).month(Number(value?.split("-")[0]) - 1).format("MM") === dayjs().month(i).format(daysFormat?.value || "MM")
|
|
116
124
|
}))
|
|
117
125
|
};
|
|
118
126
|
}
|
|
@@ -1678,16 +1686,23 @@ var initialPropsComponent3 = {
|
|
|
1678
1686
|
style: {}
|
|
1679
1687
|
}
|
|
1680
1688
|
};
|
|
1681
|
-
var MonthSelector = ({ label,
|
|
1689
|
+
var MonthSelector = ({ label, value, defaultValue, propsComponent, data, daysFormat, onNext, onLast }) => {
|
|
1682
1690
|
const [open, setOpen] = React10.useState(false);
|
|
1683
1691
|
const [valueState, setValueState] = React10.useState(value || defaultValue || null);
|
|
1684
|
-
const [yearSelected, setYearSelected] = React10.useState(years.findIndex((y) =>
|
|
1692
|
+
const [yearSelected, setYearSelected] = React10.useState(data?.years.findIndex((y) => data.year) || 0);
|
|
1685
1693
|
const ref = React10.useRef(null);
|
|
1686
1694
|
useClickAway(ref, () => setOpen(false));
|
|
1687
1695
|
const properties = mergeDeep(initialPropsComponent3, propsComponent || {});
|
|
1688
1696
|
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1689
1697
|
const containerClasses = monthSelectorContainerVariants({ color: properties?.container?.color });
|
|
1690
|
-
const
|
|
1698
|
+
const getData = React10.useMemo(() => getMonthCalendarProps({ year: data.years[yearSelected], data, daysFormat, value: valueState }), [yearSelected, data, daysFormat, valueState]);
|
|
1699
|
+
React10.useEffect(() => {
|
|
1700
|
+
if (onNext) onNext(getData.prev);
|
|
1701
|
+
if (onLast) onLast(getData.last);
|
|
1702
|
+
}, [getData]);
|
|
1703
|
+
React10.useEffect(() => {
|
|
1704
|
+
setValueState(value || defaultValue || null);
|
|
1705
|
+
}, [value, defaultValue]);
|
|
1691
1706
|
return /* @__PURE__ */ jsxs6("div", { className: "yr3MonthSelector", ref, children: [
|
|
1692
1707
|
/* @__PURE__ */ jsx24(
|
|
1693
1708
|
Input,
|
|
@@ -1735,15 +1750,15 @@ var MonthSelector = ({ label, year, month, value, defaultValue, propsComponent,
|
|
|
1735
1750
|
children: [
|
|
1736
1751
|
/* @__PURE__ */ jsx24("button", { disabled: yearSelected === 0, type: "button", className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `, onClick: () => setYearSelected(yearSelected - 1), children: /* @__PURE__ */ jsx24(IconLeft, { width: 20, height: 20, stroke: "currentColor" }) }),
|
|
1737
1752
|
/* @__PURE__ */ jsx24("div", { className: `yr3MonthSelector--year-option`, children: /* @__PURE__ */ jsxs6(Text, { variant: "body1", color: "primary", children: [
|
|
1738
|
-
years[yearSelected],
|
|
1753
|
+
data.years[yearSelected],
|
|
1739
1754
|
" "
|
|
1740
1755
|
] }) }),
|
|
1741
1756
|
/* @__PURE__ */ jsx24(
|
|
1742
1757
|
"button",
|
|
1743
1758
|
{
|
|
1744
|
-
disabled: yearSelected === years.length - 1,
|
|
1759
|
+
disabled: yearSelected === data.years.length - 1,
|
|
1745
1760
|
type: "button",
|
|
1746
|
-
className: `yr3MonthSelector--year-button-next ${yearSelected === years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1761
|
+
className: `yr3MonthSelector--year-button-next ${yearSelected === data.years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1747
1762
|
onClick: () => setYearSelected(yearSelected + 1),
|
|
1748
1763
|
children: /* @__PURE__ */ jsx24(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1749
1764
|
}
|
|
@@ -1751,15 +1766,15 @@ var MonthSelector = ({ label, year, month, value, defaultValue, propsComponent,
|
|
|
1751
1766
|
]
|
|
1752
1767
|
}
|
|
1753
1768
|
),
|
|
1754
|
-
/* @__PURE__ */ jsx24("div", { className: "yr3MonthSelector--months", children:
|
|
1769
|
+
/* @__PURE__ */ jsx24("div", { className: "yr3MonthSelector--months", children: getData.months.map((m) => /* @__PURE__ */ jsx24(
|
|
1755
1770
|
"button",
|
|
1756
1771
|
{
|
|
1757
1772
|
type: "button",
|
|
1758
1773
|
style: properties?.text?.button,
|
|
1759
1774
|
disabled: m.disabled,
|
|
1760
|
-
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month
|
|
1775
|
+
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month--disabled" : ""} ${m.selected ? "yr3MonthSelector--month--selected" : ""}`,
|
|
1761
1776
|
onClick: () => {
|
|
1762
|
-
setValueState(`${m.value}-${years[yearSelected]}`);
|
|
1777
|
+
setValueState(`${m.value}-${data.years[yearSelected]}`);
|
|
1763
1778
|
setOpen(false);
|
|
1764
1779
|
},
|
|
1765
1780
|
children: /* @__PURE__ */ jsx24(Text, { ...properties?.text, weight: m.disabled ? "thin" : "medium", children: m.label })
|
|
@@ -2441,12 +2456,171 @@ var Pending = ({
|
|
|
2441
2456
|
);
|
|
2442
2457
|
};
|
|
2443
2458
|
|
|
2459
|
+
// src/components/Picker/Picker.tsx
|
|
2460
|
+
import * as React17 from "react";
|
|
2461
|
+
|
|
2462
|
+
// src/components/Picker/picker.variants.ts
|
|
2463
|
+
var PickerVariants = createVariants({
|
|
2464
|
+
base: "yr3Picker",
|
|
2465
|
+
variants: {
|
|
2466
|
+
variant: {
|
|
2467
|
+
filled: "yr3Picker--filled",
|
|
2468
|
+
outlined: "yr3Picker--outlined",
|
|
2469
|
+
base: "yr3Picker--base",
|
|
2470
|
+
lined: "yr3Picker--lined"
|
|
2471
|
+
},
|
|
2472
|
+
color: {
|
|
2473
|
+
primary: "yr3Picker--color-primary",
|
|
2474
|
+
secondary: "yr3Picker--color-secondary",
|
|
2475
|
+
success: "yr3Picker--color-success",
|
|
2476
|
+
text: "yr3Picker--color-text",
|
|
2477
|
+
disabled: "yr3Picker--color-disabled",
|
|
2478
|
+
background: "yr3Picker--color-background",
|
|
2479
|
+
error: "yr3Picker--color-error",
|
|
2480
|
+
warning: "yr3Picker--color-warning",
|
|
2481
|
+
info: "yr3Picker--color-info",
|
|
2482
|
+
common: "yr3Picker--color-common"
|
|
2483
|
+
},
|
|
2484
|
+
animated: {
|
|
2485
|
+
true: "yr3Picker--animated"
|
|
2486
|
+
},
|
|
2487
|
+
icon: {
|
|
2488
|
+
true: "yr3Picker--icon"
|
|
2489
|
+
},
|
|
2490
|
+
wrapper: {
|
|
2491
|
+
true: "yr3Picker--wrapper"
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
});
|
|
2495
|
+
var PickerIconVariants = createVariants({
|
|
2496
|
+
base: "yr3Picker--icon",
|
|
2497
|
+
variants: {
|
|
2498
|
+
color: {
|
|
2499
|
+
primary: "yr3Picker--icon-color-primary",
|
|
2500
|
+
secondary: "yr3Picker--icon-color-secondary",
|
|
2501
|
+
success: "yr3Picker--icon-color-success",
|
|
2502
|
+
text: "yr3Picker--icon-color-text",
|
|
2503
|
+
disabled: "yr3Picker--icon-color-disabled",
|
|
2504
|
+
background: "yr3Picker--icon-color-background",
|
|
2505
|
+
error: "yr3Picker--icon-color-error",
|
|
2506
|
+
warning: "yr3Picker--icon-color-warning",
|
|
2507
|
+
info: "yr3Picker--icon-color-info",
|
|
2508
|
+
common: "yr3Picker--icon-color-common"
|
|
2509
|
+
},
|
|
2510
|
+
animated: {
|
|
2511
|
+
true: "yr3Picker--icon-animated"
|
|
2512
|
+
},
|
|
2513
|
+
open: {
|
|
2514
|
+
true: "yr3Picker--icon-open"
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
|
|
2519
|
+
// src/components/Picker/Picker.tsx
|
|
2520
|
+
import { jsx as jsx37, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2521
|
+
var initiaPropsComponent3 = {
|
|
2522
|
+
control: {
|
|
2523
|
+
variant: "outlined",
|
|
2524
|
+
color: "primary",
|
|
2525
|
+
ui: {},
|
|
2526
|
+
style: {}
|
|
2527
|
+
},
|
|
2528
|
+
label: {
|
|
2529
|
+
display: true,
|
|
2530
|
+
color: "primary",
|
|
2531
|
+
ui: {},
|
|
2532
|
+
style: {}
|
|
2533
|
+
},
|
|
2534
|
+
wrapper: {
|
|
2535
|
+
ui: {},
|
|
2536
|
+
style: {}
|
|
2537
|
+
},
|
|
2538
|
+
icon: {
|
|
2539
|
+
style: {
|
|
2540
|
+
width: 24,
|
|
2541
|
+
height: 24
|
|
2542
|
+
},
|
|
2543
|
+
color: "primary",
|
|
2544
|
+
component: void 0
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
var Picker = ({ label, variant, color, children, name, value, onChange, propsComponent, closeOnSelect }) => {
|
|
2548
|
+
const [open, setOpen] = React17.useState(false);
|
|
2549
|
+
const [valueState, setValueState] = React17.useState(value || null);
|
|
2550
|
+
const ref = React17.useRef(null);
|
|
2551
|
+
useClickAway(ref, () => setOpen(false));
|
|
2552
|
+
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2553
|
+
const classesIcon = PickerIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2554
|
+
const classes = PickerVariants({ wrapper: true, variant, color });
|
|
2555
|
+
React17.useEffect(() => {
|
|
2556
|
+
if (value !== void 0) {
|
|
2557
|
+
setValueState(value);
|
|
2558
|
+
}
|
|
2559
|
+
}, [value]);
|
|
2560
|
+
React17.useEffect(() => {
|
|
2561
|
+
if (closeOnSelect && valueState) {
|
|
2562
|
+
setOpen(false);
|
|
2563
|
+
}
|
|
2564
|
+
}, [valueState, closeOnSelect]);
|
|
2565
|
+
React17.useEffect(() => {
|
|
2566
|
+
if (valueState !== null && onChange) {
|
|
2567
|
+
onChange({ event: {}, target: { name, value: valueState }, currentTarget: { name, value: valueState } }, valueState);
|
|
2568
|
+
}
|
|
2569
|
+
}, [valueState, onChange, name]);
|
|
2570
|
+
return /* @__PURE__ */ jsxs12("div", { className: classes, ref, children: [
|
|
2571
|
+
/* @__PURE__ */ jsx37(
|
|
2572
|
+
Input,
|
|
2573
|
+
{
|
|
2574
|
+
label,
|
|
2575
|
+
variant: "base",
|
|
2576
|
+
disabled: true,
|
|
2577
|
+
color,
|
|
2578
|
+
value: valueState || "",
|
|
2579
|
+
propsComponent: {
|
|
2580
|
+
control: {
|
|
2581
|
+
variant,
|
|
2582
|
+
color
|
|
2583
|
+
},
|
|
2584
|
+
label: properties?.label
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
),
|
|
2588
|
+
/* @__PURE__ */ jsx37(
|
|
2589
|
+
"div",
|
|
2590
|
+
{
|
|
2591
|
+
className: classesIcon,
|
|
2592
|
+
style: properties?.icon?.style,
|
|
2593
|
+
onClick: () => setOpen((prev) => !prev),
|
|
2594
|
+
"data-testid": "yr3Picker--icon",
|
|
2595
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx37(
|
|
2596
|
+
IconDown,
|
|
2597
|
+
{
|
|
2598
|
+
width: properties?.icon?.style?.width,
|
|
2599
|
+
height: properties?.icon?.style?.height,
|
|
2600
|
+
stroke: "currentColor",
|
|
2601
|
+
style: properties?.icon?.style
|
|
2602
|
+
}
|
|
2603
|
+
)
|
|
2604
|
+
}
|
|
2605
|
+
),
|
|
2606
|
+
open && /* @__PURE__ */ jsx37(
|
|
2607
|
+
"div",
|
|
2608
|
+
{
|
|
2609
|
+
className: "yr3Picker--container",
|
|
2610
|
+
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
2611
|
+
"data-testid": "yr3Picker-container",
|
|
2612
|
+
children
|
|
2613
|
+
}
|
|
2614
|
+
)
|
|
2615
|
+
] });
|
|
2616
|
+
};
|
|
2617
|
+
|
|
2444
2618
|
// src/components/Phone/Phone.tsx
|
|
2445
|
-
import * as
|
|
2619
|
+
import * as React19 from "react";
|
|
2446
2620
|
|
|
2447
2621
|
// src/components/Selector/Selector.tsx
|
|
2448
|
-
import * as
|
|
2449
|
-
import { jsx as
|
|
2622
|
+
import * as React18 from "react";
|
|
2623
|
+
import { jsx as jsx38, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2450
2624
|
var initalPropsComponent2 = {
|
|
2451
2625
|
text: {
|
|
2452
2626
|
variant: "caption",
|
|
@@ -2459,16 +2633,16 @@ var initalPropsComponent2 = {
|
|
|
2459
2633
|
}
|
|
2460
2634
|
};
|
|
2461
2635
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
2462
|
-
const [open, setOpen] =
|
|
2463
|
-
const [valueState, setValueState] =
|
|
2464
|
-
const ref =
|
|
2636
|
+
const [open, setOpen] = React18.useState(false);
|
|
2637
|
+
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2638
|
+
const ref = React18.useRef(null);
|
|
2465
2639
|
useClickAway(ref, () => setOpen(false));
|
|
2466
|
-
return /* @__PURE__ */
|
|
2467
|
-
/* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2640
|
+
return /* @__PURE__ */ jsxs13("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
2641
|
+
/* @__PURE__ */ jsx38("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ jsxs13("div", { className: "yr3Selector--control", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx38("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ jsx38(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
2469
2643
|
valueState
|
|
2470
2644
|
] }) }),
|
|
2471
|
-
open && /* @__PURE__ */
|
|
2645
|
+
open && /* @__PURE__ */ jsx38("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ jsx38(
|
|
2472
2646
|
"div",
|
|
2473
2647
|
{
|
|
2474
2648
|
className: "yr3Selector--option",
|
|
@@ -2489,7 +2663,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2489
2663
|
};
|
|
2490
2664
|
onChange?.(event, opt.value);
|
|
2491
2665
|
},
|
|
2492
|
-
children: /* @__PURE__ */
|
|
2666
|
+
children: /* @__PURE__ */ jsx38(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
|
|
2493
2667
|
},
|
|
2494
2668
|
opt.value
|
|
2495
2669
|
)) })
|
|
@@ -2497,7 +2671,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2497
2671
|
};
|
|
2498
2672
|
|
|
2499
2673
|
// src/components/Phone/Phone.tsx
|
|
2500
|
-
import { jsx as
|
|
2674
|
+
import { jsx as jsx39, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2501
2675
|
var Phone = ({
|
|
2502
2676
|
name,
|
|
2503
2677
|
value,
|
|
@@ -2509,13 +2683,13 @@ var Phone = ({
|
|
|
2509
2683
|
}) => {
|
|
2510
2684
|
const isControlled = value !== void 0;
|
|
2511
2685
|
const initial = value || defaultValue || "";
|
|
2512
|
-
const [prefix, setPrefix] =
|
|
2686
|
+
const [prefix, setPrefix] = React19.useState(
|
|
2513
2687
|
getDialPhone(initial, countries) || countries[0].dial
|
|
2514
2688
|
);
|
|
2515
|
-
const [number, setNumber] =
|
|
2689
|
+
const [number, setNumber] = React19.useState(
|
|
2516
2690
|
getNumberPhone(initial, prefix) || ""
|
|
2517
2691
|
);
|
|
2518
|
-
|
|
2692
|
+
React19.useEffect(() => {
|
|
2519
2693
|
if (isControlled && value) {
|
|
2520
2694
|
const dial = getDialPhone(value, countries);
|
|
2521
2695
|
const num = getNumberPhone(value, dial);
|
|
@@ -2534,10 +2708,10 @@ var Phone = ({
|
|
|
2534
2708
|
setPrefix(val);
|
|
2535
2709
|
onChange?.(null, `${val}${number}`);
|
|
2536
2710
|
};
|
|
2537
|
-
return /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2711
|
+
return /* @__PURE__ */ jsxs14(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2712
|
+
/* @__PURE__ */ jsx39(Label, { text: label, className: "yr3Input--active" }),
|
|
2713
|
+
/* @__PURE__ */ jsxs14(Flex, { variant: "row", container: true, center: true, children: [
|
|
2714
|
+
/* @__PURE__ */ jsx39(
|
|
2541
2715
|
Selector,
|
|
2542
2716
|
{
|
|
2543
2717
|
options: countries.map((c) => ({
|
|
@@ -2549,7 +2723,7 @@ var Phone = ({
|
|
|
2549
2723
|
...propsComponent?.selector
|
|
2550
2724
|
}
|
|
2551
2725
|
),
|
|
2552
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsx39(
|
|
2553
2727
|
Divider,
|
|
2554
2728
|
{
|
|
2555
2729
|
orientation: "vertical",
|
|
@@ -2558,7 +2732,7 @@ var Phone = ({
|
|
|
2558
2732
|
...propsComponent?.divider
|
|
2559
2733
|
}
|
|
2560
2734
|
),
|
|
2561
|
-
/* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ jsx39(
|
|
2562
2736
|
Input,
|
|
2563
2737
|
{
|
|
2564
2738
|
type: "number",
|
|
@@ -2574,9 +2748,9 @@ var Phone = ({
|
|
|
2574
2748
|
};
|
|
2575
2749
|
|
|
2576
2750
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2577
|
-
import * as
|
|
2751
|
+
import * as React20 from "react";
|
|
2578
2752
|
import { useAutocompletePlaces } from "@yr3/autocomplete-places";
|
|
2579
|
-
import { jsx as
|
|
2753
|
+
import { jsx as jsx40, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2580
2754
|
var initPropsComponent = {
|
|
2581
2755
|
label: {
|
|
2582
2756
|
display: true,
|
|
@@ -2616,9 +2790,9 @@ var PlacesAutocomplete = ({
|
|
|
2616
2790
|
keyApi,
|
|
2617
2791
|
propsComponent = initPropsComponent
|
|
2618
2792
|
}) => {
|
|
2619
|
-
const [value, setValue] =
|
|
2620
|
-
const inputRef =
|
|
2621
|
-
const [anchorEl, setAnchorEl] =
|
|
2793
|
+
const [value, setValue] = React20.useState(null);
|
|
2794
|
+
const inputRef = React20.useRef(null);
|
|
2795
|
+
const [anchorEl, setAnchorEl] = React20.useState(null);
|
|
2622
2796
|
const { suggestions, selectPlace } = useAutocompletePlaces({ input: value, apiKey: keyApi, language, provider });
|
|
2623
2797
|
const handleSelect = async (id) => {
|
|
2624
2798
|
const place = await selectPlace(id);
|
|
@@ -2638,12 +2812,12 @@ var PlacesAutocomplete = ({
|
|
|
2638
2812
|
setValue(place.address);
|
|
2639
2813
|
setAnchorEl(null);
|
|
2640
2814
|
};
|
|
2641
|
-
|
|
2815
|
+
React20.useEffect(() => {
|
|
2642
2816
|
if (defaultLocation) {
|
|
2643
2817
|
setValue(defaultLocation);
|
|
2644
2818
|
}
|
|
2645
2819
|
}, [defaultLocation]);
|
|
2646
|
-
|
|
2820
|
+
React20.useEffect(() => {
|
|
2647
2821
|
if (value === "") {
|
|
2648
2822
|
onSelect(null);
|
|
2649
2823
|
}
|
|
@@ -2653,13 +2827,13 @@ var PlacesAutocomplete = ({
|
|
|
2653
2827
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2654
2828
|
};
|
|
2655
2829
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2656
|
-
|
|
2830
|
+
React20.useEffect(() => {
|
|
2657
2831
|
if (onChangeForm) {
|
|
2658
2832
|
onChangeForm({ target: { value } });
|
|
2659
2833
|
}
|
|
2660
2834
|
}, [onChangeForm]);
|
|
2661
|
-
return /* @__PURE__ */
|
|
2662
|
-
/* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ jsxs15(Control, { ...propsComponent?.control, children: [
|
|
2836
|
+
/* @__PURE__ */ jsx40(
|
|
2663
2837
|
Input,
|
|
2664
2838
|
{
|
|
2665
2839
|
ref: inputRef,
|
|
@@ -2673,7 +2847,7 @@ var PlacesAutocomplete = ({
|
|
|
2673
2847
|
},
|
|
2674
2848
|
"input-places"
|
|
2675
2849
|
),
|
|
2676
|
-
open && /* @__PURE__ */
|
|
2850
|
+
open && /* @__PURE__ */ jsx40("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ jsx40(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ jsx40(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ jsx40(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
|
|
2677
2851
|
] });
|
|
2678
2852
|
};
|
|
2679
2853
|
|
|
@@ -2701,7 +2875,7 @@ var radioVariant = createVariants({
|
|
|
2701
2875
|
});
|
|
2702
2876
|
|
|
2703
2877
|
// src/components/Radio/Radio.tsx
|
|
2704
|
-
import { jsx as
|
|
2878
|
+
import { jsx as jsx41, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2705
2879
|
var Radio = ({
|
|
2706
2880
|
checked,
|
|
2707
2881
|
value,
|
|
@@ -2717,8 +2891,8 @@ var Radio = ({
|
|
|
2717
2891
|
const bemClass = bem("yr3Radio");
|
|
2718
2892
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2719
2893
|
const variantClass = radioVariant({ variant });
|
|
2720
|
-
return /* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2894
|
+
return /* @__PURE__ */ jsxs16("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2895
|
+
/* @__PURE__ */ jsx41(
|
|
2722
2896
|
"input",
|
|
2723
2897
|
{
|
|
2724
2898
|
type: "radio",
|
|
@@ -2730,8 +2904,8 @@ var Radio = ({
|
|
|
2730
2904
|
}
|
|
2731
2905
|
),
|
|
2732
2906
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2733
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */
|
|
2734
|
-
typeof label === "string" && /* @__PURE__ */
|
|
2907
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ jsx41("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2908
|
+
typeof label === "string" && /* @__PURE__ */ jsx41(
|
|
2735
2909
|
"span",
|
|
2736
2910
|
{
|
|
2737
2911
|
className: "yr3Radio--label",
|
|
@@ -2744,7 +2918,7 @@ var Radio = ({
|
|
|
2744
2918
|
};
|
|
2745
2919
|
|
|
2746
2920
|
// src/components/Select/Select.tsx
|
|
2747
|
-
import * as
|
|
2921
|
+
import * as React21 from "react";
|
|
2748
2922
|
|
|
2749
2923
|
// src/components/Select/select.variants.ts
|
|
2750
2924
|
var selectVariants = createVariants({
|
|
@@ -2804,8 +2978,8 @@ var selectIconVariants = createVariants({
|
|
|
2804
2978
|
});
|
|
2805
2979
|
|
|
2806
2980
|
// src/components/Select/Select.tsx
|
|
2807
|
-
import { jsx as
|
|
2808
|
-
var
|
|
2981
|
+
import { jsx as jsx42, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2982
|
+
var initiaPropsComponent4 = {
|
|
2809
2983
|
control: {
|
|
2810
2984
|
variant: "outlined",
|
|
2811
2985
|
color: "primary",
|
|
@@ -2844,15 +3018,15 @@ var initiaPropsComponent3 = {
|
|
|
2844
3018
|
}
|
|
2845
3019
|
};
|
|
2846
3020
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2847
|
-
const [open, setOpen] =
|
|
2848
|
-
const [valueState, setValueState] =
|
|
2849
|
-
const ref =
|
|
3021
|
+
const [open, setOpen] = React21.useState(false);
|
|
3022
|
+
const [valueState, setValueState] = React21.useState(value || defaultValue || null);
|
|
3023
|
+
const ref = React21.useRef(null);
|
|
2850
3024
|
useClickAway(ref, () => setOpen(false));
|
|
2851
|
-
const properties = mergeDeep(
|
|
3025
|
+
const properties = mergeDeep(initiaPropsComponent4, propsComponent || {});
|
|
2852
3026
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2853
3027
|
const classes = selectVariants({ wrapper: true });
|
|
2854
|
-
return /* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ jsxs17("div", { className: classes, ref, children: [
|
|
3029
|
+
/* @__PURE__ */ jsx42(
|
|
2856
3030
|
Input,
|
|
2857
3031
|
{
|
|
2858
3032
|
label,
|
|
@@ -2865,14 +3039,14 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2865
3039
|
}
|
|
2866
3040
|
}
|
|
2867
3041
|
),
|
|
2868
|
-
/* @__PURE__ */
|
|
3042
|
+
/* @__PURE__ */ jsx42(
|
|
2869
3043
|
"div",
|
|
2870
3044
|
{
|
|
2871
3045
|
className: classesIcon,
|
|
2872
3046
|
style: properties?.icon?.style,
|
|
2873
3047
|
onClick: () => setOpen((prev) => !prev),
|
|
2874
3048
|
"data-testid": "yr3Select-icon",
|
|
2875
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */
|
|
3049
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx42(
|
|
2876
3050
|
IconDown,
|
|
2877
3051
|
{
|
|
2878
3052
|
width: properties?.icon?.style?.width,
|
|
@@ -2883,13 +3057,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2883
3057
|
)
|
|
2884
3058
|
}
|
|
2885
3059
|
),
|
|
2886
|
-
open && /* @__PURE__ */
|
|
3060
|
+
open && /* @__PURE__ */ jsx42(
|
|
2887
3061
|
"div",
|
|
2888
3062
|
{
|
|
2889
3063
|
className: "yr3Select--menu",
|
|
2890
3064
|
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2891
3065
|
"data-testid": "yr3Select-menu",
|
|
2892
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
3066
|
+
children: options.map((opt) => /* @__PURE__ */ jsx42(
|
|
2893
3067
|
"div",
|
|
2894
3068
|
{
|
|
2895
3069
|
className: "yr3Select--option",
|
|
@@ -2911,7 +3085,7 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2911
3085
|
onChange?.(event, opt.value);
|
|
2912
3086
|
},
|
|
2913
3087
|
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2914
|
-
children: /* @__PURE__ */
|
|
3088
|
+
children: /* @__PURE__ */ jsx42(Text, { as: "span", variant: "caption", color: properties?.menu?.options?.text?.color || "primary", ...properties?.menu?.options?.text, children: opt.label })
|
|
2915
3089
|
},
|
|
2916
3090
|
opt.value
|
|
2917
3091
|
))
|
|
@@ -2921,8 +3095,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2921
3095
|
};
|
|
2922
3096
|
|
|
2923
3097
|
// src/components/Slide/Slide.tsx
|
|
2924
|
-
import * as
|
|
2925
|
-
import { jsx as
|
|
3098
|
+
import * as React22 from "react";
|
|
3099
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2926
3100
|
var initialPropsComponent5 = {
|
|
2927
3101
|
slide: {
|
|
2928
3102
|
ui: {},
|
|
@@ -2945,7 +3119,7 @@ var Slide = ({
|
|
|
2945
3119
|
"in": !!inProp,
|
|
2946
3120
|
"out": !inProp
|
|
2947
3121
|
});
|
|
2948
|
-
|
|
3122
|
+
React22.useEffect(() => {
|
|
2949
3123
|
let timeoutId;
|
|
2950
3124
|
if (inProp) {
|
|
2951
3125
|
timeoutId = setTimeout(() => {
|
|
@@ -2955,19 +3129,19 @@ var Slide = ({
|
|
|
2955
3129
|
return () => clearTimeout(timeoutId);
|
|
2956
3130
|
}, [inProp, duration, onTransitionEnd]);
|
|
2957
3131
|
const uiStyleContent = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2958
|
-
return /* @__PURE__ */
|
|
3132
|
+
return /* @__PURE__ */ jsx43(
|
|
2959
3133
|
"div",
|
|
2960
3134
|
{
|
|
2961
3135
|
className: "yr3Slide",
|
|
2962
3136
|
style: composeStyles(),
|
|
2963
3137
|
"data-testid": "yr3Slide",
|
|
2964
|
-
children: /* @__PURE__ */
|
|
3138
|
+
children: /* @__PURE__ */ jsx43(
|
|
2965
3139
|
"div",
|
|
2966
3140
|
{
|
|
2967
3141
|
className: classNameContent,
|
|
2968
3142
|
style: composeStyles(uiStyleContent, properties?.slide?.style || {}),
|
|
2969
3143
|
"data-testid": "yr3Slide-content",
|
|
2970
|
-
children: /* @__PURE__ */
|
|
3144
|
+
children: /* @__PURE__ */ jsx43(Box, { ...properties?.box, "data-testid": "yr3Slide-box", children })
|
|
2971
3145
|
}
|
|
2972
3146
|
)
|
|
2973
3147
|
}
|
|
@@ -2975,7 +3149,7 @@ var Slide = ({
|
|
|
2975
3149
|
};
|
|
2976
3150
|
|
|
2977
3151
|
// src/components/Switch/Switch.tsx
|
|
2978
|
-
import * as
|
|
3152
|
+
import * as React23 from "react";
|
|
2979
3153
|
|
|
2980
3154
|
// src/components/Switch/switch.variants.ts
|
|
2981
3155
|
var switchVariants = createVariants({
|
|
@@ -3012,7 +3186,7 @@ var switchVariants = createVariants({
|
|
|
3012
3186
|
});
|
|
3013
3187
|
|
|
3014
3188
|
// src/components/Switch/Switch.tsx
|
|
3015
|
-
import { jsx as
|
|
3189
|
+
import { jsx as jsx44, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3016
3190
|
var Switch = ({
|
|
3017
3191
|
checked,
|
|
3018
3192
|
defaultChecked,
|
|
@@ -3024,7 +3198,7 @@ var Switch = ({
|
|
|
3024
3198
|
placement = "end",
|
|
3025
3199
|
propsComponent
|
|
3026
3200
|
}) => {
|
|
3027
|
-
const [internal, setInternal] =
|
|
3201
|
+
const [internal, setInternal] = React23.useState(defaultChecked || false);
|
|
3028
3202
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
3029
3203
|
const isControlled = checked !== void 0;
|
|
3030
3204
|
const value = isControlled ? checked : internal;
|
|
@@ -3032,13 +3206,13 @@ var Switch = ({
|
|
|
3032
3206
|
if (!isControlled) setInternal(e.target.checked);
|
|
3033
3207
|
onChange?.(e, e.target.checked);
|
|
3034
3208
|
};
|
|
3035
|
-
return /* @__PURE__ */
|
|
3209
|
+
return /* @__PURE__ */ jsxs18(
|
|
3036
3210
|
"label",
|
|
3037
3211
|
{
|
|
3038
3212
|
className: classname,
|
|
3039
3213
|
"data-testid": "yr3Switch",
|
|
3040
3214
|
children: [
|
|
3041
|
-
/* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ jsx44(
|
|
3042
3216
|
"input",
|
|
3043
3217
|
{
|
|
3044
3218
|
type: "checkbox",
|
|
@@ -3047,8 +3221,8 @@ var Switch = ({
|
|
|
3047
3221
|
disabled
|
|
3048
3222
|
}
|
|
3049
3223
|
),
|
|
3050
|
-
/* @__PURE__ */
|
|
3051
|
-
/* @__PURE__ */
|
|
3224
|
+
/* @__PURE__ */ jsx44("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx44("span", { className: "yr3Switch--thumb" }) }),
|
|
3225
|
+
/* @__PURE__ */ jsx44(
|
|
3052
3226
|
"span",
|
|
3053
3227
|
{
|
|
3054
3228
|
className: "yr3Switch--label",
|
|
@@ -3063,14 +3237,14 @@ var Switch = ({
|
|
|
3063
3237
|
};
|
|
3064
3238
|
|
|
3065
3239
|
// src/theme/ThemeProvider.tsx
|
|
3066
|
-
import * as
|
|
3240
|
+
import * as React25 from "react";
|
|
3067
3241
|
|
|
3068
3242
|
// src/theme/notistackContext.tsx
|
|
3069
|
-
import * as
|
|
3070
|
-
import { jsx as
|
|
3071
|
-
var NotistackContext =
|
|
3243
|
+
import * as React24 from "react";
|
|
3244
|
+
import { jsx as jsx45, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3245
|
+
var NotistackContext = React24.createContext(null);
|
|
3072
3246
|
var NotistackProvider = ({ children }) => {
|
|
3073
|
-
const [snacks, setSnacks] =
|
|
3247
|
+
const [snacks, setSnacks] = React24.useState([]);
|
|
3074
3248
|
const notistack = (snack) => {
|
|
3075
3249
|
const id = Date.now();
|
|
3076
3250
|
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
@@ -3085,13 +3259,13 @@ var NotistackProvider = ({ children }) => {
|
|
|
3085
3259
|
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
3086
3260
|
}, duration + exitDuration);
|
|
3087
3261
|
};
|
|
3088
|
-
return /* @__PURE__ */
|
|
3262
|
+
return /* @__PURE__ */ jsxs19(NotistackContext.Provider, { value: { notistack }, children: [
|
|
3089
3263
|
children,
|
|
3090
|
-
/* @__PURE__ */
|
|
3264
|
+
/* @__PURE__ */ jsx45("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx45(Notistack, { ...snack }, snack.id)) })
|
|
3091
3265
|
] });
|
|
3092
3266
|
};
|
|
3093
3267
|
var useNotistack = () => {
|
|
3094
|
-
const ctx =
|
|
3268
|
+
const ctx = React24.useContext(NotistackContext);
|
|
3095
3269
|
if (!ctx) {
|
|
3096
3270
|
throw new Error("NotistackProvider missing");
|
|
3097
3271
|
}
|
|
@@ -3099,15 +3273,15 @@ var useNotistack = () => {
|
|
|
3099
3273
|
};
|
|
3100
3274
|
|
|
3101
3275
|
// src/theme/ThemeProvider.tsx
|
|
3102
|
-
import { jsx as
|
|
3103
|
-
var ThemeContext =
|
|
3276
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3277
|
+
var ThemeContext = React25.createContext(null);
|
|
3104
3278
|
var ThemeProvider = ({ theme, children }) => {
|
|
3105
|
-
|
|
3279
|
+
React25.useEffect(() => {
|
|
3106
3280
|
applyTheme(theme);
|
|
3107
3281
|
}, [theme]);
|
|
3108
|
-
return /* @__PURE__ */
|
|
3282
|
+
return /* @__PURE__ */ jsx46(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx46(BackdropProvider, { children: /* @__PURE__ */ jsx46(NotistackProvider, { children }) }) });
|
|
3109
3283
|
};
|
|
3110
|
-
var useTheme = () =>
|
|
3284
|
+
var useTheme = () => React25.useContext(ThemeContext);
|
|
3111
3285
|
|
|
3112
3286
|
// src/theme/tokens.ts
|
|
3113
3287
|
var baseTokens = {
|
|
@@ -3128,15 +3302,15 @@ var baseTokens = {
|
|
|
3128
3302
|
};
|
|
3129
3303
|
|
|
3130
3304
|
// src/theme/useMediaQuery.tsx
|
|
3131
|
-
import * as
|
|
3305
|
+
import * as React26 from "react";
|
|
3132
3306
|
function useMediaQuery(query) {
|
|
3133
3307
|
const theme = useTheme();
|
|
3134
3308
|
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
3135
|
-
const [matches, setMatches] =
|
|
3309
|
+
const [matches, setMatches] = React26.useState(() => {
|
|
3136
3310
|
if (typeof window === "undefined") return false;
|
|
3137
3311
|
return window.matchMedia(computedQuery).matches;
|
|
3138
3312
|
});
|
|
3139
|
-
|
|
3313
|
+
React26.useEffect(() => {
|
|
3140
3314
|
if (typeof window === "undefined") return;
|
|
3141
3315
|
const media = window.matchMedia(computedQuery);
|
|
3142
3316
|
const listener = () => setMatches(media.matches);
|
|
@@ -3170,7 +3344,7 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
3170
3344
|
};
|
|
3171
3345
|
|
|
3172
3346
|
// src/hooks/useBreakpoint.ts
|
|
3173
|
-
import * as
|
|
3347
|
+
import * as React27 from "react";
|
|
3174
3348
|
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
3175
3349
|
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
3176
3350
|
function useBreakpoint(queryInput) {
|
|
@@ -3180,8 +3354,8 @@ function useBreakpoint(queryInput) {
|
|
|
3180
3354
|
if (typeof window === "undefined") return false;
|
|
3181
3355
|
return window.matchMedia(query).matches;
|
|
3182
3356
|
};
|
|
3183
|
-
const [matches, setMatches] =
|
|
3184
|
-
|
|
3357
|
+
const [matches, setMatches] = React27.useState(getMatch);
|
|
3358
|
+
React27.useEffect(() => {
|
|
3185
3359
|
if (typeof window === "undefined") return;
|
|
3186
3360
|
const media = window.matchMedia(query);
|
|
3187
3361
|
const listener = (e) => {
|
|
@@ -3245,6 +3419,7 @@ export {
|
|
|
3245
3419
|
NotistackProvider,
|
|
3246
3420
|
Pending,
|
|
3247
3421
|
Phone,
|
|
3422
|
+
Picker,
|
|
3248
3423
|
PlacesAutocomplete,
|
|
3249
3424
|
Radio,
|
|
3250
3425
|
Select,
|