@yr3/ui 1.0.6 → 1.0.8
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/Control/control.css +8 -0
- package/dist/components/Control/control.css.map +1 -1
- package/dist/components/Input/input.css +9 -1
- package/dist/components/Input/input.css.map +1 -1
- package/dist/components/Select/select.css +18 -23
- package/dist/components/Select/select.css.map +1 -1
- package/dist/components/Selector/selector.css +1 -2
- package/dist/components/Selector/selector.css.map +1 -1
- package/dist/components/Switch/switch.css +16 -0
- package/dist/components/Switch/switch.css.map +1 -1
- package/dist/index.cjs +259 -134
- package/dist/index.d.cts +43 -8
- package/dist/index.d.ts +43 -8
- package/dist/index.js +257 -131
- package/dist/styles/index.css +52 -26
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -100,6 +99,7 @@ __export(index_exports, {
|
|
|
100
99
|
useControl: () => useControl,
|
|
101
100
|
useMediaQuery: () => useMediaQuery,
|
|
102
101
|
useNotistack: () => useNotistack,
|
|
102
|
+
usePlaces: () => usePlaces,
|
|
103
103
|
useTheme: () => useTheme
|
|
104
104
|
});
|
|
105
105
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -377,7 +377,6 @@ var normalizePhone = (phone, dial) => {
|
|
|
377
377
|
};
|
|
378
378
|
var getDialPhone = (phone, countries) => {
|
|
379
379
|
for (const country of countries) {
|
|
380
|
-
console.log("checking", phone, "against", country.dial);
|
|
381
380
|
if (phone.startsWith(country.dial)) {
|
|
382
381
|
return country.dial;
|
|
383
382
|
}
|
|
@@ -562,9 +561,6 @@ function initTheme() {
|
|
|
562
561
|
applyTheme(createTheme());
|
|
563
562
|
}
|
|
564
563
|
|
|
565
|
-
// src/index.ts
|
|
566
|
-
__reExport(index_exports, require("@yr3/autocomplete-places"), module.exports);
|
|
567
|
-
|
|
568
564
|
// src/components/Avatar/Avatar.tsx
|
|
569
565
|
var React = __toESM(require("react"), 1);
|
|
570
566
|
|
|
@@ -716,6 +712,42 @@ var Box = ({
|
|
|
716
712
|
);
|
|
717
713
|
};
|
|
718
714
|
|
|
715
|
+
// src/components/Text/text.variants.ts
|
|
716
|
+
var textVariants = createVariants({
|
|
717
|
+
base: "yr3Text",
|
|
718
|
+
variants: {
|
|
719
|
+
variant: {
|
|
720
|
+
h1: "yr3Text--h1",
|
|
721
|
+
h2: "yr3Text--h2",
|
|
722
|
+
h3: "yr3Text--h3",
|
|
723
|
+
h4: "yr3Text--h4",
|
|
724
|
+
h5: "yr3Text--h5",
|
|
725
|
+
h6: "yr3Text--h6",
|
|
726
|
+
title: "yr3Text--title",
|
|
727
|
+
subtitle: "yr3Text--subtitle",
|
|
728
|
+
body1: "yr3Text--body1",
|
|
729
|
+
body2: "yr3Text--body2",
|
|
730
|
+
helper: "yr3Text--helper",
|
|
731
|
+
inherit: "yr3Text--inherit",
|
|
732
|
+
caption: "yr3Text--caption",
|
|
733
|
+
button: "yr3Text--button",
|
|
734
|
+
code: "yr3Text--code"
|
|
735
|
+
},
|
|
736
|
+
color: {
|
|
737
|
+
primary: "yr3Text--color-primary",
|
|
738
|
+
secondary: "yr3Text--color-secondary",
|
|
739
|
+
success: "yr3Text--color-success",
|
|
740
|
+
text: "yr3Text--color-text",
|
|
741
|
+
disabled: "yr3Text--color-disabled",
|
|
742
|
+
warning: "yr3Text--color-warning",
|
|
743
|
+
error: "yr3Text--color-error",
|
|
744
|
+
info: "yr3Text--color-info",
|
|
745
|
+
background: "yr3Text--color-background"
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
var text_variants_default = textVariants;
|
|
750
|
+
|
|
719
751
|
// src/components/Text/Text.tsx
|
|
720
752
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
721
753
|
var Text = ({
|
|
@@ -730,16 +762,11 @@ var Text = ({
|
|
|
730
762
|
onClick
|
|
731
763
|
}) => {
|
|
732
764
|
const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
|
|
765
|
+
const classes = text_variants_default({ variant, color, weight });
|
|
733
766
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
734
767
|
Component,
|
|
735
768
|
{
|
|
736
|
-
className:
|
|
737
|
-
yr3Text
|
|
738
|
-
yr3Text--${variant}
|
|
739
|
-
yr3Text--${color}
|
|
740
|
-
${weight ? `yr3Text--${weight}` : ""}
|
|
741
|
-
|
|
742
|
-
`,
|
|
769
|
+
className: classes,
|
|
743
770
|
style: composeStyles(styleUI, style),
|
|
744
771
|
onClick,
|
|
745
772
|
"data-testid": "yr3Text",
|
|
@@ -868,7 +895,8 @@ var initalPropsComponent = {
|
|
|
868
895
|
color: "primary",
|
|
869
896
|
bordered: true,
|
|
870
897
|
ui: {},
|
|
871
|
-
style: {}
|
|
898
|
+
style: {},
|
|
899
|
+
component: null
|
|
872
900
|
},
|
|
873
901
|
buttonNext: {
|
|
874
902
|
disabled: false,
|
|
@@ -914,7 +942,7 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
914
942
|
children: (0, import_dayjs2.default)().day(i + 1).format("dd")
|
|
915
943
|
}
|
|
916
944
|
) }, `month_day_${i}`)),
|
|
917
|
-
times(program.calendar.length, (i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
945
|
+
times(program.calendar.length, (i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
918
946
|
"div",
|
|
919
947
|
{
|
|
920
948
|
className: calendarDayVariants({
|
|
@@ -936,14 +964,17 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
936
964
|
setSelected(program.calendar[i][j]);
|
|
937
965
|
}
|
|
938
966
|
},
|
|
939
|
-
children:
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
967
|
+
children: [
|
|
968
|
+
program.calendar[i][j]?.data && propsComponent?.day?.component ? propsComponent.day.component : null,
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
970
|
+
Text,
|
|
971
|
+
{
|
|
972
|
+
variant: "body2",
|
|
973
|
+
color: program.calendar[i][j]?.isFuture ? "text" : "text",
|
|
974
|
+
children: program.calendar[i][j]?.day || ""
|
|
975
|
+
}
|
|
976
|
+
)
|
|
977
|
+
]
|
|
947
978
|
},
|
|
948
979
|
`day-${i}-${j}`
|
|
949
980
|
)) }, i))
|
|
@@ -1155,6 +1186,7 @@ var Control = ({
|
|
|
1155
1186
|
style,
|
|
1156
1187
|
ui,
|
|
1157
1188
|
color = "primary",
|
|
1189
|
+
size = "auto",
|
|
1158
1190
|
label = true
|
|
1159
1191
|
}) => {
|
|
1160
1192
|
const [focused, setFocused] = React7.useState(false);
|
|
@@ -1164,7 +1196,7 @@ var Control = ({
|
|
|
1164
1196
|
error,
|
|
1165
1197
|
disabled
|
|
1166
1198
|
};
|
|
1167
|
-
const classes = controlVariants({ variant, color, label });
|
|
1199
|
+
const classes = controlVariants({ variant, color, label, size });
|
|
1168
1200
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ControlContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1169
1201
|
"div",
|
|
1170
1202
|
{
|
|
@@ -1646,7 +1678,8 @@ var initiaPropsComponent = {
|
|
|
1646
1678
|
display: true,
|
|
1647
1679
|
ui: {},
|
|
1648
1680
|
style: {}
|
|
1649
|
-
}
|
|
1681
|
+
},
|
|
1682
|
+
control: {}
|
|
1650
1683
|
};
|
|
1651
1684
|
var Input = React12.forwardRef(
|
|
1652
1685
|
({
|
|
@@ -1661,11 +1694,11 @@ var Input = React12.forwardRef(
|
|
|
1661
1694
|
propsComponent = initiaPropsComponent,
|
|
1662
1695
|
type = "text",
|
|
1663
1696
|
color = "primary",
|
|
1697
|
+
size = "auto",
|
|
1664
1698
|
...props
|
|
1665
1699
|
}, ref) => {
|
|
1666
1700
|
const [focused, setFocused] = React12.useState(false);
|
|
1667
1701
|
const [internalValue, setInternalValue] = React12.useState(defaultValue);
|
|
1668
|
-
const [internalError, setInternalError] = React12.useState(null);
|
|
1669
1702
|
const isControlled = value !== void 0;
|
|
1670
1703
|
const currentValue = isControlled ? value : internalValue;
|
|
1671
1704
|
const isActive = focused || !!currentValue;
|
|
@@ -1683,19 +1716,13 @@ var Input = React12.forwardRef(
|
|
|
1683
1716
|
};
|
|
1684
1717
|
const handleChange = (e) => {
|
|
1685
1718
|
const newValue = e.target.value;
|
|
1686
|
-
const isValid = checkPattern(type, newValue);
|
|
1687
|
-
if (!isValid) {
|
|
1688
|
-
setInternalError("Valore non valido");
|
|
1689
|
-
} else {
|
|
1690
|
-
setInternalError(null);
|
|
1691
|
-
}
|
|
1692
1719
|
if (!isControlled) {
|
|
1693
1720
|
setInternalValue(newValue);
|
|
1694
1721
|
}
|
|
1695
1722
|
onChange?.(e, newValue);
|
|
1696
1723
|
};
|
|
1697
1724
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1698
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, children: [
|
|
1725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, ...propsComponent.control, children: [
|
|
1699
1726
|
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1700
1727
|
Label,
|
|
1701
1728
|
{
|
|
@@ -1713,6 +1740,7 @@ var Input = React12.forwardRef(
|
|
|
1713
1740
|
type,
|
|
1714
1741
|
autoComplete: "off",
|
|
1715
1742
|
onChange: handleChange,
|
|
1743
|
+
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1716
1744
|
onFocus: () => setFocused(true),
|
|
1717
1745
|
onBlur: () => setFocused(false),
|
|
1718
1746
|
className: classes,
|
|
@@ -1720,8 +1748,7 @@ var Input = React12.forwardRef(
|
|
|
1720
1748
|
...props,
|
|
1721
1749
|
"data-testid": "yr3Input"
|
|
1722
1750
|
}
|
|
1723
|
-
)
|
|
1724
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { variant: "helper", color: "disabled", "data-testid": "yr3Input-helper", ui: { position: "absolute", bottom: -18, left: 0 }, children: error || internalError || "" })
|
|
1751
|
+
)
|
|
1725
1752
|
] });
|
|
1726
1753
|
}
|
|
1727
1754
|
);
|
|
@@ -1981,6 +2008,10 @@ var initalPropsComponent2 = {
|
|
|
1981
2008
|
variant: "caption",
|
|
1982
2009
|
color: "primary",
|
|
1983
2010
|
children: void 0
|
|
2011
|
+
},
|
|
2012
|
+
menu: {
|
|
2013
|
+
ui: {},
|
|
2014
|
+
style: {}
|
|
1984
2015
|
}
|
|
1985
2016
|
};
|
|
1986
2017
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
@@ -1993,7 +2024,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
1993
2024
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
1994
2025
|
valueState
|
|
1995
2026
|
] }) }),
|
|
1996
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Selector--menu", children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2027
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1997
2028
|
"div",
|
|
1998
2029
|
{
|
|
1999
2030
|
className: "yr3Selector--option",
|
|
@@ -2033,38 +2064,36 @@ var Phone = ({
|
|
|
2033
2064
|
propsComponent,
|
|
2034
2065
|
defaultValue
|
|
2035
2066
|
}) => {
|
|
2036
|
-
const [prefixValue, setPrefixValue] = React16.useState(countries?.[0].dial);
|
|
2037
|
-
const [internalValue, setInternalValue] = React16.useState(defaultValue);
|
|
2038
2067
|
const isControlled = value !== void 0;
|
|
2039
|
-
const
|
|
2040
|
-
const
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
}
|
|
2047
|
-
};
|
|
2068
|
+
const initial = value || defaultValue || "";
|
|
2069
|
+
const [prefix, setPrefix] = React16.useState(
|
|
2070
|
+
getDialPhone(initial, countries) || countries[0].dial
|
|
2071
|
+
);
|
|
2072
|
+
const [number, setNumber] = React16.useState(
|
|
2073
|
+
getNumberPhone(initial, prefix) || ""
|
|
2074
|
+
);
|
|
2048
2075
|
React16.useEffect(() => {
|
|
2049
|
-
if (
|
|
2050
|
-
const dial = getDialPhone(
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
const handleChange = (e, value2) => {
|
|
2055
|
-
const newValue = value2;
|
|
2056
|
-
const isValid = checkPattern("phone", newValue);
|
|
2057
|
-
if (!isValid) {
|
|
2058
|
-
return;
|
|
2076
|
+
if (isControlled && value) {
|
|
2077
|
+
const dial = getDialPhone(value, countries);
|
|
2078
|
+
const num = getNumberPhone(value, dial);
|
|
2079
|
+
setPrefix(dial);
|
|
2080
|
+
setNumber(num);
|
|
2059
2081
|
}
|
|
2082
|
+
}, [value]);
|
|
2083
|
+
const handleNumberChange = (e, val) => {
|
|
2084
|
+
const clean = val.replace(/[^\d]/g, "");
|
|
2060
2085
|
if (!isControlled) {
|
|
2061
|
-
|
|
2086
|
+
setNumber(clean);
|
|
2062
2087
|
}
|
|
2063
|
-
onChange?.(e,
|
|
2088
|
+
onChange?.(e, `${prefix}${clean}`);
|
|
2089
|
+
};
|
|
2090
|
+
const handlePrefixChange = (_, val) => {
|
|
2091
|
+
setPrefix(val);
|
|
2092
|
+
onChange?.(null, `${val}${number}`);
|
|
2064
2093
|
};
|
|
2065
2094
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2066
2095
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
2067
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
2068
2097
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2069
2098
|
Selector_default,
|
|
2070
2099
|
{
|
|
@@ -2072,33 +2101,33 @@ var Phone = ({
|
|
|
2072
2101
|
value: c.dial,
|
|
2073
2102
|
label: c.code
|
|
2074
2103
|
})),
|
|
2075
|
-
value:
|
|
2076
|
-
onChange:
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2104
|
+
value: prefix,
|
|
2105
|
+
onChange: handlePrefixChange,
|
|
2106
|
+
...propsComponent?.selector
|
|
2107
|
+
}
|
|
2108
|
+
),
|
|
2109
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2110
|
+
Divider,
|
|
2111
|
+
{
|
|
2112
|
+
orientation: "vertical",
|
|
2113
|
+
color: "primary",
|
|
2114
|
+
ui: { height: 49 },
|
|
2115
|
+
...propsComponent?.divider
|
|
2085
2116
|
}
|
|
2086
2117
|
),
|
|
2087
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, { orientation: "vertical", color: "primary", ui: { height: 50 - 1, mb: -1 }, ...propsComponent?.divider }),
|
|
2088
2118
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2089
2119
|
Input,
|
|
2090
2120
|
{
|
|
2091
|
-
type: "
|
|
2092
|
-
variant: "base",
|
|
2121
|
+
type: "number",
|
|
2093
2122
|
name,
|
|
2094
|
-
value:
|
|
2123
|
+
value: number,
|
|
2124
|
+
variant: "base",
|
|
2095
2125
|
...propsComponent?.input,
|
|
2096
|
-
onChange:
|
|
2097
|
-
}
|
|
2098
|
-
currentValue
|
|
2126
|
+
onChange: handleNumberChange
|
|
2127
|
+
}
|
|
2099
2128
|
)
|
|
2100
|
-
] })
|
|
2101
|
-
] }
|
|
2129
|
+
] })
|
|
2130
|
+
] });
|
|
2102
2131
|
};
|
|
2103
2132
|
|
|
2104
2133
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
@@ -2268,68 +2297,140 @@ var Radio = ({
|
|
|
2268
2297
|
|
|
2269
2298
|
// src/components/Select/Select.tsx
|
|
2270
2299
|
var React18 = __toESM(require("react"), 1);
|
|
2300
|
+
|
|
2301
|
+
// src/components/Select/select.variants.ts
|
|
2302
|
+
var selectVariants = createVariants({
|
|
2303
|
+
base: "yr3Select",
|
|
2304
|
+
variants: {
|
|
2305
|
+
wrapper: {
|
|
2306
|
+
true: "yr3Select--wrapper"
|
|
2307
|
+
},
|
|
2308
|
+
variant: {
|
|
2309
|
+
filled: "yr3Select--filled",
|
|
2310
|
+
outlined: "yr3Select--outlined",
|
|
2311
|
+
base: "yr3Select--base",
|
|
2312
|
+
lined: "yr3Select--lined"
|
|
2313
|
+
},
|
|
2314
|
+
color: {
|
|
2315
|
+
primary: "yr3Select--color-primary",
|
|
2316
|
+
secondary: "yr3Select--color-secondary",
|
|
2317
|
+
success: "yr3Select--color-success",
|
|
2318
|
+
text: "yr3Select--color-text",
|
|
2319
|
+
disabled: "yr3Select--color-disabled",
|
|
2320
|
+
background: "yr3Select--color-background",
|
|
2321
|
+
error: "yr3Select--color-error",
|
|
2322
|
+
warning: "yr3Select--color-warning",
|
|
2323
|
+
info: "yr3Select--color-info"
|
|
2324
|
+
},
|
|
2325
|
+
animated: {
|
|
2326
|
+
true: "yr3Select--animated"
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
});
|
|
2330
|
+
var select_variants_default = selectVariants;
|
|
2331
|
+
|
|
2332
|
+
// src/components/Select/Select.tsx
|
|
2271
2333
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2272
|
-
var
|
|
2334
|
+
var initiaPropsComponent3 = {
|
|
2335
|
+
control: {
|
|
2336
|
+
variant: "outlined",
|
|
2337
|
+
color: "primary",
|
|
2338
|
+
ui: {},
|
|
2339
|
+
style: {}
|
|
2340
|
+
},
|
|
2341
|
+
label: {
|
|
2342
|
+
display: true,
|
|
2343
|
+
ui: {},
|
|
2344
|
+
style: {}
|
|
2345
|
+
},
|
|
2346
|
+
wrapper: {
|
|
2347
|
+
ui: {},
|
|
2348
|
+
style: {}
|
|
2349
|
+
},
|
|
2350
|
+
menu: {
|
|
2351
|
+
ui: {},
|
|
2352
|
+
style: {},
|
|
2353
|
+
options: {
|
|
2354
|
+
text: {
|
|
2355
|
+
variant: "caption",
|
|
2356
|
+
color: "primary"
|
|
2357
|
+
},
|
|
2358
|
+
ui: {},
|
|
2359
|
+
style: {}
|
|
2360
|
+
}
|
|
2361
|
+
},
|
|
2362
|
+
icon: {
|
|
2363
|
+
style: {
|
|
2364
|
+
width: 24,
|
|
2365
|
+
height: 24,
|
|
2366
|
+
stroke: "currentColor"
|
|
2367
|
+
},
|
|
2368
|
+
component: void 0
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent = initiaPropsComponent3 }) => {
|
|
2273
2372
|
const [open, setOpen] = React18.useState(false);
|
|
2274
2373
|
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2275
2374
|
const ref = React18.useRef(null);
|
|
2276
2375
|
useClickAway(ref, () => setOpen(false));
|
|
2277
|
-
|
|
2376
|
+
const classes = select_variants_default({ wrapper: true });
|
|
2377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: classes, ref, children: [
|
|
2278
2378
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2279
|
-
|
|
2379
|
+
Input,
|
|
2280
2380
|
{
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2381
|
+
label,
|
|
2382
|
+
variant: "base",
|
|
2383
|
+
disabled: true,
|
|
2384
|
+
value: valueState,
|
|
2385
|
+
propsComponent: {
|
|
2386
|
+
control: propsComponent?.control,
|
|
2387
|
+
label: propsComponent?.label
|
|
2388
|
+
}
|
|
2284
2389
|
}
|
|
2285
2390
|
),
|
|
2286
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `yr3Select--icon ${open ? "yr3Select--icon--open" : ""}`, onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2392
|
+
IconDown,
|
|
2393
|
+
{
|
|
2394
|
+
width: propsComponent?.icon?.style?.width,
|
|
2395
|
+
height: propsComponent?.icon?.style?.height,
|
|
2396
|
+
stroke: propsComponent?.icon?.style?.stroke || "currentColor",
|
|
2397
|
+
style: propsComponent?.icon?.style
|
|
2398
|
+
}
|
|
2399
|
+
) }),
|
|
2400
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2401
|
+
"div",
|
|
2402
|
+
{
|
|
2403
|
+
className: "yr3Select--menu",
|
|
2404
|
+
style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
|
|
2405
|
+
"data-testid": "yr3Select-menu",
|
|
2406
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2407
|
+
"div",
|
|
2291
2408
|
{
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
onClick: (e) => {
|
|
2310
|
-
e.stopPropagation();
|
|
2311
|
-
setValueState(opt.value);
|
|
2312
|
-
setOpen(false);
|
|
2313
|
-
const event = {
|
|
2314
|
-
event: e,
|
|
2315
|
-
target: {
|
|
2316
|
-
name,
|
|
2317
|
-
value: opt.value
|
|
2318
|
-
},
|
|
2319
|
-
currentTarget: {
|
|
2320
|
-
name,
|
|
2321
|
-
value: opt.value
|
|
2322
|
-
}
|
|
2323
|
-
};
|
|
2324
|
-
onChange?.(event, opt.value);
|
|
2325
|
-
},
|
|
2326
|
-
children: opt.label
|
|
2409
|
+
className: "yr3Select--option",
|
|
2410
|
+
onClick: (e) => {
|
|
2411
|
+
e.stopPropagation();
|
|
2412
|
+
setValueState(opt.value);
|
|
2413
|
+
setOpen(false);
|
|
2414
|
+
const event = {
|
|
2415
|
+
event: e,
|
|
2416
|
+
target: {
|
|
2417
|
+
name,
|
|
2418
|
+
value: opt.value
|
|
2419
|
+
},
|
|
2420
|
+
currentTarget: {
|
|
2421
|
+
name,
|
|
2422
|
+
value: opt.value
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
onChange?.(event, opt.value);
|
|
2327
2426
|
},
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2427
|
+
style: composeStyles(propsComponent?.menu?.options?.ui, propsComponent?.menu?.options?.style),
|
|
2428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { as: "span", variant: "caption", color: propsComponent?.menu?.options?.text?.color || "primary", ...propsComponent?.menu?.options?.text, children: opt.label })
|
|
2429
|
+
},
|
|
2430
|
+
opt.value
|
|
2431
|
+
))
|
|
2432
|
+
}
|
|
2433
|
+
)
|
|
2333
2434
|
] });
|
|
2334
2435
|
};
|
|
2335
2436
|
|
|
@@ -2403,6 +2504,10 @@ var switchVariants = createVariants({
|
|
|
2403
2504
|
},
|
|
2404
2505
|
checked: {
|
|
2405
2506
|
true: "yr3Switch--checked"
|
|
2507
|
+
},
|
|
2508
|
+
placement: {
|
|
2509
|
+
start: "yr3Switch--label-start",
|
|
2510
|
+
end: "yr3Switch--label-end"
|
|
2406
2511
|
}
|
|
2407
2512
|
}
|
|
2408
2513
|
});
|
|
@@ -2416,10 +2521,12 @@ var Switch = ({
|
|
|
2416
2521
|
disabled,
|
|
2417
2522
|
color = "primary",
|
|
2418
2523
|
size = "sm",
|
|
2419
|
-
label
|
|
2524
|
+
label,
|
|
2525
|
+
placement = "end",
|
|
2526
|
+
propsComponent
|
|
2420
2527
|
}) => {
|
|
2421
2528
|
const [internal, setInternal] = React20.useState(defaultChecked || false);
|
|
2422
|
-
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
|
|
2529
|
+
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2423
2530
|
const isControlled = checked !== void 0;
|
|
2424
2531
|
const value = isControlled ? checked : internal;
|
|
2425
2532
|
const handleChange = (e) => {
|
|
@@ -2442,7 +2549,15 @@ var Switch = ({
|
|
|
2442
2549
|
}
|
|
2443
2550
|
),
|
|
2444
2551
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2445
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2553
|
+
"span",
|
|
2554
|
+
{
|
|
2555
|
+
className: "yr3Switch--label",
|
|
2556
|
+
"data-testid": "yr3Switch-label",
|
|
2557
|
+
style: composeStyles(propsComponent?.label.ui, propsComponent?.label?.style),
|
|
2558
|
+
children: label
|
|
2559
|
+
}
|
|
2560
|
+
)
|
|
2446
2561
|
]
|
|
2447
2562
|
}
|
|
2448
2563
|
);
|
|
@@ -2552,6 +2667,16 @@ function useBreakpointValue(values) {
|
|
|
2552
2667
|
return void 0;
|
|
2553
2668
|
}
|
|
2554
2669
|
|
|
2670
|
+
// src/hooks/usePlaces.ts
|
|
2671
|
+
var import_autocomplete_places2 = require("@yr3/autocomplete-places");
|
|
2672
|
+
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
2673
|
+
const { suggestions, selectPlace } = (0, import_autocomplete_places2.useAutocompletePlaces)({ apiKey, provider, language, input });
|
|
2674
|
+
return {
|
|
2675
|
+
suggestions,
|
|
2676
|
+
selectPlace
|
|
2677
|
+
};
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2555
2680
|
// src/index.ts
|
|
2556
2681
|
initTheme();
|
|
2557
2682
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2625,6 +2750,6 @@ initTheme();
|
|
|
2625
2750
|
useControl,
|
|
2626
2751
|
useMediaQuery,
|
|
2627
2752
|
useNotistack,
|
|
2628
|
-
|
|
2629
|
-
|
|
2753
|
+
usePlaces,
|
|
2754
|
+
useTheme
|
|
2630
2755
|
});
|