@unicom-cloud/ui 0.8.106 → 0.8.108
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/App.js +7 -0
- package/BackTop.js +2 -4
- package/Calendar.js +2 -2
- package/ColorPicker.js +15 -14
- package/Constant.js +4 -0
- package/Copy.js +4 -3
- package/Countdown.js +25 -0
- package/Grid.js +8 -10
- package/LiquidFill.js +4 -3
- package/List.js +7 -6
- package/Marquee.js +4 -3
- package/Modal.js +4 -2
- package/PageHeader.js +3 -2
- package/QrCode.js +4 -3
- package/RowCol.js +8 -0
- package/Segmented.js +14 -4
- package/Statistic.js +5 -4
- package/Tour.js +4 -3
- package/Transfer.js +4 -2
- package/anchor/Link.js +1 -1
- package/app/App.js +26 -0
- package/app/context.js +9 -0
- package/app/index.js +9 -0
- package/app/interface.js +1 -0
- package/app/useApp.js +8 -0
- package/avatar/Group.js +1 -1
- package/back-top/index.js +44 -56
- package/button/index.js +52 -51
- package/calendar/Lunar.js +71 -0
- package/calendar/index.js +11 -11
- package/cascader/base/node.js +22 -20
- package/cascader/base/store.js +10 -10
- package/cascader/util.js +29 -27
- package/color-picker/Mode.js +8 -7
- package/color-picker/hooks/useColorPicker.js +56 -55
- package/color-picker/index.js +49 -48
- package/color-picker/utils.js +58 -57
- package/components/common/empty/index.js +2 -2
- package/components/common/flex/index.js +64 -55
- package/components/common/flex/interface.js +6 -6
- package/components/common/hooks/useInterval.js +6 -6
- package/components/common/icons/file/index.js +13 -11
- package/components/common/space/index.js +53 -53
- package/components/common/utils/dayjs.js +114 -126
- package/components/common/utils/is.js +98 -104
- package/components/common/utils/setDir.js +12 -0
- package/components/common/utils/setTheme.js +13 -13
- package/components/common/utils/toArray.js +7 -5
- package/config-provider/ConfigProvider.js +32 -30
- package/constant/index.js +4 -0
- package/copy/index.js +2 -1
- package/countdown/index.js +113 -0
- package/countdown/interface.js +1 -0
- package/countdown/util.js +29 -0
- package/descriptions/index.js +45 -45
- package/divider/index.js +28 -20
- package/dropdown/Button.js +1 -1
- package/empty/index.js +1 -1
- package/flex/index.js +30 -29
- package/form/FormItem.js +126 -122
- package/grid/Grid.js +56 -90
- package/grid/Item.js +44 -65
- package/grid/context.js +2 -6
- package/grid/index.js +6 -8
- package/grid/util.js +6 -44
- package/hooks/useResponsiveState.js +54 -0
- package/index.js +614 -605
- package/input/Button.js +12 -12
- package/input/Group.js +11 -12
- package/input/Input.js +112 -102
- package/input/InputElement.js +25 -24
- package/input/Search.js +24 -24
- package/layout/Sider.js +1 -1
- package/liquid-fill/index.js +4 -3
- package/list/Item.js +21 -21
- package/list/index.js +53 -52
- package/marquee/index.js +20 -19
- package/marquee-/index.js +4 -3
- package/mentions/util.js +9 -8
- package/modal/Confirm.js +17 -17
- package/modal/Modal.js +247 -237
- package/modal/index.js +4 -2
- package/modal/use-modal/index.js +2 -2
- package/package.json +1 -1
- package/page-header/index.js +57 -56
- package/pagination/Pagination.js +89 -92
- package/qr-code/index.js +4 -3
- package/radio/Group.js +1 -1
- package/row-col/Col-.js +88 -0
- package/row-col/Col.js +159 -0
- package/row-col/Row.js +73 -0
- package/row-col/context.js +5 -0
- package/row-col/index.js +11 -0
- package/row-col/interface.js +1 -0
- package/segmented/index.js +257 -206
- package/select/Select.js +191 -191
- package/select/util.js +50 -50
- package/select-view/Core.js +31 -28
- package/space/index.js +15 -13
- package/splitter/SplitBar.js +44 -46
- package/statistic/index.js +56 -55
- package/statistic/interface.js +4 -1
- package/style.css +1 -1
- package/table/Table.js +198 -210
- package/table/hook/useColumns.js +27 -26
- package/table/hook/useStickyClassNames.js +9 -8
- package/table/hook/useThResizable.js +4 -3
- package/table/th-resizable/index.js +2 -2
- package/table/thead/index.js +18 -16
- package/time-picker/util.js +20 -30
- package/timeline/Item.js +1 -1
- package/tour/index.js +4 -3
- package/transfer/index.js +93 -91
- package/trigger/index.js +66 -66
- package/types/common/development/interface.d.ts +3 -3
- package/types/common/flex/index.d.ts +3 -9
- package/types/common/flex/interface.d.ts +15 -4
- package/types/common/space/index.d.ts +3 -5
- package/types/common/space/interface.d.ts +2 -0
- package/types/common/utils/dayjs.d.ts +3 -1
- package/types/common/utils/is.d.ts +3 -4
- package/types/common/utils/setDir.d.ts +2 -0
- package/types/pc/app/App.d.ts +6 -0
- package/types/pc/app/context.d.ts +4 -0
- package/types/pc/app/index.d.ts +5 -0
- package/types/pc/app/interface.d.ts +17 -0
- package/types/pc/app/useApp.d.ts +3 -0
- package/types/pc/back-top/interface.d.ts +4 -17
- package/types/pc/button/interface.d.ts +2 -2
- package/types/pc/calendar/Lunar.d.ts +17 -0
- package/types/pc/calendar/index.d.ts +1 -1
- package/types/pc/config-provider/interface.d.ts +17 -12
- package/types/pc/constant/index.d.ts +1 -0
- package/types/pc/countdown/interface.d.ts +65 -0
- package/types/pc/countdown/util.d.ts +7 -0
- package/types/pc/divider/interface.d.ts +1 -0
- package/types/pc/flex/index.d.ts +8 -6
- package/types/pc/flex/interface.d.ts +3 -10
- package/types/pc/form/FormItem.d.ts +1 -1
- package/types/pc/form/interface.d.ts +1 -1
- package/types/pc/grid/Grid.d.ts +2 -4
- package/types/pc/grid/Item.d.ts +1 -5
- package/types/pc/grid/context.d.ts +4 -15
- package/types/pc/grid/index.d.ts +4 -6
- package/types/pc/grid/interface.d.ts +14 -142
- package/types/pc/grid/util.d.ts +1 -10
- package/types/pc/hooks/useResponsiveState.d.ts +3 -0
- package/types/pc/index.d.ts +10 -4
- package/types/pc/input/Button.d.ts +2 -2
- package/types/pc/list/interface.d.ts +2 -1
- package/types/pc/message/index.d.ts +1 -9
- package/types/pc/message/interface.d.ts +8 -0
- package/types/pc/message/useMessage.d.ts +1 -2
- package/types/pc/modal/Modal.d.ts +1 -0
- package/types/pc/modal/config.d.ts +1 -2
- package/types/pc/modal/index.d.ts +2 -1
- package/types/pc/modal/interface.d.ts +17 -5
- package/types/pc/notification/index.d.ts +2 -9
- package/types/pc/notification/interface.d.ts +7 -0
- package/types/pc/notification/useNotification.d.ts +1 -2
- package/types/pc/pagination/PageOption.d.ts +0 -1
- package/types/pc/pagination/interface.d.ts +5 -6
- package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
- package/types/pc/{grid → row-col}/Col.d.ts +1 -2
- package/types/pc/{grid → row-col}/Row.d.ts +1 -2
- package/types/pc/row-col/context.d.ts +6 -0
- package/types/pc/row-col/index.d.ts +7 -0
- package/types/pc/row-col/interface.d.ts +112 -0
- package/types/pc/segmented/index.d.ts +3 -7
- package/types/pc/segmented/interface.d.ts +38 -5
- package/types/pc/select-view/Core.d.ts +1 -8
- package/types/pc/select-view/index.d.ts +1 -8
- package/types/pc/select-view/interface.d.ts +9 -2
- package/types/pc/space/index.d.ts +5 -7
- package/types/pc/space/interface.d.ts +3 -10
- package/types/pc/statistic/index.d.ts +1 -1
- package/types/pc/statistic/interface.d.ts +1 -49
- package/types/pc/utils/is.d.ts +1 -1
- package/types/pc/utils/names.d.ts +422 -111
- package/types/pc/utils/responsiveObserve.d.ts +8 -8
- package/typography/Ellipsis.js +5 -4
- package/typography/Operations.js +4 -3
- package/utils/dayjs.js +13 -11
- package/utils/index.js +245 -244
- package/utils/is.js +65 -66
- package/utils/names.js +309 -150
- package/utils/responsiveObserve.js +43 -36
- package/version/index.js +1 -1
- package/grid/Col-.js +0 -86
- package/grid/Col.js +0 -169
- package/grid/Row.js +0 -96
- package/grid/hook/useResponsiveState.js +0 -38
- package/statistic/Countdown.js +0 -56
- package/statistic/util.js +0 -33
- package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
- package/types/pc/statistic/util.d.ts +0 -1
- /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
package/segmented/index.js
CHANGED
|
@@ -1,228 +1,279 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as h, jsxs as H, Fragment as $e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as he, useContext as ye, useMemo as ze, useState as xe, useRef as L, useEffect as K, useImperativeHandle as ve } from "react";
|
|
3
3
|
import "../config-provider/ConfigProvider.js";
|
|
4
|
-
import
|
|
5
|
-
import j from "@unicom-cloud/utils/class-name";
|
|
4
|
+
import "lodash/isEqualWith";
|
|
6
5
|
import "../components/common/utils/is.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
6
|
+
import "@unicom-cloud/utils/constant/keyboardCode";
|
|
7
|
+
import "lodash/isNumber";
|
|
8
|
+
import "lodash/merge";
|
|
9
|
+
import "../components/common/utils/dom.js";
|
|
10
|
+
import we from "../components/common/hooks/useForceUpdate.js";
|
|
11
|
+
import "../components/common/hooks/useIntersectionObserver.js";
|
|
12
|
+
import Se from "../components/common/hooks/useMergeProps.js";
|
|
13
|
+
import "../components/common/utils/reactDOM.js";
|
|
14
|
+
import "@unicom-cloud/utils/constant";
|
|
15
|
+
import ke from "../components/common/hooks/useUpdateEffect.js";
|
|
16
|
+
import "lodash/debounce";
|
|
17
|
+
import M from "@unicom-cloud/utils/class-name";
|
|
18
|
+
import Ce from "../config-provider/context.js";
|
|
19
|
+
import { isString as Ie, isNumber as T, isFunction as W } from "@unicom-cloud/utils/is";
|
|
20
|
+
const G = {
|
|
21
|
+
mini: {
|
|
22
|
+
root: {
|
|
23
|
+
fontSize: "var(--pqb-font-size-body-1)",
|
|
24
|
+
padding: "2px"
|
|
25
|
+
},
|
|
26
|
+
option: {
|
|
27
|
+
size: "var(--pqb-size-mini)",
|
|
28
|
+
padding: `${10 + 3 * 0}px`
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
small: {
|
|
32
|
+
root: {
|
|
33
|
+
fontSize: "var(--pqb-font-size-body-3)",
|
|
34
|
+
padding: "3px"
|
|
35
|
+
},
|
|
36
|
+
option: {
|
|
37
|
+
size: "var(--pqb-size-small)",
|
|
38
|
+
padding: `${10 + 3 * 1}px`
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
medium: {
|
|
42
|
+
root: {
|
|
43
|
+
fontSize: "var(--pqb-font-size-body-3)",
|
|
44
|
+
padding: "4px"
|
|
45
|
+
},
|
|
46
|
+
option: {
|
|
47
|
+
size: "var(--pqb-size-medium)",
|
|
48
|
+
padding: `${10 + 3 * 2}px`
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
large: {
|
|
52
|
+
root: {
|
|
53
|
+
fontSize: "var(--pqb-font-size-body-3)",
|
|
54
|
+
padding: "5px"
|
|
55
|
+
},
|
|
56
|
+
option: {
|
|
57
|
+
size: "var(--pqb-size-large)",
|
|
58
|
+
padding: `${10 + 3 * 3}px`
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, Ne = {
|
|
11
62
|
options: [],
|
|
12
63
|
size: "medium",
|
|
13
64
|
mode: "default",
|
|
14
65
|
disabled: !1,
|
|
15
66
|
block: !1,
|
|
67
|
+
split: !1,
|
|
16
68
|
direction: "horizontal",
|
|
17
69
|
showIndicator: !0,
|
|
70
|
+
keyboardSwitch: !0,
|
|
18
71
|
animationDuration: 300
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const e = i.findIndex(
|
|
58
|
-
(s) => s?.value === a
|
|
59
|
-
);
|
|
60
|
-
if (e === -1) {
|
|
61
|
-
b((s) => ({ ...s, opacity: 0 }));
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const o = I.current[e];
|
|
65
|
-
if (!o) {
|
|
66
|
-
b((s) => ({ ...s, opacity: 0 }));
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const n = d.current.getBoundingClientRect(), t = o.getBoundingClientRect(), l = h === "vertical" ? {
|
|
70
|
-
width: t.width,
|
|
71
|
-
// 垂直模式下宽度撑满
|
|
72
|
-
top: t.top - n.top,
|
|
73
|
-
height: t.height
|
|
74
|
-
} : {
|
|
75
|
-
width: t.width,
|
|
76
|
-
left: t.left - n.left,
|
|
77
|
-
height: t.height
|
|
78
|
-
// 水平模式下高度撑满
|
|
79
|
-
};
|
|
80
|
-
b({
|
|
81
|
-
...l,
|
|
82
|
-
opacity: 1
|
|
83
|
-
});
|
|
84
|
-
}, [a, i, C, h]), z = (e, o) => {
|
|
85
|
-
o || m || (g || S(e), u?.(e));
|
|
86
|
-
}, X = (e, o) => {
|
|
87
|
-
if (m) return;
|
|
88
|
-
const n = i.length;
|
|
89
|
-
if (n === 0) return;
|
|
90
|
-
let t = o;
|
|
91
|
-
switch (e.key) {
|
|
92
|
-
case "ArrowLeft":
|
|
93
|
-
case "ArrowUp":
|
|
94
|
-
e.preventDefault(), t = (o - 1 + n) % n;
|
|
95
|
-
break;
|
|
96
|
-
case "ArrowRight":
|
|
97
|
-
case "ArrowDown":
|
|
98
|
-
e.preventDefault(), t = (o + 1) % n;
|
|
99
|
-
break;
|
|
100
|
-
case "Home":
|
|
101
|
-
e.preventDefault(), t = 0;
|
|
102
|
-
break;
|
|
103
|
-
case "End":
|
|
104
|
-
e.preventDefault(), t = n - 1;
|
|
105
|
-
break;
|
|
106
|
-
default:
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
for (; t !== o && i[t]?.disabled; )
|
|
110
|
-
t = (t + (e.key === "ArrowLeft" || e.key === "ArrowUp" ? -1 : 1) + n) % n;
|
|
111
|
-
const l = i[t]?.value;
|
|
112
|
-
l && l !== a && (z(l), I.current[t]?.focus());
|
|
72
|
+
};
|
|
73
|
+
function Oe(B, J) {
|
|
74
|
+
const { getPrefixCls: Q, componentConfig: X, rtl: k } = ye(Ce), f = Se(
|
|
75
|
+
B,
|
|
76
|
+
Ne,
|
|
77
|
+
X?.Segmented
|
|
78
|
+
), {
|
|
79
|
+
style: Y,
|
|
80
|
+
className: Z,
|
|
81
|
+
options: C = [],
|
|
82
|
+
defaultValue: _,
|
|
83
|
+
value: ee,
|
|
84
|
+
size: y = "medium",
|
|
85
|
+
gap: I,
|
|
86
|
+
mode: z = "default",
|
|
87
|
+
disabled: u = !1,
|
|
88
|
+
block: N = !1,
|
|
89
|
+
split: oe,
|
|
90
|
+
direction: x = "horizontal",
|
|
91
|
+
showIndicator: O = !0,
|
|
92
|
+
keyboardSwitch: q = !0,
|
|
93
|
+
animationDuration: A = 300,
|
|
94
|
+
name: D,
|
|
95
|
+
immediateTrigger: te = !1,
|
|
96
|
+
onChange: P,
|
|
97
|
+
...ie
|
|
98
|
+
} = f, R = we(), o = Q?.("segmented"), ne = x === "vertical", V = z === "pill", F = "value" in f, r = ze(() => C.map((e) => Ie(e) || T(e) ? { value: e, label: e } : e), [C]), [re, se] = xe(_), U = L(null), v = L([]), a = F ? ee : re, d = G[y] || G.medium;
|
|
99
|
+
function ae() {
|
|
100
|
+
let e = I;
|
|
101
|
+
return "gap" in f ? e = I : e = d.root.padding, e;
|
|
102
|
+
}
|
|
103
|
+
const m = ae();
|
|
104
|
+
function de() {
|
|
105
|
+
const e = {
|
|
106
|
+
padding: `0 ${d.option.padding}`,
|
|
107
|
+
height: `calc(${d.option.size} - ${d.root.padding} * 2)`
|
|
113
108
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, [i, a, g, u]), $(() => {
|
|
124
|
-
q && !ue(c) && de(u) && u(c);
|
|
125
|
-
}, []), $(() => {
|
|
126
|
-
w();
|
|
127
|
-
}, [a, i, w]), $(() => {
|
|
128
|
-
if (!d.current) return;
|
|
129
|
-
const e = le(
|
|
130
|
-
[d.current],
|
|
131
|
-
() => {
|
|
132
|
-
w();
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
return () => {
|
|
136
|
-
e();
|
|
137
|
-
};
|
|
138
|
-
}, [w]);
|
|
139
|
-
const Y = (e, o) => {
|
|
140
|
-
if (e.render)
|
|
141
|
-
return e.render(e, o);
|
|
142
|
-
const n = !e.label && !!e.icon;
|
|
143
|
-
return /* @__PURE__ */ D(ne, { children: [
|
|
144
|
-
e.icon && /* @__PURE__ */ v("span", { className: `${r}-option-icon`, children: e.icon }),
|
|
145
|
-
!n && e.label && /* @__PURE__ */ v("span", { className: `${r}-option-label`, children: e.label })
|
|
146
|
-
] });
|
|
109
|
+
return V && (e.borderRadius = `calc(${e.height} / 2)`), e;
|
|
110
|
+
}
|
|
111
|
+
const b = de();
|
|
112
|
+
function le() {
|
|
113
|
+
const e = {
|
|
114
|
+
gap: m,
|
|
115
|
+
fontSize: d.root.fontSize,
|
|
116
|
+
padding: d.root.padding,
|
|
117
|
+
...Y
|
|
147
118
|
};
|
|
148
|
-
|
|
149
|
-
"
|
|
119
|
+
if (e["--gap"] = T(m) ? `${m}px` : m, V && (e.borderRadius = `calc(${d.option.size} / 2)`), O) {
|
|
120
|
+
b.borderRadius && (e["--before-border-radius"] = b.borderRadius), A && (e["--before-transition-duration"] = `${A}ms`);
|
|
121
|
+
const i = r.findIndex((n) => n?.value === a), t = v.current[i];
|
|
122
|
+
t && (e["--before-width"] = `${t.offsetWidth}px`, e["--before-height"] = `${t.offsetHeight}px`, ne ? e["--before-top"] = `${t.offsetTop}px` : e["--before-left"] = `${t.offsetLeft}px`);
|
|
123
|
+
}
|
|
124
|
+
return e;
|
|
125
|
+
}
|
|
126
|
+
const pe = le();
|
|
127
|
+
function g(e, i, t) {
|
|
128
|
+
const n = t || r.find((p) => p.value === e);
|
|
129
|
+
F || se(e), W(P) && P(e, n);
|
|
130
|
+
}
|
|
131
|
+
function ce(e, i, t, n) {
|
|
132
|
+
n || u || g(e, i, t);
|
|
133
|
+
}
|
|
134
|
+
function fe(e) {
|
|
135
|
+
if (e.preventDefault(), !q || u)
|
|
136
|
+
return;
|
|
137
|
+
const i = r.findIndex((l) => l?.value === a);
|
|
138
|
+
let t = i;
|
|
139
|
+
const n = r.length;
|
|
140
|
+
switch (e.key) {
|
|
141
|
+
case "ArrowLeft":
|
|
142
|
+
case "ArrowUp":
|
|
143
|
+
t = (i - 1 + n) % n;
|
|
144
|
+
break;
|
|
145
|
+
case "ArrowRight":
|
|
146
|
+
case "ArrowDown":
|
|
147
|
+
t = (i + 1) % n;
|
|
148
|
+
break;
|
|
149
|
+
case "Home":
|
|
150
|
+
t = 0;
|
|
151
|
+
break;
|
|
152
|
+
case "End":
|
|
153
|
+
t = n - 1;
|
|
154
|
+
break;
|
|
155
|
+
default:
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
for (; t !== i && r[t]?.disabled; ) {
|
|
159
|
+
const l = ["ArrowLeft", "ArrowUp"].includes(e.key) ? -1 : 1;
|
|
160
|
+
t = (t + l + n) % n;
|
|
161
|
+
}
|
|
162
|
+
const p = r[t], s = p?.value;
|
|
163
|
+
s && s !== a && (g(s, t, p), v.current[t]?.focus?.());
|
|
164
|
+
}
|
|
165
|
+
function ue(e, i, t) {
|
|
166
|
+
if (!e) return;
|
|
167
|
+
const {
|
|
168
|
+
style: n,
|
|
169
|
+
className: p,
|
|
170
|
+
value: s,
|
|
171
|
+
label: l,
|
|
172
|
+
icon: w,
|
|
173
|
+
disabled: me,
|
|
174
|
+
render: E,
|
|
175
|
+
...be
|
|
176
|
+
} = e, c = s === a, $ = me || u, S = !l && !!w, ge = Object.assign(
|
|
177
|
+
{},
|
|
178
|
+
b,
|
|
179
|
+
S ? { padding: 0, width: b.height } : {},
|
|
180
|
+
n
|
|
181
|
+
);
|
|
182
|
+
return /* @__PURE__ */ H(
|
|
183
|
+
"button",
|
|
150
184
|
{
|
|
151
|
-
ref: (
|
|
152
|
-
|
|
185
|
+
ref: (j) => {
|
|
186
|
+
v.current[i] = j;
|
|
187
|
+
},
|
|
188
|
+
style: ge,
|
|
189
|
+
className: M(
|
|
190
|
+
`${o}-option`,
|
|
191
|
+
`${o}-option-size-${y}`,
|
|
192
|
+
`${o}-option-mode-${z}`,
|
|
193
|
+
`${o}-option-direction-${x}`,
|
|
194
|
+
{
|
|
195
|
+
[`${o}-option-rtl`]: k,
|
|
196
|
+
[`${o}-option-block`]: N,
|
|
197
|
+
[`${o}-option-split`]: oe,
|
|
198
|
+
[`${o}-option-active`]: c,
|
|
199
|
+
[`${o}-option-disabled`]: $
|
|
200
|
+
},
|
|
201
|
+
S ? `${o}-option-icon-only` : `${o}-option-not-icon-only`,
|
|
202
|
+
p
|
|
203
|
+
),
|
|
204
|
+
disabled: $,
|
|
205
|
+
role: "radio",
|
|
206
|
+
"aria-checked": c,
|
|
207
|
+
"aria-disabled": $,
|
|
208
|
+
tabIndex: c ? 0 : -1,
|
|
209
|
+
onClick: (j) => {
|
|
210
|
+
ce(s, i, e, $);
|
|
153
211
|
},
|
|
154
|
-
...
|
|
155
|
-
style: L,
|
|
156
|
-
className: W,
|
|
157
|
-
role: "radiogroup",
|
|
212
|
+
...be,
|
|
158
213
|
children: [
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const {
|
|
162
|
-
value: n,
|
|
163
|
-
label: t,
|
|
164
|
-
disabled: l,
|
|
165
|
-
icon: s,
|
|
166
|
-
render: he,
|
|
167
|
-
...Z
|
|
168
|
-
} = e, f = n === a, y = l || m, ee = !t && !!s, te = [t, n, o].filter(Boolean).join("-");
|
|
169
|
-
return /* @__PURE__ */ D(
|
|
170
|
-
"button",
|
|
171
|
-
{
|
|
172
|
-
ref: (N) => I.current[o] = N,
|
|
173
|
-
className: j(
|
|
174
|
-
`${r}-option`,
|
|
175
|
-
`${r}-option-${H}`,
|
|
176
|
-
`${r}-option-${k}`,
|
|
177
|
-
{
|
|
178
|
-
[`${r}-option-active`]: f,
|
|
179
|
-
[`${r}-option-disabled`]: y,
|
|
180
|
-
[`${r}-option-icon-only`]: ee
|
|
181
|
-
}
|
|
182
|
-
),
|
|
183
|
-
onClick: () => z(n, y),
|
|
184
|
-
onKeyDown: (N) => X(N, o),
|
|
185
|
-
disabled: y,
|
|
186
|
-
role: "radio",
|
|
187
|
-
"aria-checked": f,
|
|
188
|
-
"aria-disabled": y,
|
|
189
|
-
tabIndex: f ? 0 : -1,
|
|
190
|
-
...Z,
|
|
191
|
-
children: [
|
|
192
|
-
x && /* @__PURE__ */ v(
|
|
193
|
-
"input",
|
|
194
|
-
{
|
|
195
|
-
type: "radio",
|
|
196
|
-
name: x,
|
|
197
|
-
value: n,
|
|
198
|
-
checked: f,
|
|
199
|
-
className: `${r}-input`,
|
|
200
|
-
tabIndex: -1,
|
|
201
|
-
"aria-hidden": "true"
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
Y(e, f)
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
te
|
|
208
|
-
);
|
|
209
|
-
}),
|
|
210
|
-
C && /* @__PURE__ */ v(
|
|
211
|
-
"div",
|
|
214
|
+
!!D && /* @__PURE__ */ h(
|
|
215
|
+
"input",
|
|
212
216
|
{
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
217
|
+
type: "radio",
|
|
218
|
+
name: D,
|
|
219
|
+
value: s,
|
|
220
|
+
checked: c,
|
|
221
|
+
className: `${o}-input`,
|
|
222
|
+
tabIndex: -1,
|
|
223
|
+
"aria-hidden": "true"
|
|
218
224
|
}
|
|
219
|
-
)
|
|
225
|
+
),
|
|
226
|
+
W(E) ? E(e, c) : /* @__PURE__ */ H($e, { children: [
|
|
227
|
+
w && /* @__PURE__ */ h("span", { className: `${o}-option-icon`, children: w }),
|
|
228
|
+
!S && /* @__PURE__ */ h("span", { className: `${o}-option-label`, children: l })
|
|
229
|
+
] })
|
|
220
230
|
]
|
|
221
|
-
}
|
|
231
|
+
},
|
|
232
|
+
`${l}-${s}-${i}`
|
|
222
233
|
);
|
|
223
234
|
}
|
|
224
|
-
)
|
|
225
|
-
|
|
235
|
+
return ke(() => {
|
|
236
|
+
a === void 0 || r.some((i) => i.value === a) || g(void 0);
|
|
237
|
+
}, [r]), K(() => {
|
|
238
|
+
const e = requestAnimationFrame(() => {
|
|
239
|
+
R();
|
|
240
|
+
});
|
|
241
|
+
return () => {
|
|
242
|
+
cancelAnimationFrame(e);
|
|
243
|
+
};
|
|
244
|
+
}, [R, f]), K(() => {
|
|
245
|
+
te && g(a);
|
|
246
|
+
}, []), ve(J, () => ({
|
|
247
|
+
dom: U.current
|
|
248
|
+
})), /* @__PURE__ */ h(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
ref: U,
|
|
252
|
+
...ie,
|
|
253
|
+
style: pe,
|
|
254
|
+
className: M(
|
|
255
|
+
o,
|
|
256
|
+
{
|
|
257
|
+
[`${o}-rtl`]: k,
|
|
258
|
+
[`${o}-block`]: N,
|
|
259
|
+
[`${o}-disabled`]: u,
|
|
260
|
+
[`${o}-indicator`]: O
|
|
261
|
+
},
|
|
262
|
+
`${o}-mode-${z}`,
|
|
263
|
+
`${o}-direction-${x}`,
|
|
264
|
+
`${o}-size-${y}`,
|
|
265
|
+
Z
|
|
266
|
+
),
|
|
267
|
+
role: "radiogroup",
|
|
268
|
+
onKeyDown: q ? (e) => {
|
|
269
|
+
fe(e);
|
|
270
|
+
} : void 0,
|
|
271
|
+
children: r.map(ue)
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
const qe = he(Oe);
|
|
276
|
+
qe.displayName = "Segmented";
|
|
226
277
|
export {
|
|
227
|
-
|
|
278
|
+
qe as default
|
|
228
279
|
};
|