@astryxdesign/core 0.7.2-canary.fe2c655 → 0.7.2
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 +156 -2
- package/README.md +4 -4
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +40 -1
- package/dist/AspectRatio/AspectRatio.d.ts +6 -8
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +44 -3
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +8 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +4 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +5 -2
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +1 -0
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +3 -1
- package/dist/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +6 -2
- package/dist/CheckboxList/CheckboxListItem.d.ts +9 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +4 -2
- package/dist/CommandPalette/CommandPaletteInput.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteInput.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteInput.js +37 -5
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +5 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +20 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +84 -113
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +17 -0
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +21 -0
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts +5 -3
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuDivider.js +7 -3
- package/dist/DropdownMenu/DropdownMenuGroup.d.ts +6 -4
- package/dist/DropdownMenu/DropdownMenuGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuGroup.js +4 -3
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +15 -4
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +24 -0
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -0
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +46 -0
- package/dist/DropdownMenu/menuRegionStops.d.ts +38 -0
- package/dist/DropdownMenu/menuRegionStops.d.ts.map +1 -0
- package/dist/DropdownMenu/menuRegionStops.js +131 -0
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +4 -10
- package/dist/Field/Field.d.ts +1 -1
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +8 -4
- package/dist/FormLayout/FormLayout.d.ts +5 -4
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +1 -1
- package/dist/FormLayout/FormLayoutContext.d.ts +3 -3
- package/dist/FormLayout/FormLayoutContext.js +3 -3
- package/dist/Grid/Grid.d.ts +8 -7
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +5 -4
- package/dist/Grid/GridSpan.d.ts +1 -1
- package/dist/Grid/GridSpan.d.ts.map +1 -1
- package/dist/Grid/GridSpan.js +1 -0
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +4 -2
- package/dist/Item/Item.d.ts +6 -2
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +19 -4
- package/dist/List/List.d.ts +46 -19
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +28 -10
- package/dist/List/ListContext.d.ts +8 -3
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +7 -2
- package/dist/List/ListItem.d.ts +13 -5
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +21 -8
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.d.ts.map +1 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +8 -1
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +8 -2
- package/dist/Markdown/plugins/headingLinks.d.ts.map +1 -1
- package/dist/Markdown/plugins/headingLinks.js +9 -1
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +5 -1
- package/dist/MetadataList/MetadataListContext.d.ts +1 -1
- package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.d.ts +9 -0
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +30 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +5 -0
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +45 -11
- package/dist/RadioList/RadioList.d.ts +1 -1
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +6 -2
- package/dist/RadioList/RadioListItem.d.ts +9 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +2 -0
- package/dist/SideNav/SideNavItem.d.ts +8 -1
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +76 -10
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +4 -2
- package/dist/ToggleButton/ToggleButton.d.ts +3 -2
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +12 -1
- package/dist/Token/Token.js +1 -1
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +5 -3
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +5 -3
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +1 -0
- package/dist/TreeList/TreeListBranches.d.ts.map +1 -1
- package/dist/TreeList/TreeListBranches.js +2 -2
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +57 -9
- package/dist/astryx.css +27 -4
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +18 -13
- package/dist/reset.a11y.chromium.spec.js +50 -1
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +15 -9
- package/docs.mjs +4 -4
- package/package.json +4 -4
- package/scripts/agent-doc-state.mjs +66 -6
- package/scripts/postinstall.mjs +44 -3
- package/src/AppShell/AppShell.tsx +45 -1
- package/src/AspectRatio/AspectRatio.test.tsx +44 -43
- package/src/AspectRatio/AspectRatio.tsx +38 -18
- package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +157 -0
- package/src/Avatar/Avatar.doc.mjs +5 -3
- package/src/Avatar/Avatar.tsx +11 -2
- package/src/AvatarGroup/AvatarGroup.doc.mjs +3 -2
- package/src/AvatarGroup/AvatarGroupOverflow.test.tsx +24 -1
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +2 -0
- package/src/Breadcrumbs/BreadcrumbItem.tsx +4 -1
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +30 -1
- package/src/Card/Card.doc.mjs +1 -1
- package/src/Chat/ChatLayoutScrollButton.test.tsx +13 -0
- package/src/Chat/ChatLayoutScrollButton.tsx +4 -2
- package/src/Chat/__tests__/ChatLayoutScrollButton.a11y.chromium.spec.ts +64 -19
- package/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts +3 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +34 -0
- package/src/CheckboxInput/CheckboxInput.tsx +3 -1
- package/src/CheckboxList/CheckboxList.fr10.test.tsx +29 -2
- package/src/CheckboxList/CheckboxList.test.tsx +22 -0
- package/src/CheckboxList/CheckboxList.tsx +4 -1
- package/src/CheckboxList/CheckboxListItem.doc.mjs +16 -0
- package/src/CheckboxList/CheckboxListItem.tsx +10 -0
- package/src/Code/Code.doc.mjs +1 -0
- package/src/CommandPalette/CommandPalette.doc.mjs +2 -0
- package/src/CommandPalette/CommandPaletteInput.test.tsx +53 -4
- package/src/CommandPalette/CommandPaletteInput.tsx +33 -3
- package/src/CommandPalette/__tests__/CommandPaletteInputAudit.a11y.chromium.spec.ts +335 -0
- package/src/CommandPalette/__tests__/CommandPaletteItemAudit.a11y.chromium.spec.ts +292 -0
- package/src/ContextMenu/ContextMenu.doc.mjs +2 -3
- package/src/ContextMenu/ContextMenu.test.tsx +12 -2
- package/src/ContextMenu/ContextMenu.tsx +4 -1
- package/src/ContextMenu/__tests__/ContextMenuAudit.a11y.chromium.spec.ts +438 -0
- package/src/Dialog/Dialog.test.tsx +46 -0
- package/src/Dialog/Dialog.tsx +20 -7
- package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -14
- package/src/Drawer/Drawer.doc.mjs +1 -0
- package/src/DropdownMenu/DropdownMenu.ssr.test.tsx +57 -0
- package/src/DropdownMenu/DropdownMenu.test.tsx +79 -6
- package/src/DropdownMenu/DropdownMenu.tsx +88 -144
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +1 -1
- package/src/DropdownMenu/DropdownMenuContext.tsx +24 -0
- package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +2 -2
- package/src/DropdownMenu/DropdownMenuDivider.spec.md +192 -0
- package/src/DropdownMenu/DropdownMenuDivider.tsx +9 -5
- package/src/DropdownMenu/DropdownMenuGroup.doc.mjs +169 -10
- package/src/DropdownMenu/DropdownMenuGroup.tsx +6 -4
- package/src/DropdownMenu/DropdownMenuLazySheet.test.tsx +126 -0
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +1 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +185 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +17 -3
- package/src/DropdownMenu/__tests__/DropdownMenuDividerAudit.a11y.chromium.spec.ts +280 -0
- package/src/DropdownMenu/__tests__/DropdownMenuGroupAudit.a11y.chromium.spec.ts +334 -0
- package/src/DropdownMenu/__tests__/warmMenuBottomSheet.tsx +43 -0
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +71 -0
- package/src/DropdownMenu/menuRegionStops.ts +167 -0
- package/src/EmptyState/EmptyState.doc.mjs +3 -2
- package/src/EmptyState/EmptyState.spec.md +189 -0
- package/src/EmptyState/EmptyState.test.tsx +74 -3
- package/src/EmptyState/EmptyState.tsx +4 -8
- package/src/Field/Field.doc.mjs +14 -8
- package/src/Field/Field.spec.md +217 -0
- package/src/Field/Field.test.tsx +60 -2
- package/src/Field/Field.tsx +17 -8
- package/src/Field/FieldLabel.doc.mjs +133 -26
- package/src/Field/FieldLabel.spec.md +172 -0
- package/src/Field/__tests__/FieldLabelAudit.a11y.chromium.spec.ts +296 -0
- package/src/FormLayout/FormLayout.doc.mjs +6 -3
- package/src/FormLayout/FormLayout.spec.md +192 -0
- package/src/FormLayout/FormLayout.test.tsx +15 -0
- package/src/FormLayout/FormLayout.tsx +7 -6
- package/src/FormLayout/FormLayoutContext.ts +3 -3
- package/src/Grid/Grid.doc.mjs +7 -1
- package/src/Grid/Grid.spec.md +93 -113
- package/src/Grid/Grid.test.tsx +22 -0
- package/src/Grid/Grid.tsx +10 -9
- package/src/Grid/GridSpan.doc.mjs +3 -3
- package/src/Grid/GridSpan.tsx +4 -1
- package/src/Heading/Heading.test.tsx +57 -0
- package/src/Heading/Heading.tsx +6 -2
- package/src/Icon/Icon.doc.mjs +36 -0
- package/src/Indicator/Indicator.doc.mjs +3 -3
- package/src/Item/Item.doc.mjs +12 -8
- package/src/Item/Item.test.tsx +61 -0
- package/src/Item/Item.tsx +40 -4
- package/src/Layout/LayoutHeader.doc.mjs +5 -0
- package/src/List/List.doc.mjs +14 -1
- package/src/List/List.spec.md +129 -77
- package/src/List/List.test.tsx +163 -94
- package/src/List/List.tsx +74 -18
- package/src/List/ListContext.tsx +9 -3
- package/src/List/ListItem.doc.mjs +16 -0
- package/src/List/ListItem.tsx +56 -27
- package/src/List/index.ts +1 -1
- package/src/Markdown/Markdown.tsx +14 -1
- package/src/Markdown/parser.ts +8 -2
- package/src/Markdown/plugins/headingLinks.ts +9 -1
- package/src/MetadataList/MetadataList.doc.mjs +3 -3
- package/src/MetadataList/MetadataList.test.tsx +38 -0
- package/src/MetadataList/MetadataList.tsx +8 -1
- package/src/MetadataList/MetadataListContext.tsx +1 -1
- package/src/MobileNav/MobileNav.tsx +30 -3
- package/src/MobileNav/MobileNavCloseEdgeCases.test.tsx +173 -15
- package/src/MoreMenu/MoreMenu.test.tsx +5 -1
- package/src/PowerSearch/PowerSearch.test.tsx +62 -0
- package/src/PowerSearch/PowerSearch.tsx +9 -0
- package/src/PowerSearch/PowerSearchValueEditor.test.tsx +71 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +45 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +1 -0
- package/src/RadioList/RadioList.fr10.test.tsx +45 -2
- package/src/RadioList/RadioList.test.tsx +22 -0
- package/src/RadioList/RadioList.tsx +4 -1
- package/src/RadioList/RadioListItem.doc.mjs +16 -0
- package/src/RadioList/RadioListItem.tsx +10 -1
- package/src/Resizable/useResizable.doc.mjs +2 -0
- package/src/ScrollableArea/ScrollableArea.doc.mjs +1 -1
- package/src/SideNav/SideNav.spec.md +227 -0
- package/src/SideNav/SideNav.test.tsx +220 -0
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/SideNav/SideNavItem.tsx +99 -17
- package/src/Slider/Slider.spec.md +39 -18
- package/src/Spinner/Spinner.doc.mjs +1 -1
- package/src/TabList/TabList.spec.md +57 -44
- package/src/Table/Table.spec.md +6 -1
- package/src/Table/plugins/activation/useTableActivation.spec.md +254 -0
- package/src/Text/Text.test.tsx +57 -0
- package/src/Text/Text.tsx +6 -2
- package/src/TimeInput/TimeInput.fr10.test.tsx +15 -0
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/ToggleButton/ToggleButton.test.tsx +95 -0
- package/src/ToggleButton/ToggleButton.tsx +12 -1
- package/src/ToggleButton/ToggleButtonGroup.doc.mjs +4 -0
- package/src/Token/Token.tsx +1 -1
- package/src/Token/__tests__/TokenRemoveTarget.a11y.chromium.spec.ts +86 -0
- package/src/Toolbar/Toolbar.test.tsx +0 -8
- package/src/Toolbar/__tests__/Toolbar.a11y.chromium.spec.ts +163 -0
- package/src/Toolbar/__tests__/Toolbar.a11y.renders.tsx +63 -0
- package/src/Toolbar/__tests__/Toolbar.a11y.states.ts +142 -0
- package/src/Toolbar/__tests__/Toolbar.a11y.test.tsx +126 -0
- package/src/TopNav/TopNavMegaMenu.test.tsx +47 -0
- package/src/TopNav/TopNavMegaMenu.tsx +9 -3
- package/src/TopNav/TopNavMenu.test.tsx +46 -1
- package/src/TopNav/TopNavMenu.tsx +13 -3
- package/src/TreeList/TreeList.doc.mjs +1 -0
- package/src/TreeList/TreeList.test.tsx +327 -6
- package/src/TreeList/TreeList.tsx +5 -1
- package/src/TreeList/TreeListBranches.tsx +6 -0
- package/src/TreeList/TreeListItem.tsx +88 -13
- package/src/docPropLiterals.test.ts +36 -10
- package/src/hooks/useMenuHover.ts +18 -13
- package/src/postinstall.test.mjs +79 -0
- package/src/reset.a11y.chromium.spec.ts +52 -1
- package/src/reset.css +9 -29
- package/src/reset.test.ts +11 -0
- package/src/theme/derivedVarRegistry.test.ts +7 -0
- package/src/unicodePropertyEscapes.source-build.test.mjs +69 -0
- package/src/utils/plainDate.test.ts +37 -1
- package/src/utils/plainDate.ts +15 -5
package/src/Item/Item.doc.mjs
CHANGED
|
@@ -49,7 +49,7 @@ export const docs = {
|
|
|
49
49
|
{
|
|
50
50
|
name: '--_item-inset-inline',
|
|
51
51
|
description:
|
|
52
|
-
'Inline inset of the row. Item derives its paddingInline from this variable, and List reads it to
|
|
52
|
+
'Inline inset of the row. Item derives its paddingInline from this variable, and List reads it to place rows for its edge treatments (edge="flush", "outset", and "bleed"). Set paddingInline on `item` in a theme and both stay in sync.',
|
|
53
53
|
default: 'var(--spacing-2) (var(--spacing-3) for density="spacious")',
|
|
54
54
|
private: true,
|
|
55
55
|
},
|
|
@@ -118,8 +118,9 @@ export const docs = {
|
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
name: 'align',
|
|
121
|
-
type: "'center' | 'start'",
|
|
122
|
-
description:
|
|
121
|
+
type: "'center' | 'start' | 'first-line'",
|
|
122
|
+
description:
|
|
123
|
+
"Vertical alignment of start/end content slots. 'center' centers each slot on the whole text block; 'start' lines up slot tops with the text's top; 'first-line' centers each slot on the label's first line, so a small mark stays level with the first line of a wrapped label. A slot taller than that line moves the text down. The `item` theme target reflects the value as `align`.",
|
|
123
124
|
default: "'center'",
|
|
124
125
|
},
|
|
125
126
|
{
|
|
@@ -248,7 +249,7 @@ export const docs = {
|
|
|
248
249
|
{
|
|
249
250
|
guidance: true,
|
|
250
251
|
description:
|
|
251
|
-
'Use align="
|
|
252
|
+
'Use align="first-line" when a wrapping label sits beside a small mark (a status dot, a radio, a timestamp) that belongs to its first line. Use align="start" to line up the tops of a tall slot and the text.',
|
|
252
253
|
},
|
|
253
254
|
{
|
|
254
255
|
guidance: true,
|
|
@@ -321,7 +322,8 @@ export const docsZh = {
|
|
|
321
322
|
endContent:
|
|
322
323
|
'在标签/描述区域之后渲染的内容,例如徽章、元数据、时间戳或操作按钮。',
|
|
323
324
|
as: '根元素的 HTML 元素。',
|
|
324
|
-
align:
|
|
325
|
+
align:
|
|
326
|
+
"起始/结束内容插槽的垂直对齐方式:'center'(默认)、'start'(顶部对齐)或 'first-line'(以标签第一行为中心)。",
|
|
325
327
|
density:
|
|
326
328
|
'间距密度。"compact" 使用 4px 块内距,"balanced" 使用 8px,"spacious" 使用 12px 块内距和内联内距。',
|
|
327
329
|
labelLines: '标签截断前的最大行数。',
|
|
@@ -363,7 +365,8 @@ export const docsZh = {
|
|
|
363
365
|
},
|
|
364
366
|
{
|
|
365
367
|
guidance: true,
|
|
366
|
-
description:
|
|
368
|
+
description:
|
|
369
|
+
'当换行标签旁边是属于其第一行的小标记(状态点、单选按钮、时间戳)时,使用 align="first-line"。使用 align="start" 让较高插槽与文本顶部对齐。',
|
|
367
370
|
},
|
|
368
371
|
{
|
|
369
372
|
guidance: false,
|
|
@@ -426,7 +429,7 @@ export const docsDense = {
|
|
|
426
429
|
{
|
|
427
430
|
guidance: true,
|
|
428
431
|
description:
|
|
429
|
-
'align="
|
|
432
|
+
'align="first-line" for a small mark beside a wrapping label; align="start" to top-align a tall slot with the text.',
|
|
430
433
|
},
|
|
431
434
|
{
|
|
432
435
|
guidance: false,
|
|
@@ -458,7 +461,8 @@ export const docsDense = {
|
|
|
458
461
|
endContent:
|
|
459
462
|
'Content after label/description: badges, timestamps, actions.',
|
|
460
463
|
as: 'Root HTML element.',
|
|
461
|
-
align:
|
|
464
|
+
align:
|
|
465
|
+
"Start/end slot alignment: 'center' (default), 'start' (tops), or 'first-line' (centered on the label's first line).",
|
|
462
466
|
density:
|
|
463
467
|
'Spacing: "compact" (4px), "balanced" (8px), or "spacious" (12px).',
|
|
464
468
|
labelLines: 'Max label lines before truncation.',
|
package/src/Item/Item.test.tsx
CHANGED
|
@@ -531,6 +531,67 @@ describe('Item', () => {
|
|
|
531
531
|
expect(screen.getByTestId('item')).toBeInTheDocument();
|
|
532
532
|
});
|
|
533
533
|
|
|
534
|
+
it('reflects the resolved alignment on the item theme target', () => {
|
|
535
|
+
const {rerender} = render(<Item label="Item" data-testid="item" />);
|
|
536
|
+
expect(screen.getByTestId('item')).toHaveAttribute('data-align', 'center');
|
|
537
|
+
for (const align of ['center', 'start', 'first-line'] as const) {
|
|
538
|
+
rerender(<Item label="Item" align={align} data-testid="item" />);
|
|
539
|
+
const item = screen.getByTestId('item');
|
|
540
|
+
expect(item).toHaveClass('astryx-item');
|
|
541
|
+
expect(item).toHaveAttribute('data-align', align);
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
it('aligns the row on first baselines only under first-line', () => {
|
|
546
|
+
const {rerender} = render(<Item label="Item" data-testid="item" />);
|
|
547
|
+
const declares = (value: string) =>
|
|
548
|
+
rulesDeclaredFor(screen.getByTestId('item')).some(rule =>
|
|
549
|
+
rule.includes(`align-items: ${value}`),
|
|
550
|
+
);
|
|
551
|
+
expect(declares('baseline')).toBe(false);
|
|
552
|
+
rerender(<Item label="Item" align="start" data-testid="item" />);
|
|
553
|
+
expect(declares('baseline')).toBe(false);
|
|
554
|
+
rerender(<Item label="Item" align="first-line" data-testid="item" />);
|
|
555
|
+
expect(declares('baseline')).toBe(true);
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
it('gives each first-line slot a strut with no accessible text', () => {
|
|
559
|
+
render(
|
|
560
|
+
<Item
|
|
561
|
+
label="Item"
|
|
562
|
+
align="first-line"
|
|
563
|
+
startContent={<span data-testid="start">S</span>}
|
|
564
|
+
endContent={<span data-testid="end">E</span>}
|
|
565
|
+
/>,
|
|
566
|
+
);
|
|
567
|
+
for (const id of ['start', 'end']) {
|
|
568
|
+
const slot = screen.getByTestId(id).parentElement!;
|
|
569
|
+
const before = rulesDeclaredFor(slot).filter(rule =>
|
|
570
|
+
rule.slice(0, rule.indexOf('{')).includes('::before'),
|
|
571
|
+
);
|
|
572
|
+
expect(before.some(rule => rule.includes('/ ""'))).toBe(true);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
it('leaves center and start slots without a strut', () => {
|
|
577
|
+
const {rerender} = render(
|
|
578
|
+
<Item label="Item" startContent={<span data-testid="start">S</span>} />,
|
|
579
|
+
);
|
|
580
|
+
const hasStrut = () =>
|
|
581
|
+
rulesDeclaredFor(screen.getByTestId('start').parentElement!).some(rule =>
|
|
582
|
+
rule.slice(0, rule.indexOf('{')).includes('::before'),
|
|
583
|
+
);
|
|
584
|
+
expect(hasStrut()).toBe(false);
|
|
585
|
+
rerender(
|
|
586
|
+
<Item
|
|
587
|
+
label="Item"
|
|
588
|
+
align="start"
|
|
589
|
+
startContent={<span data-testid="start">S</span>}
|
|
590
|
+
/>,
|
|
591
|
+
);
|
|
592
|
+
expect(hasStrut()).toBe(false);
|
|
593
|
+
});
|
|
594
|
+
|
|
534
595
|
// ===========================================================================
|
|
535
596
|
// Description rendering
|
|
536
597
|
// ===========================================================================
|
package/src/Item/Item.tsx
CHANGED
|
@@ -67,7 +67,7 @@ const LazyItemSwipeLayer = lazy(async () => import('./ItemSwipeLayer'));
|
|
|
67
67
|
// Types
|
|
68
68
|
// =============================================================================
|
|
69
69
|
|
|
70
|
-
export type ItemAlign = 'center' | 'start';
|
|
70
|
+
export type ItemAlign = 'center' | 'start' | 'first-line';
|
|
71
71
|
export type ItemDensity = 'compact' | 'balanced' | 'spacious';
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -168,7 +168,11 @@ export interface ItemProps extends BaseProps<HTMLElement> {
|
|
|
168
168
|
endContent?: ReactNode;
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
|
-
* Vertical alignment of the start/end content slots.
|
|
171
|
+
* Vertical alignment of the start/end content slots. `center` centers each
|
|
172
|
+
* slot on the whole text block; `start` lines up slot tops with the text's
|
|
173
|
+
* top; `first-line` centers each slot on the label's first line, so a small
|
|
174
|
+
* mark (a status dot, a radio, a timestamp) stays level with the first line
|
|
175
|
+
* of a wrapped label. A slot taller than that line moves the text down.
|
|
172
176
|
* @default 'center'
|
|
173
177
|
*/
|
|
174
178
|
align?: ItemAlign;
|
|
@@ -338,7 +342,7 @@ const styles = stylex.create({
|
|
|
338
342
|
gap: spacingVars['--spacing-2'],
|
|
339
343
|
// The inline inset is published as --_item-inset-inline and the padding
|
|
340
344
|
// derives from it, so consumers that need to compensate for the inset
|
|
341
|
-
// (List's
|
|
345
|
+
// (List's edge treatments) read the var instead of mirroring the values.
|
|
342
346
|
// Themes that set paddingInline on `item` also feed this var via the
|
|
343
347
|
// derived var registry, keeping padding and compensation in sync.
|
|
344
348
|
'--_item-inset-inline': spacingVars['--spacing-2'],
|
|
@@ -351,6 +355,30 @@ const styles = stylex.create({
|
|
|
351
355
|
alignStart: {
|
|
352
356
|
alignItems: 'flex-start',
|
|
353
357
|
},
|
|
358
|
+
// `first-line`: the row aligns its children on their first baselines. The
|
|
359
|
+
// label's first baseline is its first line's; each slot gets the same
|
|
360
|
+
// baseline from its strut (below), which the slot centers against its
|
|
361
|
+
// content. So each slot's center lands on the first line's center for any
|
|
362
|
+
// slot height, and a taller slot pushes the text down instead of leaving
|
|
363
|
+
// the row. Pure CSS: no measurement.
|
|
364
|
+
alignFirstLine: {
|
|
365
|
+
alignItems: 'baseline',
|
|
366
|
+
},
|
|
367
|
+
// A zero-width line of label text inside the slot: same size and leading as
|
|
368
|
+
// the label, so its line box is the label's first line box. The slot centers
|
|
369
|
+
// it against the slot's content, and the row's baseline alignment puts it on
|
|
370
|
+
// the label's first line. Its content carries empty alternative text so
|
|
371
|
+
// assistive technology reads nothing from it.
|
|
372
|
+
firstLineSlot: {
|
|
373
|
+
alignItems: 'center',
|
|
374
|
+
'::before': {
|
|
375
|
+
content: stylex.firstThatWorks('"\\200B" / ""', '"\\200B"'),
|
|
376
|
+
inlineSize: 0,
|
|
377
|
+
overflow: 'hidden',
|
|
378
|
+
fontSize: typeScaleVars['--text-body-size'],
|
|
379
|
+
lineHeight: typeScaleVars['--text-body-leading'],
|
|
380
|
+
},
|
|
381
|
+
},
|
|
354
382
|
interactive: {
|
|
355
383
|
cursor: {
|
|
356
384
|
default: 'pointer',
|
|
@@ -712,7 +740,13 @@ export function Item({
|
|
|
712
740
|
<>
|
|
713
741
|
{marker}
|
|
714
742
|
{startContent != null && (
|
|
715
|
-
<span
|
|
743
|
+
<span
|
|
744
|
+
{...stylex.props(
|
|
745
|
+
styles.startContent,
|
|
746
|
+
align === 'first-line' && styles.firstLineSlot,
|
|
747
|
+
)}>
|
|
748
|
+
{startContent}
|
|
749
|
+
</span>
|
|
716
750
|
)}
|
|
717
751
|
|
|
718
752
|
{hasParentRole || isDelegate ? (
|
|
@@ -768,6 +802,7 @@ export function Item({
|
|
|
768
802
|
<span
|
|
769
803
|
{...stylex.props(
|
|
770
804
|
styles.endContent,
|
|
805
|
+
align === 'first-line' && styles.firstLineSlot,
|
|
771
806
|
isDisabled && styles.disabledContent,
|
|
772
807
|
)}>
|
|
773
808
|
{endContent}
|
|
@@ -846,6 +881,7 @@ export function Item({
|
|
|
846
881
|
styles.root,
|
|
847
882
|
densityStyles[density],
|
|
848
883
|
align === 'start' && styles.alignStart,
|
|
884
|
+
align === 'first-line' && styles.alignFirstLine,
|
|
849
885
|
isInteractive && styles.interactive,
|
|
850
886
|
isInteractive && interactionOverlayStyles.backgroundColor,
|
|
851
887
|
isLinkRoot && styles.linkRoot,
|
|
@@ -6,6 +6,11 @@ export const docs = {
|
|
|
6
6
|
name: 'LayoutHeader',
|
|
7
7
|
subComponentOf: 'Layout',
|
|
8
8
|
displayName: 'Layout Header',
|
|
9
|
+
keywords: [
|
|
10
|
+
'pageheader',
|
|
11
|
+
'appheader',
|
|
12
|
+
'header',
|
|
13
|
+
],
|
|
9
14
|
isHiddenFromOverview: true,
|
|
10
15
|
description: 'Top bar for page titles, app bars, and toolbars.',
|
|
11
16
|
playground: {
|
package/src/List/List.doc.mjs
CHANGED
|
@@ -41,11 +41,18 @@ export const docs = {
|
|
|
41
41
|
description: 'Show dividers between items.',
|
|
42
42
|
default: 'false',
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
name: 'edge',
|
|
46
|
+
type: "'padded' | 'flush' | 'outset' | 'bleed'",
|
|
47
|
+
description:
|
|
48
|
+
"Where each row's text, dividers, and hover and selection backgrounds sit, relative to the list's edges and the container around it. 'padded' keeps text inside each row's padding, so it starts a little in from a heading above the list and backgrounds have room around it. 'flush' drops the rows' side padding: text starts on the heading's line, and dividers and backgrounds stop at the row's content, with no room beyond it on either side. It works anywhere and suits static rows. 'outset' puts text on the heading's line and reaches dividers and backgrounds a little past it into the container's padding; it suits interactive rows in a container. 'bleed' puts text on the heading's line and reaches dividers and backgrounds to the container's edges with square corners, like Table rows in a Card. A row's first content is what lines up with the heading: its marker, icon, or avatar when it has one, otherwise its label. 'outset' and 'bleed' reach into the padding of the nearest container that shares its padding: a Card, Section, Dialog, or BottomSheet, or a transparent container such as a Layout region with explicit padding or a padded ScrollableArea. Place the List directly in that container's padding: padding that Stack, Center, or your own styles add in between is not counted. Drawers and the automatic padding of LayoutContent and LayoutPanel aren't supported yet. With no such container, including in a Popover, they look like 'padded'. In a container with less padding than the rows' own, text starts a little after the heading's line. A theme's inline padding on `item` replaces the row padding of every value, including the zero padding of flush.",
|
|
49
|
+
default: "'padded'",
|
|
50
|
+
},
|
|
44
51
|
{
|
|
45
52
|
name: 'edgeCompensation',
|
|
46
53
|
type: "'inline'",
|
|
47
54
|
description:
|
|
48
|
-
"
|
|
55
|
+
"Deprecated: use edge=\"outset\", which this sets. Still works; edge wins when both are set. `astryx upgrade` rewrites existing usage.",
|
|
49
56
|
},
|
|
50
57
|
{
|
|
51
58
|
name: 'header',
|
|
@@ -89,6 +96,8 @@ export const docs = {
|
|
|
89
96
|
bestPractices: [
|
|
90
97
|
{ guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },
|
|
91
98
|
{ guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },
|
|
99
|
+
{ guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },
|
|
100
|
+
{ guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },
|
|
92
101
|
{ guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },
|
|
93
102
|
{ guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },
|
|
94
103
|
{ guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },
|
|
@@ -109,6 +118,8 @@ export const docsZh = {
|
|
|
109
118
|
bestPractices: [
|
|
110
119
|
{ guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },
|
|
111
120
|
{ guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },
|
|
121
|
+
{ guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },
|
|
122
|
+
{ guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },
|
|
112
123
|
{ guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },
|
|
113
124
|
{ guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },
|
|
114
125
|
{ guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },
|
|
@@ -132,6 +143,8 @@ export const docsDense = {
|
|
|
132
143
|
bestPractices: [
|
|
133
144
|
{ guidance: true, description: 'Provide a header to label the list and give context to screen readers.' },
|
|
134
145
|
{ guidance: true, description: 'Use start and end content slots to add icons, avatars, or badges to each item.' },
|
|
146
|
+
{ guidance: true, description: 'Set edge to line row text up with a heading above the list: flush for static rows, outset or bleed for rows in a Card, Section, or Dialog.' },
|
|
147
|
+
{ guidance: true, description: 'To line text up with a heading and keep room around the highlight where there is no Card, such as a sidebar, put the heading and the list in a Section with variant="transparent" and set edge="outset".' },
|
|
135
148
|
{ guidance: false, description: 'Place interactive elements inside an interactive list item; it creates nested click targets and confusing focus behavior.' },
|
|
136
149
|
{ guidance: false, description: 'Use a list for a single item or for laying out unrelated content; lists imply a meaningful collection.' },
|
|
137
150
|
{ guidance: false, description: 'Mix clickable and non-clickable items in the same list without clear visual distinction.' },
|