@misoto22/kioku-ui 0.0.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/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/Alert/Alert.d.ts +7 -0
- package/dist/Alert/Alert.doc.d.ts +11 -0
- package/dist/Alert/Alert.doc.js +15 -0
- package/dist/Alert/Alert.js +149 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/index.js +2 -0
- package/dist/AsyncState/AsyncState.d.ts +30 -0
- package/dist/AsyncState/AsyncState.doc.d.ts +16 -0
- package/dist/AsyncState/AsyncState.doc.js +16 -0
- package/dist/AsyncState/AsyncState.js +36 -0
- package/dist/AsyncState/index.d.ts +1 -0
- package/dist/AsyncState/index.js +2 -0
- package/dist/Badge/Badge.d.ts +10 -0
- package/dist/Badge/Badge.doc.d.ts +11 -0
- package/dist/Badge/Badge.doc.js +12 -0
- package/dist/Badge/Badge.js +58 -0
- package/dist/Badge/index.d.ts +1 -0
- package/dist/Badge/index.js +2 -0
- package/dist/Button/Button.d.ts +18 -0
- package/dist/Button/Button.doc.d.ts +11 -0
- package/dist/Button/Button.doc.js +18 -0
- package/dist/Button/Button.js +151 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/index.js +2 -0
- package/dist/Card/Card.d.ts +6 -0
- package/dist/Card/Card.doc.d.ts +11 -0
- package/dist/Card/Card.doc.js +15 -0
- package/dist/Card/Card.js +41 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Card/index.js +2 -0
- package/dist/CardFooter/CardFooter.d.ts +3 -0
- package/dist/CardFooter/CardFooter.doc.d.ts +11 -0
- package/dist/CardFooter/CardFooter.doc.js +12 -0
- package/dist/CardFooter/CardFooter.js +16 -0
- package/dist/CardFooter/index.d.ts +1 -0
- package/dist/CardFooter/index.js +2 -0
- package/dist/CardHeader/CardHeader.d.ts +3 -0
- package/dist/CardHeader/CardHeader.doc.d.ts +11 -0
- package/dist/CardHeader/CardHeader.doc.js +12 -0
- package/dist/CardHeader/CardHeader.js +16 -0
- package/dist/CardHeader/index.d.ts +1 -0
- package/dist/CardHeader/index.js +2 -0
- package/dist/Center/Center.d.ts +3 -0
- package/dist/Center/Center.doc.d.ts +11 -0
- package/dist/Center/Center.doc.js +12 -0
- package/dist/Center/Center.js +15 -0
- package/dist/Center/index.d.ts +1 -0
- package/dist/Center/index.js +2 -0
- package/dist/Divider/Divider.d.ts +3 -0
- package/dist/Divider/Divider.doc.d.ts +11 -0
- package/dist/Divider/Divider.doc.js +12 -0
- package/dist/Divider/Divider.js +12 -0
- package/dist/Divider/index.d.ts +1 -0
- package/dist/Divider/index.js +2 -0
- package/dist/EmptyState/EmptyState.d.ts +11 -0
- package/dist/EmptyState/EmptyState.doc.d.ts +16 -0
- package/dist/EmptyState/EmptyState.doc.js +25 -0
- package/dist/EmptyState/EmptyState.js +55 -0
- package/dist/EmptyState/index.d.ts +1 -0
- package/dist/EmptyState/index.js +2 -0
- package/dist/Field/Field.d.ts +21 -0
- package/dist/Field/Field.doc.d.ts +16 -0
- package/dist/Field/Field.doc.js +28 -0
- package/dist/Field/Field.js +117 -0
- package/dist/Field/index.d.ts +1 -0
- package/dist/Field/index.js +2 -0
- package/dist/Grid/Grid.d.ts +7 -0
- package/dist/Grid/Grid.doc.d.ts +11 -0
- package/dist/Grid/Grid.doc.js +15 -0
- package/dist/Grid/Grid.js +76 -0
- package/dist/Grid/index.d.ts +1 -0
- package/dist/Grid/index.js +2 -0
- package/dist/Heading/Heading.d.ts +293 -0
- package/dist/Heading/Heading.doc.d.ts +16 -0
- package/dist/Heading/Heading.doc.js +19 -0
- package/dist/Heading/Heading.js +47 -0
- package/dist/Heading/index.d.ts +1 -0
- package/dist/Heading/index.js +2 -0
- package/dist/IconButton/IconButton.d.ts +9 -0
- package/dist/IconButton/IconButton.doc.d.ts +16 -0
- package/dist/IconButton/IconButton.doc.js +22 -0
- package/dist/IconButton/IconButton.js +11 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/IconButton/index.js +2 -0
- package/dist/MetricGrid/MetricGrid.d.ts +10 -0
- package/dist/MetricGrid/MetricGrid.doc.d.ts +12 -0
- package/dist/MetricGrid/MetricGrid.doc.js +13 -0
- package/dist/MetricGrid/MetricGrid.js +37 -0
- package/dist/MetricGrid/index.d.ts +1 -0
- package/dist/MetricGrid/index.js +2 -0
- package/dist/Section/Section.d.ts +6 -0
- package/dist/Section/Section.doc.d.ts +11 -0
- package/dist/Section/Section.doc.js +12 -0
- package/dist/Section/Section.js +49 -0
- package/dist/Section/index.d.ts +1 -0
- package/dist/Section/index.js +2 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +31 -0
- package/dist/SegmentedControl/SegmentedControl.doc.d.ts +16 -0
- package/dist/SegmentedControl/SegmentedControl.doc.js +34 -0
- package/dist/SegmentedControl/SegmentedControl.js +108 -0
- package/dist/SegmentedControl/index.d.ts +1 -0
- package/dist/SegmentedControl/index.js +2 -0
- package/dist/Skeleton/Skeleton.d.ts +5 -0
- package/dist/Skeleton/Skeleton.doc.d.ts +11 -0
- package/dist/Skeleton/Skeleton.doc.js +12 -0
- package/dist/Skeleton/Skeleton.js +20 -0
- package/dist/Skeleton/index.d.ts +1 -0
- package/dist/Skeleton/index.js +2 -0
- package/dist/Spinner/Spinner.d.ts +6 -0
- package/dist/Spinner/Spinner.doc.d.ts +12 -0
- package/dist/Spinner/Spinner.doc.js +13 -0
- package/dist/Spinner/Spinner.js +25 -0
- package/dist/Spinner/index.d.ts +1 -0
- package/dist/Spinner/index.js +2 -0
- package/dist/Stack/Stack.d.ts +7 -0
- package/dist/Stack/Stack.doc.d.ts +11 -0
- package/dist/Stack/Stack.doc.js +15 -0
- package/dist/Stack/Stack.js +77 -0
- package/dist/Stack/index.d.ts +1 -0
- package/dist/Stack/index.js +2 -0
- package/dist/StatusDot/StatusDot.d.ts +8 -0
- package/dist/StatusDot/StatusDot.doc.d.ts +16 -0
- package/dist/StatusDot/StatusDot.doc.js +16 -0
- package/dist/StatusDot/StatusDot.js +46 -0
- package/dist/StatusDot/index.d.ts +1 -0
- package/dist/StatusDot/index.js +2 -0
- package/dist/Table/Table.d.ts +20 -0
- package/dist/Table/Table.doc.d.ts +92 -0
- package/dist/Table/Table.doc.js +94 -0
- package/dist/Table/Table.js +205 -0
- package/dist/Table/index.d.ts +1 -0
- package/dist/Table/index.js +2 -0
- package/dist/Text/Text.d.ts +7 -0
- package/dist/Text/Text.doc.d.ts +11 -0
- package/dist/Text/Text.doc.js +15 -0
- package/dist/Text/Text.js +50 -0
- package/dist/Text/index.d.ts +1 -0
- package/dist/Text/index.js +2 -0
- package/dist/TextArea/TextArea.d.ts +16 -0
- package/dist/TextArea/TextArea.doc.d.ts +11 -0
- package/dist/TextArea/TextArea.doc.js +30 -0
- package/dist/TextArea/TextArea.js +47 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/TextArea/index.js +2 -0
- package/dist/TextInput/TextInput.d.ts +16 -0
- package/dist/TextInput/TextInput.doc.d.ts +11 -0
- package/dist/TextInput/TextInput.doc.js +30 -0
- package/dist/TextInput/TextInput.js +49 -0
- package/dist/TextInput/index.d.ts +1 -0
- package/dist/TextInput/index.js +2 -0
- package/dist/Toggle/Toggle.d.ts +16 -0
- package/dist/Toggle/Toggle.doc.d.ts +11 -0
- package/dist/Toggle/Toggle.doc.js +21 -0
- package/dist/Toggle/Toggle.js +64 -0
- package/dist/Toggle/index.d.ts +1 -0
- package/dist/Toggle/index.js +2 -0
- package/dist/VisuallyHidden/VisuallyHidden.d.ts +3 -0
- package/dist/VisuallyHidden/VisuallyHidden.doc.d.ts +11 -0
- package/dist/VisuallyHidden/VisuallyHidden.doc.js +12 -0
- package/dist/VisuallyHidden/VisuallyHidden.js +15 -0
- package/dist/VisuallyHidden/index.d.ts +1 -0
- package/dist/VisuallyHidden/index.js +2 -0
- package/dist/authoring.stylex.d.ts +75 -0
- package/dist/authoring.stylex.js +77 -0
- package/dist/components/Alert.d.ts +7 -0
- package/dist/components/Alert.doc.d.ts +11 -0
- package/dist/components/Alert.doc.js +15 -0
- package/dist/components/Alert.js +149 -0
- package/dist/components/AsyncState.d.ts +30 -0
- package/dist/components/AsyncState.doc.d.ts +16 -0
- package/dist/components/AsyncState.doc.js +16 -0
- package/dist/components/AsyncState.js +36 -0
- package/dist/components/Badge.d.ts +10 -0
- package/dist/components/Badge.doc.d.ts +11 -0
- package/dist/components/Badge.doc.js +12 -0
- package/dist/components/Badge.js +58 -0
- package/dist/components/Button.d.ts +18 -0
- package/dist/components/Button.doc.d.ts +11 -0
- package/dist/components/Button.doc.js +18 -0
- package/dist/components/Button.js +151 -0
- package/dist/components/Card.d.ts +6 -0
- package/dist/components/Card.doc.d.ts +11 -0
- package/dist/components/Card.doc.js +15 -0
- package/dist/components/Card.js +41 -0
- package/dist/components/CardFooter.d.ts +3 -0
- package/dist/components/CardFooter.doc.d.ts +11 -0
- package/dist/components/CardFooter.doc.js +12 -0
- package/dist/components/CardFooter.js +16 -0
- package/dist/components/CardHeader.d.ts +3 -0
- package/dist/components/CardHeader.doc.d.ts +11 -0
- package/dist/components/CardHeader.doc.js +12 -0
- package/dist/components/CardHeader.js +16 -0
- package/dist/components/Center.d.ts +3 -0
- package/dist/components/Center.doc.d.ts +11 -0
- package/dist/components/Center.doc.js +12 -0
- package/dist/components/Center.js +15 -0
- package/dist/components/Divider.d.ts +3 -0
- package/dist/components/Divider.doc.d.ts +11 -0
- package/dist/components/Divider.doc.js +12 -0
- package/dist/components/Divider.js +12 -0
- package/dist/components/EmptyState.d.ts +11 -0
- package/dist/components/EmptyState.doc.d.ts +16 -0
- package/dist/components/EmptyState.doc.js +25 -0
- package/dist/components/EmptyState.js +55 -0
- package/dist/components/Field.d.ts +21 -0
- package/dist/components/Field.doc.d.ts +16 -0
- package/dist/components/Field.doc.js +28 -0
- package/dist/components/Field.js +117 -0
- package/dist/components/Grid.d.ts +7 -0
- package/dist/components/Grid.doc.d.ts +11 -0
- package/dist/components/Grid.doc.js +15 -0
- package/dist/components/Grid.js +76 -0
- package/dist/components/Heading.d.ts +293 -0
- package/dist/components/Heading.doc.d.ts +16 -0
- package/dist/components/Heading.doc.js +19 -0
- package/dist/components/Heading.js +46 -0
- package/dist/components/IconButton.d.ts +9 -0
- package/dist/components/IconButton.doc.d.ts +16 -0
- package/dist/components/IconButton.doc.js +22 -0
- package/dist/components/IconButton.js +11 -0
- package/dist/components/MetricGrid.d.ts +10 -0
- package/dist/components/MetricGrid.doc.d.ts +12 -0
- package/dist/components/MetricGrid.doc.js +13 -0
- package/dist/components/MetricGrid.js +37 -0
- package/dist/components/Section.d.ts +6 -0
- package/dist/components/Section.doc.d.ts +11 -0
- package/dist/components/Section.doc.js +12 -0
- package/dist/components/Section.js +49 -0
- package/dist/components/SegmentedControl.d.ts +31 -0
- package/dist/components/SegmentedControl.doc.d.ts +16 -0
- package/dist/components/SegmentedControl.doc.js +34 -0
- package/dist/components/SegmentedControl.js +108 -0
- package/dist/components/Skeleton.d.ts +5 -0
- package/dist/components/Skeleton.doc.d.ts +11 -0
- package/dist/components/Skeleton.doc.js +12 -0
- package/dist/components/Skeleton.js +20 -0
- package/dist/components/Spinner.d.ts +6 -0
- package/dist/components/Spinner.doc.d.ts +12 -0
- package/dist/components/Spinner.doc.js +13 -0
- package/dist/components/Spinner.js +25 -0
- package/dist/components/Stack.d.ts +7 -0
- package/dist/components/Stack.doc.d.ts +11 -0
- package/dist/components/Stack.doc.js +15 -0
- package/dist/components/Stack.js +77 -0
- package/dist/components/StatusDot.d.ts +8 -0
- package/dist/components/StatusDot.doc.d.ts +16 -0
- package/dist/components/StatusDot.doc.js +16 -0
- package/dist/components/StatusDot.js +46 -0
- package/dist/components/Table.d.ts +20 -0
- package/dist/components/Table.doc.d.ts +92 -0
- package/dist/components/Table.doc.js +94 -0
- package/dist/components/Table.js +205 -0
- package/dist/components/Text.d.ts +7 -0
- package/dist/components/Text.doc.d.ts +11 -0
- package/dist/components/Text.doc.js +15 -0
- package/dist/components/Text.js +50 -0
- package/dist/components/TextArea.d.ts +16 -0
- package/dist/components/TextArea.doc.d.ts +11 -0
- package/dist/components/TextArea.doc.js +30 -0
- package/dist/components/TextArea.js +47 -0
- package/dist/components/TextInput.d.ts +16 -0
- package/dist/components/TextInput.doc.d.ts +11 -0
- package/dist/components/TextInput.doc.js +30 -0
- package/dist/components/TextInput.js +49 -0
- package/dist/components/Toggle.d.ts +16 -0
- package/dist/components/Toggle.doc.d.ts +11 -0
- package/dist/components/Toggle.doc.js +21 -0
- package/dist/components/Toggle.js +64 -0
- package/dist/components/VisuallyHidden.d.ts +3 -0
- package/dist/components/VisuallyHidden.doc.d.ts +11 -0
- package/dist/components/VisuallyHidden.doc.js +12 -0
- package/dist/components/VisuallyHidden.js +15 -0
- package/dist/components/index.d.ts +27 -0
- package/dist/components/index.js +28 -0
- package/dist/docs/index.d.ts +33 -0
- package/dist/docs/index.js +33 -0
- package/dist/docs/types.d.ts +15 -0
- package/dist/docs/types.js +25 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/navigation/LinkProvider.d.ts +9 -0
- package/dist/navigation/LinkProvider.doc.d.ts +27 -0
- package/dist/navigation/LinkProvider.doc.js +27 -0
- package/dist/navigation/LinkProvider.js +22 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +2 -0
- package/dist/styles/global.stylex.d.ts +20 -0
- package/dist/styles/global.stylex.js +22 -0
- package/dist/styles/index.css +14 -0
- package/dist/styles/reset.css +35 -0
- package/dist/styles/stylex.css +212 -0
- package/dist/theme/Theme.d.ts +24 -0
- package/dist/theme/Theme.doc.d.ts +16 -0
- package/dist/theme/Theme.doc.js +27 -0
- package/dist/theme/Theme.js +110 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/tokens/contracts.d.ts +140 -0
- package/dist/tokens/contracts.js +102 -0
- package/package.json +93 -0
- package/src/Alert/Alert.doc.ts +21 -0
- package/src/Alert/Alert.tsx +129 -0
- package/src/Alert/index.ts +1 -0
- package/src/AsyncState/AsyncState.doc.ts +21 -0
- package/src/AsyncState/AsyncState.tsx +75 -0
- package/src/AsyncState/index.ts +5 -0
- package/src/Badge/Badge.doc.ts +15 -0
- package/src/Badge/Badge.tsx +58 -0
- package/src/Badge/index.ts +6 -0
- package/src/Button/Button.doc.ts +17 -0
- package/src/Button/Button.tsx +176 -0
- package/src/Button/index.ts +7 -0
- package/src/Card/Card.doc.ts +22 -0
- package/src/Card/Card.tsx +44 -0
- package/src/Card/index.ts +1 -0
- package/src/CardFooter/CardFooter.doc.ts +12 -0
- package/src/CardFooter/CardFooter.tsx +27 -0
- package/src/CardFooter/index.ts +1 -0
- package/src/CardHeader/CardHeader.doc.ts +12 -0
- package/src/CardHeader/CardHeader.tsx +27 -0
- package/src/CardHeader/index.ts +1 -0
- package/src/Center/Center.doc.ts +12 -0
- package/src/Center/Center.tsx +20 -0
- package/src/Center/index.ts +1 -0
- package/src/Divider/Divider.doc.ts +12 -0
- package/src/Divider/Divider.tsx +20 -0
- package/src/Divider/index.ts +1 -0
- package/src/EmptyState/EmptyState.doc.ts +31 -0
- package/src/EmptyState/EmptyState.tsx +87 -0
- package/src/EmptyState/index.ts +6 -0
- package/src/Field/Field.doc.ts +34 -0
- package/src/Field/Field.tsx +126 -0
- package/src/Field/index.ts +6 -0
- package/src/Grid/Grid.doc.ts +16 -0
- package/src/Grid/Grid.tsx +54 -0
- package/src/Grid/index.ts +1 -0
- package/src/Heading/Heading.doc.ts +26 -0
- package/src/Heading/Heading.tsx +48 -0
- package/src/Heading/index.ts +1 -0
- package/src/IconButton/IconButton.doc.ts +24 -0
- package/src/IconButton/IconButton.tsx +18 -0
- package/src/IconButton/index.ts +1 -0
- package/src/MetricGrid/MetricGrid.doc.ts +19 -0
- package/src/MetricGrid/MetricGrid.tsx +72 -0
- package/src/MetricGrid/index.ts +5 -0
- package/src/Section/Section.doc.ts +12 -0
- package/src/Section/Section.tsx +38 -0
- package/src/Section/index.ts +1 -0
- package/src/SegmentedControl/SegmentedControl.doc.ts +51 -0
- package/src/SegmentedControl/SegmentedControl.tsx +238 -0
- package/src/SegmentedControl/index.ts +5 -0
- package/src/Skeleton/Skeleton.doc.ts +15 -0
- package/src/Skeleton/Skeleton.tsx +45 -0
- package/src/Skeleton/index.ts +1 -0
- package/src/Spinner/Spinner.doc.ts +19 -0
- package/src/Spinner/Spinner.tsx +47 -0
- package/src/Spinner/index.ts +1 -0
- package/src/Stack/Stack.doc.ts +13 -0
- package/src/Stack/Stack.tsx +57 -0
- package/src/Stack/index.ts +1 -0
- package/src/StatusDot/StatusDot.doc.ts +23 -0
- package/src/StatusDot/StatusDot.tsx +35 -0
- package/src/StatusDot/index.ts +1 -0
- package/src/Table/Table.doc.ts +104 -0
- package/src/Table/Table.tsx +222 -0
- package/src/Table/index.ts +18 -0
- package/src/Text/Text.doc.ts +17 -0
- package/src/Text/Text.tsx +43 -0
- package/src/Text/index.ts +1 -0
- package/src/TextArea/TextArea.doc.ts +43 -0
- package/src/TextArea/TextArea.tsx +119 -0
- package/src/TextArea/index.ts +1 -0
- package/src/TextInput/TextInput.doc.ts +43 -0
- package/src/TextInput/TextInput.tsx +122 -0
- package/src/TextInput/index.ts +1 -0
- package/src/Toggle/Toggle.doc.ts +30 -0
- package/src/Toggle/Toggle.tsx +139 -0
- package/src/Toggle/index.ts +1 -0
- package/src/VisuallyHidden/VisuallyHidden.doc.ts +18 -0
- package/src/VisuallyHidden/VisuallyHidden.tsx +28 -0
- package/src/VisuallyHidden/index.ts +1 -0
- package/src/authoring.stylex.ts +76 -0
- package/src/docs/index.ts +122 -0
- package/src/docs/types.ts +51 -0
- package/src/index.ts +102 -0
- package/src/navigation/LinkProvider.doc.ts +32 -0
- package/src/navigation/LinkProvider.tsx +32 -0
- package/src/navigation/index.ts +7 -0
- package/src/styles/global.stylex.ts +23 -0
- package/src/styles/index.css +14 -0
- package/src/styles/reset.css +35 -0
- package/src/theme/Theme.doc.ts +38 -0
- package/src/theme/Theme.tsx +195 -0
- package/src/theme/index.ts +9 -0
- package/src/tokens/contracts.ts +210 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const buttonDoc = {
|
|
4
|
+
name: 'Button',
|
|
5
|
+
description: 'Triggers an action through native button semantics.',
|
|
6
|
+
props: [
|
|
7
|
+
{
|
|
8
|
+
name: 'loading',
|
|
9
|
+
description: 'Shows progress and disables native activation.',
|
|
10
|
+
},
|
|
11
|
+
{name: 'size', description: 'Selects the fixed control height.'},
|
|
12
|
+
{name: 'variant', description: 'Selects a semantic visual emphasis.'},
|
|
13
|
+
],
|
|
14
|
+
inheritedProps: ['ButtonHTMLAttributes<HTMLButtonElement> except className'],
|
|
15
|
+
example: '<Button onClick={save}>Save</Button>',
|
|
16
|
+
storyId: 'core-button--default',
|
|
17
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {ButtonHTMLAttributes} from 'react';
|
|
3
|
+
|
|
4
|
+
import {semanticTokens} from '../authoring.stylex.js';
|
|
5
|
+
import {SpinnerVisual} from '../Spinner/index.js';
|
|
6
|
+
|
|
7
|
+
const styles = stylex.create({
|
|
8
|
+
base: {
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
boxSizing: 'border-box',
|
|
11
|
+
borderRadius: semanticTokens.radiusElement,
|
|
12
|
+
borderStyle: semanticTokens.borderStyle,
|
|
13
|
+
borderWidth: semanticTokens.borderWidth,
|
|
14
|
+
display: 'inline-flex',
|
|
15
|
+
fontFamily: semanticTokens.fontFamilyBody,
|
|
16
|
+
fontWeight: semanticTokens.fontWeightMedium,
|
|
17
|
+
gap: semanticTokens.spacingSm,
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
lineHeight: semanticTokens.lineHeightBody,
|
|
20
|
+
position: 'relative',
|
|
21
|
+
':disabled': {
|
|
22
|
+
backgroundColor: semanticTokens.colorDisabledSurface,
|
|
23
|
+
borderColor: semanticTokens.borderDisabled,
|
|
24
|
+
color: semanticTokens.colorDisabledText,
|
|
25
|
+
},
|
|
26
|
+
':focus-visible': {
|
|
27
|
+
outlineColor: semanticTokens.colorFocus,
|
|
28
|
+
outlineOffset: semanticTokens.focusOffset,
|
|
29
|
+
outlineStyle: semanticTokens.borderStyle,
|
|
30
|
+
outlineWidth: semanticTokens.focusWidth,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
sm: {
|
|
34
|
+
fontSize: semanticTokens.fontSizeSm,
|
|
35
|
+
height: semanticTokens.sizeControlSm,
|
|
36
|
+
paddingInline: semanticTokens.spacingSm,
|
|
37
|
+
},
|
|
38
|
+
md: {
|
|
39
|
+
fontSize: semanticTokens.fontSizeMd,
|
|
40
|
+
height: semanticTokens.sizeControlMd,
|
|
41
|
+
paddingInline: semanticTokens.spacingMd,
|
|
42
|
+
},
|
|
43
|
+
lg: {
|
|
44
|
+
fontSize: semanticTokens.fontSizeMd,
|
|
45
|
+
height: semanticTokens.sizeControlLg,
|
|
46
|
+
paddingInline: semanticTokens.spacingLg,
|
|
47
|
+
},
|
|
48
|
+
primary: {
|
|
49
|
+
backgroundColor: semanticTokens.colorAccent,
|
|
50
|
+
borderColor: semanticTokens.colorAccent,
|
|
51
|
+
color: semanticTokens.colorTextOnAccent,
|
|
52
|
+
':hover:not(:disabled):not(:active)': {
|
|
53
|
+
backgroundColor: semanticTokens.colorAccentHover,
|
|
54
|
+
borderColor: semanticTokens.colorAccentHover,
|
|
55
|
+
},
|
|
56
|
+
':active:not(:disabled)': {
|
|
57
|
+
backgroundColor: semanticTokens.colorAccentActive,
|
|
58
|
+
borderColor: semanticTokens.colorAccentActive,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
secondary: {
|
|
62
|
+
backgroundColor: semanticTokens.colorSurface,
|
|
63
|
+
borderColor: semanticTokens.borderStrong,
|
|
64
|
+
color: semanticTokens.colorText,
|
|
65
|
+
':hover:not(:disabled):not(:active)': {
|
|
66
|
+
backgroundColor: semanticTokens.colorOverlayHover,
|
|
67
|
+
borderColor: semanticTokens.borderInteractive,
|
|
68
|
+
},
|
|
69
|
+
':active:not(:disabled)': {
|
|
70
|
+
backgroundColor: semanticTokens.colorOverlayActive,
|
|
71
|
+
borderColor: semanticTokens.borderInteractive,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
ghost: {
|
|
75
|
+
backgroundColor: 'transparent',
|
|
76
|
+
borderColor: 'transparent',
|
|
77
|
+
color: semanticTokens.colorText,
|
|
78
|
+
':hover:not(:disabled):not(:active)': {
|
|
79
|
+
backgroundColor: semanticTokens.colorOverlayHover,
|
|
80
|
+
},
|
|
81
|
+
':active:not(:disabled)': {
|
|
82
|
+
backgroundColor: semanticTokens.colorOverlayActive,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
destructive: {
|
|
86
|
+
backgroundColor: semanticTokens.statusDangerSurface,
|
|
87
|
+
borderColor: semanticTokens.statusDangerText,
|
|
88
|
+
color: semanticTokens.statusDangerText,
|
|
89
|
+
':hover:not(:disabled):not(:active)': {
|
|
90
|
+
backgroundImage: `linear-gradient(${semanticTokens.colorOverlayHover}, ${semanticTokens.colorOverlayHover})`,
|
|
91
|
+
},
|
|
92
|
+
':active:not(:disabled)': {
|
|
93
|
+
backgroundImage: `linear-gradient(${semanticTokens.colorOverlayActive}, ${semanticTokens.colorOverlayActive})`,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
loading: {cursor: 'progress'},
|
|
97
|
+
iconOnly: {paddingInline: 0},
|
|
98
|
+
iconSm: {width: semanticTokens.sizeControlSm},
|
|
99
|
+
iconMd: {width: semanticTokens.sizeControlMd},
|
|
100
|
+
iconLg: {width: semanticTokens.sizeControlLg},
|
|
101
|
+
iconHitTarget: {
|
|
102
|
+
'::before': {
|
|
103
|
+
content: '',
|
|
104
|
+
height: semanticTokens.sizeHitTarget,
|
|
105
|
+
insetBlockStart: '50%',
|
|
106
|
+
insetInlineStart: '50%',
|
|
107
|
+
position: 'absolute',
|
|
108
|
+
transform: 'translate(-50%, -50%)',
|
|
109
|
+
width: semanticTokens.sizeHitTarget,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const iconSizes = {
|
|
115
|
+
sm: styles.iconSm,
|
|
116
|
+
md: styles.iconMd,
|
|
117
|
+
lg: styles.iconLg,
|
|
118
|
+
} satisfies Record<ControlSize, (typeof styles)[keyof typeof styles]>;
|
|
119
|
+
|
|
120
|
+
/** Visual sizes shared by native action controls. */
|
|
121
|
+
export type ControlSize = 'sm' | 'md' | 'lg';
|
|
122
|
+
|
|
123
|
+
/** Semantic emphasis variants shared by native action controls. */
|
|
124
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'destructive';
|
|
125
|
+
|
|
126
|
+
/** Props for a text-labelled native action button. */
|
|
127
|
+
export interface ButtonProps extends Omit<
|
|
128
|
+
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
129
|
+
'className'
|
|
130
|
+
> {
|
|
131
|
+
readonly loading?: boolean;
|
|
132
|
+
readonly size?: ControlSize;
|
|
133
|
+
readonly variant?: ButtonVariant;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface ActionControlProps extends ButtonProps {
|
|
137
|
+
readonly iconOnly?: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** @internal Shared native implementation for Button and IconButton. */
|
|
141
|
+
export function ActionControl({
|
|
142
|
+
'aria-busy': ariaBusy,
|
|
143
|
+
children,
|
|
144
|
+
disabled,
|
|
145
|
+
iconOnly = false,
|
|
146
|
+
loading = false,
|
|
147
|
+
size = 'md',
|
|
148
|
+
type = 'button',
|
|
149
|
+
variant = 'primary',
|
|
150
|
+
...props
|
|
151
|
+
}: ActionControlProps) {
|
|
152
|
+
return (
|
|
153
|
+
<button
|
|
154
|
+
{...props}
|
|
155
|
+
aria-busy={loading ? 'true' : ariaBusy}
|
|
156
|
+
disabled={disabled || loading}
|
|
157
|
+
{...stylex.props(
|
|
158
|
+
styles.base,
|
|
159
|
+
styles[size],
|
|
160
|
+
styles[variant],
|
|
161
|
+
loading && styles.loading,
|
|
162
|
+
iconOnly && styles.iconOnly,
|
|
163
|
+
iconOnly && iconSizes[size],
|
|
164
|
+
iconOnly && styles.iconHitTarget,
|
|
165
|
+
)}
|
|
166
|
+
type={type}
|
|
167
|
+
>
|
|
168
|
+
{loading ? <SpinnerVisual /> : null}
|
|
169
|
+
{iconOnly && loading ? null : children}
|
|
170
|
+
</button>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function Button(props: ButtonProps) {
|
|
175
|
+
return <ActionControl {...props} />;
|
|
176
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const cardDoc = {
|
|
4
|
+
name: 'Card',
|
|
5
|
+
description:
|
|
6
|
+
'Groups self-contained content in a token-backed article surface.',
|
|
7
|
+
props: [
|
|
8
|
+
{
|
|
9
|
+
name: 'children',
|
|
10
|
+
description: 'The self-contained article content.',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'elevation',
|
|
14
|
+
description:
|
|
15
|
+
'Optional boundary treatment: "none" uses a border; "low" and "medium" use only the matching elevation.',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
inheritedProps: ['HTMLAttributes<HTMLElement> except className and children'],
|
|
19
|
+
example:
|
|
20
|
+
'<Card aria-label="Summary" elevation="none"><Text>Content</Text></Card>',
|
|
21
|
+
storyId: 'core-card--default',
|
|
22
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {HTMLAttributes} from 'react';
|
|
3
|
+
|
|
4
|
+
import {semanticTokens} from '../authoring.stylex.js';
|
|
5
|
+
|
|
6
|
+
const styles = stylex.create({
|
|
7
|
+
base: {
|
|
8
|
+
backgroundColor: semanticTokens.colorSurface,
|
|
9
|
+
borderRadius: semanticTokens.radiusContainer,
|
|
10
|
+
color: semanticTokens.colorText,
|
|
11
|
+
padding: semanticTokens.spacingXl,
|
|
12
|
+
},
|
|
13
|
+
none: {
|
|
14
|
+
borderColor: semanticTokens.borderDefault,
|
|
15
|
+
borderStyle: semanticTokens.borderStyle,
|
|
16
|
+
borderWidth: semanticTokens.borderWidth,
|
|
17
|
+
boxShadow: 'none',
|
|
18
|
+
},
|
|
19
|
+
low: {
|
|
20
|
+
borderStyle: 'none',
|
|
21
|
+
boxShadow: semanticTokens.elevationLow,
|
|
22
|
+
},
|
|
23
|
+
medium: {
|
|
24
|
+
borderStyle: 'none',
|
|
25
|
+
boxShadow: semanticTokens.elevationMedium,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type CardElevation = 'none' | 'low' | 'medium';
|
|
30
|
+
|
|
31
|
+
export interface CardProps extends Omit<
|
|
32
|
+
HTMLAttributes<HTMLElement>,
|
|
33
|
+
'className'
|
|
34
|
+
> {
|
|
35
|
+
readonly elevation?: CardElevation;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function Card({children, elevation = 'none', ...props}: CardProps) {
|
|
39
|
+
return (
|
|
40
|
+
<article {...props} {...stylex.props(styles.base, styles[elevation])}>
|
|
41
|
+
{children}
|
|
42
|
+
</article>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {Card, type CardElevation, type CardProps} from './Card.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const cardFooterDoc = {
|
|
4
|
+
name: 'CardFooter',
|
|
5
|
+
description:
|
|
6
|
+
'Provides a padded native footer with an inward divider when composed directly inside a Card.',
|
|
7
|
+
props: [{name: 'children', description: 'The footer content.'}],
|
|
8
|
+
inheritedProps: ['HTMLAttributes<HTMLElement> except className and children'],
|
|
9
|
+
example:
|
|
10
|
+
'<Card><Text>Content</Text><CardFooter><Text>Updated now</Text></CardFooter></Card>',
|
|
11
|
+
storyId: 'core-card--card-footer',
|
|
12
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {HTMLAttributes} from 'react';
|
|
3
|
+
|
|
4
|
+
import {semanticTokens} from '../authoring.stylex.js';
|
|
5
|
+
|
|
6
|
+
const styles = stylex.create({
|
|
7
|
+
base: {
|
|
8
|
+
borderBlockStartColor: semanticTokens.borderDefault,
|
|
9
|
+
borderBlockStartStyle: semanticTokens.borderStyle,
|
|
10
|
+
borderBlockStartWidth: semanticTokens.borderWidth,
|
|
11
|
+
marginBlockEnd: `calc(-1 * ${semanticTokens.spacingXl})`,
|
|
12
|
+
marginBlockStart: semanticTokens.spacingXl,
|
|
13
|
+
marginInline: `calc(-1 * ${semanticTokens.spacingXl})`,
|
|
14
|
+
paddingBlock: semanticTokens.spacingLg,
|
|
15
|
+
paddingInline: semanticTokens.spacingXl,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type CardFooterProps = Omit<HTMLAttributes<HTMLElement>, 'className'>;
|
|
20
|
+
|
|
21
|
+
export function CardFooter({children, ...props}: CardFooterProps) {
|
|
22
|
+
return (
|
|
23
|
+
<footer {...props} {...stylex.props(styles.base)}>
|
|
24
|
+
{children}
|
|
25
|
+
</footer>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {CardFooter, type CardFooterProps} from './CardFooter.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const cardHeaderDoc = {
|
|
4
|
+
name: 'CardHeader',
|
|
5
|
+
description:
|
|
6
|
+
'Provides a padded native header with an inward divider when composed directly inside a Card.',
|
|
7
|
+
props: [{name: 'children', description: 'The header content.'}],
|
|
8
|
+
inheritedProps: ['HTMLAttributes<HTMLElement> except className and children'],
|
|
9
|
+
example:
|
|
10
|
+
'<Card><CardHeader><Heading level={2}>Card title</Heading></CardHeader><Text>Content</Text></Card>',
|
|
11
|
+
storyId: 'core-card--card-header',
|
|
12
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {HTMLAttributes} from 'react';
|
|
3
|
+
|
|
4
|
+
import {semanticTokens} from '../authoring.stylex.js';
|
|
5
|
+
|
|
6
|
+
const styles = stylex.create({
|
|
7
|
+
base: {
|
|
8
|
+
borderBlockEndColor: semanticTokens.borderDefault,
|
|
9
|
+
borderBlockEndStyle: semanticTokens.borderStyle,
|
|
10
|
+
borderBlockEndWidth: semanticTokens.borderWidth,
|
|
11
|
+
marginBlockEnd: semanticTokens.spacingXl,
|
|
12
|
+
marginBlockStart: `calc(-1 * ${semanticTokens.spacingXl})`,
|
|
13
|
+
marginInline: `calc(-1 * ${semanticTokens.spacingXl})`,
|
|
14
|
+
paddingBlock: semanticTokens.spacingLg,
|
|
15
|
+
paddingInline: semanticTokens.spacingXl,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type CardHeaderProps = Omit<HTMLAttributes<HTMLElement>, 'className'>;
|
|
20
|
+
|
|
21
|
+
export function CardHeader({children, ...props}: CardHeaderProps) {
|
|
22
|
+
return (
|
|
23
|
+
<header {...props} {...stylex.props(styles.base)}>
|
|
24
|
+
{children}
|
|
25
|
+
</header>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {CardHeader, type CardHeaderProps} from './CardHeader.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const centerDoc = {
|
|
4
|
+
name: 'Center',
|
|
5
|
+
description: 'Centers child content on both layout axes.',
|
|
6
|
+
props: [{name: 'children', description: 'The content to center.'}],
|
|
7
|
+
inheritedProps: [
|
|
8
|
+
'HTMLAttributes<HTMLDivElement> except className and children',
|
|
9
|
+
],
|
|
10
|
+
example: '<Center><Text>Centered content</Text></Center>',
|
|
11
|
+
storyId: 'core-center--default',
|
|
12
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {HTMLAttributes} from 'react';
|
|
3
|
+
|
|
4
|
+
const styles = stylex.create({
|
|
5
|
+
base: {
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
display: 'flex',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type CenterProps = Omit<HTMLAttributes<HTMLDivElement>, 'className'>;
|
|
13
|
+
|
|
14
|
+
export function Center({children, ...props}: CenterProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div {...props} {...stylex.props(styles.base)}>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {Center, type CenterProps} from './Center.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const dividerDoc = {
|
|
4
|
+
name: 'Divider',
|
|
5
|
+
description: 'Renders a token-backed native horizontal separator.',
|
|
6
|
+
props: [
|
|
7
|
+
{name: 'aria-label', description: 'Optional accessible separator label.'},
|
|
8
|
+
],
|
|
9
|
+
inheritedProps: ['HTMLAttributes<HTMLHRElement> except className'],
|
|
10
|
+
example: '<Divider aria-label="Separates summary from details" />',
|
|
11
|
+
storyId: 'core-divider--default',
|
|
12
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {HTMLAttributes} from 'react';
|
|
3
|
+
|
|
4
|
+
import {semanticTokens} from '../authoring.stylex.js';
|
|
5
|
+
|
|
6
|
+
const styles = stylex.create({
|
|
7
|
+
base: {
|
|
8
|
+
border: 0,
|
|
9
|
+
borderBlockStartColor: semanticTokens.borderDefault,
|
|
10
|
+
borderBlockStartStyle: semanticTokens.borderStyle,
|
|
11
|
+
borderBlockStartWidth: semanticTokens.borderWidth,
|
|
12
|
+
margin: 0,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type DividerProps = Omit<HTMLAttributes<HTMLHRElement>, 'className'>;
|
|
17
|
+
|
|
18
|
+
export function Divider(props: DividerProps) {
|
|
19
|
+
return <hr {...props} {...stylex.props(styles.base)} />;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {Divider, type DividerProps} from './Divider.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const emptyStateDoc = {
|
|
4
|
+
name: 'EmptyState',
|
|
5
|
+
description:
|
|
6
|
+
'Presents an announced empty result with optional detail and action.',
|
|
7
|
+
props: [
|
|
8
|
+
{
|
|
9
|
+
name: 'action',
|
|
10
|
+
description: 'Provides an optional consumer-owned recovery action.',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'detail',
|
|
14
|
+
description: 'Provides optional supporting empty-state content.',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'size',
|
|
18
|
+
description: 'Adjusts container padding and grouping rhythm.',
|
|
19
|
+
},
|
|
20
|
+
{name: 'title', description: 'Names the empty state.', required: true},
|
|
21
|
+
{
|
|
22
|
+
name: 'visual',
|
|
23
|
+
description:
|
|
24
|
+
'Provides optional consumer-owned visual content before the copy; consumers own its accessible semantics.',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
inheritedProps: ['HTMLAttributes<HTMLDivElement> except className and title'],
|
|
28
|
+
example:
|
|
29
|
+
'<EmptyState title="No results" detail="Try another query." size="compact" />',
|
|
30
|
+
storyId: 'core-empty-state--default',
|
|
31
|
+
} satisfies ComponentDoc;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type {HTMLAttributes, ReactNode} from 'react';
|
|
3
|
+
|
|
4
|
+
import {semanticTokens} from '../authoring.stylex.js';
|
|
5
|
+
|
|
6
|
+
const copyWidth = `calc(${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl} + ${semanticTokens.spacing2xl})`;
|
|
7
|
+
|
|
8
|
+
const styles = stylex.create({
|
|
9
|
+
root: {
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
color: semanticTokens.colorText,
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
fontFamily: semanticTokens.fontFamilyBody,
|
|
15
|
+
gap: semanticTokens.spacingMd,
|
|
16
|
+
padding: semanticTokens.spacing2xl,
|
|
17
|
+
textAlign: 'center',
|
|
18
|
+
},
|
|
19
|
+
compact: {
|
|
20
|
+
gap: semanticTokens.spacingSm,
|
|
21
|
+
padding: semanticTokens.spacingLg,
|
|
22
|
+
},
|
|
23
|
+
title: {
|
|
24
|
+
fontFamily: semanticTokens.fontFamilyHeading,
|
|
25
|
+
fontSize: semanticTokens.fontSizeLg,
|
|
26
|
+
fontWeight: semanticTokens.fontWeightStrong,
|
|
27
|
+
margin: 0,
|
|
28
|
+
maxInlineSize: copyWidth,
|
|
29
|
+
},
|
|
30
|
+
detail: {
|
|
31
|
+
fontSize: semanticTokens.fontSizeMd,
|
|
32
|
+
lineHeight: semanticTokens.lineHeightBody,
|
|
33
|
+
margin: 0,
|
|
34
|
+
maxInlineSize: copyWidth,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type EmptyStateSize = 'compact' | 'default';
|
|
39
|
+
|
|
40
|
+
export interface EmptyStateProps extends Omit<
|
|
41
|
+
HTMLAttributes<HTMLDivElement>,
|
|
42
|
+
'className' | 'title'
|
|
43
|
+
> {
|
|
44
|
+
readonly action?: ReactNode;
|
|
45
|
+
readonly detail?: ReactNode;
|
|
46
|
+
readonly size?: EmptyStateSize;
|
|
47
|
+
readonly title: ReactNode;
|
|
48
|
+
readonly visual?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function EmptyState({
|
|
52
|
+
action,
|
|
53
|
+
detail,
|
|
54
|
+
size = 'default',
|
|
55
|
+
title,
|
|
56
|
+
visual,
|
|
57
|
+
...props
|
|
58
|
+
}: EmptyStateProps) {
|
|
59
|
+
return (
|
|
60
|
+
<div {...props} aria-live="polite" role="status">
|
|
61
|
+
<EmptyStateContent
|
|
62
|
+
action={action}
|
|
63
|
+
detail={detail}
|
|
64
|
+
size={size}
|
|
65
|
+
title={title}
|
|
66
|
+
visual={visual}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function EmptyStateContent({
|
|
73
|
+
action,
|
|
74
|
+
detail,
|
|
75
|
+
size = 'default',
|
|
76
|
+
title,
|
|
77
|
+
visual,
|
|
78
|
+
}: EmptyStateProps) {
|
|
79
|
+
return (
|
|
80
|
+
<div {...stylex.props(styles.root, size === 'compact' && styles.compact)}>
|
|
81
|
+
{visual}
|
|
82
|
+
<p {...stylex.props(styles.title)}>{title}</p>
|
|
83
|
+
{detail ? <p {...stylex.props(styles.detail)}>{detail}</p> : null}
|
|
84
|
+
{action}
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type {ComponentDoc} from '../docs/types.js';
|
|
2
|
+
|
|
3
|
+
export const fieldDoc = {
|
|
4
|
+
name: 'Field',
|
|
5
|
+
description:
|
|
6
|
+
'Connects a form control to its label, description, and validation status.',
|
|
7
|
+
props: [
|
|
8
|
+
{
|
|
9
|
+
name: 'controlId',
|
|
10
|
+
description: 'Overrides the generated form-control identifier.',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'description',
|
|
14
|
+
description: 'Adds supporting text to the control description.',
|
|
15
|
+
},
|
|
16
|
+
{name: 'label', description: 'Provides the control label.', required: true},
|
|
17
|
+
{
|
|
18
|
+
name: 'necessity',
|
|
19
|
+
description:
|
|
20
|
+
'Displays required or optional metadata and supplies the native required default to supported text controls.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'status',
|
|
24
|
+
description: 'Adds validation or status text to the control description.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'statusTone',
|
|
28
|
+
description: 'Selects status color, announcement, and invalid semantics.',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
inheritedProps: ['HTMLAttributes<HTMLDivElement> except className'],
|
|
32
|
+
example: '<Field label="Email" necessity="required"><TextInput /></Field>',
|
|
33
|
+
storyId: 'core-field--default',
|
|
34
|
+
} satisfies ComponentDoc;
|