@cratis/scene.blueprint.default 4.31.0 → 4.32.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/ComponentName.ts +12 -0
- package/defaultBlueprint.ts +2 -1
- package/defaultBlueprintComponentMetadata.ts +2 -0
- package/defaultBlueprintComponents.ts +5 -0
- package/dist/cjs/ComponentName.js +4 -0
- package/dist/cjs/ComponentName.js.map +1 -1
- package/dist/cjs/defaultBlueprint.js +9 -5
- package/dist/cjs/defaultBlueprint.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponentMetadata.js +8 -0
- package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponents.js +13 -1
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
- package/dist/cjs/foundation/ActionButton.js +33 -0
- package/dist/cjs/foundation/ActionButton.js.map +1 -0
- package/dist/cjs/foundation/ComponentState.js +42 -0
- package/dist/cjs/foundation/ComponentState.js.map +1 -0
- package/dist/cjs/foundation/EmptyState.js +31 -0
- package/dist/cjs/foundation/EmptyState.js.map +1 -0
- package/dist/cjs/foundation/FoundationIcon.js +58 -0
- package/dist/cjs/foundation/FoundationIcon.js.map +1 -0
- package/dist/cjs/foundation/FoundationStates.js +62 -0
- package/dist/cjs/foundation/FoundationStates.js.map +1 -0
- package/dist/cjs/foundation/PermissionRule.js +22 -0
- package/dist/cjs/foundation/PermissionRule.js.map +1 -0
- package/dist/cjs/foundation/StatCard.js +61 -0
- package/dist/cjs/foundation/StatCard.js.map +1 -0
- package/dist/cjs/foundation/StateFrame.js +200 -0
- package/dist/cjs/foundation/StateFrame.js.map +1 -0
- package/dist/cjs/foundation/StatusChip.js +64 -0
- package/dist/cjs/foundation/StatusChip.js.map +1 -0
- package/dist/cjs/foundation/TrendChip.js +93 -0
- package/dist/cjs/foundation/TrendChip.js.map +1 -0
- package/dist/cjs/foundation/formatting.js +85 -0
- package/dist/cjs/foundation/formatting.js.map +1 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js +41 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -0
- package/dist/cjs/foundation/foundationDescriptors.js +232 -0
- package/dist/cjs/foundation/foundationDescriptors.js.map +1 -0
- package/dist/cjs/foundation/foundationSamples.js +71 -0
- package/dist/cjs/foundation/foundationSamples.js.map +1 -0
- package/dist/cjs/foundation/foundationStrings.js +105 -0
- package/dist/cjs/foundation/foundationStrings.js.map +1 -0
- package/dist/cjs/index.js +52 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/themes/dark.js +9 -1
- package/dist/cjs/themes/dark.js.map +1 -1
- package/dist/cjs/themes/light.js +10 -2
- package/dist/cjs/themes/light.js.map +1 -1
- package/dist/esm/ComponentName.d.ts +5 -1
- package/dist/esm/ComponentName.d.ts.map +1 -1
- package/dist/esm/ComponentName.js +4 -0
- package/dist/esm/ComponentName.js.map +1 -1
- package/dist/esm/defaultBlueprint.d.ts.map +1 -1
- package/dist/esm/defaultBlueprint.js +9 -5
- package/dist/esm/defaultBlueprint.js.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.js +8 -0
- package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponents.js +13 -1
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/ActionButton.d.ts +13 -0
- package/dist/esm/foundation/ActionButton.d.ts.map +1 -0
- package/dist/esm/foundation/ActionButton.js +31 -0
- package/dist/esm/foundation/ActionButton.js.map +1 -0
- package/dist/esm/foundation/ComponentState.d.ts +12 -0
- package/dist/esm/foundation/ComponentState.d.ts.map +1 -0
- package/dist/esm/foundation/ComponentState.js +38 -0
- package/dist/esm/foundation/ComponentState.js.map +1 -0
- package/dist/esm/foundation/EmptyState.d.ts +3 -0
- package/dist/esm/foundation/EmptyState.d.ts.map +1 -0
- package/dist/esm/foundation/EmptyState.js +29 -0
- package/dist/esm/foundation/EmptyState.js.map +1 -0
- package/dist/esm/foundation/Foundation.stories.d.ts +21 -0
- package/dist/esm/foundation/Foundation.stories.d.ts.map +1 -0
- package/dist/esm/foundation/Foundation.stories.js +18 -0
- package/dist/esm/foundation/Foundation.stories.js.map +1 -0
- package/dist/esm/foundation/FoundationIcon.d.ts +7 -0
- package/dist/esm/foundation/FoundationIcon.d.ts.map +1 -0
- package/dist/esm/foundation/FoundationIcon.js +55 -0
- package/dist/esm/foundation/FoundationIcon.js.map +1 -0
- package/dist/esm/foundation/FoundationStates.d.ts +8 -0
- package/dist/esm/foundation/FoundationStates.d.ts.map +1 -0
- package/dist/esm/foundation/FoundationStates.js +60 -0
- package/dist/esm/foundation/FoundationStates.js.map +1 -0
- package/dist/esm/foundation/PermissionRule.d.ts +8 -0
- package/dist/esm/foundation/PermissionRule.d.ts.map +1 -0
- package/dist/esm/foundation/PermissionRule.js +19 -0
- package/dist/esm/foundation/PermissionRule.js.map +1 -0
- package/dist/esm/foundation/StatCard.d.ts +3 -0
- package/dist/esm/foundation/StatCard.d.ts.map +1 -0
- package/dist/esm/foundation/StatCard.js +59 -0
- package/dist/esm/foundation/StatCard.js.map +1 -0
- package/dist/esm/foundation/StateFrame.d.ts +15 -0
- package/dist/esm/foundation/StateFrame.d.ts.map +1 -0
- package/dist/esm/foundation/StateFrame.js +197 -0
- package/dist/esm/foundation/StateFrame.js.map +1 -0
- package/dist/esm/foundation/StatusChip.d.ts +13 -0
- package/dist/esm/foundation/StatusChip.d.ts.map +1 -0
- package/dist/esm/foundation/StatusChip.js +59 -0
- package/dist/esm/foundation/StatusChip.js.map +1 -0
- package/dist/esm/foundation/TrendChip.d.ts +18 -0
- package/dist/esm/foundation/TrendChip.d.ts.map +1 -0
- package/dist/esm/foundation/TrendChip.js +88 -0
- package/dist/esm/foundation/TrendChip.js.map +1 -0
- package/dist/esm/foundation/formatting.d.ts +13 -0
- package/dist/esm/foundation/formatting.d.ts.map +1 -0
- package/dist/esm/foundation/formatting.js +78 -0
- package/dist/esm/foundation/formatting.js.map +1 -0
- package/dist/esm/foundation/foundationComponentMetadata.d.ts +3 -0
- package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -0
- package/dist/esm/foundation/foundationComponentMetadata.js +39 -0
- package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -0
- package/dist/esm/foundation/foundationDescriptors.d.ts +6 -0
- package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -0
- package/dist/esm/foundation/foundationDescriptors.js +227 -0
- package/dist/esm/foundation/foundationDescriptors.js.map +1 -0
- package/dist/esm/foundation/foundationSamples.d.ts +10 -0
- package/dist/esm/foundation/foundationSamples.d.ts.map +1 -0
- package/dist/esm/foundation/foundationSamples.js +68 -0
- package/dist/esm/foundation/foundationSamples.js.map +1 -0
- package/dist/esm/foundation/foundationStrings.d.ts +78 -0
- package/dist/esm/foundation/foundationStrings.d.ts.map +1 -0
- package/dist/esm/foundation/foundationStrings.js +101 -0
- package/dist/esm/foundation/foundationStrings.js.map +1 -0
- package/dist/esm/foundation/index.d.ts +16 -0
- package/dist/esm/foundation/index.d.ts.map +1 -0
- package/dist/esm/foundation/index.js +16 -0
- package/dist/esm/foundation/index.js.map +1 -0
- package/dist/esm/gallery/widgets.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/themes/dark.d.ts.map +1 -1
- package/dist/esm/themes/dark.js +9 -1
- package/dist/esm/themes/dark.js.map +1 -1
- package/dist/esm/themes/light.d.ts.map +1 -1
- package/dist/esm/themes/light.js +10 -2
- package/dist/esm/themes/light.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/ActionButton.tsx +39 -0
- package/foundation/ComponentState.ts +53 -0
- package/foundation/EmptyState.tsx +22 -0
- package/foundation/Foundation.stories.tsx +30 -0
- package/foundation/FoundationIcon.tsx +49 -0
- package/foundation/FoundationStates.tsx +46 -0
- package/foundation/PermissionRule.ts +26 -0
- package/foundation/StatCard.tsx +44 -0
- package/foundation/StateFrame.tsx +126 -0
- package/foundation/StatusChip.tsx +51 -0
- package/foundation/TrendChip.tsx +78 -0
- package/foundation/formatting.ts +69 -0
- package/foundation/foundationComponentMetadata.ts +17 -0
- package/foundation/foundationDescriptors.ts +119 -0
- package/foundation/foundationSamples.ts +44 -0
- package/foundation/foundationStrings.ts +112 -0
- package/foundation/index.ts +18 -0
- package/index.ts +1 -0
- package/package.json +9 -8
- package/shell/layout.css +241 -0
- package/themes/dark.ts +8 -0
- package/themes/light.ts +9 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ComponentCategory } from '@cratis/scene.model';
|
|
5
|
+
import { ComponentMetadata, componentMetadata as m } from '@cratis/scene.react';
|
|
6
|
+
import { ComponentName } from '../ComponentName';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The category, icon, keywords and picker badge of every foundation component (CMP1), keyed by bare component name.
|
|
10
|
+
* The names are those of `ComponentName`; the metadata of the rest of the package lives in `defaultBlueprintComponentMetadata`.
|
|
11
|
+
*/
|
|
12
|
+
export const foundationComponentMetadata: Record<string, ComponentMetadata> = {
|
|
13
|
+
[ComponentName.EmptyState]: m('Empty state', ComponentCategory.Feedback, 'inbox', ['no data', 'nothing', 'blank slate', 'zero state']),
|
|
14
|
+
[ComponentName.StatCard]: m('Stat card', ComponentCategory.DataDisplay, 'gauge', ['kpi', 'metric', 'figure', 'number', 'dashboard']),
|
|
15
|
+
[ComponentName.TrendChip]: m('Trend chip', ComponentCategory.DataDisplay, 'trending-up', ['delta', 'change', 'arrow', 'comparison']),
|
|
16
|
+
[ComponentName.StatusChip]: m('Status chip', ComponentCategory.DataDisplay, 'badge-check', ['badge', 'state', 'tag', 'label']),
|
|
17
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { BindingSourceKind, ComponentDescriptor, PropertyDescriptor, PropertyEditorKind, PropertyValueType } from '@cratis/scene.model';
|
|
5
|
+
import { componentRegistryKey } from '@cratis/scene.react';
|
|
6
|
+
import { ComponentName } from '../ComponentName';
|
|
7
|
+
import { defaultBlueprintName } from '../packageName';
|
|
8
|
+
import { ComponentState } from './ComponentState';
|
|
9
|
+
import { NumberFormat } from './formatting';
|
|
10
|
+
import { PermissionRule } from './PermissionRule';
|
|
11
|
+
import { StatusTone } from './StatusChip';
|
|
12
|
+
|
|
13
|
+
/** Data properties take what a screen binds them to: a query's result, a data context or another component's output. */
|
|
14
|
+
export const bindable = [BindingSourceKind.DataContext, BindingSourceKind.QueryResult, BindingSourceKind.ComponentProperty];
|
|
15
|
+
|
|
16
|
+
const text = (path: string, label: string, group: string, description?: string, extra: Partial<PropertyDescriptor> = {}): PropertyDescriptor =>
|
|
17
|
+
({ path, label, group, valueType: PropertyValueType.String, ...(group === 'Data' ? { acceptedBindingKinds: bindable } : {}), ...(description === undefined ? {} : { description }), ...extra });
|
|
18
|
+
|
|
19
|
+
const number = (path: string, label: string, group: string, description?: string, extra: Partial<PropertyDescriptor> = {}): PropertyDescriptor =>
|
|
20
|
+
({ path, label, group, valueType: PropertyValueType.Number, editorKind: PropertyEditorKind.Number, ...(group === 'Data' ? { acceptedBindingKinds: bindable } : {}), ...(description === undefined ? {} : { description }), ...extra });
|
|
21
|
+
|
|
22
|
+
const flag = (path: string, label: string, group: string, description?: string, extra: Partial<PropertyDescriptor> = {}): PropertyDescriptor =>
|
|
23
|
+
({ path, label, group, valueType: PropertyValueType.Boolean, editorKind: PropertyEditorKind.Boolean, ...(description === undefined ? {} : { description }), ...extra });
|
|
24
|
+
|
|
25
|
+
const choice = (path: string, label: string, group: string, values: Record<string, string>, defaultValue: string, description?: string): PropertyDescriptor =>
|
|
26
|
+
({
|
|
27
|
+
path, label, group, valueType: PropertyValueType.Enum, editorKind: PropertyEditorKind.Enum, default: defaultValue,
|
|
28
|
+
choices: Object.entries(values).map(([value, name]) => ({ value, label: name })), ...(description === undefined ? {} : { description }),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const list = (path: string, label: string, group: string, itemLabel: string, properties: PropertyDescriptor[], description?: string): PropertyDescriptor =>
|
|
32
|
+
({ path, label, group, valueType: PropertyValueType.Collection, default: [], item: { label: itemLabel, properties }, ...(description === undefined ? {} : { description }) });
|
|
33
|
+
|
|
34
|
+
const rule = (path: string, label: string, description: string): PropertyDescriptor =>
|
|
35
|
+
choice(path, label, 'Permissions', { [PermissionRule.Enabled]: 'Enabled', [PermissionRule.Disabled]: 'Disabled', [PermissionRule.Hidden]: 'Hidden' }, PermissionRule.Enabled, description);
|
|
36
|
+
|
|
37
|
+
/** The properties every data-showing foundation component shares: the standard states (spec Part B 1.4) and the cross-cutting rules of 1.5. */
|
|
38
|
+
export const standardStateProperties: PropertyDescriptor[] = [
|
|
39
|
+
choice('state', 'Preview state', 'State', {
|
|
40
|
+
[ComponentState.Ready]: 'Ready', [ComponentState.Loading]: 'Loading', [ComponentState.Empty]: 'Empty',
|
|
41
|
+
[ComponentState.Error]: 'Error', [ComponentState.NoPermission]: 'No permission', [ComponentState.Partial]: 'Partial',
|
|
42
|
+
}, ComponentState.Ready, 'Forces a state so each can be designed and previewed; empty means the state follows the bound data.'),
|
|
43
|
+
text('error', 'Error message', 'State', 'The message of the error state; setting it puts the component in that state.'),
|
|
44
|
+
flag('loading', 'Loading', 'State', 'Shows the skeleton while the data has not answered.'),
|
|
45
|
+
flag('forbidden', 'Not allowed', 'State', 'Shows the no-permission state, which explains what is missing and shows no data.'),
|
|
46
|
+
text('permissionSubject', 'What access is missing', 'State', 'Names what the user cannot see in the no-permission message.'),
|
|
47
|
+
{ path: 'failedRegions', label: 'Failed regions', group: 'State', valueType: PropertyValueType.Json, editorKind: PropertyEditorKind.StringList, default: [], description: 'The parts that failed to load; any entry puts the component in the partial state.' },
|
|
48
|
+
text('emptyHeadline', 'Empty headline', 'State'),
|
|
49
|
+
text('emptyHint', 'Empty hint', 'State'),
|
|
50
|
+
text('emptyActionLabel', 'Empty action', 'State', 'The primary action offered when there is nothing to show.'),
|
|
51
|
+
rule('actionPermission', 'Empty action permission', 'Whether the empty state offers its action, refuses it with a reason, or does not render it.'),
|
|
52
|
+
text('label', 'Label', 'Accessibility', 'The accessible name of the region.'),
|
|
53
|
+
text('locale', 'Locale', 'Content', 'The locale dates, numbers and currency are formatted in; empty follows the document.'),
|
|
54
|
+
choice('density', 'Density', 'Appearance', { comfortable: 'Comfortable', compact: 'Compact' }, 'comfortable'),
|
|
55
|
+
{ path: 'strings', label: 'Text overrides', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap, description: 'Replaces the text the component says itself, for localization.' },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
const key = (name: ComponentName) => componentRegistryKey(defaultBlueprintName, name);
|
|
59
|
+
|
|
60
|
+
const formats = { [NumberFormat.Number]: 'Number', [NumberFormat.Currency]: 'Currency', [NumberFormat.Percent]: 'Percent', [NumberFormat.Compact]: 'Compact' };
|
|
61
|
+
|
|
62
|
+
/** What can be edited on the foundation components (Part B 4). Each declares the shape of its data, never values (SD1). */
|
|
63
|
+
export const foundationDescriptors: ComponentDescriptor[] = [
|
|
64
|
+
{
|
|
65
|
+
component: key(ComponentName.EmptyState),
|
|
66
|
+
displayName: 'Empty state',
|
|
67
|
+
description: 'An icon, a headline, a hint and one primary action; embeddable in any region.',
|
|
68
|
+
properties: [
|
|
69
|
+
text('headline', 'Headline', 'Content', undefined, { default: 'Nothing here yet' }),
|
|
70
|
+
text('hint', 'Hint', 'Content'),
|
|
71
|
+
text('icon', 'Icon', 'Appearance'),
|
|
72
|
+
text('actionLabel', 'Primary action', 'Behavior', 'The label of the one action the state offers; its behaviors say what it does.'),
|
|
73
|
+
rule('actionPermission', 'Action permission', 'Whether the action works, refuses with a reason, or is not rendered.'),
|
|
74
|
+
text('locale', 'Locale', 'Content'),
|
|
75
|
+
{ path: 'strings', label: 'Text overrides', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
component: key(ComponentName.StatCard),
|
|
80
|
+
displayName: 'Stat card',
|
|
81
|
+
description: 'One key figure with its label, trend and the period the trend is compared to.',
|
|
82
|
+
properties: [
|
|
83
|
+
text('label', 'Label', 'Content', 'What the figure measures.', { constraints: { required: true } }),
|
|
84
|
+
number('value', 'Value', 'Data', 'The figure; bind it to a query result.'),
|
|
85
|
+
choice('format', 'Format', 'Appearance', formats, NumberFormat.Number),
|
|
86
|
+
text('currency', 'Currency', 'Appearance', 'The ISO 4217 code when the format is currency.'),
|
|
87
|
+
number('fractionDigits', 'Fraction digits', 'Appearance'),
|
|
88
|
+
number('change', 'Change', 'Data', 'How much the figure moved, as a percentage; bind it to a query result.'),
|
|
89
|
+
choice('goodDirection', 'Good direction', 'Appearance', { up: 'Up is good', down: 'Down is good' }, 'up', 'Which movement is good: a falling response time is.'),
|
|
90
|
+
text('comparison', 'Compared to', 'Content', 'The period the change is compared to, for example "last month".'),
|
|
91
|
+
...standardStateProperties.filter(property => property.path !== 'label'),
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
component: key(ComponentName.TrendChip),
|
|
96
|
+
displayName: 'Trend chip',
|
|
97
|
+
description: 'A change drawn as a direction, a magnitude and whether the movement is good.',
|
|
98
|
+
properties: [
|
|
99
|
+
number('change', 'Change', 'Data', 'The movement; bind it to a query result.'),
|
|
100
|
+
choice('format', 'Format', 'Appearance', formats, NumberFormat.Percent),
|
|
101
|
+
choice('goodDirection', 'Good direction', 'Appearance', { up: 'Up is good', down: 'Down is good' }, 'up'),
|
|
102
|
+
text('comparison', 'Compared to', 'Content'),
|
|
103
|
+
text('locale', 'Locale', 'Content'),
|
|
104
|
+
{ path: 'strings', label: 'Text overrides', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
component: key(ComponentName.StatusChip),
|
|
109
|
+
displayName: 'Status chip',
|
|
110
|
+
description: 'A status shown as a semantic color, an icon and its text; the text is always shown.',
|
|
111
|
+
properties: [
|
|
112
|
+
text('status', 'Status', 'Data', 'The status text; bind it to a query result.', { constraints: { required: true } }),
|
|
113
|
+
choice('tone', 'Tone', 'Appearance', {
|
|
114
|
+
[StatusTone.Success]: 'Success', [StatusTone.Warning]: 'Warning', [StatusTone.Danger]: 'Danger', [StatusTone.Info]: 'Info', [StatusTone.Neutral]: 'Neutral',
|
|
115
|
+
}, StatusTone.Neutral, 'The tone picks the icon and the theme color.'),
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ExternalComponent } from '@cratis/scene.model';
|
|
5
|
+
import { componentRegistryKey } from '@cratis/scene.react';
|
|
6
|
+
import { ComponentName } from '../ComponentName';
|
|
7
|
+
import { defaultBlueprintName } from '../packageName';
|
|
8
|
+
import { ComponentState } from './ComponentState';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What a story or a specification feeds each foundation component to see it populated.
|
|
12
|
+
*
|
|
13
|
+
* These are design-time and test-time values, never part of what a component is: a component declares the shape of its data
|
|
14
|
+
* and a screen binds it to a query (spec SD1). The domain blueprints supply real preview data as sample-data packs; this is
|
|
15
|
+
* only enough to draw each component in each state.
|
|
16
|
+
*/
|
|
17
|
+
export interface FoundationSample {
|
|
18
|
+
/** The properties that make the component populated. */
|
|
19
|
+
properties: Record<string, unknown>;
|
|
20
|
+
|
|
21
|
+
/** Text that only appears when the component shows its data, so a specification can prove the no-permission state shows none of it. */
|
|
22
|
+
data: string[];
|
|
23
|
+
|
|
24
|
+
/** Whether the component shows data and so owns the five standard states; chips and the empty state themselves do not. */
|
|
25
|
+
stateful: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const foundationSamples: Record<string, FoundationSample> = {
|
|
29
|
+
[ComponentName.EmptyState]: { properties: { headline: 'No invoices yet', hint: 'Invoices you create appear here.', icon: 'file', actionLabel: 'New invoice' }, data: [], stateful: false },
|
|
30
|
+
[ComponentName.StatCard]: { properties: { label: 'Open pipeline', value: 1234567, format: 'currency', currency: 'USD', change: 12.5, comparison: 'last month', locale: 'en-US' }, data: ['$1,234,567'], stateful: true },
|
|
31
|
+
[ComponentName.TrendChip]: { properties: { change: -3.2, goodDirection: 'down', comparison: 'last week', locale: 'en-US' }, data: [], stateful: false },
|
|
32
|
+
[ComponentName.StatusChip]: { properties: { status: 'Awaiting approval', tone: 'warning' }, data: [], stateful: false },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** A scene element for a foundation component, populated with its sample unless properties are given, with the state forced when asked. */
|
|
36
|
+
export function foundationElement(name: string, properties?: Record<string, unknown>, state?: ComponentState): ExternalComponent {
|
|
37
|
+
const sample = foundationSamples[name];
|
|
38
|
+
return {
|
|
39
|
+
id: `${name}-sample`,
|
|
40
|
+
componentName: componentRegistryKey(defaultBlueprintName, name),
|
|
41
|
+
properties: { ...(properties ?? sample?.properties ?? {}), ...(state === undefined ? {} : { state }) },
|
|
42
|
+
slots: {},
|
|
43
|
+
} as unknown as ExternalComponent;
|
|
44
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ExternalComponent } from '@cratis/scene.model';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Every piece of text the foundation components say themselves, as opposed to text a screen author or a bound query
|
|
8
|
+
* supplies. Nothing is hard-coded in a component (spec Part B 1.5): a component reads its text from here, merged with
|
|
9
|
+
* the `strings` property of the element, so an application localizes by supplying a table - and a bound string
|
|
10
|
+
* (a `{name}` placeholder is replaced by the values the component passes) arrives the same way any other property does.
|
|
11
|
+
*/
|
|
12
|
+
export const foundationStrings = {
|
|
13
|
+
loading: 'Loading',
|
|
14
|
+
emptyHeadline: 'Nothing here yet',
|
|
15
|
+
emptyHint: 'There is nothing to show for now.',
|
|
16
|
+
errorHeadline: 'This could not be loaded',
|
|
17
|
+
errorHint: 'Something went wrong while loading. Try again in a moment.',
|
|
18
|
+
retry: 'Try again',
|
|
19
|
+
noPermissionHeadline: 'You do not have access',
|
|
20
|
+
noPermissionHint: 'Ask an administrator to grant you access to {subject}.',
|
|
21
|
+
noPermissionSubject: 'this content',
|
|
22
|
+
partialHeadline: 'Some parts could not be loaded',
|
|
23
|
+
partialHint: 'The unavailable parts are: {regions}.',
|
|
24
|
+
disabledNoPermission: 'You do not have permission to do this',
|
|
25
|
+
trendUp: 'up {value}',
|
|
26
|
+
trendDown: 'down {value}',
|
|
27
|
+
trendFlat: 'unchanged',
|
|
28
|
+
trendComparison: 'compared to {period}',
|
|
29
|
+
statusSuccess: 'Success',
|
|
30
|
+
statusWarning: 'Warning',
|
|
31
|
+
statusDanger: 'Problem',
|
|
32
|
+
statusInfo: 'Information',
|
|
33
|
+
statusNeutral: 'Status',
|
|
34
|
+
chartNoData: 'No data to chart',
|
|
35
|
+
chartDataTable: 'Chart data',
|
|
36
|
+
chartSeries: 'Series',
|
|
37
|
+
chartCategory: 'Category',
|
|
38
|
+
filterAdd: 'Add condition',
|
|
39
|
+
filterAddGroup: 'Add group',
|
|
40
|
+
filterRemove: 'Remove condition',
|
|
41
|
+
filterRemoveGroup: 'Remove group',
|
|
42
|
+
filterMatchAll: 'Match all (AND)',
|
|
43
|
+
filterMatchAny: 'Match any (OR)',
|
|
44
|
+
filterField: 'Field',
|
|
45
|
+
filterOperator: 'Operator',
|
|
46
|
+
filterValue: 'Value',
|
|
47
|
+
filterClear: 'Clear filters',
|
|
48
|
+
filterSummary: '{count} active filters',
|
|
49
|
+
columnsChoose: 'Columns',
|
|
50
|
+
columnsLocked: 'always shown',
|
|
51
|
+
columnsReset: 'Show all columns',
|
|
52
|
+
viewsLabel: 'Saved views',
|
|
53
|
+
viewsDefault: 'All items',
|
|
54
|
+
viewsSave: 'Save current view',
|
|
55
|
+
viewsManage: 'Manage views',
|
|
56
|
+
checklistProgress: '{done} of {total} complete',
|
|
57
|
+
checklistOwner: 'Owner',
|
|
58
|
+
checklistDue: 'Due',
|
|
59
|
+
activityEmpty: 'No activity yet',
|
|
60
|
+
avatarOverflow: '{count} more',
|
|
61
|
+
avatarPeople: '{count} people',
|
|
62
|
+
uploadDrop: 'Drop files here or',
|
|
63
|
+
uploadBrowse: 'Browse files',
|
|
64
|
+
uploadRemove: 'Remove {name}',
|
|
65
|
+
uploadTooLarge: '{name} is larger than {limit}',
|
|
66
|
+
uploadWrongType: '{name} is not an accepted file type',
|
|
67
|
+
uploadUploading: 'Uploading',
|
|
68
|
+
uploadDone: 'Uploaded',
|
|
69
|
+
uploadFailed: 'Upload failed',
|
|
70
|
+
approvalPending: 'Pending',
|
|
71
|
+
approvalCurrent: 'Awaiting decision',
|
|
72
|
+
approvalApproved: 'Approved',
|
|
73
|
+
approvalRejected: 'Rejected',
|
|
74
|
+
approvalSkipped: 'Skipped',
|
|
75
|
+
approvalChain: 'Approval chain',
|
|
76
|
+
orgExpand: 'Expand {name}',
|
|
77
|
+
orgCollapse: 'Collapse {name}',
|
|
78
|
+
orgReports: '{count} reports',
|
|
79
|
+
matrixAllowed: 'Allowed',
|
|
80
|
+
matrixDenied: 'Not allowed',
|
|
81
|
+
matrixGrant: 'Grant {permission} to {role}',
|
|
82
|
+
matrixReadOnly: 'Read-only',
|
|
83
|
+
} as const;
|
|
84
|
+
|
|
85
|
+
/** The name of one of the foundation strings. */
|
|
86
|
+
export type FoundationStringName = keyof typeof foundationStrings;
|
|
87
|
+
|
|
88
|
+
/** The text table a foundation component works with. */
|
|
89
|
+
export type FoundationStrings = Record<FoundationStringName, string>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The foundation strings with the element's own `strings` property laid over them.
|
|
93
|
+
*
|
|
94
|
+
* Only string values of known names are taken, so a typo in an application's table falls back to the default text
|
|
95
|
+
* rather than rendering nothing.
|
|
96
|
+
*/
|
|
97
|
+
export function readFoundationStrings(element: ExternalComponent): FoundationStrings {
|
|
98
|
+
const supplied = element.properties.strings;
|
|
99
|
+
const result: FoundationStrings = { ...foundationStrings };
|
|
100
|
+
if (typeof supplied !== 'object' || supplied === null || Array.isArray(supplied)) return result;
|
|
101
|
+
|
|
102
|
+
for (const [name, value] of Object.entries(supplied as Record<string, unknown>)) {
|
|
103
|
+
if (name in foundationStrings && typeof value === 'string') result[name as FoundationStringName] = value;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Replaces each `{name}` in a string with the value of the same name, leaving an unknown placeholder visible rather than blank. */
|
|
110
|
+
export function formatText(text: string, values: Record<string, string | number> = {}): string {
|
|
111
|
+
return text.replace(/\{(\w+)\}/g, (placeholder, name: string) => (name in values ? String(values[name]) : placeholder));
|
|
112
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
export * from './foundationStrings';
|
|
5
|
+
export * from './ComponentState';
|
|
6
|
+
export * from './PermissionRule';
|
|
7
|
+
export * from './formatting';
|
|
8
|
+
export * from './FoundationIcon';
|
|
9
|
+
export * from './ActionButton';
|
|
10
|
+
export * from './StateFrame';
|
|
11
|
+
export * from './EmptyState';
|
|
12
|
+
export * from './TrendChip';
|
|
13
|
+
export * from './StatusChip';
|
|
14
|
+
export * from './StatCard';
|
|
15
|
+
export * from './foundationDescriptors';
|
|
16
|
+
export * from './foundationComponentMetadata';
|
|
17
|
+
export * from './foundationSamples';
|
|
18
|
+
export * from './FoundationStates';
|
package/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './configuration';
|
|
|
7
7
|
export * from './layouts';
|
|
8
8
|
export * from './gallery';
|
|
9
9
|
export * from './shell';
|
|
10
|
+
export * from './foundation';
|
|
10
11
|
export * from './themes';
|
|
11
12
|
export * from './defaultBlueprintComponents';
|
|
12
13
|
export * from './defaultBlueprint';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene.blueprint.default",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.32.0",
|
|
4
4
|
"description": "The default blueprint: application shell layouts, the screen and dialog templates that go inside them, the components that fill their slots, and two themes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cratis",
|
|
@@ -48,21 +48,22 @@
|
|
|
48
48
|
"lint": "yarn g:lint",
|
|
49
49
|
"lint:ci": "yarn g:lint:ci",
|
|
50
50
|
"test": "yarn g:test",
|
|
51
|
+
"test:browser": "yarn g:test --config ./vitest.browser.config.mts",
|
|
51
52
|
"ci": "yarn g:ci",
|
|
52
53
|
"up": "yarn g:up",
|
|
53
54
|
"dev": "storybook dev -p 6006",
|
|
54
55
|
"build-storybook": "storybook build"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
|
-
"@cratis/scene.engine": "4.
|
|
58
|
-
"@cratis/scene.model": "4.
|
|
59
|
-
"@cratis/scene.react": "4.
|
|
58
|
+
"@cratis/scene.engine": "4.32.0",
|
|
59
|
+
"@cratis/scene.model": "4.32.0",
|
|
60
|
+
"@cratis/scene.react": "4.32.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@cratis/scene.engine": "4.
|
|
63
|
-
"@cratis/scene.model": "4.
|
|
64
|
-
"@cratis/scene.primereact": "4.
|
|
65
|
-
"@cratis/scene.react": "4.
|
|
63
|
+
"@cratis/scene.engine": "4.32.0",
|
|
64
|
+
"@cratis/scene.model": "4.32.0",
|
|
65
|
+
"@cratis/scene.primereact": "4.32.0",
|
|
66
|
+
"@cratis/scene.react": "4.32.0",
|
|
66
67
|
"@primereact/core": "11.2.0",
|
|
67
68
|
"@primereact/headless": "11.2.0",
|
|
68
69
|
"@primeuix/themes": "^3.0.1",
|
package/shell/layout.css
CHANGED
|
@@ -1059,3 +1059,244 @@
|
|
|
1059
1059
|
align-items: center;
|
|
1060
1060
|
gap: 0.5rem;
|
|
1061
1061
|
}
|
|
1062
|
+
|
|
1063
|
+
/*
|
|
1064
|
+
* FOUNDATION COMPONENTS
|
|
1065
|
+
* ---------------------
|
|
1066
|
+
* The stat card, chips, empty state and the other composites of the foundation set (spec Part B 4). They may be placed
|
|
1067
|
+
* anywhere - inside the shell, in a dialog, on a page with no shell at all - so they alias the Scene tokens themselves instead of
|
|
1068
|
+
* relying on the `--layout-*` block above, which only exists under the shell. Colors and radii come from tokens only; the
|
|
1069
|
+
* spacing is one scale (`--foundation-space-*`). Direction-sensitive rules use logical properties so right-to-left needs no
|
|
1070
|
+
* second stylesheet.
|
|
1071
|
+
*/
|
|
1072
|
+
.foundation {
|
|
1073
|
+
--foundation-text: var(--scene-text-color, #1f2430);
|
|
1074
|
+
--foundation-muted: var(--scene-text-muted-color, #5b6472);
|
|
1075
|
+
--foundation-surface: var(--scene-surface-card, #ffffff);
|
|
1076
|
+
--foundation-background: var(--scene-surface-background, #f4f5f7);
|
|
1077
|
+
--foundation-border: var(--scene-surface-border, #d5d9df);
|
|
1078
|
+
--foundation-hover: var(--scene-surface-hover, #eceef1);
|
|
1079
|
+
--foundation-primary: var(--scene-primary-color, #4f46e5);
|
|
1080
|
+
--foundation-primary-contrast: var(--scene-primary-contrast-color, #ffffff);
|
|
1081
|
+
--foundation-highlight: var(--scene-highlight-background, #eef2ff);
|
|
1082
|
+
--foundation-highlight-text: var(--scene-highlight-color, #3730a3);
|
|
1083
|
+
--foundation-radius: var(--scene-content-border-radius, 0.5rem);
|
|
1084
|
+
--foundation-focus: var(--scene-focus-ring, 0 0 0 2px rgb(79 70 229 / 0.55));
|
|
1085
|
+
--foundation-success: var(--scene-status-success-color, #166534);
|
|
1086
|
+
--foundation-success-background: var(--scene-status-success-background, #dcfce7);
|
|
1087
|
+
--foundation-warning: var(--scene-status-warning-color, #854d0e);
|
|
1088
|
+
--foundation-warning-background: var(--scene-status-warning-background, #fef3c7);
|
|
1089
|
+
--foundation-danger: var(--scene-status-danger-color, #991b1b);
|
|
1090
|
+
--foundation-danger-background: var(--scene-status-danger-background, #fee2e2);
|
|
1091
|
+
--foundation-info: var(--scene-status-info-color, #1e40af);
|
|
1092
|
+
--foundation-info-background: var(--scene-status-info-background, #dbeafe);
|
|
1093
|
+
--foundation-space-1: 0.25rem;
|
|
1094
|
+
--foundation-space-2: 0.5rem;
|
|
1095
|
+
--foundation-space-3: 0.75rem;
|
|
1096
|
+
--foundation-space-4: 1rem;
|
|
1097
|
+
--foundation-space-6: 1.5rem;
|
|
1098
|
+
--foundation-row-height: 2.75rem;
|
|
1099
|
+
|
|
1100
|
+
box-sizing: border-box;
|
|
1101
|
+
color: var(--foundation-text);
|
|
1102
|
+
font-family: inherit;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.foundation[data-density='compact'] {
|
|
1106
|
+
--foundation-row-height: 2rem;
|
|
1107
|
+
--foundation-space-3: 0.5rem;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
.foundation *,
|
|
1111
|
+
.foundation *::before,
|
|
1112
|
+
.foundation *::after {
|
|
1113
|
+
box-sizing: border-box;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
.foundation-visually-hidden {
|
|
1117
|
+
position: absolute;
|
|
1118
|
+
inline-size: 1px;
|
|
1119
|
+
block-size: 1px;
|
|
1120
|
+
margin: -1px;
|
|
1121
|
+
padding: 0;
|
|
1122
|
+
overflow: hidden;
|
|
1123
|
+
clip-path: inset(50%);
|
|
1124
|
+
white-space: nowrap;
|
|
1125
|
+
border: 0;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
.foundation-icon {
|
|
1129
|
+
flex: none;
|
|
1130
|
+
inline-size: 1em;
|
|
1131
|
+
block-size: 1em;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
.foundation :focus-visible {
|
|
1135
|
+
outline: 2px solid var(--foundation-primary);
|
|
1136
|
+
outline-offset: 2px;
|
|
1137
|
+
box-shadow: var(--foundation-focus);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.foundation-button {
|
|
1141
|
+
display: inline-flex;
|
|
1142
|
+
align-items: center;
|
|
1143
|
+
justify-content: center;
|
|
1144
|
+
gap: var(--foundation-space-2);
|
|
1145
|
+
min-block-size: 2.25rem;
|
|
1146
|
+
padding-inline: var(--foundation-space-4);
|
|
1147
|
+
border: 1px solid var(--foundation-primary);
|
|
1148
|
+
border-radius: var(--foundation-radius);
|
|
1149
|
+
background: var(--foundation-primary);
|
|
1150
|
+
color: var(--foundation-primary-contrast);
|
|
1151
|
+
font: inherit;
|
|
1152
|
+
font-weight: 600;
|
|
1153
|
+
cursor: pointer;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
.foundation-button[data-emphasis='secondary'] {
|
|
1157
|
+
background: var(--foundation-surface);
|
|
1158
|
+
color: var(--foundation-primary);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
.foundation-button[data-emphasis='quiet'] {
|
|
1162
|
+
border-color: transparent;
|
|
1163
|
+
background: transparent;
|
|
1164
|
+
color: var(--foundation-primary);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
.foundation-button:hover:not([aria-disabled='true']) {
|
|
1168
|
+
filter: brightness(0.95);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
.foundation-button[aria-disabled='true'] {
|
|
1172
|
+
opacity: 0.6;
|
|
1173
|
+
cursor: not-allowed;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/* Standard states: skeleton, empty, message (error / no permission / partial). */
|
|
1177
|
+
.foundation-skeleton {
|
|
1178
|
+
display: flex;
|
|
1179
|
+
flex-direction: column;
|
|
1180
|
+
gap: var(--foundation-space-3);
|
|
1181
|
+
padding: var(--foundation-space-4);
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
.foundation-skeleton-block {
|
|
1185
|
+
display: block;
|
|
1186
|
+
block-size: 0.875rem;
|
|
1187
|
+
border-radius: var(--foundation-radius);
|
|
1188
|
+
background: linear-gradient(90deg, var(--foundation-hover) 25%, var(--foundation-border) 50%, var(--foundation-hover) 75%);
|
|
1189
|
+
background-size: 200% 100%;
|
|
1190
|
+
animation: foundation-shimmer 1.4s linear infinite;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
@keyframes foundation-shimmer {
|
|
1194
|
+
from { background-position: 200% 0; }
|
|
1195
|
+
to { background-position: -200% 0; }
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1199
|
+
.foundation-skeleton-block { animation: none; }
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
.foundation-empty {
|
|
1203
|
+
display: flex;
|
|
1204
|
+
flex-direction: column;
|
|
1205
|
+
align-items: center;
|
|
1206
|
+
gap: var(--foundation-space-2);
|
|
1207
|
+
padding: var(--foundation-space-6);
|
|
1208
|
+
text-align: center;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.foundation-empty-icon {
|
|
1212
|
+
display: inline-flex;
|
|
1213
|
+
padding: var(--foundation-space-3);
|
|
1214
|
+
border-radius: 50%;
|
|
1215
|
+
background: var(--foundation-highlight);
|
|
1216
|
+
color: var(--foundation-highlight-text);
|
|
1217
|
+
font-size: 1.5rem;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
.foundation-empty-hint {
|
|
1221
|
+
color: var(--foundation-muted);
|
|
1222
|
+
max-inline-size: 36ch;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.foundation-message {
|
|
1226
|
+
display: flex;
|
|
1227
|
+
align-items: flex-start;
|
|
1228
|
+
gap: var(--foundation-space-3);
|
|
1229
|
+
padding: var(--foundation-space-3) var(--foundation-space-4);
|
|
1230
|
+
border: 1px solid var(--foundation-border);
|
|
1231
|
+
border-radius: var(--foundation-radius);
|
|
1232
|
+
background: var(--foundation-surface);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
.foundation-message[data-tone='danger'] { border-color: var(--foundation-danger); color: var(--foundation-danger); background: var(--foundation-danger-background); }
|
|
1236
|
+
.foundation-message[data-tone='warning'] { border-color: var(--foundation-warning); color: var(--foundation-warning); background: var(--foundation-warning-background); }
|
|
1237
|
+
|
|
1238
|
+
.foundation-message-text {
|
|
1239
|
+
display: flex;
|
|
1240
|
+
flex: 1;
|
|
1241
|
+
flex-direction: column;
|
|
1242
|
+
gap: var(--foundation-space-1);
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/* Chips: status and trend. Tone is color plus icon plus text, never color alone. */
|
|
1246
|
+
.foundation-chip {
|
|
1247
|
+
display: inline-flex;
|
|
1248
|
+
align-items: center;
|
|
1249
|
+
gap: var(--foundation-space-1);
|
|
1250
|
+
padding: var(--foundation-space-1) var(--foundation-space-2);
|
|
1251
|
+
border: 1px solid currentColor;
|
|
1252
|
+
border-radius: 999px;
|
|
1253
|
+
font-size: 0.875rem;
|
|
1254
|
+
font-weight: 600;
|
|
1255
|
+
line-height: 1.5;
|
|
1256
|
+
white-space: nowrap;
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
.foundation-chip[data-tone='success'] { color: var(--foundation-success); background: var(--foundation-success-background); }
|
|
1260
|
+
.foundation-chip[data-tone='warning'] { color: var(--foundation-warning); background: var(--foundation-warning-background); }
|
|
1261
|
+
.foundation-chip[data-tone='danger'] { color: var(--foundation-danger); background: var(--foundation-danger-background); }
|
|
1262
|
+
.foundation-chip[data-tone='info'] { color: var(--foundation-info); background: var(--foundation-info-background); }
|
|
1263
|
+
.foundation-chip[data-tone='neutral'] { color: var(--foundation-muted); background: var(--foundation-hover); }
|
|
1264
|
+
|
|
1265
|
+
.foundation-trend-comparison {
|
|
1266
|
+
font-weight: 400;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.foundation-trend-chip { display: inline-flex; }
|
|
1270
|
+
|
|
1271
|
+
/* Stat card. */
|
|
1272
|
+
.foundation-stat-card {
|
|
1273
|
+
display: flex;
|
|
1274
|
+
flex-direction: column;
|
|
1275
|
+
gap: var(--foundation-space-2);
|
|
1276
|
+
min-inline-size: 10rem;
|
|
1277
|
+
padding: var(--foundation-space-4);
|
|
1278
|
+
border: 1px solid var(--foundation-border);
|
|
1279
|
+
border-radius: var(--foundation-radius);
|
|
1280
|
+
background: var(--foundation-surface);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
.foundation-stat-label {
|
|
1284
|
+
margin: 0;
|
|
1285
|
+
color: var(--foundation-muted);
|
|
1286
|
+
font-size: 0.875rem;
|
|
1287
|
+
font-weight: 600;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
.foundation-stat-value {
|
|
1291
|
+
margin: 0;
|
|
1292
|
+
font-size: 2rem;
|
|
1293
|
+
font-weight: 700;
|
|
1294
|
+
line-height: 1.2;
|
|
1295
|
+
font-variant-numeric: tabular-nums;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
.foundation-empty-state {
|
|
1299
|
+
border: 1px dashed var(--foundation-border);
|
|
1300
|
+
border-radius: var(--foundation-radius);
|
|
1301
|
+
background: var(--foundation-surface);
|
|
1302
|
+
}
|
package/themes/dark.ts
CHANGED
|
@@ -34,5 +34,13 @@ export const darkTheme: Theme = {
|
|
|
34
34
|
'highlight.color': '#c7ccff',
|
|
35
35
|
'content.borderRadius': '0.5rem',
|
|
36
36
|
'focus.ring': '0 0 0 2px rgb(129 140 248 / 0.45)',
|
|
37
|
+
'status.successColor': '#86efac',
|
|
38
|
+
'status.successBackground': '#14301f',
|
|
39
|
+
'status.warningColor': '#fcd34d',
|
|
40
|
+
'status.warningBackground': '#33290f',
|
|
41
|
+
'status.dangerColor': '#fca5a5',
|
|
42
|
+
'status.dangerBackground': '#3a1616',
|
|
43
|
+
'status.infoColor': '#93c5fd',
|
|
44
|
+
'status.infoBackground': '#162a4a',
|
|
37
45
|
},
|
|
38
46
|
};
|
package/themes/light.ts
CHANGED
|
@@ -32,10 +32,18 @@ export const lightTheme: Theme = {
|
|
|
32
32
|
'surface.hover': '#eceef1',
|
|
33
33
|
'surface.overlay': '#ffffff',
|
|
34
34
|
'text.color': '#1f2430',
|
|
35
|
-
'text.mutedColor': '#
|
|
35
|
+
'text.mutedColor': '#5b6472',
|
|
36
36
|
'highlight.background': '#eef2ff',
|
|
37
37
|
'highlight.color': '#3730a3',
|
|
38
38
|
'content.borderRadius': '0.5rem',
|
|
39
39
|
'focus.ring': '0 0 0 2px rgb(79 70 229 / 0.4)',
|
|
40
|
+
'status.successColor': '#166534',
|
|
41
|
+
'status.successBackground': '#dcfce7',
|
|
42
|
+
'status.warningColor': '#854d0e',
|
|
43
|
+
'status.warningBackground': '#fef3c7',
|
|
44
|
+
'status.dangerColor': '#991b1b',
|
|
45
|
+
'status.dangerBackground': '#fee2e2',
|
|
46
|
+
'status.infoColor': '#1e40af',
|
|
47
|
+
'status.infoBackground': '#dbeafe',
|
|
40
48
|
},
|
|
41
49
|
};
|