@hashicorp/mds-react 0.9.12 → 0.9.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/components/accordion/item/index.js.map +1 -1
- package/components/accordion/style.module.scss +4 -4
- package/components/alert/alert.module.scss +2 -4
- package/components/alert/index.js.map +1 -1
- package/components/badge/index.js.map +1 -1
- package/components/badge/style.module.scss +1 -7
- package/components/badge-count/index.js.map +1 -1
- package/components/badge-count/style.module.scss +1 -6
- package/components/breadcrumbs/index.js.map +1 -1
- package/components/breadcrumbs/style.module.scss +2 -2
- package/components/button/button-primitive.js.map +1 -1
- package/components/button/styles.module.scss +9 -13
- package/components/card/index.js.map +1 -1
- package/components/code-block/code-block.module.scss +5 -11
- package/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -1
- package/components/code-block/hidden-copy-content/index.js.map +1 -1
- package/components/code-block/index.js.map +1 -1
- package/components/code-block/utils/parse-highlighted-lines.js.map +1 -1
- package/components/code-block/utils/shellwords.js.map +1 -1
- package/components/combo-box-primitive/index.js.map +1 -1
- package/components/dialog-primitive/index.js.map +1 -1
- package/components/disclosure-primitive/index.js.map +1 -1
- package/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -1
- package/components/dismiss-button/styles.module.scss +1 -6
- package/components/dropdown/index.js.map +1 -1
- package/components/dropdown/list-item/styles.module.css +2 -6
- package/components/dropdown/list-item/title.js.map +1 -1
- package/components/dropdown/toggle-button/index.js.map +1 -1
- package/components/dropdown/toggle-button/styles.module.scss +5 -5
- package/components/flight-icon/index.js.map +1 -1
- package/components/form/checkbox/form-checkbox.module.css +4 -11
- package/components/form/file-input/form-file-input.module.scss +1 -1
- package/components/form/radio/form-radio.module.scss +2 -5
- package/components/form/radio-card/form-radio-card.module.css +1 -2
- package/components/form/radio-card/index.js.map +1 -1
- package/components/form/select/form-select.module.css +6 -14
- package/components/form/select/index.js.map +1 -1
- package/components/form/super-select/form-super-select.module.css +4 -10
- package/components/form/super-select/index.js.map +1 -1
- package/components/form/text-input/index.js.map +1 -1
- package/components/form/text-input/styles.module.css +7 -21
- package/components/form/textarea/form-textarea.module.css +1 -2
- package/components/form/textarea/index.js.map +1 -1
- package/components/form/toggle/form-toggle.module.scss +7 -20
- package/components/icon-tile/index.js.map +1 -1
- package/components/icon-tile/style.module.scss +3 -18
- package/components/index.d.ts +2 -0
- package/components/index.js +49 -45
- package/components/index.js.map +1 -1
- package/components/interactive/index.d.ts +2 -2
- package/components/interactive/index.js.map +1 -1
- package/components/legacy-button/index.js.map +1 -1
- package/components/legacy-button/utils.js.map +1 -1
- package/components/menu-primitive/index.js.map +1 -1
- package/components/menu-primitive/use-menu-primitive.js.map +1 -1
- package/components/modal/index.js.map +1 -1
- package/components/modal/use-modal.js.map +1 -1
- package/components/skeleton/index.d.ts +14 -0
- package/components/skeleton/index.js +30 -0
- package/components/skeleton/index.js.map +1 -0
- package/components/skeleton/skeleton-form/index.d.ts +7 -0
- package/components/skeleton/skeleton-form/index.js +19 -0
- package/components/skeleton/skeleton-form/index.js.map +1 -0
- package/components/skeleton/skeleton-form/skeleton-form.module.css +32 -0
- package/components/skeleton/skeleton-form/skeleton-form.module.css.js +11 -0
- package/components/skeleton/skeleton-form/skeleton-form.module.css.js.map +1 -0
- package/components/skeleton/skeleton.module.css +87 -0
- package/components/skeleton/skeleton.module.css.js +19 -0
- package/components/skeleton/skeleton.module.css.js.map +1 -0
- package/components/standalone-link/index.js.map +1 -1
- package/components/standalone-link/styles.module.scss +4 -6
- package/components/table/index.js.map +1 -1
- package/components/table/td.js.map +1 -1
- package/components/table/th.js.map +1 -1
- package/components/table/utils.js.map +1 -1
- package/components/tabs/index.js.map +1 -1
- package/components/tabs/tab-panel.js.map +1 -1
- package/components/tabs/tab.js.map +1 -1
- package/components/tabs/tabs.module.scss +11 -54
- package/components/tabs/use-tabs-context.js.map +1 -1
- package/components/text/index.js.map +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +19 -18
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/index.js +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -1
- package/components/visualizations/bar-chart/horizontal-chart/style.module.css +2 -2
- package/components/visualizations/bar-chart/style.module.css +2 -4
- package/components/visualizations/donut-chart/index.js +49 -48
- package/components/visualizations/donut-chart/index.js.map +1 -1
- package/components/visualizations/donut-chart/styles.module.css +2 -4
- package/index.js +107 -101
- package/index.js.map +1 -1
- package/package.json +8 -7
- package/patterns/card/style.module.css +0 -2
- package/patterns/card/unified-card/index.js.map +1 -1
- package/patterns/copy-button/index.d.ts +3 -3
- package/patterns/copy-button/index.js +17 -17
- package/patterns/copy-button/index.js.map +1 -1
- package/patterns/layout/layout.module.css +2 -8
- package/patterns/product-badge/style.module.css +1 -1
- package/patterns/related-content/style.module.css +1 -1
- package/style.css +1 -1
- package/styles/mixins/button.scss +18 -73
- package/styles/mixins/focus-ring.scss +1 -8
- package/{patterns/copy-button → utils}/clipboard.d.ts +5 -5
- package/{patterns/copy-button → utils}/clipboard.js +1 -1
- package/utils/clipboard.js.map +1 -0
- package/utils/get-contrast-yiq.js.map +1 -1
- package/utils/hooks/use-media-query/index.d.ts +1 -0
- package/utils/hooks/use-media-query/index.js +16 -0
- package/utils/hooks/use-media-query/index.js.map +1 -0
- package/utils/hooks/{use-screen-size.js → use-screen-size/index.js} +2 -2
- package/utils/hooks/use-screen-size/index.js.map +1 -0
- package/utils/i18n/constants/index.d.ts +14 -0
- package/utils/i18n/constants/index.js.map +1 -1
- package/utils/i18n/helpers/index.d.ts +1 -0
- package/utils/i18n/helpers/is-supported-local.d.ts +2 -0
- package/utils/i18n/helpers/{index.js → is-supported-local.js} +1 -1
- package/utils/i18n/helpers/is-supported-local.js.map +1 -0
- package/utils/i18n/helpers/locale-provider.d.ts +1 -1
- package/utils/i18n/helpers/locale-provider.js +1 -1
- package/utils/i18n/helpers/locale-provider.js.map +1 -1
- package/utils/i18n/helpers/to-smart-sentence-case.d.ts +1 -1
- package/utils/i18n/helpers/to-smart-sentence-case.js.map +1 -1
- package/utils/i18n/helpers/to-smart-title-case.d.ts +1 -1
- package/utils/i18n/helpers/to-smart-title-case.js.map +1 -1
- package/utils/i18n/helpers/use-locale.d.ts +1 -1
- package/utils/i18n/helpers/use-locale.js +6 -6
- package/utils/i18n/helpers/use-locale.js.map +1 -1
- package/utils/i18n/index.d.ts +1 -1
- package/utils/i18n/index.js.map +1 -1
- package/utils/i18n/types.d.ts +2 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +8 -6
- package/utils/index.js.map +1 -1
- package/utils/make-normalizer/index.js.map +1 -1
- package/utils/mds-context/index.js.map +1 -1
- package/hooks/use-media-query/index.js +0 -16
- package/hooks/use-media-query/index.js.map +0 -1
- package/patterns/copy-button/clipboard.js.map +0 -1
- package/utils/hooks/use-screen-size.js.map +0 -1
- package/utils/i18n/helpers/index.js.map +0 -1
- /package/utils/hooks/{use-screen-size.d.ts → use-screen-size/index.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, useState, useCallback, useEffect } from 'react'\nimport FocusLock from 'react-focus-lock'\nimport { Dialog } from '../dialog-primitive'\nimport { ModalContext, useModal } from './use-modal'\nimport type { ReactNode } from 'react'\nimport type { ModalContextState } from './use-modal'\nimport s from './modal.module.css'\n\ninterface ModalProps {\n\tinitialIsOpen?: boolean\n\tinitialModalContent?: ReactNode\n\tonClose?: () => void\n\tchildren: ReactNode\n}\n\nconst ModalProvider = ({\n\tonClose,\n\tinitialIsOpen = false,\n\tinitialModalContent = null,\n\tchildren,\n}: ModalProps) => {\n\tconst [modalContent, setModalContent] = useState<ReactNode | null>(\n\t\tinitialModalContent
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, useState, useCallback, useEffect } from 'react'\nimport FocusLock from 'react-focus-lock'\nimport { Dialog } from '../dialog-primitive'\nimport { ModalContext, useModal } from './use-modal'\nimport type { ReactNode } from 'react'\nimport type { ModalContextState } from './use-modal'\nimport s from './modal.module.css'\n\ninterface ModalProps {\n\tinitialIsOpen?: boolean\n\tinitialModalContent?: ReactNode\n\tonClose?: () => void\n\tchildren: ReactNode\n}\n\nconst ModalProvider = ({\n\tonClose,\n\tinitialIsOpen = false,\n\tinitialModalContent = null,\n\tchildren,\n}: ModalProps) => {\n\tconst [modalContent, setModalContent] = useState<ReactNode | null>(\n\t\tinitialModalContent,\n\t)\n\tconst [isOpen, setIsOpen] = useState(initialIsOpen)\n\n\tconst closeModal = useCallback(() => {\n\t\tsetIsOpen(false)\n\t\tsetModalContent(null)\n\t\tif (onClose) {\n\t\t\tonClose()\n\t\t}\n\t}, [setIsOpen, onClose])\n\n\tconst openModal = useCallback(\n\t\t(content: ReactNode) => {\n\t\t\tsetModalContent(content)\n\t\t\tsetIsOpen(true)\n\t\t},\n\t\t[setIsOpen],\n\t)\n\n\tconst contextValue: ModalContextState = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\topenModal,\n\t\t\tmodalContent,\n\t\t\tcloseModal,\n\t\t}),\n\t\t[isOpen, openModal, closeModal, modalContent],\n\t)\n\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape' && isOpen) {\n\t\t\t\tcloseModal()\n\t\t\t}\n\t\t}\n\t\tif (isOpen) {\n\t\t\twindow.addEventListener('keydown', handleKeyDown)\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isOpen) {\n\t\t\t\twindow.removeEventListener('keydown', handleKeyDown)\n\t\t\t}\n\t\t}\n\t}, [isOpen, closeModal])\n\n\treturn (\n\t\t<ModalContext.Provider value={contextValue}>\n\t\t\t{children}\n\t\t\t{isOpen && modalContent && (\n\t\t\t\t<>\n\t\t\t\t\t<FocusLock>\n\t\t\t\t\t\t<Dialog.Wrapper\n\t\t\t\t\t\t\tonDismiss={closeModal}\n\t\t\t\t\t\t\tclassName={s.modal}\n\t\t\t\t\t\t\topen={isOpen}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{modalContent}\n\t\t\t\t\t\t</Dialog.Wrapper>\n\t\t\t\t\t</FocusLock>\n\t\t\t\t\t<Dialog.Overlay />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</ModalContext.Provider>\n\t)\n}\n\nModalProvider.displayName = 'ModalProvider'\n\nexport { useModal, ModalProvider }\n"],"names":["ModalProvider","onClose","initialIsOpen","initialModalContent","children","modalContent","setModalContent","useState","isOpen","setIsOpen","closeModal","useCallback","content","contextValue","useMemo","openModal","useEffect","handleKeyDown","event","jsxs","ModalContext","jsx","FocusLock","Dialog","s"],"mappings":";;;;;;;;AAiBuB,MACtBA,IAAA,CAAA;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC,IAAA;AAAA,EACA,qBAAAC,IAAA;AAAA,EACD,UAAAC;AACC;AAAwC,QACvC,CAAAC,GAAAC,CAAA,IAAAC;AAAA,IACDJ;AAAA,EACA,GAEM,CAAAK,GAAAC,CAAa,IAAAF,EAAkBL,CAAA,GACpCQ,IAAeC,EAAA,MAAA;AACf,IAAAF,EAAA,EAAA,GACAH,EAAa,IAAA,QAEbL,EAAA;AAAA,EAGD,GAAA,CAAAQ,GAAMR,CAAY,CAAA,OACOU;AAAA,IACvB,CAAAC,MAAA;AACA,MAAAN,EAAcM,CAAA,GACfH,EAAA,EAAA;AAAA,IACA;AAAA,IACD,CAAAA,CAAA;AAAA,EAEA,GACCI,IAAOC;AAAA,IAAA,OACN;AAAA,MACA,QAAAN;AAAA,MACA,WAAAO;AAAA,MACA,cAAAV;AAAA,MACD,YAAAK;AAAA,IACA;AAAA,IACD,CAAAF,GAAAO,GAAAL,GAAAL,CAAA;AAAA,EAEA;AACC,SAAAW,EAAM,MAAA;AACL,UAAIC,IAAc,CAAAC;AACjB,gBAAW,YAAAV,KACZE,EAAA;AAAA,IAED;AACC,gBACD,OAAA,iBAAA,WAAAO,CAAA,SAGK;AACH,WACD,OAAA,oBAAA,WAAAA,CAAA;AAAA,IAEF;AAAA,EAEA,GAAA,CAAAT,GAAAE,CAAA,CACC,GACE,gBAAAS,EAAAC,EAAA,UAAA,EAAA,OAAAP,GAAA,UAAA;AAAA,IACAT;AAAA,IAECI,KAAAH,KACC,gBAAAc,iBAAA;AAAA,MAAQ,gBAAAE,EAAAC,GAAA,EAAA,UAAA,gBAAAD;AAAA,QAAPE,EAAA;AAAA,QAAA;AAAA,UAEA,WAAWb;AAAA,UACX,WAAMc,EAAA;AAAA,UAEL;UAAA,UAAAnB;AAAA;MAEH,EAAA,CAAA;AAAA,MAED,gBAAAgB,EAAAE,EAAA,SAAA,CAAA,CAAA;AAAA,MAEF,CAAA;AAAA,EAEF,EAAA,CAAA;AAEA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-modal.js","sources":["../../../src/components/modal/use-modal.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport type { ReactNode } from 'react'\n\nexport interface ModalContextState {\n\tisOpen: boolean\n\topenModal: (content: ReactNode) => void\n\tcloseModal: () => void\n}\n\nexport const ModalContext = createContext<ModalContextState | undefined>(\n\tundefined
|
|
1
|
+
{"version":3,"file":"use-modal.js","sources":["../../../src/components/modal/use-modal.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport type { ReactNode } from 'react'\n\nexport interface ModalContextState {\n\tisOpen: boolean\n\topenModal: (content: ReactNode) => void\n\tcloseModal: () => void\n}\n\nexport const ModalContext = createContext<ModalContextState | undefined>(\n\tundefined,\n)\nModalContext.displayName = 'ModalContext'\n\nexport function useModal(): ModalContextState {\n\tconst context = useContext(ModalContext)\n\tif (context === undefined) {\n\t\tthrow new Error('useModal must be used within a ModalContext.Provider')\n\t}\n\treturn context\n}\n"],"names":["ModalContext","createContext","useModal","context","useContext"],"mappings":";;AAW4B,MAC3BA,IAAAC;AAAA,EACD;AACA;AAEOD,gBAAuC;AAC7C,SAAME,IAAU;AAChB,QAAIC,IAAYC,EAAWJ,CAAA;AAC1B,MAAAG,MAAU;AACX,UAAA,IAAA,MAAA,sDAAA;AAED,SAAAA;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SKELETON_COLOR: readonly ["faint", "strong"];
|
|
3
|
+
export type SkeletonColor = (typeof SKELETON_COLOR)[number];
|
|
4
|
+
export interface SkeletonProps extends React.PropsWithChildren {
|
|
5
|
+
animate?: boolean;
|
|
6
|
+
border?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
color?: SkeletonColor;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
}
|
|
11
|
+
export declare const Skeleton: {
|
|
12
|
+
({ animate, border, children, className, color, style, }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import e from "./skeleton.module.css.js";
|
|
3
|
+
import n from "classnames";
|
|
4
|
+
const l = ({
|
|
5
|
+
animate: r = !0,
|
|
6
|
+
border: t = !0,
|
|
7
|
+
children: o,
|
|
8
|
+
className: s,
|
|
9
|
+
color: a = "strong",
|
|
10
|
+
style: m
|
|
11
|
+
}) => /* @__PURE__ */ i(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: n(
|
|
15
|
+
e.skeleton,
|
|
16
|
+
e[a],
|
|
17
|
+
t && e.border,
|
|
18
|
+
r && e.animate,
|
|
19
|
+
s
|
|
20
|
+
),
|
|
21
|
+
style: m,
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: o
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
l.displayName = "Skeleton";
|
|
27
|
+
export {
|
|
28
|
+
l as Skeleton
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/skeleton/index.tsx"],"sourcesContent":["import s from './skeleton.module.css'\nimport classNames from 'classnames'\n\nexport const SKELETON_COLOR = ['faint', 'strong'] as const\nexport type SkeletonColor = (typeof SKELETON_COLOR)[number]\n\nexport interface SkeletonProps extends React.PropsWithChildren {\n\tanimate?: boolean\n\tborder?: boolean\n\tclassName?: string\n\tcolor?: SkeletonColor\n\tstyle?: React.CSSProperties\n}\n\nexport const Skeleton = ({\n\tanimate = true,\n\tborder = true,\n\tchildren,\n\tclassName,\n\tcolor = 'strong',\n\tstyle,\n}: SkeletonProps) => {\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\ts.skeleton,\n\t\t\t\ts[color],\n\t\t\t\tborder && s.border,\n\t\t\t\tanimate && s.animate,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={style}\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\nSkeleton.displayName = 'Skeleton'\n"],"names":["Skeleton","animate","border","children","className","color","style","jsx","classNames","s"],"mappings":";;;AAcO,MAAMA,IAAW,CAAC;AAAA,EACxB,SAAAC,IAAU;AAAA,EACV,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,OAAAC;AACD,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,WAAWC;AAAA,MACVC,EAAE;AAAA,MACFA,EAAEJ,CAAK;AAAA,MACPH,KAAUO,EAAE;AAAA,MACZR,KAAWQ,EAAE;AAAA,MACbL;AAAA,IAAA;AAAA,IAED,OAAAE;AAAA,IACA,eAAY;AAAA,IAEX,UAAAH;AAAA,EAAA;AAAA;AAKJH,EAAS,cAAc;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as t, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import l from "classnames";
|
|
3
|
+
import { Skeleton as e } from "../index.js";
|
|
4
|
+
import a from "./skeleton-form.module.css.js";
|
|
5
|
+
const i = ({ showHeading: m }) => /* @__PURE__ */ t(e, { className: a["skeleton-form"], animate: !1, color: "faint", children: [
|
|
6
|
+
m ? /* @__PURE__ */ s("div", { className: a["span-all"], children: /* @__PURE__ */ s(e, { className: l(a.item, a["max-width"]) }) }) : null,
|
|
7
|
+
/* @__PURE__ */ s(e, { className: l(a.item, a["span-all"]) }),
|
|
8
|
+
/* @__PURE__ */ s(e, { className: a.item }),
|
|
9
|
+
/* @__PURE__ */ s(e, { className: a.item }),
|
|
10
|
+
/* @__PURE__ */ s(e, { className: l(a.item, a["span-all"]) }),
|
|
11
|
+
/* @__PURE__ */ s(e, { className: l(a.item, a["span-all"]) }),
|
|
12
|
+
/* @__PURE__ */ s(e, { className: l(a.item, a["span-all"]) }),
|
|
13
|
+
/* @__PURE__ */ s("div", { className: a["span-all"], children: /* @__PURE__ */ s(e, { className: l(a.item, a["max-width"]) }) })
|
|
14
|
+
] });
|
|
15
|
+
i.displayName = "Skeleton";
|
|
16
|
+
export {
|
|
17
|
+
i as SkeletonForm
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/skeleton/skeleton-form/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { Skeleton } from '..'\nimport style from './skeleton-form.module.css'\n\nexport interface SkeletonFormProps {\n\tshowHeading?: boolean\n}\n\nexport const SkeletonForm = ({ showHeading }: SkeletonFormProps) => {\n\treturn (\n\t\t<Skeleton className={style['skeleton-form']} animate={false} color=\"faint\">\n\t\t\t{showHeading ? (\n\t\t\t\t<div className={style['span-all']}>\n\t\t\t\t\t<Skeleton className={classNames(style.item, style['max-width'])} />\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t<Skeleton className={classNames(style.item, style['span-all'])} />\n\t\t\t<Skeleton className={style.item} />\n\t\t\t<Skeleton className={style.item} />\n\t\t\t<Skeleton className={classNames(style.item, style['span-all'])} />\n\t\t\t<Skeleton className={classNames(style.item, style['span-all'])} />\n\t\t\t<Skeleton className={classNames(style.item, style['span-all'])} />\n\t\t\t<div className={style['span-all']}>\n\t\t\t\t<Skeleton className={classNames(style.item, style['max-width'])} />\n\t\t\t</div>\n\t\t</Skeleton>\n\t)\n}\n\nSkeletonForm.displayName = 'Skeleton'\n"],"names":["SkeletonForm","showHeading","jsxs","Skeleton","style","jsx","classNames"],"mappings":";;;;AAQO,MAAMA,IAAe,CAAC,EAAE,aAAAC,QAE7B,gBAAAC,EAACC,KAAS,WAAWC,EAAM,eAAe,GAAG,SAAS,IAAO,OAAM,SACjE,UAAA;AAAA,EAAAH,sBACC,OAAA,EAAI,WAAWG,EAAM,UAAU,GAC/B,UAAA,gBAAAC,EAACF,GAAA,EAAS,WAAWG,EAAWF,EAAM,MAAMA,EAAM,WAAW,CAAC,EAAA,CAAG,GAClE,IACG;AAAA,EACJ,gBAAAC,EAACF,KAAS,WAAWG,EAAWF,EAAM,MAAMA,EAAM,UAAU,CAAC,GAAG;AAAA,EAChE,gBAAAC,EAACF,GAAA,EAAS,WAAWC,EAAM,KAAA,CAAM;AAAA,EACjC,gBAAAC,EAACF,GAAA,EAAS,WAAWC,EAAM,KAAA,CAAM;AAAA,EACjC,gBAAAC,EAACF,KAAS,WAAWG,EAAWF,EAAM,MAAMA,EAAM,UAAU,CAAC,GAAG;AAAA,EAChE,gBAAAC,EAACF,KAAS,WAAWG,EAAWF,EAAM,MAAMA,EAAM,UAAU,CAAC,GAAG;AAAA,EAChE,gBAAAC,EAACF,KAAS,WAAWG,EAAWF,EAAM,MAAMA,EAAM,UAAU,CAAC,GAAG;AAAA,oBAC/D,OAAA,EAAI,WAAWA,EAAM,UAAU,GAC/B,UAAA,gBAAAC,EAACF,GAAA,EAAS,WAAWG,EAAWF,EAAM,MAAMA,EAAM,WAAW,CAAC,GAAG,EAAA,CAClE;AAAA,GACD;AAIFJ,EAAa,cAAc;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.skeleton-form {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(2, 1fr);
|
|
4
|
+
padding: var(--mds-spacing-08);
|
|
5
|
+
gap: var(--mds-spacing-08) var(--mds-spacing-05);
|
|
6
|
+
|
|
7
|
+
@media (--medium) {
|
|
8
|
+
padding: var(--mds-spacing-09);
|
|
9
|
+
gap: var(--mds-spacing-09) var(--mds-spacing-06);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@media (--large) {
|
|
13
|
+
padding: var(--mds-spacing-10);
|
|
14
|
+
gap: var(--mds-spacing-10) var(--mds-spacing-07);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.item {
|
|
19
|
+
height: 48px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.span-all {
|
|
23
|
+
grid-column: 1 / -1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.max-width {
|
|
27
|
+
max-width: 75%;
|
|
28
|
+
|
|
29
|
+
@media (--medium) {
|
|
30
|
+
max-width: 565px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton-form.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
.skeleton {
|
|
2
|
+
/* defaults */
|
|
3
|
+
--pulse-opacity: 0.5;
|
|
4
|
+
--wipe-angle: 90deg;
|
|
5
|
+
--wipe-size: 340%;
|
|
6
|
+
--wipe-band: 5%;
|
|
7
|
+
--wipe-soft: 25%;
|
|
8
|
+
--wipe-duration: 2.6s;
|
|
9
|
+
|
|
10
|
+
position: relative;
|
|
11
|
+
border-radius: 5px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.border {
|
|
15
|
+
border: 1px solid var(--mds-color-border-primary);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* The “surface fill” layer */
|
|
19
|
+
.skeleton::before {
|
|
20
|
+
content: '';
|
|
21
|
+
position: absolute;
|
|
22
|
+
inset: 0;
|
|
23
|
+
border-radius: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.faint::before {
|
|
27
|
+
background: var(--mds-color-surface-faint);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.strong::before {
|
|
31
|
+
background: var(--mds-color-surface-strong);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:global(.mds-dark-mode) .skeleton {
|
|
35
|
+
--pulse-opacity: 0.7;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:global(.mds-light-mode) .skeleton {
|
|
39
|
+
--pulse-opacity: 0.5;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
43
|
+
/* Wipe variant overlay */
|
|
44
|
+
.animate::after {
|
|
45
|
+
content: '';
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: 0;
|
|
48
|
+
border-radius: inherit;
|
|
49
|
+
background: var(--mds-color-palette-neutral-200);
|
|
50
|
+
opacity: 0.6;
|
|
51
|
+
-webkit-mask-image: linear-gradient(var(--wipe-angle), transparent calc(50% - var(--wipe-band) - var(--wipe-soft)), rgba(0, 0, 0, 1) calc(50% - var(--wipe-band)), rgba(0, 0, 0, 1) calc(50% + var(--wipe-band)), transparent calc(50% + var(--wipe-band) + var(--wipe-soft)));
|
|
52
|
+
mask-image: linear-gradient(var(--wipe-angle), transparent calc(50% - var(--wipe-band) - var(--wipe-soft)), rgba(0, 0, 0, 1) calc(50% - var(--wipe-band)), rgba(0, 0, 0, 1) calc(50% + var(--wipe-band)), transparent calc(50% + var(--wipe-band) + var(--wipe-soft)));
|
|
53
|
+
-webkit-mask-size: var(--wipe-size) var(--wipe-size);
|
|
54
|
+
mask-size: var(--wipe-size) var(--wipe-size);
|
|
55
|
+
-webkit-mask-repeat: no-repeat;
|
|
56
|
+
mask-repeat: no-repeat;
|
|
57
|
+
animation: skeleton-wipe var(--wipe-duration) linear infinite;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (prefers-reduced-motion: reduce) {
|
|
62
|
+
/* Pulse variant */
|
|
63
|
+
.animate {
|
|
64
|
+
animation: pulse 2.3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@keyframes pulse {
|
|
69
|
+
0%,
|
|
70
|
+
100% {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
}
|
|
73
|
+
50% {
|
|
74
|
+
opacity: var(--pulse-opacity);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes skeleton-wipe {
|
|
79
|
+
0% {
|
|
80
|
+
-webkit-mask-position: 120% 0%;
|
|
81
|
+
mask-position: 120% 0%;
|
|
82
|
+
}
|
|
83
|
+
100% {
|
|
84
|
+
-webkit-mask-position: -120% 0%;
|
|
85
|
+
mask-position: -120% 0%;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const e = "skeleton__fula5", t = "border__NB2r5", n = "faint__UPSew", s = "strong__QSJRI", o = "animate__NIadM", a = "pulse__YLysm", _ = {
|
|
2
|
+
skeleton: e,
|
|
3
|
+
border: t,
|
|
4
|
+
faint: n,
|
|
5
|
+
strong: s,
|
|
6
|
+
animate: o,
|
|
7
|
+
"skeleton-wipe": "skeleton-wipe__cblaB",
|
|
8
|
+
pulse: a
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
o as animate,
|
|
12
|
+
t as border,
|
|
13
|
+
_ as default,
|
|
14
|
+
n as faint,
|
|
15
|
+
a as pulse,
|
|
16
|
+
e as skeleton,
|
|
17
|
+
s as strong
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=skeleton.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/standalone-link/index.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport classNames from 'classnames'\nimport type { InteractiveProps } from '../interactive'\nimport { Interactive } from '../interactive'\nimport { FlightIcon } from '../flight-icon'\nimport s from './styles.module.scss'\n\nconst STANDALONE_LINK_SIZES = ['small', 'medium', 'large'] as const\ntype StandaloneLinkSize = (typeof STANDALONE_LINK_SIZES)[number]\n\nconst STANDALONE_LINK_COLORS = [\n\t'primary',\n\t'secondary',\n\t'secondary-inverted',\n] as const\ntype StandaloneLinkColor = (typeof STANDALONE_LINK_COLORS)[number]\n\nconst STANDALONE_LINK_ICON_POSITIONS = ['leading', 'trailing'] as const\ntype StandaloneLinkIconPosition =\n\t(typeof STANDALONE_LINK_ICON_POSITIONS)[number]\n\ninterface StandaloneLinkProps extends Omit<InteractiveProps, 'color' | 'size'> {\n\ttext: string\n\tsize?: StandaloneLinkSize\n\tcolor?: StandaloneLinkColor\n\ticon?: string\n\ticonPosition?: StandaloneLinkIconPosition\n\thref?: string\n\tlocale?: string\n\tisHrefExternal?: boolean\n\tonClick?: () => void\n\tclassName?: string\n\t'data-testid'?: string\n}\n\nconst StandaloneLink = forwardRef<\n\tHTMLAnchorElement | HTMLButtonElement,\n\tStandaloneLinkProps\n>(\n\t(\n\t\t{\n\t\t\ttext,\n\t\t\tsize = 'medium',\n\t\t\tcolor = 'primary',\n\t\t\ticon,\n\t\t\ticonPosition = 'leading',\n\t\t\tclassName,\n\t\t\t'data-testid': dataTestId,\n\t\t\tlocale,\n\t\t\t...props\n\t\t},\n\t\tref
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/standalone-link/index.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport classNames from 'classnames'\nimport type { InteractiveProps } from '../interactive'\nimport { Interactive } from '../interactive'\nimport { FlightIcon } from '../flight-icon'\nimport s from './styles.module.scss'\n\nconst STANDALONE_LINK_SIZES = ['small', 'medium', 'large'] as const\ntype StandaloneLinkSize = (typeof STANDALONE_LINK_SIZES)[number]\n\nconst STANDALONE_LINK_COLORS = [\n\t'primary',\n\t'secondary',\n\t'secondary-inverted',\n] as const\ntype StandaloneLinkColor = (typeof STANDALONE_LINK_COLORS)[number]\n\nconst STANDALONE_LINK_ICON_POSITIONS = ['leading', 'trailing'] as const\ntype StandaloneLinkIconPosition =\n\t(typeof STANDALONE_LINK_ICON_POSITIONS)[number]\n\ninterface StandaloneLinkProps extends Omit<InteractiveProps, 'color' | 'size'> {\n\ttext: string\n\tsize?: StandaloneLinkSize\n\tcolor?: StandaloneLinkColor\n\ticon?: string\n\ticonPosition?: StandaloneLinkIconPosition\n\thref?: string\n\tlocale?: string\n\tisHrefExternal?: boolean\n\tonClick?: () => void\n\tclassName?: string\n\t'data-testid'?: string\n}\n\nconst StandaloneLink = forwardRef<\n\tHTMLAnchorElement | HTMLButtonElement,\n\tStandaloneLinkProps\n>(\n\t(\n\t\t{\n\t\t\ttext,\n\t\t\tsize = 'medium',\n\t\t\tcolor = 'primary',\n\t\t\ticon,\n\t\t\ticonPosition = 'leading',\n\t\t\tclassName,\n\t\t\t'data-testid': dataTestId,\n\t\t\tlocale,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst iconElement = icon && <FlightIcon name={icon} size={16} />\n\n\t\treturn (\n\t\t\t<Interactive\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['standalone-link'],\n\t\t\t\t\ts[`size-${size}`],\n\t\t\t\t\ts[`color-${color}`],\n\t\t\t\t\ts[`icon-position-${iconPosition}`],\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-testid={dataTestId}\n\t\t\t\tlocale={locale}\n\t\t\t>\n\t\t\t\t{iconElement && iconPosition === 'leading' && iconElement}\n\t\t\t\t<span className={s.text}>{text}</span>\n\t\t\t\t{iconElement && iconPosition === 'trailing' && iconElement}\n\t\t\t</Interactive>\n\t\t)\n\t},\n)\n\nStandaloneLink.displayName = 'StandaloneLink'\n\nexport type {\n\tStandaloneLinkSize,\n\tStandaloneLinkColor,\n\tStandaloneLinkIconPosition,\n\tStandaloneLinkProps,\n}\nexport {\n\tSTANDALONE_LINK_SIZES,\n\tSTANDALONE_LINK_COLORS,\n\tSTANDALONE_LINK_ICON_POSITIONS,\n\tStandaloneLink,\n}\n"],"names":["STANDALONE_LINK_SIZES","STANDALONE_LINK_COLORS","STANDALONE_LINK_ICON_POSITIONS","StandaloneLink","forwardRef","text","size","color","icon","iconPosition","className","dataTestId","locale","props","ref","iconElement","jsx","FlightIcon","jsxs","Interactive","classNames","s"],"mappings":";;;;;;AAOA,MAAMA,IAAwB,CAAC,SAAS,UAAU,OAAO,GAGnDC,IAAyB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,GAGMC,IAAiC,CAAC,WAAW,UAAU,GAkBvDC,IAAiBC;AAAA,EAItB,CACC;AAAA,IACC,MAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,MAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,WAAAC;AAAA,IACA,eAAeC;AAAA,IACf,QAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEJC,MACI;AACJ,UAAMC,IAAcP,KAAQ,gBAAAQ,EAACC,KAAW,MAAMT,GAAM,MAAM,IAAI;AAE9D,WACC,gBAAAU;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,GAAGN;AAAA,QACJ,KAAAC;AAAA,QACA,WAAWM;AAAA,UACVC,EAAE,iBAAiB;AAAA,UACnBA,EAAE,QAAQf,CAAI,EAAE;AAAA,UAChBe,EAAE,SAASd,CAAK,EAAE;AAAA,UAClBc,EAAE,iBAAiBZ,CAAY,EAAE;AAAA,UACjCC;AAAA,QAAA;AAAA,QAED,eAAaC;AAAA,QACb,QAAAC;AAAA,QAEC,UAAA;AAAA,UAAAG,KAAeN,MAAiB,aAAaM;AAAA,UAC9C,gBAAAC,EAAC,QAAA,EAAK,WAAWK,EAAE,MAAO,UAAAhB,GAAK;AAAA,UAC9BU,KAAeN,MAAiB,cAAcM;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlD;AACD;AAEAZ,EAAe,cAAc;"}
|
|
@@ -30,11 +30,7 @@ $standalone-link-focus-shift: 4px;
|
|
|
30
30
|
$shift-extra: $shift + 2px;
|
|
31
31
|
|
|
32
32
|
// notice: this is used not only for the focus, but also to increase the clickable area
|
|
33
|
-
@include hds-focus-ring-with-pseudo-element(
|
|
34
|
-
$right: -$shift,
|
|
35
|
-
$left: -$shift,
|
|
36
|
-
$radius: $standalone-link-focus-border-radius
|
|
37
|
-
);
|
|
33
|
+
@include hds-focus-ring-with-pseudo-element($right: -$shift, $left: -$shift, $radius: $standalone-link-focus-border-radius);
|
|
38
34
|
|
|
39
35
|
// we need to override a couple of values for better visual alignment
|
|
40
36
|
&.icon-position-leading::before {
|
|
@@ -54,7 +50,9 @@ $standalone-link-focus-shift: 4px;
|
|
|
54
50
|
flex: 1 0 0;
|
|
55
51
|
text-decoration: underline;
|
|
56
52
|
text-decoration-color: transparent;
|
|
57
|
-
transition:
|
|
53
|
+
transition:
|
|
54
|
+
text-decoration-color 0.15s ease-in,
|
|
55
|
+
color 0.15s ease-in;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
.size-small {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { TD } from './td'\nimport { TH } from './th'\nimport { TR } from './tr'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport {\n\tDEFAULT_DENSITY,\n\tDEFAULT_VERTICAL_ALIGNMENT,\n\ttype Density,\n\ttype VerticalAlignment,\n} from './utils'\nimport s from './table.module.scss'\n\nexport interface TableProps extends HTMLAttributes<HTMLTableElement> {\n\t/**\n\t * Define on the table invocation. If set to `true`, even-numbered rows will have a different background color from odd-numbered rows.\n\t */\n\tisStriped?: boolean\n\t/**\n\t * If set to `true`, the `table-display`(CSS) property will be set to fixed. See [MDN reference on table-layout](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout) for more details.\n\t */\n\tisFixedLayout?: boolean\n\t/**\n\t * If set, determines the density (height) of the table body’s rows.\n\t */\n\tdensity?: Density\n\t/**\n\t * Determines the vertical alignment for content in a table. Does not apply to table headers (`th`). See [MDN reference on vertical-align](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) for more details.\n\t */\n\tvalign?: VerticalAlignment\n\t/**\n\t * Adds a (non-visible) caption for users with assistive technology. If set on a sortable table, the provided table caption is paired with the automatically generated sorted message text.\n\t */\n\tcaption?: string\n}\n\nfunction Root({\n\tcaption,\n\tdensity = DEFAULT_DENSITY,\n\tvalign = DEFAULT_VERTICAL_ALIGNMENT,\n\tisStriped,\n\tisFixedLayout,\n\tchildren,\n\tclassName,\n\t...rest\n}: TableProps) {\n\treturn (\n\t\t<table\n\t\t\tclassName={classNames(\n\t\t\t\ts.table,\n\t\t\t\ts[`density-${density}`],\n\t\t\t\ts[`valign-${valign}`],\n\t\t\t\t{\n\t\t\t\t\t[s.striped]: isStriped,\n\t\t\t\t\t[s['layout-fixed']]: isFixedLayout,\n\t\t\t\t},\n\t\t\t\tclassName
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { TD } from './td'\nimport { TH } from './th'\nimport { TR } from './tr'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport {\n\tDEFAULT_DENSITY,\n\tDEFAULT_VERTICAL_ALIGNMENT,\n\ttype Density,\n\ttype VerticalAlignment,\n} from './utils'\nimport s from './table.module.scss'\n\nexport interface TableProps extends HTMLAttributes<HTMLTableElement> {\n\t/**\n\t * Define on the table invocation. If set to `true`, even-numbered rows will have a different background color from odd-numbered rows.\n\t */\n\tisStriped?: boolean\n\t/**\n\t * If set to `true`, the `table-display`(CSS) property will be set to fixed. See [MDN reference on table-layout](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout) for more details.\n\t */\n\tisFixedLayout?: boolean\n\t/**\n\t * If set, determines the density (height) of the table body’s rows.\n\t */\n\tdensity?: Density\n\t/**\n\t * Determines the vertical alignment for content in a table. Does not apply to table headers (`th`). See [MDN reference on vertical-align](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) for more details.\n\t */\n\tvalign?: VerticalAlignment\n\t/**\n\t * Adds a (non-visible) caption for users with assistive technology. If set on a sortable table, the provided table caption is paired with the automatically generated sorted message text.\n\t */\n\tcaption?: string\n}\n\nfunction Root({\n\tcaption,\n\tdensity = DEFAULT_DENSITY,\n\tvalign = DEFAULT_VERTICAL_ALIGNMENT,\n\tisStriped,\n\tisFixedLayout,\n\tchildren,\n\tclassName,\n\t...rest\n}: TableProps) {\n\treturn (\n\t\t<table\n\t\t\tclassName={classNames(\n\t\t\t\ts.table,\n\t\t\t\ts[`density-${density}`],\n\t\t\t\ts[`valign-${valign}`],\n\t\t\t\t{\n\t\t\t\t\t[s.striped]: isStriped,\n\t\t\t\t\t[s['layout-fixed']]: isFixedLayout,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{caption && <caption className=\"sr-only\">{caption}</caption>}\n\t\t\t{children}\n\t\t</table>\n\t)\n}\nRoot.displayName = 'Table'\n\nfunction THead({ children }: { children: ReactNode }) {\n\treturn <thead className={s.thead}>{children}</thead>\n}\nTHead.displayName = 'T.Head'\n\nfunction TBody({ children }: { children: ReactNode }) {\n\treturn <tbody className={s.tbody}>{children}</tbody>\n}\nTBody.displayName = 'T.Body'\n\nconst Table = { Root, TR, THead, TH, TBody, TD }\n\nexport { Table }\n"],"names":["Root","caption","density","DEFAULT_DENSITY","valign","DEFAULT_VERTICAL_ALIGNMENT","isStriped","isFixedLayout","children","className","rest","jsxs","classNames","s","jsx","THead","TBody","Table","TR","TH","TD"],"mappings":";;;;;;;AAoCA,SAASA,EAAK;AAAA,EACb,SAAAC;AAAA,EACA,SAAAC,IAAUC;AAAA,EACV,QAAAC,IAASC;AAAA,EACT,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,GAAe;AACd,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAWC;AAAA,QACVC,EAAE;AAAA,QACFA,EAAE,WAAWX,CAAO,EAAE;AAAA,QACtBW,EAAE,UAAUT,CAAM,EAAE;AAAA,QACpB;AAAA,UACC,CAACS,EAAE,OAAO,GAAGP;AAAA,UACb,CAACO,EAAE,cAAc,CAAC,GAAGN;AAAA,QAAA;AAAA,QAEtBE;AAAA,MAAA;AAAA,MAEA,GAAGC;AAAA,MAEH,UAAA;AAAA,QAAAT,KAAW,gBAAAa,EAAC,WAAA,EAAQ,WAAU,WAAW,UAAAb,GAAQ;AAAA,QACjDO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGJ;AACAR,EAAK,cAAc;AAEnB,SAASe,EAAM,EAAE,UAAAP,KAAqC;AACrD,SAAO,gBAAAM,EAAC,SAAA,EAAM,WAAWD,EAAE,OAAQ,UAAAL,GAAS;AAC7C;AACAO,EAAM,cAAc;AAEpB,SAASC,EAAM,EAAE,UAAAR,KAAqC;AACrD,SAAO,gBAAAM,EAAC,SAAA,EAAM,WAAWD,EAAE,OAAQ,UAAAL,GAAS;AAC7C;AACAQ,EAAM,cAAc;AAEpB,MAAMC,IAAQ,EAAE,MAAAjB,GAAM,IAAAkB,GAAI,OAAAH,GAAO,IAAAI,GAAI,OAAAH,GAAO,IAAAI,EAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"td.js","sources":["../../../src/components/table/td.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { DEFAULT_ALIGNMENT, type HorizontalAlignment } from './utils'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport s from './table.module.scss'\n\nexport interface TDProps extends HTMLAttributes<HTMLTableCellElement> {\n\t/**\n\t * Determines the horizontal content alignment (sometimes referred to as text alignment) for the cell (make sure it is also set for the column header).\n\t */\n\talign?: HorizontalAlignment\n\t/**\n\t * Elements passed as children are yielded as inner content of a <td> HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TD = ({\n\talign = DEFAULT_ALIGNMENT,\n\tchildren,\n\tclassName,\n\t...rest\n}: TDProps) => {\n\treturn (\n\t\t<td\n\t\t\tclassName={classNames(\n\t\t\t\ts.td,\n\t\t\t\ts[`align-${align}`],\n\t\t\t\t'mds-typography-legacy-body-200',\n\t\t\t\t'mds-typography-font-weight-regular',\n\t\t\t\tclassName
|
|
1
|
+
{"version":3,"file":"td.js","sources":["../../../src/components/table/td.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { DEFAULT_ALIGNMENT, type HorizontalAlignment } from './utils'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport s from './table.module.scss'\n\nexport interface TDProps extends HTMLAttributes<HTMLTableCellElement> {\n\t/**\n\t * Determines the horizontal content alignment (sometimes referred to as text alignment) for the cell (make sure it is also set for the column header).\n\t */\n\talign?: HorizontalAlignment\n\t/**\n\t * Elements passed as children are yielded as inner content of a <td> HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TD = ({\n\talign = DEFAULT_ALIGNMENT,\n\tchildren,\n\tclassName,\n\t...rest\n}: TDProps) => {\n\treturn (\n\t\t<td\n\t\t\tclassName={classNames(\n\t\t\t\ts.td,\n\t\t\t\ts[`align-${align}`],\n\t\t\t\t'mds-typography-legacy-body-200',\n\t\t\t\t'mds-typography-font-weight-regular',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<div className={s.content}>{children}</div>\n\t\t</td>\n\t)\n}\n\nTD.displayName = 'B.Td'\n\nexport { TD }\n"],"names":["TD","align","DEFAULT_ALIGNMENT","children","className","rest","jsx","classNames","s"],"mappings":";;;;AAgBA,MAAMA,IAAK,CAAC;AAAA,EACX,OAAAC,IAAQC;AAAA,EACR,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,WAAWC;AAAA,MACVC,EAAE;AAAA,MACFA,EAAE,SAASP,CAAK,EAAE;AAAA,MAClB;AAAA,MACA;AAAA,MACAG;AAAA,IAAA;AAAA,IAEA,GAAGC;AAAA,IAEJ,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWE,EAAE,SAAU,UAAAL,EAAA,CAAS;AAAA,EAAA;AAAA;AAKxCH,EAAG,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"th.js","sources":["../../../src/components/table/th.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { DEFAULT_ALIGNMENT, DEFAULT_SCOPE } from './utils'\nimport { useId, type HTMLAttributes, type ReactNode } from 'react'\nimport { ThButtonTooltip } from './th-button-tooltip'\nimport type { HorizontalAlignment, Scope } from './utils'\nimport s from './table.module.scss'\n\nexport interface THProps extends HTMLAttributes<HTMLTableCellElement> {\n\t/**\n\t * Determines the horizontal content alignment (sometimes referred to as text alignment) for the column header.\n\t */\n\talign?: HorizontalAlignment\n\t/**\n\t * If used as the first item in a table body’s row, scope should be set to row for accessibility purposes.\n\t */\n\tscope?: Scope\n\t/**\n\t * Any valid CSS\n\t * If set, determines the column’s width.\n\t */\n\twidth?: string\n\t/**\n\t * Text string which will appear in the tooltip. May contain basic HTML tags for formatting text such as strong and em tags. Not intended for multi-paragraph text or other more complex content. May not contain interactive content such as links or buttons. The placement and offset are automatically set and can’t be overwritten.\n\t */\n\ttooltip?: string\n\t/**\n\t * If set to `true`, it visually hides the column’s text content (it will still be available to screen readers for accessibility).\n\t */\n\tisVisuallyHidden?: boolean\n\t/**\n\t * Elements passed as children are yielded as inner content of a `<th>` HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TH = ({\n\talign = DEFAULT_ALIGNMENT,\n\twidth,\n\tscope = DEFAULT_SCOPE,\n\ttooltip,\n\tisVisuallyHidden,\n\tchildren,\n\tclassName,\n\t...rest\n}: THProps) => {\n\tconst labelId = useId()\n\tlet content: React.ReactNode\n\n\tif (isVisuallyHidden) {\n\t\tcontent = <span className=\"sr-only\">{children}</span>\n\t} else if (tooltip) {\n\t\tcontent = (\n\t\t\t<div className={s.content}>\n\t\t\t\t<span id={labelId}>{children}</span>\n\t\t\t\t<ThButtonTooltip tooltip={tooltip} labelId={labelId} />\n\t\t\t</div>\n\t\t)\n\t} else {\n\t\tcontent = <div className={s.content}>{children}</div>\n\t}\n\n\treturn (\n\t\t<th\n\t\t\tclassName={classNames(\n\t\t\t\ts.th,\n\t\t\t\ts[`align-${align}`],\n\t\t\t\t'mds-typography-legacy-body-200',\n\t\t\t\t'mds-typography-font-weight-semibold',\n\t\t\t\tclassName
|
|
1
|
+
{"version":3,"file":"th.js","sources":["../../../src/components/table/th.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { DEFAULT_ALIGNMENT, DEFAULT_SCOPE } from './utils'\nimport { useId, type HTMLAttributes, type ReactNode } from 'react'\nimport { ThButtonTooltip } from './th-button-tooltip'\nimport type { HorizontalAlignment, Scope } from './utils'\nimport s from './table.module.scss'\n\nexport interface THProps extends HTMLAttributes<HTMLTableCellElement> {\n\t/**\n\t * Determines the horizontal content alignment (sometimes referred to as text alignment) for the column header.\n\t */\n\talign?: HorizontalAlignment\n\t/**\n\t * If used as the first item in a table body’s row, scope should be set to row for accessibility purposes.\n\t */\n\tscope?: Scope\n\t/**\n\t * Any valid CSS\n\t * If set, determines the column’s width.\n\t */\n\twidth?: string\n\t/**\n\t * Text string which will appear in the tooltip. May contain basic HTML tags for formatting text such as strong and em tags. Not intended for multi-paragraph text or other more complex content. May not contain interactive content such as links or buttons. The placement and offset are automatically set and can’t be overwritten.\n\t */\n\ttooltip?: string\n\t/**\n\t * If set to `true`, it visually hides the column’s text content (it will still be available to screen readers for accessibility).\n\t */\n\tisVisuallyHidden?: boolean\n\t/**\n\t * Elements passed as children are yielded as inner content of a `<th>` HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TH = ({\n\talign = DEFAULT_ALIGNMENT,\n\twidth,\n\tscope = DEFAULT_SCOPE,\n\ttooltip,\n\tisVisuallyHidden,\n\tchildren,\n\tclassName,\n\t...rest\n}: THProps) => {\n\tconst labelId = useId()\n\tlet content: React.ReactNode\n\n\tif (isVisuallyHidden) {\n\t\tcontent = <span className=\"sr-only\">{children}</span>\n\t} else if (tooltip) {\n\t\tcontent = (\n\t\t\t<div className={s.content}>\n\t\t\t\t<span id={labelId}>{children}</span>\n\t\t\t\t<ThButtonTooltip tooltip={tooltip} labelId={labelId} />\n\t\t\t</div>\n\t\t)\n\t} else {\n\t\tcontent = <div className={s.content}>{children}</div>\n\t}\n\n\treturn (\n\t\t<th\n\t\t\tclassName={classNames(\n\t\t\t\ts.th,\n\t\t\t\ts[`align-${align}`],\n\t\t\t\t'mds-typography-legacy-body-200',\n\t\t\t\t'mds-typography-font-weight-semibold',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={width ? { width, minWidth: width } : {}}\n\t\t\t{...rest}\n\t\t\tscope={scope}\n\t\t>\n\t\t\t{content}\n\t\t</th>\n\t)\n}\n\nTH.displayName = 'H.TH'\n\nexport { TH }\n"],"names":["TH","align","DEFAULT_ALIGNMENT","width","scope","DEFAULT_SCOPE","tooltip","isVisuallyHidden","children","className","rest","labelId","useId","content","jsx","jsxs","s","ThButtonTooltip","classNames"],"mappings":";;;;;;AAmCA,MAAMA,IAAK,CAAC;AAAA,EACX,OAAAC,IAAQC;AAAA,EACR,OAAAC;AAAA,EACA,OAAAC,IAAQC;AAAA,EACR,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAAe;AACd,QAAMC,IAAUC,EAAA;AAChB,MAAIC;AAEJ,SAAIN,IACHM,IAAU,gBAAAC,EAAC,QAAA,EAAK,WAAU,WAAW,UAAAN,GAAS,IACpCF,IACVO,IACC,gBAAAE,EAAC,OAAA,EAAI,WAAWC,EAAE,SACjB,UAAA;AAAA,IAAA,gBAAAF,EAAC,QAAA,EAAK,IAAIH,GAAU,UAAAH,EAAA,CAAS;AAAA,IAC7B,gBAAAM,EAACG,GAAA,EAAgB,SAAAX,GAAkB,SAAAK,EAAA,CAAkB;AAAA,EAAA,GACtD,IAGDE,IAAU,gBAAAC,EAAC,OAAA,EAAI,WAAWE,EAAE,SAAU,UAAAR,GAAS,GAI/C,gBAAAM;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAWI;AAAA,QACVF,EAAE;AAAA,QACFA,EAAE,SAASf,CAAK,EAAE;AAAA,QAClB;AAAA,QACA;AAAA,QACAQ;AAAA,MAAA;AAAA,MAED,OAAON,IAAQ,EAAE,OAAAA,GAAO,UAAUA,EAAA,IAAU,CAAA;AAAA,MAC3C,GAAGO;AAAA,MACJ,OAAAN;AAAA,MAEC,UAAAS;AAAA,IAAA;AAAA,EAAA;AAGJ;AAEAb,EAAG,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/table/utils.ts"],"sourcesContent":["export const DEFAULT_DENSITY = 'medium'\nexport const DENSITIES = ['default', 'medium', 'short', 'tall'] as const\nexport type Density = (typeof DENSITIES)[number]\nexport const getDensity = (densityStr: string): Density => {\n\tconst density = densityStr as Density\n\treturn DENSITIES.includes(density) ? density : DEFAULT_DENSITY\n}\n\nexport const DEFAULT_VERTICAL_ALIGNMENT = 'top'\nexport const VERTICAL_ALIGNMENTS = ['baseline', 'middle', 'top'] as const\nexport type VerticalAlignment = (typeof VERTICAL_ALIGNMENTS)[number]\nexport const getVerticalAlignment = (valignStr: string): VerticalAlignment => {\n\tconst valign = valignStr as VerticalAlignment\n\treturn VERTICAL_ALIGNMENTS.includes(valign)\n\t\t? valign\n\t\t: DEFAULT_VERTICAL_ALIGNMENT\n}\n\nexport const DEFAULT_ALIGNMENT = 'left'\nexport const ALIGNMENTS = ['left', 'center', 'right'] as const\nexport type HorizontalAlignment = (typeof ALIGNMENTS)[number]\nexport const getHorizontalAlignment = (\n\talignStr: string
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/table/utils.ts"],"sourcesContent":["export const DEFAULT_DENSITY = 'medium'\nexport const DENSITIES = ['default', 'medium', 'short', 'tall'] as const\nexport type Density = (typeof DENSITIES)[number]\nexport const getDensity = (densityStr: string): Density => {\n\tconst density = densityStr as Density\n\treturn DENSITIES.includes(density) ? density : DEFAULT_DENSITY\n}\n\nexport const DEFAULT_VERTICAL_ALIGNMENT = 'top'\nexport const VERTICAL_ALIGNMENTS = ['baseline', 'middle', 'top'] as const\nexport type VerticalAlignment = (typeof VERTICAL_ALIGNMENTS)[number]\nexport const getVerticalAlignment = (valignStr: string): VerticalAlignment => {\n\tconst valign = valignStr as VerticalAlignment\n\treturn VERTICAL_ALIGNMENTS.includes(valign)\n\t\t? valign\n\t\t: DEFAULT_VERTICAL_ALIGNMENT\n}\n\nexport const DEFAULT_ALIGNMENT = 'left'\nexport const ALIGNMENTS = ['left', 'center', 'right'] as const\nexport type HorizontalAlignment = (typeof ALIGNMENTS)[number]\nexport const getHorizontalAlignment = (\n\talignStr: string,\n): HorizontalAlignment => {\n\tconst align = alignStr as HorizontalAlignment\n\treturn ALIGNMENTS.includes(align) ? align : DEFAULT_ALIGNMENT\n}\n\nexport const DEFAULT_SCOPE = 'col'\nexport const SCOPES = ['col', 'row'] as const\nexport type Scope = (typeof SCOPES)[number]\nexport const getScope = (scopeStr: string): Scope => {\n\tconst scope = scopeStr as Scope\n\treturn SCOPES.includes(scope) ? scope : DEFAULT_SCOPE\n}\n"],"names":["DEFAULT_DENSITY","DENSITIES","getDensity","densityStr","density","DEFAULT_VERTICAL_ALIGNMENT","VERTICAL_ALIGNMENTS","getVerticalAlignment","valignStr","valign","DEFAULT_ALIGNMENT","ALIGNMENTS","getHorizontalAlignment","alignStr","align","DEFAULT_SCOPE","SCOPES","getScope","scopeStr","scope"],"mappings":"AAAO,MAAMA,IAAkB,UAClBC,IAAY,CAAC,WAAW,UAAU,SAAS,MAAM,GAEjDC,IAAa,CAACC,MAAgC;AAC1D,QAAMC,IAAUD;AAChB,SAAOF,EAAU,SAASG,CAAO,IAAIA,IAAUJ;AAChD,GAEaK,IAA6B,OAC7BC,IAAsB,CAAC,YAAY,UAAU,KAAK,GAElDC,IAAuB,CAACC,MAAyC;AAC7E,QAAMC,IAASD;AACf,SAAOF,EAAoB,SAASG,CAAM,IACvCA,IACAJ;AACJ,GAEaK,IAAoB,QACpBC,IAAa,CAAC,QAAQ,UAAU,OAAO,GAEvCC,IAAyB,CACrCC,MACyB;AACzB,QAAMC,IAAQD;AACd,SAAOF,EAAW,SAASG,CAAK,IAAIA,IAAQJ;AAC7C,GAEaK,IAAgB,OAChBC,IAAS,CAAC,OAAO,KAAK,GAEtBC,IAAW,CAACC,MAA4B;AACpD,QAAMC,IAAQD;AACd,SAAOF,EAAO,SAASG,CAAK,IAAIA,IAAQJ;AACzC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/tabs/index.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport {\n\ttype ReactNode,\n\ttype HTMLAttributes,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n} from 'react'\nimport { TabPanel } from './tab-panel'\nimport { Tab } from './tab'\nimport { TabsContext, useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\nexport interface TabsProps extends HTMLAttributes<HTMLDivElement> {\n\tonClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void\n\tinitialSelectedTabIndex?: number\n\tsize?: 'medium' | 'large'\n}\n\nconst Provider = ({\n\tchildren,\n\tonClickTab,\n\tinitialSelectedTabIndex = 0,\n\tsize = 'medium',\n\tclassName,\n\t...rest\n}: TabsProps) => {\n\tconst [selectedTabIndex, setSelectedTabIndex] = useState(\n\t\tinitialSelectedTabIndex
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/tabs/index.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport {\n\ttype ReactNode,\n\ttype HTMLAttributes,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n} from 'react'\nimport { TabPanel } from './tab-panel'\nimport { Tab } from './tab'\nimport { TabsContext, useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\nexport interface TabsProps extends HTMLAttributes<HTMLDivElement> {\n\tonClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void\n\tinitialSelectedTabIndex?: number\n\tsize?: 'medium' | 'large'\n}\n\nconst Provider = ({\n\tchildren,\n\tonClickTab,\n\tinitialSelectedTabIndex = 0,\n\tsize = 'medium',\n\tclassName,\n\t...rest\n}: TabsProps) => {\n\tconst [selectedTabIndex, setSelectedTabIndex] = useState(\n\t\tinitialSelectedTabIndex,\n\t)\n\tconst tabNodes = useRef<Array<HTMLButtonElement>>([])\n\tconst panelNodes = useRef<Array<HTMLDivElement>>([])\n\tconst [tabIds, setTabIds] = useState<Array<string>>([])\n\tconst [panelIds, setPanelIds] = useState<Array<string>>([])\n\tconst [indicatorWidth, setIndicatorWidth] = useState(0)\n\tconst [indicatorLeftPosition, setIndicatorLeftPosition] = useState(0)\n\tconst tabsListRef = useRef<HTMLUListElement | null>(null)\n\n\tconst scrollIntoView = useCallback((tabIndex: number) => {\n\t\t// Scroll Tab into view if it's out of view\n\t\tconst parentNode = tabNodes.current[tabIndex]\n\t\t\t?.parentNode as HTMLElement | null\n\t\tif (parentNode) {\n\t\t\tparentNode.scrollIntoView({\n\t\t\t\tbehavior: 'smooth',\n\t\t\t\tblock: 'nearest',\n\t\t\t\tinline: 'nearest',\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tuseEffect(() => {\n\t\tsetSelectedTabIndex(initialSelectedTabIndex)\n\t}, [initialSelectedTabIndex])\n\n\tuseEffect(() => {\n\t\tconst tabElem = tabNodes.current[selectedTabIndex]?.parentElement\n\t\tif (tabElem && tabsListRef.current) {\n\t\t\tconst tabLeftPos = tabElem.offsetLeft\n\t\t\tconst tabWidth = tabElem.offsetWidth\n\t\t\tsetIndicatorLeftPosition(tabLeftPos)\n\t\t\tsetIndicatorWidth(tabWidth)\n\t\t\ttabsListRef.current.scrollTo({\n\t\t\t\tleft: tabLeftPos,\n\t\t\t\tbehavior: 'smooth',\n\t\t\t})\n\t\t}\n\t}, [tabNodes, selectedTabIndex, scrollIntoView, tabsListRef])\n\n\tuseEffect(() => {\n\t\tsetTabIds(tabNodes.current.map((tab) => tab.id))\n\n\t\tlet selectedCount = 0\n\n\t\ttabNodes.current.forEach((tabElement) => {\n\t\t\tif (tabElement.hasAttribute('data-is-selected')) {\n\t\t\t\tselectedCount++\n\t\t\t}\n\t\t})\n\n\t\tif (selectedCount > 1) {\n\t\t\tconsole.error('Only one tab may use isSelected argument')\n\t\t}\n\t}, [tabNodes])\n\n\tuseEffect(() => {\n\t\tsetPanelIds(panelNodes.current.map((tab) => tab.id))\n\t}, [panelNodes])\n\n\tconst onClick = useCallback(\n\t\t(tabIndex: number, event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tsetSelectedTabIndex(tabIndex)\n\n\t\t\tscrollIntoView(tabIndex)\n\n\t\t\t// invoke the callback function if it's provided as argument\n\t\t\tif (typeof onClickTab === 'function') {\n\t\t\t\tonClickTab(event, tabIndex)\n\t\t\t}\n\t\t},\n\t\t[onClickTab, scrollIntoView],\n\t)\n\n\t// Focus tab for keyboard & mouse navigation:\n\tconst focusTab = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\te.preventDefault()\n\t\t\ttabNodes.current[tabIndex].focus()\n\t\t},\n\t\t[],\n\t)\n\n\tconst onKeyUp = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tconst leftArrow = 'ArrowLeft'\n\t\t\tconst rightArrow = 'ArrowRight'\n\t\t\tconst enterKey = 'Enter'\n\t\t\tconst spaceKey = ' '\n\n\t\t\tif (e.key === rightArrow) {\n\t\t\t\tconst nextTabIndex = (tabIndex + 1) % tabIds.length\n\t\t\t\tfocusTab(nextTabIndex, e)\n\t\t\t} else if (e.key === leftArrow) {\n\t\t\t\tconst prevTabIndex = (tabIndex + tabIds.length - 1) % tabIds.length\n\t\t\t\tfocusTab(prevTabIndex, e)\n\t\t\t} else if (e.key === enterKey || e.key === spaceKey) {\n\t\t\t\tsetSelectedTabIndex(tabIndex)\n\t\t\t}\n\t\t},\n\t\t[focusTab, tabIds.length],\n\t)\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t}),\n\t\t[\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t],\n\t)\n\n\treturn (\n\t\t<TabsContext.Provider value={contextValue}>\n\t\t\t<div\n\t\t\t\tclassName={classNames(s.tabs, className)}\n\t\t\t\t{...rest}\n\t\t\t\tstyle={{\n\t\t\t\t\t['--indicator-left-pos' as string]: `${indicatorLeftPosition}px`,\n\t\t\t\t\t['--indicator-width' as string]: `${indicatorWidth}px`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</TabsContext.Provider>\n\t)\n}\n\ninterface TabsListProps {\n\t/**\n\t * `<Tabs.Tab />` as children\n\t */\n\tchildren: ReactNode\n\tclassName?: string\n}\n\nconst TabList = ({ children, className }: TabsListProps) => {\n\tconst { tabsListRef } = useTabsContext()\n\treturn (\n\t\t<div className={classNames(s['tablist-wrapper'], className)}>\n\t\t\t<ul className={s.tablist} role=\"tablist\" ref={tabsListRef}>\n\t\t\t\t{children}\n\t\t\t\t<li className={s.indicator} role=\"presentation\"></li>\n\t\t\t</ul>\n\t\t</div>\n\t)\n}\n\nconst Tabs = { Provider, TabList, Panel: TabPanel, Tab }\n\nexport type { TabsListProps }\nexport { Tabs }\n"],"names":["Provider","children","onClickTab","initialSelectedTabIndex","size","className","rest","selectedTabIndex","setSelectedTabIndex","useState","tabNodes","useRef","panelNodes","tabIds","setTabIds","panelIds","setPanelIds","indicatorWidth","setIndicatorWidth","indicatorLeftPosition","tabsListRef","scrollIntoView","useCallback","tabIndex","parentNode","useEffect","tabElem","tabLeftPos","tabWidth","setIndicatorLeftPosition","tab","selectedCount","onClick","event","focusTab","onKeyUp","leftArrow","rightArrow","enterKey","spaceKey","nextTabIndex","prevTabIndex","contextValue","useMemo","jsx","TabsContext","classNames","s","jsxs"],"mappings":";;;;;;;;AAyBkB,MACjBA,IAAA,CAAA;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC,IAAO;AAAA,EACP,MAAAC,IAAA;AAAA,EACA,WAAAC;AAAA,EACD,GAAAC;AACC;AAAgD,QAC/C,CAAAC,GAAAC,CAAA,IAAAC;AAAA,IACDN;AAAA,EACA,GACMO,IAAAC,EAAa,CAAA,CAA8B,GAC3CC,IAASD,EAAS,CAAA,CAAI,GACtB,CAACE,GAAAC,CAAU,IAAWL,EAAI,CAAA,CAAA,GAC1B,CAACM,GAAAC,CAAgB,IAAAP,EAAiB,CAAA,CAAA,GAClC,CAACQ,GAAAC,CAAuB,IAAAT,EAAA,CAAwB,GAChD,CAAAU,IAAkD,IAAAV,EAAA,CAAA,GAElDW,IAAAT,SAELU,IAAmBC,SAChB;AACH,cAAgBZ,EAAA,QAAAa,CAAA,GAAA;AACf,IAAAC,KAA0BA,iBACf;AAAA,MACV,UAAO;AAAA,MACP,OAAA;AAAA,MACA,QAAA;AAAA,IACF,CAAA;AAAA,EAGD,GAAA,CAAA,CAAA;AACC,EAAAC,EAAA,MAAA;AACD,IAAAjB,EAAIL,CAAwB;AAAA,EAE5B,GAAA,CAAAA,CAAgB,CAAA,GACfsB,EAAM,MAAA;AACN,UAAIC,IAAWhB,EAAA,SAAqB,GAAA;AACnC,QAAAgB,KAAMN,EAAa,SAAQ;AAC3B,YAAMO,IAAWD,EAAQ,YACzBE,IAAAF,EAAyB;AACzB,MAAAG,EAAkBF,CAAQ,GAC1BT,EAAYU,IAAiBR,EACtB,QAAA,SAAA;AAAA,QACN;QACA,UAAA;AAAA,MACF,CAAA;AAAA;EAGD,GAAA,CAAAV,GAAUH,GAAMc,GAAAD,CAAA,CAAA,GACfK,EAAA,MAAU;AAEV,IAAAX,EAAIJ,EAAA,QAAgB,IAAA,CAAAoB,MAAAA,EAAA,EAAA,CAAA;AAEpB,QAAAC;AACC,IAAArB,EAAI,QAAW,eAAa;AAC3B,QAAA,aAAA,kBAAA,KACDqB;AAAA,IAGD,CAAA,GACCA,SACD,QAAA,MAAA,0CAAA;AAAA,EAGD,GAAA,CAAArB,CAAU,CAAA,GACTe,EAAA,MAAY;AACb,IAAAT,EAAcJ,EAAC,QAAA,IAAA,CAAAkB,MAAAA,EAAA,EAAA,CAAA;AAAA,EAEf,GAAA,CAAAlB,CAAM,CAAA;AAAU,QACdoB,IAAkBV;AAAA,IAClB,CAAAC,GAAAU,MAAA;AAEA,MAAAzB,EAAee,CAAQ,GAGvBF,EAAWE,IACV,OAAArB,mBACDA,EAAA+B,GAAAV,CAAA;AAAA,IAED;AAAA,IACD,CAAArB,GAAAmB,CAAA;AAAA,EAGA,GACEa,IAAkBZ;AAAA,IAClB,CAAAC,GAAE,MAAA;AACF,QAAA,eAAiB,GAClBb,EAAA,QAAAa,CAAA,EAAA,MAAA;AAAA,IACA;AAAA,IACD,CAAA;AAAA,EAEA,GACEY,IAAkBb;AAAA,IAClB,CAAAC,GAAM,MAAA;AACN,YAAMa,IAAA,aACAC,IAAW,cACXC,IAAW,SAEXC;AACL,UAAA,EAAA,QAAMF,GAAgB;AACtB,cAAAG,SAAwB,KAAA3B,EAAA;UACd2B;MACV,WAAM,EAAA,QAAAJ,GAAgB;AACtB,cAAAK,SAAwB5B,EAAA,SAAA,KAAAA,EAAA;UACd4B,GAAU,CAAA;AAAA,MACpB,MAAA,EAAA,EAAA,QAAAH,KAA4B,EAAA,QAAAC,MAC7B/B,EAAAe,CAAA;AAAA,IAED;AAAA,IACD,CAAAW,GAAArB,EAAA,MAAA;AAAA,EAEA,GACC6B,IAAOC;AAAA,IAAA,OACN;AAAA,MACA,UAAAjC;AAAA,MACA,QAAAG;AAAA,MACA,YAAAD;AAAA,MACA,UAAAG;AAAA,MACA,kBAAAR;AAAA,MACA,SAAAyB;AAAA,MACA,SAAAG;AAAA,MACA,MAAA/B;AAAA,MACD,aAAAgB;AAAA,IACA;AAAA,IAAA;AAAA,MAECV;AAAA,MACAG;AAAA,MACAD;AAAA,MACAG;AAAA,MACAR;AAAA,MACAyB;AAAA,MACAG;AAAA,MACA/B;AAAA,MAAAgB;AAAA,IAEF;AAAA,EAEA;AAEE,SAAC,gBAAAwB,EAAAC,EAAA,UAAA,EAAA,OAAAH,GAAA,UAAA,gBAAAE;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGE,EAAAC,EAAA,MAAA1C,CAAA;AAAA,MACJ;MAAO;QAEL,wBAAmC,GAAAc,CAAc;AAAA,QACnD,qBAAA,GAAAF,CAAA;AAAA,MAEC;AAAA,MAAA,UAAAhB;AAAA;EAIL,EAAA,CAAA;AAUA,OACS,CAAA,EAAA,UAAAA,sBAA+B;AACvC;AAGI,SAAA,gBAAA2C,EAAA,OAAA,EAAA,WAAAE,EAAAC,EAAA,iBAAA,GAAA1C,CAAA,GAAA,UAAA,gBAAA2C,EAAA,MAAA,EAAA,WAAAD,EAAA,SAAA,MAAA,WAAA,KAAA3B,GAAA,UAAA;AAAA,IAAAnB;AAAA,IAGH,gBAAA2C,EAAA,MAAA,EAAA,WAAAG,EAAA,WAAA,MAAA,eAAA,CAAA;AAAA,EAEF,EAAA,CAAA,EAAA,CAAA;AAEA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.js","sources":["../../../src/components/tabs/tab-panel.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo, type HTMLAttributes } from 'react'\nimport classNames from 'classnames'\nimport { useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\ntype TabPanelProps = HTMLAttributes<HTMLDivElement>\n\nconst TabPanel = ({ children, className, ...rest }: TabPanelProps) => {\n\tconst { panelIds, tabIds, selectedTabIndex, panelNodes } = useTabsContext()\n\tconst panelId = 'panel-' + useId()\n\n\tconst nodeIndex = useMemo(\n\t\t() => panelIds.indexOf(panelId),\n\t\t[panelIds, panelId]
|
|
1
|
+
{"version":3,"file":"tab-panel.js","sources":["../../../src/components/tabs/tab-panel.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo, type HTMLAttributes } from 'react'\nimport classNames from 'classnames'\nimport { useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\ntype TabPanelProps = HTMLAttributes<HTMLDivElement>\n\nconst TabPanel = ({ children, className, ...rest }: TabPanelProps) => {\n\tconst { panelIds, tabIds, selectedTabIndex, panelNodes } = useTabsContext()\n\tconst panelId = 'panel-' + useId()\n\n\tconst nodeIndex = useMemo(\n\t\t() => panelIds.indexOf(panelId),\n\t\t[panelIds, panelId],\n\t)\n\n\tconst tabId = useMemo(\n\t\t() => (nodeIndex > -1 ? tabIds[nodeIndex] : undefined),\n\t\t[tabIds, nodeIndex],\n\t)\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex],\n\t)\n\n\treturn (\n\t\t<section\n\t\t\tclassName={classNames(s.panel, className)}\n\t\t\t{...rest}\n\t\t\trole=\"tabpanel\"\n\t\t\taria-labelledby={tabId}\n\t\t\tid={panelId}\n\t\t\thidden={!isSelected}\n\t\t\tref={(el: HTMLDivElement) => panelNodes.current.push(el)}\n\t\t>\n\t\t\t{children}\n\t\t</section>\n\t)\n}\n\nexport type { TabPanelProps }\nexport { TabPanel }\n"],"names":["TabPanel","children","className","rest","panelIds","tabIds","panelNodes","useTabsContext","panelId","useId","useMemo","tabId","nodeIndex","isSelected","selectedTabIndex","jsx","classNames","s","el"],"mappings":";;;;;;AAUC,MAAAA,IAAQ,CAAA,EAAU,UAAAC,GAAQ,WAAAC,GAAA,GAAAC,EAAkB,MAAA;AAC5C,QAAM,EAAA,UAAAC,GAAU,QAAAC,wBAAiB,YAAAC,EAAA,IAAAC,EAAA,GAE3BC,IAAA,WAAYC,EAAA,OACFC;AAAA,IACf,MAACN,EAAU,QAAOI,CAAA;AAAA,IACnB,CAAAJ,GAAAI,CAAA;AAAA,EAEA,GACCG,IAAOD;AAAA,IACP,MAACE,IAAiB,KAAAP,EAAAO,CAAA,IAAA;AAAA,IACnB,CAAAP,GAAAO,CAAA;AAAA,EAEA,GACCC,IAAMH;AAAA,IACN,MAACE,MAAWE;AAAA,IACb,CAAAF,GAAAE,CAAA;AAAA,EAEA;AACC,SAAC,gBAAAC;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGC,EAAAC,EAAA,OAAAf,CAAA;AAAA,MACJ,GAAAC;AAAA,MACA,MAAA;AAAA,MACA,mBAAIQ;AAAA,MACJ,IAAAH;AAAA,MACA,QAAM,CAAAK;AAAA,MAEL,KAAA,CAAAK,MAAAZ,EAAA,QAAA,KAAAY,CAAA;AAAA,MAAA,UAAAjB;AAAA,IACF;AAAA,EAEF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.js","sources":["../../../src/components/tabs/tab.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport { BadgeCount } from '../badge-count'\nimport { useId, type HTMLAttributes, useMemo } from 'react'\nimport { useTabsContext } from './use-tabs-context'\nimport type { FlightIconName } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\nimport s from './tabs.module.scss'\n\ninterface TabProps extends HTMLAttributes<HTMLLIElement> {\n\ttabIndicatorTheme?: 'primary' | 'secondary'\n\t/**\n\t * Displays a count indicator in the tab. Accepts the text value that should go in Badge Count. (optional)\n\t */\n\tcount?: string\n\t/**\n\t * Displays an icon in the tab. (optional)\n\t */\n\ticon?: FlightIconName\n\t/**\n\t * Customizes the initial tab to display when the page is loaded. The first tab is selected on page load by default. (optional)\n\t */\n\tisSelected?: boolean\n\t/**\n\t * Used to append analytics and tracking related data attributes to any interactive element internal to this component.\n\t */\n\ttrackingKey?: string\n}\n\nconst Tab = ({\n\tcount,\n\ticon,\n\tisSelected: isInitialTab,\n\tchildren,\n\tclassName,\n\ttrackingKey,\n\ttabIndicatorTheme = 'primary',\n\t...rest\n}: TabProps) => {\n\tconst { tabNodes, tabIds, selectedTabIndex, onClick, onKeyUp, size } =\n\t\tuseTabsContext()\n\tconst tabId = 'tab-' + useId()\n\n\tconst nodeIndex = useMemo(() => tabIds.indexOf(tabId), [tabIds, tabId])\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex]
|
|
1
|
+
{"version":3,"file":"tab.js","sources":["../../../src/components/tabs/tab.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport { BadgeCount } from '../badge-count'\nimport { useId, type HTMLAttributes, useMemo } from 'react'\nimport { useTabsContext } from './use-tabs-context'\nimport type { FlightIconName } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\nimport s from './tabs.module.scss'\n\ninterface TabProps extends HTMLAttributes<HTMLLIElement> {\n\ttabIndicatorTheme?: 'primary' | 'secondary'\n\t/**\n\t * Displays a count indicator in the tab. Accepts the text value that should go in Badge Count. (optional)\n\t */\n\tcount?: string\n\t/**\n\t * Displays an icon in the tab. (optional)\n\t */\n\ticon?: FlightIconName\n\t/**\n\t * Customizes the initial tab to display when the page is loaded. The first tab is selected on page load by default. (optional)\n\t */\n\tisSelected?: boolean\n\t/**\n\t * Used to append analytics and tracking related data attributes to any interactive element internal to this component.\n\t */\n\ttrackingKey?: string\n}\n\nconst Tab = ({\n\tcount,\n\ticon,\n\tisSelected: isInitialTab,\n\tchildren,\n\tclassName,\n\ttrackingKey,\n\ttabIndicatorTheme = 'primary',\n\t...rest\n}: TabProps) => {\n\tconst { tabNodes, tabIds, selectedTabIndex, onClick, onKeyUp, size } =\n\t\tuseTabsContext()\n\tconst tabId = 'tab-' + useId()\n\n\tconst nodeIndex = useMemo(() => tabIds.indexOf(tabId), [tabIds, tabId])\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex],\n\t)\n\n\treturn (\n\t\t<li\n\t\t\tclassName={classNames(\n\t\t\t\ts.tab,\n\t\t\t\ts[tabIndicatorTheme],\n\t\t\t\t{\n\t\t\t\t\t[s.selected]: isSelected,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...rest}\n\t\t\trole=\"presentation\"\n\t\t>\n\t\t\t<button\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['tab-button'],\n\t\t\t\t\t'mds-typography-font-weight-medium',\n\t\t\t\t\t{\n\t\t\t\t\t\t['mds-typography-legacy-body-200']: size === 'medium',\n\t\t\t\t\t\t['mds-typography-legacy-body-300']: size === 'large',\n\t\t\t\t\t},\n\t\t\t\t)}\n\t\t\t\trole=\"tab\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tid={tabId}\n\t\t\t\taria-selected={isSelected}\n\t\t\t\ttabIndex={!isSelected ? -1 : undefined}\n\t\t\t\tonClick={(e) => onClick(nodeIndex, e)}\n\t\t\t\tonKeyUp={(e) => onKeyUp(nodeIndex, e)}\n\t\t\t\tdata-is-selected={isInitialTab}\n\t\t\t\tdata-analytics={trackingKey}\n\t\t\t\tref={(el: HTMLButtonElement) => tabNodes.current.push(el)}\n\t\t\t>\n\t\t\t\t{icon && <FlightIcon name={icon} size={16} role=\"presentation\" />}\n\n\t\t\t\t{children}\n\n\t\t\t\t{count && <BadgeCount text={count} size=\"small\" role=\"presentation\" />}\n\t\t\t</button>\n\t\t</li>\n\t)\n}\n\nexport type { TabProps }\nexport { Tab }\n"],"names":["Tab","count","icon","isInitialTab","children","className","trackingKey","tabIndicatorTheme","rest","tabNodes","tabIds","onClick","onKeyUp","size","useTabsContext","tabId","nodeIndex","useMemo","isSelected","selectedTabIndex","jsx","classNames","s","jsxs","el","FlightIcon","BadgeCount"],"mappings":";;;;;;;;AA8Ba,MACZA,IAAA,CAAA;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAG;AAAA,EACJ,GAAAC;AACC;AAEA,QAAM,EAAA,UAAAC,GAAQ,QAAAC,wBAAe,SAAAC,GAAA,SAAAC,GAAA,MAAAC,EAAA,IAAAC,EAAA,GAEvBC,IAAA,WAAoB,GAEpBC,IAAAC,EAAa,MAAAP,EAAA,QAAAK,CAAA,GAAA,CAAAL,GAAAK,CAAA,CAAA,GAClBG,IAAMD;AAAA,IACN,MAACD,MAAWG;AAAA,IACb,CAAAH,GAAAG,CAAA;AAAA,EAEA;AACC,SAAC,gBAAAC;AAAA,IAAA;AAAA,IAAA;AAAA,MACW,WACRC;AAAA,QACFC,EAAE;AAAA,QACFA,EAAAf,CAAA;AAAA,QAAA;AAAA,UAEA,CAAAe,EAAA,QAAA,GAAAJ;AAAA,QACA;AAAA,QACDb;AAAA,MACC;AAAA,MACD,GAAAG;AAAA,MAEA,MAAA;AAAA,MAAA,UAAC,gBAAAe;AAAA,QAAA;AAAA,QAAA;AAAA,UACW,WACRF;AAAA,YACFC,EAAA,YAAA;AAAA,YACA;AAAA,YAAA;AAAA,cAEE,kCAAmCT,MAAS;AAAA,cAAA,kCAAAA,MAAA;AAAA,YAE/C;AAAA,UACA;AAAA,UACA,MAAK;AAAA,UACL,MAAI;AAAA,UACJ,IAAAE;AAAA,UACA;UACA,UAAUG,IAAc,SAAA;AAAA,UACxB,SAAS,CAAC,MAAMP,EAAQK,GAAW,CAAC;AAAA,UACpC,SAAA,CAAA,MAAAJ,EAAkBI,GAAA,CAAA;AAAA,UAClB,oBAAgBb;AAAA,UAChB,kBAAgCG;AAAA,UAE/B,YAAAG,EAAA,QAAA,KAAAe,CAAA;AAAA,UAAA,UAAA;AAAA,YAEAtB,KAAA,gBAAAkB,EAAAK,GAAA,EAAA,MAAAvB,GAAA,MAAA,IAAA,MAAA,eAAA,CAAA;AAAA,YAEAE;AAAA,YAAmEH,KAAA,gBAAAmB,EAAAM,GAAA,EAAA,MAAAzB,GAAA,MAAA,SAAA,MAAA,eAAA,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACrE;AAAA,IACD;AAAA,EAEF;;"}
|
|
@@ -7,14 +7,10 @@
|
|
|
7
7
|
&::before {
|
|
8
8
|
position: absolute;
|
|
9
9
|
right: 0;
|
|
10
|
-
bottom: calc(
|
|
11
|
-
(var(--mds-tabs-indicator-height) - var(--mds-tabs-divider-height)) /
|
|
12
|
-
2
|
|
13
|
-
);
|
|
10
|
+
bottom: calc((var(--mds-tabs-indicator-height) - var(--mds-tabs-divider-height)) / 2);
|
|
14
11
|
left: 0;
|
|
15
12
|
display: block;
|
|
16
|
-
border-top: var(--mds-tabs-divider-height) solid
|
|
17
|
-
var(--mds-color-border-primary);
|
|
13
|
+
border-top: var(--mds-tabs-divider-height) solid var(--mds-color-border-primary);
|
|
18
14
|
content: '';
|
|
19
15
|
}
|
|
20
16
|
}
|
|
@@ -34,54 +30,26 @@
|
|
|
34
30
|
align-items: center;
|
|
35
31
|
height: var(--mds-tabs-tab-height-medium);
|
|
36
32
|
margin: 0;
|
|
37
|
-
padding: var(--mds-tabs-tab-padding-vertical)
|
|
38
|
-
var(--mds-tabs-tab-padding-horizontal-medium);
|
|
33
|
+
padding: var(--mds-tabs-tab-padding-vertical) var(--mds-tabs-tab-padding-horizontal-medium);
|
|
39
34
|
white-space: nowrap;
|
|
40
35
|
text-decoration: none;
|
|
41
36
|
list-style: none;
|
|
42
37
|
|
|
43
38
|
&.primary {
|
|
44
|
-
color: var(
|
|
45
|
-
--mds-accent-tab-color-foreground,
|
|
46
|
-
var(--mds-color-foreground-primary)
|
|
47
|
-
);
|
|
39
|
+
color: var(--mds-accent-tab-color-foreground, var(--mds-color-foreground-primary));
|
|
48
40
|
|
|
49
41
|
&:hover {
|
|
50
|
-
color: var(
|
|
51
|
-
--mds-accent-tab-color-foreground-hover,
|
|
52
|
-
var(
|
|
53
|
-
--mds-accent-tab-color-foreground,
|
|
54
|
-
var(--mds-color-foreground-action)
|
|
55
|
-
)
|
|
56
|
-
);
|
|
42
|
+
color: var(--mds-accent-tab-color-foreground-hover, var(--mds-accent-tab-color-foreground, var(--mds-color-foreground-action)));
|
|
57
43
|
}
|
|
58
44
|
|
|
59
45
|
&.selected {
|
|
60
|
-
color: var(
|
|
61
|
-
--mds-accent-tab-selected-color-foreground,
|
|
62
|
-
var(
|
|
63
|
-
--mds-accent-tab-color-foreground,
|
|
64
|
-
var(--mds-color-foreground-action)
|
|
65
|
-
)
|
|
66
|
-
);
|
|
46
|
+
color: var(--mds-accent-tab-selected-color-foreground, var(--mds-accent-tab-color-foreground, var(--mds-color-foreground-action)));
|
|
67
47
|
|
|
68
48
|
&:hover {
|
|
69
|
-
color: var(
|
|
70
|
-
--mds-accent-tab-selected-color-foreground-hover,
|
|
71
|
-
var(
|
|
72
|
-
--mds-accent-tab-selected-color-foreground,
|
|
73
|
-
var(
|
|
74
|
-
--mds-accent-tab-color-foreground,
|
|
75
|
-
var(--mds-color-foreground-action-hover)
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
);
|
|
49
|
+
color: var(--mds-accent-tab-selected-color-foreground-hover, var(--mds-accent-tab-selected-color-foreground, var(--mds-accent-tab-color-foreground, var(--mds-color-foreground-action-hover))));
|
|
79
50
|
|
|
80
51
|
& ~ .indicator {
|
|
81
|
-
background: var(
|
|
82
|
-
--mds-accent-tab-indicator-color,
|
|
83
|
-
var(--mds-color-foreground-action-hover)
|
|
84
|
-
);
|
|
52
|
+
background: var(--mds-accent-tab-indicator-color, var(--mds-color-foreground-action-hover));
|
|
85
53
|
}
|
|
86
54
|
}
|
|
87
55
|
}
|
|
@@ -99,21 +67,13 @@
|
|
|
99
67
|
}
|
|
100
68
|
|
|
101
69
|
& ~ .indicator {
|
|
102
|
-
background: var(
|
|
103
|
-
--mds-accent-tab-indicator-color,
|
|
104
|
-
var(--mds-color-foreground-strong)
|
|
105
|
-
);
|
|
70
|
+
background: var(--mds-accent-tab-indicator-color, var(--mds-color-foreground-strong));
|
|
106
71
|
}
|
|
107
72
|
}
|
|
108
73
|
}
|
|
109
74
|
|
|
110
75
|
.tab-button {
|
|
111
|
-
@include hds-focus-ring-with-pseudo-element(
|
|
112
|
-
$top: var(--mds-tabs-tab-focus-inset),
|
|
113
|
-
$right: var(--mds-tabs-tab-focus-inset),
|
|
114
|
-
$bottom: var(--mds-tabs-tab-focus-inset),
|
|
115
|
-
$left: var(--mds-tabs-tab-focus-inset)
|
|
116
|
-
);
|
|
76
|
+
@include hds-focus-ring-with-pseudo-element($top: var(--mds-tabs-tab-focus-inset), $right: var(--mds-tabs-tab-focus-inset), $bottom: var(--mds-tabs-tab-focus-inset), $left: var(--mds-tabs-tab-focus-inset));
|
|
117
77
|
position: static;
|
|
118
78
|
display: flex;
|
|
119
79
|
gap: var(--mds-tabs-tab-gutter);
|
|
@@ -144,10 +104,7 @@
|
|
|
144
104
|
// notice: this custom prop is set dynamically via JavaScript
|
|
145
105
|
width: var(--indicator-width);
|
|
146
106
|
height: var(--mds-tabs-indicator-height);
|
|
147
|
-
background: var(
|
|
148
|
-
--mds-accent-tab-indicator-color,
|
|
149
|
-
var(--mds-color-foreground-action)
|
|
150
|
-
);
|
|
107
|
+
background: var(--mds-accent-tab-indicator-color, var(--mds-color-foreground-action));
|
|
151
108
|
border-radius: var(--mds-tabs-indicator-height);
|
|
152
109
|
|
|
153
110
|
@media screen and (prefers-reduced-motion: no-preference) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tabs-context.js","sources":["../../../src/components/tabs/use-tabs-context.ts"],"sourcesContent":["'use client'\n\nimport {\n\ttype MutableRefObject,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\tcreateContext,\n\tuseContext,\n} from 'react'\n\ninterface TabsContextState {\n\ttabNodes: MutableRefObject<Array<HTMLButtonElement>>\n\tpanelNodes: MutableRefObject<Array<HTMLDivElement>>\n\ttabIds: Array<string>\n\tpanelIds: Array<string>\n\tselectedTabIndex: number\n\tonClick: (tabIndex: number, event: MouseEvent<HTMLButtonElement>) => void\n\tonKeyUp: (tabIndex: number, event: KeyboardEvent<HTMLButtonElement>) => void\n\tsize: 'medium' | 'large'\n\ttabsListRef: MutableRefObject<HTMLUListElement | null>\n}\n\nexport const TabsContext = createContext<TabsContextState | undefined>(\n\tundefined
|
|
1
|
+
{"version":3,"file":"use-tabs-context.js","sources":["../../../src/components/tabs/use-tabs-context.ts"],"sourcesContent":["'use client'\n\nimport {\n\ttype MutableRefObject,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\tcreateContext,\n\tuseContext,\n} from 'react'\n\ninterface TabsContextState {\n\ttabNodes: MutableRefObject<Array<HTMLButtonElement>>\n\tpanelNodes: MutableRefObject<Array<HTMLDivElement>>\n\ttabIds: Array<string>\n\tpanelIds: Array<string>\n\tselectedTabIndex: number\n\tonClick: (tabIndex: number, event: MouseEvent<HTMLButtonElement>) => void\n\tonKeyUp: (tabIndex: number, event: KeyboardEvent<HTMLButtonElement>) => void\n\tsize: 'medium' | 'large'\n\ttabsListRef: MutableRefObject<HTMLUListElement | null>\n}\n\nexport const TabsContext = createContext<TabsContextState | undefined>(\n\tundefined,\n)\n\nexport function useTabsContext(): TabsContextState {\n\tconst context = useContext(TabsContext)\n\tif (context === undefined) {\n\t\tthrow new Error('useTabsContext must be used within a TabsContext.Provider')\n\t}\n\treturn context\n}\n"],"names":["TabsContext","createContext","useTabsContext","context","useContext"],"mappings":";;AAsB2B,MAC1BA,IAAAC;AAAA,EACD;AAEO;AACN,SAAMC,IAAU;AAChB,QAAIC,IAAYC,EAAWJ,CAAA;AAC1B,MAAAG,MAAU;AACX,UAAA,IAAA,MAAA,2DAAA;AAED,SAAAA;;"}
|