@baseline-ui/mcp 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +21 -4
- package/dist/chunk-ZSPBMEL5.js +36789 -0
- package/dist/index.js +1 -35761
- package/dist/{index.cjs → server.cjs} +1081 -54
- package/dist/server.d.ts +5 -0
- package/dist/server.js +1 -0
- package/package.json +15 -2
- package/sbom.json +6 -6
- package/dist/index.d.cts +0 -1
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
'use strict';var mcp_js=require('@modelcontextprotocol/sdk/server/mcp.js'),stdio_js=require('@modelcontextprotocol/sdk/server/stdio.js'),zod=require('zod');/**
|
|
3
|
-
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
6
|
-
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
|
|
7
|
-
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
|
|
8
|
-
* This notice may not be removed from this file.
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
var o={BarChart:{id:"charts-barchart",breadcrumb:"Charts/BarChart",importStatement:`import { BarChart } from "@baseline-ui/charts";
|
|
1
|
+
'use strict';var mcp_js=require('@modelcontextprotocol/sdk/server/mcp.js'),zod=require('zod');var t={BarChart:{id:"charts-barchart",breadcrumb:"Charts/BarChart",importStatement:`import { BarChart } from "@baseline-ui/charts";
|
|
12
2
|
import { Box } from "@baseline-ui/core";`,description:"The `BarChart` component renders a responsive bar chart for categorical data. It is built on top of [Recharts](https://recharts.org/) and styled with Baseline UI design tokens so it picks up the active theme automatically.",documentation:`The \`BarChart\` component renders a responsive bar chart for categorical data. It is built on top of [Recharts](https://recharts.org/) and styled with Baseline UI design tokens so it picks up the active theme automatically.
|
|
13
3
|
|
|
14
4
|
* Renders one or more bar series from a single dataset, keyed by \`xAxisDataKey\` and the per-bar \`dataKey\`.
|
|
@@ -992,7 +982,7 @@ export const AccordionWithDisabledItemsExample: React.FC<
|
|
|
992
982
|
Omit<React.ComponentProps<typeof AccordionExample>, "disabledKeys">
|
|
993
983
|
> = (props) => {
|
|
994
984
|
return <AccordionExample {...props} disabledKeys={new Set(["item-1"])} />;
|
|
995
|
-
};`},similarTo:[],figmaUrl:null},ActionButton:{id:"core-buttons-actionbutton",breadcrumb:"Core/Buttons/ActionButton",importStatement:'import { ActionButton, Menu, VariantViewer } from "@baseline-ui/core";',description:"`ActionButton` is a labeled button that triggers an action when activated by mouse, touch, or keyboard. Use it for primary user actions such as submitting a form, confirming a choice, or invoking a command.",documentation:'`ActionButton` is a labeled button that triggers an action when activated by mouse, touch, or keyboard. Use it for primary user actions such as submitting a form, confirming a choice, or invoking a command.\n\n* Mouse and touch event handling, and press state management\n* Keyboard focus management and cross browser normalization\n* Keyboard event support for Space and Enter keys\n\nYou can import the ActionButton component like so:\n\n```jsx\nimport { ActionButton } from "@baseline-ui/core";\n\nexport default function App() {\n return <ActionButton label="Click Me" />;\n}\n```\n\nIf you want to use a button that can be toggled on and off, you can use the `ToggleButton` component.\n\
|
|
985
|
+
};`},similarTo:[],figmaUrl:null},ActionButton:{id:"core-buttons-actionbutton",breadcrumb:"Core/Buttons/ActionButton",importStatement:'import { ActionButton, Menu, VariantViewer } from "@baseline-ui/core";',description:"`ActionButton` is a labeled button that triggers an action when activated by mouse, touch, or keyboard. Use it for primary user actions such as submitting a form, confirming a choice, or invoking a command.",documentation:'`ActionButton` is a labeled button that triggers an action when activated by mouse, touch, or keyboard. Use it for primary user actions such as submitting a form, confirming a choice, or invoking a command.\n\n* Mouse and touch event handling, and press state management\n* Keyboard focus management and cross browser normalization\n* Keyboard event support for Space and Enter keys\n\nYou can import the ActionButton component like so:\n\n```jsx\nimport { ActionButton } from "@baseline-ui/core";\n\nexport default function App() {\n return <ActionButton label="Click Me" />;\n}\n```\n\nIf you want to use a button that can be toggled on and off, you can use the `ToggleButton` component.\n\nThe button has six neutral variants: `primary`, `secondary`, `tertiary`, `popover`, `toolbar` and `ghost`. The default variant is `primary`. You can change the variant by passing the `variant` prop.\n\n```jsx\n<ActionButton label="Primary" />\n<ActionButton label="Secondary" variant="secondary" />\n<ActionButton label="Tertiary" variant="tertiary" />\n<ActionButton label={"Toolbar"} variant={"toolbar"} />\n<ActionButton label="Ghost" variant="ghost" />\n<ActionButton label="Popover" variant="popover" />\n```\n\n`success`, `warning` and `error` carry a support colour for actions whose outcome matters \u2014 confirming, acknowledging a risk, or deleting. Each comes in the same three emphasis levels as the neutral variants, so a support-coloured button can sit at whatever weight the surrounding layout calls for:\n\n* `{name}` \u2014 filled, for the primary action in its context\n* `{name}-secondary` \u2014 tinted fill, for a lower-emphasis action\n* `{name}-tertiary` \u2014 outline that fills with the support colour on hover and on keyboard focus\n\nWhen disabled, all three levels drop the support colour and render in the neutral disabled treatment.\n\n```jsx\n<ActionButton label="Success" variant="success" />\n<ActionButton label="Success" variant="success-secondary" />\n<ActionButton label="Success" variant="success-tertiary" />\n<ActionButton label="Warning" variant="warning" />\n<ActionButton label="Warning" variant="warning-secondary" />\n<ActionButton label="Warning" variant="warning-tertiary" />\n<ActionButton label="Error" variant="error" />\n<ActionButton label="Error" variant="error-secondary" />\n<ActionButton label="Error" variant="error-tertiary" />\n```\n\nActionButton supports three sizes: `sm` (default), `md`, and `lg`. You can change the size by passing the `size` prop.\n\n```jsx\n<ActionButton label="Small (default)" size="sm" />\n<ActionButton label="Medium" size="md" />\n<ActionButton label="Large" size="lg" />\n```\n\nYou can disable a button by passing the `isDisabled` prop. This will disable all mouse, touch, and keyboard interactions. The `-secondary` and `-tertiary` support variants are omitted below because they render identically to disabled `secondary` and `tertiary`.\n\n```jsx\n<ActionButton label="Primary" isDisabled />\n<ActionButton label="Secondary" variant="secondary" isDisabled />\n<ActionButton label="Tertiary" variant="tertiary" isDisabled />\n<ActionButton label="Ghost" variant="ghost" isDisabled />\n<ActionButton label="Toolbar" variant="toolbar" isDisabled />\n<ActionButton label="Popover" variant="popover" isDisabled />\n<ActionButton label="Success" variant="success" isDisabled />\n<ActionButton label="Warning" variant="warning" isDisabled />\n<ActionButton label="Error" variant="error" isDisabled />\n```\n\nYou can place an icon before or after the label by passing the `iconStart` or `iconEnd` props. Choose the icon entrypoint that matches your button size: `@baseline-ui/icons/16` for `sm`, `@baseline-ui/icons/20` for `md`, and `@baseline-ui/icons/24` for `lg`.\n\n```jsx\nimport { EllipseIcon } from "@baseline-ui/icons/16";\n\n<ActionButton label="Label" iconStart={EllipseIcon} />\n<ActionButton label="Label" iconEnd={EllipseIcon} />\n```\n\nYou can listen for events by passing the `onPress` prop. The `onPress` prop will fire when the button is activated by mouse, touch, or keyboard interactions.\n\n```jsx\n<ActionButton label="Click Me" onPress={() => alert("Hello World")} />\n```\n\n| Selector | Description |\n| -------------------- | -------------------------------------------------------------- |\n| \\[data-disabled] | Whether the button is disabled. |\n| \\[data-focused] | Whether the button is focused, either via a mouse or keyboard. |\n| \\[data-hovered] | Whether the button is currently hovered with a mouse. |\n| \\[data-focus-visible] | Whether the button is keyboard focused. |\n| \\[data-pressed] | Whether the button is currently pressed. |\n\n| Key | Function |\n| ------- | --------------------- |\n| `Space` | Activates the button. |\n| `Enter` | Activates the button. |',props:`interface ActionButtonProps {
|
|
996
986
|
/**
|
|
997
987
|
* The button's class name.
|
|
998
988
|
*/
|
|
@@ -1010,6 +1000,13 @@ slot?: string | null
|
|
|
1010
1000
|
/**
|
|
1011
1001
|
* The button's variant.
|
|
1012
1002
|
*
|
|
1003
|
+
* The \`success\`, \`warning\` and \`error\` variants carry a support colour. Each
|
|
1004
|
+
* comes in three emphasis levels, mirroring \`primary\`/\`secondary\`/\`tertiary\`:
|
|
1005
|
+
* the bare name is the filled treatment, \`-secondary\` is a tinted fill and
|
|
1006
|
+
* \`-tertiary\` is an outline that fills with the support colour on hover and
|
|
1007
|
+
* on keyboard focus. When disabled, all three drop the support colour and
|
|
1008
|
+
* render in the neutral disabled treatment.
|
|
1009
|
+
*
|
|
1013
1010
|
* @default primary
|
|
1014
1011
|
*/
|
|
1015
1012
|
variant?: | "primary"
|
|
@@ -1019,8 +1016,14 @@ variant?: | "primary"
|
|
|
1019
1016
|
| "popover"
|
|
1020
1017
|
| "toolbar"
|
|
1021
1018
|
| "success"
|
|
1019
|
+
| "success-secondary"
|
|
1020
|
+
| "success-tertiary"
|
|
1022
1021
|
| "warning"
|
|
1022
|
+
| "warning-secondary"
|
|
1023
|
+
| "warning-tertiary"
|
|
1023
1024
|
| "error"
|
|
1025
|
+
| "error-secondary"
|
|
1026
|
+
| "error-tertiary"
|
|
1024
1027
|
/**
|
|
1025
1028
|
* The button's label.
|
|
1026
1029
|
*/
|
|
@@ -1207,6 +1210,114 @@ size?: "sm" | "md" | "lg"
|
|
|
1207
1210
|
{ variant: "error", size: "lg", iconStart: E24 },
|
|
1208
1211
|
{ variant: "error", size: "lg", iconEnd: E24 },
|
|
1209
1212
|
],
|
|
1213
|
+
"Success Secondary": [
|
|
1214
|
+
{ variant: "success-secondary" },
|
|
1215
|
+
{ variant: "success-secondary", isDisabled: true },
|
|
1216
|
+
{ variant: "success-secondary", iconStart: EllipseIcon },
|
|
1217
|
+
{ variant: "success-secondary", iconEnd: EllipseIcon },
|
|
1218
|
+
],
|
|
1219
|
+
"Success Secondary Medium": [
|
|
1220
|
+
{ variant: "success-secondary", size: "md" },
|
|
1221
|
+
{ variant: "success-secondary", size: "md", isDisabled: true },
|
|
1222
|
+
{ variant: "success-secondary", size: "md", iconStart: E20 },
|
|
1223
|
+
{ variant: "success-secondary", size: "md", iconEnd: E20 },
|
|
1224
|
+
],
|
|
1225
|
+
"Success Secondary Large": [
|
|
1226
|
+
{ variant: "success-secondary", size: "lg" },
|
|
1227
|
+
{ variant: "success-secondary", size: "lg", isDisabled: true },
|
|
1228
|
+
{ variant: "success-secondary", size: "lg", iconStart: E24 },
|
|
1229
|
+
{ variant: "success-secondary", size: "lg", iconEnd: E24 },
|
|
1230
|
+
],
|
|
1231
|
+
"Success Tertiary": [
|
|
1232
|
+
{ variant: "success-tertiary" },
|
|
1233
|
+
{ variant: "success-tertiary", isDisabled: true },
|
|
1234
|
+
{ variant: "success-tertiary", iconStart: EllipseIcon },
|
|
1235
|
+
{ variant: "success-tertiary", iconEnd: EllipseIcon },
|
|
1236
|
+
],
|
|
1237
|
+
"Success Tertiary Medium": [
|
|
1238
|
+
{ variant: "success-tertiary", size: "md" },
|
|
1239
|
+
{ variant: "success-tertiary", size: "md", isDisabled: true },
|
|
1240
|
+
{ variant: "success-tertiary", size: "md", iconStart: E20 },
|
|
1241
|
+
{ variant: "success-tertiary", size: "md", iconEnd: E20 },
|
|
1242
|
+
],
|
|
1243
|
+
"Success Tertiary Large": [
|
|
1244
|
+
{ variant: "success-tertiary", size: "lg" },
|
|
1245
|
+
{ variant: "success-tertiary", size: "lg", isDisabled: true },
|
|
1246
|
+
{ variant: "success-tertiary", size: "lg", iconStart: E24 },
|
|
1247
|
+
{ variant: "success-tertiary", size: "lg", iconEnd: E24 },
|
|
1248
|
+
],
|
|
1249
|
+
"Warning Secondary": [
|
|
1250
|
+
{ variant: "warning-secondary" },
|
|
1251
|
+
{ variant: "warning-secondary", isDisabled: true },
|
|
1252
|
+
{ variant: "warning-secondary", iconStart: EllipseIcon },
|
|
1253
|
+
{ variant: "warning-secondary", iconEnd: EllipseIcon },
|
|
1254
|
+
],
|
|
1255
|
+
"Warning Secondary Medium": [
|
|
1256
|
+
{ variant: "warning-secondary", size: "md" },
|
|
1257
|
+
{ variant: "warning-secondary", size: "md", isDisabled: true },
|
|
1258
|
+
{ variant: "warning-secondary", size: "md", iconStart: E20 },
|
|
1259
|
+
{ variant: "warning-secondary", size: "md", iconEnd: E20 },
|
|
1260
|
+
],
|
|
1261
|
+
"Warning Secondary Large": [
|
|
1262
|
+
{ variant: "warning-secondary", size: "lg" },
|
|
1263
|
+
{ variant: "warning-secondary", size: "lg", isDisabled: true },
|
|
1264
|
+
{ variant: "warning-secondary", size: "lg", iconStart: E24 },
|
|
1265
|
+
{ variant: "warning-secondary", size: "lg", iconEnd: E24 },
|
|
1266
|
+
],
|
|
1267
|
+
"Warning Tertiary": [
|
|
1268
|
+
{ variant: "warning-tertiary" },
|
|
1269
|
+
{ variant: "warning-tertiary", isDisabled: true },
|
|
1270
|
+
{ variant: "warning-tertiary", iconStart: EllipseIcon },
|
|
1271
|
+
{ variant: "warning-tertiary", iconEnd: EllipseIcon },
|
|
1272
|
+
],
|
|
1273
|
+
"Warning Tertiary Medium": [
|
|
1274
|
+
{ variant: "warning-tertiary", size: "md" },
|
|
1275
|
+
{ variant: "warning-tertiary", size: "md", isDisabled: true },
|
|
1276
|
+
{ variant: "warning-tertiary", size: "md", iconStart: E20 },
|
|
1277
|
+
{ variant: "warning-tertiary", size: "md", iconEnd: E20 },
|
|
1278
|
+
],
|
|
1279
|
+
"Warning Tertiary Large": [
|
|
1280
|
+
{ variant: "warning-tertiary", size: "lg" },
|
|
1281
|
+
{ variant: "warning-tertiary", size: "lg", isDisabled: true },
|
|
1282
|
+
{ variant: "warning-tertiary", size: "lg", iconStart: E24 },
|
|
1283
|
+
{ variant: "warning-tertiary", size: "lg", iconEnd: E24 },
|
|
1284
|
+
],
|
|
1285
|
+
"Error Secondary": [
|
|
1286
|
+
{ variant: "error-secondary" },
|
|
1287
|
+
{ variant: "error-secondary", isDisabled: true },
|
|
1288
|
+
{ variant: "error-secondary", iconStart: EllipseIcon },
|
|
1289
|
+
{ variant: "error-secondary", iconEnd: EllipseIcon },
|
|
1290
|
+
],
|
|
1291
|
+
"Error Secondary Medium": [
|
|
1292
|
+
{ variant: "error-secondary", size: "md" },
|
|
1293
|
+
{ variant: "error-secondary", size: "md", isDisabled: true },
|
|
1294
|
+
{ variant: "error-secondary", size: "md", iconStart: E20 },
|
|
1295
|
+
{ variant: "error-secondary", size: "md", iconEnd: E20 },
|
|
1296
|
+
],
|
|
1297
|
+
"Error Secondary Large": [
|
|
1298
|
+
{ variant: "error-secondary", size: "lg" },
|
|
1299
|
+
{ variant: "error-secondary", size: "lg", isDisabled: true },
|
|
1300
|
+
{ variant: "error-secondary", size: "lg", iconStart: E24 },
|
|
1301
|
+
{ variant: "error-secondary", size: "lg", iconEnd: E24 },
|
|
1302
|
+
],
|
|
1303
|
+
"Error Tertiary": [
|
|
1304
|
+
{ variant: "error-tertiary" },
|
|
1305
|
+
{ variant: "error-tertiary", isDisabled: true },
|
|
1306
|
+
{ variant: "error-tertiary", iconStart: EllipseIcon },
|
|
1307
|
+
{ variant: "error-tertiary", iconEnd: EllipseIcon },
|
|
1308
|
+
],
|
|
1309
|
+
"Error Tertiary Medium": [
|
|
1310
|
+
{ variant: "error-tertiary", size: "md" },
|
|
1311
|
+
{ variant: "error-tertiary", size: "md", isDisabled: true },
|
|
1312
|
+
{ variant: "error-tertiary", size: "md", iconStart: E20 },
|
|
1313
|
+
{ variant: "error-tertiary", size: "md", iconEnd: E20 },
|
|
1314
|
+
],
|
|
1315
|
+
"Error Tertiary Large": [
|
|
1316
|
+
{ variant: "error-tertiary", size: "lg" },
|
|
1317
|
+
{ variant: "error-tertiary", size: "lg", isDisabled: true },
|
|
1318
|
+
{ variant: "error-tertiary", size: "lg", iconStart: E24 },
|
|
1319
|
+
{ variant: "error-tertiary", size: "lg", iconEnd: E24 },
|
|
1320
|
+
],
|
|
1210
1321
|
}}
|
|
1211
1322
|
/>
|
|
1212
1323
|
);`},{id:"core-buttons-actionbutton--disabled",name:"Disabled",snippet:'const Disabled = () => <ActionButton onPress={fn()} label="Label" isDisabled />;'},{id:"core-buttons-actionbutton--with-icon",name:"With Icon",snippet:'const WithIcon = () => <ActionButton onPress={fn()} label="Label" iconStart={EllipseIcon} />;'},{id:"core-buttons-actionbutton--with-both-icons",name:"With Both Icons",snippet:`const WithBothIcons = () => <ActionButton
|
|
@@ -2237,6 +2348,14 @@ contentClassName?: string
|
|
|
2237
2348
|
* The class name for the close button.
|
|
2238
2349
|
*/
|
|
2239
2350
|
closeButtonClassName?: string
|
|
2351
|
+
/**
|
|
2352
|
+
* Overrides the accessible label of the close button (X) that dismisses
|
|
2353
|
+
* the dialog. This is distinct from \`cancelLabel\`, which is the visible
|
|
2354
|
+
* text of the footer cancel button.
|
|
2355
|
+
*
|
|
2356
|
+
* Message id: \`bui.alertDialog.close\`. Defaults to \`"Close"\`.
|
|
2357
|
+
*/
|
|
2358
|
+
closeLabel?: string
|
|
2240
2359
|
/**
|
|
2241
2360
|
* The class name for the button group wrapper.
|
|
2242
2361
|
*/
|
|
@@ -2424,6 +2543,40 @@ sources: {
|
|
|
2424
2543
|
* @default "lg"
|
|
2425
2544
|
*/
|
|
2426
2545
|
size?: "sm" | "lg"
|
|
2546
|
+
/**
|
|
2547
|
+
* Overrides the accessible name of the button that starts audio playback.
|
|
2548
|
+
*
|
|
2549
|
+
* Message id: \`bui.audioPlayer.play\`. Defaults to \`"Play"\`.
|
|
2550
|
+
*/
|
|
2551
|
+
playLabel?: string
|
|
2552
|
+
/**
|
|
2553
|
+
* Overrides the accessible name of the button that pauses audio playback.
|
|
2554
|
+
*
|
|
2555
|
+
* Message id: \`bui.audioPlayer.pause\`. Defaults to \`"Pause"\`.
|
|
2556
|
+
*/
|
|
2557
|
+
pauseLabel?: string
|
|
2558
|
+
/**
|
|
2559
|
+
* Overrides the accessible name of the slider used to seek through the
|
|
2560
|
+
* audio track.
|
|
2561
|
+
*
|
|
2562
|
+
* Message id: \`bui.audioPlayer.audioTimeline\`. Defaults to
|
|
2563
|
+
* \`"Audio timeline"\`.
|
|
2564
|
+
*/
|
|
2565
|
+
audioTimelineLabel?: string
|
|
2566
|
+
/**
|
|
2567
|
+
* Overrides the screen reader announcement made when audio playback
|
|
2568
|
+
* starts.
|
|
2569
|
+
*
|
|
2570
|
+
* Message id: \`bui.useMedia.playing\`. Defaults to \`"Playing"\`.
|
|
2571
|
+
*/
|
|
2572
|
+
playingLabel?: string
|
|
2573
|
+
/**
|
|
2574
|
+
* Overrides the screen reader announcement made when audio playback is
|
|
2575
|
+
* paused.
|
|
2576
|
+
*
|
|
2577
|
+
* Message id: \`bui.useMedia.paused\`. Defaults to \`"Paused"\`.
|
|
2578
|
+
*/
|
|
2579
|
+
pausedLabel?: string
|
|
2427
2580
|
}`,stories:{usage:[{id:"core-media-audioplayer--basic",name:"Basic",snippet:'const Basic = () => <AudioPlayer sources={[{ url: "/sound.mp3", type: "audio/mpeg" }]} />;'},{id:"core-media-audioplayer--small",name:"Small",snippet:'const Small = () => <AudioPlayer sources={[{ url: "/sound.mp3", type: "audio/mpeg" }]} size="sm" />;'}],implementation:""},similarTo:[],figmaUrl:null},Avatar:{id:"core-content-avatar",breadcrumb:"Core/Content/Avatar",importStatement:'import { Avatar, VariantViewer } from "@baseline-ui/core";',description:"`Avatar` is a small visual representation of a user, showing either a profile image or initials derived from the user's name. Use it to identify people in lists, comments, mentions, or anywhere a user needs to be visually attributed.",documentation:`\`Avatar\` is a small visual representation of a user, showing either a profile image or initials derived from the user's name. Use it to identify people in lists, comments, mentions, or anywhere a user needs to be visually attributed.
|
|
2428
2581
|
|
|
2429
2582
|
\`\`\`jsx
|
|
@@ -3060,6 +3213,42 @@ title?: string
|
|
|
3060
3213
|
headerVariant?: | "title"
|
|
3061
3214
|
| "selectMonth"
|
|
3062
3215
|
| "selectMonthAndYear"
|
|
3216
|
+
/**
|
|
3217
|
+
* Overrides the accessible label of the button that moves the calendar forward one month.
|
|
3218
|
+
*
|
|
3219
|
+
* Message id: \`bui.calendar.nextMonth\`. Defaults to \`"Next month"\`.
|
|
3220
|
+
*/
|
|
3221
|
+
nextMonthLabel?: string
|
|
3222
|
+
/**
|
|
3223
|
+
* Overrides the accessible label of the button that moves the calendar back one month.
|
|
3224
|
+
*
|
|
3225
|
+
* Message id: \`bui.calendar.previousMonth\`. Defaults to \`"Previous month"\`.
|
|
3226
|
+
*/
|
|
3227
|
+
previousMonthLabel?: string
|
|
3228
|
+
/**
|
|
3229
|
+
* Overrides the accessible label of the button that moves the calendar forward one year.
|
|
3230
|
+
*
|
|
3231
|
+
* Message id: \`bui.calendar.nextYear\`. Defaults to \`"Next year"\`.
|
|
3232
|
+
*/
|
|
3233
|
+
nextYearLabel?: string
|
|
3234
|
+
/**
|
|
3235
|
+
* Overrides the accessible label of the button that moves the calendar back one year.
|
|
3236
|
+
*
|
|
3237
|
+
* Message id: \`bui.calendar.previousYear\`. Defaults to \`"Previous year"\`.
|
|
3238
|
+
*/
|
|
3239
|
+
previousYearLabel?: string
|
|
3240
|
+
/**
|
|
3241
|
+
* Overrides the accessible label of the dropdown that jumps the calendar to a chosen month.
|
|
3242
|
+
*
|
|
3243
|
+
* Message id: \`bui.calendar.selectMonth\`. Defaults to \`"Select month"\`.
|
|
3244
|
+
*/
|
|
3245
|
+
selectMonthLabel?: string
|
|
3246
|
+
/**
|
|
3247
|
+
* Overrides the accessible label of the dropdown that jumps the calendar to a chosen year.
|
|
3248
|
+
*
|
|
3249
|
+
* Message id: \`bui.calendar.selectYear\`. Defaults to \`"Select year"\`.
|
|
3250
|
+
*/
|
|
3251
|
+
selectYearLabel?: string
|
|
3063
3252
|
}`,stories:{usage:[{id:"core-forms-calendar--default",name:"Default",snippet:'const Default = () => <Calendar size="sm" aria-label="Event date" />;'},{id:"core-forms-calendar--with-title",name:"With Title",snippet:'const WithTitle = () => <Calendar size="sm" aria-label="Event date" title="Date" />;'},{id:"core-forms-calendar--with-default-value",name:"With Default Value",snippet:`const WithDefaultValue = () => <Calendar
|
|
3064
3253
|
size="sm"
|
|
3065
3254
|
aria-label="Event date"
|
|
@@ -3498,6 +3687,42 @@ title?: string
|
|
|
3498
3687
|
headerVariant?: | "title"
|
|
3499
3688
|
| "selectMonth"
|
|
3500
3689
|
| "selectMonthAndYear"
|
|
3690
|
+
/**
|
|
3691
|
+
* Overrides the accessible label of the button that moves the calendar forward one month.
|
|
3692
|
+
*
|
|
3693
|
+
* Message id: \`bui.calendar.nextMonth\`. Defaults to \`"Next month"\`.
|
|
3694
|
+
*/
|
|
3695
|
+
nextMonthLabel?: string
|
|
3696
|
+
/**
|
|
3697
|
+
* Overrides the accessible label of the button that moves the calendar back one month.
|
|
3698
|
+
*
|
|
3699
|
+
* Message id: \`bui.calendar.previousMonth\`. Defaults to \`"Previous month"\`.
|
|
3700
|
+
*/
|
|
3701
|
+
previousMonthLabel?: string
|
|
3702
|
+
/**
|
|
3703
|
+
* Overrides the accessible label of the button that moves the calendar forward one year.
|
|
3704
|
+
*
|
|
3705
|
+
* Message id: \`bui.calendar.nextYear\`. Defaults to \`"Next year"\`.
|
|
3706
|
+
*/
|
|
3707
|
+
nextYearLabel?: string
|
|
3708
|
+
/**
|
|
3709
|
+
* Overrides the accessible label of the button that moves the calendar back one year.
|
|
3710
|
+
*
|
|
3711
|
+
* Message id: \`bui.calendar.previousYear\`. Defaults to \`"Previous year"\`.
|
|
3712
|
+
*/
|
|
3713
|
+
previousYearLabel?: string
|
|
3714
|
+
/**
|
|
3715
|
+
* Overrides the accessible label of the dropdown that jumps the calendar to a chosen month.
|
|
3716
|
+
*
|
|
3717
|
+
* Message id: \`bui.calendar.selectMonth\`. Defaults to \`"Select month"\`.
|
|
3718
|
+
*/
|
|
3719
|
+
selectMonthLabel?: string
|
|
3720
|
+
/**
|
|
3721
|
+
* Overrides the accessible label of the dropdown that jumps the calendar to a chosen year.
|
|
3722
|
+
*
|
|
3723
|
+
* Message id: \`bui.calendar.selectYear\`. Defaults to \`"Select year"\`.
|
|
3724
|
+
*/
|
|
3725
|
+
selectYearLabel?: string
|
|
3501
3726
|
}`,stories:{usage:[{id:"core-forms-rangecalendar--default",name:"Default",snippet:'const Default = () => <RangeCalendar size="sm" aria-label="Trip dates" />;'},{id:"core-forms-rangecalendar--with-title",name:"With Title",snippet:'const WithTitle = () => <RangeCalendar size="sm" aria-label="Trip dates" title="Date" />;'},{id:"core-forms-rangecalendar--with-default-value",name:"With Default Value",snippet:`const WithDefaultValue = () => <RangeCalendar
|
|
3502
3727
|
size="sm"
|
|
3503
3728
|
aria-label="Trip dates"
|
|
@@ -3946,7 +4171,9 @@ pickerMode?: "active" | "lazy"
|
|
|
3946
4171
|
*/
|
|
3947
4172
|
storePickedColorKey?: string
|
|
3948
4173
|
/**
|
|
3949
|
-
* The label to show on the add color button
|
|
4174
|
+
* The label to show on the add color button that opens the color picker
|
|
4175
|
+
* for defining a new custom color. Not to be confused with \`addLabel\`,
|
|
4176
|
+
* which labels the "Add" confirmation button inside that picker.
|
|
3950
4177
|
*
|
|
3951
4178
|
* @default Add Color
|
|
3952
4179
|
*/
|
|
@@ -3963,6 +4190,52 @@ removeColorButtonLabel?: string
|
|
|
3963
4190
|
* @default Custom Colors
|
|
3964
4191
|
*/
|
|
3965
4192
|
customColorsLabel?: string
|
|
4193
|
+
/**
|
|
4194
|
+
* Overrides the label of the button that saves the custom color being
|
|
4195
|
+
* defined into the palette (shown inside the new-color picker in
|
|
4196
|
+
* \`pickerMode="lazy"\`). Not to be confused with \`addColorButtonLabel\`,
|
|
4197
|
+
* which labels the button that opens that picker.
|
|
4198
|
+
*
|
|
4199
|
+
* Message id: \`bui.colorInput.add\`. Defaults to \`"Add"\`.
|
|
4200
|
+
*/
|
|
4201
|
+
addLabel?: string
|
|
4202
|
+
/**
|
|
4203
|
+
* Overrides the label of the button that abandons the custom color being
|
|
4204
|
+
* defined (shown inside the new-color picker in \`pickerMode="lazy"\`).
|
|
4205
|
+
*
|
|
4206
|
+
* Message id: \`bui.colorInput.cancel\`. Defaults to \`"Cancel"\`.
|
|
4207
|
+
*/
|
|
4208
|
+
cancelLabel?: string
|
|
4209
|
+
/**
|
|
4210
|
+
* Overrides the accessible name of the dialog holding the color picker
|
|
4211
|
+
* used to define a new custom color, in \`pickerMode="lazy"\`.
|
|
4212
|
+
*
|
|
4213
|
+
* Message id: \`bui.colorInput.newColor\`. Defaults to \`"New Custom Color"\`.
|
|
4214
|
+
*/
|
|
4215
|
+
newColorLabel?: string
|
|
4216
|
+
/**
|
|
4217
|
+
* Overrides the accessible name of the control that switches the notation
|
|
4218
|
+
* a color is entered in (HEX, RGB).
|
|
4219
|
+
*
|
|
4220
|
+
* Message id: \`bui.colorInput.colorFormat\`. Defaults to \`"Color Format"\`.
|
|
4221
|
+
*/
|
|
4222
|
+
colorFormatLabel?: string
|
|
4223
|
+
/**
|
|
4224
|
+
* Overrides the accessible name of the group of predefined color swatches.
|
|
4225
|
+
*
|
|
4226
|
+
* Message id: \`bui.colorInput.colorPresets\`. Defaults to \`"Color Presets"\`.
|
|
4227
|
+
*/
|
|
4228
|
+
colorPresetsLabel?: string
|
|
4229
|
+
/**
|
|
4230
|
+
* Overrides the label of the swatch that clears the color selection, and the
|
|
4231
|
+
* accessible name of the trigger swatch while no color is set. Triggers that
|
|
4232
|
+
* render no swatch are unaffected; a custom \`renderTriggerButton\` must
|
|
4233
|
+
* forward the \`noneLabel\` it receives.
|
|
4234
|
+
*
|
|
4235
|
+
* Message ids: \`bui.colorInput.noColor\` (preset swatch),
|
|
4236
|
+
* \`bui.colorSwatch.none\` (trigger swatch). Both default to \`"None"\`.
|
|
4237
|
+
*/
|
|
4238
|
+
noColorLabel?: string
|
|
3966
4239
|
/**
|
|
3967
4240
|
* An optional function to render the custom trigger button.
|
|
3968
4241
|
*
|
|
@@ -3976,7 +4249,10 @@ renderTriggerButton?: (
|
|
|
3976
4249
|
colorName?: string | boolean;
|
|
3977
4250
|
triggerProps: AriaButtonProps<"button">;
|
|
3978
4251
|
labelId?: string;
|
|
3979
|
-
} & Pick<
|
|
4252
|
+
} & Pick<
|
|
4253
|
+
ColorSwatchProps,
|
|
4254
|
+
"isIndeterminate" | "indeterminateIcon" | "noneLabel"
|
|
4255
|
+
>,
|
|
3980
4256
|
) => React.JSX.Element
|
|
3981
4257
|
/**
|
|
3982
4258
|
* Handler that is called when the user stops dragging or clicking on the
|
|
@@ -3990,6 +4266,20 @@ onChangeEnd?: (color: Color | null) => void
|
|
|
3990
4266
|
* @default false
|
|
3991
4267
|
*/
|
|
3992
4268
|
isIndeterminate?: boolean
|
|
4269
|
+
/**
|
|
4270
|
+
* Overrides the accessible name of the color trigger when the current
|
|
4271
|
+
* selection spans several different colors (\`isIndeterminate\` is \`true\`).
|
|
4272
|
+
*
|
|
4273
|
+
* Message id: \`bui.colorInput.indeterminate\`. Defaults to \`"Indeterminate"\`.
|
|
4274
|
+
*/
|
|
4275
|
+
indeterminateLabel?: string
|
|
4276
|
+
/**
|
|
4277
|
+
* Overrides the label of the swatch representing a fully transparent
|
|
4278
|
+
* color.
|
|
4279
|
+
*
|
|
4280
|
+
* Message id: \`bui.colorInput.transparent\`. Defaults to \`"Transparent"\`.
|
|
4281
|
+
*/
|
|
4282
|
+
transparentLabel?: string
|
|
3993
4283
|
/**
|
|
3994
4284
|
* Handler that is called when the user presses the trigger button. This can
|
|
3995
4285
|
* be used to track events like clicks on the trigger button.
|
|
@@ -4262,6 +4552,13 @@ isIndeterminate?: boolean
|
|
|
4262
4552
|
* @default HelpIcon
|
|
4263
4553
|
*/
|
|
4264
4554
|
indeterminateIcon?: React.FC<IconProps> | null
|
|
4555
|
+
/**
|
|
4556
|
+
* Overrides the accessible label used when the swatch has no colour
|
|
4557
|
+
* applied.
|
|
4558
|
+
*
|
|
4559
|
+
* Message id: \`bui.colorSwatch.none\`. Defaults to \`"None"\`.
|
|
4560
|
+
*/
|
|
4561
|
+
noneLabel?: string
|
|
4265
4562
|
}`,stories:{usage:[{id:"core-content-colorswatch--basic",name:"Basic",snippet:'const Basic = () => <ColorSwatch color="#800800" />;'},{id:"core-content-colorswatch--variants",name:"Variants",snippet:`const Variants = (args) => (
|
|
4266
4563
|
<VariantViewer
|
|
4267
4564
|
header={["Enabled", "Focused", "Disabled"]}
|
|
@@ -4576,6 +4873,28 @@ By default the ComboBox current value cannot be set to values not included in it
|
|
|
4576
4873
|
/>
|
|
4577
4874
|
\`\`\`
|
|
4578
4875
|
|
|
4876
|
+
\`renderOption\` replaces the entire contents of each option \u2014 including the default selection checkmark, so render your own affordance from \`isSelected\` if you need one. Selection and keyboard behavior are unchanged. \`optionClassName\` and \`optionStyle\` accept either a value or a function of the item and its render state, and apply to the option element itself.
|
|
4877
|
+
|
|
4878
|
+
Keep all three referentially stable. The collection caches its elements per option and rebuilds every one of them whenever one of these changes identity, so an inline arrow rebuilds the list on each render.
|
|
4879
|
+
|
|
4880
|
+
\`\`\`jsx
|
|
4881
|
+
const renderOption = React.useCallback(
|
|
4882
|
+
(item) => (
|
|
4883
|
+
<span>
|
|
4884
|
+
{item.label}
|
|
4885
|
+
<span style={{ color: color.text.secondary }}> \u2014 custom</span>
|
|
4886
|
+
</span>
|
|
4887
|
+
),
|
|
4888
|
+
[],
|
|
4889
|
+
);
|
|
4890
|
+
|
|
4891
|
+
<ComboBox
|
|
4892
|
+
label="Custom option rendering"
|
|
4893
|
+
items={items}
|
|
4894
|
+
renderOption={renderOption}
|
|
4895
|
+
/>;
|
|
4896
|
+
\`\`\`
|
|
4897
|
+
|
|
4579
4898
|
The \`ComboBox\` input field filters visible items in the list to show only the ones that match the typed text. By default, only items that contain that text are shown. A custom filter function can be provided to modify this behavior.
|
|
4580
4899
|
|
|
4581
4900
|
This example provides a filter that will only show items that match exactly the typed text, case sensitive.
|
|
@@ -5019,7 +5338,17 @@ onValueChange?: (option: { value?: string; key?: string | null }) => void
|
|
|
5019
5338
|
<AddItemDecorator>
|
|
5020
5339
|
{(items) => <ComboBox label="Select a fruit" {...args} items={items} />}
|
|
5021
5340
|
</AddItemDecorator>
|
|
5022
|
-
);`},{id:"core-forms-combobox--with-
|
|
5341
|
+
);`},{id:"core-forms-combobox--with-render-option",name:"With Render Option",snippet:`const WithRenderOption = () => <ComboBox
|
|
5342
|
+
items={items}
|
|
5343
|
+
aria-label="ComboBox"
|
|
5344
|
+
label="Custom option rendering"
|
|
5345
|
+
placeholder="Placeholder"
|
|
5346
|
+
renderOption={(item) => (
|
|
5347
|
+
<span style={{ ...typography.label.md.regular }}>
|
|
5348
|
+
{item.label}
|
|
5349
|
+
<span style={{ color: color.text.secondary }}> \u2014 custom</span>
|
|
5350
|
+
</span>
|
|
5351
|
+
)} />;`},{id:"core-forms-combobox--with-tooltip",name:"With Tooltip",snippet:`const WithTooltip = () => <ComboBox
|
|
5023
5352
|
items={items}
|
|
5024
5353
|
aria-label="This is aria-label"
|
|
5025
5354
|
tooltip
|
|
@@ -5090,11 +5419,36 @@ export const itemsWithSections = [
|
|
|
5090
5419
|
] as ListItem[];
|
|
5091
5420
|
|
|
5092
5421
|
export const ComboBoxExample: React.FC<
|
|
5093
|
-
Omit<React.ComponentProps<typeof ComboBox>, "items">
|
|
5094
|
-
|
|
5422
|
+
Omit<React.ComponentProps<typeof ComboBox>, "items"> & {
|
|
5423
|
+
items?: ListItem[];
|
|
5424
|
+
/** Must stay focusable \u2014 the outside-click test asserts focus lands on it. */
|
|
5425
|
+
withSiblingField?: boolean;
|
|
5426
|
+
onNonFocusingPress?: () => void;
|
|
5427
|
+
}
|
|
5428
|
+
> = ({
|
|
5429
|
+
items: comboBoxItems = items,
|
|
5430
|
+
withSiblingField,
|
|
5431
|
+
onNonFocusingPress,
|
|
5432
|
+
...args
|
|
5433
|
+
}) => {
|
|
5095
5434
|
return (
|
|
5096
5435
|
<Box style={{ width: "100%", height: 200 }}>
|
|
5097
|
-
|
|
5436
|
+
{/* Above the ComboBox: the popover opens downwards and would otherwise cover
|
|
5437
|
+
the spot a test means to click "outside" on. */}
|
|
5438
|
+
{withSiblingField ? <input aria-label="Sibling field" /> : null}
|
|
5439
|
+
{onNonFocusingPress ? (
|
|
5440
|
+
<button
|
|
5441
|
+
// Stands in for \`preventFocusOnPress\`: the press lands but the input
|
|
5442
|
+
// never blurs.
|
|
5443
|
+
onMouseDown={(e) => {
|
|
5444
|
+
e.preventDefault();
|
|
5445
|
+
}}
|
|
5446
|
+
onClick={onNonFocusingPress}
|
|
5447
|
+
>
|
|
5448
|
+
Toolbar action
|
|
5449
|
+
</button>
|
|
5450
|
+
) : null}
|
|
5451
|
+
<ComboBox items={comboBoxItems} aria-label="Combo box" {...args} />
|
|
5098
5452
|
</Box>
|
|
5099
5453
|
);
|
|
5100
5454
|
};
|
|
@@ -5227,6 +5581,47 @@ export const LabelledByComboBoxExample: React.FC<
|
|
|
5227
5581
|
);
|
|
5228
5582
|
};
|
|
5229
5583
|
|
|
5584
|
+
export const CustomOptionComboBoxExample: React.FC = () => {
|
|
5585
|
+
return (
|
|
5586
|
+
<ComboBoxExample
|
|
5587
|
+
renderOption={(item) => <span>{item.label} \u2014 custom</span>}
|
|
5588
|
+
optionClassName={(item) => \`custom-option-\${item.id}\`}
|
|
5589
|
+
optionStyle={(_item, { isSelected }) => ({
|
|
5590
|
+
outline: isSelected
|
|
5591
|
+
? "1px solid rgb(0, 128, 0)"
|
|
5592
|
+
: "1px solid rgb(255, 0, 0)",
|
|
5593
|
+
})}
|
|
5594
|
+
/>
|
|
5595
|
+
);
|
|
5596
|
+
};
|
|
5597
|
+
|
|
5598
|
+
export const CountingOptionComboBoxExample: React.FC<{
|
|
5599
|
+
withSections?: boolean;
|
|
5600
|
+
}> = ({ withSections = false }) => {
|
|
5601
|
+
const [count, setCount] = React.useState(0);
|
|
5602
|
+
|
|
5603
|
+
return (
|
|
5604
|
+
<>
|
|
5605
|
+
<button
|
|
5606
|
+
onClick={() => {
|
|
5607
|
+
setCount(count + 1);
|
|
5608
|
+
}}
|
|
5609
|
+
>
|
|
5610
|
+
Increment
|
|
5611
|
+
</button>
|
|
5612
|
+
<ComboBoxExample
|
|
5613
|
+
items={withSections ? itemsWithSections : items}
|
|
5614
|
+
renderOption={(item) => (
|
|
5615
|
+
<span>
|
|
5616
|
+
{item.label} #{count}
|
|
5617
|
+
</span>
|
|
5618
|
+
)}
|
|
5619
|
+
optionClassName={() => \`count-\${count}\`}
|
|
5620
|
+
/>
|
|
5621
|
+
</>
|
|
5622
|
+
);
|
|
5623
|
+
};
|
|
5624
|
+
|
|
5230
5625
|
export const SectionComboBoxExample: React.FC = () => {
|
|
5231
5626
|
return (
|
|
5232
5627
|
<Box style={{ width: "100%", height: 300 }}>
|
|
@@ -5506,6 +5901,13 @@ warningMessage?: string
|
|
|
5506
5901
|
* @default "none"
|
|
5507
5902
|
*/
|
|
5508
5903
|
pickerType?: "none" | "presentation" | "calendar"
|
|
5904
|
+
/**
|
|
5905
|
+
* Overrides the accessible label of the button that opens the calendar
|
|
5906
|
+
* picker popover.
|
|
5907
|
+
*
|
|
5908
|
+
* Message id: \`bui.dateField.openCalendar\`. Defaults to \`"Open calendar"\`.
|
|
5909
|
+
*/
|
|
5910
|
+
openCalendarLabel?: string
|
|
5509
5911
|
}`,stories:{usage:[{id:"core-forms-datefield--basic",name:"Basic",snippet:'const Basic = () => <DateField onChange={fn()} aria-label="Event Date" granularity="day" />;'},{id:"core-forms-datefield--with-label",name:"With Label",snippet:'const WithLabel = () => <DateField onChange={fn()} label="Event Date" granularity="day" />;'},{id:"core-forms-datefield--variants",name:"Variants",snippet:`const Variants = (args) => (
|
|
5510
5912
|
<VariantViewer<React.ComponentProps<typeof DateField>>
|
|
5511
5913
|
cellStyle={{ minWidth: 300 }}
|
|
@@ -7094,6 +7496,12 @@ contentStyle?: React.CSSProperties
|
|
|
7094
7496
|
* The class name of the content container.
|
|
7095
7497
|
*/
|
|
7096
7498
|
contentClassName?: string
|
|
7499
|
+
/**
|
|
7500
|
+
* Overrides the accessible label of the close button.
|
|
7501
|
+
*
|
|
7502
|
+
* Message id: \`bui.drawer.close\`. Defaults to \`"Close"\`.
|
|
7503
|
+
*/
|
|
7504
|
+
closeLabel?: string
|
|
7097
7505
|
}`,stories:{usage:[{id:"core-overlays-drawer--basic",name:"Basic",snippet:'const Basic = () => <Drawer title=""><div style={{ height: 400 }} /></Drawer>;'},{id:"core-overlays-drawer--with-action",name:"With Action",snippet:`const WithAction = () => <Drawer
|
|
7098
7506
|
action={{
|
|
7099
7507
|
icon: EllipseIcon,
|
|
@@ -7325,6 +7733,182 @@ saveOnEnter?: boolean
|
|
|
7325
7733
|
* @default true
|
|
7326
7734
|
*/
|
|
7327
7735
|
autoLink?: boolean
|
|
7736
|
+
/**
|
|
7737
|
+
* Overrides the accessible name of the toolbar button that inserts an
|
|
7738
|
+
* @-mention, and the accessible name of the mention combobox it opens.
|
|
7739
|
+
*
|
|
7740
|
+
* Message id: \`bui.editor.mention\`. Defaults to \`"Mention"\`.
|
|
7741
|
+
*/
|
|
7742
|
+
mentionLabel?: string
|
|
7743
|
+
/**
|
|
7744
|
+
* Overrides the accessible name of the rich text toolbar's Bold toggle, and
|
|
7745
|
+
* the matching row in the keyboard shortcut dialog.
|
|
7746
|
+
*
|
|
7747
|
+
* Message id: \`bui.editor.bold\`. Defaults to \`"Bold"\`.
|
|
7748
|
+
*/
|
|
7749
|
+
boldLabel?: string
|
|
7750
|
+
/**
|
|
7751
|
+
* Overrides the accessible name of the rich text toolbar's Italic toggle,
|
|
7752
|
+
* and the matching row in the keyboard shortcut dialog.
|
|
7753
|
+
*
|
|
7754
|
+
* Message id: \`bui.editor.italic\`. Defaults to \`"Italic"\`.
|
|
7755
|
+
*/
|
|
7756
|
+
italicLabel?: string
|
|
7757
|
+
/**
|
|
7758
|
+
* Overrides the accessible name of the rich text toolbar's Underline
|
|
7759
|
+
* toggle, and the matching row in the keyboard shortcut dialog.
|
|
7760
|
+
*
|
|
7761
|
+
* Message id: \`bui.editor.underline\`. Defaults to \`"Underline"\`.
|
|
7762
|
+
*/
|
|
7763
|
+
underlineLabel?: string
|
|
7764
|
+
/**
|
|
7765
|
+
* Overrides the accessible name of the toolbar control that sets the
|
|
7766
|
+
* colour of the selected text.
|
|
7767
|
+
*
|
|
7768
|
+
* Message id: \`bui.editor.fontColor\`. Defaults to \`"Font color"\`.
|
|
7769
|
+
*/
|
|
7770
|
+
fontColorLabel?: string
|
|
7771
|
+
/**
|
|
7772
|
+
* Overrides the accessible name of the toolbar control that sets the
|
|
7773
|
+
* highlight colour drawn behind the selected text.
|
|
7774
|
+
*
|
|
7775
|
+
* Message id: \`bui.editor.backgroundColor\`. Defaults to \`"Background color"\`.
|
|
7776
|
+
*/
|
|
7777
|
+
backgroundColorLabel?: string
|
|
7778
|
+
/**
|
|
7779
|
+
* Overrides the title of the keyboard shortcut dialog, and the accessible
|
|
7780
|
+
* name of the toolbar button that opens it.
|
|
7781
|
+
*
|
|
7782
|
+
* Message id: \`bui.editor.help\`. Defaults to \`"Help"\`.
|
|
7783
|
+
*/
|
|
7784
|
+
helpLabel?: string
|
|
7785
|
+
/**
|
|
7786
|
+
* Overrides the accessible name of the icon button that dismisses the
|
|
7787
|
+
* keyboard shortcut dialog.
|
|
7788
|
+
*
|
|
7789
|
+
* Message id: \`bui.editor.close\`. Defaults to \`"Close"\`.
|
|
7790
|
+
*/
|
|
7791
|
+
closeLabel?: string
|
|
7792
|
+
/**
|
|
7793
|
+
* Overrides the "Action" column header of the keyboard shortcut dialog's
|
|
7794
|
+
* table.
|
|
7795
|
+
*
|
|
7796
|
+
* Message id: \`bui.editor.action\`. Defaults to \`"Action"\`.
|
|
7797
|
+
*/
|
|
7798
|
+
actionLabel?: string
|
|
7799
|
+
/**
|
|
7800
|
+
* Overrides the "Shortcut" column header of the keyboard shortcut dialog's
|
|
7801
|
+
* table.
|
|
7802
|
+
*
|
|
7803
|
+
* Message id: \`bui.editor.shortcut\`. Defaults to \`"Shortcut"\`.
|
|
7804
|
+
*/
|
|
7805
|
+
shortcutLabel?: string
|
|
7806
|
+
/**
|
|
7807
|
+
* Overrides the row label for the "move focus to the toolbar" command in
|
|
7808
|
+
* the keyboard shortcut dialog.
|
|
7809
|
+
*
|
|
7810
|
+
* Message id: \`bui.editor.toolbarFocus\`. Defaults to \`"Toolbar Focus"\`.
|
|
7811
|
+
*/
|
|
7812
|
+
toolbarFocusLabel?: string
|
|
7813
|
+
/**
|
|
7814
|
+
* Overrides the row label for the "select all" command in the keyboard
|
|
7815
|
+
* shortcut dialog.
|
|
7816
|
+
*
|
|
7817
|
+
* Message id: \`bui.editor.selectAll\`. Defaults to \`"Select All"\`.
|
|
7818
|
+
*/
|
|
7819
|
+
selectAllLabel?: string
|
|
7820
|
+
/**
|
|
7821
|
+
* Overrides the row label for the "cut" command in the keyboard shortcut
|
|
7822
|
+
* dialog.
|
|
7823
|
+
*
|
|
7824
|
+
* Message id: \`bui.editor.cut\`. Defaults to \`"Cut"\`.
|
|
7825
|
+
*/
|
|
7826
|
+
cutLabel?: string
|
|
7827
|
+
/**
|
|
7828
|
+
* Overrides the row label for the "copy" command in the keyboard shortcut
|
|
7829
|
+
* dialog.
|
|
7830
|
+
*
|
|
7831
|
+
* Message id: \`bui.editor.copy\`. Defaults to \`"Copy"\`.
|
|
7832
|
+
*/
|
|
7833
|
+
copyLabel?: string
|
|
7834
|
+
/**
|
|
7835
|
+
* Overrides the row label for the "paste" command in the keyboard shortcut
|
|
7836
|
+
* dialog.
|
|
7837
|
+
*
|
|
7838
|
+
* Message id: \`bui.editor.paste\`. Defaults to \`"Paste"\`.
|
|
7839
|
+
*/
|
|
7840
|
+
pasteLabel?: string
|
|
7841
|
+
/**
|
|
7842
|
+
* Overrides the row label for the "undo" command in the keyboard shortcut
|
|
7843
|
+
* dialog.
|
|
7844
|
+
*
|
|
7845
|
+
* Message id: \`bui.editor.undo\`. Defaults to \`"Undo"\`.
|
|
7846
|
+
*/
|
|
7847
|
+
undoLabel?: string
|
|
7848
|
+
/**
|
|
7849
|
+
* Overrides the row label for the "redo" command in the keyboard shortcut
|
|
7850
|
+
* dialog.
|
|
7851
|
+
*
|
|
7852
|
+
* Message id: \`bui.editor.redo\`. Defaults to \`"Redo"\`.
|
|
7853
|
+
*/
|
|
7854
|
+
redoLabel?: string
|
|
7855
|
+
/**
|
|
7856
|
+
* Overrides the row label for the "open help dialog" command in the
|
|
7857
|
+
* keyboard shortcut dialog.
|
|
7858
|
+
*
|
|
7859
|
+
* Message id: \`bui.editor.openHelpDialog\`. Defaults to \`"Open Help Dialog"\`.
|
|
7860
|
+
*/
|
|
7861
|
+
openHelpDialogLabel?: string
|
|
7862
|
+
/**
|
|
7863
|
+
* Overrides the row label for the "submit" command in the keyboard
|
|
7864
|
+
* shortcut dialog.
|
|
7865
|
+
*
|
|
7866
|
+
* Message id: \`bui.editor.submit\`. Defaults to \`"Submit"\`.
|
|
7867
|
+
*/
|
|
7868
|
+
submitLabel?: string
|
|
7869
|
+
/**
|
|
7870
|
+
* Overrides the accessible name of the link popover's toolbar trigger
|
|
7871
|
+
* button.
|
|
7872
|
+
*
|
|
7873
|
+
* Message id: \`bui.editor.addLink\`. Defaults to \`"Add Link"\`.
|
|
7874
|
+
*/
|
|
7875
|
+
addLinkLabel?: string
|
|
7876
|
+
/**
|
|
7877
|
+
* Overrides the label of the button that changes the URL of an existing
|
|
7878
|
+
* link, shown in the link popover.
|
|
7879
|
+
*
|
|
7880
|
+
* Message id: \`bui.editor.editLink\`. Defaults to \`"Edit Link"\`.
|
|
7881
|
+
*/
|
|
7882
|
+
editLinkLabel?: string
|
|
7883
|
+
/**
|
|
7884
|
+
* Overrides the label of the button that unlinks the selected text, shown
|
|
7885
|
+
* in the link popover.
|
|
7886
|
+
*
|
|
7887
|
+
* Message id: \`bui.editor.removeLink\`. Defaults to \`"Remove Link"\`.
|
|
7888
|
+
*/
|
|
7889
|
+
removeLinkLabel?: string
|
|
7890
|
+
/**
|
|
7891
|
+
* Overrides the label of the URL field in the link popover.
|
|
7892
|
+
*
|
|
7893
|
+
* Message id: \`bui.editor.linkAnnotation\`. Defaults to \`"Link"\`.
|
|
7894
|
+
*/
|
|
7895
|
+
linkAnnotationLabel?: string
|
|
7896
|
+
/**
|
|
7897
|
+
* Overrides the label of the Cancel button in the link popover's edit mode.
|
|
7898
|
+
* Distinct from \`cancelButtonAriaLabel\`, which labels the editor footer's
|
|
7899
|
+
* Cancel button.
|
|
7900
|
+
*
|
|
7901
|
+
* Message id: \`bui.editor.cancel\`. Defaults to \`"Cancel"\`.
|
|
7902
|
+
*/
|
|
7903
|
+
linkCancelLabel?: string
|
|
7904
|
+
/**
|
|
7905
|
+
* Overrides the label of the Save button in the link popover's edit mode.
|
|
7906
|
+
* Distinct from \`submitButtonAriaLabel\`, which labels the editor footer's
|
|
7907
|
+
* Save button.
|
|
7908
|
+
*
|
|
7909
|
+
* Message id: \`bui.editor.save\`. Defaults to \`"Save"\`.
|
|
7910
|
+
*/
|
|
7911
|
+
linkSaveLabel?: string
|
|
7328
7912
|
}`,stories:{usage:[{id:"core-miscellaneous-editor-rich-text--default",name:"Default",snippet:`const Default = () => <Editor
|
|
7329
7913
|
placeholder="Placeholder"
|
|
7330
7914
|
aria-label="Editor"
|
|
@@ -8035,6 +8619,27 @@ onRemove?: (id: string) => void
|
|
|
8035
8619
|
* button or keyboard.
|
|
8036
8620
|
*/
|
|
8037
8621
|
disabledKeys?: Iterable<string> | "all"
|
|
8622
|
+
/**
|
|
8623
|
+
* Overrides the accessible name of a file row while it is loading, and of
|
|
8624
|
+
* its spinner.
|
|
8625
|
+
*
|
|
8626
|
+
* Message id: \`bui.fileList.loading\`. Defaults to \`"Loading {fileName}"\`.
|
|
8627
|
+
* A string is used as-is, with no placeholder substitution. To include
|
|
8628
|
+
* \`fileName\`, pass a function \u2014 it receives \`{ fileName }\` and its return
|
|
8629
|
+
* value is used verbatim.
|
|
8630
|
+
*/
|
|
8631
|
+
loadingLabel?: string | ((values: { fileName: string }) => string)
|
|
8632
|
+
/**
|
|
8633
|
+
* Overrides the accessible name of a removable file row, telling keyboard
|
|
8634
|
+
* users how to delete it.
|
|
8635
|
+
*
|
|
8636
|
+
* Message id: \`bui.fileList.removeHint\`. Defaults to
|
|
8637
|
+
* \`"{fileName}, press Delete or Backspace to remove"\`. A string is used
|
|
8638
|
+
* as-is, with no placeholder substitution. To include \`fileName\`, pass a
|
|
8639
|
+
* function \u2014 it receives \`{ fileName }\` and its return value is used
|
|
8640
|
+
* verbatim.
|
|
8641
|
+
*/
|
|
8642
|
+
removeHintLabel?: string | ((values: { fileName: string }) => string)
|
|
8038
8643
|
}`,stories:{usage:[{id:"core-collections-filelist--basic",name:"Basic",snippet:`const Basic = () => {
|
|
8039
8644
|
const [items, setItems] = React.useState(args.items);
|
|
8040
8645
|
React.useEffect(() => {
|
|
@@ -8163,7 +8768,7 @@ disabledKeys?: Iterable<string> | "all"
|
|
|
8163
8768
|
import { ActionButton } from "../../ActionButton";
|
|
8164
8769
|
import { FileList } from "../FileList";
|
|
8165
8770
|
|
|
8166
|
-
import type { FileListItem } from "../FileList.types";
|
|
8771
|
+
import type { FileListItem, FileListProps } from "../FileList.types";
|
|
8167
8772
|
|
|
8168
8773
|
export const defaultItems: FileListItem[] = [
|
|
8169
8774
|
{ id: "1", name: "report.pdf" },
|
|
@@ -8244,11 +8849,16 @@ export const UploadingFileList: React.FC = () => {
|
|
|
8244
8849
|
interface BasicProps {
|
|
8245
8850
|
onRemove?: (id: string) => void;
|
|
8246
8851
|
disabledKeys?: Iterable<string> | "all";
|
|
8852
|
+
removeHintLabel?: FileListProps["removeHintLabel"];
|
|
8853
|
+
/** Playwright cannot serialize a function prop, so the callback form is built here. */
|
|
8854
|
+
useFunctionLabel?: boolean;
|
|
8247
8855
|
}
|
|
8248
8856
|
|
|
8249
8857
|
export const BasicFileList: React.FC<BasicProps> = ({
|
|
8250
8858
|
onRemove,
|
|
8251
8859
|
disabledKeys,
|
|
8860
|
+
removeHintLabel,
|
|
8861
|
+
useFunctionLabel,
|
|
8252
8862
|
}) => {
|
|
8253
8863
|
const [items, setItems] = React.useState<FileListItem[]>(defaultItems);
|
|
8254
8864
|
return (
|
|
@@ -8256,6 +8866,11 @@ export const BasicFileList: React.FC<BasicProps> = ({
|
|
|
8256
8866
|
aria-label="Uploaded files"
|
|
8257
8867
|
items={items}
|
|
8258
8868
|
disabledKeys={disabledKeys}
|
|
8869
|
+
removeHintLabel={
|
|
8870
|
+
useFunctionLabel
|
|
8871
|
+
? ({ fileName }) => \`Remove \${fileName}?\`
|
|
8872
|
+
: removeHintLabel
|
|
8873
|
+
}
|
|
8259
8874
|
onRemove={(id) => {
|
|
8260
8875
|
onRemove?.(id);
|
|
8261
8876
|
setItems((current) => current.filter((item) => item.id !== id));
|
|
@@ -8268,8 +8883,25 @@ export const EmptyFileList: React.FC = () => (
|
|
|
8268
8883
|
<FileList aria-label="Empty" items={[]} />
|
|
8269
8884
|
);
|
|
8270
8885
|
|
|
8271
|
-
|
|
8272
|
-
|
|
8886
|
+
interface LoadingProps {
|
|
8887
|
+
loadingLabel?: FileListProps["loadingLabel"];
|
|
8888
|
+
/** Playwright cannot serialize a function prop, so the callback form is built here. */
|
|
8889
|
+
useFunctionLabel?: boolean;
|
|
8890
|
+
}
|
|
8891
|
+
|
|
8892
|
+
export const LoadingFileList: React.FC<LoadingProps> = ({
|
|
8893
|
+
loadingLabel,
|
|
8894
|
+
useFunctionLabel,
|
|
8895
|
+
}) => (
|
|
8896
|
+
<FileList
|
|
8897
|
+
aria-label="Uploaded files"
|
|
8898
|
+
items={loadingItems}
|
|
8899
|
+
loadingLabel={
|
|
8900
|
+
useFunctionLabel
|
|
8901
|
+
? ({ fileName }) => \`Working on \${fileName}\`
|
|
8902
|
+
: loadingLabel
|
|
8903
|
+
}
|
|
8904
|
+
/>
|
|
8273
8905
|
);
|
|
8274
8906
|
|
|
8275
8907
|
export const ErrorFileList: React.FC = () => (
|
|
@@ -9998,9 +10630,9 @@ children: React.ReactNode
|
|
|
9998
10630
|
This example shows how to use \`I18nProvider\` to override the default locale.
|
|
9999
10631
|
|
|
10000
10632
|
\`\`\`jsx
|
|
10001
|
-
import { I18nProvider } from "@
|
|
10633
|
+
import { I18nProvider } from "@baseline-ui/core";
|
|
10002
10634
|
|
|
10003
|
-
export const
|
|
10635
|
+
export const Root = () => (
|
|
10004
10636
|
<I18nProvider locale="en">
|
|
10005
10637
|
<App />
|
|
10006
10638
|
</I18nProvider>
|
|
@@ -10011,14 +10643,18 @@ The \`App\` component will receive the new locale through \`useLocale\`.
|
|
|
10011
10643
|
|
|
10012
10644
|
\`\`\`jsx
|
|
10013
10645
|
// App.js
|
|
10014
|
-
import { useLocale } from "@
|
|
10646
|
+
import { useLocale } from "@baseline-ui/core";
|
|
10015
10647
|
|
|
10016
10648
|
const App = () => {
|
|
10017
|
-
const locale = useLocale();
|
|
10649
|
+
const { locale } = useLocale();
|
|
10018
10650
|
|
|
10019
10651
|
return <div>Current locale: {locale}</div>;
|
|
10020
10652
|
};
|
|
10021
|
-
|
|
10653
|
+
\`\`\`
|
|
10654
|
+
|
|
10655
|
+
\`locale\` only switches date, number and collation formatting and text direction. To
|
|
10656
|
+
translate the strings Baseline UI renders, pass a catalog through \`messages\` \u2014 see
|
|
10657
|
+
[Internationalization](/?path=/docs/internationalization--docs#loading-a-translation-catalog).`,props:`interface I18nProviderProps {
|
|
10022
10658
|
/**
|
|
10023
10659
|
* Contents that should have the locale applied.
|
|
10024
10660
|
*/
|
|
@@ -10044,6 +10680,8 @@ shouldLogMissingMessages?: boolean
|
|
|
10044
10680
|
import React from "react";
|
|
10045
10681
|
|
|
10046
10682
|
import { useI18n } from "../../../hooks";
|
|
10683
|
+
import { Pagination } from "../../Pagination";
|
|
10684
|
+
import { I18nProvider } from "../I18nProvider";
|
|
10047
10685
|
|
|
10048
10686
|
export const messages = {
|
|
10049
10687
|
en: { greeting: "Hello, {name} !" },
|
|
@@ -10095,7 +10733,23 @@ export const LocaleStringExample: React.FC<{
|
|
|
10095
10733
|
{formatter.formatMessage("greeting", { name })}
|
|
10096
10734
|
</div>
|
|
10097
10735
|
);
|
|
10098
|
-
}
|
|
10736
|
+
};
|
|
10737
|
+
|
|
10738
|
+
const paginationCatalog = {
|
|
10739
|
+
en: { "bui.pagination.pageXofY": "Catalog position" },
|
|
10740
|
+
};
|
|
10741
|
+
|
|
10742
|
+
/** The same ID resolved twice: from the catalog, and from an override prop. */
|
|
10743
|
+
export const OverridePrecedenceExample: React.FC = () => (
|
|
10744
|
+
<I18nProvider locale="en" messages={paginationCatalog}>
|
|
10745
|
+
<Pagination aria-label="from catalog" maxValue={10} />
|
|
10746
|
+
<Pagination
|
|
10747
|
+
aria-label="from prop"
|
|
10748
|
+
maxValue={10}
|
|
10749
|
+
pageXofYLabel="Prop position"
|
|
10750
|
+
/>
|
|
10751
|
+
</I18nProvider>
|
|
10752
|
+
);`},similarTo:[],figmaUrl:null},ImageDropZone:{id:"core-forms-imagedropzone",breadcrumb:"Core/Forms/ImageDropZone",importStatement:'import { ImageDropZone, VariantViewer } from "@baseline-ui/core";',description:"`ImageDropZone` is a single-image input that accepts a file via drag-and-drop, paste, or the native picker and previews it in place. Use it when collecting one representative image, such as an avatar, logo, or thumbnail, with an optional replace and remove flow.",documentation:`\`ImageDropZone\` is a single-image input that accepts a file via drag-and-drop, paste, or the native picker and previews it in place. Use it when collecting one representative image, such as an avatar, logo, or thumbnail, with an optional replace and remove flow.
|
|
10099
10753
|
|
|
10100
10754
|
* Automatic handling of Keyboard focus management and cross browser normalization
|
|
10101
10755
|
* Labeling support for screen readers (aria-describedby)
|
|
@@ -10630,6 +11284,28 @@ layoutTransition?: Transition | boolean
|
|
|
10630
11284
|
* @default "Are you sure you want to delete this item?"
|
|
10631
11285
|
*/
|
|
10632
11286
|
deleteConfirmationTitle?: string | ((selectedKeys: Selection) => string)
|
|
11287
|
+
/**
|
|
11288
|
+
* Overrides the label of the button that permanently deletes the selected
|
|
11289
|
+
* image(s), and the accessible label of each image's individual delete
|
|
11290
|
+
* button.
|
|
11291
|
+
*
|
|
11292
|
+
* Message id: \`bui.imageGallery.delete\`. Defaults to \`"Delete"\`.
|
|
11293
|
+
*/
|
|
11294
|
+
deleteLabel?: string
|
|
11295
|
+
/**
|
|
11296
|
+
* Overrides the label of the button that dismisses the delete confirmation
|
|
11297
|
+
* modal without deleting anything.
|
|
11298
|
+
*
|
|
11299
|
+
* Message id: \`bui.imageGallery.cancel\`. Defaults to \`"Cancel"\`.
|
|
11300
|
+
*/
|
|
11301
|
+
cancelLabel?: string
|
|
11302
|
+
/**
|
|
11303
|
+
* Overrides the accessible label announced while an image is still
|
|
11304
|
+
* loading.
|
|
11305
|
+
*
|
|
11306
|
+
* Message id: \`bui.imageGallery.loading\`. Defaults to \`"Loading"\`.
|
|
11307
|
+
*/
|
|
11308
|
+
loadingLabel?: string
|
|
10633
11309
|
}`,stories:{usage:[{id:"core-collections-imagegallery--basic",name:"Basic",snippet:'const Basic = () => <ImageGallery fit="cover" aria-label="Image gallery" defaultItems={items.slice(0, 4)} />;'},{id:"core-collections-imagegallery--more-items",name:"More Items",snippet:'const MoreItems = () => <ImageGallery fit="cover" aria-label="Image gallery" defaultItems={items} />;'},{id:"core-collections-imagegallery--with-medium-size",name:"With Medium Size",snippet:`const WithMediumSize = () => <ImageGallery
|
|
10634
11310
|
fit="cover"
|
|
10635
11311
|
aria-label="Image gallery"
|
|
@@ -10790,6 +11466,10 @@ import { Box } from "../../Box";
|
|
|
10790
11466
|
import { I18nProvider } from "../../I18nProvider";
|
|
10791
11467
|
import { NumberInput } from "../../NumberInput";
|
|
10792
11468
|
import { Text } from "../../Text";
|
|
11469
|
+
import {
|
|
11470
|
+
VIRTUALIZER_LAYOUT_DEFAULT_OPTIONS,
|
|
11471
|
+
Virtualizer,
|
|
11472
|
+
} from "../../Virtualizer";
|
|
10793
11473
|
import { ImageGallery, ImageSize } from "../ImageGallery";
|
|
10794
11474
|
import { items } from "./data";
|
|
10795
11475
|
|
|
@@ -11102,6 +11782,43 @@ export function RTLImageGalleryExample(
|
|
|
11102
11782
|
<ImageGallery {...props} />
|
|
11103
11783
|
</I18nProvider>
|
|
11104
11784
|
);
|
|
11785
|
+
}
|
|
11786
|
+
|
|
11787
|
+
/**
|
|
11788
|
+
* Driven by a window event rather than a button, because clicking anything would move focus
|
|
11789
|
+
* and end the keyboard drag by itself.
|
|
11790
|
+
*/
|
|
11791
|
+
export function RerenderOnDemandImageGalleryExample({
|
|
11792
|
+
isVirtualized = false,
|
|
11793
|
+
...props
|
|
11794
|
+
}: Omit<React.ComponentProps<typeof ImageGallery>, "onDelete"> & {
|
|
11795
|
+
isVirtualized?: boolean;
|
|
11796
|
+
}) {
|
|
11797
|
+
const [, rerender] = React.useReducer((tick: number) => tick + 1, 0);
|
|
11798
|
+
|
|
11799
|
+
React.useEffect(() => {
|
|
11800
|
+
const onRerender = () => {
|
|
11801
|
+
rerender();
|
|
11802
|
+
};
|
|
11803
|
+
|
|
11804
|
+
window.addEventListener("repro:rerender", onRerender);
|
|
11805
|
+
|
|
11806
|
+
return () => {
|
|
11807
|
+
window.removeEventListener("repro:rerender", onRerender);
|
|
11808
|
+
};
|
|
11809
|
+
}, []);
|
|
11810
|
+
|
|
11811
|
+
const gallery = <ImageGallery defaultItems={items} {...props} />;
|
|
11812
|
+
|
|
11813
|
+
if (!isVirtualized) {
|
|
11814
|
+
return gallery;
|
|
11815
|
+
}
|
|
11816
|
+
|
|
11817
|
+
return (
|
|
11818
|
+
<Virtualizer {...VIRTUALIZER_LAYOUT_DEFAULT_OPTIONS.IMAGE_GALLERY}>
|
|
11819
|
+
{gallery}
|
|
11820
|
+
</Virtualizer>
|
|
11821
|
+
);
|
|
11105
11822
|
}`},similarTo:[],figmaUrl:null},InlineAlert:{id:"core-status-inlinealert",breadcrumb:"Core/Status/InlineAlert",importStatement:'import { InlineAlert } from "@baseline-ui/core";',description:"`InlineAlert` is a status message anchored next to related content, with success, warning, error, or info styling and optional action and dismiss buttons. Use it for persistent, in-context feedback that should stay visible without interrupting the user's flow.",documentation:`\`InlineAlert\` is a status message anchored next to related content, with success, warning, error, or info styling and optional action and dismiss buttons. Use it for persistent, in-context feedback that should stay visible without interrupting the user's flow.
|
|
11106
11823
|
|
|
11107
11824
|
* Exposed to assistive technology with \`role="alert"\`.
|
|
@@ -11272,6 +11989,12 @@ onAction?: () => void
|
|
|
11272
11989
|
* close button will be rendered.
|
|
11273
11990
|
*/
|
|
11274
11991
|
onClose?: () => void
|
|
11992
|
+
/**
|
|
11993
|
+
* Overrides the accessible label of the close button.
|
|
11994
|
+
*
|
|
11995
|
+
* Message id: \`bui.inlineAlert.close\`. Defaults to \`"Close"\`.
|
|
11996
|
+
*/
|
|
11997
|
+
closeLabel?: string
|
|
11275
11998
|
/**
|
|
11276
11999
|
* The arrangement of the variable.
|
|
11277
12000
|
*
|
|
@@ -14694,6 +15417,18 @@ size?: "xs" | "sm" | "md" | "lg"
|
|
|
14694
15417
|
* Whether to hide the increment and decrement actions.
|
|
14695
15418
|
*/
|
|
14696
15419
|
hideActions?: boolean
|
|
15420
|
+
/**
|
|
15421
|
+
* Overrides the accessible name announcing the current position in the
|
|
15422
|
+
* document.
|
|
15423
|
+
*
|
|
15424
|
+
* Message id: \`bui.pagination.pageXofY\`. Defaults to
|
|
15425
|
+
* \`"Page {arg0} of {arg1}"\`, where \`arg0\` is the current page and \`arg1\`
|
|
15426
|
+
* the total page count. A string is used as-is, with no placeholder
|
|
15427
|
+
* substitution. To include the numbers, pass a function \u2014 it receives
|
|
15428
|
+
* \`{ page, totalPages }\` and its return value is used verbatim.
|
|
15429
|
+
*/
|
|
15430
|
+
pageXofYLabel?: | string
|
|
15431
|
+
| ((values: { page: number; totalPages: number }) => string)
|
|
14697
15432
|
minValue?: any
|
|
14698
15433
|
defaultValue?: any
|
|
14699
15434
|
}`,stories:{usage:[{id:"core-forms-pagination--primary",name:"Primary",snippet:'const Primary = () => <Pagination maxValue={10} aria-label="Pagination" />;'},{id:"core-forms-pagination--variants",name:"Variants",snippet:`const Variants = (args) => (
|
|
@@ -14757,7 +15492,29 @@ defaultValue?: any
|
|
|
14757
15492
|
},
|
|
14758
15493
|
}}>
|
|
14759
15494
|
<Pagination maxValue={10} aria-label="Pagination" />
|
|
14760
|
-
</I18nProvider>;`}],implementation
|
|
15495
|
+
</I18nProvider>;`}],implementation:`import React from "react";
|
|
15496
|
+
|
|
15497
|
+
import { Pagination } from "../Pagination";
|
|
15498
|
+
|
|
15499
|
+
/**
|
|
15500
|
+
* Pagination whose \`pageXofYLabel\` is the callback form. Playwright cannot
|
|
15501
|
+
* serialize a function prop, so it is built here rather than in the spec.
|
|
15502
|
+
*
|
|
15503
|
+
* The label does arithmetic on \`page\` so the assertion fails if the callback
|
|
15504
|
+
* is ever handed the formatted string instead of the number.
|
|
15505
|
+
*/
|
|
15506
|
+
export function FunctionPageLabelPagination() {
|
|
15507
|
+
return (
|
|
15508
|
+
<Pagination
|
|
15509
|
+
aria-label="test"
|
|
15510
|
+
maxValue={100}
|
|
15511
|
+
defaultValue={5}
|
|
15512
|
+
pageXofYLabel={({ page, totalPages }) =>
|
|
15513
|
+
\`Currently \${page}/\${totalPages}, next is \${page + 1}\`
|
|
15514
|
+
}
|
|
15515
|
+
/>
|
|
15516
|
+
);
|
|
15517
|
+
}`},similarTo:[],figmaUrl:null},Panel:{id:"core-utilities-panel",breadcrumb:"Core/Utilities/Panel",importStatement:`import {
|
|
14761
15518
|
PanelCollapsibleStoryExample,
|
|
14762
15519
|
PanelConditionalExample,
|
|
14763
15520
|
PanelControlledExample,
|
|
@@ -19297,6 +20054,36 @@ hideSelectAll?: boolean
|
|
|
19297
20054
|
* @default false
|
|
19298
20055
|
*/
|
|
19299
20056
|
hideClear?: boolean
|
|
20057
|
+
/**
|
|
20058
|
+
* Overrides the label of the button that unticks every selected option.
|
|
20059
|
+
*
|
|
20060
|
+
* Message id: \`bui.select.clear\`. Defaults to \`"Clear"\`.
|
|
20061
|
+
*/
|
|
20062
|
+
clearLabel?: string
|
|
20063
|
+
/**
|
|
20064
|
+
* Overrides the placeholder and accessible name of the input that filters
|
|
20065
|
+
* the option list.
|
|
20066
|
+
*
|
|
20067
|
+
* Message id: \`bui.select.search\`. Defaults to \`"Search"\`.
|
|
20068
|
+
*/
|
|
20069
|
+
searchLabel?: string
|
|
20070
|
+
/**
|
|
20071
|
+
* Overrides the label of the button that ticks every option in a
|
|
20072
|
+
* multi-select list.
|
|
20073
|
+
*
|
|
20074
|
+
* Message id: \`bui.select.selectAll\`. Defaults to \`"Select All"\`.
|
|
20075
|
+
*/
|
|
20076
|
+
selectAllLabel?: string
|
|
20077
|
+
/**
|
|
20078
|
+
* Overrides the tag shown on the select trigger standing in for the
|
|
20079
|
+
* selected options that did not fit.
|
|
20080
|
+
*
|
|
20081
|
+
* Message id: \`bui.select.more\`. Defaults to \`"+{count} more"\`, where
|
|
20082
|
+
* \`count\` is the number of hidden options. A string is used as-is, with
|
|
20083
|
+
* no placeholder substitution. To include \`count\`, pass a function \u2014 it
|
|
20084
|
+
* receives \`{ count }\` and its return value is used verbatim.
|
|
20085
|
+
*/
|
|
20086
|
+
moreLabel?: string | ((values: { count: number }) => string)
|
|
19300
20087
|
}`,stories:{usage:[{id:"core-forms-select-multiselect--basic",name:"Basic",error:{name:"SyntaxError",message:`Expected story to be a function or variable declaration
|
|
19301
20088
|
32 | type Story = StoryObj<typeof meta>;
|
|
19302
20089
|
33 |
|
|
@@ -19518,13 +20305,19 @@ import type { IconSelectProps } from "../Select.types";
|
|
|
19518
20305
|
import type { Key } from "@react-types/shared";
|
|
19519
20306
|
|
|
19520
20307
|
export const SelectExample: React.FC<
|
|
19521
|
-
Omit<React.ComponentProps<typeof Select>, "items">
|
|
19522
|
-
|
|
20308
|
+
Omit<React.ComponentProps<typeof Select>, "items"> & {
|
|
20309
|
+
/** Playwright cannot serialize a function prop, so the callback form is built here. */
|
|
20310
|
+
useFunctionLabel?: boolean;
|
|
20311
|
+
}
|
|
20312
|
+
> = ({ useFunctionLabel, ...args }) => {
|
|
19523
20313
|
return (
|
|
19524
20314
|
<Select
|
|
19525
20315
|
placeholder="Choose an item"
|
|
19526
20316
|
optionClassName={(item) => item.label}
|
|
19527
20317
|
{...args}
|
|
20318
|
+
moreLabel={
|
|
20319
|
+
useFunctionLabel ? ({ count }) => \`\${count} others\` : args.moreLabel
|
|
20320
|
+
}
|
|
19528
20321
|
items={items}
|
|
19529
20322
|
/>
|
|
19530
20323
|
);
|
|
@@ -20652,6 +21445,23 @@ isDisabled?: boolean
|
|
|
20652
21445
|
* (e.g. "Checkout").
|
|
20653
21446
|
*/
|
|
20654
21447
|
aria-label?: string
|
|
21448
|
+
/**
|
|
21449
|
+
* Overrides the fallback accessible name of a step when the application
|
|
21450
|
+
* supplies no title.
|
|
21451
|
+
*
|
|
21452
|
+
* Message id: \`bui.stepper.step\`. Defaults to \`"Step {index}"\`, where
|
|
21453
|
+
* \`index\` is the step's 1-based position. A string is used as-is, with
|
|
21454
|
+
* no placeholder substitution. To include \`index\`, pass a function \u2014 it
|
|
21455
|
+
* receives \`{ index }\` and its return value is used verbatim.
|
|
21456
|
+
*/
|
|
21457
|
+
stepLabel?: string | ((values: { index: number }) => string)
|
|
21458
|
+
/**
|
|
21459
|
+
* Overrides the screen-reader-only suffix marking a step the reader has
|
|
21460
|
+
* finished.
|
|
21461
|
+
*
|
|
21462
|
+
* Message id: \`bui.stepper.completed\`. Defaults to \`"Completed"\`.
|
|
21463
|
+
*/
|
|
21464
|
+
completedLabel?: string
|
|
20655
21465
|
}`,stories:{usage:[{id:"core-navigation-stepper--default",name:"Default",snippet:`const Default = () => <Stepper
|
|
20656
21466
|
items={items}
|
|
20657
21467
|
aria-label="Checkout"
|
|
@@ -20824,6 +21634,22 @@ export const checkoutItems: StepperItem[] = [
|
|
|
20824
21634
|
|
|
20825
21635
|
const defaultItems = checkoutItems;
|
|
20826
21636
|
|
|
21637
|
+
/**
|
|
21638
|
+
* Condensed Stepper whose \`stepLabel\` is the callback form. Playwright cannot
|
|
21639
|
+
* serialize a function prop, so it is built here rather than in the spec.
|
|
21640
|
+
*/
|
|
21641
|
+
export function FunctionStepLabelStepper() {
|
|
21642
|
+
return (
|
|
21643
|
+
<Stepper
|
|
21644
|
+
items={defaultItems.map(({ key }) => ({ key }))}
|
|
21645
|
+
variant="condensed"
|
|
21646
|
+
defaultSelectedStep="cart"
|
|
21647
|
+
aria-label="Checkout"
|
|
21648
|
+
stepLabel={({ index }) => \`Phase \${index}\`}
|
|
21649
|
+
/>
|
|
21650
|
+
);
|
|
21651
|
+
}
|
|
21652
|
+
|
|
20827
21653
|
export interface ControlledStepperProps {
|
|
20828
21654
|
items?: StepperItem[];
|
|
20829
21655
|
initialSelected?: Key;
|
|
@@ -22787,6 +23613,7 @@ interface AsyncLoadingTableExampleProps {
|
|
|
22787
23613
|
totalCount?: number;
|
|
22788
23614
|
loadingDelay?: number;
|
|
22789
23615
|
scrollOffset?: number;
|
|
23616
|
+
loadingLabel?: string;
|
|
22790
23617
|
}
|
|
22791
23618
|
|
|
22792
23619
|
/** Virtualized table that loads more rows automatically near the end. */
|
|
@@ -22800,6 +23627,7 @@ export const AsyncLoadingTableExample: React.FC<
|
|
|
22800
23627
|
totalCount = 60,
|
|
22801
23628
|
loadingDelay = 50,
|
|
22802
23629
|
scrollOffset = 1,
|
|
23630
|
+
loadingLabel,
|
|
22803
23631
|
}) => {
|
|
22804
23632
|
const dataset = generateLargeDataset(totalCount);
|
|
22805
23633
|
const [visibleCount, setVisibleCount] = useState(initialCount);
|
|
@@ -22865,6 +23693,7 @@ export const AsyncLoadingTableExample: React.FC<
|
|
|
22865
23693
|
}
|
|
22866
23694
|
isLoading={isLoading}
|
|
22867
23695
|
scrollOffset={scrollOffset}
|
|
23696
|
+
loadingLabel={loadingLabel}
|
|
22868
23697
|
>
|
|
22869
23698
|
{(row) => {
|
|
22870
23699
|
const typedRow = row as ReturnType<typeof generateLargeDataset>[0];
|
|
@@ -26317,6 +27146,14 @@ onKeyDown?: KeyboardProps["onKeyDown"]
|
|
|
26317
27146
|
* @default true
|
|
26318
27147
|
*/
|
|
26319
27148
|
isSingleTabStop?: boolean
|
|
27149
|
+
/**
|
|
27150
|
+
* Overrides the accessible label of the overflow button that reveals the
|
|
27151
|
+
* toolbar items which did not fit in the available width. This prop is
|
|
27152
|
+
* only relevant when \`isCollapsible\` is true.
|
|
27153
|
+
*
|
|
27154
|
+
* Message id: \`bui.toolbar.more\`. Defaults to \`"More"\`.
|
|
27155
|
+
*/
|
|
27156
|
+
moreLabel?: string
|
|
26320
27157
|
}`,stories:{usage:[{id:"core-miscellaneous-toolbar--basic",name:"Basic",snippet:'const Basic = () => <Toolbar style={{ display: "flex", flexDirection: "row", alignItems: "center" }}><ToolbarChildren /></Toolbar>;'},{id:"core-miscellaneous-toolbar--vertical",name:"Vertical",snippet:`const Vertical = () => <Toolbar
|
|
26321
27158
|
orientation="vertical"
|
|
26322
27159
|
style={{ display: "flex", flexDirection: "column", alignItems: "center" }} />;`},{id:"core-miscellaneous-toolbar--with-tooltip",name:"With Tooltip",snippet:"const WithTooltip = () => <Toolbar><ChildrenWithTooltip /></Toolbar>;"},{id:"core-miscellaneous-toolbar--with-over-flow",name:"With Over Flow",snippet:'const WithOverFlow = () => <Toolbar style={{ width: "max-content", display: "flex", alignItems: "center" }} />;'},{id:"core-miscellaneous-toolbar--with-tabbing-within",name:"With Tabbing Within",snippet:`const WithTabbingWithin = () => <Toolbar
|
|
@@ -26391,6 +27228,7 @@ export const CollapsibleChildren: React.FC<{
|
|
|
26391
27228
|
onDisabledPress?: () => void;
|
|
26392
27229
|
maxWidth?: number;
|
|
26393
27230
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
27231
|
+
moreLabel?: string;
|
|
26394
27232
|
}> = ({
|
|
26395
27233
|
onPageAdd,
|
|
26396
27234
|
onPageRemove,
|
|
@@ -26399,6 +27237,7 @@ export const CollapsibleChildren: React.FC<{
|
|
|
26399
27237
|
onDisabledPress,
|
|
26400
27238
|
maxWidth: _maxWidth,
|
|
26401
27239
|
onKeyDown,
|
|
27240
|
+
moreLabel,
|
|
26402
27241
|
}) => {
|
|
26403
27242
|
const [maxWidth, setMaxWidth] = useState(_maxWidth);
|
|
26404
27243
|
|
|
@@ -26428,7 +27267,11 @@ export const CollapsibleChildren: React.FC<{
|
|
|
26428
27267
|
justifyContent: "center",
|
|
26429
27268
|
}}
|
|
26430
27269
|
onKeyDown={onKeyDown}
|
|
26431
|
-
|
|
27270
|
+
moreLabel={moreLabel}
|
|
27271
|
+
collapsibleMenuProps={
|
|
27272
|
+
moreLabel
|
|
27273
|
+
? undefined
|
|
27274
|
+
: {
|
|
26432
27275
|
renderTrigger: ({ buttonProps, ref }) => (
|
|
26433
27276
|
<ActionIconButton
|
|
26434
27277
|
{...buttonProps}
|
|
@@ -26440,7 +27283,8 @@ export const CollapsibleChildren: React.FC<{
|
|
|
26440
27283
|
tooltip={true}
|
|
26441
27284
|
/>
|
|
26442
27285
|
),
|
|
26443
|
-
}
|
|
27286
|
+
}
|
|
27287
|
+
}
|
|
26444
27288
|
>
|
|
26445
27289
|
<ActionButton
|
|
26446
27290
|
iconStart={EllipseIcon}
|
|
@@ -27164,11 +28008,32 @@ secondaryActionAriaLabel?: string | ((key: Key) => string)
|
|
|
27164
28008
|
* @default "start"
|
|
27165
28009
|
*/
|
|
27166
28010
|
actionsPosition?: "start" | "end"
|
|
28011
|
+
/**
|
|
28012
|
+
* Overrides the accessible label of the button that expands a tree item to
|
|
28013
|
+
* reveal its children.
|
|
28014
|
+
*
|
|
28015
|
+
* Message id: \`bui.treeView.expand\`. Defaults to \`"Expand"\`.
|
|
28016
|
+
*/
|
|
28017
|
+
expandLabel?: string
|
|
28018
|
+
/**
|
|
28019
|
+
* Overrides the accessible label of the button that collapses a tree item
|
|
28020
|
+
* to hide its children.
|
|
28021
|
+
*
|
|
28022
|
+
* Message id: \`bui.treeView.collapse\`. Defaults to \`"Collapse"\`.
|
|
28023
|
+
*/
|
|
28024
|
+
collapseLabel?: string
|
|
27167
28025
|
/**
|
|
27168
28026
|
* The callback function that is called when the item is renamed. The rename
|
|
27169
28027
|
* functionality is disabled if not provided.
|
|
27170
28028
|
*/
|
|
27171
28029
|
onRename?: (options: { key: Key; value: string }) => void
|
|
28030
|
+
/**
|
|
28031
|
+
* Overrides the accessible label of the input shown while an item is being
|
|
28032
|
+
* renamed.
|
|
28033
|
+
*
|
|
28034
|
+
* Message id: \`bui.treeView.rename\`. Defaults to \`"Rename"\`.
|
|
28035
|
+
*/
|
|
28036
|
+
renameLabel?: string
|
|
27172
28037
|
/**
|
|
27173
28038
|
* The callback function that is called when the item is clicked.
|
|
27174
28039
|
*/
|
|
@@ -27386,6 +28251,27 @@ export function TreeViewWithPrimaryActionAtEnd({
|
|
|
27386
28251
|
);
|
|
27387
28252
|
}
|
|
27388
28253
|
|
|
28254
|
+
export function TreeViewWithSwappableLabels(): React.JSX.Element {
|
|
28255
|
+
const [swapped, setSwapped] = useState(false);
|
|
28256
|
+
const items = useMemo(() => getTreeItems({}), []);
|
|
28257
|
+
|
|
28258
|
+
return (
|
|
28259
|
+
<Box display="flex" flexDirection="column" gap="md">
|
|
28260
|
+
<ActionButton
|
|
28261
|
+
label="Swap labels"
|
|
28262
|
+
onPress={() => {
|
|
28263
|
+
setSwapped(true);
|
|
28264
|
+
}}
|
|
28265
|
+
/>
|
|
28266
|
+
<TreeView
|
|
28267
|
+
items={items}
|
|
28268
|
+
defaultExpandedKeys={["documents"]}
|
|
28269
|
+
expandLabel={swapped ? "Aufklappen" : "Expand"}
|
|
28270
|
+
/>
|
|
28271
|
+
</Box>
|
|
28272
|
+
);
|
|
28273
|
+
}
|
|
28274
|
+
|
|
27389
28275
|
export function TreeViewWithCustomTitle(): React.JSX.Element {
|
|
27390
28276
|
return (
|
|
27391
28277
|
<TreeView
|
|
@@ -27785,6 +28671,10 @@ style?: React.CSSProperties
|
|
|
27785
28671
|
/**
|
|
27786
28672
|
* The custom render function for the listbox options.
|
|
27787
28673
|
*
|
|
28674
|
+
* Replaces the option's entire contents, including the default selection
|
|
28675
|
+
* indicator \u2014 render your own affordance from \`options.isSelected\` if you
|
|
28676
|
+
* need one. Selection and keyboard behavior are unaffected.
|
|
28677
|
+
*
|
|
27788
28678
|
* Reading component state here works, at the cost of rebuilding every cached option and
|
|
27789
28679
|
* section whenever the function's identity changes \u2014 see {@link UNSAFE_ListBoxProps.items}
|
|
27790
28680
|
* for when that cost applies.
|
|
@@ -27797,7 +28687,7 @@ renderOption?: (
|
|
|
27797
28687
|
options: ListBoxItemRenderProps,
|
|
27798
28688
|
) => React.ReactNode
|
|
27799
28689
|
/**
|
|
27800
|
-
*
|
|
28690
|
+
* A CSS class name added to the option's built-in classes.
|
|
27801
28691
|
*
|
|
27802
28692
|
* Compared by identity, so an inline function or an unmemoized value rebuilds every
|
|
27803
28693
|
* cached option and section on each render. A plain string is compared by value.
|
|
@@ -28109,8 +28999,27 @@ export const ListBoxWithSectionsExample: React.FC<
|
|
|
28109
28999
|
export const DragAndDropListBoxExample: React.FC<
|
|
28110
29000
|
Omit<React.ComponentProps<typeof ListBox>, "items" | "onReorder"> & {
|
|
28111
29001
|
customPreview?: boolean;
|
|
29002
|
+
rerenderOnEvent?: boolean;
|
|
28112
29003
|
}
|
|
28113
|
-
> = ({ orientation, layout, customPreview, ...rest }) => {
|
|
29004
|
+
> = ({ orientation, layout, customPreview, rerenderOnEvent, ...rest }) => {
|
|
29005
|
+
const [, rerender] = React.useReducer((tick: number) => tick + 1, 0);
|
|
29006
|
+
|
|
29007
|
+
React.useEffect(() => {
|
|
29008
|
+
if (!rerenderOnEvent) {
|
|
29009
|
+
return;
|
|
29010
|
+
}
|
|
29011
|
+
|
|
29012
|
+
const onRerender = () => {
|
|
29013
|
+
rerender();
|
|
29014
|
+
};
|
|
29015
|
+
|
|
29016
|
+
window.addEventListener("repro:rerender", onRerender);
|
|
29017
|
+
|
|
29018
|
+
return () => {
|
|
29019
|
+
window.removeEventListener("repro:rerender", onRerender);
|
|
29020
|
+
};
|
|
29021
|
+
}, [rerenderOnEvent]);
|
|
29022
|
+
|
|
28114
29023
|
const list = useListData({
|
|
28115
29024
|
initialItems: Array.from({ length: 20 }).map((_, i) => ({
|
|
28116
29025
|
id: \`item-\${i}\`,
|
|
@@ -33837,13 +34746,19 @@ import type { IconSelectProps } from "../Select.types";
|
|
|
33837
34746
|
import type { Key } from "@react-types/shared";
|
|
33838
34747
|
|
|
33839
34748
|
export const SelectExample: React.FC<
|
|
33840
|
-
Omit<React.ComponentProps<typeof Select>, "items">
|
|
33841
|
-
|
|
34749
|
+
Omit<React.ComponentProps<typeof Select>, "items"> & {
|
|
34750
|
+
/** Playwright cannot serialize a function prop, so the callback form is built here. */
|
|
34751
|
+
useFunctionLabel?: boolean;
|
|
34752
|
+
}
|
|
34753
|
+
> = ({ useFunctionLabel, ...args }) => {
|
|
33842
34754
|
return (
|
|
33843
34755
|
<Select
|
|
33844
34756
|
placeholder="Choose an item"
|
|
33845
34757
|
optionClassName={(item) => item.label}
|
|
33846
34758
|
{...args}
|
|
34759
|
+
moreLabel={
|
|
34760
|
+
useFunctionLabel ? ({ count }) => \`\${count} others\` : args.moreLabel
|
|
34761
|
+
}
|
|
33847
34762
|
items={items}
|
|
33848
34763
|
/>
|
|
33849
34764
|
);
|
|
@@ -34178,7 +35093,7 @@ popoverContentProps?: Omit<PopoverContentProps, "children">
|
|
|
34178
35093
|
formatValue={(value: number) => \`\${value} pt\`}
|
|
34179
35094
|
aria-label="Icon slider"
|
|
34180
35095
|
onTriggerPress={fn()}
|
|
34181
|
-
isDisabled />;`}],implementation:""},similarTo:[],figmaUrl:null}};var
|
|
35096
|
+
isDisabled />;`}],implementation:""},similarTo:[],figmaUrl:null}};var o={gettingStarted:`# Getting started
|
|
34182
35097
|
|
|
34183
35098
|
Install the packages required for using Baseline UI with the following command:
|
|
34184
35099
|
|
|
@@ -34497,7 +35412,7 @@ Localization is the process of translating your website into different languages
|
|
|
34497
35412
|
|
|
34498
35413
|
Baseline UI automatically detects a user\u2019s preferred language from the browser, and it uses that language for all localization. It\u2019s possible to override the language used for localization by providing a \`locale\` prop to the \`I18nProvider\` component.
|
|
34499
35414
|
|
|
34500
|
-
See [\`useMessageFormatter\`](https://react-spectrum.adobe.com/react-aria/useMessageFormatter.html), [\`DateFormat\`](/?path=/docs/utilities-dateformat--docs), [\`NumberFormat\`](/?path=/docs/utilities-numberformat--docs), and [\`useCollator\`](https://react-spectrum.adobe.com/react-aria/useCollator.html) for more information about using our internationalization hooks.
|
|
35415
|
+
See [\`useMessageFormatter\`](https://react-spectrum.adobe.com/react-aria/useMessageFormatter.html), [\`DateFormat\`](/?path=/docs/core-utilities-dateformat--docs), [\`NumberFormat\`](/?path=/docs/core-utilities-numberformat--docs), and [\`useCollator\`](https://react-spectrum.adobe.com/react-aria/useCollator.html) for more information about using our internationalization hooks.
|
|
34501
35416
|
|
|
34502
35417
|
### Example
|
|
34503
35418
|
|
|
@@ -34517,7 +35432,7 @@ function YourApp() {
|
|
|
34517
35432
|
}
|
|
34518
35433
|
\`\`\`
|
|
34519
35434
|
|
|
34520
|
-
You can also override the language used for localization with the [\`I18nProvider\`](/?path=/docs/utilities-i18nprovider--docs) component:
|
|
35435
|
+
You can also override the language used for localization with the [\`I18nProvider\`](/?path=/docs/core-utilities-i18nprovider--docs) component:
|
|
34521
35436
|
|
|
34522
35437
|
\`\`\`jsx
|
|
34523
35438
|
import { I18nProvider } from "@baseline-ui/core";
|
|
@@ -34556,6 +35471,10 @@ so \`{ de }\` answers for \`de\`, \`de-DE\` and \`de-AT\` alike, and \`{ de, "de
|
|
|
34556
35471
|
TypeScript needs \`resolveJsonModule\` enabled to import the files, and Node ESM needs a
|
|
34557
35472
|
\`with { type: "json" }\` import attribute.
|
|
34558
35473
|
|
|
35474
|
+
Key each catalog with a BCP 47 locale ID. An underscored key (\`de_DE\`) is read as its
|
|
35475
|
+
hyphenated form, so both spellings resolve \u2014 but supplying the same locale under both is
|
|
35476
|
+
reported once, and the hyphenated entry wins.
|
|
35477
|
+
|
|
34559
35478
|
To avoid shipping every language up front, put each catalog behind a dynamic \`import()\`
|
|
34560
35479
|
and load one when the user picks a language. Write the specifiers out in full \u2014 a
|
|
34561
35480
|
template literal over a bare package subpath is not statically analyzable, so bundlers
|
|
@@ -34583,8 +35502,70 @@ ship it. Outside production, each such ID is reported once in the console.
|
|
|
34583
35502
|
If you supply catalogs but none of them matches the active locale \u2014 \`{ de }\` while the
|
|
34584
35503
|
locale is \`ja-JP\`, say \u2014 every string falls back to English and that is reported once for
|
|
34585
35504
|
the locale rather than once per ID. It means the catalog keys and the locale disagree,
|
|
34586
|
-
which no per-ID warning can tell you.
|
|
34587
|
-
English
|
|
35505
|
+
which no per-ID warning can tell you. It stays quiet when the active locale is itself
|
|
35506
|
+
English, since falling back to English is then the intended result. Supplying no catalogs
|
|
35507
|
+
at all is the supported English-only mode and stays silent.
|
|
35508
|
+
|
|
35509
|
+
Only \`bui.*\` IDs are reported. An app that routes its own strings through
|
|
35510
|
+
[\`useI18n\`](#your-own-strings) is missing no translation Baseline UI can tell it how to add.
|
|
35511
|
+
|
|
35512
|
+
### Controlling the warnings
|
|
35513
|
+
|
|
35514
|
+
The warnings above \u2014 the missing-ID, no-matching-catalog, duplicate-locale-key and
|
|
35515
|
+
[bare-ID deprecation](#migrating-from-bare-ids) ones \u2014 are development guidance, so they
|
|
35516
|
+
are off when \`process.env.NODE_ENV === "production"\`. That keeps a consumer who never
|
|
35517
|
+
touched \`messages\` from logging Baseline UI's internal IDs to their end users. Set
|
|
35518
|
+
\`shouldLogMissingMessages\` to force them either way:
|
|
35519
|
+
|
|
35520
|
+
\`\`\`jsx
|
|
35521
|
+
// Surface them in a production build \u2014 e.g. a staging deploy checking catalog coverage.
|
|
35522
|
+
<I18nProvider locale="de-DE" messages={messages} shouldLogMissingMessages>
|
|
35523
|
+
<YourApp />
|
|
35524
|
+
</I18nProvider>;
|
|
35525
|
+
|
|
35526
|
+
// Or silence them in development, while a catalog is still being filled in.
|
|
35527
|
+
<I18nProvider
|
|
35528
|
+
locale="de-DE"
|
|
35529
|
+
messages={messages}
|
|
35530
|
+
shouldLogMissingMessages={false}
|
|
35531
|
+
>
|
|
35532
|
+
<YourApp />
|
|
35533
|
+
</I18nProvider>;
|
|
35534
|
+
\`\`\`
|
|
35535
|
+
|
|
35536
|
+
Each distinct warning is logged once and reset when the locale changes, so switching
|
|
35537
|
+
languages re-reports what the new locale is missing.
|
|
35538
|
+
|
|
35539
|
+
### Your own strings
|
|
35540
|
+
|
|
35541
|
+
\`useI18n\` is the same hook the components use, so you can put your application's strings
|
|
35542
|
+
through it and get one formatter for both:
|
|
35543
|
+
|
|
35544
|
+
\`\`\`tsx
|
|
35545
|
+
import { defineMessages, useI18n } from "@baseline-ui/core";
|
|
35546
|
+
|
|
35547
|
+
const messages = defineMessages({
|
|
35548
|
+
greeting: {
|
|
35549
|
+
id: "myApp.greeting",
|
|
35550
|
+
defaultMessage: "Hello, {name}",
|
|
35551
|
+
description:
|
|
35552
|
+
"Greeting on the dashboard header. {name} is the user's first name.",
|
|
35553
|
+
},
|
|
35554
|
+
});
|
|
35555
|
+
|
|
35556
|
+
// Hoisted for the same reason as the catalogs above.
|
|
35557
|
+
const catalogs = { de: { "myApp.greeting": "Hallo, {name}" } };
|
|
35558
|
+
|
|
35559
|
+
function Header({ name }) {
|
|
35560
|
+
const { formatMessage } = useI18n(catalogs);
|
|
35561
|
+
|
|
35562
|
+
return <h1>{formatMessage(messages.greeting, { name })}</h1>;
|
|
35563
|
+
}
|
|
35564
|
+
\`\`\`
|
|
35565
|
+
|
|
35566
|
+
The catalogs you pass to \`useI18n\` are merged per locale with the ones on \`I18nProvider\`,
|
|
35567
|
+
and the provider wins on a shared key \u2014 so an application can hold its own strings locally
|
|
35568
|
+
while a host app still overrides any \`bui.*\` string from above.
|
|
34588
35569
|
|
|
34589
35570
|
### Supported locales
|
|
34590
35571
|
|
|
@@ -34602,8 +35583,10 @@ import { messageIds } from "@baseline-ui/core";
|
|
|
34602
35583
|
const uncovered = messageIds.filter((id) => !(id in ourCatalog.en));
|
|
34603
35584
|
\`\`\`
|
|
34604
35585
|
|
|
34605
|
-
|
|
34606
|
-
|
|
35586
|
+
Below is every ID with the English string it renders, and the prop that overrides it on a
|
|
35587
|
+
single component instance (see [Overriding one instance](#overriding-one-instance)). For
|
|
35588
|
+
the translator context that goes with each one, read \`@baseline-ui/core/messages.json\` \u2014
|
|
35589
|
+
the extracted source messages keyed by ID.
|
|
34607
35590
|
|
|
34608
35591
|
### Translating them yourself
|
|
34609
35592
|
|
|
@@ -34643,13 +35626,56 @@ import de from "@baseline-ui/core/intl/de.json";
|
|
|
34643
35626
|
</I18nProvider>;
|
|
34644
35627
|
\`\`\`
|
|
34645
35628
|
|
|
35629
|
+
### Overriding one instance
|
|
35630
|
+
|
|
35631
|
+
\`I18nProvider.messages\` changes a string everywhere it renders. To change it for one
|
|
35632
|
+
component instance \u2014 two galleries on the same page whose delete buttons should read
|
|
35633
|
+
differently \u2014 pass the override prop from the [Message IDs](#translations-list) table
|
|
35634
|
+
instead:
|
|
35635
|
+
|
|
35636
|
+
\`\`\`jsx
|
|
35637
|
+
<ImageGallery deleteLabel="Remove page" />
|
|
35638
|
+
<ImageGallery deleteLabel="Remove signature" />
|
|
35639
|
+
\`\`\`
|
|
35640
|
+
|
|
35641
|
+
A prop wins over an \`I18nProvider\` catalog entry for the same ID, which in turn wins over
|
|
35642
|
+
the built-in English default. For most props an empty string is a real override:
|
|
35643
|
+
\`closeLabel=""\` renders an empty label rather than falling back to \`"Close"\`.
|
|
35644
|
+
|
|
35645
|
+
The props that pre-date this feature keep their existing behaviour and treat \`""\` as
|
|
35646
|
+
unset: \`aria-label\` on \`Pagination\` and \`Stepper\`, \`Pagination\`'s \`incrementAriaLabel\` and
|
|
35647
|
+
\`decrementAriaLabel\`, \`ButtonSelect\`'s \`moreAriaLabel\`, \`ColorInput\`'s
|
|
35648
|
+
\`addColorButtonLabel\`, \`removeColorButtonLabel\` and \`customColorsLabel\`, \`Editor\`'s
|
|
35649
|
+
\`submitButtonAriaLabel\` and \`cancelButtonAriaLabel\`, \`FreehandCanvas\`'s \`undoLabel\` and
|
|
35650
|
+
\`redoLabel\`, and \`ImageDropZone\`'s \`pickerButtonLabel\`.
|
|
35651
|
+
|
|
35652
|
+
Five IDs interpolate a value \u2014 \`bui.fileList.loading\`, \`bui.fileList.removeHint\`,
|
|
35653
|
+
\`bui.pagination.pageXofY\`, \`bui.select.more\`, and \`bui.stepper.step\`. Their props accept
|
|
35654
|
+
either form:
|
|
35655
|
+
|
|
35656
|
+
\`\`\`jsx
|
|
35657
|
+
{
|
|
35658
|
+
/* A string renders verbatim \u2014 placeholders are not substituted. */
|
|
35659
|
+
}
|
|
35660
|
+
<Stepper stepLabel="Current stage" />;
|
|
35661
|
+
|
|
35662
|
+
{
|
|
35663
|
+
/* A function receives the values and returns the finished string. */
|
|
35664
|
+
}
|
|
35665
|
+
<Stepper stepLabel={({ index }) => \`Phase \${index}\`} />;
|
|
35666
|
+
\`\`\`
|
|
35667
|
+
|
|
35668
|
+
The props only cover Baseline UI's own \`bui.*\` strings. Strings that come from the
|
|
35669
|
+
underlying accessibility layer \u2014 drag-and-drop announcements, calendar cell descriptions \u2014
|
|
35670
|
+
are not overridable this way.
|
|
35671
|
+
|
|
34646
35672
|
Each component's documentation lists its overridable keys and shows an example. See:
|
|
34647
35673
|
|
|
34648
|
-
* [Pagination](?path=/docs/
|
|
34649
|
-
* [ColorInput](?path=/docs/
|
|
34650
|
-
* [ImageDropZone](?path=/docs/
|
|
34651
|
-
* [FreehandCanvas](?path=/docs/
|
|
34652
|
-
* [InlineAlert](?path=/docs/
|
|
35674
|
+
* [Pagination](?path=/docs/core-forms-pagination--docs#translations)
|
|
35675
|
+
* [ColorInput](?path=/docs/core-forms-colorinput--docs#translations)
|
|
35676
|
+
* [ImageDropZone](?path=/docs/core-forms-imagedropzone--docs#translations)
|
|
35677
|
+
* [FreehandCanvas](?path=/docs/core-miscellaneous-freehandcanvas--docs#translations)
|
|
35678
|
+
* [InlineAlert](?path=/docs/core-status-inlinealert--docs#translations)
|
|
34653
35679
|
|
|
34654
35680
|
### Migrating from bare IDs
|
|
34655
35681
|
|
|
@@ -35595,7 +36621,7 @@ padding={[null, "lg", "xl"]}
|
|
|
35595
36621
|
|
|
35596
36622
|
* [vanilla-extract sprinkles documentation](https://vanilla-extract.style/documentation/packages/sprinkles/) - Learn about the underlying sprinkles framework
|
|
35597
36623
|
* [Box component documentation](/docs/core-utilities-box--docs) - Detailed information about the Box component
|
|
35598
|
-
* [Theme documentation](/docs/theming--docs) - Learn about Baseline UI's theming system`};var c={"8":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","ChevronRightFilledIcon","ChevronRightIcon","EllipseIcon","MinusIcon","PlusIcon","XIcon"],"12":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","EditIcon","EllipseIcon","EnterKeyIcon","LockFilledIcon","LockIcon","MinusIcon","MoreVIcon","MoreIcon","PlaceholderIcon","PlusIcon","SearchIcon","SizeIcon","TrashIcon","XIcon","ZoomIcon"],"16":["AlignBottomIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDiagonalTopLeftBottomRightIcon","ArrowDownCircleFilledIcon","ArrowDownIcon","ArrowIcon","ArrowLeftRightIcon","ArrowRightIcon","ArrowUpArrowDownIcon","ArrowUpIcon","AtIcon","AttachmentsIcon","AvatarIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BulletListIcon","CalendarIcon","CaretLeftIcon","CaretRightIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","CircleFilledIcon","ClockIcon","CopyIcon","CustomizeIcon","DocumentEditIcon","DownloadIcon","DuplicateIcon","EditIcon","ElipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FilterAltIcon","FolderIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FullScreenIcon","HelpCircleIcon","HelpIcon","HereIcon","HideIcon","HighlightTextAltIcon","HighlightTextIcon","HorizontalScrollIcon","ImageIcon","InfoCircleFilledIcon","InsertIcon","ItalicIcon","LightBulbIcon","LineIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MeasureIcon","MinusIcon","MoreIcon","MoreVerticalIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","NumberedListIcon","OpenIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageVerticalScrollIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PlaceholderIcon","PlayIcon","PlusIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","ReadOnlyIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedoIcon","RemoveFormattingIcon","ReorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RulerIcon","SearchIcon","SettingsIcon","ShowIcon","SlashCommandsIcon","SoundRecordIcon","StampIcon","StarFilledIcon","StarIcon","StrikeoutTextAltIcon","TableCellIcon","TableColumnIcon","TableHeaderIcon","TableIcon","TableRowIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextDecreaseIndentIcon","TextIcon","TextIncreaseIndentIcon","TextMarkIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UndoIcon","UnlockIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WindowedIcon","WorkflowIcon","XCircleFilledIcon","XIcon"],"20":["AddPageIcon","AnonymousIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpCircleFilledIcon","AtIcon","AvatarFilledIcon","BoldIcon","CalloutIcon","CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ClockIcon","CollapseIcon","CommentIcon","CopyIcon","CutIcon","DistanceIcon","DownloadIcon","DuplicateIcon","EditIcon","EllipseIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorAlternativeCircleIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FormDateIcon","FormSignatureIcon","FormTextFieldIcon","HelpCircleIcon","HighlightTextIcon","HomeIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","ItalicIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MinusIcon","MoreIcon","MoreVerticalIcon","MoveIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OpenIcon","PageMoveLeftIcon","PageMoveRightIcon","PagesInsertIcon","PasteIcon","PipetteIcon","PlusIcon","PrintIcon","RotateClockwiseIcon","SearchIcon","SettingsIcon","ShapeIcon","ShareIcon","SoundIcon","SoundRecordIcon","StarFilledIcon","StarIcon","StyleIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UploadIcon","WarningFilledIcon","WarningIcon","XCircleFilledIcon","XCircleIcon","XIcon"],"24":["AddNoteCloudIcon","AddNoteIcon","AddTextSerifIcon","AiIcon","AirplaneIcon","AlignBottomIcon","AlignHorizontalCenterIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDownIcon","ArrowIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpIcon","AtIcon","AttachmentIcon","AvatarFilledIcon","AvatarIcon","BlendModeIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BorderColorIcon","BottomBorderIcon","BulletListIcon","CalibrateIcon","CaptureAddIcon","CaretDownIcon","CaretIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ChevronListIcon","ClockIcon","CloudyBorderIcon","CollapseIcon","ColorPaletteIcon","ColorSwatchIcon","CommentIcon","CommentInSidebarIcon","CommentOnPageIcon","CompareDocumentsIcon","CopyIcon","CopyPageIcon","CropIcon","CustomizeIcon","CutIcon","DateModifiedIcon","DatePlusIcon","DebugIcon","DocumentArrowDownCircleIcon","DocumentArrowDownIcon","DocumentArrowRightIcon","DocumentFilledIcon","DocumentLockIcon","DocumentPdfIcon","DownloadIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","DuplicateIcon","EditAnnotationsIcon","EditContentIcon","EditDocumentIcon","EditIcon","EditThumbnailsIcon","EllipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","EndCapArrowFilledIcon","EndCapArrowIcon","EndCapChevronFilledIcon","EndCapChevronIcon","EndCapCircleIcon","EndCapDiamondIcon","EndCapNoneIcon","EndCapSlantedIcon","EndCapSquareIcon","EndCapStraightIcon","EraserIcon","ErrorAltCircleFilledIcon","ErrorAltIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","ExpandVerticalIcon","FillColorIcon","FilterIcon","FitToHeightIcon","FivePagesHorizontalFilledIcon","FivePagesVerticalFilledIcon","FolderAddIcon","FolderIcon","FontListIcon","FontSizeIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormPageIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FormTwoRadioButtonsIcon","FourPagesGridFilledIcon","FourPagesHorizontalFilledIcon","FourPagesStackedFilledIcon","FourPagesVerticalFilledIcon","GroupIcon","HamburgerMenuIcon","HandIcon","HeartIcon","HideIcon","HideRevealIcon","HighlightTextIcon","HomeIcon","HorizontalScollIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","InitialsIcon","InnerHorizontalBorderIcon","InnerVerticalBorderIcon","InsertIcon","ItalicIcon","LayerBottomIcon","LayerDownIcon","LayerTopIcon","LayerUpIcon","LayersIcon","LeftBindingIcon","LeftBorderIcon","LineCapsIcon","LineIcon","LineSpacingIcon","LineStyleCloudyIcon","LineStyleDashedDoubleDashIcon","LineStyleDashedDoubleGapIcon","LineStyleDashedQuadrupleDashIcon","LineStyleDashedSingleGapIcon","LineStyleIcon","LineStyleSolidIcon","LineWidthIcon","LinkIcon","LockFilledIcon","LockIcon","MagicIcon","MagicPenIcon","MailIcon","MarkupIcon","MarqueeZoomIcon","MeasureIcon","MergeIcon","MessageCloudIcon","MinusIcon","MoonIcon","MoreCircleIcon","MoreIcon","MoreVerticalIcon","MoveAllDirectionsIcon","MoveLeftIcon","MoveLeftRightIcon","MoveRightIcon","MultiplePagesIcon","NonEditableIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OcrIcon","OpacityIcon","PageAddIcon","PageCurlIcon","PageDuplicateIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLandscapeIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageMoveLeftIcon","PageMoveRightIcon","PageNumberCircleIcon","PageNumberIcon","PagePortraitIcon","PageRemoveIcon","PageVerticalScrollIcon","PagesInsertAltIcon","PagesInsertIcon","PagesNewFromSelectionAltIcon","PagesNewFromSelectionIcon","PagesSelectAllIcon","PagesSelectNoneIcon","PasteBoardIcon","PastePageIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PinDropFilledIcon","PinDropIcon","PipetteIcon","PlayIcon","PlusCircleFilledIcon","PlusCircleIcon","PlusIcon","PointerIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","PrecisionIcon","PrintIcon","PrivateModeIcon","PushPinIcon","QuestionmarkCircleIcon","ReaderViewIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedactIcon","RedactRectangleIcon","RedactTextHighlighterIcon","RedactionTextRepeatingIcon","RedactionTextSingleIcon","RedoAllIcon","RedoIcon","RegexIcon","ReplaceIcon","RightBindingIcon","RightBorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RotateObjectClockwiseIcon","RotateObjectCounterClockwiseIcon","RulerIcon","ScaleIcon","SearchCircleIcon","SearchIcon","SearchSelectionIcon","SelectAllIcon","SelectionToolIcon","SettingsIcon","ShapesIcon","ShareAltIcon","ShareIcon","ShieldAddIcon","ShieldCheckmarkIcon","ShieldWarningIcon","ShieldXIcon","ShowIcon","SidebarIcon","SignOutIcon","SignatureDigitalIcon","SignatureIcon","SinglePageFilledIcon","SoundIcon","SquigglyTextIcon","StampAddIcon","StampIcon","StarFilledIcon","StarIcon","StartCapArrowFilledIcon","StartCapArrowIcon","StartCapChevronFilledIcon","StartCapChevronIcon","StartCapCircleIcon","StartCapDiamondIcon","StartCapNoneIcon","StartCapSlantedIcon","StartCapSquareIcon","StartCapStraightIcon","StrikeoutTextIcon","StyleFilledIcon","StyleIcon","StylusFilledIcon","StylusIcon","SunIcon","TableCellIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextColorIcon","TextIcon","TextPropertiesHideIcon","TextPropertiesShowIcon","TextSerifIcon","TextSmallerIcon","ThreePagesHorizontalFilledIcon","ThreePagesStackedFilledIcon","ThreePagesVerticalFilledIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TopBorderIcon","TrashIcon","TwoPagesHorizontalFilledIcon","TwoPagesVerticalFilledIcon","TypeTextIcon","UnderlineIcon","UnderlineTextIcon","UndoAllIcon","UndoIcon","UndoRedoIcon","UngroupIcon","UnlockIcon","UploadIcon","UserIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WidgetIcon","WorkflowIcon","XCircleFilledIcon","XCircleIcon","XIcon","ZoomInIcon","ZoomOutIcon"],"36":["ArrowRight","Check","Circle","Cross","Help","Inset","Key","NewParagraphAlt","NewParagraph","Note","PointerRight","SpeechBubble","Star"]};var p={version:"2.0.0"};var u=`
|
|
36624
|
+
* [Theme documentation](/docs/theming--docs) - Learn about Baseline UI's theming system`};var c={"8":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","ChevronRightFilledIcon","ChevronRightIcon","EllipseIcon","MinusIcon","PlusIcon","XIcon"],"12":["CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","EditIcon","EllipseIcon","EnterKeyIcon","LockFilledIcon","LockIcon","MinusIcon","MoreVIcon","MoreIcon","PlaceholderIcon","PlusIcon","SearchIcon","SizeIcon","TrashIcon","XIcon","ZoomIcon"],"16":["AlignBottomIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDiagonalTopLeftBottomRightIcon","ArrowDownCircleFilledIcon","ArrowDownIcon","ArrowIcon","ArrowLeftRightIcon","ArrowRightIcon","ArrowUpArrowDownIcon","ArrowUpIcon","AtIcon","AttachmentsIcon","AvatarIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BulletListIcon","CalendarIcon","CaretLeftIcon","CaretRightIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","CircleFilledIcon","ClockIcon","CopyIcon","CustomizeIcon","DocumentEditIcon","DownloadIcon","DuplicateIcon","EditIcon","ElipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FilterAltIcon","FolderIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FullScreenIcon","HelpCircleIcon","HelpIcon","HereIcon","HideIcon","HighlightTextAltIcon","HighlightTextIcon","HorizontalScrollIcon","ImageIcon","InfoCircleFilledIcon","InsertIcon","ItalicIcon","LightBulbIcon","LineIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MeasureIcon","MinusIcon","MoreIcon","MoreVerticalIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","NumberedListIcon","OpenIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageVerticalScrollIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PlaceholderIcon","PlayIcon","PlusIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","ReadOnlyIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedoIcon","RemoveFormattingIcon","ReorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RulerIcon","SearchIcon","SettingsIcon","ShowIcon","SlashCommandsIcon","SoundRecordIcon","StampIcon","StarFilledIcon","StarIcon","StrikeoutTextAltIcon","TableCellIcon","TableColumnIcon","TableHeaderIcon","TableIcon","TableRowIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextDecreaseIndentIcon","TextIcon","TextIncreaseIndentIcon","TextMarkIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UndoIcon","UnlockIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WindowedIcon","WorkflowIcon","XCircleFilledIcon","XIcon"],"20":["AddPageIcon","AnonymousIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpCircleFilledIcon","AtIcon","AvatarFilledIcon","BoldIcon","CalloutIcon","CaretDownIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ClockIcon","CollapseIcon","CommentIcon","CopyIcon","CutIcon","DistanceIcon","DownloadIcon","DuplicateIcon","EditIcon","EllipseIcon","EmojiSmileIcon","ErrorAltCircleFilledIcon","ErrorAlternativeCircleIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","FormDateIcon","FormSignatureIcon","FormTextFieldIcon","HelpCircleIcon","HighlightTextIcon","HomeIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","ItalicIcon","LinkIcon","ListIcon","LockIcon","MagicIcon","MinusIcon","MoreIcon","MoreVerticalIcon","MoveIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCrossIcon","NoteHelpIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OpenIcon","PageMoveLeftIcon","PageMoveRightIcon","PagesInsertIcon","PasteIcon","PipetteIcon","PlusIcon","PrintIcon","RotateClockwiseIcon","SearchIcon","SettingsIcon","ShapeIcon","ShareIcon","SoundIcon","SoundRecordIcon","StarFilledIcon","StarIcon","StyleIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TrashIcon","TypeTextIcon","UnderlineIcon","UploadIcon","WarningFilledIcon","WarningIcon","XCircleFilledIcon","XCircleIcon","XIcon"],"24":["AddNoteCloudIcon","AddNoteIcon","AddTextSerifIcon","AiIcon","AirplaneIcon","AlignBottomIcon","AlignHorizontalCenterIcon","AlignMiddleIcon","AlignTopIcon","AnonymousIcon","ArrowDownIcon","ArrowIcon","ArrowLeftIcon","ArrowRightIcon","ArrowUpIcon","AtIcon","AttachmentIcon","AvatarFilledIcon","AvatarIcon","BlendModeIcon","BoldIcon","BookmarkFilledIcon","BookmarkIcon","BorderColorIcon","BottomBorderIcon","BulletListIcon","CalibrateIcon","CaptureAddIcon","CaretDownIcon","CaretIcon","CaretLeftIcon","CaretRightIcon","CaretUpIcon","CheckmarkCircleFilledIcon","CheckmarkCircleIcon","CheckmarkIcon","ChevronListIcon","ClockIcon","CloudyBorderIcon","CollapseIcon","ColorPaletteIcon","ColorSwatchIcon","CommentIcon","CommentInSidebarIcon","CommentOnPageIcon","CompareDocumentsIcon","CopyIcon","CopyPageIcon","CropIcon","CustomizeIcon","CutIcon","DateModifiedIcon","DatePlusIcon","DebugIcon","DocumentArrowDownCircleIcon","DocumentArrowDownIcon","DocumentArrowRightIcon","DocumentFilledIcon","DocumentLockIcon","DocumentPdfIcon","DownloadIcon","DragIndicatorIcon","DragIndicatorVerticalIcon","DuplicateIcon","EditAnnotationsIcon","EditContentIcon","EditDocumentIcon","EditIcon","EditThumbnailsIcon","EllipseAreaIcon","EllipseCloudyIcon","EllipseDashedIcon","EllipseIcon","EmbedIcon","EmojiSmileIcon","EndCapArrowFilledIcon","EndCapArrowIcon","EndCapChevronFilledIcon","EndCapChevronIcon","EndCapCircleIcon","EndCapDiamondIcon","EndCapNoneIcon","EndCapSlantedIcon","EndCapSquareIcon","EndCapStraightIcon","EraserIcon","ErrorAltCircleFilledIcon","ErrorAltIcon","ErrorCircleFilledIcon","ErrorCircleIcon","ExpandIcon","ExpandVerticalIcon","FillColorIcon","FilterIcon","FitToHeightIcon","FivePagesHorizontalFilledIcon","FivePagesVerticalFilledIcon","FolderAddIcon","FolderIcon","FontListIcon","FontSizeIcon","FormButtonIcon","FormChoiceIcon","FormComboboxIcon","FormDateIcon","FormListboxIcon","FormPageIcon","FormRadioButtonIcon","FormSignatureIcon","FormTextFieldIcon","FormTwoRadioButtonsIcon","FourPagesGridFilledIcon","FourPagesHorizontalFilledIcon","FourPagesStackedFilledIcon","FourPagesVerticalFilledIcon","GroupIcon","HamburgerMenuIcon","HandIcon","HeartIcon","HideIcon","HideRevealIcon","HighlightTextIcon","HomeIcon","HorizontalScollIcon","ImageIcon","InfoCircleFilledIcon","InfoCircleIcon","InitialsIcon","InnerHorizontalBorderIcon","InnerVerticalBorderIcon","InsertIcon","ItalicIcon","LayerBottomIcon","LayerDownIcon","LayerTopIcon","LayerUpIcon","LayersIcon","LeftBindingIcon","LeftBorderIcon","LineCapsIcon","LineIcon","LineSpacingIcon","LineStyleCloudyIcon","LineStyleDashedDoubleDashIcon","LineStyleDashedDoubleGapIcon","LineStyleDashedQuadrupleDashIcon","LineStyleDashedSingleGapIcon","LineStyleIcon","LineStyleSolidIcon","LineWidthIcon","LinkIcon","LockFilledIcon","LockIcon","MagicIcon","MagicPenIcon","MailIcon","MarkupIcon","MarqueeZoomIcon","MeasureIcon","MergeIcon","MessageCloudIcon","MinusIcon","MoonIcon","MoreCircleIcon","MoreIcon","MoreVerticalIcon","MoveAllDirectionsIcon","MoveLeftIcon","MoveLeftRightIcon","MoveRightIcon","MultiplePagesIcon","NonEditableIcon","NoteArrowRightIcon","NoteCheckIcon","NoteCircleIcon","NoteCloudIcon","NoteCrossIcon","NoteHelpIcon","NoteIcon","NoteInsetIcon","NoteKeyIcon","NoteNewParagraphAltIcon","NoteNewParagraphIcon","NoteNoteIcon","NotePointerRightIcon","NoteSpeechBubbleIcon","NoteStarIcon","OcrIcon","OpacityIcon","PageAddIcon","PageCurlIcon","PageDuplicateIcon","PageFittingFillIcon","PageFittingFitIcon","PageHorizontalScrollIcon","PageLandscapeIcon","PageLayoutDoubleIcon","PageLayoutSingleIcon","PageMoveLeftIcon","PageMoveRightIcon","PageNumberCircleIcon","PageNumberIcon","PagePortraitIcon","PageRemoveIcon","PageVerticalScrollIcon","PagesInsertAltIcon","PagesInsertIcon","PagesNewFromSelectionAltIcon","PagesNewFromSelectionIcon","PagesSelectAllIcon","PagesSelectNoneIcon","PasteBoardIcon","PastePageIcon","PauseIcon","PenHighlighterIcon","PenIcon","PerimeterIcon","PinDropFilledIcon","PinDropIcon","PipetteIcon","PlayIcon","PlusCircleFilledIcon","PlusCircleIcon","PlusIcon","PointerIcon","PolygonAreaIcon","PolygonCloudyIcon","PolygonDashedIcon","PolygonIcon","PolylineIcon","PrecisionIcon","PrintIcon","PrivateModeIcon","PushPinIcon","QuestionmarkCircleIcon","ReaderViewIcon","RectangleAreaIcon","RectangleCloudyIcon","RectangleDashedIcon","RectangleIcon","RedactIcon","RedactRectangleIcon","RedactTextHighlighterIcon","RedactionTextRepeatingIcon","RedactionTextSingleIcon","RedoAllIcon","RedoIcon","RegexIcon","ReplaceIcon","RightBindingIcon","RightBorderIcon","RotateClockwiseIcon","RotateCounterClockwiseIcon","RotateObjectClockwiseIcon","RotateObjectCounterClockwiseIcon","RulerIcon","ScaleIcon","SearchCircleIcon","SearchIcon","SearchSelectionIcon","SelectAllIcon","SelectionToolIcon","SettingsIcon","ShapesIcon","ShareAltIcon","ShareIcon","ShieldAddIcon","ShieldCheckmarkIcon","ShieldWarningIcon","ShieldXIcon","ShowIcon","SidebarIcon","SignOutIcon","SignatureDigitalIcon","SignatureIcon","SinglePageFilledIcon","SoundIcon","SquigglyTextIcon","StampAddIcon","StampIcon","StarFilledIcon","StarIcon","StartCapArrowFilledIcon","StartCapArrowIcon","StartCapChevronFilledIcon","StartCapChevronIcon","StartCapCircleIcon","StartCapDiamondIcon","StartCapNoneIcon","StartCapSlantedIcon","StartCapSquareIcon","StartCapStraightIcon","StrikeoutTextIcon","StyleFilledIcon","StyleIcon","StylusFilledIcon","StylusIcon","SunIcon","TableCellIcon","TextAlignCenterIcon","TextAlignJustifyIcon","TextAlignLeftIcon","TextAlignRightIcon","TextCalloutIcon","TextColorIcon","TextIcon","TextPropertiesHideIcon","TextPropertiesShowIcon","TextSerifIcon","TextSmallerIcon","ThreePagesHorizontalFilledIcon","ThreePagesStackedFilledIcon","ThreePagesVerticalFilledIcon","ThumbnailsIcon","ThumbsDownIcon","ThumbsUpIcon","TopBorderIcon","TrashIcon","TwoPagesHorizontalFilledIcon","TwoPagesVerticalFilledIcon","TypeTextIcon","UnderlineIcon","UnderlineTextIcon","UndoAllIcon","UndoIcon","UndoRedoIcon","UngroupIcon","UnlockIcon","UploadIcon","UserIcon","VerticalScrollIcon","VideoIcon","WarningFilledIcon","WarningIcon","WidgetIcon","WorkflowIcon","XCircleFilledIcon","XCircleIcon","XIcon","ZoomInIcon","ZoomOutIcon"],"36":["ArrowRight","Check","Circle","Cross","Help","Inset","Key","NewParagraphAlt","NewParagraph","Note","PointerRight","SpeechBubble","Star"]};var p={version:"2.2.0"};var u=`
|
|
35599
36625
|
# Baseline UI MCP Server Guidelines
|
|
35600
36626
|
|
|
35601
36627
|
This MCP server provides AI assistants with structured access to Baseline UI's comprehensive component documentation, icon library, theming resources, and design guidelines.
|
|
@@ -35750,13 +36776,14 @@ Use this tool to:
|
|
|
35750
36776
|
- Consult **list_components** to find the right component for your needs
|
|
35751
36777
|
- Reference **theming** for custom design systems
|
|
35752
36778
|
- Check **styling** for CSS and design token guidance
|
|
35753
|
-
`;var
|
|
36779
|
+
`;var C=`# List of available components in Baseline UI design system
|
|
35754
36780
|
| Name | Description | Similar To |
|
|
35755
36781
|
| --- | --- | --- |
|
|
35756
|
-
${Object.entries(
|
|
36782
|
+
${Object.entries(t).toSorted(([n],[e])=>n.localeCompare(e)).map(([n,{description:e,similarTo:i}])=>`|${n}|${e}|${i?.join(", ")||""}|`).join(`
|
|
35757
36783
|
`)}
|
|
35758
|
-
`,
|
|
36784
|
+
`,T=Object.entries(c).map(([n,e])=>`${n}
|
|
35759
36785
|
|
|
35760
|
-
${
|
|
36786
|
+
${e.map(i=>"- "+i).join(`
|
|
35761
36787
|
`)}`).join(`
|
|
35762
|
-
`);
|
|
36788
|
+
`);function z(){let n=new mcp_js.McpServer({name:"baseline-ui",version:p.version});return n.registerResource("list_components","resource://baseline-ui/list_components.md",{description:a,mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:C}]})),n.registerResource("list_icons","resource://baseline-ui/list_icons.md",{description:r,mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:T}]})),n.registerResource("getting_started","resource://baseline-ui/getting_started.md",{description:"Quick start guide for integrating Baseline UI into new projects",mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:o.gettingStarted}]})),n.registerResource("nutrient_web_viewer_theming","resource://baseline-ui/nutrient_web_viewer_theming.md",{description:"Specialized theming guide for customizing Baseline UI in Nutrient Web Viewer. This is not applicable if you are not theming the Nutrient Web Viewer SDK.",mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:o.nutrientWebViewerTheming}]})),n.registerResource("theming","resource://baseline-ui/theming.md",{description:"Comprehensive guide for implementing custom themes and color schemes in Baseline UI",mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:o.theming}]})),n.registerResource("internationalization","resource://baseline-ui/internationalization.md",{description:"Guide for implementing multi-language support and localization in Baseline UI",mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:o.internationalization}]})),n.registerResource("styling","resource://baseline-ui/styling.md",{description:l,mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:o.styling}]})),n.registerResource("guidelines","resource://baseline-ui/guidelines.md",{description:s,mimeType:"text/markdown"},e=>({contents:[{uri:e.href,mimeType:"text/markdown",text:u}]})),n.registerTool("get_component_info",{title:"Get component info",description:m,inputSchema:{componentName:zod.z.enum(Object.keys(t))}},({componentName:e})=>({content:[{type:"text",text:JSON.stringify(Object.fromEntries(Object.entries(t[e]).filter(([i])=>!["description","similarTo","figmaUrl"].includes(i))),null,2)}]})),n.registerTool("get_story_url",{title:"Get story demo URL",description:h,inputSchema:{storyId:zod.z.string()}},({storyId:e})=>({content:[{type:"text",text:`https://nutrient.io/baseline-ui/iframe.html?id=${e}`}]})),n.registerTool("get_figma_url",{title:"Get Figma URL",description:b,inputSchema:{componentName:zod.z.enum(Object.keys(t))}},({componentName:e})=>({content:[{type:"text",text:t[e].figmaUrl}]})),n.registerTool("list_available_resources",{title:"List Available Resources",description:g,inputSchema:{}},()=>({content:[{type:"text",text:JSON.stringify([{name:"list_components",uri:"resource://baseline-ui/list_components.md",description:a,mimeType:"text/markdown"},{name:"list_icons",uri:"resource://baseline-ui/list_icons.md",description:r,mimeType:"text/markdown"},{name:"getting_started",uri:"resource://baseline-ui/getting_started.md",description:"Quick start guide for integrating Baseline UI into new projects",mimeType:"text/markdown"},{name:"nutrient_web_viewer_theming",uri:"resource://baseline-ui/nutrient_web_viewer_theming.md",description:"Specialized theming guide for customizing Baseline UI in Nutrient Web Viewer. This is not applicable if you are not theming the Nutrient Web Viewer SDK.",mimeType:"text/markdown"},{name:"theming",uri:"resource://baseline-ui/theming.md",description:"Comprehensive guide for implementing custom themes and color schemes in Baseline UI",mimeType:"text/markdown"},{name:"internationalization",uri:"resource://baseline-ui/internationalization.md",description:"Guide for implementing multi-language support and localization in Baseline UI",mimeType:"text/markdown"},{name:"styling",uri:"resource://baseline-ui/styling.md",description:l,mimeType:"text/markdown"},{name:"guidelines",uri:"resource://baseline-ui/guidelines.md",description:s,mimeType:"text/markdown"}],null,2)}]})),n}
|
|
36789
|
+
exports.createServer=z;
|