@adgytec/adgytec-web-ui-components 2.2.0 → 2.3.0
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/assets/AppBarHeadline.css +1 -1
- package/dist/assets/Card.css +1 -0
- package/dist/assets/CardIcon.css +1 -0
- package/dist/assets/ConnectedButtonGroup.css +1 -1
- package/dist/assets/ListAvatar.css +1 -0
- package/dist/assets/ListBox.css +1 -0
- package/dist/assets/ListIcon.css +1 -0
- package/dist/assets/ListItem.css +1 -0
- package/dist/assets/ListLabelText.css +1 -0
- package/dist/assets/ListMedia.css +1 -0
- package/dist/assets/ListOverlineText.css +1 -0
- package/dist/assets/ListSupportingText.css +1 -0
- package/dist/assets/NavigationScrollContainer.css +1 -1
- package/dist/assets/Snackbar.css +1 -1
- package/dist/chunks/AppBarHeadline +2 -2
- package/dist/chunks/AppBarHeadline.map +1 -1
- package/dist/chunks/Card +22 -0
- package/dist/chunks/Card.map +1 -0
- package/dist/chunks/CardIcon +23 -0
- package/dist/chunks/CardIcon.map +1 -0
- package/dist/chunks/ConnectedButtonGroup +6 -6
- package/dist/chunks/ConnectedButtonGroup.map +1 -1
- package/dist/chunks/ListAvatar +20 -0
- package/dist/chunks/ListAvatar.map +1 -0
- package/dist/chunks/ListBox +16 -0
- package/dist/chunks/ListBox.map +1 -0
- package/dist/chunks/ListIcon +21 -0
- package/dist/chunks/ListIcon.map +1 -0
- package/dist/chunks/ListItem +63 -0
- package/dist/chunks/ListItem.map +1 -0
- package/dist/chunks/ListLabelText +22 -0
- package/dist/chunks/ListLabelText.map +1 -0
- package/dist/chunks/ListMedia +15 -0
- package/dist/chunks/ListMedia.map +1 -0
- package/dist/chunks/ListOverlineText +21 -0
- package/dist/chunks/ListOverlineText.map +1 -0
- package/dist/chunks/ListSupportingText +22 -0
- package/dist/chunks/ListSupportingText.map +1 -0
- package/dist/chunks/Navigation +20 -20
- package/dist/chunks/NavigationScrollContainer +45 -32
- package/dist/chunks/NavigationScrollContainer.map +1 -1
- package/dist/chunks/Snackbar +18 -27
- package/dist/chunks/Snackbar.map +1 -1
- package/dist/chunks/types +6 -0
- package/dist/chunks/types.map +1 -0
- package/dist/components/Card/Card/Card.d.ts +2 -0
- package/dist/components/Card/Card/index.d.ts +2 -0
- package/dist/components/Card/Card/index.js +3 -0
- package/dist/components/Card/Card/types.d.ts +7 -0
- package/dist/components/Card/CardIcon/CardIcon.d.ts +2 -0
- package/dist/components/Card/CardIcon/index.d.ts +1 -0
- package/dist/components/Card/CardIcon/index.js +2 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Card/index.js +4 -0
- package/dist/components/List/ListAction/ListAction.d.ts +2 -0
- package/dist/components/List/ListAction/index.d.ts +1 -0
- package/dist/components/List/ListAction/index.js +0 -0
- package/dist/components/List/ListAvatar/ListAvatar.d.ts +1 -0
- package/dist/components/List/ListAvatar/index.d.ts +1 -0
- package/dist/components/List/ListAvatar/index.js +2 -0
- package/dist/components/List/ListBox/ListBox.d.ts +2 -0
- package/dist/components/List/ListBox/index.d.ts +2 -0
- package/dist/components/List/ListBox/index.js +2 -0
- package/dist/components/List/ListBox/types.d.ts +5 -0
- package/dist/components/List/ListIcon/ListIcon.d.ts +2 -0
- package/dist/components/List/ListIcon/index.d.ts +1 -0
- package/dist/components/List/ListIcon/index.js +2 -0
- package/dist/components/List/ListItem/ListItem.d.ts +2 -0
- package/dist/components/List/ListItem/index.d.ts +2 -0
- package/dist/components/List/ListItem/index.js +2 -0
- package/dist/components/List/ListItem/types.d.ts +9 -0
- package/dist/components/List/ListLabelText/ListLabelText.d.ts +2 -0
- package/dist/components/List/ListLabelText/index.d.ts +1 -0
- package/dist/components/List/ListLabelText/index.js +2 -0
- package/dist/components/List/ListMedia/ListMedia.d.ts +2 -0
- package/dist/components/List/ListMedia/index.d.ts +2 -0
- package/dist/components/List/ListMedia/index.js +2 -0
- package/dist/components/List/ListMedia/types.d.ts +10 -0
- package/dist/components/List/ListOverlineText/ListOverlineText.d.ts +2 -0
- package/dist/components/List/ListOverlineText/index.d.ts +1 -0
- package/dist/components/List/ListOverlineText/index.js +2 -0
- package/dist/components/List/ListSupportingText/ListSupportingText.d.ts +2 -0
- package/dist/components/List/ListSupportingText/index.d.ts +1 -0
- package/dist/components/List/ListSupportingText/index.js +2 -0
- package/dist/components/List/ListTrailingText/ListTrailingText.d.ts +2 -0
- package/dist/components/List/ListTrailingText/index.d.ts +1 -0
- package/dist/components/List/ListTrailingText/index.js +0 -0
- package/dist/components/List/index.d.ts +10 -0
- package/dist/components/List/index.js +9 -0
- package/dist/components/Navigation/NavigationState/context.d.ts +1 -1
- package/dist/components/Navigation/NavigationState/index.js +61 -2
- package/dist/components/Navigation/NavigationState/index.js.map +1 -0
- package/dist/components/Navigation/SubNavigation/SubNavigation/index.js +4 -4
- package/dist/components/Navigation/SubNavigation/SubNavigationTrigger/index.js +5 -5
- package/dist/components/Navigation/index.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +129 -115
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/NavigationState +0 -69
- package/dist/chunks/NavigationState.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["id","item","x","prev","depth","children"],"sources":["../../../../src/components/Navigation/NavigationState/context.ts","../../../../src/components/Navigation/NavigationState/NavigationState.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport type NavigationStateContextType = {\n openSubNavigation: (id: string, depth: number) => void;\n closeSubNavigation: (id: string) => void;\n saveNavigationScrollTopProgress: (id: string, progress: number) => void;\n\n isSubNavigationOpen: (id: string) => boolean;\n isInert: (depth: number) => boolean;\n\n getNavigationScrollProgress: (id: string) => number;\n};\n\nexport const NavigationStateContext =\n createContext<NavigationStateContextType | null>(null);\n\nexport function useNavigationState() {\n const ctx = useContext(NavigationStateContext);\n if (ctx === null) {\n throw new Error(\n \"Missing navigation state. Ensure this component is rendered within Navigation component.\"\n );\n }\n\n return ctx;\n}\n","import { type ReactNode, useCallback, useRef, useState } from \"react\";\nimport { NavigationStateContext } from \"./context\";\nimport type { NavScrollInfo, SubNavItem } from \"./types\";\n\nexport const NavigationState: React.FC<{ children?: ReactNode }> = ({\n children,\n}) => {\n const [openSubNavs, setOpenSubNavs] = useState<SubNavItem[]>([]);\n const navScrollRef = useRef<NavScrollInfo>({});\n\n const getNavigationScrollProgress = useCallback((id: string) => {\n return navScrollRef.current[id] ?? 0;\n }, []);\n\n const openSubNavigation = useCallback((id: string, depth: number) => {\n setOpenSubNavs((prev) => [\n ...prev.filter((item) => item.depth < depth),\n { id, depth },\n ]);\n }, []);\n\n const closeSubNavigation = useCallback(\n (id: string) => {\n const item = openSubNavs.find((x) => x.id === id);\n if (!item) {\n return;\n }\n\n const removedItems = openSubNavs.filter(\n (x) => x.depth >= item.depth\n );\n for (const removedItem of removedItems) {\n delete navScrollRef.current[removedItem.id];\n }\n\n setOpenSubNavs((prev) => prev.filter((x) => x.depth < item.depth));\n },\n [openSubNavs]\n );\n\n const saveNavigationScrollTopProgress = useCallback(\n (id: string, progress: number) => {\n navScrollRef.current[id] = progress;\n },\n []\n );\n\n const isSubNavigationOpen = useCallback(\n (id: string) => {\n return openSubNavs.some((item) => item.id === id);\n },\n [openSubNavs]\n );\n\n const isInert = useCallback(\n (depth: number) => {\n const activeDepth = openSubNavs[openSubNavs.length - 1]?.depth ?? 0;\n\n return depth < activeDepth;\n },\n [openSubNavs]\n );\n\n return (\n <NavigationStateContext\n value={{\n getNavigationScrollProgress,\n openSubNavigation,\n closeSubNavigation,\n saveNavigationScrollTopProgress,\n isSubNavigationOpen,\n isInert,\n }}\n >\n {children}\n </NavigationStateContext>\n );\n};\n"],"mappings":";;;;AAaA,IAAa,IACT,EAAiD,IAAI;AAEzD,SAAO,IAAA;CACH,IAAA,IAAY,EAAW,CAAsB;CAC7C,IAAI,MAAQ,MACR,MAAU,MACN,0FACJ;CACH,OAEM;AAAG;;;aCpBD,KAAsD,MAAA;CAAA,IAAA,KAAA,GAAA,EAAA,EAAA,CAAA,EAAA,GAAC,EAAA,gBAAA,GAEnE;CAAA,AAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,KACgE,IAAA,CAAA,GAAE,EAAA,KAAA,KAAA,IAAA,EAAA;CAA/D,IAAA,CAAA,GAAA,KAAsC,EAAuB,CAAE,GAAE;CAAA,AAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,KACtB,IAAA,CAAC,GAAC,EAAA,KAAA,KAAA,IAAA,EAAA;CAA7C,IAAA,IAAqB,EAAsB,CAAE,GAAE;CAAA,AAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,KAEC,KAAA,MACrC,EAAY,QAAS,MAArB,GACV,EAAA,KAAA,KAAA,IAAA,EAAA;CAFD,IAAA,IAAoC,GAE7B;CAAA,AAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,KAE+B,KAAA,GAAA,MAAA;EAClC,GAAe,MAAU,CAAA,GAClB,EAAI,QAAQ,MAAU,EAAI,QAAS,CAAK,GAC3C;GAAA,IAAEA;GAAE;EAAQ,CAAC,CAChB;CAAC,GACL,EAAA,KAAA,KAAA,IAAA,EAAA;CALD,IAAA,IAA0B,GAKnB;CAAA,AAAA,EAAA,OAAA,IAiBF,IAAA,EAAA,MAdD,KAAA,MAAA;EACI,IAAA,IAAa,EAAW,MAAM,MAAO,EAAC,OAAQA,CAAE;EAChD,IAAI,CAACC,GAAI;EAIT,IAAA,IAAqB,EAAW,QAC5B,MAAOC,EAAC,SAAUD,EAAI,KAC1B;EACA,KAAK,IAAA,KAAqB,GACtB,OAAO,EAAY,QAAS,EAAW;EAG3C,GAAe,MAAUE,EAAI,QAAQ,MAAOD,EAAC,QAASD,EAAI,KAAM,CAAC;CAAC,GACrE,EAAA,KAAA,GAAA,EAAA,KAAA;CAfL,IAAA,IAA2B,GAiBzB;CAAA,AAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,KAGE,KAAA,GAAA,MAAA;EACI,EAAY,QAASD,KAAM;CAAH,GAC3B,EAAA,KAAA,KAAA,IAAA,EAAA;CAHL,IAAA,IAAwC,GAKtC;CAAA,AAAA,EAAA,OAAA,IAKG,IAAA,EAAA,MAFD,KAAA,MACW,EAAW,MAAM,MAAUC,EAAI,OAAQD,CAAE,GACnD,EAAA,KAAA,GAAA,EAAA,KAAA;CAHL,IAAA,IAA4B,GAK1B;CAAA,AAAA,EAAA,OAAA,IAOG,IAAA,EAAA,OAJD,KAAA,MAGWI,KAFa,EAAY,EAAW,SAAU,EAAS,EAAA,SAA1C,IAGvB,EAAA,KAAA,GAAA,EAAA,MAAA;CALL,IAAA,IAAgB,GAOd;CAAA,AAAA,EAAA,QAAA,KAAA,EAAA,QAAA,KAAA,EAAA,QAAA,KAIa,IAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;CAOP,GAAC,EAAA,MAAA,GAAA,EAAA,MAAA,GAAA,EAAA,MAAA,GAAA,EAAA,MAAA,KAAA,IAAA,EAAA;CAAA,IAAA;CAGoB,OAHpB,EAAA,QAAA,KAAA,EAAA,QAAA,KARL,IAAA,kBAAC,GAAD;EACW,OAAA;EASN;CAVkB,CAAA,GAWE,EAAA,MAAA,GAAA,EAAA,MAAA,GAAA,EAAA,MAAA,KAAA,IAAA,EAAA,KAXzB;AAWyB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as e } from "../../../../chunks/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { t } from "../../../../chunks/NavigationScrollContainer";
|
|
3
3
|
import { t as n } from "../../../../chunks/base";
|
|
4
4
|
import { IconButton as r } from "../../../Button/IconButton/index.js";
|
|
5
5
|
import { useInDialog as i } from "../../../Dialog/core/index.js";
|
|
6
6
|
import { a, o, r as s, t as c } from "../../../../chunks/core8";
|
|
7
|
-
import {
|
|
7
|
+
import { useNavigationState as l } from "../../NavigationState/index.js";
|
|
8
8
|
import { r as u } from "../../../../chunks/Navigation";
|
|
9
9
|
import d from "clsx";
|
|
10
10
|
import { useContext as f } from "react";
|
|
@@ -18,7 +18,7 @@ import { createPortal as x } from "react-dom";
|
|
|
18
18
|
var S = e(), C = (e) => {
|
|
19
19
|
let C = (0, S.c)(30), w, T, E, D, O, k, A;
|
|
20
20
|
C[0] === e ? (w = C[1], T = C[2], E = C[3], D = C[4], O = C[5], k = C[6], A = C[7]) : ({className: T, label: D, children: w, inert: E, ref: k, style: A, ...O} = e, C[0] = e, C[1] = w, C[2] = T, C[3] = E, C[4] = D, C[5] = O, C[6] = k, C[7] = A);
|
|
21
|
-
let j = y(k), M = i(), { id: N, depth: P } = s(), { isInert: F, isSubNavigationOpen: I } =
|
|
21
|
+
let j = y(k), M = i(), { id: N, depth: P } = s(), { isInert: F, isSubNavigationOpen: I } = l(), { container: L } = u(), R = f(c), z = D ?? R;
|
|
22
22
|
if (L === null) return null;
|
|
23
23
|
let B;
|
|
24
24
|
C[8] === Symbol.for("react.memo_cache_sentinel") ? (B = {
|
|
@@ -55,7 +55,7 @@ var S = e(), C = (e) => {
|
|
|
55
55
|
"data-heading": !0,
|
|
56
56
|
children: z
|
|
57
57
|
})]
|
|
58
|
-
}), /* @__PURE__ */ p(
|
|
58
|
+
}), /* @__PURE__ */ p(t, { children: w })]
|
|
59
59
|
})
|
|
60
60
|
}), C[12] = w, C[13] = T, C[14] = P, C[15] = z, C[16] = E, C[17] = M, C[18] = F, C[19] = O, C[20] = A, C[21] = j, C[22] = H) : H = C[22];
|
|
61
61
|
let U;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as e } from "../../../../chunks/compiler-runtime";
|
|
2
|
-
import { r as t } from "../../../../chunks/
|
|
3
|
-
import {
|
|
2
|
+
import { n as t, r as n, t as r } from "../../../../chunks/core8";
|
|
3
|
+
import { useNavigationState as i } from "../../NavigationState/index.js";
|
|
4
4
|
import { jsx as a } from "react/jsx-runtime";
|
|
5
5
|
import { ButtonContext as o, DEFAULT_SLOT as s, Provider as c } from "react-aria-components";
|
|
6
6
|
//#region src/components/Navigation/SubNavigation/SubNavigationTrigger/SubNavigationTrigger.tsx
|
|
7
7
|
var l = e(), u = (e) => {
|
|
8
|
-
let u = (0, l.c)(29), { stateID: d, children: f, label: p } = e, m =
|
|
9
|
-
u[0] === p ? b = u[1] : (b = [
|
|
8
|
+
let u = (0, l.c)(29), { stateID: d, children: f, label: p } = e, m = n(), { openSubNavigation: h, closeSubNavigation: g, isSubNavigationOpen: _ } = i(), v = `${m.id}--${d}`, y = m.depth + 1, b;
|
|
9
|
+
u[0] === p ? b = u[1] : (b = [r, p], u[0] = p, u[1] = b);
|
|
10
10
|
let x;
|
|
11
|
-
u[2] !== y || u[3] !== v ? (x = [
|
|
11
|
+
u[2] !== y || u[3] !== v ? (x = [t, {
|
|
12
12
|
id: v,
|
|
13
13
|
depth: y
|
|
14
14
|
}], u[2] = y, u[3] = v, u[4] = x) : x = u[4];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavigationState as e, NavigationStateContext as t, useNavigationState as n } from "./NavigationState/index.js";
|
|
2
2
|
import { n as r, t as i } from "../../chunks/navContext";
|
|
3
3
|
import { n as a, r as o, t as s } from "../../chunks/Navigation";
|
|
4
4
|
import { NavigationButton as c } from "./NavigationItem/NavigationButton/index.js";
|
|
@@ -7,4 +7,4 @@ import { t as u } from "../../chunks/NavigationSection";
|
|
|
7
7
|
import { t as d } from "../../chunks/NavigationSectionLabel";
|
|
8
8
|
import { SubNavigation as f } from "./SubNavigation/SubNavigation/index.js";
|
|
9
9
|
import { SubNavigationTrigger as p } from "./SubNavigation/SubNavigationTrigger/index.js";
|
|
10
|
-
export { s as Navigation, c as NavigationButton, i as NavigationContext, l as NavigationLink, a as NavigationRenderingContext, u as NavigationSection, d as NavigationSectionLabel,
|
|
10
|
+
export { s as Navigation, c as NavigationButton, i as NavigationContext, l as NavigationLink, a as NavigationRenderingContext, u as NavigationSection, d as NavigationSectionLabel, e as NavigationState, t as NavigationStateContext, f as SubNavigation, p as SubNavigationTrigger, o as useNavigationContainer, r as useNavigationContext, n as useNavigationState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './components/AppBar';
|
|
2
2
|
export * from './components/Button';
|
|
3
3
|
export * from './components/Calendar';
|
|
4
|
+
export * from './components/Card';
|
|
4
5
|
export * from './components/Decorators';
|
|
5
6
|
export * from './components/Dialog';
|
|
6
7
|
export * from './components/Disclosure';
|
|
@@ -8,6 +9,7 @@ export * from './components/Divider';
|
|
|
8
9
|
export * from './components/Icon';
|
|
9
10
|
export * from './components/Image';
|
|
10
11
|
export * from './components/Input';
|
|
12
|
+
export * from './components/List';
|
|
11
13
|
export * from './components/Loader';
|
|
12
14
|
export * from './components/Menu';
|
|
13
15
|
export * from './components/Navigation';
|
package/dist/index.js
CHANGED
|
@@ -1,129 +1,143 @@
|
|
|
1
1
|
import { AppBarState as e, AppBarStateContext as t } from "./components/AppBar/AppBarState/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import { i as
|
|
5
|
-
import { t as
|
|
6
|
-
import { AppBarContext as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
import { n as
|
|
11
|
-
import { a as
|
|
12
|
-
import { ButtonGroupContext as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import { RichTooltipSubhead as
|
|
19
|
-
import { RichTooltipText as
|
|
20
|
-
import { t as
|
|
21
|
-
import { TooltipTrigger as
|
|
22
|
-
import { Button as
|
|
23
|
-
import { IconButton as
|
|
24
|
-
import { LinkButton as
|
|
25
|
-
import { LinkIconButton as
|
|
26
|
-
import { a as
|
|
27
|
-
import { t as
|
|
28
|
-
import { SplitButtonPrimary as
|
|
29
|
-
import { t as
|
|
30
|
-
import { ToggleButton as
|
|
31
|
-
import { ToggleIconButton as
|
|
32
|
-
import { t as
|
|
33
|
-
import { t as
|
|
34
|
-
import { t as
|
|
2
|
+
import { n, r } from "./chunks/NavigationScrollContainer";
|
|
3
|
+
import { n as ee, t as te } from "./chunks/tapTarget";
|
|
4
|
+
import { i as ne, n as i, r as a, t as o } from "./chunks/ThemeSelector";
|
|
5
|
+
import { t as s } from "./chunks/base";
|
|
6
|
+
import { AppBarContext as c, AppBarHeadlineBlockSize as l, AppBarHeadlineTypography as u, useAppBarContext as d } from "./components/AppBar/core/index.js";
|
|
7
|
+
import { t as f } from "./chunks/AppBar";
|
|
8
|
+
import { t as p } from "./chunks/Icon";
|
|
9
|
+
import { t as m } from "./chunks/Loader";
|
|
10
|
+
import { n as h, t as g } from "./chunks/useSplash";
|
|
11
|
+
import { a as _, c as v, d as y, f as b, i as x, l as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k } from "./chunks/core";
|
|
12
|
+
import { ButtonGroupContext as A, ConnectedButtonGroupContext as j, useButtonGroupContext as M, useConnectedButtonGroupContext as N } from "./components/Button/ButtonGroups/ButtonGroupContext/index.js";
|
|
13
|
+
import { t as P } from "./chunks/ButtonGroup";
|
|
14
|
+
import { t as F } from "./chunks/ConnectedButtonGroup";
|
|
15
|
+
import { t as I } from "./chunks/RichTooltip";
|
|
16
|
+
import { t as L } from "./chunks/RichTooltipActions";
|
|
17
|
+
import { t as R } from "./chunks/RichTooltipInfo";
|
|
18
|
+
import { RichTooltipSubhead as z } from "./components/Tooltip/RichTooltip/RichTooltipInfo/RichTooltipSubhead/index.js";
|
|
19
|
+
import { RichTooltipText as B } from "./components/Tooltip/RichTooltip/RichTooltipInfo/RichTooltipText/index.js";
|
|
20
|
+
import { t as V } from "./chunks/Tooltip";
|
|
21
|
+
import { TooltipTrigger as H } from "./components/Tooltip/TooltipTrigger/index.js";
|
|
22
|
+
import { Button as U } from "./components/Button/Button/index.js";
|
|
23
|
+
import { IconButton as W } from "./components/Button/IconButton/index.js";
|
|
24
|
+
import { LinkButton as G } from "./components/Button/LinkButton/index.js";
|
|
25
|
+
import { LinkIconButton as K } from "./components/Button/LinkIconButton/index.js";
|
|
26
|
+
import { a as q, i as J, n as Y, r as X, t as Z } from "./chunks/core2";
|
|
27
|
+
import { t as re } from "./chunks/SplitButton";
|
|
28
|
+
import { SplitButtonPrimary as ie } from "./components/Button/SplitButton/SplitButtonPrimary/index.js";
|
|
29
|
+
import { t as ae } from "./chunks/SplitButtonTrigger";
|
|
30
|
+
import { ToggleButton as oe } from "./components/Button/ToggleButton/index.js";
|
|
31
|
+
import { ToggleIconButton as se } from "./components/Button/ToggleIconButton/index.js";
|
|
32
|
+
import { t as ce } from "./chunks/AppBarAction";
|
|
33
|
+
import { t as le } from "./chunks/AppBarAvatar";
|
|
34
|
+
import { t as ue } from "./chunks/AppBarHeadline";
|
|
35
35
|
import "./components/AppBar/index.js";
|
|
36
|
-
import { Calendar as
|
|
37
|
-
import { RangeCalendar as
|
|
38
|
-
import { t as
|
|
39
|
-
import { t as
|
|
36
|
+
import { Calendar as de } from "./components/Calendar/Calendar/index.js";
|
|
37
|
+
import { RangeCalendar as fe } from "./components/Calendar/RangeCalendar/index.js";
|
|
38
|
+
import { t as pe } from "./chunks/Card";
|
|
39
|
+
import { n as me, t as he } from "./chunks/types";
|
|
40
|
+
import { t as ge } from "./chunks/CardIcon";
|
|
41
|
+
import "./components/Card/index.js";
|
|
42
|
+
import { t as _e } from "./chunks/GridBackgroundDecorator";
|
|
43
|
+
import { t as ve } from "./chunks/RadialGlowDecorator";
|
|
40
44
|
import "./components/Decorators/index.js";
|
|
41
|
-
import { DialogBodyTypography as
|
|
42
|
-
import { t as
|
|
43
|
-
import { t as
|
|
44
|
-
import { t as
|
|
45
|
-
import { t as
|
|
46
|
-
import { DisclosureTypographyContext as
|
|
47
|
-
import { t as
|
|
48
|
-
import { t as
|
|
49
|
-
import { t as
|
|
50
|
-
import { t as
|
|
45
|
+
import { DialogBodyTypography as ye, DialogContext as be, DialogHeadlineTypography as xe, DialogIconSize as Se, useInDialog as Ce } from "./components/Dialog/core/index.js";
|
|
46
|
+
import { t as we } from "./chunks/Dialog";
|
|
47
|
+
import { t as Te } from "./chunks/ActionDialog";
|
|
48
|
+
import { t as Ee } from "./chunks/Modal";
|
|
49
|
+
import { t as De } from "./chunks/ModalOverlay";
|
|
50
|
+
import { DisclosureTypographyContext as Oe, useDisclosureTypographyContext as ke } from "./components/Disclosure/context/index.js";
|
|
51
|
+
import { t as Ae } from "./chunks/Disclosure";
|
|
52
|
+
import { t as je } from "./chunks/DisclosureGroup";
|
|
53
|
+
import { t as Me } from "./chunks/DisclosureHeader";
|
|
54
|
+
import { t as Ne } from "./chunks/DisclosurePanel";
|
|
51
55
|
import "./components/Disclosure/index.js";
|
|
52
|
-
import { t as
|
|
53
|
-
import { Image as
|
|
54
|
-
import { n as
|
|
55
|
-
import { Description as
|
|
56
|
-
import { t as
|
|
57
|
-
import { Label as
|
|
58
|
-
import { DateField as
|
|
59
|
-
import { t as
|
|
60
|
-
import { n as
|
|
61
|
-
import { useControllableState as
|
|
62
|
-
import { DatePicker as
|
|
63
|
-
import { DateRangePicker as
|
|
64
|
-
import { n as
|
|
65
|
-
import { t as
|
|
66
|
-
import { n as
|
|
67
|
-
import { t as
|
|
68
|
-
import { t as
|
|
69
|
-
import { t as
|
|
70
|
-
import { Select as
|
|
71
|
-
import { a as
|
|
72
|
-
import { Menu as
|
|
73
|
-
import { MenuItem as
|
|
74
|
-
import { t as
|
|
75
|
-
import { MenuSection as
|
|
76
|
-
import { MenuSectionHeader as
|
|
77
|
-
import { MenuShortcut as
|
|
78
|
-
import { MenuTrailingText as
|
|
79
|
-
import { MenuTrigger as
|
|
80
|
-
import { t as
|
|
81
|
-
import { SelectItem as
|
|
82
|
-
import { SelectList as
|
|
83
|
-
import { SelectListSection as
|
|
84
|
-
import { SelectListSectionHeader as
|
|
85
|
-
import { t as
|
|
86
|
-
import { t as
|
|
87
|
-
import { a as
|
|
88
|
-
import { t as
|
|
89
|
-
import { t as
|
|
90
|
-
import { RangeSlider as
|
|
91
|
-
import { t as
|
|
92
|
-
import { t as
|
|
93
|
-
import { TextArea as
|
|
94
|
-
import { TimeField as
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import { t as
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
56
|
+
import { t as Pe } from "./chunks/Divider";
|
|
57
|
+
import { Image as Fe } from "./components/Image/index.js";
|
|
58
|
+
import { n as Ie, t as Le } from "./chunks/Input";
|
|
59
|
+
import { Description as Re } from "./components/Input/Description/index.js";
|
|
60
|
+
import { t as ze } from "./chunks/FieldError";
|
|
61
|
+
import { Label as Be } from "./components/Input/Label/index.js";
|
|
62
|
+
import { DateField as Ve } from "./components/Input/DateField/index.js";
|
|
63
|
+
import { t as He } from "./chunks/Popover";
|
|
64
|
+
import { n as Ue, t as We } from "./chunks/Input2";
|
|
65
|
+
import { useControllableState as Ge } from "./components/Input/hooks/index.js";
|
|
66
|
+
import { DatePicker as Ke } from "./components/Input/DatePicker/DatePicker/index.js";
|
|
67
|
+
import { DateRangePicker as qe } from "./components/Input/DatePicker/DateRangePicker/index.js";
|
|
68
|
+
import { n as Je, t as Ye } from "./chunks/Radio";
|
|
69
|
+
import { t as Xe } from "./chunks/SearchField";
|
|
70
|
+
import { n as Ze, r as Qe, t as $e } from "./chunks/Tag";
|
|
71
|
+
import { t as et } from "./chunks/ComboBox";
|
|
72
|
+
import { t as tt } from "./chunks/ComboBoxPopover";
|
|
73
|
+
import { t as nt } from "./chunks/ComboBoxTrigger";
|
|
74
|
+
import { Select as rt } from "./components/Input/Select/Select/index.js";
|
|
75
|
+
import { a as it, c as at, d as Q, f as ot, i as st, l as ct, n as lt, o as ut, p as dt, r as ft, s as pt, t as mt, u as ht } from "./chunks/core6";
|
|
76
|
+
import { Menu as gt } from "./components/Menu/Menu/index.js";
|
|
77
|
+
import { MenuItem as _t } from "./components/Menu/MenuItem/index.js";
|
|
78
|
+
import { t as vt } from "./chunks/MenuPopover";
|
|
79
|
+
import { MenuSection as yt } from "./components/Menu/MenuSection/index.js";
|
|
80
|
+
import { MenuSectionHeader as bt } from "./components/Menu/MenuSectionHeader/index.js";
|
|
81
|
+
import { MenuShortcut as xt } from "./components/Menu/MenuShortcut/index.js";
|
|
82
|
+
import { MenuTrailingText as St } from "./components/Menu/MenuTrailingText/index.js";
|
|
83
|
+
import { MenuTrigger as Ct } from "./components/Menu/MenuTrigger/index.js";
|
|
84
|
+
import { t as wt } from "./chunks/SubmenuPopover";
|
|
85
|
+
import { SelectItem as Tt } from "./components/Input/Select/SelectItem/index.js";
|
|
86
|
+
import { SelectList as Et } from "./components/Input/Select/SelectList/index.js";
|
|
87
|
+
import { SelectListSection as Dt } from "./components/Input/Select/SelectListSection/index.js";
|
|
88
|
+
import { SelectListSectionHeader as Ot } from "./components/Input/Select/SelectListSectionHeader/index.js";
|
|
89
|
+
import { t as kt } from "./chunks/SelectPopover";
|
|
90
|
+
import { t as At } from "./chunks/SelectTrigger";
|
|
91
|
+
import { a as jt, c as Mt, i as Nt, n as Pt, o as Ft, r as It, s as Lt, t as Rt } from "./chunks/core7";
|
|
92
|
+
import { t as zt } from "./chunks/SliderOutput";
|
|
93
|
+
import { t as Bt } from "./chunks/CenteredSlider";
|
|
94
|
+
import { RangeSlider as Vt } from "./components/Input/Slider/RangeSlider/index.js";
|
|
95
|
+
import { t as Ht } from "./chunks/Slider";
|
|
96
|
+
import { t as Ut } from "./chunks/Switch";
|
|
97
|
+
import { TextArea as Wt } from "./components/Input/TextArea/index.js";
|
|
98
|
+
import { TimeField as Gt } from "./components/Input/TimeField/index.js";
|
|
99
|
+
import { t as Kt } from "./chunks/ListAvatar";
|
|
100
|
+
import { t as qt } from "./chunks/ListBox";
|
|
101
|
+
import { t as Jt } from "./chunks/ListIcon";
|
|
102
|
+
import { t as Yt } from "./chunks/ListItem";
|
|
103
|
+
import { t as Xt } from "./chunks/ListLabelText";
|
|
104
|
+
import { a as Zt, i as Qt, n as $t, o as en, r as tn, s as nn, t as rn } from "./chunks/ListMedia";
|
|
105
|
+
import { t as an } from "./chunks/ListOverlineText";
|
|
106
|
+
import { t as on } from "./chunks/ListSupportingText";
|
|
107
|
+
import "./components/List/index.js";
|
|
108
|
+
import { NavigationState as sn, NavigationStateContext as cn, useNavigationState as ln } from "./components/Navigation/NavigationState/index.js";
|
|
109
|
+
import { n as un, t as dn } from "./chunks/navContext";
|
|
110
|
+
import { n as fn, r as pn, t as mn } from "./chunks/Navigation";
|
|
111
|
+
import { NavigationButton as hn } from "./components/Navigation/NavigationItem/NavigationButton/index.js";
|
|
112
|
+
import { NavigationLink as gn } from "./components/Navigation/NavigationItem/NavigationLink/index.js";
|
|
113
|
+
import { t as _n } from "./chunks/NavigationSection";
|
|
114
|
+
import { t as vn } from "./chunks/NavigationSectionLabel";
|
|
115
|
+
import { SubNavigation as yn } from "./components/Navigation/SubNavigation/SubNavigation/index.js";
|
|
116
|
+
import { SubNavigationTrigger as bn } from "./components/Navigation/SubNavigation/SubNavigationTrigger/index.js";
|
|
103
117
|
import "./components/Navigation/index.js";
|
|
104
|
-
import { n as
|
|
105
|
-
import { t as
|
|
106
|
-
import { n as
|
|
107
|
-
import { n as
|
|
118
|
+
import { n as xn, t as Sn } from "./chunks/BottomSheetModal";
|
|
119
|
+
import { t as Cn } from "./chunks/BottomSheet";
|
|
120
|
+
import { n as wn, t as Tn } from "./chunks/SideSheetModal";
|
|
121
|
+
import { n as En, t as Dn } from "./chunks/SideSheet";
|
|
108
122
|
import "./components/Sheets/index.js";
|
|
109
|
-
import { n as
|
|
110
|
-
import { t as
|
|
111
|
-
import { t as
|
|
112
|
-
import { t as
|
|
113
|
-
import { t as
|
|
114
|
-
import { t as
|
|
123
|
+
import { n as On, r as kn, t as An } from "./chunks/Snackbar";
|
|
124
|
+
import { t as jn } from "./chunks/Tab";
|
|
125
|
+
import { t as Mn } from "./chunks/TabList";
|
|
126
|
+
import { t as Nn } from "./chunks/TabPanel";
|
|
127
|
+
import { t as Pn } from "./chunks/TabPanels";
|
|
128
|
+
import { t as Fn } from "./chunks/Tabs";
|
|
115
129
|
import "./components/Tabs/index.js";
|
|
116
|
-
import { n as
|
|
117
|
-
import * as
|
|
130
|
+
import { n as In, t as Ln } from "./chunks/Toolbar";
|
|
131
|
+
import * as Rn from "zod";
|
|
118
132
|
import './assets/index.css';//#region src/utils/form/form.ts
|
|
119
|
-
var
|
|
133
|
+
var zn = (e, t) => {
|
|
120
134
|
let n = Object.fromEntries(new FormData(e)), r = t.safeParse(n);
|
|
121
135
|
return r.success ? {
|
|
122
136
|
success: !0,
|
|
123
137
|
data: r.data
|
|
124
138
|
} : {
|
|
125
139
|
success: !1,
|
|
126
|
-
errors:
|
|
140
|
+
errors: Rn.flattenError(r.error).fieldErrors
|
|
127
141
|
};
|
|
128
142
|
}, $ = {
|
|
129
143
|
"gradient-ambient-primary": "_gradient-ambient-primary_1aada_6",
|
|
@@ -141,7 +155,7 @@ var xn = (e, t) => {
|
|
|
141
155
|
"gradient-luster-soft": "_gradient-luster-soft_1aada_274",
|
|
142
156
|
"gradient-luster-metallic": "_gradient-luster-metallic_1aada_284",
|
|
143
157
|
"gradient-luster-deep": "_gradient-luster-deep_1aada_295"
|
|
144
|
-
},
|
|
158
|
+
}, Bn = {
|
|
145
159
|
AmbientPrimary: $["gradient-ambient-primary"],
|
|
146
160
|
AmbientSecondary: $["gradient-ambient-secondary"],
|
|
147
161
|
AmbientTertiary: $["gradient-ambient-tertiary"],
|
|
@@ -157,7 +171,7 @@ var xn = (e, t) => {
|
|
|
157
171
|
LusterSoft: $["gradient-luster-soft"],
|
|
158
172
|
LusterMetallic: $["gradient-luster-metallic"],
|
|
159
173
|
LusterDeep: $["gradient-luster-deep"]
|
|
160
|
-
},
|
|
174
|
+
}, Vn = {
|
|
161
175
|
displayLarge: "typography-display-large-fluid",
|
|
162
176
|
displayMedium: "typography-display-medium-fluid",
|
|
163
177
|
displaySmall: "typography-display-small-fluid",
|
|
@@ -166,6 +180,6 @@ var xn = (e, t) => {
|
|
|
166
180
|
headlineSmall: "typography-headline-small-fluid"
|
|
167
181
|
};
|
|
168
182
|
//#endregion
|
|
169
|
-
export {
|
|
183
|
+
export { Te as ActionDialog, Rt as ActiveTrackStyles, f as AppBar, ce as AppBarAction, le as AppBarAvatar, c as AppBarContext, ue as AppBarHeadline, l as AppBarHeadlineBlockSize, u as AppBarHeadlineTypography, e as AppBarState, t as AppBarStateContext, Ze as AvatarSize, Cn as BottomSheet, xn as BottomSheetContext, Sn as BottomSheetModal, U as Button, y as ButtonCore, P as ButtonGroup, A as ButtonGroupContext, x as ButtonIconSizeMapping, _ as ButtonLabelTextMapping, b as ButtonReset, w as ButtonSizeBase, de as Calendar, pe as Card, ge as CardIcon, he as CardIconSize, Bt as CenteredSlider, Ie as Checkbox, Le as CheckboxGroup, et as ComboBox, tt as ComboBoxPopover, nt as ComboBoxTrigger, E as ConnectedButton, F as ConnectedButtonGroup, j as ConnectedButtonGroupContext, Ve as DateField, Ke as DatePicker, qe as DateRangePicker, Re as Description, we as Dialog, ye as DialogBodyTypography, be as DialogContext, xe as DialogHeadlineTypography, Se as DialogIconSize, Ae as Disclosure, je as DisclosureGroup, Me as DisclosureHeader, Ne as DisclosurePanel, Oe as DisclosureTypographyContext, Pe as Divider, ze as FieldError, _e as GridBackgroundDecorator, p as Icon, W as IconButton, D as IconButtonIconSizeMapping, Fe as Image, Pt as InactiveTrackStyles, We as Input, Ue as InputButton, Be as Label, G as LinkButton, K as LinkIconButton, Kt as ListAvatar, qt as ListBox, Jt as ListIcon, Yt as ListItem, Xt as ListLabelText, nn as ListMedia, rn as ListMediaImageHeight, $t as ListMediaImageWidth, tn as ListMediaLargeVideoHeight, Qt as ListMediaLargeVideoWidth, Zt as ListMediaVideoHeight, en as ListMediaVideoWidth, an as ListOverlineText, on as ListSupportingText, m as Loader, gt as Menu, pt as MenuBaseLayout, _t as MenuItem, at as MenuItemIconSize, mt as MenuItemLeadingStyles, lt as MenuItemStyles, ft as MenuItemTrailingStyles, vt as MenuPopover, yt as MenuSection, bt as MenuSectionHeader, st as MenuSectionHeaderStyles, it as MenuSectionStyles, xt as MenuShortcut, ut as MenuStyles, St as MenuTrailingText, Ct as MenuTrigger, Ee as Modal, De as ModalOverlay, mn as Navigation, hn as NavigationButton, dn as NavigationContext, gn as NavigationLink, fn as NavigationRenderingContext, _n as NavigationSection, vn as NavigationSectionLabel, sn as NavigationState, cn as NavigationStateContext, me as PaddingBetweenCards, He as Popover, ve as RadialGlowDecorator, Je as Radio, Ye as RadioGroup, fe as RangeCalendar, Vt as RangeSlider, I as RichTooltip, L as RichTooltipActions, R as RichTooltipInfo, z as RichTooltipSubhead, B as RichTooltipText, Xe as SearchField, rt as Select, Tt as SelectItem, Et as SelectList, Dt as SelectListSection, Ot as SelectListSectionHeader, kt as SelectPopover, At as SelectTrigger, Dn as SideSheet, wn as SideSheetContext, En as SideSheetDialog, Tn as SideSheetModal, Ht as Slider, Mt as SliderColors, zt as SliderOutput, Nt as SliderSizeStyles, jt as SliderStyles, On as SnackbarQueueContext, An as SnackbarRegion, h as Splash, re as SplitButton, ie as SplitButtonPrimary, Z as SplitButtonPrimaryBase, ae as SplitButtonTrigger, Y as SplitButtonTriggerBase, X as SplitButtonTriggerIconSize, J as SplitButtonVariantBase, yn as SubNavigation, bn as SubNavigationTrigger, wt as SubmenuPopover, Ut as Switch, jn as Tab, Mn as TabList, Nn as TabPanel, Pn as TabPanels, Fn as Tabs, $e as Tag, Qe as TagIconSize, te as TapTarget, ee as TapTargetBefore, Wt as TextArea, i as ThemeProvider, o as ThemeSelector, Gt as TimeField, oe as ToggleButton, se as ToggleIconButton, In as Toolbar, Ln as ToolbarToggleButtonGroup, V as Tooltip, H as TooltipTrigger, Ft as TrackContainerStyles, Lt as TrackStyles, It as VisualTrackStyles, ne as buildThemeString, S as buttonColorBase, k as buttonColorConfig, v as buttonSizeConfig, Vn as fluidTypography, n as getScrollProgress, r as getScrollTopFromProgress, Bn as gradientStyles, ht as menuBaseColor, Q as menuColorConfig, ot as menuItemBaseColor, dt as menuItemLabelColor, ct as menuLayoutConfig, T as newButtonBaseDataAttrs, q as splitButtonSizeConfig, s as typography, d as useAppBarContext, C as useButtonConfig, M as useButtonGroupContext, N as useConnectedButtonGroupContext, Ge as useControllableState, ke as useDisclosureTypographyContext, Ce as useInDialog, pn as useNavigationContainer, un as useNavigationContext, ln as useNavigationState, kn as useSnackbarQueue, g as useSplash, a as useTheme, zn as validateAndGetFormValues, O as withTooltip };
|
|
170
184
|
|
|
171
185
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/utils/form/form.ts","../src/utils/gradients/gradients.module.css","../src/utils/gradients/gradients.ts","../src/utils/typography/fluid.ts"],"sourcesContent":["import * as z from \"zod\";\n\ninterface FormValidateSuccessResult<T> {\n success: true;\n data: T;\n}\n\ninterface FormValidateFailureResult<T> {\n success: false;\n errors: Partial<Record<keyof T, string | string[]>>;\n}\n\ntype FormValidateResult<T> =\n | FormValidateSuccessResult<T>\n | FormValidateFailureResult<T>;\n\nexport type ValidateAndGetFormValues = <T extends z.ZodTypeAny>(\n formElement: HTMLFormElement,\n schema: T\n) => FormValidateResult<z.infer<T>>;\n\nexport const validateAndGetFormValues: ValidateAndGetFormValues = (\n formElement,\n schema\n) => {\n const valueObject = Object.fromEntries(new FormData(formElement));\n const result = schema.safeParse(valueObject);\n if (result.success) {\n return {\n success: true,\n data: result.data,\n };\n }\n\n return {\n success: false,\n errors: z.flattenError(result.error).fieldErrors,\n };\n};\n","@layer adgytec.comps {\n /* ==========================================================================\n 1. Ambient Diagonal Gradients (Soft Color Wash)\n ========================================================================== */\n\n .gradient-ambient-primary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n .gradient-ambient-secondary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n .gradient-ambient-tertiary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n .gradient-ambient-alt {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n /* ==========================================================================\n 2. Split Tint Top-Glow (Vertical Accent)\n ========================================================================== */\n\n .gradient-glow-primary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-glow-secondary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-glow-tertiary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-glow-alt {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n /* ==========================================================================\n 3. Corner Radial Glows (Soft Blend)\n ========================================================================== */\n\n .gradient-corner-primary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(in srgb, var(--md-sys-color-primary) 11%, transparent)\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 8%,\n transparent\n )\n 0%,\n transparent 70%\n );\n }\n\n .gradient-corner-secondary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 11%,\n transparent\n )\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(in srgb, var(--md-sys-color-tertiary) 8%, transparent)\n 0%,\n transparent 70%\n );\n }\n\n .gradient-corner-tertiary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 11%,\n transparent\n )\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 8%,\n transparent\n )\n 0%,\n transparent 70%\n );\n }\n\n .gradient-corner-alt {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 11%,\n transparent\n )\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent)\n 0%,\n transparent 70%\n );\n }\n\n /* ==========================================================================\n 4. Monochromatic Surface Lusters (Colorless)\n ========================================================================== */\n\n .gradient-luster-soft {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n var(--md-sys-color-surface-container) 0%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-luster-metallic {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n var(--md-sys-color-surface-bright) 0%,\n var(--md-sys-color-surface-container) 50%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-luster-deep {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 145deg,\n var(--md-sys-color-surface-container-high) 0%,\n var(--md-sys-color-surface-container) 60%,\n var(--md-sys-color-surface-container-lowest) 100%\n );\n }\n}\n","import styles from \"./gradients.module.css\";\n\nexport const gradientStyles = {\n // 1. Ambient Diagonal Gradients (Very Low Opacity)\n AmbientPrimary: styles[\"gradient-ambient-primary\"],\n AmbientSecondary: styles[\"gradient-ambient-secondary\"],\n AmbientTertiary: styles[\"gradient-ambient-tertiary\"],\n AmbientAlt: styles[\"gradient-ambient-alt\"],\n\n // 2. Split Tint Top-Glow (Vertical Accent)\n GlowPrimary: styles[\"gradient-glow-primary\"],\n GlowSecondary: styles[\"gradient-glow-secondary\"],\n GlowTertiary: styles[\"gradient-glow-tertiary\"],\n GlowAlt: styles[\"gradient-glow-alt\"],\n\n // 3. Subtle Corner Radial Glows\n CornerPrimary: styles[\"gradient-corner-primary\"],\n CornerSecondary: styles[\"gradient-corner-secondary\"],\n CornerTertiary: styles[\"gradient-corner-tertiary\"],\n CornerAlt: styles[\"gradient-corner-alt\"],\n\n // 4. Monochromatic Surface Lusters (Colorless)\n LusterSoft: styles[\"gradient-luster-soft\"],\n LusterMetallic: styles[\"gradient-luster-metallic\"],\n LusterDeep: styles[\"gradient-luster-deep\"],\n} as const;\n","export const fluidTypography = {\n displayLarge: \"typography-display-large-fluid\",\n displayMedium: \"typography-display-medium-fluid\",\n displaySmall: \"typography-display-small-fluid\",\n\n headlineLarge: \"typography-headline-large-fluid\",\n headlineMedium: \"typography-headline-medium-fluid\",\n headlineSmall: \"typography-headline-small-fluid\",\n} as const;\n\nexport type FluidTypographyVariant =\n (typeof fluidTypography)[keyof typeof fluidTypography];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,MACT,GACA,MACC;CACD,IAAM,IAAc,OAAO,YAAY,IAAI,SAAS,CAAW,CAAC,GAC1D,IAAS,EAAO,UAAU,CAAW;CAQ3C,OAPI,EAAO,UACA;EACH,SAAS;EACT,MAAM,EAAO;CACjB,IAGG;EACH,SAAS;EACT,QAAQ,GAAE,aAAa,EAAO,KAAK,CAAC,CAAC;CACzC;AACJ;;;;;;;;;;;;;;;;GEpCa,KAAiB;CAE1B,gBAAgB,EAAO;CACvB,kBAAkB,EAAO;CACzB,iBAAiB,EAAO;CACxB,YAAY,EAAO;CAGnB,aAAa,EAAO;CACpB,eAAe,EAAO;CACtB,cAAc,EAAO;CACrB,SAAS,EAAO;CAGhB,eAAe,EAAO;CACtB,iBAAiB,EAAO;CACxB,gBAAgB,EAAO;CACvB,WAAW,EAAO;CAGlB,YAAY,EAAO;CACnB,gBAAgB,EAAO;CACvB,YAAY,EAAO;AACvB,GCzBa,KAAkB;CAC3B,cAAc;CACd,eAAe;CACf,cAAc;CAEd,eAAe;CACf,gBAAgB;CAChB,eAAe;AACnB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/utils/form/form.ts","../src/utils/gradients/gradients.module.css","../src/utils/gradients/gradients.ts","../src/utils/typography/fluid.ts"],"sourcesContent":["import * as z from \"zod\";\n\ninterface FormValidateSuccessResult<T> {\n success: true;\n data: T;\n}\n\ninterface FormValidateFailureResult<T> {\n success: false;\n errors: Partial<Record<keyof T, string | string[]>>;\n}\n\ntype FormValidateResult<T> =\n | FormValidateSuccessResult<T>\n | FormValidateFailureResult<T>;\n\nexport type ValidateAndGetFormValues = <T extends z.ZodTypeAny>(\n formElement: HTMLFormElement,\n schema: T\n) => FormValidateResult<z.infer<T>>;\n\nexport const validateAndGetFormValues: ValidateAndGetFormValues = (\n formElement,\n schema\n) => {\n const valueObject = Object.fromEntries(new FormData(formElement));\n const result = schema.safeParse(valueObject);\n if (result.success) {\n return {\n success: true,\n data: result.data,\n };\n }\n\n return {\n success: false,\n errors: z.flattenError(result.error).fieldErrors,\n };\n};\n","@layer adgytec.comps {\n /* ==========================================================================\n 1. Ambient Diagonal Gradients (Soft Color Wash)\n ========================================================================== */\n\n .gradient-ambient-primary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n .gradient-ambient-secondary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n .gradient-ambient-tertiary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n .gradient-ambient-alt {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 10%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 7%,\n var(--md-sys-color-surface-container-low)\n )\n 100%\n );\n }\n\n /* ==========================================================================\n 2. Split Tint Top-Glow (Vertical Accent)\n ========================================================================== */\n\n .gradient-glow-primary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-primary) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-glow-secondary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-glow-tertiary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-glow-alt {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 180deg,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 12%,\n var(--md-sys-color-surface-container-low)\n )\n 0%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 3%,\n var(--md-sys-color-surface-container-low)\n )\n 45%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n /* ==========================================================================\n 3. Corner Radial Glows (Soft Blend)\n ========================================================================== */\n\n .gradient-corner-primary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(in srgb, var(--md-sys-color-primary) 11%, transparent)\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 8%,\n transparent\n )\n 0%,\n transparent 70%\n );\n }\n\n .gradient-corner-secondary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-secondary) 11%,\n transparent\n )\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(in srgb, var(--md-sys-color-tertiary) 8%, transparent)\n 0%,\n transparent 70%\n );\n }\n\n .gradient-corner-tertiary {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(\n in srgb,\n var(--md-sys-color-tertiary) 11%,\n transparent\n )\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 8%,\n transparent\n )\n 0%,\n transparent 70%\n );\n }\n\n .gradient-corner-alt {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image:\n radial-gradient(\n circle at 0% 0%,\n color-mix(\n in srgb,\n var(--md-extended-color-primary-alt-color) 11%,\n transparent\n )\n 0%,\n transparent 70%\n ),\n radial-gradient(\n circle at 100% 100%,\n color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent)\n 0%,\n transparent 70%\n );\n }\n\n /* ==========================================================================\n 4. Monochromatic Surface Lusters (Colorless)\n ========================================================================== */\n\n .gradient-luster-soft {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n var(--md-sys-color-surface-container) 0%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-luster-metallic {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 135deg,\n var(--md-sys-color-surface-bright) 0%,\n var(--md-sys-color-surface-container) 50%,\n var(--md-sys-color-surface-container-low) 100%\n );\n }\n\n .gradient-luster-deep {\n background-color: var(--md-sys-color-surface-container-low);\n color: var(--md-sys-color-on-surface);\n background-image: linear-gradient(\n 145deg,\n var(--md-sys-color-surface-container-high) 0%,\n var(--md-sys-color-surface-container) 60%,\n var(--md-sys-color-surface-container-lowest) 100%\n );\n }\n}\n","import styles from \"./gradients.module.css\";\n\nexport const gradientStyles = {\n // 1. Ambient Diagonal Gradients (Very Low Opacity)\n AmbientPrimary: styles[\"gradient-ambient-primary\"],\n AmbientSecondary: styles[\"gradient-ambient-secondary\"],\n AmbientTertiary: styles[\"gradient-ambient-tertiary\"],\n AmbientAlt: styles[\"gradient-ambient-alt\"],\n\n // 2. Split Tint Top-Glow (Vertical Accent)\n GlowPrimary: styles[\"gradient-glow-primary\"],\n GlowSecondary: styles[\"gradient-glow-secondary\"],\n GlowTertiary: styles[\"gradient-glow-tertiary\"],\n GlowAlt: styles[\"gradient-glow-alt\"],\n\n // 3. Subtle Corner Radial Glows\n CornerPrimary: styles[\"gradient-corner-primary\"],\n CornerSecondary: styles[\"gradient-corner-secondary\"],\n CornerTertiary: styles[\"gradient-corner-tertiary\"],\n CornerAlt: styles[\"gradient-corner-alt\"],\n\n // 4. Monochromatic Surface Lusters (Colorless)\n LusterSoft: styles[\"gradient-luster-soft\"],\n LusterMetallic: styles[\"gradient-luster-metallic\"],\n LusterDeep: styles[\"gradient-luster-deep\"],\n} as const;\n","export const fluidTypography = {\n displayLarge: \"typography-display-large-fluid\",\n displayMedium: \"typography-display-medium-fluid\",\n displaySmall: \"typography-display-small-fluid\",\n\n headlineLarge: \"typography-headline-large-fluid\",\n headlineMedium: \"typography-headline-medium-fluid\",\n headlineSmall: \"typography-headline-small-fluid\",\n} as const;\n\nexport type FluidTypographyVariant =\n (typeof fluidTypography)[keyof typeof fluidTypography];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,MACT,GACA,MACC;CACD,IAAM,IAAc,OAAO,YAAY,IAAI,SAAS,CAAW,CAAC,GAC1D,IAAS,EAAO,UAAU,CAAW;CAQ3C,OAPI,EAAO,UACA;EACH,SAAS;EACT,MAAM,EAAO;CACjB,IAGG;EACH,SAAS;EACT,QAAQ,GAAE,aAAa,EAAO,KAAK,CAAC,CAAC;CACzC;AACJ;;;;;;;;;;;;;;;;GEpCa,KAAiB;CAE1B,gBAAgB,EAAO;CACvB,kBAAkB,EAAO;CACzB,iBAAiB,EAAO;CACxB,YAAY,EAAO;CAGnB,aAAa,EAAO;CACpB,eAAe,EAAO;CACtB,cAAc,EAAO;CACrB,SAAS,EAAO;CAGhB,eAAe,EAAO;CACtB,iBAAiB,EAAO;CACxB,gBAAgB,EAAO;CACvB,WAAW,EAAO;CAGlB,YAAY,EAAO;CACnB,gBAAgB,EAAO;CACvB,YAAY,EAAO;AACvB,GCzBa,KAAkB;CAC3B,cAAc;CACd,eAAe;CACf,cAAc;CAEd,eAAe;CACf,gBAAgB;CAChB,eAAe;AACnB"}
|
package/package.json
CHANGED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createContext as e, useCallback as t, useContext as n, useRef as r, useState as i } from "react";
|
|
2
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
-
//#region src/utils/scroll/scroll.ts
|
|
4
|
-
function o({ scrollHeight: e, scrollTop: t, clientHeight: n }) {
|
|
5
|
-
let r = e - n;
|
|
6
|
-
return r <= 0 ? 0 : t / r;
|
|
7
|
-
}
|
|
8
|
-
function s({ scrollHeight: e, progress: t, clientHeight: n }) {
|
|
9
|
-
return t * (e - n);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/components/Navigation/NavigationState/context.ts
|
|
13
|
-
var c = e(null);
|
|
14
|
-
function l() {
|
|
15
|
-
let e = n(c);
|
|
16
|
-
if (e === null) throw Error("Missing navigation state. Ensure this component is rendered within Navigation component.");
|
|
17
|
-
return e;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/components/Navigation/NavigationState/NavigationState.tsx
|
|
21
|
-
var u = ({ children: e }) => {
|
|
22
|
-
let [n, o] = i([]), l = r({}), u = r({}), d = t((e, t) => {
|
|
23
|
-
let n = l.current[e] ?? 0;
|
|
24
|
-
return t.scrollTop = s({
|
|
25
|
-
scrollHeight: t.scrollHeight,
|
|
26
|
-
clientHeight: t.clientHeight,
|
|
27
|
-
progress: n
|
|
28
|
-
}), u.current[e] ??= /* @__PURE__ */ new Set(), u.current[e].add(t), () => {
|
|
29
|
-
u.current[e]?.delete(t), u.current[e]?.size === 0 && delete u.current[e];
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
return /* @__PURE__ */ a(c, {
|
|
33
|
-
value: {
|
|
34
|
-
openSubNavigation: t((e, t) => {
|
|
35
|
-
o((n) => [...n.filter((e) => e.depth < t), {
|
|
36
|
-
id: e,
|
|
37
|
-
depth: t
|
|
38
|
-
}]);
|
|
39
|
-
}, []),
|
|
40
|
-
closeSubNavigation: t((e) => {
|
|
41
|
-
let t = n.find((t) => t.id === e);
|
|
42
|
-
if (!t) return;
|
|
43
|
-
let r = n.filter((e) => e.depth >= t.depth);
|
|
44
|
-
for (let e of r) delete l.current[e.id];
|
|
45
|
-
o((e) => e.filter((e) => e.depth < t.depth));
|
|
46
|
-
}, [n]),
|
|
47
|
-
saveNavigationScrollTopProgress: t((e, t) => {
|
|
48
|
-
l.current[e] = t;
|
|
49
|
-
let n = u.current[e];
|
|
50
|
-
if (n) for (let e of n) {
|
|
51
|
-
let n = s({
|
|
52
|
-
scrollHeight: e.scrollHeight,
|
|
53
|
-
clientHeight: e.clientHeight,
|
|
54
|
-
progress: t
|
|
55
|
-
});
|
|
56
|
-
Math.abs(e.scrollTop - n) > 1 && (e.scrollTop = n);
|
|
57
|
-
}
|
|
58
|
-
}, []),
|
|
59
|
-
registerNavigationContainer: d,
|
|
60
|
-
isSubNavigationOpen: t((e) => n.some((t) => t.id === e), [n]),
|
|
61
|
-
isInert: t((e) => e < (n[n.length - 1]?.depth ?? 0), [n])
|
|
62
|
-
},
|
|
63
|
-
children: e
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
//#endregion
|
|
67
|
-
export { s as a, o as i, c as n, l as r, u as t };
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=NavigationState.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationState","names":["id","item","x","prev","progress","container","depth"],"sources":["../../src/utils/scroll/scroll.ts","../../src/components/Navigation/NavigationState/context.ts","../../src/components/Navigation/NavigationState/NavigationState.tsx"],"sourcesContent":["export function getScrollProgress({\n scrollHeight,\n scrollTop,\n clientHeight,\n}: {\n scrollTop: number;\n scrollHeight: number;\n clientHeight: number;\n}): number {\n const maxScrollTop = scrollHeight - clientHeight;\n return maxScrollTop <= 0 ? 0 : scrollTop / maxScrollTop;\n}\nexport function getScrollTopFromProgress({\n scrollHeight,\n progress,\n clientHeight,\n}: {\n progress: number;\n scrollHeight: number;\n clientHeight: number;\n}): number {\n const maxScrollTop = scrollHeight - clientHeight;\n return progress * maxScrollTop;\n}\n","import { createContext, useContext } from \"react\";\n\nexport type NavigationStateContextType = {\n openSubNavigation: (id: string, depth: number) => void;\n closeSubNavigation: (id: string) => void;\n saveNavigationScrollTopProgress: (id: string, progress: number) => void;\n registerNavigationContainer: (\n id: string,\n container: HTMLDivElement\n ) => () => void;\n\n isSubNavigationOpen: (id: string) => boolean;\n isInert: (depth: number) => boolean;\n};\n\nexport const NavigationStateContext =\n createContext<NavigationStateContextType | null>(null);\n\nexport function useNavigationState() {\n const ctx = useContext(NavigationStateContext);\n if (ctx === null) {\n throw new Error(\n \"Missing navigation state. Ensure this component is rendered within Navigation component.\"\n );\n }\n\n return ctx;\n}\n","import { type ReactNode, useCallback, useRef, useState } from \"react\";\nimport { getScrollTopFromProgress } from \"@/utils\";\nimport { NavigationStateContext } from \"./context\";\nimport type { NavScrollInfo, SubNavItem } from \"./types\";\n\nexport const NavigationState: React.FC<{ children?: ReactNode }> = ({\n children,\n}) => {\n const [openSubNavs, setOpenSubNavs] = useState<SubNavItem[]>([]);\n const navScrollRef = useRef<NavScrollInfo>({});\n const navContainersRef = useRef<Record<string, Set<HTMLDivElement>>>({});\n\n const registerNavigationContainer = useCallback(\n (id: string, container: HTMLDivElement) => {\n const progress = navScrollRef.current[id] ?? 0;\n\n container.scrollTop = getScrollTopFromProgress({\n scrollHeight: container.scrollHeight,\n clientHeight: container.clientHeight,\n progress,\n });\n\n navContainersRef.current[id] ??= new Set();\n navContainersRef.current[id].add(container);\n\n return () => {\n navContainersRef.current[id]?.delete(container);\n\n if (navContainersRef.current[id]?.size === 0) {\n delete navContainersRef.current[id];\n }\n };\n },\n []\n );\n\n const openSubNavigation = useCallback((id: string, depth: number) => {\n setOpenSubNavs((prev) => [\n ...prev.filter((item) => item.depth < depth),\n { id, depth },\n ]);\n }, []);\n\n const closeSubNavigation = useCallback(\n (id: string) => {\n const item = openSubNavs.find((x) => x.id === id);\n if (!item) {\n return;\n }\n\n const removedItems = openSubNavs.filter(\n (x) => x.depth >= item.depth\n );\n for (const removedItem of removedItems) {\n delete navScrollRef.current[removedItem.id];\n }\n\n setOpenSubNavs((prev) => prev.filter((x) => x.depth < item.depth));\n },\n [openSubNavs]\n );\n\n const saveNavigationScrollTopProgress = useCallback(\n (id: string, progress: number) => {\n navScrollRef.current[id] = progress;\n\n const containers = navContainersRef.current[id];\n\n if (!containers) {\n return;\n }\n\n for (const container of containers) {\n const targetScrollTop = getScrollTopFromProgress({\n scrollHeight: container.scrollHeight,\n clientHeight: container.clientHeight,\n progress,\n });\n\n if (Math.abs(container.scrollTop - targetScrollTop) > 1) {\n container.scrollTop = targetScrollTop;\n }\n }\n },\n []\n );\n\n const isSubNavigationOpen = useCallback(\n (id: string) => {\n return openSubNavs.some((item) => item.id === id);\n },\n [openSubNavs]\n );\n\n const isInert = useCallback(\n (depth: number) => {\n const activeDepth = openSubNavs[openSubNavs.length - 1]?.depth ?? 0;\n\n return depth < activeDepth;\n },\n [openSubNavs]\n );\n\n return (\n <NavigationStateContext\n value={{\n openSubNavigation,\n closeSubNavigation,\n saveNavigationScrollTopProgress,\n registerNavigationContainer,\n isSubNavigationOpen,\n isInert,\n }}\n >\n {children}\n </NavigationStateContext>\n );\n};\n"],"mappings":";;;AAAA,SAAgB,EAAkB,EAC9B,iBACA,cACA,mBAKO;CACP,IAAM,IAAe,IAAe;CACpC,OAAO,KAAgB,IAAI,IAAI,IAAY;AAC/C;AACA,SAAgB,EAAyB,EACrC,iBACA,aACA,mBAKO;CAEP,OAAO,KADc,IAAe;AAExC;;;ACRA,IAAa,IACT,EAAiD,IAAI;AAEzD,SAAO,IAAA;CACH,IAAA,IAAY,EAAW,CAAsB;CAC7C,IAAI,MAAQ,MACR,MAAU,MACN,0FACJ;CACH,OAEM;AAAG;;;ACrBd,IAAa,KAAuD,EAChE,kBACE;CACF,IAAM,CAAC,GAAa,KAAkB,EAAuB,CAAA,CAAE,GACzD,IAAe,EAAsB,CAAC,CAAC,GACvC,IAAmB,EAA4C,CAAC,CAAC,GAEjE,IAA8B,GAC/B,GAAY,MAA8B;EACvC,IAAM,IAAW,EAAa,QAAQ,MAAO;EAW7C,OATA,EAAU,YAAY,EAAyB;GAC3C,cAAc,EAAU;GACxB,cAAc,EAAU;GACxB;EACJ,CAAC,GAED,EAAiB,QAAQ,uBAAQ,IAAI,IAAI,GACzC,EAAiB,QAAQ,EAAG,CAAC,IAAI,CAAS,SAE7B;GAGT,AAFA,EAAiB,QAAQ,EAAG,EAAE,OAAO,CAAS,GAE1C,EAAiB,QAAQ,EAAG,EAAE,SAAS,KACvC,OAAO,EAAiB,QAAQ;EAExC;CACJ,GACA,CAAA,CACJ;CAqEA,OACI,kBAAC,GAAD;EACI,OAAO;GACH,mBAtEc,GAAaA,GAAY,MAAkB;IACjE,GAAgB,MAAS,CACrB,GAAG,EAAK,QAAQ,MAAS,EAAK,QAAQ,CAAK,GAC3C;KAAE,IAAAA;KAAI;IAAM,CAAC,CAChB;GACL,GAAG,CAAA,CAiES;GACA,oBAhEe,GACtBA,MAAe;IACZ,IAAMC,IAAO,EAAY,MAAM,MAAM,EAAE,OAAOD,CAAE;IAChD,IAAI,CAACC,GACD;IAGJ,IAAM,IAAe,EAAY,QAC5BC,MAAMA,EAAE,SAASD,EAAK,KAC3B;IACA,KAAK,IAAM,KAAe,GACtB,OAAO,EAAa,QAAQ,EAAY;IAG5C,GAAgBE,MAASA,EAAK,QAAQD,MAAMA,EAAE,QAAQD,EAAK,KAAK,CAAC;GACrE,GACA,CAAC,CAAW,CAgDJ;GACA,iCA9C4B,GACnCD,GAAYI,MAAqB;IAC9B,EAAa,QAAQJ,KAAMI;IAE3B,IAAM,IAAa,EAAiB,QAAQJ;IAEvC,OAIL,KAAK,IAAMK,KAAa,GAAY;KAChC,IAAM,IAAkB,EAAyB;MAC7C,cAAcA,EAAU;MACxB,cAAcA,EAAU;MACxB,UAAAD;KACJ,CAAC;KAED,AAAI,KAAK,IAAIC,EAAU,YAAY,CAAe,IAAI,MAClDA,EAAU,YAAY;IAE9B;GACJ,GACA,CAAA,CAwBQ;GACA;GACA,qBAvBgB,GACvBL,MACU,EAAY,MAAMC,MAASA,EAAK,OAAOD,CAAE,GAEpD,CAAC,CAAW,CAmBJ;GACA,SAjBI,GACXM,MAGUA,KAFa,EAAY,EAAY,SAAS,EAAE,EAAE,SAAS,IAItE,CAAC,CAAW,CAWJ;EACJ;EAEC;CACmB,CAAA;AAEhC"}
|