@astryxdesign/core 0.5.1 → 0.5.2-canary.00477a5
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 +19 -0
- package/dist/BottomSheet/BottomSheet.d.ts +3 -1
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -3
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts +2 -2
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetEdgeTint.js +7 -10
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +1 -1
- package/dist/Button/Button.d.ts +2 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +11 -4
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +2 -2
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +34 -17
- package/dist/ContextMenu/ContextMenu.d.ts +14 -3
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +149 -26
- package/dist/ContextMenu/index.d.ts +1 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts +24 -5
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +340 -26
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +6 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +43 -14
- package/dist/DropdownMenu/MenuBottomSheet.d.ts +20 -0
- package/dist/DropdownMenu/MenuBottomSheet.d.ts.map +1 -0
- package/dist/DropdownMenu/MenuBottomSheet.js +36 -0
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts +10 -0
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -0
- package/dist/DropdownMenu/MenuBottomSheetActionList.js +111 -0
- package/dist/DropdownMenu/index.d.ts +2 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/menuWidth.d.ts +14 -0
- package/dist/DropdownMenu/menuWidth.d.ts.map +1 -0
- package/dist/DropdownMenu/menuWidth.js +35 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts +10 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -0
- package/dist/DropdownMenu/useMenuOverflow.js +60 -0
- package/dist/MoreMenu/MoreMenu.d.ts +8 -2
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +2 -0
- package/dist/MultiSelector/MultiSelector.d.ts +11 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +97 -68
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts.map +1 -1
- package/dist/Popover/Popover.d.ts +10 -6
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +141 -16
- package/dist/Popover/usePopover.d.ts +4 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +52 -5
- package/dist/Selector/Selector.d.ts +10 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +106 -80
- package/dist/Selector/SelectorBottomSheet.d.ts +21 -0
- package/dist/Selector/SelectorBottomSheet.d.ts.map +1 -0
- package/dist/Selector/SelectorBottomSheet.js +83 -0
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.d.ts.map +1 -1
- package/dist/Selector/selectorPresentation.stylex.d.ts +16 -0
- package/dist/Selector/selectorPresentation.stylex.d.ts.map +1 -0
- package/dist/Selector/selectorPresentation.stylex.js +21 -0
- package/dist/Selector/useSelectorPresentation.d.ts +32 -0
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -0
- package/dist/Selector/useSelectorPresentation.js +90 -0
- package/dist/Toast/useToastGesture.d.ts.map +1 -1
- package/dist/Toast/useToastGesture.js +46 -9
- package/dist/astryx.css +19 -1
- package/dist/hooks/useAdaptivePresentation.d.ts +5 -0
- package/dist/hooks/useAdaptivePresentation.d.ts.map +1 -0
- package/dist/hooks/useAdaptivePresentation.js +19 -0
- package/dist/hooks/useFocusReturnVisibility.d.ts +7 -0
- package/dist/hooks/useFocusReturnVisibility.d.ts.map +1 -0
- package/dist/hooks/useFocusReturnVisibility.js +35 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +12 -0
- package/dist/i18n/InternationalizationContext.d.ts +2 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +3 -1
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +3 -1
- package/dist/i18n/resolve.d.ts +1 -1
- package/dist/i18n/resolve.d.ts.map +1 -1
- package/dist/i18n/resolve.js +37 -38
- package/dist/i18n/useTranslator.d.ts.map +1 -1
- package/dist/i18n/useTranslator.js +2 -3
- package/locales/af-ZA.json +0 -4
- package/locales/ar-SA.json +0 -4
- package/locales/ca-ES.json +0 -4
- package/locales/cs-CZ.json +0 -4
- package/locales/da-DK.json +0 -4
- package/locales/de-DE.json +0 -4
- package/locales/el-GR.json +0 -4
- package/locales/en.json +20 -0
- package/locales/es-ES.json +0 -4
- package/locales/fi-FI.json +0 -4
- package/locales/fr-FR.json +0 -4
- package/locales/he-IL.json +0 -4
- package/locales/hu-HU.json +0 -4
- package/locales/it-IT.json +0 -4
- package/locales/ja-JP.json +0 -4
- package/locales/ko-KR.json +0 -4
- package/locales/nl-NL.json +0 -4
- package/locales/no-NO.json +0 -4
- package/locales/pl-PL.json +0 -4
- package/locales/pseudo.json +15 -0
- package/locales/pt-BR.json +0 -4
- package/locales/pt-PT.json +0 -4
- package/locales/ro-RO.json +0 -4
- package/locales/ru-RU.json +0 -4
- package/locales/sr-SP.json +0 -4
- package/locales/sv-SE.json +0 -4
- package/locales/tr-TR.json +0 -4
- package/locales/uk-UA.json +0 -4
- package/locales/vi-VN.json +0 -4
- package/locales/zh-CN.json +0 -4
- package/locales/zh-TW.json +0 -4
- package/package.json +3 -3
- package/src/BottomSheet/BottomSheet.doc.mjs +37 -0
- package/src/BottomSheet/BottomSheet.spec.md +177 -0
- package/src/BottomSheet/BottomSheet.test.tsx +29 -0
- package/src/BottomSheet/BottomSheet.tsx +7 -4
- package/src/BottomSheet/BottomSheetEdgeTint.test.tsx +4 -6
- package/src/BottomSheet/BottomSheetEdgeTint.tsx +7 -10
- package/src/BottomSheet/BottomSheetSwitcher.tsx +1 -2
- package/src/Button/Button.doc.mjs +56 -0
- package/src/Button/Button.test.tsx +10 -0
- package/src/Button/Button.tsx +13 -5
- package/src/ButtonGroup/ButtonGroup.doc.mjs +47 -0
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Carousel/Carousel.test.tsx +83 -0
- package/src/Carousel/Carousel.tsx +8 -2
- package/src/Chat/ChatToolCalls.test.tsx +44 -0
- package/src/Chat/ChatToolCalls.tsx +36 -15
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/CheckboxList/CheckboxList.doc.mjs +173 -32
- package/src/CheckboxList/CheckboxList.spec.md +214 -0
- package/src/CommandPalette/CommandPalette.doc.mjs +72 -0
- package/src/CommandPalette/CommandPalette.spec.md +223 -0
- package/src/ComplexSelector/ComplexSelector.doc.mjs +44 -2
- package/src/ComplexSelector/ComplexSelector.spec.md +189 -0
- package/src/ContextMenu/ContextMenu.doc.mjs +13 -1
- package/src/ContextMenu/ContextMenu.test.tsx +131 -1
- package/src/ContextMenu/ContextMenu.tsx +199 -32
- package/src/ContextMenu/index.ts +1 -0
- package/src/DateInput/DateInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateTimeInput/DateTimeInput.doc.mjs +1 -1
- package/src/Divider/Divider.doc.mjs +24 -0
- package/src/Divider/Divider.spec.md +150 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +201 -40
- package/src/DropdownMenu/DropdownMenu.test.tsx +518 -7
- package/src/DropdownMenu/DropdownMenu.tsx +459 -28
- package/src/DropdownMenu/DropdownMenuContext.tsx +1 -1
- package/src/DropdownMenu/DropdownMenuItem.tsx +2 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +4 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +124 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +72 -17
- package/src/DropdownMenu/MenuBottomSheet.tsx +46 -0
- package/src/DropdownMenu/MenuBottomSheetActionList.tsx +141 -0
- package/src/DropdownMenu/index.ts +2 -0
- package/src/DropdownMenu/menuWidth.ts +51 -0
- package/src/DropdownMenu/useMenuOverflow.ts +77 -0
- package/src/Field/Field.doc.mjs +1 -1
- package/src/FieldStatus/FieldStatus.doc.mjs +22 -1
- package/src/FieldStatus/FieldStatus.spec.md +212 -0
- package/src/FileInput/FileInput.doc.mjs +1 -1
- package/src/Grid/Grid.doc.mjs +19 -0
- package/src/Grid/Grid.spec.md +161 -0
- package/src/Icon/Icon.doc.mjs +196 -48
- package/src/Icon/Icon.spec.md +191 -0
- package/src/IconButton/IconButton.doc.mjs +38 -0
- package/src/Indicator/Indicator.doc.mjs +1 -1
- package/src/InputGroup/InputGroup.doc.mjs +1 -1
- package/src/Kbd/Kbd.doc.mjs +18 -0
- package/src/Kbd/Kbd.spec.md +141 -0
- package/src/Layout/Layout.doc.mjs +32 -0
- package/src/Layout/Layout.spec.md +199 -0
- package/src/Lightbox/Lightbox.doc.mjs +149 -33
- package/src/Lightbox/Lightbox.spec.md +197 -0
- package/src/Markdown/Markdown.doc.mjs +60 -0
- package/src/Markdown/Markdown.spec.md +200 -0
- package/src/MobileNav/MobileNav.doc.mjs +140 -32
- package/src/MobileNav/MobileNav.spec.md +208 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +17 -0
- package/src/MoreMenu/MoreMenu.test.tsx +47 -0
- package/src/MoreMenu/MoreMenu.tsx +13 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +129 -1
- package/src/MultiSelector/MultiSelector.spec.md +266 -0
- package/src/MultiSelector/MultiSelector.test.tsx +127 -0
- package/src/MultiSelector/MultiSelector.tsx +121 -73
- package/src/MultiSelector/index.ts +1 -0
- package/src/NavIcon/NavIcon.doc.mjs +17 -0
- package/src/NavIcon/NavIcon.spec.md +133 -0
- package/src/NavMenu/NavHeadingMenu.spec.md +205 -0
- package/src/NavMenu/NavMenu.doc.mjs +37 -0
- package/src/NumberInput/NumberInput.doc.mjs +1 -1
- package/src/Outline/Outline.doc.mjs +35 -0
- package/src/Outline/Outline.spec.md +161 -0
- package/src/OverflowList/OverflowList.doc.mjs +24 -0
- package/src/OverflowList/OverflowList.spec.md +156 -0
- package/src/Pagination/Pagination.doc.mjs +74 -0
- package/src/Pagination/Pagination.spec.md +225 -0
- package/src/Popover/Popover.doc.mjs +11 -11
- package/src/Popover/Popover.test.tsx +397 -2
- package/src/Popover/Popover.tsx +228 -21
- package/src/Popover/usePopover.tsx +92 -15
- package/src/PowerSearch/PowerSearch.doc.mjs +1 -1
- package/src/ProgressBar/ProgressBar.doc.mjs +198 -38
- package/src/ProgressBar/ProgressBar.spec.md +260 -0
- package/src/RadioList/RadioList.doc.mjs +1 -1
- package/src/Resizable/Resizable.doc.mjs +59 -16
- package/src/Resizable/Resizable.spec.md +194 -0
- package/src/Section/Section.doc.mjs +17 -0
- package/src/Section/Section.spec.md +138 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +83 -0
- package/src/SegmentedControl/SegmentedControl.spec.md +151 -0
- package/src/Selector/Selector.doc.mjs +13 -1
- package/src/Selector/Selector.test.tsx +135 -0
- package/src/Selector/Selector.tsx +141 -82
- package/src/Selector/SelectorBottomSheet.tsx +97 -0
- package/src/Selector/index.ts +1 -0
- package/src/Selector/selectorPresentation.stylex.ts +20 -0
- package/src/Selector/useSelectorPresentation.ts +147 -0
- package/src/Skeleton/Skeleton.doc.mjs +12 -0
- package/src/Skeleton/Skeleton.spec.md +126 -0
- package/src/Slider/Slider.doc.mjs +186 -32
- package/src/Slider/Slider.spec.md +223 -0
- package/src/Stack/Stack.doc.mjs +22 -0
- package/src/Stack/Stack.spec.md +154 -0
- package/src/StatusDot/StatusDot.doc.mjs +17 -0
- package/src/StatusDot/StatusDot.spec.md +137 -0
- package/src/Switch/Switch.doc.mjs +41 -1
- package/src/Switch/Switch.spec.md +174 -0
- package/src/Text/Text.doc.mjs +190 -43
- package/src/Text/Text.spec.md +205 -0
- package/src/TextArea/TextArea.doc.mjs +256 -46
- package/src/TextArea/TextArea.spec.md +204 -0
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.doc.mjs +1 -1
- package/src/Toast/ToastViewport.test.tsx +118 -4
- package/src/Toast/useToastGesture.ts +61 -8
- package/src/ToggleButton/ToggleButton.doc.mjs +56 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +1 -1
- package/src/Toolbar/Toolbar.doc.mjs +19 -0
- package/src/Toolbar/Toolbar.spec.md +173 -0
- package/src/Tooltip/Tooltip.doc.mjs +17 -0
- package/src/Tooltip/Tooltip.spec.md +141 -0
- package/src/TreeList/TreeList.doc.mjs +58 -0
- package/src/TreeList/TreeList.spec.md +220 -0
- package/src/Typeahead/Typeahead.doc.mjs +84 -2
- package/src/Typeahead/Typeahead.spec.md +250 -0
- package/src/hooks/useAdaptivePresentation.ts +35 -0
- package/src/hooks/useFocusReturnVisibility.ts +45 -0
- package/src/hooks/useFocusTrap.test.tsx +40 -0
- package/src/hooks/useFocusTrap.ts +13 -0
- package/src/i18n/InternationalizationContext.ts +3 -0
- package/src/i18n/InternationalizationProvider.tsx +8 -1
- package/src/i18n/__tests__/resolve.test.ts +23 -1
- package/src/i18n/resolve.ts +46 -49
- package/src/i18n/useTranslator.ts +2 -7
- package/src/theme/themingTargets.test.ts +91 -25
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').ComponentAnatomyElement[]} */
|
|
4
|
+
const anatomy = [
|
|
5
|
+
{
|
|
6
|
+
name: 'Placeholder',
|
|
7
|
+
required: true,
|
|
8
|
+
description: 'Painted shape that stands in for content while it loads.',
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
|
|
3
12
|
/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */
|
|
4
13
|
|
|
5
14
|
export const docs = {
|
|
@@ -49,6 +58,7 @@ export const docs = {
|
|
|
49
58
|
],
|
|
50
59
|
},
|
|
51
60
|
usage: {
|
|
61
|
+
anatomy,
|
|
52
62
|
description:
|
|
53
63
|
'An animated shimmer placeholder that previews the shape of content while it loads. Use it to build loading screens that match the layout of the real content. For content with unknown dimensions, use Spinner instead.',
|
|
54
64
|
bestPractices: [
|
|
@@ -98,6 +108,7 @@ export const docsZh = {
|
|
|
98
108
|
],
|
|
99
109
|
},
|
|
100
110
|
usage: {
|
|
111
|
+
anatomy,
|
|
101
112
|
description:
|
|
102
113
|
'An animated shimmer placeholder that previews the shape of content while it loads. Use it to build loading screens that match the layout of the real content. For content with unknown dimensions, use Spinner instead.',
|
|
103
114
|
bestPractices: [
|
|
@@ -113,6 +124,7 @@ export const docsZh = {
|
|
|
113
124
|
/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */
|
|
114
125
|
export const docsDense = {
|
|
115
126
|
usage: {
|
|
127
|
+
anatomy,
|
|
116
128
|
description:
|
|
117
129
|
'An animated shimmer placeholder that previews the shape of content while it loads. Use it to build loading screens that match the layout of the real content. For content with unknown dimensions, use Spinner instead.',
|
|
118
130
|
bestPractices: [
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema_version: 1
|
|
3
|
+
template_version: 3
|
|
4
|
+
kind: component
|
|
5
|
+
id: component:Skeleton
|
|
6
|
+
authority: draft
|
|
7
|
+
archive_reason: null
|
|
8
|
+
superseded_by: null
|
|
9
|
+
approved_by: null
|
|
10
|
+
approved_at: null
|
|
11
|
+
owners: [cixzhang]
|
|
12
|
+
review_triggers: [theming]
|
|
13
|
+
verified_by:
|
|
14
|
+
[packages/core/src/Skeleton/Skeleton.test.tsx, scripts/check-knowledge.mjs]
|
|
15
|
+
families: []
|
|
16
|
+
design_specs: []
|
|
17
|
+
architecture:
|
|
18
|
+
[architecture:component-theming-surface, architecture:public-component-api]
|
|
19
|
+
contributing: []
|
|
20
|
+
system_specs: []
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Skeleton component contract
|
|
24
|
+
|
|
25
|
+
## Intent
|
|
26
|
+
|
|
27
|
+
Skeleton renders a placeholder shape while surrounding content loads. This draft
|
|
28
|
+
records the component's current consumer anatomy and theming ownership without
|
|
29
|
+
changing its runtime contract.
|
|
30
|
+
|
|
31
|
+
## Compatibility and migration
|
|
32
|
+
|
|
33
|
+
- Released default preserved: `yes`
|
|
34
|
+
- Compatibility class: additive documentation only; runtime, DOM, styling,
|
|
35
|
+
targets, and public API remain unchanged
|
|
36
|
+
- Controlled/uncontrolled behavior: not applicable
|
|
37
|
+
- Migration decision: none
|
|
38
|
+
|
|
39
|
+
Consumer migration instructions belong in consumer docs and release notes.
|
|
40
|
+
|
|
41
|
+
## Ownership boundary
|
|
42
|
+
|
|
43
|
+
**Owns**
|
|
44
|
+
|
|
45
|
+
- The rendered placeholder shape and its existing `skeleton` theming target.
|
|
46
|
+
|
|
47
|
+
**Does not own / non-goals**
|
|
48
|
+
|
|
49
|
+
- The surrounding content's loading state, layout, or replacement timing — owned
|
|
50
|
+
by the product callsite.
|
|
51
|
+
|
|
52
|
+
## Public concepts
|
|
53
|
+
|
|
54
|
+
No new public concept is introduced. Consumer props and usage remain documented
|
|
55
|
+
in `Skeleton.doc.mjs`.
|
|
56
|
+
|
|
57
|
+
## Behavioral and layout contract
|
|
58
|
+
|
|
59
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
60
|
+
| --- | ----------------------------------------------------------------------------------- | ------------------------------- | -------------------------------------------------- |
|
|
61
|
+
| FR1 | The current render contains one painted placeholder carrying the `skeleton` target. | Current source, docs, and tests | Verified current behavior; no new behavior decided |
|
|
62
|
+
|
|
63
|
+
### Allowed variation
|
|
64
|
+
|
|
65
|
+
- This documentation does not constrain behavior beyond the factual anatomy and
|
|
66
|
+
target relationship recorded here.
|
|
67
|
+
|
|
68
|
+
### Representative states
|
|
69
|
+
|
|
70
|
+
- The anatomy and target relationship is the same for the documented size,
|
|
71
|
+
radius, and animation inputs.
|
|
72
|
+
|
|
73
|
+
### Transformation and precedence order
|
|
74
|
+
|
|
75
|
+
- No new ordering rule is introduced.
|
|
76
|
+
|
|
77
|
+
### Performance and resources
|
|
78
|
+
|
|
79
|
+
- No new performance or resource rule is introduced.
|
|
80
|
+
|
|
81
|
+
## Accessibility contract
|
|
82
|
+
|
|
83
|
+
This draft does not change or extend Skeleton's existing accessibility behavior.
|
|
84
|
+
|
|
85
|
+
## Design relationships
|
|
86
|
+
|
|
87
|
+
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
|
|
88
|
+
| ---------------- | ------------------------------------------ | ------------------------------ | -------------- | ------------------ |
|
|
89
|
+
| Placeholder | Represents the current painted loading UI. | Current source and public docs | Supporting | FR1 |
|
|
90
|
+
|
|
91
|
+
### Theming anatomy
|
|
92
|
+
|
|
93
|
+
<!-- anatomy-theming:v1 -->
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"Placeholder": {"target": "skeleton"}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Family and system relationships
|
|
102
|
+
|
|
103
|
+
This draft references the current shared owners without restating their rules:
|
|
104
|
+
`architecture:component-theming-surface` and
|
|
105
|
+
`architecture:public-component-api`.
|
|
106
|
+
|
|
107
|
+
## Verification map
|
|
108
|
+
|
|
109
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
110
|
+
| ------------------- | -------------------------------- | ------------------------------------ | ----------------------------------------------------------------------- | ------------------------ |
|
|
111
|
+
| FR1 | `Skeleton.test.tsx` render suite | A rendered placeholder | Removing the placeholder fails the existing render assertion. | `audit:Skeleton/anatomy` |
|
|
112
|
+
| Theming anatomy map | `scripts/check-knowledge.mjs` | Canonical anatomy and current target | Missing, extra, prefixed, or stale mappings fail repository validation. | `audit:Skeleton/theming` |
|
|
113
|
+
|
|
114
|
+
## Decision log
|
|
115
|
+
|
|
116
|
+
None. This draft records current facts and introduces no component-local design
|
|
117
|
+
decision.
|
|
118
|
+
|
|
119
|
+
## Open questions
|
|
120
|
+
|
|
121
|
+
None.
|
|
122
|
+
|
|
123
|
+
## Content boundary
|
|
124
|
+
|
|
125
|
+
This file does not duplicate consumer prop tables, examples, implementation
|
|
126
|
+
steps, or system rules. It links to their owners.
|
|
@@ -1,12 +1,86 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').ComponentAnatomyElement[]} */
|
|
4
|
+
const anatomy = [
|
|
5
|
+
{
|
|
6
|
+
name: 'Label',
|
|
7
|
+
required: true,
|
|
8
|
+
description:
|
|
9
|
+
'Text identifying the numeric setting controlled by the slider.',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'Description',
|
|
13
|
+
required: false,
|
|
14
|
+
description: 'Helper text between the label and the slider control.',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'Slider',
|
|
18
|
+
required: true,
|
|
19
|
+
description:
|
|
20
|
+
'Control row containing the track, thumb or thumbs, and optional text value.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Track',
|
|
24
|
+
required: true,
|
|
25
|
+
description: 'Background rail representing the available numeric range.',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Filled range',
|
|
29
|
+
required: true,
|
|
30
|
+
description:
|
|
31
|
+
'Accent segment from the minimum to a single value, or between two range values.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Tick mark',
|
|
35
|
+
required: false,
|
|
36
|
+
description: 'Position marker supplied through the marks collection.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Mark label',
|
|
40
|
+
required: false,
|
|
41
|
+
description: 'Optional text displayed beside a tick mark.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Thumb',
|
|
45
|
+
required: true,
|
|
46
|
+
description:
|
|
47
|
+
'Draggable value indicator; range mode renders a minimum and maximum thumb.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Value display',
|
|
51
|
+
required: false,
|
|
52
|
+
description:
|
|
53
|
+
'Formatted current value shown beside the slider when valueDisplay is text.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Value tooltip',
|
|
57
|
+
required: false,
|
|
58
|
+
description:
|
|
59
|
+
'Formatted current value shown in a tooltip when valueDisplay is tooltip.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Status message',
|
|
63
|
+
required: false,
|
|
64
|
+
description: 'Error, warning, or success message below the slider.',
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
3
68
|
/** @type {import('@astryxdesign/cli/authoring').ComponentDoc} */
|
|
4
69
|
|
|
5
70
|
export const docs = {
|
|
6
71
|
name: 'Slider',
|
|
7
72
|
displayName: 'Slider',
|
|
8
|
-
category: '
|
|
9
|
-
keywords: [
|
|
73
|
+
category: 'Form Controls',
|
|
74
|
+
keywords: [
|
|
75
|
+
'slider',
|
|
76
|
+
'range',
|
|
77
|
+
'slidebar',
|
|
78
|
+
'trackbar',
|
|
79
|
+
'scrubber',
|
|
80
|
+
'knob',
|
|
81
|
+
'thumb',
|
|
82
|
+
'rangeslider',
|
|
83
|
+
],
|
|
10
84
|
playground: {
|
|
11
85
|
defaults: {
|
|
12
86
|
label: 'Volume',
|
|
@@ -156,20 +230,49 @@ export const docs = {
|
|
|
156
230
|
],
|
|
157
231
|
theming: {
|
|
158
232
|
targets: [
|
|
159
|
-
{
|
|
233
|
+
{
|
|
234
|
+
className: 'astryx-slider',
|
|
235
|
+
visualProps: ['orientation'],
|
|
236
|
+
states: ['disabled'],
|
|
237
|
+
},
|
|
160
238
|
{className: 'astryx-slider-track', visualProps: ['orientation']},
|
|
161
|
-
{
|
|
239
|
+
{
|
|
240
|
+
className: 'astryx-slider-thumb',
|
|
241
|
+
visualProps: ['orientation'],
|
|
242
|
+
states: ['disabled'],
|
|
243
|
+
},
|
|
162
244
|
],
|
|
163
245
|
},
|
|
164
246
|
usage: {
|
|
247
|
+
anatomy,
|
|
165
248
|
description:
|
|
166
249
|
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage.',
|
|
167
250
|
bestPractices: [
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
251
|
+
{
|
|
252
|
+
guidance: true,
|
|
253
|
+
description:
|
|
254
|
+
'Always provide a label, even if visually hidden, so the slider is accessible to screen readers.',
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
guidance: true,
|
|
258
|
+
description:
|
|
259
|
+
'Format values with meaningful units like "$50" or "75%" instead of raw numbers.',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
guidance: false,
|
|
263
|
+
description:
|
|
264
|
+
'Use for precise numeric entry; pair with a text input or use NumberInput instead.',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
guidance: false,
|
|
268
|
+
description:
|
|
269
|
+
'Set a step size so large that only a few positions are possible; use SegmentedControl or radio buttons instead.',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
guidance: false,
|
|
273
|
+
description:
|
|
274
|
+
'Wrap a disabled slider in Tooltip to explain why it is disabled; disabled controls swallow the hover events the wrapper needs. Use the disabledMessage prop instead.',
|
|
275
|
+
},
|
|
173
276
|
],
|
|
174
277
|
},
|
|
175
278
|
};
|
|
@@ -229,8 +332,7 @@ export const docsZh = {
|
|
|
229
332
|
{
|
|
230
333
|
name: 'formatValue',
|
|
231
334
|
type: '(value: number) => string',
|
|
232
|
-
description:
|
|
233
|
-
'自定义值格式化函数,用于显示和 `aria-valuetext`。',
|
|
335
|
+
description: '自定义值格式化函数,用于显示和 `aria-valuetext`。',
|
|
234
336
|
},
|
|
235
337
|
{
|
|
236
338
|
name: 'valueDisplay',
|
|
@@ -246,8 +348,7 @@ export const docsZh = {
|
|
|
246
348
|
{
|
|
247
349
|
name: 'minStepsBetweenThumbs',
|
|
248
350
|
type: 'number',
|
|
249
|
-
description:
|
|
250
|
-
'范围模式下滑块之间的最小步数;防止滑块重叠。',
|
|
351
|
+
description: '范围模式下滑块之间的最小步数;防止滑块重叠。',
|
|
251
352
|
default: '0',
|
|
252
353
|
},
|
|
253
354
|
{
|
|
@@ -259,7 +360,8 @@ export const docsZh = {
|
|
|
259
360
|
{
|
|
260
361
|
name: 'htmlName',
|
|
261
362
|
type: 'string',
|
|
262
|
-
description:
|
|
363
|
+
description:
|
|
364
|
+
'用于表单提交的 HTML name 属性。渲染携带当前值的隐藏输入(范围模式下为两个条目)。',
|
|
263
365
|
},
|
|
264
366
|
{
|
|
265
367
|
name: 'disabledMessage',
|
|
@@ -293,8 +395,7 @@ export const docsZh = {
|
|
|
293
395
|
{
|
|
294
396
|
name: 'status',
|
|
295
397
|
type: "{type: 'warning' | 'error' | 'success', message?: string}",
|
|
296
|
-
description:
|
|
297
|
-
'验证反馈的状态指示器对象(`{ type, message }`)。',
|
|
398
|
+
description: '验证反馈的状态指示器对象(`{ type, message }`)。',
|
|
298
399
|
},
|
|
299
400
|
{
|
|
300
401
|
name: 'labelTooltip',
|
|
@@ -310,20 +411,49 @@ export const docsZh = {
|
|
|
310
411
|
],
|
|
311
412
|
theming: {
|
|
312
413
|
targets: [
|
|
313
|
-
{
|
|
414
|
+
{
|
|
415
|
+
className: 'astryx-slider',
|
|
416
|
+
visualProps: ['orientation'],
|
|
417
|
+
states: ['disabled'],
|
|
418
|
+
},
|
|
314
419
|
{className: 'astryx-slider-track', visualProps: ['orientation']},
|
|
315
|
-
{
|
|
420
|
+
{
|
|
421
|
+
className: 'astryx-slider-thumb',
|
|
422
|
+
visualProps: ['orientation'],
|
|
423
|
+
states: ['disabled'],
|
|
424
|
+
},
|
|
316
425
|
],
|
|
317
426
|
},
|
|
318
427
|
usage: {
|
|
428
|
+
anatomy,
|
|
319
429
|
description:
|
|
320
430
|
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage.',
|
|
321
431
|
bestPractices: [
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
432
|
+
{
|
|
433
|
+
guidance: true,
|
|
434
|
+
description:
|
|
435
|
+
'Always provide a label, even if visually hidden, so the slider is accessible to screen readers.',
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
guidance: true,
|
|
439
|
+
description:
|
|
440
|
+
'Format values with meaningful units like "$50" or "75%" instead of raw numbers.',
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
guidance: false,
|
|
444
|
+
description:
|
|
445
|
+
'Use for precise numeric entry; pair with a text input or use NumberInput instead.',
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
guidance: false,
|
|
449
|
+
description:
|
|
450
|
+
'Set a step size so large that only a few positions are possible; use SegmentedControl or radio buttons instead.',
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
guidance: false,
|
|
454
|
+
description:
|
|
455
|
+
'Wrap a disabled slider in Tooltip to explain why it is disabled; disabled controls swallow the hover events the wrapper needs. Use the disabledMessage prop instead.',
|
|
456
|
+
},
|
|
327
457
|
],
|
|
328
458
|
},
|
|
329
459
|
};
|
|
@@ -331,19 +461,41 @@ export const docsZh = {
|
|
|
331
461
|
/** @type {import('@astryxdesign/cli/authoring').ComponentTranslationDoc} */
|
|
332
462
|
export const docsDense = {
|
|
333
463
|
usage: {
|
|
464
|
+
anatomy,
|
|
334
465
|
description:
|
|
335
466
|
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage.',
|
|
336
467
|
bestPractices: [
|
|
337
|
-
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
468
|
+
{
|
|
469
|
+
guidance: true,
|
|
470
|
+
description:
|
|
471
|
+
'Always provide a label, even if visually hidden, so the slider is accessible to screen readers.',
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
guidance: true,
|
|
475
|
+
description:
|
|
476
|
+
'Format values with meaningful units like "$50" or "75%" instead of raw numbers.',
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
guidance: false,
|
|
480
|
+
description:
|
|
481
|
+
'Use for precise numeric entry; pair with a text input or use NumberInput instead.',
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
guidance: false,
|
|
485
|
+
description:
|
|
486
|
+
'Set a step size so large that only a few positions are possible; use SegmentedControl or radio buttons instead.',
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
guidance: false,
|
|
490
|
+
description:
|
|
491
|
+
'Wrap a disabled slider in Tooltip to explain why it is disabled; disabled controls swallow the hover events the wrapper needs. Use the disabledMessage prop instead.',
|
|
492
|
+
},
|
|
342
493
|
],
|
|
343
494
|
},
|
|
344
495
|
propDescriptions: {
|
|
345
496
|
label: 'Label text (always rendered for a11y).',
|
|
346
|
-
value:
|
|
497
|
+
value:
|
|
498
|
+
'Current value; number for single thumb, [number, number] for range.',
|
|
347
499
|
onChange: 'Fired on value change during drag.',
|
|
348
500
|
onChangeEnd: 'Fired when drag ends.',
|
|
349
501
|
min: 'Minimum value.',
|
|
@@ -353,9 +505,11 @@ export const docsDense = {
|
|
|
353
505
|
formatValue: 'Custom value formatting fn for display + aria-valuetext.',
|
|
354
506
|
valueDisplay: 'How current value is displayed.',
|
|
355
507
|
marks: 'Tick marks at specified positions w/ optional labels.',
|
|
356
|
-
minStepsBetweenThumbs:
|
|
508
|
+
minStepsBetweenThumbs:
|
|
509
|
+
'Min steps between thumbs in range mode; prevents overlap.',
|
|
357
510
|
isDisabled: 'Whether slider is disabled.',
|
|
358
|
-
htmlName:
|
|
511
|
+
htmlName:
|
|
512
|
+
'HTML name attr; hidden inputs carry the value (two in range mode).',
|
|
359
513
|
isOptional: 'Whether field is optional.',
|
|
360
514
|
isRequired: 'Whether field is required.',
|
|
361
515
|
isLabelHidden: 'Visually hide label.',
|
|
@@ -364,4 +518,4 @@ export const docsDense = {
|
|
|
364
518
|
labelTooltip: 'Tooltip text for info icon next to label.',
|
|
365
519
|
xstyle: 'StyleX layout styles; must be stylex.create() value.',
|
|
366
520
|
},
|
|
367
|
-
};
|
|
521
|
+
};
|