@dss-kit/ui-kit 1.0.2 → 1.0.4
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/builders/Dialog/Dialog.const.d.ts +9 -0
- package/dist/components/builders/Dialog/Dialog.const.js +4 -0
- package/dist/components/builders/Dialog/Dialog.context.d.ts +12 -0
- package/dist/components/builders/{Modal/context.js → Dialog/Dialog.context.js} +5 -5
- package/dist/components/builders/Dialog/Dialog.parts.d.ts +11 -0
- package/dist/components/builders/Dialog/Dialog.parts.js +11 -0
- package/dist/components/builders/Dialog/Dialog.types.d.ts +44 -0
- package/dist/components/builders/Dialog/DialogCloseButton/DialogCloseButton.d.ts +10 -0
- package/dist/components/builders/Dialog/DialogCloseButton/DialogCloseButton.js +34 -0
- package/dist/components/builders/Dialog/DialogCloseButton/index.d.ts +2 -0
- package/dist/components/builders/{Modal/ModalFooter/ModalFooter.d.ts → Dialog/DialogFooter/DialogFooter.d.ts} +13 -22
- package/dist/components/builders/Dialog/DialogFooter/DialogFooter.js +48 -0
- package/dist/components/builders/Dialog/DialogFooter/index.d.ts +2 -0
- package/dist/components/builders/{Modal/ModalHeader/ModalHeader.d.ts → Dialog/DialogHeader/DialogHeader.d.ts} +10 -6
- package/dist/components/builders/Dialog/DialogHeader/DialogHeader.js +97 -0
- package/dist/components/builders/Dialog/DialogHeader/index.d.ts +2 -0
- package/dist/components/builders/{Modal/ModalMain/ModalMain.d.ts → Dialog/DialogMain/DialogMain.d.ts} +18 -17
- package/dist/components/builders/{Modal/ModalMain/ModalMain.js → Dialog/DialogMain/DialogMain.js} +39 -29
- package/dist/components/builders/Dialog/DialogMain/index.d.ts +2 -0
- package/dist/components/builders/Dialog/DialogMain/styles.d.ts +6 -0
- package/dist/components/builders/{Modal/ModalMain → Dialog/DialogMain}/styles.js +16 -0
- package/dist/components/builders/Dialog/hooks/index.d.ts +3 -0
- package/dist/components/builders/Dialog/hooks/useBackdropClose.d.ts +10 -0
- package/dist/components/builders/Dialog/hooks/useBackdropClose.js +15 -0
- package/dist/components/builders/Dialog/hooks/useBodyScrollLock.d.ts +6 -0
- package/dist/components/builders/Dialog/hooks/useBodyScrollLock.js +13 -0
- package/dist/components/builders/Dialog/hooks/useCloseOnEsc.d.ts +6 -0
- package/dist/components/builders/Dialog/hooks/useCloseOnEsc.js +21 -0
- package/dist/components/builders/Dialog/index.d.ts +10 -0
- package/dist/components/builders/Modal/Modal.d.ts +8 -28
- package/dist/components/builders/Modal/Modal.js +50 -78
- package/dist/components/builders/Modal/index.d.ts +6 -11
- package/dist/components/builders/Modal/index.js +7 -9
- package/dist/components/builders/Modal/styles.js +6 -7
- package/dist/components/builders/Sheet/Sheet.const.d.ts +50 -0
- package/dist/components/builders/Sheet/Sheet.const.js +38 -0
- package/dist/components/builders/Sheet/Sheet.d.ts +12 -0
- package/dist/components/builders/Sheet/Sheet.js +55 -0
- package/dist/components/builders/Sheet/Sheet.types.d.ts +82 -0
- package/dist/components/builders/Sheet/Sheet.utils.d.ts +34 -0
- package/dist/components/builders/Sheet/Sheet.utils.js +50 -0
- package/dist/components/builders/Sheet/SheetLayer.d.ts +22 -0
- package/dist/components/builders/Sheet/SheetLayer.js +115 -0
- package/dist/components/builders/Sheet/hooks/index.d.ts +2 -0
- package/dist/components/builders/Sheet/hooks/useSheetGesture.d.ts +24 -0
- package/dist/components/builders/Sheet/hooks/useSheetGesture.js +67 -0
- package/dist/components/builders/Sheet/hooks/useSheetMotion.d.ts +31 -0
- package/dist/components/builders/Sheet/hooks/useSheetMotion.js +74 -0
- package/dist/components/builders/Sheet/hooks/useSheetPointer.d.ts +31 -0
- package/dist/components/builders/Sheet/hooks/useSheetPointer.js +81 -0
- package/dist/components/builders/Sheet/index.d.ts +15 -0
- package/dist/components/builders/Sheet/index.js +9 -0
- package/dist/components/builders/Sheet/styles.d.ts +17 -0
- package/dist/components/builders/Sheet/styles.js +135 -0
- package/dist/components/builders/Table/TablePagination/TablePagination.js +1 -1
- package/dist/components/builders/Text/Text.d.ts +1 -1
- package/dist/components/builders/index.d.ts +1 -0
- package/dist/components/controls/Checkbox/Checkbox.js +6 -6
- package/dist/components/controls/Select/Select.js +6 -6
- package/dist/components/controls/Switch/Switch.d.ts +10 -6
- package/dist/components/controls/Switch/Switch.js +109 -86
- package/dist/components/controls/Switch/styles.d.ts +3 -2
- package/dist/components/controls/Switch/styles.js +76 -73
- package/dist/index.js +93 -91
- package/dist/ui-kit.cjs +8 -8
- package/dist/utils/hooks/useLatestRef.d.ts +6 -0
- package/dist/utils/hooks/useLatestRef.js +10 -0
- package/package.json +1 -1
- package/dist/components/builders/Modal/ModalFooter/ModalFooter.js +0 -35
- package/dist/components/builders/Modal/ModalFooter/index.d.ts +0 -2
- package/dist/components/builders/Modal/ModalHeader/ModalHeader.js +0 -86
- package/dist/components/builders/Modal/ModalHeader/index.d.ts +0 -2
- package/dist/components/builders/Modal/ModalMain/index.d.ts +0 -2
- package/dist/components/builders/Modal/ModalMain/styles.d.ts +0 -3
- package/dist/components/builders/Modal/context.d.ts +0 -8
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { css as o } from "@emotion/css";
|
|
2
|
+
import { SHEET_HANDLE_HEIGHT as n, SHEET_OVERDRAG_LIMIT as a, SHEET_SNAP_POINT_VAR as i } from "./Sheet.const.js";
|
|
3
|
+
import { getDialogPartSelector as r } from "../Dialog/Dialog.const.js";
|
|
4
|
+
import { theme as t } from "../../../utils/theme/index.js";
|
|
5
|
+
const e = "env(safe-area-inset-top, 0px)", l = "env(safe-area-inset-bottom, 0px)", c = {
|
|
6
|
+
content: o({
|
|
7
|
+
maxHeight: [
|
|
8
|
+
`calc(100vh - ${e})`,
|
|
9
|
+
`calc(100dvh - ${e})`
|
|
10
|
+
]
|
|
11
|
+
}),
|
|
12
|
+
full: o({
|
|
13
|
+
height: ["100vh", "100dvh"],
|
|
14
|
+
paddingTop: e,
|
|
15
|
+
borderRadius: 0
|
|
16
|
+
}),
|
|
17
|
+
// Значение с var() браузер не отбросит при разборе даже без поддержки dvh,
|
|
18
|
+
// поэтому фолбэк через @supports, а не повтором свойства
|
|
19
|
+
snap: o({
|
|
20
|
+
height: `calc(var(${i}) * (100vh - ${e}))`,
|
|
21
|
+
"@supports (height: 100dvh)": {
|
|
22
|
+
height: `calc(var(${i}) * (100dvh - ${e}))`
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
}, f = {
|
|
26
|
+
bottom: {
|
|
27
|
+
panel: o({
|
|
28
|
+
right: 0,
|
|
29
|
+
bottom: 0,
|
|
30
|
+
left: 0,
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
paddingBottom: l,
|
|
33
|
+
borderTopLeftRadius: t.cornerRadius.md,
|
|
34
|
+
borderTopRightRadius: t.cornerRadius.md,
|
|
35
|
+
boxShadow: `0 -4px 20px 0 ${t.color.effect.shadow_s}`,
|
|
36
|
+
// Продолжение фона за нижним краем: при перетягивании вверх за открытое
|
|
37
|
+
// положение («резинка») у края экрана не появляется просвет. Нахлёст
|
|
38
|
+
// в 1px убирает шов на дробных смещениях
|
|
39
|
+
"&::after": {
|
|
40
|
+
content: '""',
|
|
41
|
+
position: "absolute",
|
|
42
|
+
top: "calc(100% - 1px)",
|
|
43
|
+
right: 0,
|
|
44
|
+
left: 0,
|
|
45
|
+
height: a + 1,
|
|
46
|
+
backgroundColor: "inherit"
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
handle: o({
|
|
50
|
+
alignItems: "flex-start",
|
|
51
|
+
paddingTop: t.spacing.sm
|
|
52
|
+
}),
|
|
53
|
+
handleBar: o({
|
|
54
|
+
width: 36,
|
|
55
|
+
height: 4
|
|
56
|
+
}),
|
|
57
|
+
sizing: c
|
|
58
|
+
}
|
|
59
|
+
}, u = {
|
|
60
|
+
root: o({
|
|
61
|
+
position: "fixed",
|
|
62
|
+
top: 0,
|
|
63
|
+
right: 0,
|
|
64
|
+
bottom: 0,
|
|
65
|
+
left: 0,
|
|
66
|
+
zIndex: 1
|
|
67
|
+
}),
|
|
68
|
+
// Пока Sheet уезжает, страница под ним уже доступна для кликов
|
|
69
|
+
rootClosing: o({
|
|
70
|
+
pointerEvents: "none"
|
|
71
|
+
}),
|
|
72
|
+
backdrop: o({
|
|
73
|
+
position: "absolute",
|
|
74
|
+
top: 0,
|
|
75
|
+
right: 0,
|
|
76
|
+
bottom: 0,
|
|
77
|
+
left: 0,
|
|
78
|
+
backgroundColor: t.color.fill.bg_overlay_primary,
|
|
79
|
+
backdropFilter: "blur(5px)"
|
|
80
|
+
}),
|
|
81
|
+
panel: o({
|
|
82
|
+
position: "absolute",
|
|
83
|
+
display: "flex",
|
|
84
|
+
outline: "none",
|
|
85
|
+
// Шапка — зона перетаскивания: жест не прокручивает страницу и не выделяет текст
|
|
86
|
+
[`& ${r("header")}`]: {
|
|
87
|
+
touchAction: "none",
|
|
88
|
+
userSelect: "none"
|
|
89
|
+
},
|
|
90
|
+
// Main занимает свободное место (в режимах full и snap футер прижат к низу)
|
|
91
|
+
// и не передаёт прокрутку странице, когда доходит до края
|
|
92
|
+
[`& ${r("main")}`]: {
|
|
93
|
+
flex: "1 1 auto",
|
|
94
|
+
overscrollBehavior: "contain"
|
|
95
|
+
},
|
|
96
|
+
// У футера `flex: 1` (Box): у Modal высота по контенту и это незаметно,
|
|
97
|
+
// у Sheet высота бывает фиксированной — футер не растягиваем
|
|
98
|
+
[`& ${r("footer")}`]: {
|
|
99
|
+
flex: "0 0 auto"
|
|
100
|
+
}
|
|
101
|
+
}),
|
|
102
|
+
// Первым сжимается Main. Если шапка и футер всё равно не помещаются
|
|
103
|
+
// (мелкая точка фиксации, низкий экран в landscape), прокручивается всё
|
|
104
|
+
// содержимое — футер остаётся достижимым
|
|
105
|
+
content: o({
|
|
106
|
+
display: "flex",
|
|
107
|
+
flex: "1 1 auto",
|
|
108
|
+
flexDirection: "column",
|
|
109
|
+
minWidth: 0,
|
|
110
|
+
minHeight: 0,
|
|
111
|
+
overflowX: "hidden",
|
|
112
|
+
overflowY: "auto",
|
|
113
|
+
overscrollBehavior: "contain"
|
|
114
|
+
}),
|
|
115
|
+
handle: o({
|
|
116
|
+
display: "flex",
|
|
117
|
+
flexShrink: 0,
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
height: n,
|
|
120
|
+
cursor: "grab",
|
|
121
|
+
touchAction: "none",
|
|
122
|
+
userSelect: "none",
|
|
123
|
+
"&:active": {
|
|
124
|
+
cursor: "grabbing"
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
handleBar: o({
|
|
128
|
+
borderRadius: t.cornerRadius.fullRound,
|
|
129
|
+
backgroundColor: t.color.icon.tertiary
|
|
130
|
+
})
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
f as positionStyles,
|
|
134
|
+
u as styles
|
|
135
|
+
};
|
|
@@ -5,10 +5,10 @@ import z from "../../../../assets/svg/table/chevron-left.svg.js";
|
|
|
5
5
|
import M from "../../../../assets/svg/table/chevron-right.svg.js";
|
|
6
6
|
import Q from "../../../../assets/svg/table/dots.svg.js";
|
|
7
7
|
import { getPageNumbers as U } from "./TablePagination.utils.js";
|
|
8
|
+
import { Select as X } from "../../../controls/Select/Select.js";
|
|
8
9
|
import { Button as _ } from "../../../controls/Button/Button.js";
|
|
9
10
|
import { IconButton as B } from "../../../controls/IconButton/IconButton.js";
|
|
10
11
|
import { Box as r } from "../../Box/Box.js";
|
|
11
|
-
import { Select as X } from "../../../controls/Select/Select.js";
|
|
12
12
|
import { theme as Y } from "../../../../utils/theme/index.js";
|
|
13
13
|
import { Text as Z } from "../../Text/Text.js";
|
|
14
14
|
const { color: i, cornerRadius: tt, spacing: b } = Y, bt = ({
|
|
@@ -332,11 +332,11 @@ export declare const AnimatedText: React.ComponentType<Omit<{
|
|
|
332
332
|
textOverflow?: import("csstype").Property.TextOverflow | undefined;
|
|
333
333
|
whiteSpace?: import("csstype").Property.WhiteSpace | undefined;
|
|
334
334
|
wordBreak?: import("csstype").Property.WordBreak | undefined;
|
|
335
|
-
disabled?: boolean | undefined;
|
|
336
335
|
capitalize?: boolean | undefined;
|
|
337
336
|
lowercase?: boolean | undefined;
|
|
338
337
|
uppercase?: boolean | undefined;
|
|
339
338
|
decoration?: import("csstype").Property.TextDecoration<string | number> | undefined;
|
|
339
|
+
disabled?: boolean | undefined;
|
|
340
340
|
variant?: "inherit" | TextVariant | undefined;
|
|
341
341
|
tag?: TextTag | undefined;
|
|
342
342
|
colorName?: "inherit" | TextColorName | undefined;
|
|
@@ -4,8 +4,8 @@ import { forwardRef as q, useState as A } from "react";
|
|
|
4
4
|
import D from "../../../assets/svg/shared/check.svg.js";
|
|
5
5
|
import E from "../../../assets/svg/shared/minus.svg.js";
|
|
6
6
|
import { styles as e, checkboxVariantsStyles as F } from "./styles.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Box as b } from "../../builders/Box/Box.js";
|
|
8
|
+
import { Text as g } from "../../builders/Text/Text.js";
|
|
9
9
|
const G = { sm: 20, md: 24 }, H = q(
|
|
10
10
|
({
|
|
11
11
|
checked: m,
|
|
@@ -45,7 +45,7 @@ const G = { sm: 20, md: 24 }, H = q(
|
|
|
45
45
|
),
|
|
46
46
|
children: [
|
|
47
47
|
/* @__PURE__ */ i(
|
|
48
|
-
|
|
48
|
+
b,
|
|
49
49
|
{
|
|
50
50
|
relative: !0,
|
|
51
51
|
display: "inline-flex",
|
|
@@ -95,9 +95,9 @@ const G = { sm: 20, md: 24 }, H = q(
|
|
|
95
95
|
]
|
|
96
96
|
}
|
|
97
97
|
),
|
|
98
|
-
(a || t) && /* @__PURE__ */ i(
|
|
98
|
+
(a || t) && /* @__PURE__ */ i(b, { gap: 4, children: [
|
|
99
99
|
a && /* @__PURE__ */ r(
|
|
100
|
-
|
|
100
|
+
g,
|
|
101
101
|
{
|
|
102
102
|
colorName: N,
|
|
103
103
|
variant: d === "sm" ? "body-2" : "body-1",
|
|
@@ -106,7 +106,7 @@ const G = { sm: 20, md: 24 }, H = q(
|
|
|
106
106
|
}
|
|
107
107
|
),
|
|
108
108
|
t && /* @__PURE__ */ r(
|
|
109
|
-
|
|
109
|
+
g,
|
|
110
110
|
{
|
|
111
111
|
variant: "body-2",
|
|
112
112
|
colorName: u,
|
|
@@ -7,9 +7,9 @@ import Me from "../../../assets/svg/shared/chevron-down.svg.js";
|
|
|
7
7
|
import Oe from "../../../assets/svg/shared/empty-box.svg.js";
|
|
8
8
|
import { styles as n, selectArrowSizesStyles as Ve } from "./styles.js";
|
|
9
9
|
import { useControlled as Ae } from "../../../utils/hooks/useControlled.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { Portal as De } from "../../builders/Portal/Portal.js";
|
|
11
|
+
import { Checkbox as We } from "../Checkbox/Checkbox.js";
|
|
12
|
+
import { Tag as ze } from "../../shared/Tag/Tag.js";
|
|
13
13
|
import { Box as i } from "../../builders/Box/Box.js";
|
|
14
14
|
import { Text as d } from "../../builders/Text/Text.js";
|
|
15
15
|
import { Ripple as Be } from "../../builders/Ripple/Ripple.js";
|
|
@@ -149,7 +149,7 @@ function Ye({
|
|
|
149
149
|
}) : /* @__PURE__ */ t(i, { flexWrap: "wrap", row: !0, gap: 10, children: s.map((r) => {
|
|
150
150
|
const c = S.get(r);
|
|
151
151
|
return c ? /* @__PURE__ */ t(
|
|
152
|
-
|
|
152
|
+
ze,
|
|
153
153
|
{
|
|
154
154
|
size: "sm",
|
|
155
155
|
label: l ? l(c) : String(r),
|
|
@@ -180,7 +180,7 @@ function Ye({
|
|
|
180
180
|
children: o
|
|
181
181
|
}
|
|
182
182
|
) : /* @__PURE__ */ t(ye, { children: o });
|
|
183
|
-
}, he = V && /* @__PURE__ */ t(
|
|
183
|
+
}, he = V && /* @__PURE__ */ t(De, { children: /* @__PURE__ */ t(
|
|
184
184
|
i,
|
|
185
185
|
{
|
|
186
186
|
row: !0,
|
|
@@ -258,7 +258,7 @@ function Ye({
|
|
|
258
258
|
relative: !0,
|
|
259
259
|
onClick: () => de(e),
|
|
260
260
|
children: [
|
|
261
|
-
a && /* @__PURE__ */ t(
|
|
261
|
+
a && /* @__PURE__ */ t(We, { size: "sm", checked: c }),
|
|
262
262
|
D ? /* @__PURE__ */ t(
|
|
263
263
|
d,
|
|
264
264
|
{
|
|
@@ -38,11 +38,15 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
38
38
|
*/
|
|
39
39
|
variant?: SwitchVariant;
|
|
40
40
|
/**
|
|
41
|
-
* Заголовок
|
|
41
|
+
* Заголовок переключателя — его доступное имя.
|
|
42
|
+
* Рендерится внутри `<label>`, поэтому `ReactNode` должен быть строчным
|
|
43
|
+
* контентом (без `div`, `p` и интерактивных элементов).
|
|
44
|
+
* Без `title` и `text` передайте `aria-label`.
|
|
42
45
|
*/
|
|
43
46
|
title?: string | React.ReactNode;
|
|
44
47
|
/**
|
|
45
|
-
* Текст переключателя.
|
|
48
|
+
* Текст переключателя. Вместе с `title` связывается с переключателем
|
|
49
|
+
* через `aria-describedby`. Ограничения на `ReactNode` те же, что у `title`.
|
|
46
50
|
*/
|
|
47
51
|
text?: string | React.ReactNode;
|
|
48
52
|
/**
|
|
@@ -73,13 +77,13 @@ interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
|
73
77
|
className?: string;
|
|
74
78
|
/** Класс для внешнего `Box`-обёртки над `<label>`. */
|
|
75
79
|
wrapperClassName?: string;
|
|
76
|
-
/** Класс для контейнера переключателя (
|
|
80
|
+
/** Класс для контейнера переключателя (`<span>` со `switchContainer`). */
|
|
77
81
|
switchContainerClassName?: string;
|
|
78
|
-
/** Класс для рельса-трека переключателя (`<
|
|
82
|
+
/** Класс для рельса-трека переключателя (`<span>` с `switch`). */
|
|
79
83
|
trackClassName?: string;
|
|
80
|
-
/** Класс для перемещаемой ручки переключателя (`<
|
|
84
|
+
/** Класс для перемещаемой ручки переключателя (`<span>` с `thumb`). */
|
|
81
85
|
thumbClassName?: string;
|
|
82
|
-
/** Класс для скрытого нативного `<input
|
|
86
|
+
/** Класс для визуально скрытого нативного `<input>` поверх трека. */
|
|
83
87
|
inputClassName?: string;
|
|
84
88
|
/** Класс для блока с заголовком/описанием. */
|
|
85
89
|
labelsContainerClassName?: string;
|
|
@@ -1,140 +1,163 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { cx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { styles as
|
|
7
|
-
import { useControlled as
|
|
8
|
-
import { Text as
|
|
9
|
-
import { Box as
|
|
10
|
-
import { theme as
|
|
11
|
-
const { spacing:
|
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { cx as o } from "@emotion/css";
|
|
3
|
+
import { forwardRef as q, useId as A, useRef as G, useImperativeHandle as J, useCallback as K, useMemo as I } from "react";
|
|
4
|
+
import L from "../../../assets/svg/switch/fire.svg.js";
|
|
5
|
+
import O from "../../../assets/svg/switch/moon.svg.js";
|
|
6
|
+
import { styles as e } from "./styles.js";
|
|
7
|
+
import { useControlled as Q } from "../../../utils/hooks/useControlled.js";
|
|
8
|
+
import { Text as x } from "../../builders/Text/Text.js";
|
|
9
|
+
import { Box as U } from "../../builders/Box/Box.js";
|
|
10
|
+
import { theme as X } from "../../../utils/theme/index.js";
|
|
11
|
+
const { spacing: Y } = X, Z = q(
|
|
12
12
|
({
|
|
13
|
-
title:
|
|
14
|
-
text:
|
|
15
|
-
icon:
|
|
16
|
-
disabled:
|
|
17
|
-
onChange:
|
|
18
|
-
checked:
|
|
19
|
-
defaultValue:
|
|
20
|
-
className:
|
|
21
|
-
wrapperClassName:
|
|
22
|
-
switchContainerClassName:
|
|
23
|
-
trackClassName:
|
|
24
|
-
thumbClassName:
|
|
25
|
-
inputClassName:
|
|
26
|
-
labelsContainerClassName:
|
|
13
|
+
title: c,
|
|
14
|
+
text: s,
|
|
15
|
+
icon: B,
|
|
16
|
+
disabled: d,
|
|
17
|
+
onChange: n,
|
|
18
|
+
checked: S,
|
|
19
|
+
defaultValue: p,
|
|
20
|
+
className: $,
|
|
21
|
+
wrapperClassName: j,
|
|
22
|
+
switchContainerClassName: C,
|
|
23
|
+
trackClassName: R,
|
|
24
|
+
thumbClassName: V,
|
|
25
|
+
inputClassName: D,
|
|
26
|
+
labelsContainerClassName: E,
|
|
27
27
|
titleClassName: h,
|
|
28
|
-
textClassName:
|
|
29
|
-
size:
|
|
30
|
-
variant:
|
|
28
|
+
textClassName: b,
|
|
29
|
+
size: F = "md",
|
|
30
|
+
variant: y = "accent",
|
|
31
31
|
reverse: M = !1,
|
|
32
32
|
w: W = "auto",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
"aria-describedby": _,
|
|
34
|
+
...g
|
|
35
|
+
}, z) => {
|
|
36
|
+
const [l, a] = Q(
|
|
37
|
+
S,
|
|
38
|
+
p ?? !1
|
|
39
|
+
), N = A(), m = `${N}-title`, u = `${N}-text`, k = !!(c && s), H = [k && u, _].filter(Boolean).join(" ") || void 0, i = G(null);
|
|
40
|
+
J(
|
|
41
|
+
z,
|
|
38
42
|
() => ({
|
|
39
43
|
focus: () => {
|
|
40
|
-
|
|
44
|
+
i.current?.focus();
|
|
41
45
|
},
|
|
42
46
|
blur: () => {
|
|
43
|
-
|
|
47
|
+
i.current?.blur();
|
|
44
48
|
},
|
|
45
49
|
get checked() {
|
|
46
|
-
return
|
|
50
|
+
return l ?? !1;
|
|
47
51
|
},
|
|
48
|
-
setChecked: (
|
|
49
|
-
|
|
52
|
+
setChecked: (r) => {
|
|
53
|
+
a(r), n?.(r);
|
|
50
54
|
},
|
|
51
55
|
toggle: () => {
|
|
52
|
-
const
|
|
53
|
-
|
|
56
|
+
const r = !l;
|
|
57
|
+
a(r), n?.(r);
|
|
54
58
|
},
|
|
55
|
-
isFocused: () => document.activeElement ===
|
|
56
|
-
isDisabled: () =>
|
|
57
|
-
getInputElement: () =>
|
|
58
|
-
checkValidity: () =>
|
|
59
|
+
isFocused: () => document.activeElement === i.current,
|
|
60
|
+
isDisabled: () => d ?? !1,
|
|
61
|
+
getInputElement: () => i.current,
|
|
62
|
+
checkValidity: () => i.current?.checkValidity() ?? !0,
|
|
59
63
|
reset: () => {
|
|
60
|
-
const
|
|
61
|
-
|
|
64
|
+
const r = p ?? !1;
|
|
65
|
+
a(r), n?.(r);
|
|
62
66
|
}
|
|
63
67
|
}),
|
|
64
|
-
[
|
|
68
|
+
[l, a, n, d, p]
|
|
65
69
|
);
|
|
66
|
-
const
|
|
67
|
-
(
|
|
68
|
-
|
|
70
|
+
const T = K(
|
|
71
|
+
(r) => {
|
|
72
|
+
a(r.target.checked), n?.(r.target.checked);
|
|
69
73
|
},
|
|
70
|
-
[
|
|
71
|
-
),
|
|
72
|
-
|
|
74
|
+
[n, a]
|
|
75
|
+
), v = I(() => c ? typeof c == "string" ? /* @__PURE__ */ t(
|
|
76
|
+
x,
|
|
73
77
|
{
|
|
78
|
+
id: m,
|
|
79
|
+
tag: "span",
|
|
74
80
|
variant: "body-1",
|
|
75
81
|
colorName: "primary",
|
|
76
82
|
fontWeight: "medium",
|
|
77
83
|
className: h,
|
|
78
|
-
children:
|
|
84
|
+
children: c
|
|
79
85
|
}
|
|
80
|
-
) :
|
|
81
|
-
|
|
86
|
+
) : /* @__PURE__ */ t("span", { id: m, children: c }) : null, [c, h, m]), w = I(() => s ? typeof s == "string" ? /* @__PURE__ */ t(
|
|
87
|
+
x,
|
|
82
88
|
{
|
|
89
|
+
id: u,
|
|
90
|
+
tag: "span",
|
|
83
91
|
variant: "body-2",
|
|
84
92
|
colorName: "secondary",
|
|
85
93
|
fontWeight: "regular",
|
|
86
|
-
className:
|
|
87
|
-
children:
|
|
94
|
+
className: b,
|
|
95
|
+
children: s
|
|
88
96
|
}
|
|
89
|
-
) :
|
|
90
|
-
return /* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
97
|
+
) : /* @__PURE__ */ t("span", { id: u, children: s }) : null, [s, b, u]);
|
|
98
|
+
return /* @__PURE__ */ f(U, { row: !0, w: W, gap: Y.sm, className: j, children: [
|
|
99
|
+
/* @__PURE__ */ f(
|
|
92
100
|
"label",
|
|
93
101
|
{
|
|
94
|
-
className:
|
|
95
|
-
[
|
|
96
|
-
[
|
|
102
|
+
className: o(e.container, $, {
|
|
103
|
+
[e.disabled]: d,
|
|
104
|
+
[e.reverse]: M
|
|
97
105
|
}),
|
|
98
106
|
children: [
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
|
|
107
|
+
/* @__PURE__ */ f(
|
|
108
|
+
"span",
|
|
101
109
|
{
|
|
102
|
-
className:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
className: o(
|
|
111
|
+
e.switchContainer,
|
|
112
|
+
e[`size_${F}`],
|
|
113
|
+
e[`variant_${y}`],
|
|
114
|
+
C
|
|
107
115
|
),
|
|
108
116
|
children: [
|
|
109
117
|
/* @__PURE__ */ t(
|
|
110
118
|
"input",
|
|
111
119
|
{
|
|
112
|
-
ref:
|
|
120
|
+
ref: i,
|
|
113
121
|
type: "checkbox",
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
onChange:
|
|
117
|
-
disabled:
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
role: "switch",
|
|
123
|
+
checked: l,
|
|
124
|
+
onChange: T,
|
|
125
|
+
disabled: d,
|
|
126
|
+
"aria-labelledby": k && !g["aria-label"] ? m : void 0,
|
|
127
|
+
"aria-describedby": H,
|
|
128
|
+
className: o(e.input, D),
|
|
129
|
+
...g
|
|
120
130
|
}
|
|
121
131
|
),
|
|
122
|
-
/* @__PURE__ */ t(
|
|
132
|
+
/* @__PURE__ */ t(
|
|
133
|
+
"span",
|
|
134
|
+
{
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
className: o(e.switch, R),
|
|
137
|
+
children: /* @__PURE__ */ t("span", { className: o(e.thumb, V), children: y === "theme" && (l ? /* @__PURE__ */ t(O, { className: e.icon }) : /* @__PURE__ */ t(L, { className: e.icon })) })
|
|
138
|
+
}
|
|
139
|
+
)
|
|
123
140
|
]
|
|
124
141
|
}
|
|
125
142
|
),
|
|
126
|
-
(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
(v || w) && /* @__PURE__ */ f(
|
|
144
|
+
"span",
|
|
145
|
+
{
|
|
146
|
+
className: o(e.labelsContainer, E),
|
|
147
|
+
children: [
|
|
148
|
+
v,
|
|
149
|
+
w
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
)
|
|
130
153
|
]
|
|
131
154
|
}
|
|
132
155
|
),
|
|
133
|
-
|
|
156
|
+
B
|
|
134
157
|
] });
|
|
135
158
|
}
|
|
136
159
|
);
|
|
137
|
-
|
|
160
|
+
Z.displayName = "Switch";
|
|
138
161
|
export {
|
|
139
|
-
|
|
162
|
+
Z as Switch
|
|
140
163
|
};
|
|
@@ -3,6 +3,7 @@ export declare const styles: {
|
|
|
3
3
|
disabled: string;
|
|
4
4
|
reverse: string;
|
|
5
5
|
switchContainer: string;
|
|
6
|
+
input: string;
|
|
6
7
|
variant_accent: string;
|
|
7
8
|
variant_secondary: string;
|
|
8
9
|
variant_positive: string;
|
|
@@ -12,6 +13,6 @@ export declare const styles: {
|
|
|
12
13
|
size_lg: string;
|
|
13
14
|
switch: string;
|
|
14
15
|
thumb: string;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
labelsContainer: string;
|
|
17
|
+
icon: string;
|
|
17
18
|
};
|