@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.js
CHANGED
|
@@ -271,7 +271,6 @@ var normalizePhone = (phone, dial) => {
|
|
|
271
271
|
};
|
|
272
272
|
var getDialPhone = (phone, countries) => {
|
|
273
273
|
for (const country of countries) {
|
|
274
|
-
console.log("checking", phone, "against", country.dial);
|
|
275
274
|
if (phone.startsWith(country.dial)) {
|
|
276
275
|
return country.dial;
|
|
277
276
|
}
|
|
@@ -456,9 +455,6 @@ function initTheme() {
|
|
|
456
455
|
applyTheme(createTheme());
|
|
457
456
|
}
|
|
458
457
|
|
|
459
|
-
// src/index.ts
|
|
460
|
-
export * from "@yr3/autocomplete-places";
|
|
461
|
-
|
|
462
458
|
// src/components/Avatar/Avatar.tsx
|
|
463
459
|
import * as React from "react";
|
|
464
460
|
|
|
@@ -610,6 +606,42 @@ var Box = ({
|
|
|
610
606
|
);
|
|
611
607
|
};
|
|
612
608
|
|
|
609
|
+
// src/components/Text/text.variants.ts
|
|
610
|
+
var textVariants = createVariants({
|
|
611
|
+
base: "yr3Text",
|
|
612
|
+
variants: {
|
|
613
|
+
variant: {
|
|
614
|
+
h1: "yr3Text--h1",
|
|
615
|
+
h2: "yr3Text--h2",
|
|
616
|
+
h3: "yr3Text--h3",
|
|
617
|
+
h4: "yr3Text--h4",
|
|
618
|
+
h5: "yr3Text--h5",
|
|
619
|
+
h6: "yr3Text--h6",
|
|
620
|
+
title: "yr3Text--title",
|
|
621
|
+
subtitle: "yr3Text--subtitle",
|
|
622
|
+
body1: "yr3Text--body1",
|
|
623
|
+
body2: "yr3Text--body2",
|
|
624
|
+
helper: "yr3Text--helper",
|
|
625
|
+
inherit: "yr3Text--inherit",
|
|
626
|
+
caption: "yr3Text--caption",
|
|
627
|
+
button: "yr3Text--button",
|
|
628
|
+
code: "yr3Text--code"
|
|
629
|
+
},
|
|
630
|
+
color: {
|
|
631
|
+
primary: "yr3Text--color-primary",
|
|
632
|
+
secondary: "yr3Text--color-secondary",
|
|
633
|
+
success: "yr3Text--color-success",
|
|
634
|
+
text: "yr3Text--color-text",
|
|
635
|
+
disabled: "yr3Text--color-disabled",
|
|
636
|
+
warning: "yr3Text--color-warning",
|
|
637
|
+
error: "yr3Text--color-error",
|
|
638
|
+
info: "yr3Text--color-info",
|
|
639
|
+
background: "yr3Text--color-background"
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
var text_variants_default = textVariants;
|
|
644
|
+
|
|
613
645
|
// src/components/Text/Text.tsx
|
|
614
646
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
615
647
|
var Text = ({
|
|
@@ -624,16 +656,11 @@ var Text = ({
|
|
|
624
656
|
onClick
|
|
625
657
|
}) => {
|
|
626
658
|
const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
|
|
659
|
+
const classes = text_variants_default({ variant, color, weight });
|
|
627
660
|
return /* @__PURE__ */ jsx5(
|
|
628
661
|
Component,
|
|
629
662
|
{
|
|
630
|
-
className:
|
|
631
|
-
yr3Text
|
|
632
|
-
yr3Text--${variant}
|
|
633
|
-
yr3Text--${color}
|
|
634
|
-
${weight ? `yr3Text--${weight}` : ""}
|
|
635
|
-
|
|
636
|
-
`,
|
|
663
|
+
className: classes,
|
|
637
664
|
style: composeStyles(styleUI, style),
|
|
638
665
|
onClick,
|
|
639
666
|
"data-testid": "yr3Text",
|
|
@@ -762,7 +789,8 @@ var initalPropsComponent = {
|
|
|
762
789
|
color: "primary",
|
|
763
790
|
bordered: true,
|
|
764
791
|
ui: {},
|
|
765
|
-
style: {}
|
|
792
|
+
style: {},
|
|
793
|
+
component: null
|
|
766
794
|
},
|
|
767
795
|
buttonNext: {
|
|
768
796
|
disabled: false,
|
|
@@ -808,7 +836,7 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
808
836
|
children: dayjs2().day(i + 1).format("dd")
|
|
809
837
|
}
|
|
810
838
|
) }, `month_day_${i}`)),
|
|
811
|
-
times(program.calendar.length, (i) => /* @__PURE__ */ jsx7(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */
|
|
839
|
+
times(program.calendar.length, (i) => /* @__PURE__ */ jsx7(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ jsxs2(
|
|
812
840
|
"div",
|
|
813
841
|
{
|
|
814
842
|
className: calendarDayVariants({
|
|
@@ -830,14 +858,17 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
830
858
|
setSelected(program.calendar[i][j]);
|
|
831
859
|
}
|
|
832
860
|
},
|
|
833
|
-
children:
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
861
|
+
children: [
|
|
862
|
+
program.calendar[i][j]?.data && propsComponent?.day?.component ? propsComponent.day.component : null,
|
|
863
|
+
/* @__PURE__ */ jsx7(
|
|
864
|
+
Text,
|
|
865
|
+
{
|
|
866
|
+
variant: "body2",
|
|
867
|
+
color: program.calendar[i][j]?.isFuture ? "text" : "text",
|
|
868
|
+
children: program.calendar[i][j]?.day || ""
|
|
869
|
+
}
|
|
870
|
+
)
|
|
871
|
+
]
|
|
841
872
|
},
|
|
842
873
|
`day-${i}-${j}`
|
|
843
874
|
)) }, i))
|
|
@@ -1049,6 +1080,7 @@ var Control = ({
|
|
|
1049
1080
|
style,
|
|
1050
1081
|
ui,
|
|
1051
1082
|
color = "primary",
|
|
1083
|
+
size = "auto",
|
|
1052
1084
|
label = true
|
|
1053
1085
|
}) => {
|
|
1054
1086
|
const [focused, setFocused] = React7.useState(false);
|
|
@@ -1058,7 +1090,7 @@ var Control = ({
|
|
|
1058
1090
|
error,
|
|
1059
1091
|
disabled
|
|
1060
1092
|
};
|
|
1061
|
-
const classes = controlVariants({ variant, color, label });
|
|
1093
|
+
const classes = controlVariants({ variant, color, label, size });
|
|
1062
1094
|
return /* @__PURE__ */ jsx13(ControlContext.Provider, { value, children: /* @__PURE__ */ jsx13(
|
|
1063
1095
|
"div",
|
|
1064
1096
|
{
|
|
@@ -1540,7 +1572,8 @@ var initiaPropsComponent = {
|
|
|
1540
1572
|
display: true,
|
|
1541
1573
|
ui: {},
|
|
1542
1574
|
style: {}
|
|
1543
|
-
}
|
|
1575
|
+
},
|
|
1576
|
+
control: {}
|
|
1544
1577
|
};
|
|
1545
1578
|
var Input = React12.forwardRef(
|
|
1546
1579
|
({
|
|
@@ -1555,11 +1588,11 @@ var Input = React12.forwardRef(
|
|
|
1555
1588
|
propsComponent = initiaPropsComponent,
|
|
1556
1589
|
type = "text",
|
|
1557
1590
|
color = "primary",
|
|
1591
|
+
size = "auto",
|
|
1558
1592
|
...props
|
|
1559
1593
|
}, ref) => {
|
|
1560
1594
|
const [focused, setFocused] = React12.useState(false);
|
|
1561
1595
|
const [internalValue, setInternalValue] = React12.useState(defaultValue);
|
|
1562
|
-
const [internalError, setInternalError] = React12.useState(null);
|
|
1563
1596
|
const isControlled = value !== void 0;
|
|
1564
1597
|
const currentValue = isControlled ? value : internalValue;
|
|
1565
1598
|
const isActive = focused || !!currentValue;
|
|
@@ -1577,19 +1610,13 @@ var Input = React12.forwardRef(
|
|
|
1577
1610
|
};
|
|
1578
1611
|
const handleChange = (e) => {
|
|
1579
1612
|
const newValue = e.target.value;
|
|
1580
|
-
const isValid = checkPattern(type, newValue);
|
|
1581
|
-
if (!isValid) {
|
|
1582
|
-
setInternalError("Valore non valido");
|
|
1583
|
-
} else {
|
|
1584
|
-
setInternalError(null);
|
|
1585
|
-
}
|
|
1586
1613
|
if (!isControlled) {
|
|
1587
1614
|
setInternalValue(newValue);
|
|
1588
1615
|
}
|
|
1589
1616
|
onChange?.(e, newValue);
|
|
1590
1617
|
};
|
|
1591
1618
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1592
|
-
return /* @__PURE__ */ jsxs6(Control, { variant, color, label: propsComponent?.label?.display, children: [
|
|
1619
|
+
return /* @__PURE__ */ jsxs6(Control, { variant, color, label: propsComponent?.label?.display, ...propsComponent.control, children: [
|
|
1593
1620
|
propsComponent?.label?.display && /* @__PURE__ */ jsx24(
|
|
1594
1621
|
Label,
|
|
1595
1622
|
{
|
|
@@ -1607,6 +1634,7 @@ var Input = React12.forwardRef(
|
|
|
1607
1634
|
type,
|
|
1608
1635
|
autoComplete: "off",
|
|
1609
1636
|
onChange: handleChange,
|
|
1637
|
+
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1610
1638
|
onFocus: () => setFocused(true),
|
|
1611
1639
|
onBlur: () => setFocused(false),
|
|
1612
1640
|
className: classes,
|
|
@@ -1614,8 +1642,7 @@ var Input = React12.forwardRef(
|
|
|
1614
1642
|
...props,
|
|
1615
1643
|
"data-testid": "yr3Input"
|
|
1616
1644
|
}
|
|
1617
|
-
)
|
|
1618
|
-
/* @__PURE__ */ jsx24(Text, { variant: "helper", color: "disabled", "data-testid": "yr3Input-helper", ui: { position: "absolute", bottom: -18, left: 0 }, children: error || internalError || "" })
|
|
1645
|
+
)
|
|
1619
1646
|
] });
|
|
1620
1647
|
}
|
|
1621
1648
|
);
|
|
@@ -1875,6 +1902,10 @@ var initalPropsComponent2 = {
|
|
|
1875
1902
|
variant: "caption",
|
|
1876
1903
|
color: "primary",
|
|
1877
1904
|
children: void 0
|
|
1905
|
+
},
|
|
1906
|
+
menu: {
|
|
1907
|
+
ui: {},
|
|
1908
|
+
style: {}
|
|
1878
1909
|
}
|
|
1879
1910
|
};
|
|
1880
1911
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
@@ -1887,7 +1918,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
1887
1918
|
/* @__PURE__ */ jsx31("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ jsx31(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
1888
1919
|
valueState
|
|
1889
1920
|
] }) }),
|
|
1890
|
-
open && /* @__PURE__ */ jsx31("div", { className: "yr3Selector--menu", children: options.map((opt) => /* @__PURE__ */ jsx31(
|
|
1921
|
+
open && /* @__PURE__ */ jsx31("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ jsx31(
|
|
1891
1922
|
"div",
|
|
1892
1923
|
{
|
|
1893
1924
|
className: "yr3Selector--option",
|
|
@@ -1927,38 +1958,36 @@ var Phone = ({
|
|
|
1927
1958
|
propsComponent,
|
|
1928
1959
|
defaultValue
|
|
1929
1960
|
}) => {
|
|
1930
|
-
const [prefixValue, setPrefixValue] = React16.useState(countries?.[0].dial);
|
|
1931
|
-
const [internalValue, setInternalValue] = React16.useState(defaultValue);
|
|
1932
1961
|
const isControlled = value !== void 0;
|
|
1933
|
-
const
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
}
|
|
1941
|
-
};
|
|
1962
|
+
const initial = value || defaultValue || "";
|
|
1963
|
+
const [prefix, setPrefix] = React16.useState(
|
|
1964
|
+
getDialPhone(initial, countries) || countries[0].dial
|
|
1965
|
+
);
|
|
1966
|
+
const [number, setNumber] = React16.useState(
|
|
1967
|
+
getNumberPhone(initial, prefix) || ""
|
|
1968
|
+
);
|
|
1942
1969
|
React16.useEffect(() => {
|
|
1943
|
-
if (
|
|
1944
|
-
const dial = getDialPhone(
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
const handleChange = (e, value2) => {
|
|
1949
|
-
const newValue = value2;
|
|
1950
|
-
const isValid = checkPattern("phone", newValue);
|
|
1951
|
-
if (!isValid) {
|
|
1952
|
-
return;
|
|
1970
|
+
if (isControlled && value) {
|
|
1971
|
+
const dial = getDialPhone(value, countries);
|
|
1972
|
+
const num = getNumberPhone(value, dial);
|
|
1973
|
+
setPrefix(dial);
|
|
1974
|
+
setNumber(num);
|
|
1953
1975
|
}
|
|
1976
|
+
}, [value]);
|
|
1977
|
+
const handleNumberChange = (e, val) => {
|
|
1978
|
+
const clean = val.replace(/[^\d]/g, "");
|
|
1954
1979
|
if (!isControlled) {
|
|
1955
|
-
|
|
1980
|
+
setNumber(clean);
|
|
1956
1981
|
}
|
|
1957
|
-
onChange?.(e,
|
|
1982
|
+
onChange?.(e, `${prefix}${clean}`);
|
|
1983
|
+
};
|
|
1984
|
+
const handlePrefixChange = (_, val) => {
|
|
1985
|
+
setPrefix(val);
|
|
1986
|
+
onChange?.(null, `${val}${number}`);
|
|
1958
1987
|
};
|
|
1959
1988
|
return /* @__PURE__ */ jsxs11(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
1960
1989
|
/* @__PURE__ */ jsx32(Label, { text: label, className: "yr3Input--active" }),
|
|
1961
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ jsxs11(Flex, { variant: "row", container: true, center: true, children: [
|
|
1962
1991
|
/* @__PURE__ */ jsx32(
|
|
1963
1992
|
Selector_default,
|
|
1964
1993
|
{
|
|
@@ -1966,33 +1995,33 @@ var Phone = ({
|
|
|
1966
1995
|
value: c.dial,
|
|
1967
1996
|
label: c.code
|
|
1968
1997
|
})),
|
|
1969
|
-
value:
|
|
1970
|
-
onChange:
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1998
|
+
value: prefix,
|
|
1999
|
+
onChange: handlePrefixChange,
|
|
2000
|
+
...propsComponent?.selector
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
/* @__PURE__ */ jsx32(
|
|
2004
|
+
Divider,
|
|
2005
|
+
{
|
|
2006
|
+
orientation: "vertical",
|
|
2007
|
+
color: "primary",
|
|
2008
|
+
ui: { height: 49 },
|
|
2009
|
+
...propsComponent?.divider
|
|
1979
2010
|
}
|
|
1980
2011
|
),
|
|
1981
|
-
/* @__PURE__ */ jsx32(Divider, { orientation: "vertical", color: "primary", ui: { height: 50 - 1, mb: -1 }, ...propsComponent?.divider }),
|
|
1982
2012
|
/* @__PURE__ */ jsx32(
|
|
1983
2013
|
Input,
|
|
1984
2014
|
{
|
|
1985
|
-
type: "
|
|
1986
|
-
variant: "base",
|
|
2015
|
+
type: "number",
|
|
1987
2016
|
name,
|
|
1988
|
-
value:
|
|
2017
|
+
value: number,
|
|
2018
|
+
variant: "base",
|
|
1989
2019
|
...propsComponent?.input,
|
|
1990
|
-
onChange:
|
|
1991
|
-
}
|
|
1992
|
-
currentValue
|
|
2020
|
+
onChange: handleNumberChange
|
|
2021
|
+
}
|
|
1993
2022
|
)
|
|
1994
|
-
] })
|
|
1995
|
-
] }
|
|
2023
|
+
] })
|
|
2024
|
+
] });
|
|
1996
2025
|
};
|
|
1997
2026
|
|
|
1998
2027
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
@@ -2162,68 +2191,140 @@ var Radio = ({
|
|
|
2162
2191
|
|
|
2163
2192
|
// src/components/Select/Select.tsx
|
|
2164
2193
|
import * as React18 from "react";
|
|
2194
|
+
|
|
2195
|
+
// src/components/Select/select.variants.ts
|
|
2196
|
+
var selectVariants = createVariants({
|
|
2197
|
+
base: "yr3Select",
|
|
2198
|
+
variants: {
|
|
2199
|
+
wrapper: {
|
|
2200
|
+
true: "yr3Select--wrapper"
|
|
2201
|
+
},
|
|
2202
|
+
variant: {
|
|
2203
|
+
filled: "yr3Select--filled",
|
|
2204
|
+
outlined: "yr3Select--outlined",
|
|
2205
|
+
base: "yr3Select--base",
|
|
2206
|
+
lined: "yr3Select--lined"
|
|
2207
|
+
},
|
|
2208
|
+
color: {
|
|
2209
|
+
primary: "yr3Select--color-primary",
|
|
2210
|
+
secondary: "yr3Select--color-secondary",
|
|
2211
|
+
success: "yr3Select--color-success",
|
|
2212
|
+
text: "yr3Select--color-text",
|
|
2213
|
+
disabled: "yr3Select--color-disabled",
|
|
2214
|
+
background: "yr3Select--color-background",
|
|
2215
|
+
error: "yr3Select--color-error",
|
|
2216
|
+
warning: "yr3Select--color-warning",
|
|
2217
|
+
info: "yr3Select--color-info"
|
|
2218
|
+
},
|
|
2219
|
+
animated: {
|
|
2220
|
+
true: "yr3Select--animated"
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
});
|
|
2224
|
+
var select_variants_default = selectVariants;
|
|
2225
|
+
|
|
2226
|
+
// src/components/Select/Select.tsx
|
|
2165
2227
|
import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2166
|
-
var
|
|
2228
|
+
var initiaPropsComponent3 = {
|
|
2229
|
+
control: {
|
|
2230
|
+
variant: "outlined",
|
|
2231
|
+
color: "primary",
|
|
2232
|
+
ui: {},
|
|
2233
|
+
style: {}
|
|
2234
|
+
},
|
|
2235
|
+
label: {
|
|
2236
|
+
display: true,
|
|
2237
|
+
ui: {},
|
|
2238
|
+
style: {}
|
|
2239
|
+
},
|
|
2240
|
+
wrapper: {
|
|
2241
|
+
ui: {},
|
|
2242
|
+
style: {}
|
|
2243
|
+
},
|
|
2244
|
+
menu: {
|
|
2245
|
+
ui: {},
|
|
2246
|
+
style: {},
|
|
2247
|
+
options: {
|
|
2248
|
+
text: {
|
|
2249
|
+
variant: "caption",
|
|
2250
|
+
color: "primary"
|
|
2251
|
+
},
|
|
2252
|
+
ui: {},
|
|
2253
|
+
style: {}
|
|
2254
|
+
}
|
|
2255
|
+
},
|
|
2256
|
+
icon: {
|
|
2257
|
+
style: {
|
|
2258
|
+
width: 24,
|
|
2259
|
+
height: 24,
|
|
2260
|
+
stroke: "currentColor"
|
|
2261
|
+
},
|
|
2262
|
+
component: void 0
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent = initiaPropsComponent3 }) => {
|
|
2167
2266
|
const [open, setOpen] = React18.useState(false);
|
|
2168
2267
|
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2169
2268
|
const ref = React18.useRef(null);
|
|
2170
2269
|
useClickAway(ref, () => setOpen(false));
|
|
2171
|
-
|
|
2270
|
+
const classes = select_variants_default({ wrapper: true });
|
|
2271
|
+
return /* @__PURE__ */ jsxs14("div", { className: classes, ref, children: [
|
|
2172
2272
|
/* @__PURE__ */ jsx35(
|
|
2173
|
-
|
|
2273
|
+
Input,
|
|
2174
2274
|
{
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2275
|
+
label,
|
|
2276
|
+
variant: "base",
|
|
2277
|
+
disabled: true,
|
|
2278
|
+
value: valueState,
|
|
2279
|
+
propsComponent: {
|
|
2280
|
+
control: propsComponent?.control,
|
|
2281
|
+
label: propsComponent?.label
|
|
2282
|
+
}
|
|
2178
2283
|
}
|
|
2179
2284
|
),
|
|
2180
|
-
/* @__PURE__ */
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2285
|
+
/* @__PURE__ */ jsx35("div", { className: `yr3Select--icon ${open ? "yr3Select--icon--open" : ""}`, onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ jsx35(
|
|
2286
|
+
IconDown,
|
|
2287
|
+
{
|
|
2288
|
+
width: propsComponent?.icon?.style?.width,
|
|
2289
|
+
height: propsComponent?.icon?.style?.height,
|
|
2290
|
+
stroke: propsComponent?.icon?.style?.stroke || "currentColor",
|
|
2291
|
+
style: propsComponent?.icon?.style
|
|
2292
|
+
}
|
|
2293
|
+
) }),
|
|
2294
|
+
open && /* @__PURE__ */ jsx35(
|
|
2295
|
+
"div",
|
|
2296
|
+
{
|
|
2297
|
+
className: "yr3Select--menu",
|
|
2298
|
+
style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
|
|
2299
|
+
"data-testid": "yr3Select-menu",
|
|
2300
|
+
children: options.map((opt) => /* @__PURE__ */ jsx35(
|
|
2301
|
+
"div",
|
|
2185
2302
|
{
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
onClick: (e) => {
|
|
2204
|
-
e.stopPropagation();
|
|
2205
|
-
setValueState(opt.value);
|
|
2206
|
-
setOpen(false);
|
|
2207
|
-
const event = {
|
|
2208
|
-
event: e,
|
|
2209
|
-
target: {
|
|
2210
|
-
name,
|
|
2211
|
-
value: opt.value
|
|
2212
|
-
},
|
|
2213
|
-
currentTarget: {
|
|
2214
|
-
name,
|
|
2215
|
-
value: opt.value
|
|
2216
|
-
}
|
|
2217
|
-
};
|
|
2218
|
-
onChange?.(event, opt.value);
|
|
2219
|
-
},
|
|
2220
|
-
children: opt.label
|
|
2303
|
+
className: "yr3Select--option",
|
|
2304
|
+
onClick: (e) => {
|
|
2305
|
+
e.stopPropagation();
|
|
2306
|
+
setValueState(opt.value);
|
|
2307
|
+
setOpen(false);
|
|
2308
|
+
const event = {
|
|
2309
|
+
event: e,
|
|
2310
|
+
target: {
|
|
2311
|
+
name,
|
|
2312
|
+
value: opt.value
|
|
2313
|
+
},
|
|
2314
|
+
currentTarget: {
|
|
2315
|
+
name,
|
|
2316
|
+
value: opt.value
|
|
2317
|
+
}
|
|
2318
|
+
};
|
|
2319
|
+
onChange?.(event, opt.value);
|
|
2221
2320
|
},
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2321
|
+
style: composeStyles(propsComponent?.menu?.options?.ui, propsComponent?.menu?.options?.style),
|
|
2322
|
+
children: /* @__PURE__ */ jsx35(Text, { as: "span", variant: "caption", color: propsComponent?.menu?.options?.text?.color || "primary", ...propsComponent?.menu?.options?.text, children: opt.label })
|
|
2323
|
+
},
|
|
2324
|
+
opt.value
|
|
2325
|
+
))
|
|
2326
|
+
}
|
|
2327
|
+
)
|
|
2227
2328
|
] });
|
|
2228
2329
|
};
|
|
2229
2330
|
|
|
@@ -2297,6 +2398,10 @@ var switchVariants = createVariants({
|
|
|
2297
2398
|
},
|
|
2298
2399
|
checked: {
|
|
2299
2400
|
true: "yr3Switch--checked"
|
|
2401
|
+
},
|
|
2402
|
+
placement: {
|
|
2403
|
+
start: "yr3Switch--label-start",
|
|
2404
|
+
end: "yr3Switch--label-end"
|
|
2300
2405
|
}
|
|
2301
2406
|
}
|
|
2302
2407
|
});
|
|
@@ -2310,10 +2415,12 @@ var Switch = ({
|
|
|
2310
2415
|
disabled,
|
|
2311
2416
|
color = "primary",
|
|
2312
2417
|
size = "sm",
|
|
2313
|
-
label
|
|
2418
|
+
label,
|
|
2419
|
+
placement = "end",
|
|
2420
|
+
propsComponent
|
|
2314
2421
|
}) => {
|
|
2315
2422
|
const [internal, setInternal] = React20.useState(defaultChecked || false);
|
|
2316
|
-
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
|
|
2423
|
+
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2317
2424
|
const isControlled = checked !== void 0;
|
|
2318
2425
|
const value = isControlled ? checked : internal;
|
|
2319
2426
|
const handleChange = (e) => {
|
|
@@ -2336,7 +2443,15 @@ var Switch = ({
|
|
|
2336
2443
|
}
|
|
2337
2444
|
),
|
|
2338
2445
|
/* @__PURE__ */ jsx37("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx37("span", { className: "yr3Switch--thumb" }) }),
|
|
2339
|
-
/* @__PURE__ */ jsx37(
|
|
2446
|
+
/* @__PURE__ */ jsx37(
|
|
2447
|
+
"span",
|
|
2448
|
+
{
|
|
2449
|
+
className: "yr3Switch--label",
|
|
2450
|
+
"data-testid": "yr3Switch-label",
|
|
2451
|
+
style: composeStyles(propsComponent?.label.ui, propsComponent?.label?.style),
|
|
2452
|
+
children: label
|
|
2453
|
+
}
|
|
2454
|
+
)
|
|
2340
2455
|
]
|
|
2341
2456
|
}
|
|
2342
2457
|
);
|
|
@@ -2446,6 +2561,16 @@ function useBreakpointValue(values) {
|
|
|
2446
2561
|
return void 0;
|
|
2447
2562
|
}
|
|
2448
2563
|
|
|
2564
|
+
// src/hooks/usePlaces.ts
|
|
2565
|
+
import { useAutocompletePlaces as useAutocompletePlaces2 } from "@yr3/autocomplete-places";
|
|
2566
|
+
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
2567
|
+
const { suggestions, selectPlace } = useAutocompletePlaces2({ apiKey, provider, language, input });
|
|
2568
|
+
return {
|
|
2569
|
+
suggestions,
|
|
2570
|
+
selectPlace
|
|
2571
|
+
};
|
|
2572
|
+
};
|
|
2573
|
+
|
|
2449
2574
|
// src/index.ts
|
|
2450
2575
|
initTheme();
|
|
2451
2576
|
export {
|
|
@@ -2518,5 +2643,6 @@ export {
|
|
|
2518
2643
|
useControl,
|
|
2519
2644
|
useMediaQuery,
|
|
2520
2645
|
useNotistack,
|
|
2646
|
+
usePlaces,
|
|
2521
2647
|
useTheme
|
|
2522
2648
|
};
|