react-material-design 0.5.0 → 0.5.1
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/Menubar/MenuSection.cjs +1 -0
- package/dist/components/Menubar/MenuSection.js +21 -0
- package/dist/components/Menubar/index.cjs +1 -1
- package/dist/components/Menubar/index.d.ts +1 -0
- package/dist/components/Menubar/index.js +10 -9
- package/dist/layouts/Panes/index.d.ts +2 -0
- package/dist/layouts/Tabs/Tab.cjs +1 -0
- package/dist/layouts/Tabs/Tab.js +33 -0
- package/dist/layouts/Tabs/Tabs.cjs +1 -0
- package/dist/layouts/Tabs/Tabs.js +110 -0
- package/dist/layouts/Tabs/index.cjs +1 -1
- package/dist/layouts/Tabs/index.d.ts +4 -1
- package/dist/layouts/Tabs/index.js +3 -0
- package/dist/layouts/Tabs/style.css +1 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +6 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../misc/OrderedCollection/index.cjs");let t=require("react/compiler-runtime"),n=require("react"),r=require("react/jsx-runtime");function i(i){let a=(0,t.c)(7),o=(0,n.useId)(),s;a[0]!==o||a[1]!==i.children||a[2]!==i.label?(s={id:o,label:i.label,children:i.children},a[0]=o,a[1]=i.children,a[2]=i.label,a[3]=s):s=a[3];let c=s,l;return a[4]!==c||a[5]!==o?(l=(0,r.jsx)(e.OrderedCollectionChild,{name:`MenuSection`,id:o,content:c}),a[4]=c,a[5]=o,a[6]=l):l=a[6],l}exports.default=i;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OrderedCollectionChild as e } from "../misc/OrderedCollection/index.js";
|
|
2
|
+
import { c as t } from "react/compiler-runtime";
|
|
3
|
+
import { useId as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region lib/components/Menubar/MenuSection.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let a = t(7), o = n(), s;
|
|
8
|
+
a[0] !== o || a[1] !== i.children || a[2] !== i.label ? (s = {
|
|
9
|
+
id: o,
|
|
10
|
+
label: i.label,
|
|
11
|
+
children: i.children
|
|
12
|
+
}, a[0] = o, a[1] = i.children, a[2] = i.label, a[3] = s) : s = a[3];
|
|
13
|
+
let c = s, l;
|
|
14
|
+
return a[4] !== c || a[5] !== o ? (l = /* @__PURE__ */ r(e, {
|
|
15
|
+
name: "MenuSection",
|
|
16
|
+
id: o,
|
|
17
|
+
content: c
|
|
18
|
+
}), a[4] = c, a[5] = o, a[6] = l) : l = a[6], l;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { i as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../misc/OrderedCollection/index.cjs"),t=require("./render.cjs");let
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../misc/OrderedCollection/index.cjs"),t=require("./render.cjs"),n=require("./MenuSection.cjs");let r=require("react/compiler-runtime"),i=require("react/jsx-runtime");function a(n){let a=(0,r.c)(4);if(e.useOrderedCollection()){let t;return a[0]===n?t=a[1]:(t=(0,i.jsx)(e.OrderedCollectionChild,{name:`Menubar`,content:n}),a[0]=n,a[1]=t),t}let o;return a[2]===n?o=a[3]:(o=(0,i.jsx)(t.default,{...n}),a[2]=n,a[3]=o),o}exports.MenuSection=n.default,exports.default=a;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { OrderedCollectionChild as e, useOrderedCollection as t } from "../misc/OrderedCollection/index.js";
|
|
2
2
|
import n from "./render.js";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import r from "./MenuSection.js";
|
|
4
|
+
import { c as i } from "react/compiler-runtime";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
5
6
|
//#region lib/components/Menubar/index.tsx
|
|
6
|
-
function
|
|
7
|
-
let o =
|
|
7
|
+
function o(r) {
|
|
8
|
+
let o = i(4);
|
|
8
9
|
if (t()) {
|
|
9
10
|
let t;
|
|
10
|
-
return o[0] ===
|
|
11
|
+
return o[0] === r ? t = o[1] : (t = /* @__PURE__ */ a(e, {
|
|
11
12
|
name: "Menubar",
|
|
12
|
-
content:
|
|
13
|
-
}), o[0] =
|
|
13
|
+
content: r
|
|
14
|
+
}), o[0] = r, o[1] = t), t;
|
|
14
15
|
}
|
|
15
16
|
let s;
|
|
16
|
-
return o[2] ===
|
|
17
|
+
return o[2] === r ? s = o[3] : (s = /* @__PURE__ */ a(n, { ...r }), o[2] = r, o[3] = s), s;
|
|
17
18
|
}
|
|
18
19
|
//#endregion
|
|
19
|
-
export {
|
|
20
|
+
export { r as MenuSection, o as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../components/Icon/Icon.cjs"),t=require("../../components/misc/OrderedCollection/index.cjs"),n=require("./Tabs.cjs");let r=require("react/compiler-runtime"),i=require("react"),a=require("react/jsx-runtime");function o(o){let s=(0,r.c)(21),{label:c,icon:l}=o,u=(0,i.useContext)(n.TabsContext),d;s[0]!==u||s[1]!==c||s[2]!==o.id?(d=typeof c==`function`?c(u===o.id):c,s[0]=u,s[1]=c,s[2]=o.id,s[3]=d):d=s[3];let f=d,p;s[4]!==u||s[5]!==l||s[6]!==o.id?(p=typeof l==`function`?l(u===o.id):l,s[4]=u,s[5]=l,s[6]=o.id,s[7]=p):p=s[7];let m=p,h;s[8]===m?h=s[9]:(h=e.convertIconDefinition(m),s[8]=m,s[9]=h);let g=h,_;s[10]!==g||s[11]!==f||s[12]!==o.blockContentPadding||s[13]!==o.children||s[14]!==o.contentPadding||s[15]!==o.id||s[16]!==o.inlineContentPadding?(_={id:o.id,label:f,icon:g,inlineContentPadding:o.inlineContentPadding,blockContentPadding:o.blockContentPadding,contentPadding:o.contentPadding,children:o.children},s[10]=g,s[11]=f,s[12]=o.blockContentPadding,s[13]=o.children,s[14]=o.contentPadding,s[15]=o.id,s[16]=o.inlineContentPadding,s[17]=_):_=s[17];let v=_,y;return s[18]!==v||s[19]!==o.id?(y=(0,a.jsx)(t.OrderedCollectionChild,{name:`Tab`,id:o.id,content:v}),s[18]=v,s[19]=o.id,s[20]=y):y=s[20],y}exports.default=o;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { convertIconDefinition as e } from "../../components/Icon/Icon.js";
|
|
2
|
+
import { OrderedCollectionChild as t } from "../../components/misc/OrderedCollection/index.js";
|
|
3
|
+
import { TabsContext as n } from "./Tabs.js";
|
|
4
|
+
import { c as r } from "react/compiler-runtime";
|
|
5
|
+
import { useContext as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region lib/layouts/Tabs/Tab.tsx
|
|
8
|
+
function o(o) {
|
|
9
|
+
let s = r(21), { label: c, icon: l } = o, u = i(n), d;
|
|
10
|
+
s[0] !== u || s[1] !== c || s[2] !== o.id ? (d = typeof c == "function" ? c(u === o.id) : c, s[0] = u, s[1] = c, s[2] = o.id, s[3] = d) : d = s[3];
|
|
11
|
+
let f = d, p;
|
|
12
|
+
s[4] !== u || s[5] !== l || s[6] !== o.id ? (p = typeof l == "function" ? l(u === o.id) : l, s[4] = u, s[5] = l, s[6] = o.id, s[7] = p) : p = s[7];
|
|
13
|
+
let m = p, h;
|
|
14
|
+
s[8] === m ? h = s[9] : (h = e(m), s[8] = m, s[9] = h);
|
|
15
|
+
let g = h, _;
|
|
16
|
+
s[10] !== g || s[11] !== f || s[12] !== o.blockContentPadding || s[13] !== o.children || s[14] !== o.contentPadding || s[15] !== o.id || s[16] !== o.inlineContentPadding ? (_ = {
|
|
17
|
+
id: o.id,
|
|
18
|
+
label: f,
|
|
19
|
+
icon: g,
|
|
20
|
+
inlineContentPadding: o.inlineContentPadding,
|
|
21
|
+
blockContentPadding: o.blockContentPadding,
|
|
22
|
+
contentPadding: o.contentPadding,
|
|
23
|
+
children: o.children
|
|
24
|
+
}, s[10] = g, s[11] = f, s[12] = o.blockContentPadding, s[13] = o.children, s[14] = o.contentPadding, s[15] = o.id, s[16] = o.inlineContentPadding, s[17] = _) : _ = s[17];
|
|
25
|
+
let v = _, y;
|
|
26
|
+
return s[18] !== v || s[19] !== o.id ? (y = /* @__PURE__ */ a(t, {
|
|
27
|
+
name: "Tab",
|
|
28
|
+
id: o.id,
|
|
29
|
+
content: v
|
|
30
|
+
}), s[18] = v, s[19] = o.id, s[20] = y) : y = s[20], y;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { o as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./style.css');const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../components/Icon/Icon.cjs"),n=require("../../utils/index.cjs"),r=require("../../utils/hooks.cjs"),i=require("../../components/misc/OrderedCollection/index.cjs"),a=require("../../components/misc/StateLayer/index.cjs"),o=require("../../components/misc/Transitionable/index.cjs");;/* empty css */let s=require("classnames");s=e.__toESM(s,1);let c=require("react"),l=require("react/jsx-runtime"),u=require("react-dom-event-hooks");var d=(0,c.createContext)(void 0);function f(e){let{variant:f=`primary`,defaultActiveTab:p,activeTab:m,onActiveTabChange:h}=e,[g,_]=(0,c.useState)([]),v=(0,c.useMemo)(()=>g.some(e=>!!e.label),[g]),y=(0,c.useMemo)(()=>g.some(e=>!!e.icon),[g]),[b,x]=(0,c.useState)(p??m??``),S=(0,c.useMemo)(()=>{let e=m??b;return g.find(t=>t.id===e)?e:p},[m,b,p,g]),{saveRef:C,ref:w}=(0,u.useMultiElementRef)(),T=(0,c.useRef)(null),E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useCallback)(e=>{x(t=>t||(e.at(0)?.id??``)),_(e)},[]),k=(0,c.useCallback)((e=!1)=>{let t=w.current.get(S??``),r,i;D.current!==null&&(D.current=cancelAnimationFrame(D.current)??null),D.current=requestAnimationFrame(()=>{t&&T.current&&(r=T.current.getBoundingClientRect(),i=f===`primary`?n.getRelativeRect(t,r):n.getRelativeRect(t.parentElement,r),e&&E.current?.classList.add(`immediate`),E.current?.style.setProperty(`--position-left`,`${i.left}px`),E.current?.style.setProperty(`--position-right`,`${r.width-i.right}px`),e&&setTimeout(()=>E.current?.classList.remove(`immediate`)))})},[S,w,f]),{saveRef:A}=(0,u.useResizeObserver)(()=>k(!0)),j=(0,c.useCallback)(e=>{let t=e.currentTarget.dataset.id;t&&(m||x(t),h?.(t))},[m,h]);return r.useIsomorphicLayoutEffect(()=>{k()},[S,g.length,k]),(0,l.jsx)(d,{value:S,children:(0,l.jsxs)(`div`,{className:(0,s.default)(`Tabs`,f),children:[(0,l.jsx)(`nav`,{ref:A,className:(0,s.default)(`navigation`,{labels:v,icons:y}),children:(0,l.jsxs)(`div`,{ref:T,className:`container`,children:[g.map(e=>(0,l.jsxs)(`button`,{className:(0,s.default)(`button`,{active:e.id===S}),"data-id":e.id,onClick:j,children:[(0,l.jsx)(a.default,{}),(0,l.jsxs)(`div`,{ref:C,className:`content`,"data-key":e.id,children:[(0,l.jsx)(t.IconProvider,{size:24,fill:e.id===S,children:(0,l.jsx)(o.default,{value:e.icon,className:`icon`})}),(0,l.jsx)(o.default,{value:e.label,className:`label`})]})]},e.id)),(0,l.jsx)(`div`,{ref:E,className:`indicator`})]})}),(0,l.jsx)(`div`,{className:`activities`,children:g.map(e=>(0,l.jsx)(c.Activity,{name:`Tab_`+e.id,mode:e.id===S?`visible`:`hidden`,children:(0,l.jsx)(`div`,{className:(0,s.default)(`content`,{"inline-padding":e.inlineContentPadding??e.contentPadding??!1,"block-padding":e.blockContentPadding??e.contentPadding??!1}),children:e.children})},e.id))}),(0,l.jsx)(i.default,{name:`Tabs`,childName:`Tab`,onChildrenChange:O,compareChild:n.shallowEqual,children:e.children})]})})}exports.TabsContext=d,exports.default=f;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { IconProvider as e } from "../../components/Icon/Icon.js";
|
|
2
|
+
import { getRelativeRect as t, shallowEqual as n } from "../../utils/index.js";
|
|
3
|
+
import { useIsomorphicLayoutEffect as r } from "../../utils/hooks.js";
|
|
4
|
+
import i from "../../components/misc/OrderedCollection/index.js";
|
|
5
|
+
import a from "../../components/misc/StateLayer/index.js";
|
|
6
|
+
import o from "../../components/misc/Transitionable/index.js";
|
|
7
|
+
import './style.css';/* empty css */
|
|
8
|
+
import s from "classnames";
|
|
9
|
+
import { Activity as c, createContext as l, useCallback as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
10
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { useMultiElementRef as g, useResizeObserver as _ } from "react-dom-event-hooks";
|
|
12
|
+
//#region lib/layouts/Tabs/Tabs.tsx
|
|
13
|
+
var v = l(void 0);
|
|
14
|
+
function y(l) {
|
|
15
|
+
let { variant: y = "primary", defaultActiveTab: b, activeTab: x, onActiveTabChange: S } = l, [C, w] = p([]), T = d(() => C.some((e) => !!e.label), [C]), E = d(() => C.some((e) => !!e.icon), [C]), [D, O] = p(b ?? x ?? ""), k = d(() => {
|
|
16
|
+
let e = x ?? D;
|
|
17
|
+
return C.find((t) => t.id === e) ? e : b;
|
|
18
|
+
}, [
|
|
19
|
+
x,
|
|
20
|
+
D,
|
|
21
|
+
b,
|
|
22
|
+
C
|
|
23
|
+
]), { saveRef: A, ref: j } = g(), M = f(null), N = f(null), P = f(null), F = u((e) => {
|
|
24
|
+
O((t) => t || (e.at(0)?.id ?? "")), w(e);
|
|
25
|
+
}, []), I = u((e = !1) => {
|
|
26
|
+
let n = j.current.get(k ?? ""), r, i;
|
|
27
|
+
P.current !== null && (P.current = cancelAnimationFrame(P.current) ?? null), P.current = requestAnimationFrame(() => {
|
|
28
|
+
n && M.current && (r = M.current.getBoundingClientRect(), i = t(y === "primary" ? n : n.parentElement, r), e && N.current?.classList.add("immediate"), N.current?.style.setProperty("--position-left", `${i.left}px`), N.current?.style.setProperty("--position-right", `${r.width - i.right}px`), e && setTimeout(() => N.current?.classList.remove("immediate")));
|
|
29
|
+
});
|
|
30
|
+
}, [
|
|
31
|
+
k,
|
|
32
|
+
j,
|
|
33
|
+
y
|
|
34
|
+
]), { saveRef: L } = _(() => I(!0)), R = u((e) => {
|
|
35
|
+
let t = e.currentTarget.dataset.id;
|
|
36
|
+
t && (x || O(t), S?.(t));
|
|
37
|
+
}, [x, S]);
|
|
38
|
+
return r(() => {
|
|
39
|
+
I();
|
|
40
|
+
}, [
|
|
41
|
+
k,
|
|
42
|
+
C.length,
|
|
43
|
+
I
|
|
44
|
+
]), /* @__PURE__ */ m(v, {
|
|
45
|
+
value: k,
|
|
46
|
+
children: /* @__PURE__ */ h("div", {
|
|
47
|
+
className: s("Tabs", y),
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ m("nav", {
|
|
50
|
+
ref: L,
|
|
51
|
+
className: s("navigation", {
|
|
52
|
+
labels: T,
|
|
53
|
+
icons: E
|
|
54
|
+
}),
|
|
55
|
+
children: /* @__PURE__ */ h("div", {
|
|
56
|
+
ref: M,
|
|
57
|
+
className: "container",
|
|
58
|
+
children: [C.map((t) => /* @__PURE__ */ h("button", {
|
|
59
|
+
className: s("button", { active: t.id === k }),
|
|
60
|
+
"data-id": t.id,
|
|
61
|
+
onClick: R,
|
|
62
|
+
children: [/* @__PURE__ */ m(a, {}), /* @__PURE__ */ h("div", {
|
|
63
|
+
ref: A,
|
|
64
|
+
className: "content",
|
|
65
|
+
"data-key": t.id,
|
|
66
|
+
children: [/* @__PURE__ */ m(e, {
|
|
67
|
+
size: 24,
|
|
68
|
+
fill: t.id === k,
|
|
69
|
+
children: /* @__PURE__ */ m(o, {
|
|
70
|
+
value: t.icon,
|
|
71
|
+
className: "icon"
|
|
72
|
+
})
|
|
73
|
+
}), /* @__PURE__ */ m(o, {
|
|
74
|
+
value: t.label,
|
|
75
|
+
className: "label"
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
}, t.id)), /* @__PURE__ */ m("div", {
|
|
79
|
+
ref: N,
|
|
80
|
+
className: "indicator"
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ m("div", {
|
|
85
|
+
className: "activities",
|
|
86
|
+
children: C.map((e) => /* @__PURE__ */ m(c, {
|
|
87
|
+
name: "Tab_" + e.id,
|
|
88
|
+
mode: e.id === k ? "visible" : "hidden",
|
|
89
|
+
children: /* @__PURE__ */ m("div", {
|
|
90
|
+
className: s("content", {
|
|
91
|
+
"inline-padding": e.inlineContentPadding ?? e.contentPadding ?? !1,
|
|
92
|
+
"block-padding": e.blockContentPadding ?? e.contentPadding ?? !1
|
|
93
|
+
}),
|
|
94
|
+
children: e.children
|
|
95
|
+
})
|
|
96
|
+
}, e.id))
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ m(i, {
|
|
99
|
+
name: "Tabs",
|
|
100
|
+
childName: "Tab",
|
|
101
|
+
onChildrenChange: F,
|
|
102
|
+
compareChild: n,
|
|
103
|
+
children: l.children
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
export { v as TabsContext, y as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./Tabs.cjs"),t=require("./Tab.cjs");exports.Tab=t.default,exports.default=e.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Tabs{flex-direction:column;width:100%;height:100%;display:flex}.Tabs>.navigation{width:100%;overflow-x:auto}.Tabs>.navigation>.container{flex-flow:row;width:max-content;min-width:100%;height:100%;display:flex;position:relative}.Tabs>.navigation>.container>.button{flex:1 0 max-content;padding:0;cursor:pointer;background-color:#0000;border:none;border-radius:0;outline:none;justify-content:center;align-items:center;margin:0;padding-inline:8px;display:flex}.Tabs>.navigation>.container>.button>.content{display:flex}.Tabs>.navigation>.container>.button>.content>.icon,.Tabs>.navigation>.container>.button>.content>.label{transition:color var(--md-sys-motion-spring-expressive-fast-effects-duration) var(--md-sys-motion-spring-expressive-fast-effects-easing)}.Tabs>.navigation>.container>.button:focus-visible>.StateLayer{border-radius:var(--md-sys-shape-corner-large)}.Tabs>.navigation>.container>.button>.StateLayer{outline-offset:calc(-1 * var(--md-comp-state-focus-indicator-thickness))}.Tabs>.navigation>.container>.indicator{position:absolute;bottom:0}.Tabs>.navigation>.container>.indicator:not(.immediate){transition:inset var(--md-sys-motion-spring-expressive-default-spatial-duration) var(--md-sys-motion-spring-expressive-default-spatial-easing), background-color var(--md-sys-motion-spring-expressive-fast-effects-duration) var(--md-sys-motion-spring-expressive-fast-effects-easing)}.Tabs>.activities{box-sizing:border-box;scrollbar-color:var(--md-sys-color-surface-variant) var(--md-sys-color-surface);flex:1;overflow:auto}.Tabs>.activities>.content{box-sizing:border-box;width:100%;height:100%}.Tabs>.activities>.content.inline-padding{padding-inline:var(--md-sys-measurement-space200)}.Tabs>.activities>.content.block-padding{padding-block:var(--md-sys-measurement-space200)}.Tabs.primary>.navigation{height:var(--md-comp-primary-navigation-tab-container-height);min-height:var(--md-comp-primary-navigation-tab-container-height);background-color:var(--md-comp-primary-navigation-tab-container-color)}.Tabs.primary>.navigation:is(.labels,.icons){height:var(--md-comp-primary-navigation-tab-with-icon-and-label-text-container-height)}.Tabs.primary>.navigation>.container>.button{--md-comp-state-focus-indicator-color:var(--md-comp-primary-navigation-tab-focus-indicator-color);--md-comp-state-focus-indicator-thickness:var(--md-comp-primary-navigation-tab-focus-indicator-thickness);--md-comp-state-focus-indicator-outer-offset:var(--md-comp-primary-navigation-tab-focus-indicator-outline-offset)}.Tabs.primary>.navigation>.container>.button.active{--md-comp-state-hover-state-layer-opacity:var(--md-comp-primary-navigation-tab-active-hover-state-layer-opacity);--md-comp-state-focused-state-layer-opacity:var(--md-comp-primary-navigation-tab-active-focus-state-layer-opacity);--md-comp-state-pressed-state-layer-opacity:var(--md-comp-primary-navigation-tab-active-pressed-state-layer-opacity);--md-comp-state-hover-state-layer-color:var(--md-comp-primary-navigation-tab-active-hover-state-layer-color);--md-comp-state-focused-state-layer-color:var(--md-comp-primary-navigation-tab-active-focus-state-layer-color);--md-comp-state-pressed-state-layer-color:var(--md-comp-primary-navigation-tab-active-pressed-state-layer-color)}.Tabs.primary>.navigation>.container>.button.active>.content>.label{color:var(--md-comp-primary-navigation-tab-with-label-text-active-label-text-color)}.Tabs.primary>.navigation>.container>.button.active>.content>.icon{color:var(--md-comp-primary-navigation-tab-with-icon-active-icon-color)}.Tabs.primary>.navigation>.container>.button.active:hover>.content>.label{color:var(--md-comp-primary-navigation-tab-with-label-text-active-hover-label-text-color)}.Tabs.primary>.navigation>.container>.button.active:hover>.content>.icon{color:var(--md-comp-primary-navigation-tab-with-icon-active-hover-icon-color)}.Tabs.primary>.navigation>.container>.button:not(.active){--md-comp-state-hover-state-layer-opacity:var(--md-comp-primary-navigation-tab-inactive-hover-state-layer-opacity);--md-comp-state-focused-state-layer-opacity:var(--md-comp-primary-navigation-tab-inactive-focus-state-layer-opacity);--md-comp-state-pressed-state-layer-opacity:var(--md-comp-primary-navigation-tab-inactive-pressed-state-layer-opacity);--md-comp-state-hover-state-layer-color:var(--md-comp-primary-navigation-tab-inactive-hover-state-layer-color);--md-comp-state-focused-state-layer-color:var(--md-comp-primary-navigation-tab-inactive-focus-state-layer-color);--md-comp-state-pressed-state-layer-color:var(--md-comp-primary-navigation-tab-inactive-pressed-state-layer-color)}.Tabs.primary>.navigation>.container>.button:not(.active)>.content>.label{color:var(--md-comp-primary-navigation-tab-with-label-text-inactive-label-text-color)}.Tabs.primary>.navigation>.container>.button:not(.active)>.content>.icon{color:var(--md-comp-primary-navigation-tab-with-icon-inactive-icon-color)}.Tabs.primary>.navigation>.container>.button:not(.active):hover>.content>.label{color:var(--md-comp-primary-navigation-tab-with-label-text-inactive-hover-label-text-color)}.Tabs.primary>.navigation>.container>.button:not(.active):hover>.content>.icon{color:var(--md-comp-primary-navigation-tab-with-icon-inactive-hover-icon-color)}.Tabs.primary>.navigation>.container>.button:not(.active):active:not(.disabled,.dragged)>.content>.label{color:var(--md-comp-primary-navigation-tab-with-label-text-inactive-pressed-label-text-color)}.Tabs.primary>.navigation>.container>.button:not(.active):active:not(.disabled,.dragged)>.content>.icon{color:var(--md-comp-primary-navigation-tab-with-icon-inactive-pressed-icon-color)}.Tabs.primary>.navigation>.container>.button>.content{flex-direction:column;align-items:center}.Tabs.primary>.navigation>.container>.button>.content>.label{font-family:var(--md-comp-primary-navigation-tab-with-label-text-label-text-font);font-weight:var(--md-comp-primary-navigation-tab-with-label-text-label-text-weight);font-size:var(--md-comp-primary-navigation-tab-with-label-text-label-text-size);letter-spacing:var(--md-comp-primary-navigation-tab-with-label-text-label-text-tracking);line-height:var(--md-comp-primary-navigation-tab-with-label-text-label-text-line-height);font-variation-settings:"wght" var(--md-comp-primary-navigation-tab-with-label-text-label-text-wght), "GRAD" var(--md-comp-primary-navigation-tab-with-label-text-label-text-grad), "wdth" var(--md-comp-primary-navigation-tab-with-label-text-label-text-wdth), "ROND" var(--md-comp-primary-navigation-tab-with-label-text-label-text-rond), "opsz" var(--md-comp-primary-navigation-tab-with-label-text-label-text-opsz), "CRSV" var(--md-comp-primary-navigation-tab-with-label-text-label-text-crsv), "slnt" var(--md-comp-primary-navigation-tab-with-label-text-label-text-slnt), "FILL" var(--md-comp-primary-navigation-tab-with-label-text-label-text-fill), "HEXP" var(--md-comp-primary-navigation-tab-with-label-text-label-text-hexp)}.Tabs.primary>.navigation>.container>.indicator{height:var(--md-comp-primary-navigation-tab-active-indicator-height);background-color:var(--md-comp-primary-navigation-tab-active-indicator-color);border-radius:var(--md-comp-primary-navigation-tab-active-indicator-height);left:calc(var(--position-left) + 2px);right:calc(var(--position-right) + 2px);border-bottom-right-radius:0;border-bottom-left-radius:0}.Tabs.secondary>.navigation{height:var(--md-comp-secondary-navigation-tab-container-height);min-height:var(--md-comp-secondary-navigation-tab-container-height);background-color:var(--md-comp-secondary-navigation-tab-container-color)}.Tabs.secondary>.navigation>.container>.button{--md-comp-state-hover-state-layer-opacity:var(--md-comp-secondary-navigation-tab-hover-state-layer-opacity);--md-comp-state-focused-state-layer-opacity:var(--md-comp-secondary-navigation-tab-focus-state-layer-opacity);--md-comp-state-pressed-state-layer-opacity:var(--md-comp-secondary-navigation-tab-pressed-state-layer-opacity);--md-comp-state-hover-state-layer-color:var(--md-comp-secondary-navigation-tab-hover-state-layer-color);--md-comp-state-focused-state-layer-color:var(--md-comp-secondary-navigation-tab-focus-state-layer-color);--md-comp-state-pressed-state-layer-color:var(--md-comp-secondary-navigation-tab-pressed-state-layer-color);--md-comp-state-focus-indicator-color:var(--md-comp-secondary-navigation-tab-focus-indicator-color);--md-comp-state-focus-indicator-thickness:var(--md-comp-secondary-navigation-tab-focus-indicator-thickness);--md-comp-state-focus-indicator-outer-offset:var(--md-comp-secondary-navigation-tab-focus-indicator-outline-offset)}.Tabs.secondary>.navigation>.container>.button.active>.content>.label{color:var(--md-comp-secondary-navigation-tab-active-label-text-color)}.Tabs.secondary>.navigation>.container>.button.active>.content>.icon{color:var(--md-comp-secondary-navigation-tab-with-icon-active-icon-color)}.Tabs.secondary>.navigation>.container>.button.active:hover>.content>.label{color:var(--md-comp-secondary-navigation-tab-hover-label-text-color)}.Tabs.secondary>.navigation>.container>.button.active:hover>.content>.icon{color:var(--md-comp-secondary-navigation-tab-with-icon-hover-icon-color)}.Tabs.secondary>.navigation>.container>.button:not(.active)>.content>.label{color:var(--md-comp-secondary-navigation-tab-inactive-label-text-color)}.Tabs.secondary>.navigation>.container>.button:not(.active)>.content>.icon{color:var(--md-comp-secondary-navigation-tab-with-icon-inactive-icon-color)}.Tabs.secondary>.navigation>.container>.button:not(.active):hover>.content>.label{color:var(--md-comp-secondary-navigation-tab-hover-label-text-color)}.Tabs.secondary>.navigation>.container>.button:not(.active):hover>.content>.icon{color:var(--md-comp-secondary-navigation-tab-with-icon-hover-icon-color)}.Tabs.secondary>.navigation>.container>.button:not(.active):active:not(.disabled,.dragged)>.content>.label{color:var(--md-comp-secondary-navigation-tab-pressed-label-text-color)}.Tabs.secondary>.navigation>.container>.button:not(.active):active:not(.disabled,.dragged)>.content>.icon{color:var(--md-comp-secondary-navigation-tab-with-icon-pressed-icon-color)}.Tabs.secondary>.navigation>.container>.button>.content{flex-direction:row;align-items:center;gap:8px}.Tabs.secondary>.navigation>.container>.button>.content>.label{font-family:var(--md-comp-secondary-navigation-tab-label-text-font);font-weight:var(--md-comp-secondary-navigation-tab-label-text-weight);font-size:var(--md-comp-secondary-navigation-tab-label-text-size);letter-spacing:var(--md-comp-secondary-navigation-tab-label-text-tracking);line-height:var(--md-comp-secondary-navigation-tab-label-text-line-height);font-variation-settings:"wght" var(--md-comp-secondary-navigation-tab-label-text-wght), "GRAD" var(--md-comp-secondary-navigation-tab-label-text-grad), "wdth" var(--md-comp-secondary-navigation-tab-label-text-wdth), "ROND" var(--md-comp-secondary-navigation-tab-label-text-rond), "opsz" var(--md-comp-secondary-navigation-tab-label-text-opsz), "CRSV" var(--md-comp-secondary-navigation-tab-label-text-crsv), "slnt" var(--md-comp-secondary-navigation-tab-label-text-slnt), "FILL" var(--md-comp-secondary-navigation-tab-label-text-fill), "HEXP" var(--md-comp-secondary-navigation-tab-label-text-hexp)}.Tabs.secondary>.navigation>.container>.indicator{height:var(--md-comp-secondary-navigation-tab-active-indicator-height);background-color:var(--md-comp-secondary-navigation-tab-active-indicator-color);left:var(--position-left);right:var(--position-right)}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(){return typeof window<`u`}var t=(e,t,n)=>e<t?t:e>n?n:e,n=(e,n,r,i,a)=>t((e-n)*(a-i)/(r-n)+i,i,a);function r(e,t){let n=/\b\w+\b/g,r=0;for(;n.exec(e)!==null;)if(r++,r>=t)return e.slice(0,n.lastIndex);return e}async function i(e,t){return new Promise(n=>{let r=null,i=a=>{t(a)&&(e?.removeEventListener(`animationend`,i),r&&clearInterval(r),n())};if(!e||window.getComputedStyle(e).animationName.includes(`none`))return n();r=setInterval(()=>{window.getComputedStyle(e).animationName.includes(`none`)&&(r&&clearInterval(r),n())},100),e.addEventListener(`animationend`,i)})}async function a(e,t){return i(e,n=>n.target===e?typeof t==`string`?n.animationName===t:t(n.animationName):!1)}function o(e,t,n=0){if(e==null)return n;if(typeof e==`string`){if(e.endsWith(`%`))return parseFloat(e)/100*t;if(e.endsWith(`px`))return parseFloat(e)}return Number(e)||n}function s(e,t,n){if(typeof t==`string`){if(t.endsWith(`%`))return`${e/n*100}%`;if(t.endsWith(`px`))return`${e}px`}return e}function c(e,t,n,r){let i,a;if(!e)return r;if(e.computedStyleMap?(a=e.computedStyleMap().get(t),a instanceof CSSUnparsedValue&&(a=CSSNumericValue.parse(a.toString()))):(i=/^(?<value>\d+)(?<unit>[a-zA-Z]+)?$/.exec(window.getComputedStyle(e).getPropertyValue(t)||`0`))!==null&&(a={value:parseFloat(i.groups?.value??``),unit:i.groups?.unit??``}),a&&`value`in a&&`unit`in a&&typeof a.value==`number`&&typeof a.unit==`string`){if([`ms`,`s`].includes(a.unit.toLowerCase())){if(n?.toLowerCase()===`ms`&&a.unit.toLowerCase()===`s`)return a.value*1e3;if(n?.toLowerCase()===`s`&&a.unit.toLowerCase()===`ms`)return a.value/1e3}return a.value}return r}function l(e,t){return c(e,`--md-comp-${t}`)??0}function u(e,t){let n,r;if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t||(n=Object.keys(e),r=Object.keys(t),n.length!==r.length))return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function
|
|
1
|
+
function e(){return typeof window<`u`}var t=(e,t,n)=>e<t?t:e>n?n:e,n=(e,n,r,i,a)=>t((e-n)*(a-i)/(r-n)+i,i,a);function r(e,t){let n=/\b\w+\b/g,r=0;for(;n.exec(e)!==null;)if(r++,r>=t)return e.slice(0,n.lastIndex);return e}async function i(e,t){return new Promise(n=>{let r=null,i=a=>{t(a)&&(e?.removeEventListener(`animationend`,i),r&&clearInterval(r),n())};if(!e||window.getComputedStyle(e).animationName.includes(`none`))return n();r=setInterval(()=>{window.getComputedStyle(e).animationName.includes(`none`)&&(r&&clearInterval(r),n())},100),e.addEventListener(`animationend`,i)})}async function a(e,t){return i(e,n=>n.target===e?typeof t==`string`?n.animationName===t:t(n.animationName):!1)}function o(e,t,n=0){if(e==null)return n;if(typeof e==`string`){if(e.endsWith(`%`))return parseFloat(e)/100*t;if(e.endsWith(`px`))return parseFloat(e)}return Number(e)||n}function s(e,t,n){if(typeof t==`string`){if(t.endsWith(`%`))return`${e/n*100}%`;if(t.endsWith(`px`))return`${e}px`}return e}function c(e,t,n,r){let i,a;if(!e)return r;if(e.computedStyleMap?(a=e.computedStyleMap().get(t),a instanceof CSSUnparsedValue&&(a=CSSNumericValue.parse(a.toString()))):(i=/^(?<value>\d+)(?<unit>[a-zA-Z]+)?$/.exec(window.getComputedStyle(e).getPropertyValue(t)||`0`))!==null&&(a={value:parseFloat(i.groups?.value??``),unit:i.groups?.unit??``}),a&&`value`in a&&`unit`in a&&typeof a.value==`number`&&typeof a.unit==`string`){if([`ms`,`s`].includes(a.unit.toLowerCase())){if(n?.toLowerCase()===`ms`&&a.unit.toLowerCase()===`s`)return a.value*1e3;if(n?.toLowerCase()===`s`&&a.unit.toLowerCase()===`ms`)return a.value/1e3}return a.value}return r}function l(e,t){return c(e,`--md-comp-${t}`)??0}function u(e,t){let n=e instanceof HTMLElement?e.getBoundingClientRect():e,r=t instanceof HTMLElement?t.getBoundingClientRect():t;return n?r?new DOMRect(n.x-r.x,n.y-r.y,n.width,n.height):n:new DOMRect}function d(e,t){let n,r;if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t||(n=Object.keys(e),r=Object.keys(t),n.length!==r.length))return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function f(e){let t=[],n=e.parentElement;for(;n;){let e=window.getComputedStyle(n);/(auto|scroll|overlay)/.test(e.overflow+e.overflowY+e.overflowX)&&t.push(n),n=n.parentElement}return t}exports.clamp=t,exports.formatSizeFromPx=s,exports.getComponentTokenValue=l,exports.getMaxWords=r,exports.getPropertyValue=c,exports.getRelativeRect=u,exports.getScrollParents=f,exports.isBrowser=e,exports.mapRange=n,exports.parseSizeToPx=o,exports.shallowEqual=d,exports.waitAnimationEndEvent=i,exports.waitAnimationNameEndEvent=a;
|
package/dist/utils/index.js
CHANGED
|
@@ -56,13 +56,17 @@ function l(e, t) {
|
|
|
56
56
|
return c(e, `--md-comp-${t}`) ?? 0;
|
|
57
57
|
}
|
|
58
58
|
function u(e, t) {
|
|
59
|
+
let n = e instanceof HTMLElement ? e.getBoundingClientRect() : e, r = t instanceof HTMLElement ? t.getBoundingClientRect() : t;
|
|
60
|
+
return n ? r ? new DOMRect(n.x - r.x, n.y - r.y, n.width, n.height) : n : new DOMRect();
|
|
61
|
+
}
|
|
62
|
+
function d(e, t) {
|
|
59
63
|
let n, r;
|
|
60
64
|
if (Object.is(e, t)) return !0;
|
|
61
65
|
if (typeof e != "object" || !e || typeof t != "object" || !t || (n = Object.keys(e), r = Object.keys(t), n.length !== r.length)) return !1;
|
|
62
66
|
for (let r = 0; r < n.length; r++) if (!Object.prototype.hasOwnProperty.call(t, n[r]) || !Object.is(e[n[r]], t[n[r]])) return !1;
|
|
63
67
|
return !0;
|
|
64
68
|
}
|
|
65
|
-
function
|
|
69
|
+
function f(e) {
|
|
66
70
|
let t = [], n = e.parentElement;
|
|
67
71
|
for (; n;) {
|
|
68
72
|
let e = window.getComputedStyle(n);
|
|
@@ -71,4 +75,4 @@ function d(e) {
|
|
|
71
75
|
return t;
|
|
72
76
|
}
|
|
73
77
|
//#endregion
|
|
74
|
-
export { t as clamp, s as formatSizeFromPx, l as getComponentTokenValue, r as getMaxWords, c as getPropertyValue,
|
|
78
|
+
export { t as clamp, s as formatSizeFromPx, l as getComponentTokenValue, r as getMaxWords, c as getPropertyValue, u as getRelativeRect, f as getScrollParents, e as isBrowser, n as mapRange, o as parseSizeToPx, d as shallowEqual, i as waitAnimationEndEvent, a as waitAnimationNameEndEvent };
|