@kanso-labs/kanso-ui 0.48.4 → 0.50.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.
@@ -1,10 +1,29 @@
1
1
  import { ReactNode, RefAttributes } from "react";
2
2
  import { NavigationItemProps } from "../../navigation/index.js";
3
3
  import { RenderComponentProps } from "../../render/useRender.js";
4
+ import { FabProps } from "../fab/index.js";
5
+ type NavigationRailFabProps = Omit<FabProps, 'aria-label' | 'label' | 'size'> & RefAttributes<HTMLAnchorElement | HTMLButtonElement> & {
6
+ /**
7
+ * The FAB's name in either form, in place of `label`, for a name that
8
+ * says more than the words drawn beside the icon.
9
+ */
10
+ 'aria-label'?: string;
11
+ /**
12
+ * What the FAB does, in words: drawn beside the icon in the expanded rail,
13
+ * and the FAB's name in the collapsed one, where the icon stands alone.
14
+ */
15
+ label: string;
16
+ };
4
17
  type NavigationRailProps = RenderComponentProps<'nav'> & {
5
18
  /**
6
- * What the rail draws above its destinations: a menu button that expands
7
- * it, or a floating action button.
19
+ * The screen's floating action button, a `NavigationRail.Fab`, drawn above
20
+ * the destinations and under the header: its icon alone in the collapsed
21
+ * rail, and the extended FAB in the expanded one.
22
+ */
23
+ fab?: ReactNode;
24
+ /**
25
+ * What the rail draws above its destinations and its FAB: a menu button
26
+ * that expands it, or a mark.
8
27
  */
9
28
  header?: ReactNode;
10
29
  /**
@@ -40,10 +59,30 @@ type NavigationRailProps = RenderComponentProps<'nav'> & {
40
59
  *
41
60
  * The call site's `className` and `style` land on the `<nav>`.
42
61
  */
43
- declare function NavigationRail({ children, header, isExpanded, render, selectedRoute, ...props }: NavigationRailProps): import("react").JSX.Element;
62
+ declare function NavigationRail({ children, fab, header, isExpanded, render, selectedRoute, ...props }: NavigationRailProps): import("react").JSX.Element;
44
63
  declare namespace NavigationRail {
64
+ var Fab: typeof NavigationRailFab;
45
65
  var Item: typeof NavigationRailItem;
46
66
  }
67
+ /**
68
+ * The screen's floating action button in a navigation rail's `fab` slot: the
69
+ * 56dp FAB, its icon alone in the collapsed rail and named by `label`, and
70
+ * the extended FAB with `label` beside the icon in the expanded rail.
71
+ *
72
+ * ```tsx
73
+ * <NavigationRail
74
+ * aria-label="Label"
75
+ * fab={
76
+ * <NavigationRail.Fab label="Label" onPress={add}>
77
+ * <PlusIcon />
78
+ * </NavigationRail.Fab>
79
+ * }
80
+ * />
81
+ * ```
82
+ *
83
+ * It takes Fab's props otherwise: `tone`, `variant`, `href` and the rest.
84
+ */
85
+ declare function NavigationRailFab({ label, ...props }: NavigationRailFabProps): import("react").JSX.Element;
47
86
  /**
48
87
  * One destination of a navigation rail — an icon, a label and, when it is the
49
88
  * current one, the active indicator. See `NavigationRail`.
@@ -54,4 +93,4 @@ declare namespace NavigationRail {
54
93
  * component itself rather than a reference to a client one.
55
94
  */
56
95
  declare function NavigationRailItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>): import("react").JSX.Element;
57
- export { NavigationRailItem, type NavigationItemProps as NavigationRailItemProps, type NavigationRailProps, NavigationRail as default };
96
+ export { NavigationRailFab, type NavigationRailFabProps, NavigationRailItem, type NavigationItemProps as NavigationRailItemProps, type NavigationRailProps, NavigationRail as default };
@@ -1,29 +1,57 @@
1
1
  "use client";
2
2
  import { c } from "react/compiler-runtime";
3
- import "react";
3
+ import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { use } from "react";
4
5
  import { NavigationItem, NavigationList } from "../../navigation/index.js";
5
6
  import { NavigationContext } from "../../navigation/context.js";
7
+ import { hasContent } from "../../render/content.js";
6
8
  import { useRender } from "../../render/useRender.js";
7
9
  import { mergeStyles } from "../../styles/merge.js";
10
+ import Fab from "../fab/index.js";
8
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
12
  // src/components/navigation-rail/index.tsx
10
- const styles = { destinations: {
11
- kGNEyG: "x6s0dn4",
12
- kSGwAc: "xkh2ocl",
13
- kB7OPa: "x9f619",
14
- k1xSpc: "x78zum5",
15
- kCS8Yb: "xdl72j9",
16
- kXwgrk: "xdt5ytf",
17
- kzQI83: "x1iyjqo2",
18
- kmuXW: "xs83m0k",
19
- kqGvvJ: "x15zwqr x196bl58",
20
- kUOVxO: "x13jr4wj x1knonev",
21
- kAzted: "x2lwn1j",
22
- kORKVm: "x1odjw0f",
23
- k8WAf4: "xifx94n x1flqomg",
24
- kg3NbH: "xm9j1uf x1snzwe2",
25
- $$css: true
26
- } };
13
+ const styles = {
14
+ destinations: {
15
+ kGNEyG: "x6s0dn4",
16
+ kSGwAc: "xkh2ocl",
17
+ kB7OPa: "x9f619",
18
+ k1xSpc: "x78zum5",
19
+ kCS8Yb: "xdl72j9",
20
+ kXwgrk: "xdt5ytf",
21
+ kzQI83: "x1iyjqo2",
22
+ kmuXW: "xs83m0k",
23
+ kqGvvJ: "x15zwqr x196bl58",
24
+ kUOVxO: "x13jr4wj x1knonev",
25
+ kAzted: "x2lwn1j",
26
+ kORKVm: "x1odjw0f",
27
+ k8WAf4: "xifx94n x1flqomg",
28
+ kg3NbH: "xm9j1uf x1snzwe2",
29
+ $$css: true
30
+ },
31
+ header: {
32
+ kGNEyG: "x6s0dn4",
33
+ kB7OPa: "x9f619",
34
+ k1xSpc: "x78zum5",
35
+ kXwgrk: "xdt5ytf",
36
+ k1K539: "xqa3g7y",
37
+ $$css: true
38
+ },
39
+ headerAboveFab: {
40
+ k1K539: "xat24cr",
41
+ $$css: true
42
+ },
43
+ headerAboveFabExpanded: {
44
+ k1K539: "x135sh1i",
45
+ $$css: true
46
+ },
47
+ headerExpanded: {
48
+ kGNEyG: "x1cy8zhl",
49
+ kSGwAc: "xkh2ocl",
50
+ k1K539: "x1mgj515",
51
+ kZCmMZ: "xdxifnh",
52
+ $$css: true
53
+ }
54
+ };
27
55
  /**
28
56
  * The column of top-level destinations a medium or wider window keeps at its
29
57
  * leading edge, collapsed or, with `isExpanded`, expanded. Each destination
@@ -44,127 +72,192 @@ const styles = { destinations: {
44
72
  * The call site's `className` and `style` land on the `<nav>`.
45
73
  */
46
74
  function NavigationRail(t0) {
47
- const $ = c(32);
75
+ const $ = c(36);
48
76
  let children;
49
77
  let context;
50
- let header;
78
+ let fab;
79
+ let hasFab;
51
80
  let isExpanded;
52
81
  let render;
53
82
  let t1;
54
83
  let t2;
55
84
  let t3;
56
85
  let t4;
86
+ let t5;
57
87
  if ($[0] !== t0) {
58
- const { children: t5, header: t6, isExpanded: t7, render: t8, selectedRoute, ...props } = t0;
59
- children = t5;
60
- header = t6;
61
- render = t8;
62
- isExpanded = t7 === void 0 ? false : t7;
63
- const t9 = isExpanded ? "expanded" : "collapsed";
64
- let t10;
65
- if ($[10] !== selectedRoute || $[11] !== t9) {
66
- t10 = {
67
- form: t9,
88
+ const { children: t6, fab: t7, header, isExpanded: t8, render: t9, selectedRoute, ...props$1 } = t0;
89
+ children = t6;
90
+ fab = t7;
91
+ render = t9;
92
+ isExpanded = t8 === void 0 ? false : t8;
93
+ const t10 = isExpanded ? "expanded" : "collapsed";
94
+ let t11;
95
+ if ($[12] !== selectedRoute || $[13] !== t10) {
96
+ t11 = {
97
+ form: t10,
68
98
  selectedRoute
69
99
  };
70
- $[10] = selectedRoute;
71
- $[11] = t9;
72
- $[12] = t10;
73
- } else t10 = $[12];
74
- context = t10;
75
- t4 = useRender;
76
- t3 = "nav";
77
- t1 = props;
78
- t2 = mergeStyles({
100
+ $[12] = selectedRoute;
101
+ $[13] = t10;
102
+ $[14] = t11;
103
+ } else t11 = $[14];
104
+ context = t11;
105
+ hasFab = hasContent(fab);
106
+ t5 = useRender;
107
+ t4 = "nav";
108
+ t2 = props$1;
109
+ t3 = mergeStyles({
79
110
  0: { className: "x6s0dn4 x14s9m32 x5yr21d x9f619 x78zum5 xdt5ytf x2lah0s x8i8c5o xlaft8j xzoy561 x13oubkp" },
80
111
  1: { className: "x6s0dn4 x14s9m32 x5yr21d x9f619 x78zum5 xdt5ytf x2lah0s x8i8c5o xlaft8j xeq5yr9 xxc7z9f x12rczxh x17qtykl" }
81
- }[!!isExpanded << 0], props);
112
+ }[!!isExpanded << 0], props$1);
113
+ t1 = header === void 0 ? null : /* @__PURE__ */ jsx("div", {
114
+ ...props(styles.header, isExpanded && styles.headerExpanded, hasFab && (isExpanded ? styles.headerAboveFabExpanded : styles.headerAboveFab)),
115
+ children: header
116
+ });
82
117
  $[0] = t0;
83
118
  $[1] = children;
84
119
  $[2] = context;
85
- $[3] = header;
86
- $[4] = isExpanded;
87
- $[5] = render;
88
- $[6] = t1;
89
- $[7] = t2;
90
- $[8] = t3;
91
- $[9] = t4;
120
+ $[3] = fab;
121
+ $[4] = hasFab;
122
+ $[5] = isExpanded;
123
+ $[6] = render;
124
+ $[7] = t1;
125
+ $[8] = t2;
126
+ $[9] = t3;
127
+ $[10] = t4;
128
+ $[11] = t5;
92
129
  } else {
93
130
  children = $[1];
94
131
  context = $[2];
95
- header = $[3];
96
- isExpanded = $[4];
97
- render = $[5];
98
- t1 = $[6];
99
- t2 = $[7];
100
- t3 = $[8];
101
- t4 = $[9];
132
+ fab = $[3];
133
+ hasFab = $[4];
134
+ isExpanded = $[5];
135
+ render = $[6];
136
+ t1 = $[7];
137
+ t2 = $[8];
138
+ t3 = $[9];
139
+ t4 = $[10];
140
+ t5 = $[11];
102
141
  }
103
- let t5;
104
- if ($[13] !== header || $[14] !== isExpanded) {
105
- t5 = header === void 0 ? null : /* @__PURE__ */ jsx("div", {
142
+ let t6;
143
+ if ($[15] !== fab || $[16] !== hasFab || $[17] !== isExpanded) {
144
+ t6 = hasFab ? /* @__PURE__ */ jsx("div", {
106
145
  ...{
107
146
  0: { className: "x6s0dn4 x9f619 x78zum5 xdt5ytf xqa3g7y" },
108
- 1: { className: "x9f619 x78zum5 xdt5ytf x1cy8zhl xkh2ocl x1mgj515 xdxifnh" }
147
+ 1: { className: "x9f619 x78zum5 xdt5ytf x1cy8zhl xkh2ocl x1mgj515" }
109
148
  }[!!isExpanded << 0],
110
- children: header
111
- });
112
- $[13] = header;
113
- $[14] = isExpanded;
114
- $[15] = t5;
115
- } else t5 = $[15];
116
- let t6;
117
- if ($[16] !== children) {
118
- t6 = /* @__PURE__ */ jsx(NavigationList, {
149
+ children: fab
150
+ }) : null;
151
+ $[15] = fab;
152
+ $[16] = hasFab;
153
+ $[17] = isExpanded;
154
+ $[18] = t6;
155
+ } else t6 = $[18];
156
+ let t7;
157
+ if ($[19] !== children) {
158
+ t7 = /* @__PURE__ */ jsx(NavigationList, {
119
159
  layout: styles.destinations,
120
160
  children
121
161
  });
122
- $[16] = children;
123
- $[17] = t6;
124
- } else t6 = $[17];
125
- let t7;
126
- if ($[18] !== t5 || $[19] !== t6) {
127
- t7 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t5, t6] });
128
- $[18] = t5;
129
- $[19] = t6;
162
+ $[19] = children;
130
163
  $[20] = t7;
131
164
  } else t7 = $[20];
132
165
  let t8;
133
- if ($[21] !== t1 || $[22] !== t2 || $[23] !== t7) {
134
- t8 = {
135
- ...t1,
136
- ...t2,
137
- children: t7
138
- };
166
+ if ($[21] !== t1 || $[22] !== t6 || $[23] !== t7) {
167
+ t8 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
168
+ t1,
169
+ t6,
170
+ t7
171
+ ] });
139
172
  $[21] = t1;
140
- $[22] = t2;
173
+ $[22] = t6;
141
174
  $[23] = t7;
142
175
  $[24] = t8;
143
176
  } else t8 = $[24];
144
177
  let t9;
145
- if ($[25] !== render || $[26] !== t3 || $[27] !== t8) {
178
+ if ($[25] !== t2 || $[26] !== t3 || $[27] !== t8) {
146
179
  t9 = {
147
- defaultTagName: t3,
148
- props: t8,
149
- render
180
+ ...t2,
181
+ ...t3,
182
+ children: t8
150
183
  };
151
- $[25] = render;
184
+ $[25] = t2;
152
185
  $[26] = t3;
153
186
  $[27] = t8;
154
187
  $[28] = t9;
155
188
  } else t9 = $[28];
156
- const rail = t4(t9);
157
189
  let t10;
158
- if ($[29] !== context || $[30] !== rail) {
159
- t10 = /* @__PURE__ */ jsx(NavigationContext, {
190
+ if ($[29] !== render || $[30] !== t4 || $[31] !== t9) {
191
+ t10 = {
192
+ defaultTagName: t4,
193
+ props: t9,
194
+ render
195
+ };
196
+ $[29] = render;
197
+ $[30] = t4;
198
+ $[31] = t9;
199
+ $[32] = t10;
200
+ } else t10 = $[32];
201
+ const rail = t5(t10);
202
+ let t11;
203
+ if ($[33] !== context || $[34] !== rail) {
204
+ t11 = /* @__PURE__ */ jsx(NavigationContext, {
160
205
  value: context,
161
206
  children: rail
162
207
  });
163
- $[29] = context;
164
- $[30] = rail;
165
- $[31] = t10;
166
- } else t10 = $[31];
167
- return t10;
208
+ $[33] = context;
209
+ $[34] = rail;
210
+ $[35] = t11;
211
+ } else t11 = $[35];
212
+ return t11;
213
+ }
214
+ /**
215
+ * The screen's floating action button in a navigation rail's `fab` slot: the
216
+ * 56dp FAB, its icon alone in the collapsed rail and named by `label`, and
217
+ * the extended FAB with `label` beside the icon in the expanded rail.
218
+ *
219
+ * ```tsx
220
+ * <NavigationRail
221
+ * aria-label="Label"
222
+ * fab={
223
+ * <NavigationRail.Fab label="Label" onPress={add}>
224
+ * <PlusIcon />
225
+ * </NavigationRail.Fab>
226
+ * }
227
+ * />
228
+ * ```
229
+ *
230
+ * It takes Fab's props otherwise: `tone`, `variant`, `href` and the rest.
231
+ */
232
+ function NavigationRailFab(t0) {
233
+ const $ = c(7);
234
+ let label;
235
+ let props;
236
+ if ($[0] !== t0) {
237
+ ({label, ...props} = t0);
238
+ $[0] = t0;
239
+ $[1] = label;
240
+ $[2] = props;
241
+ } else {
242
+ label = $[1];
243
+ props = $[2];
244
+ }
245
+ const { form } = use(NavigationContext);
246
+ let t1;
247
+ if ($[3] !== form || $[4] !== label || $[5] !== props) {
248
+ t1 = form === "expanded" ? /* @__PURE__ */ jsx(Fab, {
249
+ ...props,
250
+ label
251
+ }) : /* @__PURE__ */ jsx(Fab, {
252
+ ...props,
253
+ "aria-label": props["aria-label"] ?? label
254
+ });
255
+ $[3] = form;
256
+ $[4] = label;
257
+ $[5] = props;
258
+ $[6] = t1;
259
+ } else t1 = $[6];
260
+ return t1;
168
261
  }
169
262
  /**
170
263
  * One destination of a navigation rail — an icon, a label and, when it is the
@@ -185,7 +278,8 @@ function NavigationRailItem(props) {
185
278
  } else t0 = $[1];
186
279
  return t0;
187
280
  }
281
+ NavigationRail.Fab = NavigationRailFab;
188
282
  NavigationRail.Item = NavigationRailItem;
189
- export { NavigationRailItem, NavigationRail as default };
283
+ export { NavigationRailFab, NavigationRailItem, NavigationRail as default };
190
284
 
191
285
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","useRender","mergeStyles","styles","destinations","kGNEyG","kSGwAc","kB7OPa","k1xSpc","kCS8Yb","kXwgrk","kzQI83","kmuXW","kqGvvJ","kUOVxO","kAzted","kORKVm","k8WAf4","kg3NbH","$$css","header","isExpanded","selectedRoute","NavigationRail","t0","$","children","context","render","t1","t2","t3","t4","t5","t6","t7","t8","props","undefined","t9","t10","form","0","className","1","defaultTagName","rail","NavigationRailItem","Item"],"sources":["../../../src/components/navigation-rail/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useMemo } from 'react';\nimport type { NavigationItemProps } from '../../navigation';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { NavigationItem, NavigationList } from '../../navigation';\nimport { NavigationContext } from '../../navigation/context';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing } from '../../tokens/design.tokens.stylex';\n\n// The navigation rail page's rail, in both its forms: collapsed, a 96dp\n// column of vertical destinations down the leading edge of a medium or wider\n// window, and expanded, between 220dp and 360dp with each destination the\n// page's 56dp horizontal pill. The expanded rail is what the page has\n// replace the navigation drawer, so an app's top-level destinations reach\n// every window size between this and NavigationBar. Both forms are on the\n// surface role, with their contents 44dp from the top: the first destination,\n// or a header when the rail has one — a menu button that expands it, say —\n// with the first destination 40dp under it. The destinations are\n// `src/navigation`'s, shared with NavigationBar, which holds their values.\n//\n// A collapsed destination's label stays on one line in the 88dp under its\n// indicator, about thirteen characters of label medium. A longer one is cut\n// short with an ellipsis and shows its full text in the browser's tooltip on\n// hover — see `src/navigation`. Once the reader has enlarged their text, by\n// a text-only zoom or a minimum font size, the label takes further lines\n// instead and its destination grows to hold them, since that text no longer\n// fits the lengths around it — see src/hooks/useEnlargedText.ts. The expanded\n// rail's labels sit beside their icons, with the rest of the rail's 360dp at\n// most.\n//\n// The rail is a `<nav>`, and a page usually has more than one navigation\n// landmark, so name it with `aria-label`.\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// How far a destination's focus ring reaches past it: the 2dp offset and\n// the 3dp ring, and 3dp more under forced colours, where the ring is twice\n// as heavy — see `ringWeight` in src/navigation/styles.ts. The destinations\n// scroll, and a scroll container clips what overflows it, so the block they\n// scroll in is padded by this much and pulled back out by as much, which\n// leaves every destination where it was and every ring whole.\nconst RING_REACH = {\n default: '5px',\n [FORCED_COLORS]: '8px'\n};\nconst RING_PULL = {\n default: '-5px',\n [FORCED_COLORS]: '-8px'\n};\nconst styles = {\n destinations: {\n kGNEyG: \"x6s0dn4\",\n kSGwAc: \"xkh2ocl\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kCS8Yb: \"xdl72j9\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kmuXW: \"xs83m0k\",\n kqGvvJ: \"x15zwqr x196bl58\",\n kUOVxO: \"x13jr4wj x1knonev\",\n kAzted: \"x2lwn1j\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"xifx94n x1flqomg\",\n kg3NbH: \"xm9j1uf x1snzwe2\",\n $$css: true\n }\n};\ntype NavigationRailProps = RenderComponentProps<'nav'> & {\n /**\n * What the rail draws above its destinations: a menu button that expands\n * it, or a floating action button.\n */\n header?: ReactNode;\n /**\n * Whether the rail is in its expanded form, each destination a pill with\n * its label beside the icon, rather than collapsed with the label under it.\n * @default false\n */\n isExpanded?: boolean;\n /**\n * The route of the current destination, matched exactly against each\n * destination's `href`. The match carries `aria-current=\"page\"` and the\n * active indicator. For a route nested under a destination, which no\n * `href` matches whole, mark that destination with its own `isCurrent`.\n */\n selectedRoute?: string;\n};\n\n/**\n * The column of top-level destinations a medium or wider window keeps at its\n * leading edge, collapsed or, with `isExpanded`, expanded. Each destination\n * is a link, so it routes through React Aria's `RouterProvider` when the app\n * has one.\n *\n * ```tsx\n * <NavigationRail aria-label=\"Label\" selectedRoute=\"/first\">\n * <NavigationRail.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationRail.Item>\n * <NavigationRail.Item href=\"/second\" icon={<SecondIcon />}>\n * Second item\n * </NavigationRail.Item>\n * </NavigationRail>\n * ```\n *\n * The call site's `className` and `style` land on the `<nav>`.\n */\nfunction NavigationRail({\n children,\n header,\n isExpanded = false,\n render,\n selectedRoute,\n ...props\n}: NavigationRailProps) {\n const context = useMemo(() => ({\n form: isExpanded ? 'expanded' as const : 'collapsed' as const,\n selectedRoute\n }), [isExpanded, selectedRoute]);\n const rail = useRender({\n defaultTagName: 'nav',\n props: {\n ...props,\n ...mergeStyles({\n 0: {\n className: \"x6s0dn4 x14s9m32 x5yr21d x9f619 x78zum5 xdt5ytf x2lah0s x8i8c5o xlaft8j xzoy561 x13oubkp\"\n },\n 1: {\n className: \"x6s0dn4 x14s9m32 x5yr21d x9f619 x78zum5 xdt5ytf x2lah0s x8i8c5o xlaft8j xeq5yr9 xxc7z9f x12rczxh x17qtykl\"\n }\n }[!!isExpanded << 0], props),\n children: <>\n {header === undefined ? null : <div {...{\n 0: {\n className: \"x6s0dn4 x9f619 x78zum5 xdt5ytf xqa3g7y\"\n },\n 1: {\n className: \"x9f619 x78zum5 xdt5ytf x1cy8zhl xkh2ocl x1mgj515 xdxifnh\"\n }\n }[!!isExpanded << 0]}>\n {header}\n </div>}\n <NavigationList layout={styles.destinations}>\n {children}\n </NavigationList>\n </>\n },\n render\n });\n return <NavigationContext value={context}>{rail}</NavigationContext>;\n}\n\n/**\n * One destination of a navigation rail — an icon, a label and, when it is the\n * current one, the active indicator. See `NavigationRail`.\n *\n * Defined here rather than re-exported from `src/navigation`: a re-export\n * let the build hand the package entry that module directly, past this\n * module's client directive, and a server component importing it got the\n * component itself rather than a reference to a client one.\n */\nfunction NavigationRailItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>) {\n return <NavigationItem {...props} />;\n}\nNavigationRail.Item = NavigationRailItem;\nexport type { NavigationItemProps as NavigationRailItemProps, NavigationRailProps };\nexport { NavigationRailItem };\nexport default NavigationRail;"],"mappings":";;;;;;;;;AAwDA,MAAMG,SAAS,EACbC,cAAc;CACZC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;CACPC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;;;;;;;;;;;;;;;;;;;;AAyCA,SAAAI,eAAAC,IAAA;CAAA,MAAAC,IAAAzB,EAAA,EAAA;CAAA,IAAA0B;CAAA,IAAAC;CAAA,IAAAP;CAAA,IAAAC;CAAA,IAAAO;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP,EAAA,OAAAD,IAAA;EAAwB,MAAA,EAAAE,UAAAO,IAAAb,QAAAc,IAAAb,YAAAc,IAAAP,QAAAQ,IAAAd,eAAA,GAAAe,UAAAb;EAAAE,WAAAO;EAAAb,SAAAc;EAAAN,SAAAQ;EAGtBf,aAAAc,OAAAG,KAAAA,IAAA,QAAAH;EAMQ,MAAAI,KAAAlB,aAAa,aAAsB;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AAAY,OAAA;EACSb,KAAA,oBAAC,gBAAD,EAAe,GAAKa,MAAK,CAAA;EAAIZ,EAAA,KAAAY;EAAAZ,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAAA,OAA7BD;AAA6B;AAEtCD,eAAeyB,OAAOD"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","use","NavigationContext","hasContent","useRender","mergeStyles","Fab","styles","destinations","kGNEyG","kSGwAc","kB7OPa","k1xSpc","kCS8Yb","kXwgrk","kzQI83","kmuXW","kqGvvJ","kUOVxO","kAzted","kORKVm","k8WAf4","kg3NbH","$$css","header","k1K539","headerAboveFab","headerAboveFabExpanded","headerExpanded","kZCmMZ","label","fab","isExpanded","selectedRoute","NavigationRail","t0","$","children","context","hasFab","render","t1","t2","t3","t4","t5","t6","t7","t8","t9","props","undefined","t10","t11","form","0","className","1","defaultTagName","rail","NavigationRailFab","NavigationRailItem","Item"],"sources":["../../../src/components/navigation-rail/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { use, useMemo } from 'react';\nimport type { NavigationItemProps } from '../../navigation';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport type { FabProps } from '../fab';\nimport { NavigationItem, NavigationList } from '../../navigation';\nimport { NavigationContext } from '../../navigation/context';\nimport { hasContent } from '../../render/content';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing } from '../../tokens/design.tokens.stylex';\nimport Fab from '../fab';\n\n// The navigation rail page's rail, in both its forms: collapsed, a 96dp\n// column of vertical destinations down the leading edge of a medium or wider\n// window, and expanded, between 220dp and 360dp with each destination the\n// page's 56dp horizontal pill. The expanded rail is what the page has\n// replace the navigation drawer, so an app's top-level destinations reach\n// every window size between this and NavigationBar. Both forms are on the\n// surface role, with their contents 44dp from the top: the first destination,\n// or a header when the rail has one — a menu button that expands it, say —\n// with the first destination 40dp under it. The destinations are\n// `src/navigation`'s, shared with NavigationBar, which holds their values.\n//\n// A collapsed destination's label stays on one line in the 88dp under its\n// indicator, about thirteen characters of label medium. A longer one is cut\n// short with an ellipsis and shows its full text in the browser's tooltip on\n// hover — see `src/navigation`. Once the reader has enlarged their text, by\n// a text-only zoom or a minimum font size, the label takes further lines\n// instead and its destination grows to hold them, since that text no longer\n// fits the lengths around it — see src/hooks/useEnlargedText.ts. The expanded\n// rail's labels sit beside their icons, with the rest of the rail's 360dp at\n// most.\n//\n// The rail can hold the screen's FAB, where Material Design's rail puts it:\n// above the destinations, under the header when there is one, with the first\n// destination the page's 40dp under the FAB rather than under the header. The\n// header keeps whatever else stands there, such as a menu button or a mark,\n// 4dp above the FAB, the collapsed rail's gap between destinations.\n// `NavigationRail.Fab` is the 56dp FAB, taking its form from the rail's: the\n// icon alone in the collapsed rail, named by its label, and the extended FAB,\n// icon and label, in the expanded one, at the pills' leading edge so its icon\n// sits over theirs. It keeps the FAB's level 3 shadow. It sits outside the\n// list of destinations and before it, so a screen reader reaches it first.\n//\n// The rail is a `<nav>`, and a page usually has more than one navigation\n// landmark, so name it with `aria-label`.\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// How far a destination's focus ring reaches past it: the 2dp offset and\n// the 3dp ring, and 3dp more under forced colours, where the ring is twice\n// as heavy — see `ringWeight` in src/navigation/styles.ts. The destinations\n// scroll, and a scroll container clips what overflows it, so the block they\n// scroll in is padded by this much and pulled back out by as much, which\n// leaves every destination where it was and every ring whole.\nconst RING_REACH = {\n default: '5px',\n [FORCED_COLORS]: '8px'\n};\nconst RING_PULL = {\n default: '-5px',\n [FORCED_COLORS]: '-8px'\n};\nconst styles = {\n destinations: {\n kGNEyG: \"x6s0dn4\",\n kSGwAc: \"xkh2ocl\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kCS8Yb: \"xdl72j9\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kmuXW: \"xs83m0k\",\n kqGvvJ: \"x15zwqr x196bl58\",\n kUOVxO: \"x13jr4wj x1knonev\",\n kAzted: \"x2lwn1j\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"xifx94n x1flqomg\",\n kg3NbH: \"xm9j1uf x1snzwe2\",\n $$css: true\n },\n header: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n k1K539: \"xqa3g7y\",\n $$css: true\n },\n headerAboveFab: {\n k1K539: \"xat24cr\",\n $$css: true\n },\n headerAboveFabExpanded: {\n k1K539: \"x135sh1i\",\n $$css: true\n },\n headerExpanded: {\n kGNEyG: \"x1cy8zhl\",\n kSGwAc: \"xkh2ocl\",\n k1K539: \"x1mgj515\",\n kZCmMZ: \"xdxifnh\",\n $$css: true\n }\n};\ntype NavigationRailFabProps = Omit<FabProps, 'aria-label' | 'label' | 'size'> & RefAttributes<HTMLAnchorElement | HTMLButtonElement> & {\n /**\n * The FAB's name in either form, in place of `label`, for a name that\n * says more than the words drawn beside the icon.\n */\n 'aria-label'?: string;\n /**\n * What the FAB does, in words: drawn beside the icon in the expanded rail,\n * and the FAB's name in the collapsed one, where the icon stands alone.\n */\n label: string;\n};\ntype NavigationRailProps = RenderComponentProps<'nav'> & {\n /**\n * The screen's floating action button, a `NavigationRail.Fab`, drawn above\n * the destinations and under the header: its icon alone in the collapsed\n * rail, and the extended FAB in the expanded one.\n */\n fab?: ReactNode;\n /**\n * What the rail draws above its destinations and its FAB: a menu button\n * that expands it, or a mark.\n */\n header?: ReactNode;\n /**\n * Whether the rail is in its expanded form, each destination a pill with\n * its label beside the icon, rather than collapsed with the label under it.\n * @default false\n */\n isExpanded?: boolean;\n /**\n * The route of the current destination, matched exactly against each\n * destination's `href`. The match carries `aria-current=\"page\"` and the\n * active indicator. For a route nested under a destination, which no\n * `href` matches whole, mark that destination with its own `isCurrent`.\n */\n selectedRoute?: string;\n};\n\n/**\n * The column of top-level destinations a medium or wider window keeps at its\n * leading edge, collapsed or, with `isExpanded`, expanded. Each destination\n * is a link, so it routes through React Aria's `RouterProvider` when the app\n * has one.\n *\n * ```tsx\n * <NavigationRail aria-label=\"Label\" selectedRoute=\"/first\">\n * <NavigationRail.Item href=\"/first\" icon={<FirstIcon />}>\n * First item\n * </NavigationRail.Item>\n * <NavigationRail.Item href=\"/second\" icon={<SecondIcon />}>\n * Second item\n * </NavigationRail.Item>\n * </NavigationRail>\n * ```\n *\n * The call site's `className` and `style` land on the `<nav>`.\n */\nfunction NavigationRail({\n children,\n fab,\n header,\n isExpanded = false,\n render,\n selectedRoute,\n ...props\n}: NavigationRailProps) {\n const context = useMemo(() => ({\n form: isExpanded ? 'expanded' as const : 'collapsed' as const,\n selectedRoute\n }), [isExpanded, selectedRoute]);\n // A slot handed `false` or `null`, as `fab={isWide && <Fab />}` hands it,\n // holds nothing, and the header keeps its own 40dp.\n const hasFab = hasContent(fab);\n const rail = useRender({\n defaultTagName: 'nav',\n props: {\n ...props,\n ...mergeStyles({\n 0: {\n className: \"x6s0dn4 x14s9m32 x5yr21d x9f619 x78zum5 xdt5ytf x2lah0s x8i8c5o xlaft8j xzoy561 x13oubkp\"\n },\n 1: {\n className: \"x6s0dn4 x14s9m32 x5yr21d x9f619 x78zum5 xdt5ytf x2lah0s x8i8c5o xlaft8j xeq5yr9 xxc7z9f x12rczxh x17qtykl\"\n }\n }[!!isExpanded << 0], props),\n children: <>\n {header === undefined ? null : <div {...stylex.props(styles.header, isExpanded && styles.headerExpanded, hasFab && (isExpanded ? styles.headerAboveFabExpanded : styles.headerAboveFab))}>\n {header}\n </div>}\n {hasFab ? <div {...{\n 0: {\n className: \"x6s0dn4 x9f619 x78zum5 xdt5ytf xqa3g7y\"\n },\n 1: {\n className: \"x9f619 x78zum5 xdt5ytf x1cy8zhl xkh2ocl x1mgj515\"\n }\n }[!!isExpanded << 0]}>\n {fab}\n </div> : null}\n <NavigationList layout={styles.destinations}>\n {children}\n </NavigationList>\n </>\n },\n render\n });\n return <NavigationContext value={context}>{rail}</NavigationContext>;\n}\n\n/**\n * The screen's floating action button in a navigation rail's `fab` slot: the\n * 56dp FAB, its icon alone in the collapsed rail and named by `label`, and\n * the extended FAB with `label` beside the icon in the expanded rail.\n *\n * ```tsx\n * <NavigationRail\n * aria-label=\"Label\"\n * fab={\n * <NavigationRail.Fab label=\"Label\" onPress={add}>\n * <PlusIcon />\n * </NavigationRail.Fab>\n * }\n * />\n * ```\n *\n * It takes Fab's props otherwise: `tone`, `variant`, `href` and the rest.\n */\nfunction NavigationRailFab({\n label,\n ...props\n}: NavigationRailFabProps) {\n const {\n form\n } = use(NavigationContext);\n return form === 'expanded' ? <Fab {...props} label={label} /> : <Fab {...props} aria-label={props['aria-label'] ?? label} />;\n}\n\n/**\n * One destination of a navigation rail — an icon, a label and, when it is the\n * current one, the active indicator. See `NavigationRail`.\n *\n * Defined here rather than re-exported from `src/navigation`: a re-export\n * let the build hand the package entry that module directly, past this\n * module's client directive, and a server component importing it got the\n * component itself rather than a reference to a client one.\n */\nfunction NavigationRailItem(props: NavigationItemProps & RefAttributes<HTMLAnchorElement>) {\n return <NavigationItem {...props} />;\n}\nNavigationRail.Fab = NavigationRailFab;\nNavigationRail.Item = NavigationRailItem;\nexport type { NavigationRailFabProps, NavigationItemProps as NavigationRailItemProps, NavigationRailProps };\nexport { NavigationRailFab, NavigationRailItem };\nexport default NavigationRail;"],"mappings":";;;;;;;;;;;;AAsEA,MAAMQ,SAAS;CACbC,cAAc;EACZC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QA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,GAAAoB,SAAAf;EAGFC,EAAA,KAAAD;EAAAC,EAAA,KAAAN;EAAAM,EAAA,KAAAc;CAAA,OAAA;EAAApB,QAAAM,EAAA;EAAAc,QAAAd,EAAA;CAAA;CACvB,MAAA,EAAAkB,SAEIrD,IAAIC,iBAAiB;CAAE,IAAAuC;CAAA,IAAAL,EAAA,OAAAkB,QAAAlB,EAAA,OAAAN,SAAAM,EAAA,OAAAc,OAAA;EACpBT,KAAAa,SAAS,aAAa,oBAAC,KAAD;GAAI,GAAKJ;GAAcpB;EAAK,CAAA,IAAO,oBAAC,KAAD;GAAI,GAAKoB;GAAmB,cAAAA,MAAM,iBAANpB;EAA4B,CAAA;EAAIM,EAAA,KAAAkB;EAAAlB,EAAA,KAAAN;EAAAM,EAAA,KAAAc;EAAAd,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAArHK;AAAqH;;;;;;;;;;AAY9H,SAAAoB,mBAAAX,OAAA;CAAA,MAAAd,IAAArC,EAAA,CAAA;CAAA,IAAAoC;CAAA,IAAAC,EAAA,OAAAc,OAAA;EACSf,KAAA,oBAAC,gBAAD,EAAe,GAAKe,MAAK,CAAA;EAAId,EAAA,KAAAc;EAAAd,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAAA,OAA7BD;AAA6B;AAEtCD,eAAe5B,MAAMsD;AACrB1B,eAAe4B,OAAOD"}
@@ -0,0 +1,77 @@
1
+ import { ReactNode, RefAttributes } from "react";
2
+ import { RenderComponentProps } from "../../render/useRender.js";
3
+ type SkeletonBarProps = Omit<RenderComponentProps<'div'>, 'children' | 'render'> & {
4
+ /**
5
+ * What the bar stands in for: `sm`, 12px, an eyebrow or a supporting line;
6
+ * `md`, 14px, a title or a figure; `lg`, 28px, a headline.
7
+ * @default 'sm'
8
+ */
9
+ size?: SkeletonBarSize;
10
+ /**
11
+ * How wide the bar is: a number of pixels, or a CSS length or percentage
12
+ * of its row.
13
+ */
14
+ width: number | string;
15
+ };
16
+ type SkeletonBarSize = 'lg' | 'md' | 'sm';
17
+ type SkeletonCircleProps = Omit<RenderComponentProps<'div'>, 'children' | 'render'>;
18
+ type SkeletonProps = RenderComponentProps<'div'> & {
19
+ /**
20
+ * What a screen reader hears. Left out, it is the library's word for
21
+ * loading in the `I18nProvider`'s locale — "Loading" in English.
22
+ */
23
+ 'aria-label'?: string;
24
+ /** The shapes: `Skeleton.Row`s, or bars and circles of the call site's. */
25
+ children?: ReactNode;
26
+ };
27
+ type SkeletonRowProps = Omit<RenderComponentProps<'div'>, 'render'> & {
28
+ /** The bars standing in for the row's lines, one above the other. */
29
+ children?: ReactNode;
30
+ /** What stands before the lines, usually a `Skeleton.Circle`. */
31
+ leading?: ReactNode;
32
+ /**
33
+ * How many lines the row stands in for: `1` is the lists page's 56px
34
+ * one-line item, `2` its 72px two-line item.
35
+ * @default 1
36
+ */
37
+ lines?: 1 | 2;
38
+ /** What stands after the lines, such as a bar in place of a figure. */
39
+ trailing?: ReactNode;
40
+ };
41
+ /**
42
+ * The shape of what is being read, drawn at once in its place: rows of bars
43
+ * and circles, fading gently, that a screen reader hears as one "Loading".
44
+ *
45
+ * ```tsx
46
+ * <Skeleton>
47
+ * <Skeleton.Row leading={<Skeleton.Circle />} lines={2}>
48
+ * <Skeleton.Bar size="md" width="60%" />
49
+ * <Skeleton.Bar width="40%" />
50
+ * </Skeleton.Row>
51
+ * </Skeleton>
52
+ * ```
53
+ *
54
+ * Draw it where the content will be, in its place rather than over it, and
55
+ * swap it for the content once that is read. It says "Loading" where a
56
+ * reader reaches it and announces nothing as it comes and goes; mark the
57
+ * container it is swapped in `aria-busy` while it loads, or announce the
58
+ * change through a live region, where that matters. The call site's `className` and
59
+ * `style` land on its own element.
60
+ */
61
+ declare function Skeleton({ 'aria-label': ariaLabel, children, render, ...props }: SkeletonProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
62
+ declare namespace Skeleton {
63
+ var Bar: typeof SkeletonBar;
64
+ var Circle: typeof SkeletonCircle;
65
+ var Row: typeof SkeletonRow;
66
+ }
67
+ /** A bar standing in for a line of text, at the width the call site gives. */
68
+ declare function SkeletonBar({ size, width, ...props }: RefAttributes<HTMLDivElement> & SkeletonBarProps): import("react").JSX.Element;
69
+ /** A 40px circle standing in for a row's mark, such as an avatar. */
70
+ declare function SkeletonCircle(props: RefAttributes<HTMLDivElement> & SkeletonCircleProps): import("react").JSX.Element;
71
+ /**
72
+ * A row standing in for a list item: 56px for one line, 72px for two, with
73
+ * the lists page's padding, a leading and a trailing slot, and its bars one
74
+ * above the other between them.
75
+ */
76
+ declare function SkeletonRow({ children, leading, lines, trailing, ...props }: RefAttributes<HTMLDivElement> & SkeletonRowProps): import("react").JSX.Element;
77
+ export { SkeletonBar, type SkeletonBarProps, type SkeletonBarSize, SkeletonCircle, type SkeletonCircleProps, type SkeletonProps, SkeletonRow, type SkeletonRowProps, Skeleton as default };