@12-apps/ui 6.75.0 → 6.76.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/_internal/components/form/Textarea/Textarea.js +1 -1
- package/dist/_internal/components/form/index.js +1 -1
- package/dist/_internal/components/index.js +1 -1
- package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.items.js +3 -3
- package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.js +8 -8
- package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.rail.js +4 -4
- package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.styles.js +3 -1
- package/dist/_internal/components/layout/SettingsLayout/SettingsPanel.js +5 -5
- package/dist/_internal/components/layout/SettingsLayout/SettingsSectionChips.js +3 -3
- package/dist/_internal/components/layout/SettingsLayout/SettingsSectionHeader.js +2 -2
- package/dist/_internal/components/layout/SettingsLayout/SettingsStatusMarker.js +2 -2
- package/dist/{chunk-DBFRCTI5.js → chunk-7Y2VWMGS.js} +2 -2
- package/dist/{chunk-F3Q4CMRB.js → chunk-GBVNY2LG.js} +3 -3
- package/dist/{chunk-KKVM723A.js → chunk-LY5I3ZSV.js} +4 -4
- package/dist/{chunk-NYFNF7I5.js → chunk-NK4T624E.js} +3 -1
- package/dist/chunk-NK4T624E.js.map +1 -0
- package/dist/{chunk-X47MWURD.js → chunk-Q6MZHT2F.js} +10 -8
- package/dist/chunk-Q6MZHT2F.js.map +1 -0
- package/dist/{chunk-V5EWCJBT.js → chunk-SL56MOKE.js} +29 -8
- package/dist/chunk-SL56MOKE.js.map +1 -0
- package/dist/{chunk-OKYYHBGS.js → chunk-SO5OU2ZV.js} +16 -7
- package/dist/chunk-SO5OU2ZV.js.map +1 -0
- package/dist/{chunk-TNYKM4UU.js → chunk-TJO4CBYT.js} +64 -22
- package/dist/chunk-TJO4CBYT.js.map +1 -0
- package/dist/{chunk-6KEXHOIF.js → chunk-WOXNVM52.js} +2 -2
- package/dist/form/Textarea.js +1 -1
- package/dist/layout/SettingsLayout.js +8 -8
- package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
- package/dist/types/components/form/Textarea/Textarea.types.d.ts +4 -2
- package/dist/types/components/form/Textarea/Textarea.types.d.ts.map +1 -1
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.d.ts.map +1 -1
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.items.d.ts +3 -1
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.items.d.ts.map +1 -1
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.rail.d.ts +6 -2
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.rail.d.ts.map +1 -1
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.styles.d.ts +2 -0
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.styles.d.ts.map +1 -1
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.types.d.ts +19 -0
- package/dist/types/components/layout/SettingsLayout/SettingsLayout.types.d.ts.map +1 -1
- package/dist/types/components/layout/SettingsLayout/index.d.ts +1 -1
- package/dist/types/components/layout/SettingsLayout/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/form/Textarea/Textarea.tsx +14 -7
- package/src/components/form/Textarea/Textarea.types.ts +4 -2
- package/src/components/layout/SettingsLayout/SettingsLayout.items.tsx +38 -3
- package/src/components/layout/SettingsLayout/SettingsLayout.md +19 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.rail.tsx +73 -24
- package/src/components/layout/SettingsLayout/SettingsLayout.styles.ts +3 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.tsx +21 -3
- package/src/components/layout/SettingsLayout/SettingsLayout.types.ts +20 -0
- package/src/components/layout/SettingsLayout/index.ts +1 -0
- package/dist/chunk-NYFNF7I5.js.map +0 -1
- package/dist/chunk-OKYYHBGS.js.map +0 -1
- package/dist/chunk-TNYKM4UU.js.map +0 -1
- package/dist/chunk-V5EWCJBT.js.map +0 -1
- package/dist/chunk-X47MWURD.js.map +0 -1
- /package/dist/{chunk-DBFRCTI5.js.map → chunk-7Y2VWMGS.js.map} +0 -0
- /package/dist/{chunk-F3Q4CMRB.js.map → chunk-GBVNY2LG.js.map} +0 -0
- /package/dist/{chunk-KKVM723A.js.map → chunk-LY5I3ZSV.js.map} +0 -0
- /package/dist/{chunk-6KEXHOIF.js.map → chunk-WOXNVM52.js.map} +0 -0
|
@@ -219,7 +219,7 @@ import "../../chunk-QUWK7SYN.js";
|
|
|
219
219
|
import "../../chunk-BH5GSBR3.js";
|
|
220
220
|
import {
|
|
221
221
|
Textarea
|
|
222
|
-
} from "../../chunk-
|
|
222
|
+
} from "../../chunk-Q6MZHT2F.js";
|
|
223
223
|
import "../../chunk-IPC426NS.js";
|
|
224
224
|
import "../../chunk-6I3TYKE2.js";
|
|
225
225
|
import {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SettingsRailGroup,
|
|
4
4
|
SettingsRailItem
|
|
5
|
-
} from "../../../../chunk-
|
|
6
|
-
import "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
5
|
+
} from "../../../../chunk-SL56MOKE.js";
|
|
6
|
+
import "../../../../chunk-7Y2VWMGS.js";
|
|
7
|
+
import "../../../../chunk-NK4T624E.js";
|
|
8
8
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
9
9
|
import "../../../../chunk-PZ5AY32C.js";
|
|
10
10
|
export {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SettingsLayout
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-SO5OU2ZV.js";
|
|
5
5
|
import "../../../../chunk-BXC6GRLE.js";
|
|
6
|
-
import "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-LY5I3ZSV.js";
|
|
7
|
+
import "../../../../chunk-GBVNY2LG.js";
|
|
8
8
|
import "../../../../chunk-AJUSBPWG.js";
|
|
9
|
-
import "../../../../chunk-
|
|
10
|
-
import "../../../../chunk-
|
|
11
|
-
import "../../../../chunk-
|
|
12
|
-
import "../../../../chunk-
|
|
13
|
-
import "../../../../chunk-
|
|
9
|
+
import "../../../../chunk-TJO4CBYT.js";
|
|
10
|
+
import "../../../../chunk-SL56MOKE.js";
|
|
11
|
+
import "../../../../chunk-7Y2VWMGS.js";
|
|
12
|
+
import "../../../../chunk-WOXNVM52.js";
|
|
13
|
+
import "../../../../chunk-NK4T624E.js";
|
|
14
14
|
import "../../../../chunk-HPK33ACY.js";
|
|
15
15
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
16
16
|
import "../../../../chunk-PZ5AY32C.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SettingsRail
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
6
|
-
import "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-TJO4CBYT.js";
|
|
5
|
+
import "../../../../chunk-SL56MOKE.js";
|
|
6
|
+
import "../../../../chunk-7Y2VWMGS.js";
|
|
7
|
+
import "../../../../chunk-NK4T624E.js";
|
|
8
8
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
9
9
|
import "../../../../chunk-PZ5AY32C.js";
|
|
10
10
|
export {
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
TOUCH_TARGET,
|
|
5
5
|
atLeastRail,
|
|
6
6
|
displayAcrossRail,
|
|
7
|
+
railCardWidth,
|
|
7
8
|
railWidth
|
|
8
|
-
} from "../../../../chunk-
|
|
9
|
+
} from "../../../../chunk-NK4T624E.js";
|
|
9
10
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
10
11
|
import "../../../../chunk-PZ5AY32C.js";
|
|
11
12
|
export {
|
|
@@ -14,6 +15,7 @@ export {
|
|
|
14
15
|
TOUCH_TARGET,
|
|
15
16
|
atLeastRail,
|
|
16
17
|
displayAcrossRail,
|
|
18
|
+
railCardWidth,
|
|
17
19
|
railWidth
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=SettingsLayout.styles.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SettingsPanel
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-LY5I3ZSV.js";
|
|
5
|
+
import "../../../../chunk-GBVNY2LG.js";
|
|
6
6
|
import "../../../../chunk-AJUSBPWG.js";
|
|
7
|
-
import "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
9
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-7Y2VWMGS.js";
|
|
8
|
+
import "../../../../chunk-WOXNVM52.js";
|
|
9
|
+
import "../../../../chunk-NK4T624E.js";
|
|
10
10
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
11
11
|
import "../../../../chunk-PZ5AY32C.js";
|
|
12
12
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SettingsSectionChips
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-GBVNY2LG.js";
|
|
5
5
|
import "../../../../chunk-AJUSBPWG.js";
|
|
6
|
-
import "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-7Y2VWMGS.js";
|
|
7
|
+
import "../../../../chunk-NK4T624E.js";
|
|
8
8
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
9
9
|
import "../../../../chunk-PZ5AY32C.js";
|
|
10
10
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SettingsSectionHeader
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-WOXNVM52.js";
|
|
5
|
+
import "../../../../chunk-NK4T624E.js";
|
|
6
6
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
7
7
|
import "../../../../chunk-PZ5AY32C.js";
|
|
8
8
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
SettingsStatusMarker
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-7Y2VWMGS.js";
|
|
5
|
+
import "../../../../chunk-NK4T624E.js";
|
|
6
6
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
7
7
|
import "../../../../chunk-PZ5AY32C.js";
|
|
8
8
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SR_ONLY_SX,
|
|
3
3
|
STATUS_COLOR
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NK4T624E.js";
|
|
5
5
|
import {
|
|
6
6
|
sxRem
|
|
7
7
|
} from "./chunk-YKCAJ2TN.js";
|
|
@@ -62,4 +62,4 @@ SettingsStatusMarker.displayName = "SettingsStatusMarker";
|
|
|
62
62
|
export {
|
|
63
63
|
SettingsStatusMarker
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-7Y2VWMGS.js.map
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-AJUSBPWG.js";
|
|
6
6
|
import {
|
|
7
7
|
SettingsStatusMarker
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7Y2VWMGS.js";
|
|
9
9
|
import {
|
|
10
10
|
TOUCH_TARGET
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NK4T624E.js";
|
|
12
12
|
import {
|
|
13
13
|
rem,
|
|
14
14
|
sxRem
|
|
@@ -186,4 +186,4 @@ SettingsSectionChips.displayName = "SettingsSectionChips";
|
|
|
186
186
|
export {
|
|
187
187
|
SettingsSectionChips
|
|
188
188
|
};
|
|
189
|
-
//# sourceMappingURL=chunk-
|
|
189
|
+
//# sourceMappingURL=chunk-GBVNY2LG.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SettingsSectionChips
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GBVNY2LG.js";
|
|
4
4
|
import {
|
|
5
5
|
SettingsSectionHeader
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WOXNVM52.js";
|
|
7
7
|
import {
|
|
8
8
|
TOUCH_TARGET,
|
|
9
9
|
atLeastRail,
|
|
10
10
|
displayAcrossRail
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NK4T624E.js";
|
|
12
12
|
import {
|
|
13
13
|
rem
|
|
14
14
|
} from "./chunk-YKCAJ2TN.js";
|
|
@@ -167,4 +167,4 @@ function SettingsPanel({
|
|
|
167
167
|
export {
|
|
168
168
|
SettingsPanel
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-LY5I3ZSV.js.map
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// src/components/layout/SettingsLayout/SettingsLayout.styles.ts
|
|
7
7
|
var railWidth = (theme) => rem(theme, 300);
|
|
8
|
+
var railCardWidth = (theme) => rem(theme, 200);
|
|
8
9
|
var SR_ONLY_SX = {
|
|
9
10
|
position: "absolute",
|
|
10
11
|
width: sxRem(1),
|
|
@@ -31,10 +32,11 @@ var STATUS_COLOR = {
|
|
|
31
32
|
|
|
32
33
|
export {
|
|
33
34
|
railWidth,
|
|
35
|
+
railCardWidth,
|
|
34
36
|
SR_ONLY_SX,
|
|
35
37
|
atLeastRail,
|
|
36
38
|
displayAcrossRail,
|
|
37
39
|
TOUCH_TARGET,
|
|
38
40
|
STATUS_COLOR
|
|
39
41
|
};
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-NK4T624E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/layout/SettingsLayout/SettingsLayout.styles.ts"],"sourcesContent":["import type { CSSObject, SxProps, Theme } from '@mui/material/styles/index.js';\n\nimport { rem, sxRem } from '../../../tokens/relative';\n\nimport type { SettingsNavStatus, SettingsRailBreakpoint } from './SettingsLayout.types';\n\n/** Fixed width of the left navigation rail once it has its own column (300 design px). */\nexport const railWidth = (theme: Theme): string => rem(theme, 300);\n\n/** Width of the rail drawn as a card (`railVariant=\"card\"`, 200 design px). */\nexport const railCardWidth = (theme: Theme): string => rem(theme, 200);\n\n/** Visually hidden, still read aloud — for text a marker's colour cannot carry. */\nexport const SR_ONLY_SX: SxProps<Theme> = {\n position: 'absolute',\n width: sxRem(1),\n height: sxRem(1),\n padding: 0,\n margin: sxRem(-1),\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\n/**\n * The media query for \"the rail has its own column\".\n *\n * `theme.breakpoints.up` takes a NUMBER as happily as a name, which is why\n * `railBreakpoint` accepts one: a settings area whose structural switch is at\n * 1024px has no MUI breakpoint to name (the default `lg` is 1200), and rounding\n * the design to the nearest named breakpoint moves 176px of behaviour to keep a\n * string tidy.\n */\nexport function atLeastRail(theme: Theme, breakpoint: SettingsRailBreakpoint): string {\n return theme.breakpoints.up(breakpoint);\n}\n\n/**\n * A `display` pair across that query: `narrow` below it, `wide` at and above.\n *\n * Everything that changes shape between the two navigation modes goes through\n * this, so \"which width am I?\" is answered once, in CSS, for every part at\n * once — rather than by each part asking a media query in JavaScript and\n * answering slightly differently.\n */\nexport function displayAcrossRail(\n theme: Theme,\n breakpoint: SettingsRailBreakpoint,\n narrow: string,\n wide: string,\n): CSSObject {\n return { display: narrow, [atLeastRail(theme, breakpoint)]: { display: wide } };\n}\n\n/** Minimum touch target, in px. Held down to 320px-wide phones, deliberately. */\nexport const TOUCH_TARGET = 44;\n\n/**\n * Palette role per situation.\n *\n * Returned as theme keys rather than hex so a marker follows the host's theme —\n * and so light and dark do not need two copies of this table.\n */\nexport const STATUS_COLOR: Record<Exclude<SettingsNavStatus, 'locked'>, string> = {\n ok: 'success.main',\n off: 'text.disabled',\n new: 'error.main',\n};\n"],"mappings":";;;;;;AAOO,IAAM,YAAY,CAAC,UAAyB,IAAI,OAAO,GAAG;AAG1D,IAAM,gBAAgB,CAAC,UAAyB,IAAI,OAAO,GAAG;AAG9D,IAAM,aAA6B;AAAA,EACxC,UAAU;AAAA,EACV,OAAO,MAAM,CAAC;AAAA,EACd,QAAQ,MAAM,CAAC;AAAA,EACf,SAAS;AAAA,EACT,QAAQ,MAAM,EAAE;AAAA,EAChB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,QAAQ;AACV;AAWO,SAAS,YAAY,OAAc,YAA4C;AACpF,SAAO,MAAM,YAAY,GAAG,UAAU;AACxC;AAUO,SAAS,kBACd,OACA,YACA,QACA,MACW;AACX,SAAO,EAAE,SAAS,QAAQ,CAAC,YAAY,OAAO,UAAU,CAAC,GAAG,EAAE,SAAS,KAAK,EAAE;AAChF;AAGO,IAAM,eAAe;AAQrB,IAAM,eAAqE;AAAA,EAChF,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AACP;","names":[]}
|
|
@@ -49,11 +49,11 @@ var StyledTextarea = styled(TextareaAutosize, {
|
|
|
49
49
|
const colorPalette = getColorFromTheme(theme, customColor);
|
|
50
50
|
const errorColor = theme.palette.error;
|
|
51
51
|
const sizeMap = {
|
|
52
|
-
xs: { padding: rems(theme, 6, 8), fontSize: rem(theme, 12)
|
|
53
|
-
sm: { padding: rems(theme, 8, 10), fontSize: rem(theme, 14)
|
|
54
|
-
md: { padding: rems(theme, 10, 12), fontSize: rem(theme, 16)
|
|
55
|
-
lg: { padding: rems(theme, 12, 14), fontSize: rem(theme, 18)
|
|
56
|
-
xl: { padding: rems(theme, 14, 16), fontSize: rem(theme, 20)
|
|
52
|
+
xs: { padding: rems(theme, 6, 8), fontSize: rem(theme, 12) },
|
|
53
|
+
sm: { padding: rems(theme, 8, 10), fontSize: rem(theme, 14) },
|
|
54
|
+
md: { padding: rems(theme, 10, 12), fontSize: rem(theme, 16) },
|
|
55
|
+
lg: { padding: rems(theme, 12, 14), fontSize: rem(theme, 18) },
|
|
56
|
+
xl: { padding: rems(theme, 14, 16), fontSize: rem(theme, 20) }
|
|
57
57
|
};
|
|
58
58
|
const baseStyles = {
|
|
59
59
|
width: "100%",
|
|
@@ -112,7 +112,9 @@ var TEXTAREA_DEFAULTS = {
|
|
|
112
112
|
glass: false,
|
|
113
113
|
gradient: false,
|
|
114
114
|
iconPosition: "start",
|
|
115
|
-
|
|
115
|
+
// Four lines of its own text, whatever the variant or size (FUT-3534); a
|
|
116
|
+
// screen that wants another height passes `minRows`.
|
|
117
|
+
minRows: 4
|
|
116
118
|
};
|
|
117
119
|
var definedProps = (props) => Object.fromEntries(
|
|
118
120
|
Object.entries(props).filter(([, value]) => value !== void 0)
|
|
@@ -210,7 +212,7 @@ var Textarea = (textareaProps) => {
|
|
|
210
212
|
glass,
|
|
211
213
|
gradient,
|
|
212
214
|
error,
|
|
213
|
-
minRows
|
|
215
|
+
minRows,
|
|
214
216
|
maxRows: variant === "autosize" ? maxRows : void 0,
|
|
215
217
|
style: textareaStyle,
|
|
216
218
|
"aria-label": label || props["aria-label"],
|
|
@@ -225,4 +227,4 @@ Textarea.displayName = "Textarea";
|
|
|
225
227
|
export {
|
|
226
228
|
Textarea
|
|
227
229
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
230
|
+
//# sourceMappingURL=chunk-Q6MZHT2F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/form/Textarea/Textarea.tsx"],"sourcesContent":["import Box from '@mui/material/Box/index.js';\nimport FormHelperText from '@mui/material/FormHelperText/index.js';\nimport InputLabel from '@mui/material/InputLabel/index.js';\nimport TextareaAutosize from '@mui/material/TextareaAutosize/index.js';\nimport { alpha, styled, useTheme } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React, { lazy, Suspense, useState } from 'react';\n\nimport {\n getColorFromTheme,\n textareaEmphasisStyles } from './Textarea.styles';\n\n/**\n * The rich editor is LOADED ON DEMAND, not imported (12-51 follow-up).\n *\n * It renders only for `variant === 'rich'`, but a static import made every\n * consumer of a plain `<Textarea>` pay for it — 387 lines of toolbar plus the\n * MUI `Tooltip`, `IconButton` and `Divider` its formatting buttons need. That\n * is not theoretical: an adopting storefront imports this entry for a one-line\n * order note, and `Tooltip` (8.7 KiB) reached its EAGER chunk through here\n * while nothing on that critical path renders a tooltip at all.\n *\n * `variant` is a prop, so the branch cannot be decided at build time and no\n * amount of tree-shaking removes it. A lazy boundary is what expresses \"only\n * the rich variant pays\", and it costs the rich variant one microtask it can\n * afford — it is a text editor a user has already chosen to open, never a\n * first-paint element.\n */\nconst TextareaRichEditor = lazy(async () => ({\n default: (await import('./TextareaRichEditor')).TextareaRichEditor }));\nimport type { TextareaProps } from './Textarea.types';\n\nimport { fieldEdge } from '../../../tokens/field-edge';\nimport { fieldRadius } from '../../../tokens/field-radius';\nimport { FIELD_BORDER_WIDTH, fieldBorder } from '../../../tokens/field-height';\nimport { rem, rems, sxRem } from '../../../tokens/relative';\n\n// Interface for styled component props\ninterface StyledTextareaProps {\n customVariant?: string;\n customColor?: string;\n customSize?: string;\n glow?: boolean;\n glass?: boolean;\n gradient?: boolean;\n error?: boolean;\n theme?: Theme;\n}\n\n// Glow animation for enhanced visual effects\nconst StyledTextarea = styled(TextareaAutosize, {\n shouldForwardProp: (prop) =>\n !['customVariant', 'customColor', 'customSize', 'glow', 'glass', 'gradient', 'error'].includes(\n prop as string,\n ) })<StyledTextareaProps>(({\n theme,\n customVariant,\n customColor = 'primary',\n customSize = 'md',\n glow,\n glass,\n gradient,\n error }) => {\n if (!theme) return {};\n const colorPalette = getColorFromTheme(theme, customColor);\n const errorColor = theme.palette.error;\n\n // No min-height here: the box's height is counted in LINES of its own text\n // (`minRows`). A pixel floor broke that twice over — it ignored the font, and\n // `TextareaAutosize` measures one row on a hidden copy carrying this same\n // class, so a \"row\" came out as the whole floor and `minRows={2}` drew about\n // 200px (FUT-3504, FUT-3534).\n const sizeMap = {\n xs: { padding: rems(theme, 6, 8), fontSize: rem(theme, 12) },\n sm: { padding: rems(theme, 8, 10), fontSize: rem(theme, 14) },\n md: { padding: rems(theme, 10, 12), fontSize: rem(theme, 16) },\n lg: { padding: rems(theme, 12, 14), fontSize: rem(theme, 18) },\n xl: { padding: rems(theme, 14, 16), fontSize: rem(theme, 20) } };\n\n const baseStyles = {\n width: '100%',\n fontFamily: theme.typography.fontFamily,\n borderRadius: fieldRadius(theme),\n border: error ? `${FIELD_BORDER_WIDTH}px solid ${errorColor.main}` : fieldBorder(theme),\n backgroundColor: theme.palette.background.paper,\n color: theme.palette.text.primary,\n transition: 'all 0.3s ease',\n resize: customVariant === 'resizable' ? 'vertical' : 'none',\n outline: 'none',\n ...sizeMap[customSize as keyof typeof sizeMap],\n\n '&::placeholder': {\n color: theme.palette.text.secondary,\n opacity: 0.7 },\n\n '&:hover': {\n borderColor: error ? errorColor.dark : colorPalette.main,\n backgroundColor: alpha(theme.palette.background.paper, 0.8) },\n\n // Focus is two pixels, like every other field's: the second is an inset\n // shadow, so the 1px resting border can thicken without the box moving.\n '&:focus': {\n borderColor: error ? errorColor.main : colorPalette.main,\n backgroundColor: theme.palette.background.paper,\n boxShadow: `inset 0 0 0 ${FIELD_BORDER_WIDTH}px ${error ? errorColor.main : colorPalette.main}, 0 0 0 ${rem(theme, 3)} ${alpha(error ? errorColor.main : colorPalette.main, 0.1)}` } };\n\n // Glass morphism effect\n return {\n ...baseStyles,\n ...textareaEmphasisStyles({ theme, colorPalette, glass, gradient, glow }) };\n});\n\nconst StyledLabel = styled(InputLabel, {\n shouldForwardProp: (prop) => !['glass', 'error'].includes(prop as string) })<{ glass?: boolean; error?: boolean }>(({ theme, glass, error }) => ({\n marginBottom: theme.spacing(1),\n fontWeight: 500,\n color: error ? theme.palette.error.main : theme.palette.text.primary,\n ...(glass && {\n backgroundColor: alpha(theme.palette.background.paper, 0.1),\n backdropFilter: `blur(${rem(theme, 10)})`,\n padding: rems(theme, 4, 8),\n borderRadius: rem(theme, 4),\n border: `1px solid ${fieldEdge(theme)}`,\n display: 'inline-block' }) }));\n\n// IconWrapper - replaced with inline Box component for better TypeScript compatibility\n// const IconWrapper = styled(Box)<{ position: 'start' | 'end' }>(({ theme, position }) => {\n// const positionStyles = position === 'start' ? { left: '12px' } : { right: '12px' };\n// return {\n// position: 'absolute' as const,\n// top: '12px',\n// ...positionStyles,\n// color: theme.palette.text.secondary,\n// pointerEvents: 'none' as const,\n// zIndex: 1,\n// };\n// });\n\n// Rich text toolbar styling\n\nconst TEXTAREA_DEFAULTS = {\n variant: 'default',\n color: 'primary',\n size: 'md',\n error: false,\n glassLabel: false,\n glow: false,\n glass: false,\n gradient: false,\n iconPosition: 'start',\n // Four lines of its own text, whatever the variant or size (FUT-3534); a\n // screen that wants another height passes `minRows`.\n minRows: 4 } satisfies Partial<TextareaProps>;\n\n// Strips explicitly-undefined props before the merge, so `prop={undefined}`\n// still falls back to the default as a destructuring default would.\nconst definedProps = (props: TextareaProps): Partial<TextareaProps> =>\n Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Partial<TextareaProps>;\n\n// Label above, helper text below — identical for the plain and rich variants,\n// which previously duplicated both.\nconst TextareaShell: React.FC<{\n testId?: string;\n label?: React.ReactNode;\n glassLabel: boolean;\n error: boolean;\n helperText?: React.ReactNode;\n children: React.ReactNode;\n}> = ({ testId, label, glassLabel, error, helperText, children }) => (\n <Box\n sx={{ position: 'relative', width: '100%' }}\n data-testid={testId ? `${testId}-wrapper` : undefined}\n >\n {label && (\n <StyledLabel glass={glassLabel} error={error}>\n {label}\n </StyledLabel>\n )}\n\n {children}\n\n {helperText && (\n <FormHelperText error={error} sx={{ mt: 1 }}>\n {helperText}\n </FormHelperText>\n )}\n </Box>\n);\n\nconst TextareaIcon: React.FC<{\n icon?: React.ReactNode;\n iconPosition: 'start' | 'end';\n}> = ({ icon, iconPosition }) => (\n <Box\n sx={{\n position: 'absolute',\n top: sxRem(12),\n ...(iconPosition === 'start' ? { left: sxRem(12) } : { right: sxRem(12) }),\n color: 'text.secondary',\n pointerEvents: 'none',\n zIndex: 1 }}\n >\n {icon}\n </Box>\n);\n\n/**\n * The rich variant, kept out of the main component's body.\n *\n * Two reasons rather than one: the `Suspense` boundary and its props belong\n * together with the lazy import above, and the component that renders every\n * OTHER variant stays inside the size the complexity gate allows without\n * anything being suppressed.\n */\nfunction RichVariant({\n shell,\n editor }: {\n shell: Omit<React.ComponentProps<typeof TextareaShell>, 'children'>;\n editor: React.ComponentProps<typeof TextareaRichEditor>;\n}): React.JSX.Element {\n return (\n <TextareaShell {...shell}>\n {/*\n `null` rather than a spinner: the editor resolves from the same document\n the caller is already rendering, so a fallback would flash for a frame\n and read as a glitch rather than as loading.\n */}\n <Suspense fallback={null}>\n <TextareaRichEditor {...editor} />\n </Suspense>\n </TextareaShell>\n );\n}\n\n// Same gap either side; only which side it applies to changes. The previous\n// version had `iconPosition === 'start' ? '40px' : '40px'`, a ternary whose\n// two branches were identical. The icon's gutter is 40px at the design scale.\nfunction withIconGutter(\n theme: Theme,\n style: React.CSSProperties | undefined,\n hasIcon: boolean,\n iconPosition: TextareaProps['iconPosition'],\n): React.CSSProperties {\n if (!hasIcon) return { ...style };\n return { ...style, [iconPosition === 'start' ? 'paddingLeft' : 'paddingRight']: rem(theme, 40) };\n}\n\nexport const Textarea: React.FC<TextareaProps> = (textareaProps) => {\n const {\n variant,\n color,\n size,\n error,\n helperText,\n label,\n glassLabel,\n glow,\n glass,\n gradient,\n icon,\n iconPosition,\n minRows,\n maxRows,\n style,\n 'data-testid': dataTestId,\n dataTestId: dataTestIdCamelCase,\n ...props\n } = { ...TEXTAREA_DEFAULTS, ...definedProps(textareaProps) };\n\n // Read off the props rather than the merged object: the spread widens every\n // key to optional, which would lose what the variant union already proved.\n const { richEditorCopy } = textareaProps;\n\n const theme = useTheme();\n const [richTextValue, setRichTextValue] = useState('');\n const hasIcon = Boolean(icon);\n const testId = dataTestId || dataTestIdCamelCase;\n\n const textareaStyle = withIconGutter(theme, style, hasIcon, iconPosition);\n\n // If rich text variant, use the rich text editor\n if (variant === 'rich' && richEditorCopy) {\n return (\n <RichVariant\n shell={{ testId, label, glassLabel, error, helperText }}\n editor={{\n copy: richEditorCopy,\n value: richTextValue,\n onChange: setRichTextValue,\n placeholder: props.placeholder,\n error,\n glass,\n color,\n characterLimit: props.maxLength }}\n />\n );\n }\n\n return (\n <TextareaShell testId={testId} label={label} glassLabel={glassLabel} error={error} helperText={helperText}>\n <Box sx={{ position: 'relative' }}>\n {hasIcon && <TextareaIcon icon={icon} iconPosition={iconPosition} />}\n\n <StyledTextarea\n customVariant={variant}\n customColor={color}\n customSize={size}\n glow={glow}\n glass={glass}\n gradient={gradient}\n error={error}\n minRows={minRows}\n maxRows={variant === 'autosize' ? maxRows : undefined}\n style={textareaStyle}\n aria-label={label || props['aria-label']}\n data-testid={testId}\n {...props}\n />\n </Box>\n </TextareaShell>\n );\n};\n\nTextarea.displayName = 'Textarea';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS;AAChB,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AACvB,OAAO,sBAAsB;AAC7B,SAAS,OAAO,QAAQ,gBAAgB;AAExC,SAAgB,MAAM,UAAU,gBAAgB;AAqK9C,SAKI,KALJ;AA/IF,IAAM,qBAAqB,KAAK,aAAa;AAAA,EAC3C,UAAU,MAAM,OAAO,4DAAsB,GAAG;AAAmB,EAAE;AAqBvE,IAAM,iBAAiB,OAAO,kBAAkB;AAAA,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,YAAY,aAAa,UAAU;AAAA,QAC5C,OAAO;AAAA,QACP,cAAY,SAAS,MAAM,YAAY;AAAA,QACvC,eAAa;AAAA,QACZ,GAAG;AAAA;AAAA,IACN;AAAA,KACF,GACF;AAEJ;AAEA,SAAS,cAAc;","names":[]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SettingsStatusMarker
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7Y2VWMGS.js";
|
|
4
4
|
import {
|
|
5
5
|
TOUCH_TARGET,
|
|
6
6
|
atLeastRail
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NK4T624E.js";
|
|
8
8
|
import {
|
|
9
|
-
rem
|
|
9
|
+
rem,
|
|
10
|
+
sxRem
|
|
10
11
|
} from "./chunk-YKCAJ2TN.js";
|
|
11
12
|
|
|
12
13
|
// src/components/layout/SettingsLayout/SettingsLayout.items.tsx
|
|
@@ -43,6 +44,21 @@ function RailItemContent({
|
|
|
43
44
|
) : null
|
|
44
45
|
] });
|
|
45
46
|
}
|
|
47
|
+
function railItemColor(active, card) {
|
|
48
|
+
if (active) return card ? "primary.dark" : "primary.main";
|
|
49
|
+
return card ? "text.primary" : "text.secondary";
|
|
50
|
+
}
|
|
51
|
+
var FOCUS_RING_SX = {
|
|
52
|
+
"&.Mui-focusVisible": {
|
|
53
|
+
outlineStyle: "solid",
|
|
54
|
+
outlineWidth: sxRem(2),
|
|
55
|
+
outlineColor: "primary.main",
|
|
56
|
+
outlineOffset: sxRem(-2)
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function cardRowSx(theme, breakpoint) {
|
|
60
|
+
return { [atLeastRail(theme, breakpoint)]: { minHeight: rem(theme, 36), py: sxRem(6) } };
|
|
61
|
+
}
|
|
46
62
|
function SettingsRailItem({
|
|
47
63
|
item,
|
|
48
64
|
active,
|
|
@@ -51,7 +67,8 @@ function SettingsRailItem({
|
|
|
51
67
|
onNavigate,
|
|
52
68
|
testIdPrefix,
|
|
53
69
|
variant,
|
|
54
|
-
breakpoint
|
|
70
|
+
breakpoint,
|
|
71
|
+
card = false
|
|
55
72
|
}) {
|
|
56
73
|
const theme = useTheme();
|
|
57
74
|
const touchFloor = variant === "drilldown" ? { minHeight: rem(theme, TOUCH_TARGET), [atLeastRail(theme, breakpoint)]: { minHeight: "auto" } } : null;
|
|
@@ -62,11 +79,13 @@ function SettingsRailItem({
|
|
|
62
79
|
mb: 0.25,
|
|
63
80
|
gap: 1.5,
|
|
64
81
|
...touchFloor,
|
|
65
|
-
|
|
82
|
+
...card ? cardRowSx(theme, breakpoint) : null,
|
|
83
|
+
color: railItemColor(active, card),
|
|
66
84
|
"&.Mui-selected": {
|
|
67
85
|
bgcolor: alpha(theme.palette.primary.main, 0.12),
|
|
68
86
|
"&:hover": { bgcolor: alpha(theme.palette.primary.main, 0.18) }
|
|
69
|
-
}
|
|
87
|
+
},
|
|
88
|
+
...FOCUS_RING_SX
|
|
70
89
|
}
|
|
71
90
|
};
|
|
72
91
|
const content = /* @__PURE__ */ jsx(RailItemContent, { item, active, testIdPrefix });
|
|
@@ -111,7 +130,9 @@ function indexListSx(shape) {
|
|
|
111
130
|
// One spacing unit (8px). This is an `sx` callback, where a bare 8 is
|
|
112
131
|
// EIGHT units — it drew a 64px gutter between the two columns.
|
|
113
132
|
columnGap: 1,
|
|
114
|
-
|
|
133
|
+
// From `md`, not `sm`: at 600 two columns of bare text rows read as one
|
|
134
|
+
// list with a hole in it, and a row's status dot sat nearer the next column.
|
|
135
|
+
[theme.breakpoints.up("md")]: { gridTemplateColumns: "1fr 1fr" },
|
|
115
136
|
[atLeastRail(theme, shape.breakpoint)]: { gridTemplateColumns: "1fr" }
|
|
116
137
|
});
|
|
117
138
|
}
|
|
@@ -169,4 +190,4 @@ export {
|
|
|
169
190
|
SettingsRailItem,
|
|
170
191
|
SettingsRailGroup
|
|
171
192
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
193
|
+
//# sourceMappingURL=chunk-SL56MOKE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/layout/SettingsLayout/SettingsLayout.items.tsx"],"sourcesContent":["'use client';\n\nimport Box from '@mui/material/Box/index.js';\nimport List from '@mui/material/List/index.js';\nimport ListItem from '@mui/material/ListItem/index.js';\nimport ListItemButton from '@mui/material/ListItemButton/index.js';\nimport ListItemIcon from '@mui/material/ListItemIcon/index.js';\nimport ListItemText from '@mui/material/ListItemText/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { alpha, useTheme } from '@mui/material/styles/index.js';\nimport type { SxProps, Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { atLeastRail, TOUCH_TARGET } from './SettingsLayout.styles';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport { SettingsStatusMarker } from './SettingsStatusMarker';\nimport type {\n SettingsLayoutProps,\n SettingsNavGroup,\n SettingsNavItem,\n SettingsNavVariant,\n SettingsRailBreakpoint,\n} from './SettingsLayout.types';\n\n/** The shape-deciding inputs every rail part needs to know about. */\nexport interface RailShape {\n variant: SettingsNavVariant;\n breakpoint: SettingsRailBreakpoint;\n atIndex: boolean;\n /** The rail is drawn as a card (`railVariant=\"card\"`): denser rows, darker text. */\n card?: boolean;\n}\n\ninterface RailItemProps extends RailShape {\n item: SettingsNavItem;\n active: boolean;\n linkComponent?: SettingsLayoutProps['linkComponent'];\n onSelectItem?: (id: string) => void;\n /** Called on activation so the `switcher`'s rail can collapse after a choice. */\n onNavigate?: () => void;\n testIdPrefix: string;\n}\n\n/** Label, plus the situation marker when the host resolved one. */\nfunction RailItemContent({\n item,\n active,\n testIdPrefix,\n}: {\n item: SettingsNavItem;\n active: boolean;\n testIdPrefix: string;\n}): React.JSX.Element {\n return (\n <>\n {item.icon ? (\n <ListItemIcon sx={{ minWidth: 0, color: 'inherit' }}>{item.icon}</ListItemIcon>\n ) : null}\n <ListItemText\n primary={item.label}\n primaryTypographyProps={{ variant: 'body2', noWrap: true, fontWeight: active ? 600 : 500 }}\n />\n {item.status ? (\n <SettingsStatusMarker\n status={item.status}\n label={item.statusLabel}\n testId={`${testIdPrefix}-status-${item.id}`}\n />\n ) : null}\n </>\n );\n}\n\n/**\n * The row's text colour. On the card the active row's red is the darker one,\n * since `primary.main` on its 12% wash measured 4.19:1 — under AA at 16px —\n * and the rest read in the body colour, as the card's prototype draws them.\n */\nfunction railItemColor(active: boolean, card: boolean): string {\n if (active) return card ? 'primary.dark' : 'primary.main';\n return card ? 'text.primary' : 'text.secondary';\n}\n\n/**\n * Keyboard focus as a ring, not MUI's grey fill: the fill measured 1.3:1\n * against the rail, under the 3:1 a focus indicator needs.\n */\nconst FOCUS_RING_SX = {\n '&.Mui-focusVisible': {\n outlineStyle: 'solid',\n outlineWidth: sxRem(2),\n outlineColor: 'primary.main',\n outlineOffset: sxRem(-2),\n },\n} as const;\n\n/** The card's rows from the breakpoint up: 36px, the prototype's rail density. */\nfunction cardRowSx(theme: Theme, breakpoint: SettingsRailBreakpoint): Record<string, unknown> {\n return { [atLeastRail(theme, breakpoint)]: { minHeight: rem(theme, 36), py: sxRem(6) } };\n}\n\n/** One rail entry — a link when it has `href`, inert text when it says so, else a button. */\nexport function SettingsRailItem({\n item,\n active,\n linkComponent,\n onSelectItem,\n onNavigate,\n testIdPrefix,\n variant,\n breakpoint,\n card = false,\n}: RailItemProps): React.JSX.Element {\n const theme = useTheme();\n // In `drilldown` the narrow rail IS the page's list, so its rows are the\n // primary touch targets rather than a secondary column — hence the 44px floor\n // below the breakpoint. Above it, the row goes back to rail density.\n const touchFloor =\n variant === 'drilldown'\n ? { minHeight: rem(theme, TOUCH_TARGET), [atLeastRail(theme, breakpoint)]: { minHeight: 'auto' } }\n : null;\n const shared = {\n 'data-testid': `${testIdPrefix}-item-${item.id}`,\n sx: {\n borderRadius: 1.5,\n mb: 0.25,\n gap: 1.5,\n ...touchFloor,\n ...(card ? cardRowSx(theme, breakpoint) : null),\n color: railItemColor(active, card),\n '&.Mui-selected': {\n bgcolor: alpha(theme.palette.primary.main, 0.12),\n '&:hover': { bgcolor: alpha(theme.palette.primary.main, 0.18) },\n },\n ...FOCUS_RING_SX,\n },\n };\n const content = <RailItemContent item={item} active={active} testIdPrefix={testIdPrefix} />;\n\n // Listed but not reachable from here. Deliberately not a disabled button: a\n // disabled control says \"you may not\", and the true statement is \"not from\n // this screen\" — the section exists and someone else's screen owns it.\n if (item.inert) {\n return (\n <ListItem {...shared} data-inert=\"true\">\n {content}\n </ListItem>\n );\n }\n\n const interactive = {\n ...shared,\n selected: active,\n 'aria-current': active ? ('page' as const) : undefined,\n };\n\n if (item.href && linkComponent) {\n const LinkComponent = linkComponent;\n return (\n <ListItemButton\n component={LinkComponent}\n href={item.href}\n onClick={onNavigate}\n {...interactive}\n >\n {content}\n </ListItemButton>\n );\n }\n return (\n <ListItemButton\n onClick={() => {\n onSelectItem?.(item.id);\n onNavigate?.();\n }}\n {...interactive}\n >\n {content}\n </ListItemButton>\n );\n}\n\ninterface RailGroupProps extends RailShape {\n group: SettingsNavGroup;\n activeItemId?: string;\n linkComponent?: SettingsLayoutProps['linkComponent'];\n onSelectItem?: (id: string) => void;\n onNavigate?: () => void;\n testIdPrefix: string;\n}\n\n/**\n * The list's own grid, in `drilldown` at the index only.\n *\n * At the index on a wide phone or a tablet the list has room for two columns;\n * the rail column never does, so the second column is undone at exactly the\n * width where this stops being the page.\n */\nfunction indexListSx(shape: RailShape): Extract<SxProps<Theme>, (theme: Theme) => unknown> | null {\n if (shape.variant !== 'drilldown' || !shape.atIndex) return null;\n return (theme: import('@mui/material').Theme) => ({\n display: 'grid',\n gridTemplateColumns: '1fr',\n // One spacing unit (8px). This is an `sx` callback, where a bare 8 is\n // EIGHT units — it drew a 64px gutter between the two columns.\n columnGap: 1,\n // From `md`, not `sm`: at 600 two columns of bare text rows read as one\n // list with a hole in it, and a row's status dot sat nearer the next column.\n [theme.breakpoints.up('md')]: { gridTemplateColumns: '1fr 1fr' },\n [atLeastRail(theme, shape.breakpoint)]: { gridTemplateColumns: '1fr' },\n });\n}\n\n/** A category: header + optional description + its items. */\nexport function SettingsRailGroup({\n group,\n activeItemId,\n linkComponent,\n onSelectItem,\n onNavigate,\n testIdPrefix,\n ...shape\n}: RailGroupProps): React.JSX.Element {\n const grid = indexListSx(shape);\n return (\n <Box data-testid={`${testIdPrefix}-group-${group.id}`} sx={{ mb: 2 }}>\n <Typography\n variant=\"caption\"\n sx={{\n display: 'block',\n px: 1,\n color: 'text.secondary',\n fontWeight: 600,\n textTransform: 'uppercase',\n letterSpacing: '0.06em',\n }}\n >\n {group.label}\n </Typography>\n {group.description ? (\n <Typography variant=\"caption\" component=\"p\" sx={{ px: 1, mt: 0.25, color: 'text.disabled' }}>\n {group.description}\n </Typography>\n ) : null}\n <List\n disablePadding\n sx={(theme) => ({ mt: 0.5, ...(grid ? grid(theme) : null) })}\n >\n {group.items.map((item) => (\n <SettingsRailItem\n key={item.id}\n item={item}\n active={item.id === activeItemId}\n linkComponent={linkComponent}\n onSelectItem={onSelectItem}\n onNavigate={onNavigate}\n testIdPrefix={testIdPrefix}\n {...shape}\n />\n ))}\n </List>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,OAAO,gBAAgB;AACvB,SAAS,OAAO,gBAAgB;AA6C5B,mBAEI,KAFJ;AAVJ,SAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACF,GAIsB;AACpB,SACE,iCACG;AAAA,SAAK,OACJ,oBAAC,gBAAa,IAAI,EAAE,UAAU,GAAG,OAAO,UAAU,GAAI,eAAK,MAAK,IAC9D;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,KAAK;AAAA,QACd,wBAAwB,EAAE,SAAS,SAAS,QAAQ,MAAM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AY,KAAK;AAC9B,SACE,qBAAC,OAAI,eAAa,GAAG,YAAY,UAAU,MAAM,EAAE,IAAI,IAAI,EAAE,IAAI,EAAE,GACjE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,IAAI;AAAA,UACF,SAAS;AAAA,UACT,IAAI;AAAA,UACJ,OAAO;AAAA,UACP,YAAY;AAAA,UACZ,eAAe;AAAA,UACf,eAAe;AAAA,QACjB;AAAA,QAEC,gBAAM;AAAA;AAAA,IACT;AAAA,IACC,MAAM,cACL,oBAAC,cAAW,SAAQ,WAAU,WAAU,KAAI,IAAI,EAAE,IAAI,GAAG,IAAI,MAAM,OAAO,gBAAgB,GACvF,gBAAM,aACT,IACE;AAAA,IACJ;AAAA,MAAC;AAAA;AAAA,QACC,gBAAc;AAAA,QACd,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,GAAI,OAAO,KAAK,KAAK,IAAI,KAAM;AAAA,QAEzD,gBAAM,MAAM,IAAI,CAAC,SAChB;AAAA,UAAC;AAAA;AAAA,YAEC;AAAA,YACA,QAAQ,KAAK,OAAO;AAAA,YACpB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACC,GAAG;AAAA;AAAA,UAPC,KAAK;AAAA,QAQZ,CACD;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
} from "./chunk-BXC6GRLE.js";
|
|
5
5
|
import {
|
|
6
6
|
SettingsPanel
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LY5I3ZSV.js";
|
|
8
8
|
import {
|
|
9
9
|
SettingsRail
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TJO4CBYT.js";
|
|
11
11
|
import {
|
|
12
12
|
atLeastRail
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NK4T624E.js";
|
|
14
14
|
import {
|
|
15
15
|
withDefaults
|
|
16
16
|
} from "./chunk-HPK33ACY.js";
|
|
@@ -29,7 +29,13 @@ var DEFAULTS = {
|
|
|
29
29
|
atIndex: false,
|
|
30
30
|
backLabel: "Back"
|
|
31
31
|
};
|
|
32
|
-
function
|
|
32
|
+
function railLookOf({
|
|
33
|
+
searchable = true,
|
|
34
|
+
railVariant = "divided"
|
|
35
|
+
}) {
|
|
36
|
+
return { searchable, railVariant };
|
|
37
|
+
}
|
|
38
|
+
function shellSx(breakpoint, fillHeight, railVariant) {
|
|
33
39
|
return (theme) => ({
|
|
34
40
|
display: "flex",
|
|
35
41
|
flexDirection: "column",
|
|
@@ -42,7 +48,9 @@ function shellSx(breakpoint, fillHeight) {
|
|
|
42
48
|
// convenience.
|
|
43
49
|
[atLeastRail(theme, breakpoint ?? "md")]: {
|
|
44
50
|
flexDirection: "row",
|
|
45
|
-
|
|
51
|
+
// A card stands apart from the panel by 32px, as its prototype draws it;
|
|
52
|
+
// the ruled column keeps its 24.
|
|
53
|
+
gap: railVariant === "card" ? 4 : 3,
|
|
46
54
|
...fillHeight ? { height: "100%", minHeight: 0 } : {}
|
|
47
55
|
}
|
|
48
56
|
});
|
|
@@ -80,7 +88,7 @@ var SettingsLayout = (props) => {
|
|
|
80
88
|
"data-testid": testIdPrefix,
|
|
81
89
|
"data-nav-variant": navVariant,
|
|
82
90
|
"data-at-index": atIndex ? "true" : "false",
|
|
83
|
-
sx: shellSx(railBreakpoint, fillHeight),
|
|
91
|
+
sx: shellSx(railBreakpoint, fillHeight, railLookOf(props).railVariant),
|
|
84
92
|
children: [
|
|
85
93
|
/* @__PURE__ */ jsx(
|
|
86
94
|
SettingsRail,
|
|
@@ -101,6 +109,7 @@ var SettingsLayout = (props) => {
|
|
|
101
109
|
onNavigate: () => setNavOpen(false),
|
|
102
110
|
testIdPrefix,
|
|
103
111
|
variant: navVariant,
|
|
112
|
+
...railLookOf(props),
|
|
104
113
|
breakpoint: railBreakpoint,
|
|
105
114
|
atIndex,
|
|
106
115
|
fillHeight
|
|
@@ -135,4 +144,4 @@ SettingsLayout.displayName = "SettingsLayout";
|
|
|
135
144
|
export {
|
|
136
145
|
SettingsLayout
|
|
137
146
|
};
|
|
138
|
-
//# sourceMappingURL=chunk-
|
|
147
|
+
//# sourceMappingURL=chunk-SO5OU2ZV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/layout/SettingsLayout/SettingsLayout.tsx"],"sourcesContent":["'use client';\n\nimport Box from '@mui/material/Box/index.js';\nimport type { SxProps, Theme } from '@mui/material/styles/index.js';\nimport React, { useMemo, useState } from 'react';\n\nimport { withDefaults } from '../../../utils/withDefaults';\nimport { activeItemLabel, filterGroups } from './SettingsLayout.filters';\nimport { SettingsRail } from './SettingsLayout.rail';\nimport { atLeastRail } from './SettingsLayout.styles';\nimport { SettingsPanel } from './SettingsPanel';\nimport type { SettingsLayoutProps } from './SettingsLayout.types';\n\n/**\n * The props with every default already applied.\n *\n * A table through `withDefaults` rather than a `= default` per destructured\n * prop: each of those is a branch, and seven of them put the component over the\n * complexity bar before it renders anything. The single cast is what buys the\n * body non-optional values — without it every use site would restate the\n * default as a `??`, which is the same default written twice and free to drift.\n */\ntype ResolvedProps = SettingsLayoutProps &\n Required<\n Pick<\n SettingsLayoutProps,\n | 'searchPlaceholder'\n | 'defaultQuery'\n | 'emptySearchLabel'\n | 'testIdPrefix'\n | 'railBreakpoint'\n | 'navVariant'\n | 'atIndex'\n | 'backLabel'\n >\n >;\n\nconst DEFAULTS = {\n searchPlaceholder: 'Search settings',\n defaultQuery: '',\n emptySearchLabel: 'No settings match your search.',\n testIdPrefix: 'settings',\n railBreakpoint: 'md',\n navVariant: 'switcher',\n atIndex: false,\n backLabel: 'Back',\n} satisfies Partial<SettingsLayoutProps>;\n\n/**\n * How the rail looks: its search field, and its frame from the breakpoint up.\n * Both default to the shape every consumer had before they existed.\n */\nfunction railLookOf({\n searchable = true,\n railVariant = 'divided',\n}: SettingsLayoutProps): Required<Pick<SettingsLayoutProps, 'searchable' | 'railVariant'>> {\n return { searchable, railVariant };\n}\n\n/** Stacked below the rail's breakpoint, two columns at and above it. */\nfunction shellSx(\n breakpoint: SettingsLayoutProps['railBreakpoint'],\n fillHeight: boolean,\n railVariant: SettingsLayoutProps['railVariant'],\n): SxProps<Theme> {\n return (theme: Theme) => ({\n display: 'flex',\n flexDirection: 'column' as const,\n alignItems: 'stretch',\n gap: 1.5,\n width: '100%',\n minWidth: 0,\n // Only ever at the wide shape. Narrow, the rail is a disclosure or the page\n // itself, and two independent scrollbars on a phone is a trap rather than a\n // convenience.\n [atLeastRail(theme, breakpoint ?? 'md')]: {\n flexDirection: 'row',\n // A card stands apart from the panel by 32px, as its prototype draws it;\n // the ruled column keeps its 24.\n gap: railVariant === 'card' ? 4 : 3,\n ...(fillHeight ? { height: '100%', minHeight: 0 } : {}),\n },\n });\n}\n\n/**\n * A reusable, agnostic Facebook-style settings shell: a searchable left rail of\n * grouped categories/subcategories and a central panel that renders the selected\n * configuration screen (`children`). Navigation is data-driven via `groups`; the\n * host owns routing (pass `linkComponent` + item `href`, or handle `onSelectItem`).\n *\n * ## Two narrow-width shapes\n *\n * `navVariant=\"switcher\"` (the default) folds the rail into a disclosure above\n * the panel. `navVariant=\"drilldown\"` gives the phone shape instead: at the\n * area's index the LIST is the page, and inside a section the panel is the page\n * with a back link and a scrollable strip of sibling sections above it.\n *\n * ## Why the width decision is CSS and not JavaScript\n *\n * Every part that changes between the two shapes does it through a `display`\n * pair keyed on `railBreakpoint`. Nothing here asks a media query in JS and\n * renders one branch.\n *\n * That is not a performance preference. A layout that RENDERS one navigation and\n * not the other can offer the narrow width less than the wide one, and no test\n * or review catches it — the missing control simply is not in the tree to be\n * asserted about. With both forms always mounted, \"the narrow width reaches\n * everything the wide one does\" holds by construction, and an audit that counts\n * controls per width gets the same answer at both.\n */\nexport const SettingsLayout: React.FC<SettingsLayoutProps> = (props) => {\n const {\n title,\n groups,\n activeItemId,\n onSelectItem,\n searchPlaceholder,\n defaultQuery,\n emptySearchLabel,\n emptySearchAction,\n linkComponent,\n children,\n testIdPrefix,\n railBreakpoint,\n fillHeight = false,\n navVariant,\n atIndex,\n indexHref,\n backLabel,\n sectionChips,\n } = withDefaults(props, DEFAULTS) as ResolvedProps;\n const [query, setQuery] = useState(defaultQuery);\n const [navOpen, setNavOpen] = useState(false);\n const filteredGroups = useMemo(() => filterGroups(groups, query), [groups, query]);\n const activeLabel = useMemo(() => activeItemLabel(groups, activeItemId), [groups, activeItemId]);\n\n const drilldown = navVariant === 'drilldown';\n const ariaLabel = typeof title === 'string' ? title : 'Settings';\n\n return (\n <Box\n data-testid={testIdPrefix}\n data-nav-variant={navVariant}\n data-at-index={atIndex ? 'true' : 'false'}\n sx={shellSx(railBreakpoint, fillHeight, railLookOf(props).railVariant)}\n >\n <SettingsRail\n title={title}\n activeLabel={activeLabel}\n navOpen={navOpen}\n onToggleNav={() => setNavOpen((open) => !open)}\n query={query}\n onQueryChange={setQuery}\n searchPlaceholder={searchPlaceholder}\n emptySearchLabel={emptySearchLabel}\n emptySearchAction={emptySearchAction}\n filteredGroups={filteredGroups}\n activeItemId={activeItemId}\n linkComponent={linkComponent}\n onSelectItem={onSelectItem}\n onNavigate={() => setNavOpen(false)}\n testIdPrefix={testIdPrefix}\n variant={navVariant}\n {...railLookOf(props)}\n breakpoint={railBreakpoint}\n atIndex={atIndex}\n fillHeight={fillHeight}\n />\n\n <SettingsPanel\n inSection={drilldown && !atIndex}\n hideOnNarrow={drilldown && atIndex}\n breakpoint={railBreakpoint}\n indexHref={indexHref}\n sectionTitle={props.sectionTitle}\n sectionDescription={props.sectionDescription}\n backLabel={backLabel}\n ariaLabel={ariaLabel}\n sectionChips={sectionChips}\n activeItemId={activeItemId}\n linkComponent={linkComponent}\n onSelectItem={onSelectItem}\n testIdPrefix={testIdPrefix}\n fillHeight={fillHeight}\n >\n {children}\n </SettingsPanel>\n </Box>\n );\n};\n\nSettingsLayout.displayName = 'SettingsLayout';\n"],"mappings":";;;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