@12-apps/ui 6.74.2 → 6.76.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.
Files changed (74) hide show
  1. package/dist/_internal/components/form/Textarea/Textarea.js +1 -1
  2. package/dist/_internal/components/form/index.js +1 -1
  3. package/dist/_internal/components/index.js +5 -5
  4. package/dist/_internal/components/layout/Drawer/Drawer.js +1 -1
  5. package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.items.js +3 -3
  6. package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.js +8 -8
  7. package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.rail.js +4 -4
  8. package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.styles.js +3 -1
  9. package/dist/_internal/components/layout/SettingsLayout/SettingsPanel.js +5 -5
  10. package/dist/_internal/components/layout/SettingsLayout/SettingsSectionChips.js +3 -3
  11. package/dist/_internal/components/layout/SettingsLayout/SettingsSectionHeader.js +2 -2
  12. package/dist/_internal/components/layout/SettingsLayout/SettingsStatusMarker.js +2 -2
  13. package/dist/_internal/components/layout/index.js +1 -1
  14. package/dist/_internal/components/navigation/SectionNav/SectionNav.bar.js +3 -3
  15. package/dist/_internal/components/navigation/SectionNav/SectionNav.js +4 -4
  16. package/dist/_internal/components/navigation/SectionNav/SectionNav.sheet.js +2 -2
  17. package/dist/_internal/components/navigation/index.js +4 -4
  18. package/dist/{chunk-V5EWCJBT.js → chunk-4BLVVMY7.js} +3 -3
  19. package/dist/{chunk-OKYYHBGS.js → chunk-6KM3TL4Q.js} +11 -4
  20. package/dist/chunk-6KM3TL4Q.js.map +1 -0
  21. package/dist/{chunk-27F2VXS4.js → chunk-7IXXASQ6.js} +2 -2
  22. package/dist/{chunk-DBFRCTI5.js → chunk-7Y2VWMGS.js} +2 -2
  23. package/dist/{chunk-UALPKKAY.js → chunk-F742IMLQ.js} +5 -2
  24. package/dist/{chunk-UALPKKAY.js.map → chunk-F742IMLQ.js.map} +1 -1
  25. package/dist/{chunk-F3Q4CMRB.js → chunk-GBVNY2LG.js} +3 -3
  26. package/dist/{chunk-NM46HQSW.js → chunk-J26ZWYQI.js} +2 -2
  27. package/dist/{chunk-KKVM723A.js → chunk-LY5I3ZSV.js} +4 -4
  28. package/dist/{chunk-NYFNF7I5.js → chunk-NK4T624E.js} +3 -1
  29. package/dist/chunk-NK4T624E.js.map +1 -0
  30. package/dist/{chunk-URSYEHPU.js → chunk-PMRLFNBT.js} +2 -2
  31. package/dist/{chunk-X47MWURD.js → chunk-Q6MZHT2F.js} +10 -8
  32. package/dist/chunk-Q6MZHT2F.js.map +1 -0
  33. package/dist/{chunk-TNYKM4UU.js → chunk-SWQXAUUG.js} +55 -21
  34. package/dist/chunk-SWQXAUUG.js.map +1 -0
  35. package/dist/{chunk-6KEXHOIF.js → chunk-WOXNVM52.js} +2 -2
  36. package/dist/form/Textarea.js +1 -1
  37. package/dist/layout/Drawer.js +1 -1
  38. package/dist/layout/SettingsLayout.js +8 -8
  39. package/dist/navigation/SectionNav.js +4 -4
  40. package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
  41. package/dist/types/components/form/Textarea/Textarea.types.d.ts +4 -2
  42. package/dist/types/components/form/Textarea/Textarea.types.d.ts.map +1 -1
  43. package/dist/types/components/layout/Drawer/Drawer.d.ts.map +1 -1
  44. package/dist/types/components/layout/SettingsLayout/SettingsLayout.d.ts.map +1 -1
  45. package/dist/types/components/layout/SettingsLayout/SettingsLayout.rail.d.ts +6 -2
  46. package/dist/types/components/layout/SettingsLayout/SettingsLayout.rail.d.ts.map +1 -1
  47. package/dist/types/components/layout/SettingsLayout/SettingsLayout.styles.d.ts +2 -0
  48. package/dist/types/components/layout/SettingsLayout/SettingsLayout.styles.d.ts.map +1 -1
  49. package/dist/types/components/layout/SettingsLayout/SettingsLayout.types.d.ts +19 -0
  50. package/dist/types/components/layout/SettingsLayout/SettingsLayout.types.d.ts.map +1 -1
  51. package/dist/types/components/layout/SettingsLayout/index.d.ts +1 -1
  52. package/dist/types/components/layout/SettingsLayout/index.d.ts.map +1 -1
  53. package/package.json +1 -1
  54. package/src/components/form/Textarea/Textarea.tsx +14 -7
  55. package/src/components/form/Textarea/Textarea.types.ts +4 -2
  56. package/src/components/layout/Drawer/Drawer.tsx +4 -1
  57. package/src/components/layout/SettingsLayout/SettingsLayout.md +19 -0
  58. package/src/components/layout/SettingsLayout/SettingsLayout.rail.tsx +67 -23
  59. package/src/components/layout/SettingsLayout/SettingsLayout.styles.ts +3 -0
  60. package/src/components/layout/SettingsLayout/SettingsLayout.tsx +12 -0
  61. package/src/components/layout/SettingsLayout/SettingsLayout.types.ts +20 -0
  62. package/src/components/layout/SettingsLayout/index.ts +1 -0
  63. package/dist/chunk-NYFNF7I5.js.map +0 -1
  64. package/dist/chunk-OKYYHBGS.js.map +0 -1
  65. package/dist/chunk-TNYKM4UU.js.map +0 -1
  66. package/dist/chunk-X47MWURD.js.map +0 -1
  67. /package/dist/{chunk-V5EWCJBT.js.map → chunk-4BLVVMY7.js.map} +0 -0
  68. /package/dist/{chunk-27F2VXS4.js.map → chunk-7IXXASQ6.js.map} +0 -0
  69. /package/dist/{chunk-DBFRCTI5.js.map → chunk-7Y2VWMGS.js.map} +0 -0
  70. /package/dist/{chunk-F3Q4CMRB.js.map → chunk-GBVNY2LG.js.map} +0 -0
  71. /package/dist/{chunk-NM46HQSW.js.map → chunk-J26ZWYQI.js.map} +0 -0
  72. /package/dist/{chunk-KKVM723A.js.map → chunk-LY5I3ZSV.js.map} +0 -0
  73. /package/dist/{chunk-URSYEHPU.js.map → chunk-PMRLFNBT.js.map} +0 -0
  74. /package/dist/{chunk-6KEXHOIF.js.map → chunk-WOXNVM52.js.map} +0 -0
@@ -6,17 +6,19 @@ import Box from '@mui/material/Box/index.js';
6
6
  import Button from '@mui/material/Button/index.js';
7
7
  import InputAdornment from '@mui/material/InputAdornment/index.js';
8
8
  import TextField from '@mui/material/TextField/index.js';
9
+ import type { Theme } from '@mui/material/styles/index.js';
9
10
  import Typography from '@mui/material/Typography/index.js';
10
11
  import React from 'react';
11
12
 
12
13
  import { SettingsRailGroup, type RailShape } from './SettingsLayout.items';
13
- import { atLeastRail, displayAcrossRail, railWidth, TOUCH_TARGET } from './SettingsLayout.styles';
14
+ import { atLeastRail, displayAcrossRail, railCardWidth, railWidth, TOUCH_TARGET } from './SettingsLayout.styles';
14
15
  import { rem, sxRem } from '../../../tokens/relative';
15
16
  import type {
16
17
  SettingsEmptySearchAction,
17
18
  SettingsLayoutProps,
18
19
  SettingsNavGroup,
19
20
  SettingsRailBreakpoint,
21
+ SettingsRailVariant,
20
22
  } from './SettingsLayout.types';
21
23
 
22
24
  interface RailToggleProps {
@@ -139,9 +141,39 @@ export interface RailBodyProps extends RailShape {
139
141
  onSelectItem?: (id: string) => void;
140
142
  onNavigate?: () => void;
141
143
  testIdPrefix: string;
144
+ /** Whether the search field is drawn (`SettingsLayoutProps.searchable`). */
145
+ searchable: boolean;
142
146
  }
143
147
 
144
- /** The searchable rail body (search + groups). */
148
+ /** The rail's search field. */
149
+ function RailSearch({
150
+ query,
151
+ onQueryChange,
152
+ searchPlaceholder,
153
+ testIdPrefix,
154
+ }: Pick<RailBodyProps, 'query' | 'onQueryChange' | 'searchPlaceholder' | 'testIdPrefix'>): React.JSX.Element {
155
+ return (
156
+ <TextField
157
+ value={query}
158
+ onChange={(event) => onQueryChange(event.target.value)}
159
+ placeholder={searchPlaceholder}
160
+ size="small"
161
+ fullWidth
162
+ aria-label={searchPlaceholder}
163
+ data-testid={`${testIdPrefix}-search`}
164
+ InputProps={{
165
+ startAdornment: (
166
+ <InputAdornment position="start">
167
+ <SearchIcon fontSize="small" sx={{ color: 'text.secondary' }} />
168
+ </InputAdornment>
169
+ ),
170
+ }}
171
+ sx={{ mb: 2 }}
172
+ />
173
+ );
174
+ }
175
+
176
+ /** The rail body: the search field when the area has one, then the groups. */
145
177
  function SettingsRailBody({
146
178
  navOpen,
147
179
  query,
@@ -155,6 +187,7 @@ function SettingsRailBody({
155
187
  onSelectItem,
156
188
  onNavigate,
157
189
  testIdPrefix,
190
+ searchable,
158
191
  ...shape
159
192
  }: RailBodyProps): React.JSX.Element {
160
193
  // `drilldown` has no disclosure to be closed behind: below the breakpoint the
@@ -169,23 +202,14 @@ function SettingsRailBody({
169
202
  : displayAcrossRail(theme, shape.breakpoint, hidden, 'block')
170
203
  }
171
204
  >
172
- <TextField
173
- value={query}
174
- onChange={(event) => onQueryChange(event.target.value)}
175
- placeholder={searchPlaceholder}
176
- size="small"
177
- fullWidth
178
- aria-label={searchPlaceholder}
179
- data-testid={`${testIdPrefix}-search`}
180
- InputProps={{
181
- startAdornment: (
182
- <InputAdornment position="start">
183
- <SearchIcon fontSize="small" sx={{ color: 'text.secondary' }} />
184
- </InputAdornment>
185
- ),
186
- }}
187
- sx={{ mb: 2 }}
188
- />
205
+ {searchable ? (
206
+ <RailSearch
207
+ query={query}
208
+ onQueryChange={onQueryChange}
209
+ searchPlaceholder={searchPlaceholder}
210
+ testIdPrefix={testIdPrefix}
211
+ />
212
+ ) : null}
189
213
  {filteredGroups.length === 0 ? (
190
214
  <SettingsSearchEmpty
191
215
  label={emptySearchLabel}
@@ -218,8 +242,29 @@ export type SettingsRailProps = RailBodyProps & {
218
242
  onToggleNav: () => void;
219
243
  /** Scroll inside the rail rather than with the page. See `fillHeight`. */
220
244
  fillHeight?: boolean;
245
+ /** How the rail's own column is drawn. See `SettingsLayoutProps.railVariant`. */
246
+ railVariant?: SettingsRailVariant;
221
247
  };
222
248
 
249
+ /** The rail's own column, as the variant draws it: ruled off, or a card. */
250
+ function railColumnSx(theme: Theme, railVariant: SettingsRailVariant): Record<string, unknown> {
251
+ if (railVariant === 'card') {
252
+ const width = railCardWidth(theme);
253
+ return {
254
+ flex: `0 0 ${width}`,
255
+ width,
256
+ alignSelf: 'flex-start',
257
+ border: `1px solid ${theme.palette.divider}`,
258
+ borderRadius: sxRem(14),
259
+ bgcolor: 'background.paper',
260
+ px: sxRem(12),
261
+ py: sxRem(16),
262
+ };
263
+ }
264
+ const width = railWidth(theme);
265
+ return { flex: `0 0 ${width}`, width, borderRight: `1px solid ${theme.palette.divider}`, pr: sxRem(16) };
266
+ }
267
+
223
268
  /** The navigation column: title, the `switcher`'s disclosure, and the body. */
224
269
  export function SettingsRail({
225
270
  title,
@@ -228,6 +273,7 @@ export function SettingsRail({
228
273
  onToggleNav,
229
274
  testIdPrefix,
230
275
  fillHeight = false,
276
+ railVariant = 'divided',
231
277
  ...bodyProps
232
278
  }: SettingsRailProps): React.JSX.Element {
233
279
  const { variant, breakpoint, atIndex } = bodyProps;
@@ -243,16 +289,14 @@ export function SettingsRail({
243
289
  component="nav"
244
290
  aria-label={typeof title === 'string' ? title : 'Settings'}
245
291
  data-testid={`${testIdPrefix}-rail`}
292
+ data-rail-variant={railVariant}
246
293
  sx={(theme) => ({
247
294
  display: hiddenWhileInSection ? 'none' : 'block',
248
295
  flex: '0 0 auto',
249
296
  width: '100%',
250
297
  [atLeastRail(theme, breakpoint)]: {
251
298
  display: 'block',
252
- flex: `0 0 ${railWidth(theme)}`,
253
- width: railWidth(theme),
254
- borderRight: `1px solid ${theme.palette.divider}`,
255
- pr: 2,
299
+ ...railColumnSx(theme, railVariant),
256
300
  // Its own scrollbar, so a settings area with twenty categories does
257
301
  // not make the thing you NAVIGATE with scroll away while you read the
258
302
  // panel. `minHeight: 0` is the load-bearing half: without it a flex
@@ -7,6 +7,9 @@ import type { SettingsNavStatus, SettingsRailBreakpoint } from './SettingsLayout
7
7
  /** Fixed width of the left navigation rail once it has its own column (300 design px). */
8
8
  export const railWidth = (theme: Theme): string => rem(theme, 300);
9
9
 
10
+ /** Width of the rail drawn as a card (`railVariant="card"`, 200 design px). */
11
+ export const railCardWidth = (theme: Theme): string => rem(theme, 200);
12
+
10
13
  /** Visually hidden, still read aloud — for text a marker's colour cannot carry. */
11
14
  export const SR_ONLY_SX: SxProps<Theme> = {
12
15
  position: 'absolute',
@@ -46,6 +46,17 @@ const DEFAULTS = {
46
46
  backLabel: 'Back',
47
47
  } satisfies Partial<SettingsLayoutProps>;
48
48
 
49
+ /**
50
+ * How the rail looks: its search field, and its frame from the breakpoint up.
51
+ * Both default to the shape every consumer had before they existed.
52
+ */
53
+ function railLookOf({
54
+ searchable = true,
55
+ railVariant = 'divided',
56
+ }: SettingsLayoutProps): Required<Pick<SettingsLayoutProps, 'searchable' | 'railVariant'>> {
57
+ return { searchable, railVariant };
58
+ }
59
+
49
60
  /** Stacked below the rail's breakpoint, two columns at and above it. */
50
61
  function shellSx(breakpoint: SettingsLayoutProps['railBreakpoint'], fillHeight: boolean): SxProps<Theme> {
51
62
  return (theme: Theme) => ({
@@ -145,6 +156,7 @@ export const SettingsLayout: React.FC<SettingsLayoutProps> = (props) => {
145
156
  onNavigate={() => setNavOpen(false)}
146
157
  testIdPrefix={testIdPrefix}
147
158
  variant={navVariant}
159
+ {...railLookOf(props)}
148
160
  breakpoint={railBreakpoint}
149
161
  atIndex={atIndex}
150
162
  fillHeight={fillHeight}
@@ -89,6 +89,12 @@ export type SettingsRailBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | number;
89
89
  */
90
90
  export type SettingsNavVariant = 'switcher' | 'drilldown';
91
91
 
92
+ /**
93
+ * How the rail is drawn once it has its own column: `divided` — a 300px column
94
+ * ruled off from the panel; `card` — a 200px bordered card beside it.
95
+ */
96
+ export type SettingsRailVariant = 'divided' | 'card';
97
+
92
98
  /** The exit offered inside the empty-search state, so the dead end has a door. */
93
99
  export interface SettingsEmptySearchAction {
94
100
  /** Button label, e.g. `"Limpar a busca"`. */
@@ -168,6 +174,20 @@ export interface SettingsLayoutProps {
168
174
  railBreakpoint?: SettingsRailBreakpoint;
169
175
  /** Narrow-width navigation shape. Defaults to `"switcher"`. */
170
176
  navVariant?: SettingsNavVariant;
177
+ /**
178
+ * Whether the rail carries its search field. Defaults to `true`.
179
+ *
180
+ * A settings area with twenty categories needs the field; an area of eight
181
+ * rows a reader takes in at a glance is better without one, which is how a
182
+ * storefront's own account area draws it. Off, the rail shows every group.
183
+ */
184
+ searchable?: boolean;
185
+ /**
186
+ * How the rail is drawn from `railBreakpoint` up. Defaults to `"divided"`
187
+ * (a 300px column ruled off from the panel); `"card"` draws it as a 200px
188
+ * bordered card. Below the breakpoint both look the same.
189
+ */
190
+ railVariant?: SettingsRailVariant;
171
191
  /**
172
192
  * True when the router is at the area's index rather than inside a section.
173
193
  *
@@ -10,5 +10,6 @@ export type {
10
10
  SettingsNavItem,
11
11
  SettingsNavStatus,
12
12
  SettingsNavVariant,
13
+ SettingsRailVariant,
13
14
  SettingsRailBreakpoint,
14
15
  } from './SettingsLayout.types';
@@ -1 +0,0 @@
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/** 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,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":[]}
@@ -1 +0,0 @@
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/** Stacked below the rail's breakpoint, two columns at and above it. */\nfunction shellSx(breakpoint: SettingsLayoutProps['railBreakpoint'], fillHeight: boolean): 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 gap: 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)}\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 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":";;;;;;;;;;;;;;;;;;AAEA,OAAO,SAAS;AAEhB,SAAgB,SAAS,gBAAgB;AAwHrC,SAME,KANF;AAvFJ,IAAM,WAAW;AAAA,EACf,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AACb;AAGA,SAAS,QAAQ,YAAmD,YAAqC;AACvG,SAAO,CAAC,WAAkB;AAAA,IACxB,SAAS;AAAA,IACT,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,UAAU;AAAA;AAAA;AAAA;AAAA,IAIV,CAAC,YAAY,OAAO,cAAc,IAAI,CAAC,GAAG;AAAA,MACxC,eAAe;AAAA,MACf,KAAK;AAAA,MACL,GAAI,aAAa,EAAE,QAAQ,QAAQ,WAAW,EAAE,IAAI,CAAC;AAAA,IACvD;AAAA,EACF;AACF;AA4BO,IAAM,iBAAgD,CAAC,UAAU;AACtE,QAAM;AAAA,IACJ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A,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/layout/SettingsLayout/SettingsLayout.rail.tsx"],"sourcesContent":["'use client';\n\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport SearchIcon from '@mui/icons-material/Search';\nimport Box from '@mui/material/Box/index.js';\nimport Button from '@mui/material/Button/index.js';\nimport InputAdornment from '@mui/material/InputAdornment/index.js';\nimport TextField from '@mui/material/TextField/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport React from 'react';\n\nimport { SettingsRailGroup, type RailShape } from './SettingsLayout.items';\nimport { atLeastRail, displayAcrossRail, railWidth, TOUCH_TARGET } from './SettingsLayout.styles';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport type {\n SettingsEmptySearchAction,\n SettingsLayoutProps,\n SettingsNavGroup,\n SettingsRailBreakpoint,\n} from './SettingsLayout.types';\n\ninterface RailToggleProps {\n title?: React.ReactNode;\n activeLabel?: string;\n open: boolean;\n onToggle: () => void;\n breakpoint: SettingsRailBreakpoint;\n testIdPrefix: string;\n}\n\n/**\n * `switcher`-only collapse control: shows the current section (a compact\n * switcher) so the panel content stays at the top of the screen. Hidden once the\n * rail has its own column.\n */\nfunction SettingsRailToggle({\n title,\n activeLabel,\n open,\n onToggle,\n breakpoint,\n testIdPrefix,\n}: RailToggleProps): React.JSX.Element {\n return (\n <Box\n component=\"button\"\n type=\"button\"\n onClick={onToggle}\n aria-expanded={open}\n aria-label={typeof title === 'string' ? title : 'Settings'}\n data-testid={`${testIdPrefix}-toggle`}\n sx={(theme) => ({\n ...displayAcrossRail(theme, breakpoint, 'flex', 'none'),\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 1,\n width: '100%',\n minHeight: rem(theme, TOUCH_TARGET),\n px: 1.5,\n py: 1,\n mb: 1,\n textAlign: 'left',\n cursor: 'pointer',\n color: 'text.primary',\n background: 'transparent',\n border: `1px solid ${theme.palette.divider}`,\n borderRadius: 1.5,\n })}\n >\n <Box sx={{ minWidth: 0 }}>\n {title ? (\n <Typography variant=\"caption\" sx={{ display: 'block', color: 'text.secondary' }}>\n {title}\n </Typography>\n ) : null}\n <Typography variant=\"body2\" noWrap sx={{ fontWeight: 600 }}>\n {activeLabel ?? ''}\n </Typography>\n </Box>\n <ExpandMoreIcon\n fontSize=\"small\"\n sx={{\n flex: '0 0 auto',\n color: 'text.secondary',\n transition: 'transform 150ms ease',\n transform: open ? 'rotate(180deg)' : 'none',\n '@media (prefers-reduced-motion: reduce)': { transition: 'none' },\n }}\n />\n </Box>\n );\n}\n\n/** The empty-search state, with the way out of it rendered inside. */\nfunction SettingsSearchEmpty({\n label,\n action,\n onClear,\n testIdPrefix,\n}: {\n label: React.ReactNode;\n action?: SettingsEmptySearchAction;\n onClear: () => void;\n testIdPrefix: string;\n}): React.JSX.Element {\n return (\n <Box data-testid={`${testIdPrefix}-empty`} sx={{ px: 1, py: 2 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {label}\n </Typography>\n {action ? (\n <Button\n size=\"small\"\n variant=\"outlined\"\n onClick={() => {\n onClear();\n action.onClear?.();\n }}\n data-testid={`${testIdPrefix}-empty-action`}\n sx={{ mt: 1.5, minHeight: sxRem(TOUCH_TARGET) }}\n >\n {action.label}\n </Button>\n ) : null}\n </Box>\n );\n}\n\nexport interface RailBodyProps extends RailShape {\n navOpen: boolean;\n query: string;\n onQueryChange: (value: string) => void;\n searchPlaceholder: string;\n emptySearchLabel: React.ReactNode;\n emptySearchAction?: SettingsEmptySearchAction;\n filteredGroups: SettingsNavGroup[];\n activeItemId?: string;\n linkComponent?: SettingsLayoutProps['linkComponent'];\n onSelectItem?: (id: string) => void;\n onNavigate?: () => void;\n testIdPrefix: string;\n}\n\n/** The searchable rail body (search + groups). */\nfunction SettingsRailBody({\n navOpen,\n query,\n onQueryChange,\n searchPlaceholder,\n emptySearchLabel,\n emptySearchAction,\n filteredGroups,\n activeItemId,\n linkComponent,\n onSelectItem,\n onNavigate,\n testIdPrefix,\n ...shape\n}: RailBodyProps): React.JSX.Element {\n // `drilldown` has no disclosure to be closed behind: below the breakpoint the\n // body is the page, above it the rail. Only `switcher` hides it.\n const hidden = navOpen ? 'block' : 'none';\n return (\n <Box\n data-testid={`${testIdPrefix}-rail-body`}\n sx={(theme) =>\n shape.variant === 'drilldown'\n ? { display: 'block' }\n : displayAcrossRail(theme, shape.breakpoint, hidden, 'block')\n }\n >\n <TextField\n value={query}\n onChange={(event) => onQueryChange(event.target.value)}\n placeholder={searchPlaceholder}\n size=\"small\"\n fullWidth\n aria-label={searchPlaceholder}\n data-testid={`${testIdPrefix}-search`}\n InputProps={{\n startAdornment: (\n <InputAdornment position=\"start\">\n <SearchIcon fontSize=\"small\" sx={{ color: 'text.secondary' }} />\n </InputAdornment>\n ),\n }}\n sx={{ mb: 2 }}\n />\n {filteredGroups.length === 0 ? (\n <SettingsSearchEmpty\n label={emptySearchLabel}\n action={emptySearchAction}\n onClear={() => onQueryChange('')}\n testIdPrefix={testIdPrefix}\n />\n ) : (\n filteredGroups.map((group) => (\n <SettingsRailGroup\n key={group.id}\n group={group}\n activeItemId={activeItemId}\n linkComponent={linkComponent}\n onSelectItem={onSelectItem}\n onNavigate={onNavigate}\n testIdPrefix={testIdPrefix}\n {...shape}\n />\n ))\n )}\n </Box>\n );\n}\n\n/** Props for {@link SettingsRail}: the rail body's inputs plus the mobile chrome. */\nexport type SettingsRailProps = RailBodyProps & {\n title?: React.ReactNode;\n activeLabel?: string;\n onToggleNav: () => void;\n /** Scroll inside the rail rather than with the page. See `fillHeight`. */\n fillHeight?: boolean;\n};\n\n/** The navigation column: title, the `switcher`'s disclosure, and the body. */\nexport function SettingsRail({\n title,\n activeLabel,\n navOpen,\n onToggleNav,\n testIdPrefix,\n fillHeight = false,\n ...bodyProps\n}: SettingsRailProps): React.JSX.Element {\n const { variant, breakpoint, atIndex } = bodyProps;\n // In `drilldown` the rail is the index's list below the breakpoint and the\n // left column above it — so inside a section it steps aside for the chip\n // strip. It is `display: none`, never unmounted: the two navigation forms\n // both stay in the DOM at every width, which is what makes \"the narrow width\n // offers what the wide one offers\" true by construction instead of by review.\n const hiddenWhileInSection = variant === 'drilldown' && !atIndex;\n\n return (\n <Box\n component=\"nav\"\n aria-label={typeof title === 'string' ? title : 'Settings'}\n data-testid={`${testIdPrefix}-rail`}\n sx={(theme) => ({\n display: hiddenWhileInSection ? 'none' : 'block',\n flex: '0 0 auto',\n width: '100%',\n [atLeastRail(theme, breakpoint)]: {\n display: 'block',\n flex: `0 0 ${railWidth(theme)}`,\n width: railWidth(theme),\n borderRight: `1px solid ${theme.palette.divider}`,\n pr: 2,\n // Its own scrollbar, so a settings area with twenty categories does\n // not make the thing you NAVIGATE with scroll away while you read the\n // panel. `minHeight: 0` is the load-bearing half: without it a flex\n // child refuses to shrink below its content and `overflow` never\n // engages.\n ...(fillHeight\n ? { height: '100%', minHeight: 0, overflowY: 'auto' as const, overscrollBehavior: 'contain' as const }\n : {}),\n },\n })}\n >\n {title ? (\n <Typography\n variant=\"h6\"\n data-testid={`${testIdPrefix}-title`}\n sx={(theme) => ({\n ...(variant === 'drilldown'\n ? { display: 'block' }\n : displayAcrossRail(theme, breakpoint, 'none', 'block')),\n fontWeight: 700,\n mb: 1.5,\n })}\n >\n {title}\n </Typography>\n ) : null}\n {variant === 'switcher' ? (\n <SettingsRailToggle\n title={title}\n activeLabel={activeLabel}\n open={navOpen}\n onToggle={onToggleNav}\n breakpoint={breakpoint}\n testIdPrefix={testIdPrefix}\n />\n ) : null}\n <SettingsRailBody navOpen={navOpen} testIdPrefix={testIdPrefix} {...bodyProps} />\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AACvB,OAAO,SA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gBACC;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,eAAa,GAAG,YAAY;AAAA,YAC5B,IAAI,CAAC,WAAW;AAAA,cACd,GAAI,YAAY,cACZ,EAAE,SAAS,QAAQ,IACnB,kBAAkB,OAAO,YAAY,QAAQ,OAAO;AAAA,cACxD,YAAY;AAAA,cACZ,IAAI;AAAA,YACN;AAAA,YAEC;AAAA;AAAA,QACH,IACE;AAAA,QACH,YAAY,aACX;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,MAAM;AAAA,YACN,UAAU;AAAA,YACV;AAAA,YACA;AAAA;AAAA,QACF,IACE;AAAA,QACJ,oBAAC,oBAAiB,SAAkB,cAA6B,GAAG,WAAW;AAAA;AAAA;AAAA,EACjF;AAEJ;","names":[]}
@@ -1 +0,0 @@
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 const sizeMap = {\n xs: { padding: rems(theme, 6, 8), fontSize: rem(theme, 12), minHeight: rem(theme, 60) },\n sm: { padding: rems(theme, 8, 10), fontSize: rem(theme, 14), minHeight: rem(theme, 80) },\n md: { padding: rems(theme, 10, 12), fontSize: rem(theme, 16), minHeight: rem(theme, 100) },\n lg: { padding: rems(theme, 12, 14), fontSize: rem(theme, 18), minHeight: rem(theme, 120) },\n xl: { padding: rems(theme, 14, 16), fontSize: rem(theme, 20), minHeight: rem(theme, 140) } };\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 minRows: 3 } 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={variant === 'autosize' ? minRows : undefined}\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;AA8J9C,SAKI,KALJ;AAxIF,IAAM,qBAAqB,KAAK,aAAa;AAAA,EAC3C,UAAU,MAAM,OAAO,4DAAsB,GAAG;AAAmB,EAAE;AAqBvE,IAAM,iBAAiB,OAAO,kBAAkB;AAAA,EAC9C,mBAAmB,CAAC,SAClB,CAAC,CAAC,iBAAiB,eAAe,cAAc,QAAQ,SAAS,YAAY,OAAO,EAAE;AAAA,IACpF;AAAA,EACF;AAAE,CAAC,EAAuB,CAAC;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAM,MAAM;AACZ,MAAI,CAAC,MAAO,QAAO,CAAC;AACpB,QAAM,eAAe,kBAAkB,OAAO,WAAW;AACzD,QAAM,aAAa,MAAM,QAAQ;AAEjC,QAAM,UAAU;AAAA,IACd,IAAI,EAAE,SAAS,KAAK,OAAO,GAAG,CAAC,GAAG,UAAU,IAAI,OAAO,EAAE,GAAG,WAAW,IAAI,OAAO,EAAE,EAAE;AAAA,IACtF,IAAI,EAAE,SAAS,KAAK,OAAO,GAAG,EAAE,GAAG,UAAU,IAAI,OAAO,EAAE,GAAG,WAAW,IAAI,OAAO,EAAE,EAAE;AAAA,IACvF,IAAI,EAAE,SAAS,KAAK,OAAO,IAAI,EAAE,GAAG,UAAU,IAAI,OAAO,EAAE,GAAG,WAAW,IAAI,OAAO,GAAG,EAAE;AAAA,IACzF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