@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.
Files changed (163) hide show
  1. package/ComponentName.ts +12 -0
  2. package/defaultBlueprint.ts +2 -1
  3. package/defaultBlueprintComponentMetadata.ts +2 -0
  4. package/defaultBlueprintComponents.ts +5 -0
  5. package/dist/cjs/ComponentName.js +4 -0
  6. package/dist/cjs/ComponentName.js.map +1 -1
  7. package/dist/cjs/defaultBlueprint.js +9 -5
  8. package/dist/cjs/defaultBlueprint.js.map +1 -1
  9. package/dist/cjs/defaultBlueprintComponentMetadata.js +8 -0
  10. package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
  11. package/dist/cjs/defaultBlueprintComponents.js +13 -1
  12. package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
  13. package/dist/cjs/foundation/ActionButton.js +33 -0
  14. package/dist/cjs/foundation/ActionButton.js.map +1 -0
  15. package/dist/cjs/foundation/ComponentState.js +42 -0
  16. package/dist/cjs/foundation/ComponentState.js.map +1 -0
  17. package/dist/cjs/foundation/EmptyState.js +31 -0
  18. package/dist/cjs/foundation/EmptyState.js.map +1 -0
  19. package/dist/cjs/foundation/FoundationIcon.js +58 -0
  20. package/dist/cjs/foundation/FoundationIcon.js.map +1 -0
  21. package/dist/cjs/foundation/FoundationStates.js +62 -0
  22. package/dist/cjs/foundation/FoundationStates.js.map +1 -0
  23. package/dist/cjs/foundation/PermissionRule.js +22 -0
  24. package/dist/cjs/foundation/PermissionRule.js.map +1 -0
  25. package/dist/cjs/foundation/StatCard.js +61 -0
  26. package/dist/cjs/foundation/StatCard.js.map +1 -0
  27. package/dist/cjs/foundation/StateFrame.js +200 -0
  28. package/dist/cjs/foundation/StateFrame.js.map +1 -0
  29. package/dist/cjs/foundation/StatusChip.js +64 -0
  30. package/dist/cjs/foundation/StatusChip.js.map +1 -0
  31. package/dist/cjs/foundation/TrendChip.js +93 -0
  32. package/dist/cjs/foundation/TrendChip.js.map +1 -0
  33. package/dist/cjs/foundation/formatting.js +85 -0
  34. package/dist/cjs/foundation/formatting.js.map +1 -0
  35. package/dist/cjs/foundation/foundationComponentMetadata.js +41 -0
  36. package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -0
  37. package/dist/cjs/foundation/foundationDescriptors.js +232 -0
  38. package/dist/cjs/foundation/foundationDescriptors.js.map +1 -0
  39. package/dist/cjs/foundation/foundationSamples.js +71 -0
  40. package/dist/cjs/foundation/foundationSamples.js.map +1 -0
  41. package/dist/cjs/foundation/foundationStrings.js +105 -0
  42. package/dist/cjs/foundation/foundationStrings.js.map +1 -0
  43. package/dist/cjs/index.js +52 -0
  44. package/dist/cjs/index.js.map +1 -1
  45. package/dist/cjs/themes/dark.js +9 -1
  46. package/dist/cjs/themes/dark.js.map +1 -1
  47. package/dist/cjs/themes/light.js +10 -2
  48. package/dist/cjs/themes/light.js.map +1 -1
  49. package/dist/esm/ComponentName.d.ts +5 -1
  50. package/dist/esm/ComponentName.d.ts.map +1 -1
  51. package/dist/esm/ComponentName.js +4 -0
  52. package/dist/esm/ComponentName.js.map +1 -1
  53. package/dist/esm/defaultBlueprint.d.ts.map +1 -1
  54. package/dist/esm/defaultBlueprint.js +9 -5
  55. package/dist/esm/defaultBlueprint.js.map +1 -1
  56. package/dist/esm/defaultBlueprintComponentMetadata.d.ts.map +1 -1
  57. package/dist/esm/defaultBlueprintComponentMetadata.js +8 -0
  58. package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
  59. package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
  60. package/dist/esm/defaultBlueprintComponents.js +13 -1
  61. package/dist/esm/defaultBlueprintComponents.js.map +1 -1
  62. package/dist/esm/foundation/ActionButton.d.ts +13 -0
  63. package/dist/esm/foundation/ActionButton.d.ts.map +1 -0
  64. package/dist/esm/foundation/ActionButton.js +31 -0
  65. package/dist/esm/foundation/ActionButton.js.map +1 -0
  66. package/dist/esm/foundation/ComponentState.d.ts +12 -0
  67. package/dist/esm/foundation/ComponentState.d.ts.map +1 -0
  68. package/dist/esm/foundation/ComponentState.js +38 -0
  69. package/dist/esm/foundation/ComponentState.js.map +1 -0
  70. package/dist/esm/foundation/EmptyState.d.ts +3 -0
  71. package/dist/esm/foundation/EmptyState.d.ts.map +1 -0
  72. package/dist/esm/foundation/EmptyState.js +29 -0
  73. package/dist/esm/foundation/EmptyState.js.map +1 -0
  74. package/dist/esm/foundation/Foundation.stories.d.ts +21 -0
  75. package/dist/esm/foundation/Foundation.stories.d.ts.map +1 -0
  76. package/dist/esm/foundation/Foundation.stories.js +18 -0
  77. package/dist/esm/foundation/Foundation.stories.js.map +1 -0
  78. package/dist/esm/foundation/FoundationIcon.d.ts +7 -0
  79. package/dist/esm/foundation/FoundationIcon.d.ts.map +1 -0
  80. package/dist/esm/foundation/FoundationIcon.js +55 -0
  81. package/dist/esm/foundation/FoundationIcon.js.map +1 -0
  82. package/dist/esm/foundation/FoundationStates.d.ts +8 -0
  83. package/dist/esm/foundation/FoundationStates.d.ts.map +1 -0
  84. package/dist/esm/foundation/FoundationStates.js +60 -0
  85. package/dist/esm/foundation/FoundationStates.js.map +1 -0
  86. package/dist/esm/foundation/PermissionRule.d.ts +8 -0
  87. package/dist/esm/foundation/PermissionRule.d.ts.map +1 -0
  88. package/dist/esm/foundation/PermissionRule.js +19 -0
  89. package/dist/esm/foundation/PermissionRule.js.map +1 -0
  90. package/dist/esm/foundation/StatCard.d.ts +3 -0
  91. package/dist/esm/foundation/StatCard.d.ts.map +1 -0
  92. package/dist/esm/foundation/StatCard.js +59 -0
  93. package/dist/esm/foundation/StatCard.js.map +1 -0
  94. package/dist/esm/foundation/StateFrame.d.ts +15 -0
  95. package/dist/esm/foundation/StateFrame.d.ts.map +1 -0
  96. package/dist/esm/foundation/StateFrame.js +197 -0
  97. package/dist/esm/foundation/StateFrame.js.map +1 -0
  98. package/dist/esm/foundation/StatusChip.d.ts +13 -0
  99. package/dist/esm/foundation/StatusChip.d.ts.map +1 -0
  100. package/dist/esm/foundation/StatusChip.js +59 -0
  101. package/dist/esm/foundation/StatusChip.js.map +1 -0
  102. package/dist/esm/foundation/TrendChip.d.ts +18 -0
  103. package/dist/esm/foundation/TrendChip.d.ts.map +1 -0
  104. package/dist/esm/foundation/TrendChip.js +88 -0
  105. package/dist/esm/foundation/TrendChip.js.map +1 -0
  106. package/dist/esm/foundation/formatting.d.ts +13 -0
  107. package/dist/esm/foundation/formatting.d.ts.map +1 -0
  108. package/dist/esm/foundation/formatting.js +78 -0
  109. package/dist/esm/foundation/formatting.js.map +1 -0
  110. package/dist/esm/foundation/foundationComponentMetadata.d.ts +3 -0
  111. package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -0
  112. package/dist/esm/foundation/foundationComponentMetadata.js +39 -0
  113. package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -0
  114. package/dist/esm/foundation/foundationDescriptors.d.ts +6 -0
  115. package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -0
  116. package/dist/esm/foundation/foundationDescriptors.js +227 -0
  117. package/dist/esm/foundation/foundationDescriptors.js.map +1 -0
  118. package/dist/esm/foundation/foundationSamples.d.ts +10 -0
  119. package/dist/esm/foundation/foundationSamples.d.ts.map +1 -0
  120. package/dist/esm/foundation/foundationSamples.js +68 -0
  121. package/dist/esm/foundation/foundationSamples.js.map +1 -0
  122. package/dist/esm/foundation/foundationStrings.d.ts +78 -0
  123. package/dist/esm/foundation/foundationStrings.d.ts.map +1 -0
  124. package/dist/esm/foundation/foundationStrings.js +101 -0
  125. package/dist/esm/foundation/foundationStrings.js.map +1 -0
  126. package/dist/esm/foundation/index.d.ts +16 -0
  127. package/dist/esm/foundation/index.d.ts.map +1 -0
  128. package/dist/esm/foundation/index.js +16 -0
  129. package/dist/esm/foundation/index.js.map +1 -0
  130. package/dist/esm/gallery/widgets.js +1 -1
  131. package/dist/esm/index.d.ts +1 -0
  132. package/dist/esm/index.d.ts.map +1 -1
  133. package/dist/esm/index.js +15 -0
  134. package/dist/esm/index.js.map +1 -1
  135. package/dist/esm/themes/dark.d.ts.map +1 -1
  136. package/dist/esm/themes/dark.js +9 -1
  137. package/dist/esm/themes/dark.js.map +1 -1
  138. package/dist/esm/themes/light.d.ts.map +1 -1
  139. package/dist/esm/themes/light.js +10 -2
  140. package/dist/esm/themes/light.js.map +1 -1
  141. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  142. package/foundation/ActionButton.tsx +39 -0
  143. package/foundation/ComponentState.ts +53 -0
  144. package/foundation/EmptyState.tsx +22 -0
  145. package/foundation/Foundation.stories.tsx +30 -0
  146. package/foundation/FoundationIcon.tsx +49 -0
  147. package/foundation/FoundationStates.tsx +46 -0
  148. package/foundation/PermissionRule.ts +26 -0
  149. package/foundation/StatCard.tsx +44 -0
  150. package/foundation/StateFrame.tsx +126 -0
  151. package/foundation/StatusChip.tsx +51 -0
  152. package/foundation/TrendChip.tsx +78 -0
  153. package/foundation/formatting.ts +69 -0
  154. package/foundation/foundationComponentMetadata.ts +17 -0
  155. package/foundation/foundationDescriptors.ts +119 -0
  156. package/foundation/foundationSamples.ts +44 -0
  157. package/foundation/foundationStrings.ts +112 -0
  158. package/foundation/index.ts +18 -0
  159. package/index.ts +1 -0
  160. package/package.json +9 -8
  161. package/shell/layout.css +241 -0
  162. package/themes/dark.ts +8 -0
  163. package/themes/light.ts +9 -1
@@ -0,0 +1,18 @@
1
+ import { RegisteredComponentProps } from '@cratis/scene.react';
2
+ import { NumberFormat } from './formatting';
3
+ import { readFoundationStrings } from './foundationStrings';
4
+ export type TrendDirection = 'up' | 'down' | 'flat';
5
+ export type TrendOutcome = 'good' | 'bad' | 'neutral';
6
+ export declare function trendDirection(change: number): TrendDirection;
7
+ export declare function trendOutcome(direction: TrendDirection, goodDirection: 'up' | 'down'): TrendOutcome;
8
+ export interface TrendChipViewProps {
9
+ change: number;
10
+ locale: string;
11
+ goodDirection?: 'up' | 'down';
12
+ comparison?: string;
13
+ format?: NumberFormat;
14
+ strings: ReturnType<typeof readFoundationStrings>;
15
+ }
16
+ export declare function TrendChipView({ change, locale, goodDirection, comparison, format, strings }: TrendChipViewProps): import("react").JSX.Element;
17
+ export declare function TrendChip({ element }: RegisteredComponentProps): import("react").JSX.Element | undefined;
18
+ //# sourceMappingURL=TrendChip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrendChip.d.ts","sourceRoot":"","sources":["../../../foundation/TrendChip.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAgB,YAAY,EAAc,MAAM,cAAc,CAAC;AACtE,OAAO,EAAc,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIxE,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAGtD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAE7D;AAGD,wBAAgB,YAAY,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY,CAElG;AAMD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;CACrD;AAQD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,aAAoB,EAAE,UAAU,EAAE,MAA6B,EAAE,OAAO,EAAE,EAAE,kBAAkB,+BAc7I;AAQD,wBAAgB,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,2CAW9D"}
@@ -0,0 +1,88 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { FoundationIcon } from './FoundationIcon.js';
3
+ import { NumberFormat, readLocale, formatNumber } from './formatting.js';
4
+ import { readFoundationStrings, formatText } from './foundationStrings.js';
5
+ import { readOptionalString } from '../shell/elementProperties.js';
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /** The direction a change moved in. */ function trendDirection(change) {
10
+ return change > 0 ? 'up' : change < 0 ? 'down' : 'flat';
11
+ }
12
+ /** Whether a movement is good for a measure, given which direction is the good one. */ function trendOutcome(direction, goodDirection) {
13
+ return direction === 'flat' ? 'neutral' : direction === goodDirection ? 'good' : 'bad';
14
+ }
15
+ /** The tone each outcome is drawn in. */ const tones = {
16
+ good: 'success',
17
+ bad: 'danger',
18
+ neutral: 'neutral'
19
+ };
20
+ /**
21
+ * A change, drawn as an arrow, the change and what it is compared to.
22
+ *
23
+ * Color says whether the movement is good, but never alone: the arrow gives direction and a visually hidden sentence
24
+ * says all of it ("up 12.5% compared to last month"), so the chip reads the same without color.
25
+ */ function TrendChipView({ change, locale, goodDirection = 'up', comparison, format = NumberFormat.Percent, strings }) {
26
+ const direction = trendDirection(change);
27
+ const outcome = trendOutcome(direction, goodDirection);
28
+ const magnitude = formatNumber(Math.abs(change), locale, format);
29
+ const spoken = direction === 'flat' ? strings.trendFlat : formatText(direction === 'up' ? strings.trendUp : strings.trendDown, {
30
+ value: magnitude
31
+ });
32
+ return /*#__PURE__*/ jsxs("span", {
33
+ className: "foundation-chip foundation-trend",
34
+ "data-tone": tones[outcome],
35
+ "data-direction": direction,
36
+ children: [
37
+ /*#__PURE__*/ jsx(FoundationIcon, {
38
+ name: direction === 'up' ? 'arrow-up' : direction === 'down' ? 'arrow-down' : 'minus'
39
+ }),
40
+ /*#__PURE__*/ jsx("span", {
41
+ "aria-hidden": "true",
42
+ children: direction === 'flat' ? magnitude : magnitude
43
+ }),
44
+ /*#__PURE__*/ jsxs("span", {
45
+ className: "foundation-visually-hidden",
46
+ children: [
47
+ spoken,
48
+ comparison ? ` ${formatText(strings.trendComparison, {
49
+ period: comparison
50
+ })}` : ''
51
+ ]
52
+ }),
53
+ comparison && /*#__PURE__*/ jsx("span", {
54
+ className: "foundation-trend-comparison",
55
+ "aria-hidden": "true",
56
+ children: formatText(strings.trendComparison, {
57
+ period: comparison
58
+ })
59
+ })
60
+ ]
61
+ });
62
+ }
63
+ /**
64
+ * The `trendChip` component: a change with its direction, whether that is good, and what it is compared to.
65
+ *
66
+ * `change` is the movement as a number (a percentage by default), `goodDirection` says which way is good, and `comparison` names
67
+ * the period. Without a number the chip is empty, and then it draws nothing rather than an invented zero.
68
+ */ function TrendChip({ element }) {
69
+ const change = element.properties.change;
70
+ if (typeof change !== 'number') return undefined;
71
+ return /*#__PURE__*/ jsx("span", {
72
+ className: "foundation foundation-trend-chip",
73
+ "data-scene-id": element.id,
74
+ children: /*#__PURE__*/ jsx(TrendChipView, {
75
+ change: change,
76
+ locale: readLocale(element),
77
+ goodDirection: element.properties.goodDirection === 'down' ? 'down' : 'up',
78
+ comparison: readOptionalString(element, 'comparison'),
79
+ strings: readFoundationStrings(element),
80
+ ...typeof element.properties.format === 'string' && Object.values(NumberFormat).includes(element.properties.format) ? {
81
+ format: element.properties.format
82
+ } : {}
83
+ })
84
+ });
85
+ }
86
+
87
+ export { TrendChip, TrendChipView, trendDirection, trendOutcome };
88
+ //# sourceMappingURL=TrendChip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrendChip.js","sources":["../../../foundation/TrendChip.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { FoundationIcon } from './FoundationIcon';\nimport { formatNumber, NumberFormat, readLocale } from './formatting';\nimport { formatText, readFoundationStrings } from './foundationStrings';\nimport { readOptionalString } from '../shell/elementProperties';\n\n/** The direction a measure moved. */\nexport type TrendDirection = 'up' | 'down' | 'flat';\n\n/** Whether a movement is good, bad or neither, which is independent of whether the number rose: falling response time is good. */\nexport type TrendOutcome = 'good' | 'bad' | 'neutral';\n\n/** The direction a change moved in. */\nexport function trendDirection(change: number): TrendDirection {\n return change > 0 ? 'up' : change < 0 ? 'down' : 'flat';\n}\n\n/** Whether a movement is good for a measure, given which direction is the good one. */\nexport function trendOutcome(direction: TrendDirection, goodDirection: 'up' | 'down'): TrendOutcome {\n return direction === 'flat' ? 'neutral' : direction === goodDirection ? 'good' : 'bad';\n}\n\n/** The tone each outcome is drawn in. */\nconst tones: Record<TrendOutcome, string> = { good: 'success', bad: 'danger', neutral: 'neutral' };\n\n/** The props of a trend chip drawn directly, as the stat card does. */\nexport interface TrendChipViewProps {\n change: number;\n locale: string;\n goodDirection?: 'up' | 'down';\n comparison?: string;\n format?: NumberFormat;\n strings: ReturnType<typeof readFoundationStrings>;\n}\n\n/**\n * A change, drawn as an arrow, the change and what it is compared to.\n *\n * Color says whether the movement is good, but never alone: the arrow gives direction and a visually hidden sentence\n * says all of it (\"up 12.5% compared to last month\"), so the chip reads the same without color.\n */\nexport function TrendChipView({ change, locale, goodDirection = 'up', comparison, format = NumberFormat.Percent, strings }: TrendChipViewProps) {\n const direction = trendDirection(change);\n const outcome = trendOutcome(direction, goodDirection);\n const magnitude = formatNumber(Math.abs(change), locale, format);\n const spoken = direction === 'flat' ? strings.trendFlat : formatText(direction === 'up' ? strings.trendUp : strings.trendDown, { value: magnitude });\n\n return (\n <span className='foundation-chip foundation-trend' data-tone={tones[outcome]} data-direction={direction}>\n <FoundationIcon name={direction === 'up' ? 'arrow-up' : direction === 'down' ? 'arrow-down' : 'minus'} />\n <span aria-hidden='true'>{direction === 'flat' ? magnitude : magnitude}</span>\n <span className='foundation-visually-hidden'>{spoken}{comparison ? ` ${formatText(strings.trendComparison, { period: comparison })}` : ''}</span>\n {comparison && <span className='foundation-trend-comparison' aria-hidden='true'>{formatText(strings.trendComparison, { period: comparison })}</span>}\n </span>\n );\n}\n\n/**\n * The `trendChip` component: a change with its direction, whether that is good, and what it is compared to.\n *\n * `change` is the movement as a number (a percentage by default), `goodDirection` says which way is good, and `comparison` names\n * the period. Without a number the chip is empty, and then it draws nothing rather than an invented zero.\n */\nexport function TrendChip({ element }: RegisteredComponentProps) {\n const change = element.properties.change;\n if (typeof change !== 'number') return undefined;\n\n return (\n <span className='foundation foundation-trend-chip' data-scene-id={element.id}>\n <TrendChipView change={change} locale={readLocale(element)} goodDirection={element.properties.goodDirection === 'down' ? 'down' : 'up'}\n comparison={readOptionalString(element, 'comparison')} strings={readFoundationStrings(element)}\n {...(typeof element.properties.format === 'string' && (Object.values(NumberFormat) as string[]).includes(element.properties.format) ? { format: element.properties.format as NumberFormat } : {})} />\n </span>\n );\n}\n"],"names":["trendDirection","change","trendOutcome","direction","goodDirection","tones","good","bad","neutral","TrendChipView","locale","comparison","format","NumberFormat","Percent","strings","outcome","magnitude","formatNumber","Math","abs","spoken","trendFlat","formatText","trendUp","trendDown","value","_jsxs","span","className","data-tone","data-direction","_jsx","FoundationIcon","name","aria-hidden","trendComparison","period","TrendChip","element","properties","undefined","data-scene-id","id","readLocale","readOptionalString","readFoundationStrings","Object","values","includes"],"mappings":";;;;;;AAAA;AACA;AAcA,wCACO,SAASA,cAAAA,CAAeC,MAAc,EAAA;AACzC,IAAA,OAAOA,MAAAA,GAAS,CAAA,GAAI,IAAA,GAAOA,MAAAA,GAAS,IAAI,MAAA,GAAS,MAAA;AACrD;AAEA,wFACO,SAASC,YAAAA,CAAaC,SAAyB,EAAEC,aAA4B,EAAA;AAChF,IAAA,OAAOD,SAAAA,KAAc,MAAA,GAAS,SAAA,GAAYA,SAAAA,KAAcC,gBAAgB,MAAA,GAAS,KAAA;AACrF;AAEA,0CACA,MAAMC,KAAAA,GAAsC;IAAEC,IAAAA,EAAM,SAAA;IAAWC,GAAAA,EAAK,QAAA;IAAUC,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-0,0 +1,13 @@
1
+ import { ExternalComponent } from '@cratis/scene.model';
2
+ export declare enum NumberFormat {
3
+ Number = "number",
4
+ Currency = "currency",
5
+ Percent = "percent",
6
+ Compact = "compact"
7
+ }
8
+ export declare function readLocale(element: ExternalComponent): string;
9
+ export declare function isRightToLeft(locale: string): boolean;
10
+ export declare function formatNumber(value: number, locale: string, format?: NumberFormat, currency?: string, maximumFractionDigits?: number): string;
11
+ export declare function readNumberFormat(element: ExternalComponent, property?: string): NumberFormat;
12
+ export declare function formatDate(value: unknown, locale: string, withTime?: boolean): string;
13
+ //# sourceMappingURL=formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../foundation/formatting.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,oBAAY,YAAY;IACpB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;CACtB;AAMD,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAK7D;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAQrD;AAGD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,YAAkC,EAAE,QAAQ,SAAQ,EAAE,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,CAehK;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,SAAW,GAAG,YAAY,CAG9F;AAGD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,MAAM,CAQnF"}
@@ -0,0 +1,78 @@
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
+ /** How a number is presented. */ var NumberFormat = /*#__PURE__*/ function(NumberFormat) {
4
+ NumberFormat["Number"] = "number";
5
+ NumberFormat["Currency"] = "currency";
6
+ NumberFormat["Percent"] = "percent";
7
+ NumberFormat["Compact"] = "compact";
8
+ return NumberFormat;
9
+ }({});
10
+ /**
11
+ * The locale a component formats dates, numbers and currency in: the element's `locale`, else the document language, else the
12
+ * runtime's. Formatting never goes through a fixed locale, so the same screen reads correctly in every one.
13
+ */ function readLocale(element) {
14
+ const supplied = element.properties.locale;
15
+ if (typeof supplied === 'string' && supplied.length > 0) return supplied;
16
+ if (typeof document !== 'undefined' && document.documentElement.lang) return document.documentElement.lang;
17
+ return typeof navigator !== 'undefined' && navigator.language ? navigator.language : 'en';
18
+ }
19
+ /** Whether the locale reads right to left, so a component can mirror what direction-sensitive CSS cannot. */ function isRightToLeft(locale) {
20
+ try {
21
+ const info = new Intl.Locale(locale);
22
+ const direction = info.getTextInfo?.().direction ?? info.textInfo?.direction;
23
+ return direction === 'rtl';
24
+ } catch {
25
+ return false;
26
+ }
27
+ }
28
+ /** Formats a number for a locale, as a plain number, currency, percent (the value is the percentage, 12.5 is 12.5%) or compact. */ function formatNumber(value, locale, format = "number", currency = 'USD', maximumFractionDigits) {
29
+ try {
30
+ switch(format){
31
+ case "currency":
32
+ return new Intl.NumberFormat(locale, {
33
+ style: 'currency',
34
+ currency,
35
+ ...maximumFractionDigits === undefined ? {} : {
36
+ maximumFractionDigits
37
+ }
38
+ }).format(value);
39
+ case "percent":
40
+ return new Intl.NumberFormat(locale, {
41
+ style: 'percent',
42
+ maximumFractionDigits: maximumFractionDigits ?? 1
43
+ }).format(value / 100);
44
+ case "compact":
45
+ return new Intl.NumberFormat(locale, {
46
+ notation: 'compact',
47
+ maximumFractionDigits: maximumFractionDigits ?? 1
48
+ }).format(value);
49
+ default:
50
+ return new Intl.NumberFormat(locale, {
51
+ maximumFractionDigits: maximumFractionDigits ?? 2
52
+ }).format(value);
53
+ }
54
+ } catch {
55
+ return String(value);
56
+ }
57
+ }
58
+ /** Reads a number format name, defaulting to a plain number. */ function readNumberFormat(element, property = 'format') {
59
+ const value = element.properties[property];
60
+ return Object.values(NumberFormat).includes(value) ? value : "number";
61
+ }
62
+ /** Formats a date or an ISO 8601 date-time for a locale; a value that is not a date is returned as it was written. */ function formatDate(value, locale, withTime = false) {
63
+ const date = value instanceof Date ? value : typeof value === 'string' || typeof value === 'number' ? new Date(value) : undefined;
64
+ if (!date || Number.isNaN(date.getTime())) return typeof value === 'string' ? value : '';
65
+ try {
66
+ return new Intl.DateTimeFormat(locale, withTime ? {
67
+ dateStyle: 'medium',
68
+ timeStyle: 'short'
69
+ } : {
70
+ dateStyle: 'medium'
71
+ }).format(date);
72
+ } catch {
73
+ return date.toISOString();
74
+ }
75
+ }
76
+
77
+ export { NumberFormat, formatDate, formatNumber, isRightToLeft, readLocale, readNumberFormat };
78
+ //# sourceMappingURL=formatting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.js","sources":["../../../foundation/formatting.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ExternalComponent } from '@cratis/scene.model';\n\n/** How a number is presented. */\nexport enum NumberFormat {\n Number = 'number',\n Currency = 'currency',\n Percent = 'percent',\n Compact = 'compact',\n}\n\n/**\n * The locale a component formats dates, numbers and currency in: the element's `locale`, else the document language, else the\n * runtime's. Formatting never goes through a fixed locale, so the same screen reads correctly in every one.\n */\nexport function readLocale(element: ExternalComponent): string {\n const supplied = element.properties.locale;\n if (typeof supplied === 'string' && supplied.length > 0) return supplied;\n if (typeof document !== 'undefined' && document.documentElement.lang) return document.documentElement.lang;\n return typeof navigator !== 'undefined' && navigator.language ? navigator.language : 'en';\n}\n\n/** Whether the locale reads right to left, so a component can mirror what direction-sensitive CSS cannot. */\nexport function isRightToLeft(locale: string): boolean {\n try {\n const info = new Intl.Locale(locale) as Intl.Locale & { getTextInfo?: () => { direction: string }; textInfo?: { direction: string } };\n const direction = info.getTextInfo?.().direction ?? info.textInfo?.direction;\n return direction === 'rtl';\n } catch {\n return false;\n }\n}\n\n/** Formats a number for a locale, as a plain number, currency, percent (the value is the percentage, 12.5 is 12.5%) or compact. */\nexport function formatNumber(value: number, locale: string, format: NumberFormat = NumberFormat.Number, currency = 'USD', maximumFractionDigits?: number): string {\n try {\n switch (format) {\n case NumberFormat.Currency:\n return new Intl.NumberFormat(locale, { style: 'currency', currency, ...(maximumFractionDigits === undefined ? {} : { maximumFractionDigits }) }).format(value);\n case NumberFormat.Percent:\n return new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: maximumFractionDigits ?? 1 }).format(value / 100);\n case NumberFormat.Compact:\n return new Intl.NumberFormat(locale, { notation: 'compact', maximumFractionDigits: maximumFractionDigits ?? 1 }).format(value);\n default:\n return new Intl.NumberFormat(locale, { maximumFractionDigits: maximumFractionDigits ?? 2 }).format(value);\n }\n } catch {\n return String(value);\n }\n}\n\n/** Reads a number format name, defaulting to a plain number. */\nexport function readNumberFormat(element: ExternalComponent, property = 'format'): NumberFormat {\n const value = element.properties[property];\n return (Object.values(NumberFormat) as string[]).includes(value as string) ? (value as NumberFormat) : NumberFormat.Number;\n}\n\n/** Formats a date or an ISO 8601 date-time for a locale; a value that is not a date is returned as it was written. */\nexport function formatDate(value: unknown, locale: string, withTime = false): string {\n const date = value instanceof Date ? value : typeof value === 'string' || typeof value === 'number' ? new Date(value) : undefined;\n if (!date || Number.isNaN(date.getTime())) return typeof value === 'string' ? value : '';\n try {\n return new Intl.DateTimeFormat(locale, withTime ? { dateStyle: 'medium', timeStyle: 'short' } : { dateStyle: 'medium' }).format(date);\n } catch {\n return date.toISOString();\n }\n}\n"],"names":["NumberFormat","readLocale","element","supplied","properties","locale","length","document","documentElement","lang","navigator","language","isRightToLeft","info","Intl","Locale","direction","getTextInfo","textInfo","formatNumber","value","format","currency","maximumFractionDigits","style","undefined","notation","String","readNumberFormat","property","Object","values","includes","formatDate","withTime","date","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EAAE6B,QAAAA,GAAW,KAAK,EAAA;AACvE,IAAA,MAAMC,IAAAA,GAAOf,KAAAA,YAAiBgB,IAAAA,GAAOhB,KAAAA,GAAQ,OAAOA,KAAAA,KAAU,QAAA,IAAY,OAAOA,KAAAA,KAAU,QAAA,GAAW,IAAIgB,IAAAA,CAAKhB,KAAAA,CAAAA,GAASK,SAAAA;AACxH,IAAA,IAAI,CAACU,IAAAA,IAAQE,MAAAA,CAAOC,KAAK,CAACH,IAAAA,CAAKI,OAAO,EAAA,CAAA,EAAK,OAAO,OAAOnB,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQ,EAAA;IACtF,IAAI;AACA,QAAA,OAAO,IAAIN,IAAAA,CAAK0B,cAAc,CAACnC,QAAQ6B,QAAAA,GAAW;YAAEO,SAAAA,EAAW,QAAA;YAAUC,SAAAA,EAAW;SAAQ,GAAI;YAAED,SAAAA,EAAW;AAAS,SAAA,CAAA,CAAGpB,MAAM,CAACc,IAAAA,CAAAA;AACpI,IAAA,CAAA,CAAE,OAAM;AACJ,QAAA,OAAOA,KAAKQ,WAAW,EAAA;AAC3B,IAAA;AACJ;;"}
@@ -0,0 +1,3 @@
1
+ import { ComponentMetadata } from '@cratis/scene.react';
2
+ export declare const foundationComponentMetadata: Record<string, ComponentMetadata>;
3
+ //# sourceMappingURL=foundationComponentMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundationComponentMetadata.d.ts","sourceRoot":"","sources":["../../../foundation/foundationComponentMetadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAA0B,MAAM,qBAAqB,CAAC;AAOhF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAKzE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { ComponentCategory } from '@cratis/scene.model';
2
+ import { componentMetadata } from '@cratis/scene.react';
3
+ import { ComponentName } from '../ComponentName.js';
4
+
5
+ // Copyright (c) Cratis. All rights reserved.
6
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
7
+ /**
8
+ * The category, icon, keywords and picker badge of every foundation component (CMP1), keyed by bare component name.
9
+ * The names are those of `ComponentName`; the metadata of the rest of the package lives in `defaultBlueprintComponentMetadata`.
10
+ */ const foundationComponentMetadata = {
11
+ [ComponentName.EmptyState]: componentMetadata('Empty state', ComponentCategory.Feedback, 'inbox', [
12
+ 'no data',
13
+ 'nothing',
14
+ 'blank slate',
15
+ 'zero state'
16
+ ]),
17
+ [ComponentName.StatCard]: componentMetadata('Stat card', ComponentCategory.DataDisplay, 'gauge', [
18
+ 'kpi',
19
+ 'metric',
20
+ 'figure',
21
+ 'number',
22
+ 'dashboard'
23
+ ]),
24
+ [ComponentName.TrendChip]: componentMetadata('Trend chip', ComponentCategory.DataDisplay, 'trending-up', [
25
+ 'delta',
26
+ 'change',
27
+ 'arrow',
28
+ 'comparison'
29
+ ]),
30
+ [ComponentName.StatusChip]: componentMetadata('Status chip', ComponentCategory.DataDisplay, 'badge-check', [
31
+ 'badge',
32
+ 'state',
33
+ 'tag',
34
+ 'label'
35
+ ])
36
+ };
37
+
38
+ export { foundationComponentMetadata };
39
+ //# sourceMappingURL=foundationComponentMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundationComponentMetadata.js","sources":["../../../foundation/foundationComponentMetadata.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentCategory } from '@cratis/scene.model';\nimport { ComponentMetadata, componentMetadata as m } from '@cratis/scene.react';\nimport { ComponentName } from '../ComponentName';\n\n/**\n * The category, icon, keywords and picker badge of every foundation component (CMP1), keyed by bare component name.\n * The names are those of `ComponentName`; the metadata of the rest of the package lives in `defaultBlueprintComponentMetadata`.\n */\nexport const foundationComponentMetadata: Record<string, ComponentMetadata> = {\n [ComponentName.EmptyState]: m('Empty state', ComponentCategory.Feedback, 'inbox', ['no data', 'nothing', 'blank slate', 'zero state']),\n [ComponentName.StatCard]: m('Stat card', ComponentCategory.DataDisplay, 'gauge', ['kpi', 'metric', 'figure', 'number', 'dashboard']),\n [ComponentName.TrendChip]: m('Trend chip', ComponentCategory.DataDisplay, 'trending-up', ['delta', 'change', 'arrow', 'comparison']),\n [ComponentName.StatusChip]: m('Status chip', ComponentCategory.DataDisplay, 'badge-check', ['badge', 'state', 'tag', 'label']),\n};\n"],"names":["foundationComponentMetadata","ComponentName","EmptyState","m","ComponentCategory","Feedback","StatCard","DataDisplay","TrendChip","StatusChip"],"mappings":";;;;AAAA;AACA;AAMA;;;UAIaA,2BAAAA,GAAiE;IAC1E,CAACC,aAAAA,CAAcC,UAAU,GAAGC,kBAAE,aAAA,EAAeC,iBAAAA,CAAkBC,QAAQ,EAAE,OAAA,EAAS;AAAC,QAAA,SAAA;AAAW,QAAA,SAAA;AAAW,QAAA,aAAA;AAAe,QAAA;AAAa,KAAA,CAAA;IACrI,CAACJ,aAAAA,CAAcK,QAAQ,GAAGH,kBAAE,WAAA,EAAaC,iBAAAA,CAAkBG,WAAW,EAAE,OAAA,EAAS;AAAC,QAAA,KAAA;AAAO,QAAA,QAAA;AAAU,QAAA,QAAA;AAAU,QAAA,QAAA;AAAU,QAAA;AAAY,KAAA,CAAA;IACnI,CAACN,aAAAA,CAAcO,SAAS,GAAGL,kBAAE,YAAA,EAAcC,iBAAAA,CAAkBG,WAAW,EAAE,aAAA,EAAe;AAAC,QAAA,OAAA;AAAS,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA;AAAa,KAAA,CAAA;IACnI,CAACN,aAAAA,CAAcQ,UAAU,GAAGN,kBAAE,aAAA,EAAeC,iBAAAA,CAAkBG,WAAW,EAAE,aAAA,EAAe;AAAC,QAAA,OAAA;AAAS,QAAA,OAAA;AAAS,QAAA,KAAA;AAAO,QAAA;AAAQ,KAAA;AACjI;;"}
@@ -0,0 +1,6 @@
1
+ import { BindingSourceKind, ComponentDescriptor, PropertyDescriptor } from '@cratis/scene.model';
2
+ export declare const bindable: BindingSourceKind[];
3
+ export declare const list: (path: string, label: string, group: string, itemLabel: string, properties: PropertyDescriptor[], description?: string) => PropertyDescriptor;
4
+ export declare const standardStateProperties: PropertyDescriptor[];
5
+ export declare const foundationDescriptors: ComponentDescriptor[];
6
+ //# sourceMappingURL=foundationDescriptors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundationDescriptors.d.ts","sourceRoot":"","sources":["../../../foundation/foundationDescriptors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAyC,MAAM,qBAAqB,CAAC;AAUxI,eAAO,MAAM,QAAQ,qBAAsG,CAAC;AAiB5H,eAAO,MAAM,IAAI,SAAU,MAAM,SAAS,MAAM,SAAS,MAAM,aAAa,MAAM,cAAc,kBAAkB,EAAE,gBAAgB,MAAM,KAAG,kBACoC,CAAC;AAMlL,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,EAkBvD,CAAC;AAOF,eAAO,MAAM,qBAAqB,EAAE,mBAAmB,EAuDtD,CAAC"}
@@ -0,0 +1,227 @@
1
+ import { BindingSourceKind, PropertyEditorKind, PropertyValueType } from '@cratis/scene.model';
2
+ import { componentRegistryKey } from '@cratis/scene.react';
3
+ import { ComponentName } from '../ComponentName.js';
4
+ import { defaultBlueprintName } from '../packageName.js';
5
+ import { ComponentState } from './ComponentState.js';
6
+ import { NumberFormat } from './formatting.js';
7
+ import { PermissionRule } from './PermissionRule.js';
8
+ import { StatusTone } from './StatusChip.js';
9
+
10
+ // Copyright (c) Cratis. All rights reserved.
11
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
12
+ /** Data properties take what a screen binds them to: a query's result, a data context or another component's output. */ const bindable = [
13
+ BindingSourceKind.DataContext,
14
+ BindingSourceKind.QueryResult,
15
+ BindingSourceKind.ComponentProperty
16
+ ];
17
+ const text = (path, label, group, description, extra = {})=>({
18
+ path,
19
+ label,
20
+ group,
21
+ valueType: PropertyValueType.String,
22
+ ...group === 'Data' ? {
23
+ acceptedBindingKinds: bindable
24
+ } : {},
25
+ ...description === undefined ? {} : {
26
+ description
27
+ },
28
+ ...extra
29
+ });
30
+ const number = (path, label, group, description, extra = {})=>({
31
+ path,
32
+ label,
33
+ group,
34
+ valueType: PropertyValueType.Number,
35
+ editorKind: PropertyEditorKind.Number,
36
+ ...group === 'Data' ? {
37
+ acceptedBindingKinds: bindable
38
+ } : {},
39
+ ...description === undefined ? {} : {
40
+ description
41
+ },
42
+ ...extra
43
+ });
44
+ const flag = (path, label, group, description, extra = {})=>({
45
+ path,
46
+ label,
47
+ group,
48
+ valueType: PropertyValueType.Boolean,
49
+ editorKind: PropertyEditorKind.Boolean,
50
+ ...description === undefined ? {} : {
51
+ description
52
+ },
53
+ ...extra
54
+ });
55
+ const choice = (path, label, group, values, defaultValue, description)=>({
56
+ path,
57
+ label,
58
+ group,
59
+ valueType: PropertyValueType.Enum,
60
+ editorKind: PropertyEditorKind.Enum,
61
+ default: defaultValue,
62
+ choices: Object.entries(values).map(([value, name])=>({
63
+ value,
64
+ label: name
65
+ })),
66
+ ...description === undefined ? {} : {
67
+ description
68
+ }
69
+ });
70
+ const list = (path, label, group, itemLabel, properties, description)=>({
71
+ path,
72
+ label,
73
+ group,
74
+ valueType: PropertyValueType.Collection,
75
+ default: [],
76
+ item: {
77
+ label: itemLabel,
78
+ properties
79
+ },
80
+ ...description === undefined ? {} : {
81
+ description
82
+ }
83
+ });
84
+ const rule = (path, label, description)=>choice(path, label, 'Permissions', {
85
+ [PermissionRule.Enabled]: 'Enabled',
86
+ [PermissionRule.Disabled]: 'Disabled',
87
+ [PermissionRule.Hidden]: 'Hidden'
88
+ }, PermissionRule.Enabled, description);
89
+ /** The properties every data-showing foundation component shares: the standard states (spec Part B 1.4) and the cross-cutting rules of 1.5. */ const standardStateProperties = [
90
+ choice('state', 'Preview state', 'State', {
91
+ [ComponentState.Ready]: 'Ready',
92
+ [ComponentState.Loading]: 'Loading',
93
+ [ComponentState.Empty]: 'Empty',
94
+ [ComponentState.Error]: 'Error',
95
+ [ComponentState.NoPermission]: 'No permission',
96
+ [ComponentState.Partial]: 'Partial'
97
+ }, ComponentState.Ready, 'Forces a state so each can be designed and previewed; empty means the state follows the bound data.'),
98
+ text('error', 'Error message', 'State', 'The message of the error state; setting it puts the component in that state.'),
99
+ flag('loading', 'Loading', 'State', 'Shows the skeleton while the data has not answered.'),
100
+ flag('forbidden', 'Not allowed', 'State', 'Shows the no-permission state, which explains what is missing and shows no data.'),
101
+ text('permissionSubject', 'What access is missing', 'State', 'Names what the user cannot see in the no-permission message.'),
102
+ {
103
+ path: 'failedRegions',
104
+ label: 'Failed regions',
105
+ group: 'State',
106
+ valueType: PropertyValueType.Json,
107
+ editorKind: PropertyEditorKind.StringList,
108
+ default: [],
109
+ description: 'The parts that failed to load; any entry puts the component in the partial state.'
110
+ },
111
+ text('emptyHeadline', 'Empty headline', 'State'),
112
+ text('emptyHint', 'Empty hint', 'State'),
113
+ text('emptyActionLabel', 'Empty action', 'State', 'The primary action offered when there is nothing to show.'),
114
+ rule('actionPermission', 'Empty action permission', 'Whether the empty state offers its action, refuses it with a reason, or does not render it.'),
115
+ text('label', 'Label', 'Accessibility', 'The accessible name of the region.'),
116
+ text('locale', 'Locale', 'Content', 'The locale dates, numbers and currency are formatted in; empty follows the document.'),
117
+ choice('density', 'Density', 'Appearance', {
118
+ comfortable: 'Comfortable',
119
+ compact: 'Compact'
120
+ }, 'comfortable'),
121
+ {
122
+ path: 'strings',
123
+ label: 'Text overrides',
124
+ group: 'Content',
125
+ valueType: PropertyValueType.Object,
126
+ editorKind: PropertyEditorKind.StringMap,
127
+ description: 'Replaces the text the component says itself, for localization.'
128
+ }
129
+ ];
130
+ const key = (name)=>componentRegistryKey(defaultBlueprintName, name);
131
+ const formats = {
132
+ [NumberFormat.Number]: 'Number',
133
+ [NumberFormat.Currency]: 'Currency',
134
+ [NumberFormat.Percent]: 'Percent',
135
+ [NumberFormat.Compact]: 'Compact'
136
+ };
137
+ /** What can be edited on the foundation components (Part B 4). Each declares the shape of its data, never values (SD1). */ const foundationDescriptors = [
138
+ {
139
+ component: key(ComponentName.EmptyState),
140
+ displayName: 'Empty state',
141
+ description: 'An icon, a headline, a hint and one primary action; embeddable in any region.',
142
+ properties: [
143
+ text('headline', 'Headline', 'Content', undefined, {
144
+ default: 'Nothing here yet'
145
+ }),
146
+ text('hint', 'Hint', 'Content'),
147
+ text('icon', 'Icon', 'Appearance'),
148
+ text('actionLabel', 'Primary action', 'Behavior', 'The label of the one action the state offers; its behaviors say what it does.'),
149
+ rule('actionPermission', 'Action permission', 'Whether the action works, refuses with a reason, or is not rendered.'),
150
+ text('locale', 'Locale', 'Content'),
151
+ {
152
+ path: 'strings',
153
+ label: 'Text overrides',
154
+ group: 'Content',
155
+ valueType: PropertyValueType.Object,
156
+ editorKind: PropertyEditorKind.StringMap
157
+ }
158
+ ]
159
+ },
160
+ {
161
+ component: key(ComponentName.StatCard),
162
+ displayName: 'Stat card',
163
+ description: 'One key figure with its label, trend and the period the trend is compared to.',
164
+ properties: [
165
+ text('label', 'Label', 'Content', 'What the figure measures.', {
166
+ constraints: {
167
+ required: true
168
+ }
169
+ }),
170
+ number('value', 'Value', 'Data', 'The figure; bind it to a query result.'),
171
+ choice('format', 'Format', 'Appearance', formats, NumberFormat.Number),
172
+ text('currency', 'Currency', 'Appearance', 'The ISO 4217 code when the format is currency.'),
173
+ number('fractionDigits', 'Fraction digits', 'Appearance'),
174
+ number('change', 'Change', 'Data', 'How much the figure moved, as a percentage; bind it to a query result.'),
175
+ choice('goodDirection', 'Good direction', 'Appearance', {
176
+ up: 'Up is good',
177
+ down: 'Down is good'
178
+ }, 'up', 'Which movement is good: a falling response time is.'),
179
+ text('comparison', 'Compared to', 'Content', 'The period the change is compared to, for example "last month".'),
180
+ ...standardStateProperties.filter((property)=>property.path !== 'label')
181
+ ]
182
+ },
183
+ {
184
+ component: key(ComponentName.TrendChip),
185
+ displayName: 'Trend chip',
186
+ description: 'A change drawn as a direction, a magnitude and whether the movement is good.',
187
+ properties: [
188
+ number('change', 'Change', 'Data', 'The movement; bind it to a query result.'),
189
+ choice('format', 'Format', 'Appearance', formats, NumberFormat.Percent),
190
+ choice('goodDirection', 'Good direction', 'Appearance', {
191
+ up: 'Up is good',
192
+ down: 'Down is good'
193
+ }, 'up'),
194
+ text('comparison', 'Compared to', 'Content'),
195
+ text('locale', 'Locale', 'Content'),
196
+ {
197
+ path: 'strings',
198
+ label: 'Text overrides',
199
+ group: 'Content',
200
+ valueType: PropertyValueType.Object,
201
+ editorKind: PropertyEditorKind.StringMap
202
+ }
203
+ ]
204
+ },
205
+ {
206
+ component: key(ComponentName.StatusChip),
207
+ displayName: 'Status chip',
208
+ description: 'A status shown as a semantic color, an icon and its text; the text is always shown.',
209
+ properties: [
210
+ text('status', 'Status', 'Data', 'The status text; bind it to a query result.', {
211
+ constraints: {
212
+ required: true
213
+ }
214
+ }),
215
+ choice('tone', 'Tone', 'Appearance', {
216
+ [StatusTone.Success]: 'Success',
217
+ [StatusTone.Warning]: 'Warning',
218
+ [StatusTone.Danger]: 'Danger',
219
+ [StatusTone.Info]: 'Info',
220
+ [StatusTone.Neutral]: 'Neutral'
221
+ }, StatusTone.Neutral, 'The tone picks the icon and the theme color.')
222
+ ]
223
+ }
224
+ ];
225
+
226
+ export { bindable, foundationDescriptors, list, standardStateProperties };
227
+ //# sourceMappingURL=foundationDescriptors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundationDescriptors.js","sources":["../../../foundation/foundationDescriptors.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { BindingSourceKind, ComponentDescriptor, PropertyDescriptor, PropertyEditorKind, PropertyValueType } from '@cratis/scene.model';\nimport { componentRegistryKey } from '@cratis/scene.react';\nimport { ComponentName } from '../ComponentName';\nimport { defaultBlueprintName } from '../packageName';\nimport { ComponentState } from './ComponentState';\nimport { NumberFormat } from './formatting';\nimport { PermissionRule } from './PermissionRule';\nimport { StatusTone } from './StatusChip';\n\n/** Data properties take what a screen binds them to: a query's result, a data context or another component's output. */\nexport const bindable = [BindingSourceKind.DataContext, BindingSourceKind.QueryResult, BindingSourceKind.ComponentProperty];\n\nconst text = (path: string, label: string, group: string, description?: string, extra: Partial<PropertyDescriptor> = {}): PropertyDescriptor =>\n ({ path, label, group, valueType: PropertyValueType.String, ...(group === 'Data' ? { acceptedBindingKinds: bindable } : {}), ...(description === undefined ? {} : { description }), ...extra });\n\nconst number = (path: string, label: string, group: string, description?: string, extra: Partial<PropertyDescriptor> = {}): PropertyDescriptor =>\n ({ path, label, group, valueType: PropertyValueType.Number, editorKind: PropertyEditorKind.Number, ...(group === 'Data' ? { acceptedBindingKinds: bindable } : {}), ...(description === undefined ? {} : { description }), ...extra });\n\nconst flag = (path: string, label: string, group: string, description?: string, extra: Partial<PropertyDescriptor> = {}): PropertyDescriptor =>\n ({ path, label, group, valueType: PropertyValueType.Boolean, editorKind: PropertyEditorKind.Boolean, ...(description === undefined ? {} : { description }), ...extra });\n\nconst choice = (path: string, label: string, group: string, values: Record<string, string>, defaultValue: string, description?: string): PropertyDescriptor =>\n ({\n path, label, group, valueType: PropertyValueType.Enum, editorKind: PropertyEditorKind.Enum, default: defaultValue,\n choices: Object.entries(values).map(([value, name]) => ({ value, label: name })), ...(description === undefined ? {} : { description }),\n });\n\nexport const list = (path: string, label: string, group: string, itemLabel: string, properties: PropertyDescriptor[], description?: string): PropertyDescriptor =>\n ({ path, label, group, valueType: PropertyValueType.Collection, default: [], item: { label: itemLabel, properties }, ...(description === undefined ? {} : { description }) });\n\nconst rule = (path: string, label: string, description: string): PropertyDescriptor =>\n choice(path, label, 'Permissions', { [PermissionRule.Enabled]: 'Enabled', [PermissionRule.Disabled]: 'Disabled', [PermissionRule.Hidden]: 'Hidden' }, PermissionRule.Enabled, description);\n\n/** The properties every data-showing foundation component shares: the standard states (spec Part B 1.4) and the cross-cutting rules of 1.5. */\nexport const standardStateProperties: PropertyDescriptor[] = [\n choice('state', 'Preview state', 'State', {\n [ComponentState.Ready]: 'Ready', [ComponentState.Loading]: 'Loading', [ComponentState.Empty]: 'Empty',\n [ComponentState.Error]: 'Error', [ComponentState.NoPermission]: 'No permission', [ComponentState.Partial]: 'Partial',\n }, ComponentState.Ready, 'Forces a state so each can be designed and previewed; empty means the state follows the bound data.'),\n text('error', 'Error message', 'State', 'The message of the error state; setting it puts the component in that state.'),\n flag('loading', 'Loading', 'State', 'Shows the skeleton while the data has not answered.'),\n flag('forbidden', 'Not allowed', 'State', 'Shows the no-permission state, which explains what is missing and shows no data.'),\n text('permissionSubject', 'What access is missing', 'State', 'Names what the user cannot see in the no-permission message.'),\n { 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.' },\n text('emptyHeadline', 'Empty headline', 'State'),\n text('emptyHint', 'Empty hint', 'State'),\n text('emptyActionLabel', 'Empty action', 'State', 'The primary action offered when there is nothing to show.'),\n rule('actionPermission', 'Empty action permission', 'Whether the empty state offers its action, refuses it with a reason, or does not render it.'),\n text('label', 'Label', 'Accessibility', 'The accessible name of the region.'),\n text('locale', 'Locale', 'Content', 'The locale dates, numbers and currency are formatted in; empty follows the document.'),\n choice('density', 'Density', 'Appearance', { comfortable: 'Comfortable', compact: 'Compact' }, 'comfortable'),\n { path: 'strings', label: 'Text overrides', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap, description: 'Replaces the text the component says itself, for localization.' },\n];\n\nconst key = (name: ComponentName) => componentRegistryKey(defaultBlueprintName, name);\n\nconst formats = { [NumberFormat.Number]: 'Number', [NumberFormat.Currency]: 'Currency', [NumberFormat.Percent]: 'Percent', [NumberFormat.Compact]: 'Compact' };\n\n/** What can be edited on the foundation components (Part B 4). Each declares the shape of its data, never values (SD1). */\nexport const foundationDescriptors: ComponentDescriptor[] = [\n {\n component: key(ComponentName.EmptyState),\n displayName: 'Empty state',\n description: 'An icon, a headline, a hint and one primary action; embeddable in any region.',\n properties: [\n text('headline', 'Headline', 'Content', undefined, { default: 'Nothing here yet' }),\n text('hint', 'Hint', 'Content'),\n text('icon', 'Icon', 'Appearance'),\n text('actionLabel', 'Primary action', 'Behavior', 'The label of the one action the state offers; its behaviors say what it does.'),\n rule('actionPermission', 'Action permission', 'Whether the action works, refuses with a reason, or is not rendered.'),\n text('locale', 'Locale', 'Content'),\n { path: 'strings', label: 'Text overrides', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap },\n ],\n },\n {\n component: key(ComponentName.StatCard),\n displayName: 'Stat card',\n description: 'One key figure with its label, trend and the period the trend is compared to.',\n properties: [\n text('label', 'Label', 'Content', 'What the figure measures.', { constraints: { required: true } }),\n number('value', 'Value', 'Data', 'The figure; bind it to a query result.'),\n choice('format', 'Format', 'Appearance', formats, NumberFormat.Number),\n text('currency', 'Currency', 'Appearance', 'The ISO 4217 code when the format is currency.'),\n number('fractionDigits', 'Fraction digits', 'Appearance'),\n number('change', 'Change', 'Data', 'How much the figure moved, as a percentage; bind it to a query result.'),\n choice('goodDirection', 'Good direction', 'Appearance', { up: 'Up is good', down: 'Down is good' }, 'up', 'Which movement is good: a falling response time is.'),\n text('comparison', 'Compared to', 'Content', 'The period the change is compared to, for example \"last month\".'),\n ...standardStateProperties.filter(property => property.path !== 'label'),\n ],\n },\n {\n component: key(ComponentName.TrendChip),\n displayName: 'Trend chip',\n description: 'A change drawn as a direction, a magnitude and whether the movement is good.',\n properties: [\n number('change', 'Change', 'Data', 'The movement; bind it to a query result.'),\n choice('format', 'Format', 'Appearance', formats, NumberFormat.Percent),\n choice('goodDirection', 'Good direction', 'Appearance', { up: 'Up is good', down: 'Down is good' }, 'up'),\n text('comparison', 'Compared to', 'Content'),\n text('locale', 'Locale', 'Content'),\n { path: 'strings', label: 'Text overrides', group: 'Content', valueType: PropertyValueType.Object, editorKind: PropertyEditorKind.StringMap },\n ],\n },\n {\n component: key(ComponentName.StatusChip),\n displayName: 'Status chip',\n description: 'A status shown as a semantic color, an icon and its text; the text is always shown.',\n properties: [\n text('status', 'Status', 'Data', 'The status text; bind it to a query result.', { constraints: { required: true } }),\n choice('tone', 'Tone', 'Appearance', {\n [StatusTone.Success]: 'Success', [StatusTone.Warning]: 'Warning', [StatusTone.Danger]: 'Danger', [StatusTone.Info]: 'Info', [StatusTone.Neutral]: 'Neutral',\n }, StatusTone.Neutral, 'The tone picks the icon and the theme color.'),\n ],\n },\n];\n\n"],"names":["bindable","BindingSourceKind","DataContext","QueryResult","ComponentProperty","text","path","label","group","description","extra","valueType","PropertyValueType","String","acceptedBindingKinds","undefined","number","Number","editorKind","PropertyEditorKind","flag","Boolean","choice","values","defaultValue","Enum","default","choices","Object","entries","map","value","name","list","itemLabel","properties","Collection","item","rule","PermissionRule","Enabled","Disabled","Hidden","standardStateProperties","ComponentState","Ready","Loading","Empty","Error","NoPermission","Partial","Json","StringList","comfortable","compact","StringMap","key","componentRegistryKey","defaultBlueprintName","formats","NumberFormat","Currency","Percent","Compact","foundationDescriptors","component","ComponentName","EmptyState","displayName","StatCard","constraints","required","up","down","filter","property","TrendChip","StatusChip","StatusTone","Success","Warning","Danger","Info","Neutral"],"mappings":";;;;;;;;;AAAA;AACA;AAWA,yHACO,MAAMA,QAAAA,GAAW;AAACC,IAAAA,iBAAAA,CAAkBC,WAAW;AAAED,IAAAA,iBAAAA,CAAkBE,WAAW;AAAEF,IAAAA,iBAAAA,CAAkBG;;AAEzG,MAAMC,IAAAA,GAAO,CAACC,IAAAA,EAAcC,KAAAA,EAAeC,KAAAA,EAAeC,aAAsBC,KAAAA,GAAqC,EAAE,IAClH;AAAEJ,QAAAA,IAAAA;AAAMC,QAAAA,KAAAA;AAAOC,QAAAA,KAAAA;AAAOG,QAAAA,SAAAA,EAAWC,kBAAkBC,MAAM;AAA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,GAAG;aACtJ,EAAGL,UAAAA,CAAWK,OAAO,EAAE,8CAAA;AAC1B;AACL;;;"}
@@ -0,0 +1,10 @@
1
+ import { ExternalComponent } from '@cratis/scene.model';
2
+ import { ComponentState } from './ComponentState';
3
+ export interface FoundationSample {
4
+ properties: Record<string, unknown>;
5
+ data: string[];
6
+ stateful: boolean;
7
+ }
8
+ export declare const foundationSamples: Record<string, FoundationSample>;
9
+ export declare function foundationElement(name: string, properties?: Record<string, unknown>, state?: ComponentState): ExternalComponent;
10
+ //# sourceMappingURL=foundationSamples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundationSamples.d.ts","sourceRoot":"","sources":["../../../foundation/foundationSamples.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASlD,MAAM,WAAW,gBAAgB;IAE7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGpC,IAAI,EAAE,MAAM,EAAE,CAAC;IAGf,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAK9D,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc,GAAG,iBAAiB,CAQ/H"}