@mattermost/compass-ui 0.1.0-alpha.13 → 0.1.0-alpha.14
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/channel-sidebar-item/ChannelSidebarItem.cjs +1 -1
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.cjs.map +1 -1
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.d.ts.map +1 -1
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.js +32 -31
- package/dist/components/channel-sidebar-item/ChannelSidebarItem.js.map +1 -1
- package/dist/components/checkbox/Checkbox.css +1 -1
- package/dist/components/checkbox/Checkbox.module.scss.cjs +1 -1
- package/dist/components/checkbox/Checkbox.module.scss.js +10 -10
- package/dist/components/icon-button/IconButton.css +1 -1
- package/dist/components/icon-button/IconButton.module.scss.cjs +1 -1
- package/dist/components/icon-button/IconButton.module.scss.js +15 -15
- package/dist/components/modal/Modal.cjs +1 -1
- package/dist/components/modal/Modal.cjs.map +1 -1
- package/dist/components/modal/Modal.css +1 -1
- package/dist/components/modal/Modal.d.ts +25 -3
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +105 -68
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/Modal.module.scss.cjs +1 -1
- package/dist/components/modal/Modal.module.scss.js +14 -12
- package/dist/components/modal/Modal.module.scss.js.map +1 -1
- package/dist/components/modal-header/ModalHeader.css +1 -1
- package/dist/components/modal-header/ModalHeader.module.scss.cjs +1 -1
- package/dist/components/modal-header/ModalHeader.module.scss.js +15 -15
- package/dist/components/popover-menu/PopoverMenu.cjs +1 -1
- package/dist/components/popover-menu/PopoverMenu.cjs.map +1 -1
- package/dist/components/popover-menu/PopoverMenu.css +1 -1
- package/dist/components/popover-menu/PopoverMenu.d.ts +9 -1
- package/dist/components/popover-menu/PopoverMenu.d.ts.map +1 -1
- package/dist/components/popover-menu/PopoverMenu.js +39 -28
- package/dist/components/popover-menu/PopoverMenu.js.map +1 -1
- package/dist/components/popover-menu/PopoverMenu.module.scss.cjs +1 -1
- package/dist/components/popover-menu/PopoverMenu.module.scss.js +12 -10
- package/dist/components/popover-menu/PopoverMenu.module.scss.js.map +1 -1
- package/dist/components/radio/Radio.css +1 -1
- package/dist/components/radio/Radio.module.scss.cjs +1 -1
- package/dist/components/radio/Radio.module.scss.js +14 -14
- package/dist/components/switch/Switch.css +1 -1
- package/dist/components/switch/Switch.module.scss.cjs +1 -1
- package/dist/components/switch/Switch.module.scss.js +11 -11
- package/dist/components/tabs/Tabs.cjs +1 -1
- package/dist/components/tabs/Tabs.cjs.map +1 -1
- package/dist/components/tabs/Tabs.css +1 -1
- package/dist/components/tabs/Tabs.d.ts +4 -1
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +41 -35
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tabs/Tabs.module.scss.cjs +1 -1
- package/dist/components/tabs/Tabs.module.scss.js +13 -12
- package/dist/components/tabs/Tabs.module.scss.js.map +1 -1
- package/dist/components/tabs/index.d.ts +1 -1
- package/dist/components/tabs/index.d.ts.map +1 -1
- package/dist/hooks/use-modal-focus.cjs +2 -0
- package/dist/hooks/use-modal-focus.cjs.map +1 -0
- package/dist/hooks/use-modal-focus.d.ts +26 -0
- package/dist/hooks/use-modal-focus.d.ts.map +1 -0
- package/dist/hooks/use-modal-focus.js +91 -0
- package/dist/hooks/use-modal-focus.js.map +1 -0
- package/dist/hooks/use-popover-transition.cjs +1 -1
- package/dist/hooks/use-popover-transition.cjs.map +1 -1
- package/dist/hooks/use-popover-transition.d.ts +6 -4
- package/dist/hooks/use-popover-transition.d.ts.map +1 -1
- package/dist/hooks/use-popover-transition.js +19 -15
- package/dist/hooks/use-popover-transition.js.map +1 -1
- package/dist/utils/duration.cjs +2 -0
- package/dist/utils/duration.cjs.map +1 -0
- package/dist/utils/duration.d.ts +8 -0
- package/dist/utils/duration.d.ts.map +1 -0
- package/dist/utils/duration.js +11 -0
- package/dist/utils/duration.js.map +1 -0
- package/package.json +4 -1
|
@@ -1,40 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as c, useEffect as _ } from "react";
|
|
3
|
+
import { usePopoverTransition as j } from "../../hooks/use-popover-transition.js";
|
|
4
|
+
import M from "../scrollbar/Scrollbar.js";
|
|
3
5
|
import n from "./PopoverMenu.module.scss.js";
|
|
4
|
-
function
|
|
6
|
+
function T({
|
|
5
7
|
variant: o = "parent",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
open: e,
|
|
9
|
+
onExited: r,
|
|
10
|
+
children: l,
|
|
11
|
+
className: m = "",
|
|
12
|
+
...v
|
|
9
13
|
}) {
|
|
10
|
-
const
|
|
14
|
+
const { mounted: u, visible: f } = j(e ?? !0), i = e !== void 0, s = c(u), p = c(r);
|
|
15
|
+
if (p.current = r, _(() => {
|
|
16
|
+
var a;
|
|
17
|
+
s.current && !u && i && ((a = p.current) == null || a.call(p)), s.current = u;
|
|
18
|
+
}, [u, i]), i && !u) return null;
|
|
19
|
+
const d = [
|
|
11
20
|
n["popover-menu"],
|
|
12
21
|
o === "child" ? n["popover-menu--child"] : n["popover-menu--parent"],
|
|
13
|
-
|
|
22
|
+
i && n["popover-menu--transition"],
|
|
23
|
+
i && f && n["popover-menu--visible"],
|
|
24
|
+
m
|
|
14
25
|
].filter(Boolean).join(" ");
|
|
15
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ t("div", { className: d, ...v, children: l });
|
|
16
27
|
}
|
|
17
|
-
function
|
|
28
|
+
function g({
|
|
18
29
|
maxHeight: o,
|
|
19
30
|
children: e,
|
|
20
31
|
className: r = ""
|
|
21
32
|
}) {
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
33
|
+
const l = typeof o == "number" ? `${o}px` : o;
|
|
34
|
+
return /* @__PURE__ */ t(
|
|
35
|
+
M,
|
|
25
36
|
{
|
|
26
37
|
className: [n["popover-menu__scroll"], r].filter(Boolean).join(" "),
|
|
27
|
-
style: { maxHeight:
|
|
38
|
+
style: { maxHeight: l },
|
|
28
39
|
children: e
|
|
29
40
|
}
|
|
30
41
|
);
|
|
31
42
|
}
|
|
32
|
-
function
|
|
43
|
+
function G({
|
|
33
44
|
children: o,
|
|
34
45
|
className: e = "",
|
|
35
46
|
...r
|
|
36
47
|
}) {
|
|
37
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ t(
|
|
38
49
|
"p",
|
|
39
50
|
{
|
|
40
51
|
className: [n["popover-menu__title"], e].filter(Boolean).join(" "),
|
|
@@ -43,12 +54,12 @@ function v({
|
|
|
43
54
|
}
|
|
44
55
|
);
|
|
45
56
|
}
|
|
46
|
-
function
|
|
57
|
+
function S({
|
|
47
58
|
children: o,
|
|
48
59
|
className: e = "",
|
|
49
60
|
...r
|
|
50
61
|
}) {
|
|
51
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ t(
|
|
52
63
|
"div",
|
|
53
64
|
{
|
|
54
65
|
role: "group",
|
|
@@ -58,12 +69,12 @@ function f({
|
|
|
58
69
|
}
|
|
59
70
|
);
|
|
60
71
|
}
|
|
61
|
-
function
|
|
72
|
+
function h({
|
|
62
73
|
children: o,
|
|
63
74
|
className: e = "",
|
|
64
75
|
...r
|
|
65
76
|
}) {
|
|
66
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ t(
|
|
67
78
|
"p",
|
|
68
79
|
{
|
|
69
80
|
className: [n["popover-menu__group-title"], e].filter(Boolean).join(" "),
|
|
@@ -72,11 +83,11 @@ function _({
|
|
|
72
83
|
}
|
|
73
84
|
);
|
|
74
85
|
}
|
|
75
|
-
function
|
|
86
|
+
function w({
|
|
76
87
|
className: o = "",
|
|
77
88
|
...e
|
|
78
89
|
}) {
|
|
79
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ t(
|
|
80
91
|
"div",
|
|
81
92
|
{
|
|
82
93
|
className: [n["popover-menu__divider"], o].filter(Boolean).join(" "),
|
|
@@ -86,11 +97,11 @@ function d({
|
|
|
86
97
|
);
|
|
87
98
|
}
|
|
88
99
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
w as PopoverMenuDivider,
|
|
101
|
+
S as PopoverMenuGroup,
|
|
102
|
+
h as PopoverMenuGroupTitle,
|
|
103
|
+
g as PopoverMenuScroll,
|
|
104
|
+
G as PopoverMenuTitle,
|
|
105
|
+
T as default
|
|
95
106
|
};
|
|
96
107
|
//# sourceMappingURL=PopoverMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverMenu.js","sources":["../../../src/components/popover-menu/PopoverMenu.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport Scrollbar from '@/components/scrollbar/Scrollbar';\nimport styles from './PopoverMenu.module.scss';\n\nexport interface PopoverMenuProps extends HTMLAttributes<HTMLDivElement> {\n /** Parent menus use Elevation 4; nested child menus use Elevation 5. */\n variant?: 'parent' | 'child';\n children: ReactNode;\n}\n\n/**\n * Surface container for popover-style menus — border, fill, elevation, and width\n * constraints per Compass. Compose with {@link MenuItem} rows and optional\n * titles, group labels, and dividers. Use {@link PopoverMenuScroll} when the item\n * list should scroll while a {@link PopoverMenuTitle} stays pinned.\n */\nexport default function PopoverMenu({\n variant = 'parent',\n children,\n className = '',\n ...rest\n}: PopoverMenuProps) {\n const rootClass = [\n styles['popover-menu'],\n variant === 'child'\n ? styles['popover-menu--child']\n : styles['popover-menu--parent'],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass} {...rest}>\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuScrollProps {\n children: ReactNode;\n /** Maximum height of the scrollable region (coerces numbers to px). */\n maxHeight: string | number;\n className?: string;\n}\n\n/** Scrollable region for long item lists; keeps a sibling title visible when used with `maxHeight`. */\nexport function PopoverMenuScroll({\n maxHeight,\n children,\n className = '',\n}: PopoverMenuScrollProps) {\n const maxH = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n return (\n <Scrollbar\n className={[styles['popover-menu__scroll'], className]\n .filter(Boolean)\n .join(' ')}\n style={{ maxHeight: maxH }}\n >\n {children}\n </Scrollbar>\n );\n}\n\nexport interface PopoverMenuTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional heading above menu items; keep pinned outside a scrolling body when using `maxHeight` on `PopoverMenu`. */\nexport function PopoverMenuTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuTitleProps) {\n return (\n <p\n className={[styles['popover-menu__title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport interface PopoverMenuGroupProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Accessible label when the group has no visible `PopoverMenuGroupTitle`. */\n 'aria-label'?: string;\n}\n\n/** Groups related menu items. */\nexport function PopoverMenuGroup({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupProps) {\n return (\n <div\n role=\"group\"\n className={[styles['popover-menu__group'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuGroupTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional label for a `PopoverMenuGroup`. */\nexport function PopoverMenuGroupTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupTitleProps) {\n return (\n <p\n className={[styles['popover-menu__group-title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport type PopoverMenuDividerProps = HTMLAttributes<HTMLDivElement>;\n\n/** Horizontal rule between groups or below a menu title. */\nexport function PopoverMenuDivider({\n className = '',\n ...rest\n}: PopoverMenuDividerProps) {\n return (\n <div\n className={[styles['popover-menu__divider'], className]\n .filter(Boolean)\n .join(' ')}\n role=\"separator\"\n {...rest}\n />\n );\n}\n"],"names":["PopoverMenu","variant","children","className","rest","rootClass","styles","PopoverMenuScroll","maxHeight","maxH","jsx","Scrollbar","PopoverMenuTitle","PopoverMenuGroup","PopoverMenuGroupTitle","PopoverMenuDivider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PopoverMenu.js","sources":["../../../src/components/popover-menu/PopoverMenu.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { usePopoverTransition } from '@/hooks/use-popover-transition';\nimport Scrollbar from '@/components/scrollbar/Scrollbar';\nimport styles from './PopoverMenu.module.scss';\n\nexport interface PopoverMenuProps extends HTMLAttributes<HTMLDivElement> {\n /** Parent menus use Elevation 4; nested child menus use Elevation 5. */\n variant?: 'parent' | 'child';\n /**\n * Controlled visibility with the Compass popover transition (scale + fade in,\n * reverse on close); the menu unmounts after the exit. Omit to always render\n * without transition. The host owns the state and positioning.\n */\n open?: boolean;\n /** Called after the exit transition finishes and the menu unmounts (only when `open` is controlled). */\n onExited?: () => void;\n children: ReactNode;\n}\n\n/**\n * Surface container for popover-style menus — border, fill, elevation, and width\n * constraints per Compass. Compose with {@link MenuItem} rows and optional\n * titles, group labels, and dividers. Use {@link PopoverMenuScroll} when the item\n * list should scroll while a {@link PopoverMenuTitle} stays pinned.\n */\nexport default function PopoverMenu({\n variant = 'parent',\n open,\n onExited,\n children,\n className = '',\n ...rest\n}: PopoverMenuProps) {\n const { mounted, visible } = usePopoverTransition(open ?? true);\n const transitioned = open !== undefined;\n const wasMounted = useRef(mounted);\n const onExitedRef = useRef(onExited);\n onExitedRef.current = onExited;\n\n useEffect(() => {\n if (wasMounted.current && !mounted && transitioned) {\n onExitedRef.current?.();\n }\n wasMounted.current = mounted;\n }, [mounted, transitioned]);\n\n if (transitioned && !mounted) return null;\n\n const rootClass = [\n styles['popover-menu'],\n variant === 'child'\n ? styles['popover-menu--child']\n : styles['popover-menu--parent'],\n transitioned && styles['popover-menu--transition'],\n transitioned && visible && styles['popover-menu--visible'],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass} {...rest}>\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuScrollProps {\n children: ReactNode;\n /** Maximum height of the scrollable region (coerces numbers to px). */\n maxHeight: string | number;\n className?: string;\n}\n\n/** Scrollable region for long item lists; keeps a sibling title visible when used with `maxHeight`. */\nexport function PopoverMenuScroll({\n maxHeight,\n children,\n className = '',\n}: PopoverMenuScrollProps) {\n const maxH = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;\n return (\n <Scrollbar\n className={[styles['popover-menu__scroll'], className]\n .filter(Boolean)\n .join(' ')}\n style={{ maxHeight: maxH }}\n >\n {children}\n </Scrollbar>\n );\n}\n\nexport interface PopoverMenuTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional heading above menu items; keep pinned outside a scrolling body when using `maxHeight` on `PopoverMenu`. */\nexport function PopoverMenuTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuTitleProps) {\n return (\n <p\n className={[styles['popover-menu__title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport interface PopoverMenuGroupProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n /** Accessible label when the group has no visible `PopoverMenuGroupTitle`. */\n 'aria-label'?: string;\n}\n\n/** Groups related menu items. */\nexport function PopoverMenuGroup({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupProps) {\n return (\n <div\n role=\"group\"\n className={[styles['popover-menu__group'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </div>\n );\n}\n\nexport interface PopoverMenuGroupTitleProps extends HTMLAttributes<HTMLParagraphElement> {\n children: ReactNode;\n}\n\n/** Optional label for a `PopoverMenuGroup`. */\nexport function PopoverMenuGroupTitle({\n children,\n className = '',\n ...rest\n}: PopoverMenuGroupTitleProps) {\n return (\n <p\n className={[styles['popover-menu__group-title'], className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {children}\n </p>\n );\n}\n\nexport type PopoverMenuDividerProps = HTMLAttributes<HTMLDivElement>;\n\n/** Horizontal rule between groups or below a menu title. */\nexport function PopoverMenuDivider({\n className = '',\n ...rest\n}: PopoverMenuDividerProps) {\n return (\n <div\n className={[styles['popover-menu__divider'], className]\n .filter(Boolean)\n .join(' ')}\n role=\"separator\"\n {...rest}\n />\n );\n}\n"],"names":["PopoverMenu","variant","open","onExited","children","className","rest","mounted","visible","usePopoverTransition","transitioned","wasMounted","useRef","onExitedRef","useEffect","_a","rootClass","styles","PopoverMenuScroll","maxHeight","maxH","jsx","Scrollbar","PopoverMenuTitle","PopoverMenuGroup","PopoverMenuGroupTitle","PopoverMenuDivider"],"mappings":";;;;;AA0BA,SAAwBA,EAAY;AAAA,EAClC,SAAAC,IAAU;AAAA,EACV,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAAqB;AACnB,QAAM,EAAE,SAAAC,GAAS,SAAAC,EAAA,IAAYC,EAAqBP,KAAQ,EAAI,GACxDQ,IAAeR,MAAS,QACxBS,IAAaC,EAAOL,CAAO,GAC3BM,IAAcD,EAAOT,CAAQ;AAUnC,MATAU,EAAY,UAAUV,GAEtBW,EAAU,MAAM;;AACd,IAAIH,EAAW,WAAW,CAACJ,KAAWG,OACpCK,IAAAF,EAAY,YAAZ,QAAAE,EAAA,KAAAF,KAEFF,EAAW,UAAUJ;AAAA,EACvB,GAAG,CAACA,GAASG,CAAY,CAAC,GAEtBA,KAAgB,CAACH,EAAS,QAAO;AAErC,QAAMS,IAAY;AAAA,IAChBC,EAAO,cAAc;AAAA,IACrBhB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;AAGP;AAOO,SAASqB,EAAsB;AAAA,EACpC,UAAArB;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GAA+B;AAC7B,SACE,gBAAAe;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,CAACJ,EAAO,2BAA2B,GAAGZ,CAAS,EACvD,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,MACV,GAAGC;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGP;AAKO,SAASsB,EAAmB;AAAA,EACjC,WAAArB,IAAY;AAAA,EACZ,GAAGC;AACL,GAA4B;AAC1B,SACE,gBAAAe;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,CAACJ,EAAO,uBAAuB,GAAGZ,CAAS,EACnD,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,MACX,MAAK;AAAA,MACJ,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./PopoverMenu.css');const e={"popover-menu":"_popover-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./PopoverMenu.css');const e={"popover-menu":"_popover-menu_1tx2s_2","popover-menu--parent":"_popover-menu--parent_1tx2s_16","popover-menu--child":"_popover-menu--child_1tx2s_19","popover-menu--transition":"_popover-menu--transition_1tx2s_22","popover-menu--visible":"_popover-menu--visible_1tx2s_35","popover-menu__scroll":"_popover-menu__scroll_1tx2s_47","popover-menu__title":"_popover-menu__title_1tx2s_50","popover-menu__group":"_popover-menu__group_1tx2s_61","popover-menu__group-title":"_popover-menu__group-title_1tx2s_66","popover-menu__divider":"_popover-menu__divider_1tx2s_78"};exports.default=e;
|
|
2
2
|
//# sourceMappingURL=PopoverMenu.module.scss.cjs.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import './PopoverMenu.css';const
|
|
2
|
-
"popover-menu": "_popover-
|
|
3
|
-
"popover-menu--parent": "_popover-menu--
|
|
4
|
-
"popover-menu--child": "_popover-menu--
|
|
5
|
-
"popover-
|
|
6
|
-
"popover-
|
|
7
|
-
"popover-
|
|
8
|
-
"popover-
|
|
9
|
-
"popover-
|
|
1
|
+
import './PopoverMenu.css';const e = {
|
|
2
|
+
"popover-menu": "_popover-menu_1tx2s_2",
|
|
3
|
+
"popover-menu--parent": "_popover-menu--parent_1tx2s_16",
|
|
4
|
+
"popover-menu--child": "_popover-menu--child_1tx2s_19",
|
|
5
|
+
"popover-menu--transition": "_popover-menu--transition_1tx2s_22",
|
|
6
|
+
"popover-menu--visible": "_popover-menu--visible_1tx2s_35",
|
|
7
|
+
"popover-menu__scroll": "_popover-menu__scroll_1tx2s_47",
|
|
8
|
+
"popover-menu__title": "_popover-menu__title_1tx2s_50",
|
|
9
|
+
"popover-menu__group": "_popover-menu__group_1tx2s_61",
|
|
10
|
+
"popover-menu__group-title": "_popover-menu__group-title_1tx2s_66",
|
|
11
|
+
"popover-menu__divider": "_popover-menu__divider_1tx2s_78"
|
|
10
12
|
};
|
|
11
13
|
export {
|
|
12
|
-
|
|
14
|
+
e as default
|
|
13
15
|
};
|
|
14
16
|
//# sourceMappingURL=PopoverMenu.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverMenu.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PopoverMenu.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._radio_1hdqa_2{position:relative;display:flex;align-items:flex-start;width:100%;gap:var(--spacing-xs);font-family:var(--font-family-body);font-weight:var(--font-weight-regular);color:var(--center-channel-color);cursor:pointer;-webkit-user-select:none;user-select:none}._radio_1hdqa_2:has(._radio__input_1hdqa_14:disabled){cursor:not-allowed;color:rgba(var(--center-channel-color-rgb),.56)}._radio__input_1hdqa_14{position:absolute;left:0;top:0;margin:0;padding:0;opacity:0;overflow:hidden;white-space:nowrap;border:0;cursor:inherit}._radio__input_1hdqa_14:focus-visible{outline:none}._radio__circle_1hdqa_33{position:relative;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;background-color:var(--center-channel-bg);border:1px solid rgba(var(--center-channel-color-rgb),.24);border-radius:var(--radius-pill);transition:background-color var(--duration-quick) var(--ease-transition),border-color var(--duration-quick) var(--ease-transition),border-width var(--duration-quick) var(--ease-transition),box-shadow var(--duration-quick) var(--ease-transition)}._radio__input_1hdqa_14:focus-visible~._radio__circle_1hdqa_33{box-shadow:0 0 0 2px rgba(var(--button-bg-rgb),.56)}._radio_1hdqa_2:has(._radio__input_1hdqa_14:not(:disabled)):hover ._radio__circle_1hdqa_33{border-color:rgba(var(--center-channel-color-rgb),.32)}._radio__input_1hdqa_14:disabled~._radio__circle_1hdqa_33{border-color:rgba(var(--center-channel-color-rgb),.16)}._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33{background-color:var(--center-channel-bg);border-width:1px;border-color:var(--button-bg)}._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33 ._radio__dot_1hdqa_59{background-color:var(--button-bg)}._radio_1hdqa_2:has(._radio__input_1hdqa_14:not(:disabled)):hover ._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33{border-color:var(--button-bg)}._radio_1hdqa_2:has(._radio__input_1hdqa_14:not(:disabled)):hover ._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33 ._radio__dot_1hdqa_59{background-color:var(--button-bg)}._radio__input_1hdqa_14:focus-visible:checked~._radio__circle_1hdqa_33{border-color:var(--button-bg);box-shadow:0 0 0 2px rgba(var(--button-bg-rgb),.56)}._radio__input_1hdqa_14:disabled:checked~._radio__circle_1hdqa_33{background-color:var(--center-channel-bg);border-color:rgba(var(--center-channel-color-rgb),.32);border-width:1px}._radio__input_1hdqa_14:disabled:checked~._radio__circle_1hdqa_33 ._radio__dot_1hdqa_59{background-color:rgba(var(--center-channel-color-rgb),.32)}._radio--invalid_1hdqa_80 ._radio__circle_1hdqa_33{border-color:var(--error-text, var(--color-danger))}._radio_1hdqa_2:has(._radio__input_1hdqa_14:not(:disabled)):hover._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:not(:checked)~._radio__circle_1hdqa_33{border-color:var(--error-text, var(--color-danger))}._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33{background-color:var(--center-channel-bg);border-width:1px;border-color:var(--error-text, var(--color-danger))}._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33 ._radio__dot_1hdqa_59{background-color:var(--error-text, var(--color-danger))}._radio_1hdqa_2:has(._radio__input_1hdqa_14:not(:disabled)):hover._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33{border-color:var(--error-text, var(--color-danger))}._radio_1hdqa_2:has(._radio__input_1hdqa_14:not(:disabled)):hover._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33 ._radio__dot_1hdqa_59{background-color:var(--error-text, var(--color-danger))}._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:focus-visible~._radio__circle_1hdqa_33{box-shadow:0 0 0 2px rgba(var(--error-text-color-rgb, var(--color-danger-rgb)),.56)}._radio--invalid_1hdqa_80 ._radio__input_1hdqa_14:focus-visible:checked~._radio__circle_1hdqa_33{box-shadow:0 0 0 2px rgba(var(--error-text-color-rgb, var(--color-danger-rgb)),.56)}._radio__dot_1hdqa_59{display:block;border-radius:var(--radius-pill);pointer-events:none;transform:scale(.5);transition:transform var(--duration-quick) var(--ease-entrance)}._radio__input_1hdqa_14:checked~._radio__circle_1hdqa_33 ._radio__dot_1hdqa_59{transform:scale(1)}._radio__label_1hdqa_116{line-height:1}._radio--size-small_1hdqa_119{gap:var(--spacing-xs)}._radio--size-small_1hdqa_119 ._radio__input_1hdqa_14,._radio--size-small_1hdqa_119 ._radio__circle_1hdqa_33{width:var(--icon-size-12);height:var(--icon-size-12);margin-top:calc((var(--line-height-75) - var(--icon-size-12)) / 2)}._radio--size-small_1hdqa_119 ._radio__dot_1hdqa_59{width:6px;height:6px}._radio--size-small_1hdqa_119 ._radio__label_1hdqa_116{font-size:var(--font-size-75);line-height:var(--line-height-75)}._radio--size-medium_1hdqa_140{gap:var(--spacing-xs)}._radio--size-medium_1hdqa_140 ._radio__input_1hdqa_14,._radio--size-medium_1hdqa_140 ._radio__circle_1hdqa_33{width:var(--icon-size-16);height:var(--icon-size-16);margin-top:calc((var(--line-height-100) - var(--icon-size-16)) / 2)}._radio--size-medium_1hdqa_140 ._radio__dot_1hdqa_59{width:8px;height:8px}._radio--size-medium_1hdqa_140 ._radio__label_1hdqa_116{font-size:var(--font-size-100);line-height:var(--line-height-100)}._radio--size-large_1hdqa_161{gap:var(--spacing-s)}._radio--size-large_1hdqa_161 ._radio__input_1hdqa_14,._radio--size-large_1hdqa_161 ._radio__circle_1hdqa_33{width:var(--icon-size-20);height:var(--icon-size-20);margin-top:calc((var(--line-height-200) - var(--icon-size-20)) / 2)}._radio--size-large_1hdqa_161 ._radio__dot_1hdqa_59{width:10px;height:10px}._radio--size-large_1hdqa_161 ._radio__label_1hdqa_116{font-size:var(--font-size-200);line-height:var(--line-height-200)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./Radio.css');const _="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./Radio.css');const _="_radio_1hdqa_2",i="_radio__input_1hdqa_14",a="_radio__circle_1hdqa_33",d="_radio__dot_1hdqa_59",o="_radio__label_1hdqa_116",r={radio:_,radio__input:i,radio__circle:a,radio__dot:d,"radio--invalid":"_radio--invalid_1hdqa_80",radio__label:o,"radio--size-small":"_radio--size-small_1hdqa_119","radio--size-medium":"_radio--size-medium_1hdqa_140","radio--size-large":"_radio--size-large_1hdqa_161"};exports.default=r;exports.radio=_;exports.radio__circle=a;exports.radio__dot=d;exports.radio__input=i;exports.radio__label=o;
|
|
2
2
|
//# sourceMappingURL=Radio.module.scss.cjs.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import './Radio.css';const _ = "
|
|
1
|
+
import './Radio.css';const _ = "_radio_1hdqa_2", a = "_radio__input_1hdqa_14", i = "_radio__circle_1hdqa_33", d = "_radio__dot_1hdqa_59", o = "_radio__label_1hdqa_116", r = {
|
|
2
2
|
radio: _,
|
|
3
|
-
radio__input:
|
|
4
|
-
radio__circle:
|
|
5
|
-
radio__dot:
|
|
6
|
-
"radio--invalid": "_radio--
|
|
7
|
-
radio__label:
|
|
8
|
-
"radio--size-small": "_radio--size-
|
|
9
|
-
"radio--size-medium": "_radio--size-
|
|
10
|
-
"radio--size-large": "_radio--size-
|
|
3
|
+
radio__input: a,
|
|
4
|
+
radio__circle: i,
|
|
5
|
+
radio__dot: d,
|
|
6
|
+
"radio--invalid": "_radio--invalid_1hdqa_80",
|
|
7
|
+
radio__label: o,
|
|
8
|
+
"radio--size-small": "_radio--size-small_1hdqa_119",
|
|
9
|
+
"radio--size-medium": "_radio--size-medium_1hdqa_140",
|
|
10
|
+
"radio--size-large": "_radio--size-large_1hdqa_161"
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
r as default,
|
|
14
14
|
_ as radio,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
i as radio__circle,
|
|
16
|
+
d as radio__dot,
|
|
17
|
+
a as radio__input,
|
|
18
|
+
o as radio__label
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=Radio.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._switch_3fpma_2{display:flex;align-items:flex-start;width:100%;gap:var(--spacing-m);font-family:var(--font-family-body);font-weight:var(--font-weight-regular);color:var(--center-channel-color);cursor:pointer;-webkit-user-select:none;user-select:none}._switch_3fpma_2:has(._switch__input_3fpma_13:disabled){cursor:not-allowed;color:rgba(var(--center-channel-color-rgb),.56)}._switch_3fpma_2:has(._switch__input_3fpma_13:disabled) ._switch__secondary-label_3fpma_17{color:rgba(var(--center-channel-color-rgb),.56)}._switch__input_3fpma_13{position:absolute;top:0;right:0;bottom:0;left:0;margin:0;padding:0;opacity:0;width:100%;height:100%;border:0;cursor:inherit}._switch__input_3fpma_13:focus-visible{outline:none}._switch__labels_3fpma_34{display:flex;flex-direction:column;flex:1 1 0;justify-content:center;min-width:0}._switch__label_3fpma_34{line-height:1}._switch__secondary-label_3fpma_17{color:rgba(var(--center-channel-color-rgb),.72);margin-top:var(--spacing-xxxxs)}._switch__track_3fpma_48{position:relative;flex-shrink:0;display:block;box-sizing:border-box;background-color:rgba(var(--center-channel-color-rgb),.32);border-radius:var(--radius-pill);transition:background-color var(--duration-quick) var(--ease-transition),box-shadow var(--duration-quick) var(--ease-transition)}._switch__track_3fpma_48:has(._switch__input_3fpma_13:focus-visible){box-shadow:0 0 0 2px rgba(var(--button-bg-rgb),.56)}._switch_3fpma_2:has(._switch__input_3fpma_13:not(:disabled)):hover ._switch__track_3fpma_48{background-color:rgba(var(--center-channel-color-rgb),.4)}._switch__track_3fpma_48:has(._switch__input_3fpma_13:checked){background-color:var(--button-bg)}._switch_3fpma_2:has(._switch__input_3fpma_13:not(:disabled)):hover ._switch__track_3fpma_48:has(._switch__input_3fpma_13:checked){background-color:var(--button-bg)}._switch__track_3fpma_48:has(._switch__input_3fpma_13:focus-visible:checked){box-shadow:0 0 0 2px rgba(var(--button-bg-rgb),.56)}._switch__track_3fpma_48:has(._switch__input_3fpma_13:disabled){opacity:.32}._switch__track_3fpma_48:has(._switch__input_3fpma_13:disabled:checked){background-color:rgba(var(--center-channel-color-rgb),.32)}._switch__knob_3fpma_78{position:absolute;left:2px;top:50%;transform:translateY(-50%) translate(0);border-radius:var(--radius-pill);background-color:var(--button-color);box-shadow:var(--elevation-1);transition:transform var(--duration-quick) var(--ease-transition);pointer-events:none}._switch--size-small_3fpma_89 ._switch__track_3fpma_48{width:26px;height:16px}._switch--size-small_3fpma_89 ._switch__track_3fpma_48:has(._switch__input_3fpma_13:checked) ._switch__knob_3fpma_78{transform:translateY(-50%) translate(10px)}._switch--size-small_3fpma_89 ._switch__knob_3fpma_78{width:12px;height:12px}._switch--size-small_3fpma_89 ._switch__label_3fpma_34,._switch--size-small_3fpma_89 ._switch__secondary-label_3fpma_17{font-size:var(--font-size-75);line-height:var(--line-height-75)}._switch--size-medium_3fpma_108 ._switch__track_3fpma_48{width:32px;height:20px}._switch--size-medium_3fpma_108 ._switch__track_3fpma_48:has(._switch__input_3fpma_13:checked) ._switch__knob_3fpma_78{transform:translateY(-50%) translate(12px)}._switch--size-medium_3fpma_108 ._switch__knob_3fpma_78{width:16px;height:16px}._switch--size-medium_3fpma_108 ._switch__label_3fpma_34{font-size:var(--font-size-100);line-height:var(--line-height-100)}._switch--size-medium_3fpma_108 ._switch__secondary-label_3fpma_17{font-size:var(--font-size-75);line-height:var(--line-height-75)}._switch--size-large_3fpma_127 ._switch__track_3fpma_48{width:40px;height:24px}._switch--size-large_3fpma_127 ._switch__track_3fpma_48:has(._switch__input_3fpma_13:checked) ._switch__knob_3fpma_78{transform:translateY(-50%) translate(16px)}._switch--size-large_3fpma_127 ._switch__knob_3fpma_78{width:20px;height:20px}._switch--size-large_3fpma_127 ._switch__label_3fpma_34{font-size:var(--font-size-200);line-height:var(--line-height-200)}._switch--size-large_3fpma_127 ._switch__secondary-label_3fpma_17{font-size:var(--font-size-100);line-height:var(--line-height-100)}._switch--semi-bold_3fpma_146 ._switch__label_3fpma_34{font-weight:var(--font-weight-semibold)}._switch--with-secondary_3fpma_149{align-items:center}._switch--with-secondary_3fpma_149 ._switch__labels_3fpma_34{padding-top:0;padding-bottom:0}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./Switch.css');const _="
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./Switch.css');const _="_switch__input_3fpma_13",s="_switch__labels_3fpma_34",t="_switch__label_3fpma_34",i="_switch__track_3fpma_48",c="_switch__knob_3fpma_78",e={switch:"_switch_3fpma_2",switch__input:_,"switch__secondary-label":"_switch__secondary-label_3fpma_17",switch__labels:s,switch__label:t,switch__track:i,switch__knob:c,"switch--size-small":"_switch--size-small_3fpma_89","switch--size-medium":"_switch--size-medium_3fpma_108","switch--size-large":"_switch--size-large_3fpma_127","switch--semi-bold":"_switch--semi-bold_3fpma_146","switch--with-secondary":"_switch--with-secondary_3fpma_149"};exports.default=e;exports.switch__input=_;exports.switch__knob=c;exports.switch__label=t;exports.switch__labels=s;exports.switch__track=i;
|
|
2
2
|
//# sourceMappingURL=Switch.module.scss.cjs.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import './Switch.css';const _ = "
|
|
2
|
-
switch: "
|
|
1
|
+
import './Switch.css';const _ = "_switch__input_3fpma_13", s = "_switch__labels_3fpma_34", t = "_switch__label_3fpma_34", i = "_switch__track_3fpma_48", c = "_switch__knob_3fpma_78", a = {
|
|
2
|
+
switch: "_switch_3fpma_2",
|
|
3
3
|
switch__input: _,
|
|
4
|
-
"switch__secondary-label": "_switch__secondary-
|
|
4
|
+
"switch__secondary-label": "_switch__secondary-label_3fpma_17",
|
|
5
5
|
switch__labels: s,
|
|
6
6
|
switch__label: t,
|
|
7
7
|
switch__track: i,
|
|
8
|
-
switch__knob:
|
|
9
|
-
"switch--size-small": "_switch--size-
|
|
10
|
-
"switch--size-medium": "_switch--size-
|
|
11
|
-
"switch--size-large": "_switch--size-
|
|
12
|
-
"switch--semi-bold": "_switch--semi-
|
|
13
|
-
"switch--with-secondary": "_switch--with-
|
|
8
|
+
switch__knob: c,
|
|
9
|
+
"switch--size-small": "_switch--size-small_3fpma_89",
|
|
10
|
+
"switch--size-medium": "_switch--size-medium_3fpma_108",
|
|
11
|
+
"switch--size-large": "_switch--size-large_3fpma_127",
|
|
12
|
+
"switch--semi-bold": "_switch--semi-bold_3fpma_146",
|
|
13
|
+
"switch--with-secondary": "_switch--with-secondary_3fpma_149"
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
a as default,
|
|
17
17
|
_ as switch__input,
|
|
18
|
-
|
|
18
|
+
c as switch__knob,
|
|
19
19
|
t as switch__label,
|
|
20
20
|
s as switch__labels,
|
|
21
21
|
i as switch__track
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),i=require("react"),t=require("./Tabs.module.scss.cjs");function
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),i=require("react"),q=require("../../utils/string.cjs"),t=require("./Tabs.module.scss.cjs");function E({tabs:c,activeKey:o,onChange:b,className:g="",controls:_,unreadLabel:D="Unread",appearance:p="default",...h}){const N=[t.default.tabs,p!=="default"?t.default[`tabs--appearance-${q.toKebab(p)}`]:"",g].filter(Boolean).join(" "),m=i.useRef([]),[y,f]=i.useState(o);i.useEffect(()=>{f(o)},[o]);const B=c.map(e=>e.key),l=c.filter(e=>!e.disabled).map(e=>e.key),w=l.includes(y)?y:l.includes(o)?o:l[0],r=e=>{var s;f(e);const u=B.indexOf(e);(s=m.current[u])==null||s.focus()},P=(e,u)=>{const s=l.length;if(s===0)return;const a=l.indexOf(u);e.key==="ArrowRight"?(e.preventDefault(),r(l[(a+1)%s])):e.key==="ArrowLeft"?(e.preventDefault(),r(l[a<0?s-1:(a-1+s)%s])):e.key==="Home"?(e.preventDefault(),r(l[0])):e.key==="End"?(e.preventDefault(),r(l[s-1])):(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a>=0&&b(u))};return n.jsxs("div",{...h,className:N,children:[n.jsx("div",{className:t.default["tabs__tab-list"],role:"tablist",children:c.map((e,u)=>{var k,x,j;const s=e.key===o,a=e.disabled===!0,R=[t.default.tabs__tab,s?t.default["tabs__tab--active"]:"",a?t.default["tabs__tab--disabled"]:"",(k=e.buttonProps)==null?void 0:k.className].filter(Boolean).join(" ");return i.createElement("button",{...e.buttonProps,key:e.key,ref:d=>{m.current[u]=d},id:e.id??((x=e.buttonProps)==null?void 0:x.id),role:"tab",type:"button",tabIndex:w===e.key?0:-1,"aria-selected":s,"aria-controls":e.panelId,"aria-disabled":a||void 0,title:e.title??((j=e.buttonProps)==null?void 0:j.title),className:R,onMouseDown:a?d=>d.preventDefault():void 0,onClick:()=>{a||(f(e.key),b(e.key))},onKeyDown:d=>P(d,e.key)},n.jsx("span",{className:t.default["tabs__tab-label"],children:e.label}),e.countBadge!=null&&n.jsx("span",{className:[t.default["tabs__count-badge"],s?t.default["tabs__count-badge--active"]:""].filter(Boolean).join(" "),children:e.countBadge}),e.unreadBadge&&!s&&n.jsx("span",{className:t.default["tabs__unread-badge"],children:n.jsx("span",{className:t.default["tabs__unread-label"],children:D})}))})}),_!=null&&n.jsx("div",{className:t.default.tabs__controls,children:_})]})}exports.default=E;
|
|
2
2
|
//# sourceMappingURL=Tabs.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.cjs","sources":["../../../src/components/tabs/Tabs.tsx"],"sourcesContent":["import {\n useEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport type { BuiltInButtonProps } from '@/utils/props';\nimport styles from './Tabs.module.scss';\n\nexport interface TabItem {\n /** Unique key for this tab. */\n key: string;\n /** Tab label. Accepts translated nodes (e.g. `<FormattedMessage/>`). */\n label: ReactNode;\n /** Optional count badge number. */\n countBadge?: number;\n /** When true, shows an unread dot badge. */\n unreadBadge?: boolean;\n /** Optional id for this tab (pair with `panelId` for `aria-controls`). */\n id?: string;\n /** Optional id of the host tabpanel this tab controls. */\n panelId?: string;\n /** When true, the tab can't be selected and arrow-key navigation skips it. */\n disabled?: boolean;\n /** Native tooltip text, e.g. to explain why the tab is disabled. */\n title?: string;\n /**\n * Extra attributes for this tab's `<button>` (e.g. `data-testid`). Tab\n * semantics (`role`, `aria-selected`, `tabIndex`, handlers) take precedence.\n */\n buttonProps?: BuiltInButtonProps;\n}\n\nexport interface TabsProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange'\n> {\n /** Array of tab items to display. */\n tabs: TabItem[];\n /** Key of the currently active tab. */\n activeKey: string;\n /** Called when a tab is selected. */\n onChange: (key: string) => void;\n /** Optional CSS class name. */\n className?: string;\n /** Optional trailing controls rendered to the right of the tabs. */\n controls?: ReactNode;\n /** Visually hidden text announced with a tab's unread dot. Default: \"Unread\". */\n unreadLabel?: ReactNode;\n}\n\n/**\n * Tabs let people switch between sibling views inside the same surface — Mentions in the\n * right sidebar, sections of a settings panel, or filters on a list. The content area\n * changes; the surrounding chrome doesn't.\n */\nexport default function Tabs({\n tabs,\n activeKey,\n onChange,\n className = '',\n controls,\n unreadLabel = 'Unread',\n ...rest\n}: TabsProps) {\n const rootClass = [styles.tabs
|
|
1
|
+
{"version":3,"file":"Tabs.cjs","sources":["../../../src/components/tabs/Tabs.tsx"],"sourcesContent":["import {\n useEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport type { BuiltInButtonProps } from '@/utils/props';\nimport { toKebab } from '@/utils/string';\nimport styles from './Tabs.module.scss';\n\nexport type TabsAppearance = 'default' | 'underlined';\n\nexport interface TabItem {\n /** Unique key for this tab. */\n key: string;\n /** Tab label. Accepts translated nodes (e.g. `<FormattedMessage/>`). */\n label: ReactNode;\n /** Optional count badge number. */\n countBadge?: number;\n /** When true, shows an unread dot badge. */\n unreadBadge?: boolean;\n /** Optional id for this tab (pair with `panelId` for `aria-controls`). */\n id?: string;\n /** Optional id of the host tabpanel this tab controls. */\n panelId?: string;\n /** When true, the tab can't be selected and arrow-key navigation skips it. */\n disabled?: boolean;\n /** Native tooltip text, e.g. to explain why the tab is disabled. */\n title?: string;\n /**\n * Extra attributes for this tab's `<button>` (e.g. `data-testid`). Tab\n * semantics (`role`, `aria-selected`, `tabIndex`, handlers) take precedence.\n */\n buttonProps?: BuiltInButtonProps;\n}\n\nexport interface TabsProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange'\n> {\n /** Array of tab items to display. */\n tabs: TabItem[];\n /** Key of the currently active tab. */\n activeKey: string;\n /** Called when a tab is selected. */\n onChange: (key: string) => void;\n /** Optional CSS class name. */\n className?: string;\n /** Optional trailing controls rendered to the right of the tabs. */\n controls?: ReactNode;\n /** Visual style. `underlined` shows a bottom rule with an indicator under the active tab. Default: `default`. */\n appearance?: TabsAppearance;\n /** Visually hidden text announced with a tab's unread dot. Default: \"Unread\". */\n unreadLabel?: ReactNode;\n}\n\n/**\n * Tabs let people switch between sibling views inside the same surface — Mentions in the\n * right sidebar, sections of a settings panel, or filters on a list. The content area\n * changes; the surrounding chrome doesn't.\n */\nexport default function Tabs({\n tabs,\n activeKey,\n onChange,\n className = '',\n controls,\n unreadLabel = 'Unread',\n appearance = 'default',\n ...rest\n}: TabsProps) {\n const rootClass = [\n styles.tabs,\n appearance !== 'default'\n ? styles[`tabs--appearance-${toKebab(appearance)}`]\n : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n const tabRefs = useRef<Array<HTMLButtonElement | null>>([]);\n const [focusedKey, setFocusedKey] = useState(activeKey);\n\n useEffect(() => {\n setFocusedKey(activeKey);\n }, [activeKey]);\n\n const keys = tabs.map((tab) => tab.key);\n const enabledKeys = tabs.filter((tab) => !tab.disabled).map((tab) => tab.key);\n const focusKey = enabledKeys.includes(focusedKey)\n ? focusedKey\n : enabledKeys.includes(activeKey)\n ? activeKey\n : enabledKeys[0];\n\n const moveFocus = (key: string) => {\n setFocusedKey(key);\n const index = keys.indexOf(key);\n tabRefs.current[index]?.focus();\n };\n\n const handleKeyDown = (\n event: KeyboardEvent<HTMLButtonElement>,\n key: string,\n ) => {\n const count = enabledKeys.length;\n if (count === 0) return;\n const index = enabledKeys.indexOf(key);\n\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n moveFocus(enabledKeys[(index + 1) % count]);\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault();\n moveFocus(\n enabledKeys[index < 0 ? count - 1 : (index - 1 + count) % count],\n );\n } else if (event.key === 'Home') {\n event.preventDefault();\n moveFocus(enabledKeys[0]);\n } else if (event.key === 'End') {\n event.preventDefault();\n moveFocus(enabledKeys[count - 1]);\n } else if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n if (index >= 0) onChange(key);\n }\n };\n\n return (\n <div {...rest} className={rootClass}>\n <div className={styles['tabs__tab-list']} role=\"tablist\">\n {tabs.map((tab, index) => {\n const isActive = tab.key === activeKey;\n const isDisabled = tab.disabled === true;\n const tabClass = [\n styles['tabs__tab'],\n isActive ? styles['tabs__tab--active'] : '',\n isDisabled ? styles['tabs__tab--disabled'] : '',\n tab.buttonProps?.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n {...tab.buttonProps}\n key={tab.key}\n ref={(node) => {\n tabRefs.current[index] = node;\n }}\n id={tab.id ?? tab.buttonProps?.id}\n role=\"tab\"\n type=\"button\"\n tabIndex={focusKey === tab.key ? 0 : -1}\n aria-selected={isActive}\n aria-controls={tab.panelId}\n aria-disabled={isDisabled || undefined}\n title={tab.title ?? tab.buttonProps?.title}\n className={tabClass}\n onMouseDown={\n isDisabled ? (event) => event.preventDefault() : undefined\n }\n onClick={() => {\n if (isDisabled) return;\n setFocusedKey(tab.key);\n onChange(tab.key);\n }}\n onKeyDown={(event) => handleKeyDown(event, tab.key)}\n >\n <span className={styles['tabs__tab-label']}>{tab.label}</span>\n\n {tab.countBadge != null && (\n <span\n className={[\n styles['tabs__count-badge'],\n isActive ? styles['tabs__count-badge--active'] : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {tab.countBadge}\n </span>\n )}\n\n {tab.unreadBadge && !isActive && (\n <span className={styles['tabs__unread-badge']}>\n <span className={styles['tabs__unread-label']}>\n {unreadLabel}\n </span>\n </span>\n )}\n </button>\n );\n })}\n </div>\n\n {controls != null && (\n <div className={styles['tabs__controls']}>{controls}</div>\n )}\n </div>\n );\n}\n"],"names":["Tabs","tabs","activeKey","onChange","className","controls","unreadLabel","appearance","rest","rootClass","styles","toKebab","tabRefs","useRef","focusedKey","setFocusedKey","useState","useEffect","keys","tab","enabledKeys","focusKey","moveFocus","key","index","_a","handleKeyDown","event","count","jsxs","jsx","isActive","isDisabled","tabClass","createElement","node","_b","_c"],"mappings":"4OA+DA,SAAwBA,EAAK,CAC3B,KAAAC,EACA,UAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EACA,YAAAC,EAAc,SACd,WAAAC,EAAa,UACb,GAAGC,CACL,EAAc,CACZ,MAAMC,EAAY,CAChBC,EAAAA,QAAO,KACPH,IAAe,UACXG,EAAAA,QAAO,oBAAoBC,EAAAA,QAAQJ,CAAU,CAAC,EAAE,EAChD,GACJH,CAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG,EACLQ,EAAUC,EAAAA,OAAwC,EAAE,EACpD,CAACC,EAAYC,CAAa,EAAIC,EAAAA,SAASd,CAAS,EAEtDe,EAAAA,UAAU,IAAM,CACdF,EAAcb,CAAS,CACzB,EAAG,CAACA,CAAS,CAAC,EAEd,MAAMgB,EAAOjB,EAAK,IAAKkB,GAAQA,EAAI,GAAG,EAChCC,EAAcnB,EAAK,OAAQkB,GAAQ,CAACA,EAAI,QAAQ,EAAE,IAAKA,GAAQA,EAAI,GAAG,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.
|
|
1
|
+
._tabs_69hbz_2{display:flex;align-items:center;justify-content:space-between}._tabs__tab-list_69hbz_7{display:flex;align-items:flex-start;gap:var(--spacing-xxs)}._tabs__tab_69hbz_7{position:relative;display:flex;flex-direction:row;align-items:center;gap:var(--spacing-xs);border-radius:var(--radius-s);background:transparent;border:none;cursor:pointer;padding:var(--spacing-xxs) var(--spacing-s);outline:2px solid color-mix(in srgb,var(--focus-ring-color) 0%,transparent);outline-offset:0;transition:background-color var(--duration-quick) var(--ease-transition),outline-color var(--duration-quick) var(--ease-transition),outline-offset var(--duration-quick) var(--ease-transition)}._tabs__tab_69hbz_7:focus-visible{outline-color:var(--focus-ring-color);outline-offset:3px}._tabs__tab_69hbz_7:hover:not(._tabs__tab--active_69hbz_31):not(._tabs__tab--disabled_69hbz_31){background-color:rgba(var(--center-channel-color-rgb),.08)}._tabs__tab--active_69hbz_31{background-color:rgba(var(--link-color-rgb),.08)}._tabs__tab--active_69hbz_31 ._tabs__tab-label_69hbz_37{color:var(--link-color)}._tabs__tab--active_69hbz_31 ._tabs__count-badge_69hbz_40{background-color:rgba(var(--link-color-rgb),.12);color:var(--link-color)}._tabs__tab--disabled_69hbz_31{cursor:not-allowed}._tabs__tab--disabled_69hbz_31 ._tabs__tab-label_69hbz_37,._tabs__tab--disabled_69hbz_31 ._tabs__count-badge_69hbz_40{color:rgba(var(--center-channel-color-rgb),.4)}._tabs__tab-label_69hbz_37{display:flex;align-items:center;font-size:var(--font-size-100);font-weight:var(--font-weight-semibold);line-height:var(--line-height-100);color:rgba(var(--center-channel-color-rgb),.64);white-space:nowrap;transition:color var(--duration-quick) var(--ease-transition)}._tabs__count-badge_69hbz_40{display:inline-flex;align-items:center;justify-content:center;padding:2.5px var(--spacing-xxs);border-radius:var(--radius-m);background-color:rgba(var(--center-channel-color-rgb),.08);font-size:var(--font-size-25);font-weight:var(--font-weight-semibold);line-height:11px;color:rgba(var(--center-channel-color-rgb),.64);flex-shrink:0;transition:background-color var(--duration-quick) var(--ease-transition),color var(--duration-quick) var(--ease-transition)}._tabs__count-badge--active_69hbz_75{background-color:rgba(var(--link-color-rgb),.12);color:var(--link-color)}._tabs__unread-badge_69hbz_79{flex-shrink:0;width:4px;height:4px;border-radius:var(--radius-pill);background-color:var(--button-bg)}._tabs__unread-label_69hbz_86{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}._tabs__controls_69hbz_97{display:flex;align-items:center;gap:var(--spacing-xxs);flex-shrink:0}._tabs--appearance-underlined_69hbz_103{align-items:stretch;box-shadow:inset 0 -1px rgba(var(--center-channel-color-rgb),.12)}._tabs--appearance-underlined_69hbz_103 ._tabs__tab-list_69hbz_7{gap:var(--spacing-xs)}._tabs--appearance-underlined_69hbz_103 ._tabs__tab_69hbz_7{border-radius:0;padding:var(--spacing-s) var(--spacing-xs)}._tabs--appearance-underlined_69hbz_103 ._tabs__tab_69hbz_7:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background-color:transparent;transition:background-color var(--duration-quick) var(--ease-transition)}._tabs--appearance-underlined_69hbz_103 ._tabs__tab_69hbz_7:hover:not(._tabs__tab--active_69hbz_31):not(._tabs__tab--disabled_69hbz_31){background-color:transparent}._tabs--appearance-underlined_69hbz_103 ._tabs__tab_69hbz_7:hover:not(._tabs__tab--active_69hbz_31):not(._tabs__tab--disabled_69hbz_31) ._tabs__tab-label_69hbz_37{color:var(--center-channel-color)}._tabs--appearance-underlined_69hbz_103 ._tabs__tab--active_69hbz_31{background-color:transparent}._tabs--appearance-underlined_69hbz_103 ._tabs__tab--active_69hbz_31:after{background-color:var(--link-color)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { BuiltInButtonProps } from '../../utils/props';
|
|
3
|
+
export type TabsAppearance = 'default' | 'underlined';
|
|
3
4
|
export interface TabItem {
|
|
4
5
|
/** Unique key for this tab. */
|
|
5
6
|
key: string;
|
|
@@ -34,6 +35,8 @@ export interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChang
|
|
|
34
35
|
className?: string;
|
|
35
36
|
/** Optional trailing controls rendered to the right of the tabs. */
|
|
36
37
|
controls?: ReactNode;
|
|
38
|
+
/** Visual style. `underlined` shows a bottom rule with an indicator under the active tab. Default: `default`. */
|
|
39
|
+
appearance?: TabsAppearance;
|
|
37
40
|
/** Visually hidden text announced with a tab's unread dot. Default: "Unread". */
|
|
38
41
|
unreadLabel?: ReactNode;
|
|
39
42
|
}
|
|
@@ -42,5 +45,5 @@ export interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChang
|
|
|
42
45
|
* right sidebar, sections of a settings panel, or filters on a list. The content area
|
|
43
46
|
* changes; the surrounding chrome doesn't.
|
|
44
47
|
*/
|
|
45
|
-
export default function Tabs({ tabs, activeKey, onChange, className, controls, unreadLabel, ...rest }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export default function Tabs({ tabs, activeKey, onChange, className, controls, unreadLabel, appearance, ...rest }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
46
49
|
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAIxD,MAAM,MAAM,cAAc,GAAG,SA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
+
import { jsxs as P, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as A, useState as R, useEffect as C, createElement as F } from "react";
|
|
3
|
+
import { toKebab as I } from "../../utils/string.js";
|
|
3
4
|
import t from "./Tabs.module.scss.js";
|
|
4
|
-
function
|
|
5
|
+
function M({
|
|
5
6
|
tabs: c,
|
|
6
|
-
activeKey:
|
|
7
|
+
activeKey: n,
|
|
7
8
|
onChange: f,
|
|
8
|
-
className:
|
|
9
|
-
controls:
|
|
10
|
-
unreadLabel:
|
|
11
|
-
|
|
9
|
+
className: h = "",
|
|
10
|
+
controls: b,
|
|
11
|
+
unreadLabel: N = "Unread",
|
|
12
|
+
appearance: p = "default",
|
|
13
|
+
...x
|
|
12
14
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const g = [
|
|
16
|
+
t.tabs,
|
|
17
|
+
p !== "default" ? t[`tabs--appearance-${I(p)}`] : "",
|
|
18
|
+
h
|
|
19
|
+
].filter(Boolean).join(" "), m = A([]), [_, u] = R(n);
|
|
20
|
+
C(() => {
|
|
21
|
+
u(n);
|
|
22
|
+
}, [n]);
|
|
23
|
+
const B = c.map((e) => e.key), o = c.filter((e) => !e.disabled).map((e) => e.key), j = o.includes(_) ? _ : o.includes(n) ? n : o[0], d = (e) => {
|
|
18
24
|
var s;
|
|
19
25
|
u(e);
|
|
20
|
-
const a =
|
|
21
|
-
(s =
|
|
22
|
-
},
|
|
23
|
-
const s =
|
|
26
|
+
const a = B.indexOf(e);
|
|
27
|
+
(s = m.current[a]) == null || s.focus();
|
|
28
|
+
}, w = (e, a) => {
|
|
29
|
+
const s = o.length;
|
|
24
30
|
if (s === 0) return;
|
|
25
|
-
const l =
|
|
26
|
-
e.key === "ArrowRight" ? (e.preventDefault(), d(
|
|
27
|
-
|
|
28
|
-
)) : e.key === "Home" ? (e.preventDefault(), d(
|
|
31
|
+
const l = o.indexOf(a);
|
|
32
|
+
e.key === "ArrowRight" ? (e.preventDefault(), d(o[(l + 1) % s])) : e.key === "ArrowLeft" ? (e.preventDefault(), d(
|
|
33
|
+
o[l < 0 ? s - 1 : (l - 1 + s) % s]
|
|
34
|
+
)) : e.key === "Home" ? (e.preventDefault(), d(o[0])) : e.key === "End" ? (e.preventDefault(), d(o[s - 1])) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l >= 0 && f(a));
|
|
29
35
|
};
|
|
30
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ P("div", { ...x, className: g, children: [
|
|
31
37
|
/* @__PURE__ */ r("div", { className: t["tabs__tab-list"], role: "tablist", children: c.map((e, a) => {
|
|
32
|
-
var
|
|
33
|
-
const s = e.key ===
|
|
38
|
+
var y, k, D;
|
|
39
|
+
const s = e.key === n, l = e.disabled === !0, E = [
|
|
34
40
|
t.tabs__tab,
|
|
35
41
|
s ? t["tabs__tab--active"] : "",
|
|
36
42
|
l ? t["tabs__tab--disabled"] : "",
|
|
37
|
-
(
|
|
43
|
+
(y = e.buttonProps) == null ? void 0 : y.className
|
|
38
44
|
].filter(Boolean).join(" ");
|
|
39
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ F(
|
|
40
46
|
"button",
|
|
41
47
|
{
|
|
42
48
|
...e.buttonProps,
|
|
43
49
|
key: e.key,
|
|
44
50
|
ref: (i) => {
|
|
45
|
-
|
|
51
|
+
m.current[a] = i;
|
|
46
52
|
},
|
|
47
|
-
id: e.id ?? ((
|
|
53
|
+
id: e.id ?? ((k = e.buttonProps) == null ? void 0 : k.id),
|
|
48
54
|
role: "tab",
|
|
49
55
|
type: "button",
|
|
50
|
-
tabIndex:
|
|
56
|
+
tabIndex: j === e.key ? 0 : -1,
|
|
51
57
|
"aria-selected": s,
|
|
52
58
|
"aria-controls": e.panelId,
|
|
53
59
|
"aria-disabled": l || void 0,
|
|
54
|
-
title: e.title ?? ((
|
|
55
|
-
className:
|
|
60
|
+
title: e.title ?? ((D = e.buttonProps) == null ? void 0 : D.title),
|
|
61
|
+
className: E,
|
|
56
62
|
onMouseDown: l ? (i) => i.preventDefault() : void 0,
|
|
57
63
|
onClick: () => {
|
|
58
64
|
l || (u(e.key), f(e.key));
|
|
59
65
|
},
|
|
60
|
-
onKeyDown: (i) =>
|
|
66
|
+
onKeyDown: (i) => w(i, e.key)
|
|
61
67
|
},
|
|
62
68
|
/* @__PURE__ */ r("span", { className: t["tabs__tab-label"], children: e.label }),
|
|
63
69
|
e.countBadge != null && /* @__PURE__ */ r(
|
|
@@ -70,13 +76,13 @@ function H({
|
|
|
70
76
|
children: e.countBadge
|
|
71
77
|
}
|
|
72
78
|
),
|
|
73
|
-
e.unreadBadge && !s && /* @__PURE__ */ r("span", { className: t["tabs__unread-badge"], children: /* @__PURE__ */ r("span", { className: t["tabs__unread-label"], children:
|
|
79
|
+
e.unreadBadge && !s && /* @__PURE__ */ r("span", { className: t["tabs__unread-badge"], children: /* @__PURE__ */ r("span", { className: t["tabs__unread-label"], children: N }) })
|
|
74
80
|
);
|
|
75
81
|
}) }),
|
|
76
|
-
|
|
82
|
+
b != null && /* @__PURE__ */ r("div", { className: t.tabs__controls, children: b })
|
|
77
83
|
] });
|
|
78
84
|
}
|
|
79
85
|
export {
|
|
80
|
-
|
|
86
|
+
M as default
|
|
81
87
|
};
|
|
82
88
|
//# sourceMappingURL=Tabs.js.map
|