@qoretechnologies/reqore 0.78.16-pr.723.g2b35213 → 0.78.16

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 (224) hide show
  1. package/.claude/CLAUDE.md +1 -47
  2. package/dist/components/Accordion/index.d.ts.map +1 -1
  3. package/dist/components/Accordion/index.js +14 -60
  4. package/dist/components/Accordion/index.js.map +1 -1
  5. package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
  6. package/dist/components/Breadcrumbs/index.js +21 -58
  7. package/dist/components/Breadcrumbs/index.js.map +1 -1
  8. package/dist/components/Bubble/index.d.ts.map +1 -1
  9. package/dist/components/Bubble/index.js +4 -13
  10. package/dist/components/Bubble/index.js.map +1 -1
  11. package/dist/components/Button/index.d.ts +0 -67
  12. package/dist/components/Button/index.d.ts.map +1 -1
  13. package/dist/components/Button/index.js +142 -361
  14. package/dist/components/Button/index.js.map +1 -1
  15. package/dist/components/Callout/index.d.ts.map +1 -1
  16. package/dist/components/Callout/index.js +29 -49
  17. package/dist/components/Callout/index.js.map +1 -1
  18. package/dist/components/Checkbox/index.d.ts.map +1 -1
  19. package/dist/components/Checkbox/index.js +36 -112
  20. package/dist/components/Checkbox/index.js.map +1 -1
  21. package/dist/components/CollapsibleContent/index.d.ts.map +1 -1
  22. package/dist/components/CollapsibleContent/index.js +2 -6
  23. package/dist/components/CollapsibleContent/index.js.map +1 -1
  24. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  25. package/dist/components/ControlGroup/index.js +1 -22
  26. package/dist/components/ControlGroup/index.js.map +1 -1
  27. package/dist/components/DataView/index.d.ts +0 -8
  28. package/dist/components/DataView/index.d.ts.map +1 -1
  29. package/dist/components/DataView/index.js +41 -90
  30. package/dist/components/DataView/index.js.map +1 -1
  31. package/dist/components/DatePicker/index.d.ts +1 -3
  32. package/dist/components/DatePicker/index.d.ts.map +1 -1
  33. package/dist/components/DatePicker/index.js +43 -75
  34. package/dist/components/DatePicker/index.js.map +1 -1
  35. package/dist/components/DescriptionList/index.d.ts.map +1 -1
  36. package/dist/components/DescriptionList/index.js +4 -30
  37. package/dist/components/DescriptionList/index.js.map +1 -1
  38. package/dist/components/Drawer/index.d.ts.map +1 -1
  39. package/dist/components/Drawer/index.js +25 -41
  40. package/dist/components/Drawer/index.js.map +1 -1
  41. package/dist/components/Dropdown/list.d.ts.map +1 -1
  42. package/dist/components/Dropdown/list.js +14 -19
  43. package/dist/components/Dropdown/list.js.map +1 -1
  44. package/dist/components/Effect/index.d.ts +0 -37
  45. package/dist/components/Effect/index.d.ts.map +1 -1
  46. package/dist/components/Effect/index.js +58 -224
  47. package/dist/components/Effect/index.js.map +1 -1
  48. package/dist/components/EntityRow/index.d.ts.map +1 -1
  49. package/dist/components/EntityRow/index.js +59 -98
  50. package/dist/components/EntityRow/index.js.map +1 -1
  51. package/dist/components/FeatureCard/index.d.ts.map +1 -1
  52. package/dist/components/FeatureCard/index.js +21 -54
  53. package/dist/components/FeatureCard/index.js.map +1 -1
  54. package/dist/components/Header/index.d.ts.map +1 -1
  55. package/dist/components/Header/index.js +4 -7
  56. package/dist/components/Header/index.js.map +1 -1
  57. package/dist/components/Icon/index.d.ts.map +1 -1
  58. package/dist/components/Icon/index.js +3 -13
  59. package/dist/components/Icon/index.js.map +1 -1
  60. package/dist/components/Input/index.d.ts +1 -44
  61. package/dist/components/Input/index.d.ts.map +1 -1
  62. package/dist/components/Input/index.js +23 -89
  63. package/dist/components/Input/index.js.map +1 -1
  64. package/dist/components/InputClearButton/index.d.ts +2 -7
  65. package/dist/components/InputClearButton/index.d.ts.map +1 -1
  66. package/dist/components/InputClearButton/index.js +5 -12
  67. package/dist/components/InputClearButton/index.js.map +1 -1
  68. package/dist/components/InternalPopover/index.d.ts.map +1 -1
  69. package/dist/components/InternalPopover/index.js +10 -19
  70. package/dist/components/InternalPopover/index.js.map +1 -1
  71. package/dist/components/Link/index.d.ts.map +1 -1
  72. package/dist/components/Link/index.js +1 -6
  73. package/dist/components/Link/index.js.map +1 -1
  74. package/dist/components/Menu/divider.d.ts.map +1 -1
  75. package/dist/components/Menu/divider.js +3 -8
  76. package/dist/components/Menu/divider.js.map +1 -1
  77. package/dist/components/Menu/index.d.ts.map +1 -1
  78. package/dist/components/Menu/index.js +4 -17
  79. package/dist/components/Menu/index.js.map +1 -1
  80. package/dist/components/Menu/item.d.ts.map +1 -1
  81. package/dist/components/Menu/item.js +5 -3
  82. package/dist/components/Menu/item.js.map +1 -1
  83. package/dist/components/Message/index.d.ts.map +1 -1
  84. package/dist/components/Message/index.js +4 -20
  85. package/dist/components/Message/index.js.map +1 -1
  86. package/dist/components/NavRail/index.d.ts +0 -2
  87. package/dist/components/NavRail/index.d.ts.map +1 -1
  88. package/dist/components/NavRail/index.js +47 -131
  89. package/dist/components/NavRail/index.js.map +1 -1
  90. package/dist/components/Notifications/notification.d.ts +2 -6
  91. package/dist/components/Notifications/notification.d.ts.map +1 -1
  92. package/dist/components/Notifications/notification.js +18 -78
  93. package/dist/components/Notifications/notification.js.map +1 -1
  94. package/dist/components/Notifications/styles.d.ts +0 -20
  95. package/dist/components/Notifications/styles.d.ts.map +1 -1
  96. package/dist/components/Notifications/styles.js +9 -37
  97. package/dist/components/Notifications/styles.js.map +1 -1
  98. package/dist/components/Paging/index.d.ts.map +1 -1
  99. package/dist/components/Paging/index.js +3 -4
  100. package/dist/components/Paging/index.js.map +1 -1
  101. package/dist/components/Panel/index.d.ts +0 -3
  102. package/dist/components/Panel/index.d.ts.map +1 -1
  103. package/dist/components/Panel/index.js +153 -214
  104. package/dist/components/Panel/index.js.map +1 -1
  105. package/dist/components/Paragraph/index.d.ts.map +1 -1
  106. package/dist/components/Paragraph/index.js +5 -8
  107. package/dist/components/Paragraph/index.js.map +1 -1
  108. package/dist/components/Progress/index.d.ts.map +1 -1
  109. package/dist/components/Progress/index.js +1 -1
  110. package/dist/components/Progress/index.js.map +1 -1
  111. package/dist/components/Rating/index.d.ts.map +1 -1
  112. package/dist/components/Rating/index.js +8 -20
  113. package/dist/components/Rating/index.js.map +1 -1
  114. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  115. package/dist/components/RichTextEditor/index.js +46 -89
  116. package/dist/components/RichTextEditor/index.js.map +1 -1
  117. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  118. package/dist/components/SegmentedControl/index.js +42 -87
  119. package/dist/components/SegmentedControl/index.js.map +1 -1
  120. package/dist/components/SeverityRow/index.d.ts.map +1 -1
  121. package/dist/components/SeverityRow/index.js +1 -1
  122. package/dist/components/SeverityRow/index.js.map +1 -1
  123. package/dist/components/Span/index.d.ts.map +1 -1
  124. package/dist/components/Span/index.js +5 -8
  125. package/dist/components/Span/index.js.map +1 -1
  126. package/dist/components/StackedBar/index.d.ts.map +1 -1
  127. package/dist/components/StackedBar/index.js +12 -42
  128. package/dist/components/StackedBar/index.js.map +1 -1
  129. package/dist/components/Statistic/index.d.ts.map +1 -1
  130. package/dist/components/Statistic/index.js +6 -34
  131. package/dist/components/Statistic/index.js.map +1 -1
  132. package/dist/components/Table/cell.d.ts.map +1 -1
  133. package/dist/components/Table/cell.js +53 -128
  134. package/dist/components/Table/cell.js.map +1 -1
  135. package/dist/components/Table/headerCell.d.ts.map +1 -1
  136. package/dist/components/Table/headerCell.js +5 -7
  137. package/dist/components/Table/headerCell.js.map +1 -1
  138. package/dist/components/Table/index.d.ts.map +1 -1
  139. package/dist/components/Table/index.js +1 -2
  140. package/dist/components/Table/index.js.map +1 -1
  141. package/dist/components/Table/scrollbar.d.ts.map +1 -1
  142. package/dist/components/Table/scrollbar.js +9 -17
  143. package/dist/components/Table/scrollbar.js.map +1 -1
  144. package/dist/components/Tag/index.d.ts +3 -70
  145. package/dist/components/Tag/index.d.ts.map +1 -1
  146. package/dist/components/Tag/index.js +100 -336
  147. package/dist/components/Tag/index.js.map +1 -1
  148. package/dist/components/Testimonial/index.d.ts.map +1 -1
  149. package/dist/components/Testimonial/index.js +20 -35
  150. package/dist/components/Testimonial/index.js.map +1 -1
  151. package/dist/components/Textarea/index.d.ts +0 -6
  152. package/dist/components/Textarea/index.d.ts.map +1 -1
  153. package/dist/components/Textarea/index.js +20 -20
  154. package/dist/components/Textarea/index.js.map +1 -1
  155. package/dist/components/Tier/group.d.ts +0 -2
  156. package/dist/components/Tier/group.d.ts.map +1 -1
  157. package/dist/components/Tier/group.js +2 -4
  158. package/dist/components/Tier/group.js.map +1 -1
  159. package/dist/components/Timeline/index.d.ts +0 -2
  160. package/dist/components/Timeline/index.d.ts.map +1 -1
  161. package/dist/components/Timeline/index.js +13 -56
  162. package/dist/components/Timeline/index.js.map +1 -1
  163. package/dist/components/Tree/index.d.ts.map +1 -1
  164. package/dist/components/Tree/index.js +19 -23
  165. package/dist/components/Tree/index.js.map +1 -1
  166. package/dist/containers/ReqoreProvider.d.ts.map +1 -1
  167. package/dist/containers/ReqoreProvider.js +1 -4
  168. package/dist/containers/ReqoreProvider.js.map +1 -1
  169. package/dist/containers/UIProvider.d.ts +1 -11
  170. package/dist/containers/UIProvider.d.ts.map +1 -1
  171. package/dist/containers/UIProvider.js +4 -33
  172. package/dist/containers/UIProvider.js.map +1 -1
  173. package/dist/context/ReqoreContext.d.ts +0 -6
  174. package/dist/context/ReqoreContext.d.ts.map +1 -1
  175. package/dist/context/ReqoreContext.js +0 -2
  176. package/dist/context/ReqoreContext.js.map +1 -1
  177. package/dist/helpers/colors.d.ts +2 -184
  178. package/dist/helpers/colors.d.ts.map +1 -1
  179. package/dist/helpers/colors.js +86 -739
  180. package/dist/helpers/colors.js.map +1 -1
  181. package/dist/hooks/useFocusTrap.d.ts.map +1 -1
  182. package/dist/hooks/useFocusTrap.js +6 -24
  183. package/dist/hooks/useFocusTrap.js.map +1 -1
  184. package/dist/hooks/usePrefersReducedMotion.d.ts +0 -5
  185. package/dist/hooks/usePrefersReducedMotion.d.ts.map +1 -1
  186. package/dist/hooks/usePrefersReducedMotion.js +1 -9
  187. package/dist/hooks/usePrefersReducedMotion.js.map +1 -1
  188. package/dist/hooks/useTextareaAutoSize.d.ts +0 -15
  189. package/dist/hooks/useTextareaAutoSize.d.ts.map +1 -1
  190. package/dist/hooks/useTextareaAutoSize.js +12 -90
  191. package/dist/hooks/useTextareaAutoSize.js.map +1 -1
  192. package/dist/index.d.ts +2 -7
  193. package/dist/index.d.ts.map +1 -1
  194. package/dist/index.js +4 -14
  195. package/dist/index.js.map +1 -1
  196. package/package.json +2 -3
  197. package/tests.json +1 -0
  198. package/{vite.config.mts → vite.config.ts} +0 -6
  199. package/vitest.config.ts +152 -0
  200. package/dist/context/SurfaceContext.d.ts +0 -18
  201. package/dist/context/SurfaceContext.d.ts.map +0 -1
  202. package/dist/context/SurfaceContext.js +0 -39
  203. package/dist/context/SurfaceContext.js.map +0 -1
  204. package/dist/helpers/iconProps.d.ts +0 -14
  205. package/dist/helpers/iconProps.d.ts.map +0 -1
  206. package/dist/helpers/iconProps.js +0 -33
  207. package/dist/helpers/iconProps.js.map +0 -1
  208. package/dist/helpers/locale.d.ts +0 -20
  209. package/dist/helpers/locale.d.ts.map +0 -1
  210. package/dist/helpers/locale.js +0 -61
  211. package/dist/helpers/locale.js.map +0 -1
  212. package/dist/helpers/schedule.d.ts +0 -12
  213. package/dist/helpers/schedule.d.ts.map +0 -1
  214. package/dist/helpers/schedule.js +0 -10
  215. package/dist/helpers/schedule.js.map +0 -1
  216. package/dist/helpers/surface.d.ts +0 -31
  217. package/dist/helpers/surface.d.ts.map +0 -1
  218. package/dist/helpers/surface.js +0 -87
  219. package/dist/helpers/surface.js.map +0 -1
  220. package/dist/hooks/useDrawnSurface.d.ts +0 -38
  221. package/dist/hooks/useDrawnSurface.d.ts.map +0 -1
  222. package/dist/hooks/useDrawnSurface.js +0 -48
  223. package/dist/hooks/useDrawnSurface.js.map +0 -1
  224. package/vitest.config.mts +0 -241
@@ -9,10 +9,4 @@ export default defineConfig({
9
9
  // "A React Element from an older version of React was rendered".
10
10
  dedupe: ['react', 'react-dom', 'react/jsx-runtime'],
11
11
  },
12
- optimizeDeps: {
13
- // Imported only by the story run's setup (`src/stories/utils/motion.ts`): listed, so it is
14
- // bundled with the other dependencies before the first story runs, not when a story finds it,
15
- // which reloaded the page in the middle of the run.
16
- include: ['@react-spring/shared'],
17
- },
18
12
  });
@@ -0,0 +1,152 @@
1
+ import { qlipVitestPlugin } from '@qoretechnologies/qlip';
2
+ import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
3
+ import { playwright } from '@vitest/browser-playwright';
4
+ import { readFileSync, readdirSync } from 'node:fs';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { configDefaults, defineConfig, mergeConfig } from 'vitest/config';
8
+ import viteConfig from './vite.config';
9
+
10
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const qlipUploadToken = process.env.QLIP_UPLOAD_TOKEN;
12
+
13
+ /**
14
+ * Story files that cannot hold a story tagged `touch`, relative to the project root. The touch
15
+ * project leaves them out, so it does not load every story module only to skip it. Read from the
16
+ * files themselves: tagging a story is all it takes to run it on a touch screen.
17
+ *
18
+ * Both story projects split the stories by the tags Storybook reads from a story file's source
19
+ * before it runs it (`tags` below): string literals, in a `tags` array on a story or its meta, or
20
+ * in an array the file names there. So a file with no `'touch'` or `"touch"` in it has no story
21
+ * either project counts as tagged, and any other file is loaded here. Matching the shape of a
22
+ * `tags` line instead left out a file that tagged its stories another way Storybook reads
23
+ * (`tags: TOUCH`, a comment in the array): the desktop project left those stories out and this
24
+ * one never loaded them, so they ran nowhere and nothing failed. A file that only mentions the
25
+ * word costs a module load. A tag a story only has when it runs (spread into it from a shared
26
+ * object) is read from the source by neither project: `.storybook/vitest.setup.ts` fails it.
27
+ */
28
+ const storyFilesWithoutTouch = (): string[] =>
29
+ readdirSync(path.join(dirname, 'src'), { recursive: true, encoding: 'utf8' })
30
+ .filter((file) => file.endsWith('.stories.tsx'))
31
+ .map((file) => path.join('src', file).split(path.sep).join('/'))
32
+ .filter((file) => !/['"]touch['"]/.test(readFileSync(path.join(dirname, file), 'utf8')));
33
+
34
+ // One plugin for both story projects, so they make one qlip build: one build id, and one upload at the end
35
+ // of the run (the plugin registers its reporter once, however many projects load it).
36
+ const qlip = qlipVitestPlugin({
37
+ auto: true,
38
+ captureOnError: true,
39
+ disableAnimations: true,
40
+ pauseAnimationsAtEnd: true,
41
+ viewport: { width: 1920, height: 1080 },
42
+ // serverUrl omitted — defaults to https://qlip.qoretechnologies.com
43
+ ...(qlipUploadToken ? { upload: { uploadToken: qlipUploadToken } } : {}),
44
+ });
45
+
46
+ /**
47
+ * The browser a story project runs in: a desktop with a mouse, or - `phone` - the phone the stories tagged
48
+ * `touch` run on (`src/stories/utils/touchScreen.ts`). A new object for each project: Vitest names a
49
+ * project's browser instances on the objects themselves.
50
+ */
51
+ const storyBrowser = (phone = false) => ({
52
+ enabled: true,
53
+ // Vitest 4's @vitest/browser-playwright no longer applies
54
+ // `browser.viewport` to the Playwright context (the line is
55
+ // commented out in the provider), so the context silently falls
56
+ // back to Playwright's 1280×720 default and every capture is
57
+ // clamped to it — while the manifest still records qlip's
58
+ // 1920×1080, yielding blurry, mislabeled snapshots. Pass the
59
+ // viewport through the provider's `contextOptions` (which IS
60
+ // applied) so the browser window matches qlip's capture viewport
61
+ // 1:1 and screenshots come out at their true resolution.
62
+ //
63
+ // The phone is a phone from the start: Playwright makes its context with `isMobile` and `hasTouch`, so
64
+ // `(pointer: coarse)` and `(hover: none)` match and a touch is a finger's, and nothing turns that on or
65
+ // off. Turning Chromium's touch emulation off over the DevTools protocol (how a touch story used to
66
+ // borrow a desktop page) leaves the page with the hover and pointer the machine reports, not the mouse
67
+ // Playwright launched it with (`--blink-settings=primaryHoverType=2,…`), and a Linux CI runner reports
68
+ // none: every later story in the page found `(hover: none)` (qorus#646).
69
+ provider: playwright({
70
+ contextOptions: phone
71
+ ? { viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true }
72
+ : { viewport: { width: 1920, height: 1080 } },
73
+ }),
74
+ headless: true,
75
+ instances: [{ browser: 'chromium' as const }],
76
+ });
77
+
78
+ const storyTest = {
79
+ setupFiles: ['./.storybook/vitest.setup.ts'],
80
+ // Some interaction stories deliberately render slow content and the shared
81
+ // play-function helpers wait up to ~17s; give them headroom.
82
+ testTimeout: 30000,
83
+ };
84
+
85
+ export default mergeConfig(
86
+ viteConfig,
87
+ defineConfig({
88
+ test: {
89
+ projects: [
90
+ // Component/interaction tests: run every story in a real browser via Playwright.
91
+ // Replaces the former @storybook/test-runner.
92
+ //
93
+ // Stories run in two projects, each in a browser of its own kind (see `storyBrowser`): every story on
94
+ // a desktop with a mouse, but those tagged `touch`, which run on a phone. `.storybook/vitest.setup.ts`
95
+ // checks each story's browser is the one its project promises.
96
+ {
97
+ extends: true,
98
+ plugins: [
99
+ qlip,
100
+ storybookTest({
101
+ configDir: path.join(dirname, '.storybook'),
102
+ storybookScript: 'yarn storybook --no-open',
103
+ tags: { exclude: ['touch'] },
104
+ }),
105
+ ],
106
+ test: {
107
+ name: 'storybook',
108
+ // after the stories on the phone: each story here checks it still has its mouse
109
+ sequence: { groupOrder: 1 },
110
+ browser: storyBrowser(),
111
+ ...storyTest,
112
+ },
113
+ },
114
+ // The stories tagged `touch`, on the phone. Before the others, not beside them: the two projects share
115
+ // Storybook's dependency cache (it is named after the config directory), which is not built twice at
116
+ // once.
117
+ {
118
+ extends: true,
119
+ plugins: [
120
+ qlip,
121
+ storybookTest({
122
+ configDir: path.join(dirname, '.storybook'),
123
+ storybookScript: 'yarn storybook --no-open',
124
+ tags: { include: ['touch'] },
125
+ }),
126
+ ],
127
+ test: {
128
+ name: 'storybook-touch',
129
+ exclude: [...configDefaults.exclude, ...storyFilesWithoutTouch()],
130
+ sequence: { groupOrder: 0 },
131
+ browser: storyBrowser(true),
132
+ ...storyTest,
133
+ },
134
+ },
135
+ // Unit tests: the former Jest suite, now on Vitest + jsdom.
136
+ {
137
+ extends: true,
138
+ test: {
139
+ name: 'unit',
140
+ globals: true,
141
+ environment: 'jsdom',
142
+ include: ['__tests__/**/*.test.{ts,tsx}'],
143
+ setupFiles: ['./__tests__/setup.ts'],
144
+ // The former Jest suite raised the timeout to 30s for the heavier
145
+ // data-grid/pagination tests via jest.setTimeout(); match that globally.
146
+ testTimeout: 30000,
147
+ },
148
+ },
149
+ ],
150
+ },
151
+ })
152
+ );
@@ -1,18 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import type { TReqoreSurface } from '../helpers/colors';
3
- /**
4
- * Hands `color` (opaque; what this component is drawn in - each color of its gradient, when it has one) to the
5
- * components inside as their surface. Without a `color` (a component that paints nothing), they keep the surface
6
- * around it.
7
- *
8
- * The surface handed down stays the same value for as long as its colors do. A component that works its colors out
9
- * again on each render (an inline effect or content effect, a new list each time) would otherwise hand down a new
10
- * list with the same colors, and every component below that reads the surface would render again with it.
11
- */
12
- export declare const ReqoreSurfaceProvider: ({ color, children, }: {
13
- color?: TReqoreSurface;
14
- children?: ReactNode;
15
- }) => import("react/jsx-runtime").JSX.Element;
16
- /** The color this component is drawn on, when a component around it has said; undefined when none has. */
17
- export declare const useReqoreSurface: () => TReqoreSurface | undefined;
18
- //# sourceMappingURL=SurfaceContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SurfaceContext.d.ts","sourceRoot":"","sources":["../../src/context/SurfaceContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAcxD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,sBAGnC;IACD,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,4CAQA,CAAC;AAEF,0GAA0G;AAC1G,eAAO,MAAM,gBAAgB,QAAO,cAAc,GAAG,SAAuC,CAAC"}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useReqoreSurface = exports.ReqoreSurfaceProvider = void 0;
4
- var jsx_runtime_1 = require("react/jsx-runtime");
5
- var react_1 = require("react");
6
- /**
7
- * The color the components inside are drawn on, as the browser draws it (opaque): what a component that paints a
8
- * background of its own (the layout, a panel, a message, a button) hands to what it holds, so that their text and
9
- * icons are picked against what is really under them - an intent's text inside a message, a badge on a button.
10
- * Undefined outside all of them: the theme's surface then (`getThemeSurface`).
11
- */
12
- var SurfaceContext = (0, react_1.createContext)(undefined);
13
- /** One key for a surface's colors: the same colors, in the same order, are the same key. */
14
- var getSurfaceKey = function (surface) {
15
- return Array.isArray(surface) ? "[".concat(surface.join('|'), "]") : surface;
16
- };
17
- /**
18
- * Hands `color` (opaque; what this component is drawn in - each color of its gradient, when it has one) to the
19
- * components inside as their surface. Without a `color` (a component that paints nothing), they keep the surface
20
- * around it.
21
- *
22
- * The surface handed down stays the same value for as long as its colors do. A component that works its colors out
23
- * again on each render (an inline effect or content effect, a new list each time) would otherwise hand down a new
24
- * list with the same colors, and every component below that reads the surface would render again with it.
25
- */
26
- var ReqoreSurfaceProvider = function (_a) {
27
- var color = _a.color, children = _a.children;
28
- var around = (0, react_1.useContext)(SurfaceContext);
29
- var surface = color !== null && color !== void 0 ? color : around;
30
- var key = getSurfaceKey(surface);
31
- // the first surface with these colors, for as long as they hold
32
- var value = (0, react_1.useMemo)(function () { return surface; }, [key]);
33
- return (0, jsx_runtime_1.jsx)(SurfaceContext.Provider, { value: value, children: children });
34
- };
35
- exports.ReqoreSurfaceProvider = ReqoreSurfaceProvider;
36
- /** The color this component is drawn on, when a component around it has said; undefined when none has. */
37
- var useReqoreSurface = function () { return (0, react_1.useContext)(SurfaceContext); };
38
- exports.useReqoreSurface = useReqoreSurface;
39
- //# sourceMappingURL=SurfaceContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SurfaceContext.js","sourceRoot":"","sources":["../../src/context/SurfaceContext.tsx"],"names":[],"mappings":";;;;AAAA,+BAAsE;AAGtE;;;;;GAKG;AACH,IAAM,cAAc,GAAG,IAAA,qBAAa,EAA6B,SAAS,CAAC,CAAC;AAE5E,4FAA4F;AAC5F,IAAM,aAAa,GAAG,UAAC,OAAwB;IAC7C,OAAA,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAG,CAAC,CAAC,CAAC,OAAO;AAA3D,CAA2D,CAAC;AAE9D;;;;;;;;GAQG;AACI,IAAM,qBAAqB,GAAG,UAAC,EAMrC;QALC,KAAK,WAAA,EACL,QAAQ,cAAA;IAKR,IAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,cAAc,CAAC,CAAC;IAC1C,IAAM,OAAO,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC;IAChC,IAAM,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,gEAAgE;IAChE,IAAM,KAAK,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,OAAO,EAAP,CAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAE5C,OAAO,uBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAA2B,CAAC;AACrF,CAAC,CAAC;AAdW,QAAA,qBAAqB,yBAchC;AAEF,0GAA0G;AACnG,IAAM,gBAAgB,GAAG,cAAkC,OAAA,IAAA,kBAAU,EAAC,cAAc,CAAC,EAA1B,CAA0B,CAAC;AAAhF,QAAA,gBAAgB,oBAAgE"}
@@ -1,14 +0,0 @@
1
- import type { TReqoreEffectColor } from '../components/Effect';
2
- import type { IReqoreIconProps } from '../components/Icon';
3
- /**
4
- * An icon's own color given in its props (`leftIconProps={{ intent }}`, `iconProps={{ color }}`), split from the rest
5
- * of them (qorus#646).
6
- *
7
- * A component that draws an icon faded (a button's or an input's at `CONTROL_ICON_OPACITY`, a tag's, a panel's
8
- * title icon) picks the icon's color and opacity together so that it stands out by 3:1 at that opacity. A color
9
- * given in the icon's props was spread over that pick: the icon made it readable at full opacity, and drawn at 70%
10
- * a warning icon was 2.4:1. The component picks it instead, as it does its own `iconColor`, and passes the rest on.
11
- * The props' color wins over the component's, as it did when the props were spread last.
12
- */
13
- export declare const splitIconColor: (props?: IReqoreIconProps) => [TReqoreEffectColor | undefined, IReqoreIconProps | undefined];
14
- //# sourceMappingURL=iconProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iconProps.d.ts","sourceRoot":"","sources":["../../src/helpers/iconProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,gBAAgB,KACvB,CAAC,kBAAkB,GAAG,SAAS,EAAE,gBAAgB,GAAG,SAAS,CAQ/D,CAAC"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.splitIconColor = void 0;
15
- /**
16
- * An icon's own color given in its props (`leftIconProps={{ intent }}`, `iconProps={{ color }}`), split from the rest
17
- * of them (qorus#646).
18
- *
19
- * A component that draws an icon faded (a button's or an input's at `CONTROL_ICON_OPACITY`, a tag's, a panel's
20
- * title icon) picks the icon's color and opacity together so that it stands out by 3:1 at that opacity. A color
21
- * given in the icon's props was spread over that pick: the icon made it readable at full opacity, and drawn at 70%
22
- * a warning icon was 2.4:1. The component picks it instead, as it does its own `iconColor`, and passes the rest on.
23
- * The props' color wins over the component's, as it did when the props were spread last.
24
- */
25
- var splitIconColor = function (props) {
26
- if (!props || (!props.intent && !props.color)) {
27
- return [undefined, props];
28
- }
29
- var intent = props.intent, color = props.color, rest = __rest(props, ["intent", "color"]);
30
- return [intent || color, rest];
31
- };
32
- exports.splitIconColor = splitIconColor;
33
- //# sourceMappingURL=iconProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iconProps.js","sourceRoot":"","sources":["../../src/helpers/iconProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA;;;;;;;;;GASG;AACI,IAAM,cAAc,GAAG,UAC5B,KAAwB;IAExB,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEO,IAAA,MAAM,GAAqB,KAAK,OAA1B,EAAE,KAAK,GAAc,KAAK,MAAnB,EAAK,IAAI,UAAK,KAAK,EAAlC,mBAA0B,CAAF,CAAW;IAEzC,OAAO,CAAC,MAAM,IAAI,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAVW,QAAA,cAAc,kBAUzB"}
@@ -1,20 +0,0 @@
1
- /** What a `C` or `POSIX` locale name stands for: the POSIX locale is American English. */
2
- export declare const POSIX_LOCALE = "en-US";
3
- /**
4
- * `tag` as a BCP 47 language tag that `Intl` can format with, or `undefined` when it names none.
5
- *
6
- * Browsers and hosts hand over POSIX locale names as well as BCP 47 tags, and `Intl` throws a
7
- * `RangeError` on a POSIX one. Chromium on Linux reports `navigator.language` as `en-US@posix` when
8
- * its environment's locale is C or POSIX (`LANG=C.UTF-8`, `LANG=C`, or no `LANG` at all, as in most
9
- * Linux containers), and a server may send `cs_CZ.UTF-8`. So the codeset (`.UTF-8`) and the
10
- * modifier (`@posix`) are dropped, `_` becomes `-`, and `C` and `POSIX` become `en-US`. A tag that
11
- * is still not one `Intl` accepts, or names a locale it has no data for, is `undefined`.
12
- */
13
- export declare const toLanguageTag: (tag: string | null | undefined) => string | undefined;
14
- /**
15
- * The first of `tags` that `Intl` can format with, as a BCP 47 tag (see `toLanguageTag`), or
16
- * `undefined` (the runtime's own default) when none can. Pass the tags in order of preference: a
17
- * caller's own, then the browser's.
18
- */
19
- export declare const resolveLocale: (...tags: (string | null | undefined)[]) => string | undefined;
20
- //# sourceMappingURL=locale.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../src/helpers/locale.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,SAwBvE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,KAAG,MAAM,GAAG,SAU/E,CAAC"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- // Copyright 2026 Qore Technologies, s.r.o.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.resolveLocale = exports.toLanguageTag = exports.POSIX_LOCALE = void 0;
5
- /** What a `C` or `POSIX` locale name stands for: the POSIX locale is American English. */
6
- exports.POSIX_LOCALE = 'en-US';
7
- /**
8
- * `tag` as a BCP 47 language tag that `Intl` can format with, or `undefined` when it names none.
9
- *
10
- * Browsers and hosts hand over POSIX locale names as well as BCP 47 tags, and `Intl` throws a
11
- * `RangeError` on a POSIX one. Chromium on Linux reports `navigator.language` as `en-US@posix` when
12
- * its environment's locale is C or POSIX (`LANG=C.UTF-8`, `LANG=C`, or no `LANG` at all, as in most
13
- * Linux containers), and a server may send `cs_CZ.UTF-8`. So the codeset (`.UTF-8`) and the
14
- * modifier (`@posix`) are dropped, `_` becomes `-`, and `C` and `POSIX` become `en-US`. A tag that
15
- * is still not one `Intl` accepts, or names a locale it has no data for, is `undefined`.
16
- */
17
- var toLanguageTag = function (tag) {
18
- var _a;
19
- // No BCP 47 tag holds a `.` or an `@`: from the first one on, it is a POSIX codeset or modifier. It is cut off
20
- // there by position. `/[.@].*$/` did not reach past a line break (`.` stops at one, and `$` is only the end), so it
21
- // left a codeset in place when one followed it, and for every `.` before the break it tried again: quadratic in
22
- // the length of what a browser or host hands over (CodeQL js/polynomial-redos).
23
- var trimmed = (_a = tag === null || tag === void 0 ? void 0 : tag.trim()) !== null && _a !== void 0 ? _a : '';
24
- var end = trimmed.search(/[.@]/);
25
- var name = (end < 0 ? trimmed : trimmed.slice(0, end)).replace(/_/g, '-');
26
- if (!name) {
27
- return undefined;
28
- }
29
- if (name === 'C' || name === 'POSIX') {
30
- return exports.POSIX_LOCALE;
31
- }
32
- try {
33
- var canonical = Intl.getCanonicalLocales(name)[0];
34
- return Intl.DateTimeFormat.supportedLocalesOf([canonical]).length ? canonical : undefined;
35
- }
36
- catch (_b) {
37
- return undefined;
38
- }
39
- };
40
- exports.toLanguageTag = toLanguageTag;
41
- /**
42
- * The first of `tags` that `Intl` can format with, as a BCP 47 tag (see `toLanguageTag`), or
43
- * `undefined` (the runtime's own default) when none can. Pass the tags in order of preference: a
44
- * caller's own, then the browser's.
45
- */
46
- var resolveLocale = function () {
47
- var tags = [];
48
- for (var _i = 0; _i < arguments.length; _i++) {
49
- tags[_i] = arguments[_i];
50
- }
51
- for (var _a = 0, tags_1 = tags; _a < tags_1.length; _a++) {
52
- var tag = tags_1[_a];
53
- var languageTag = (0, exports.toLanguageTag)(tag);
54
- if (languageTag) {
55
- return languageTag;
56
- }
57
- }
58
- return undefined;
59
- };
60
- exports.resolveLocale = resolveLocale;
61
- //# sourceMappingURL=locale.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"locale.js","sourceRoot":"","sources":["../../src/helpers/locale.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;AAE3C,0FAA0F;AAC7E,QAAA,YAAY,GAAG,OAAO,CAAC;AAEpC;;;;;;;;;GASG;AACI,IAAM,aAAa,GAAG,UAAC,GAA8B;;IAC1D,+GAA+G;IAC/G,oHAAoH;IACpH,gHAAgH;IAChH,gFAAgF;IAChF,IAAM,OAAO,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,EAAE,mCAAI,EAAE,CAAC;IAClC,IAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,IAAM,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAE5E,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrC,OAAO,oBAAY,CAAC;IACtB,CAAC;IAED,IAAI,CAAC;QACI,IAAA,SAAS,GAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAlC,CAAmC;QAEnD,OAAO,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAxBW,QAAA,aAAa,iBAwBxB;AAEF;;;;GAIG;AACI,IAAM,aAAa,GAAG;IAAC,cAAsC;SAAtC,UAAsC,EAAtC,qBAAsC,EAAtC,IAAsC;QAAtC,yBAAsC;;IAClE,KAAkB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE,CAAC;QAApB,IAAM,GAAG,aAAA;QACZ,IAAM,WAAW,GAAG,IAAA,qBAAa,EAAC,GAAG,CAAC,CAAC;QAEvC,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB"}
@@ -1,12 +0,0 @@
1
- /**
2
- * How Reqore does something after a while: calls `fire` once `ms` have passed, and returns what cancels it.
3
- *
4
- * Reqore waits for a moment in a few places (a rail spells out its labels once the pointer has rested on it), and
5
- * by default it waits on the machine's clock (`scheduleOnTimer`). An app's tests and stories hand their own clock to
6
- * the provider (`options.schedule`), so what happens after a while happens when they say, not when the machine gets
7
- * there: a story is then drawn the same however fast the machine ran it.
8
- */
9
- export type TReqoreSchedule = (ms: number, fire: () => void) => () => void;
10
- /** Waits on the machine's clock: Reqore's schedule unless the app gives one. */
11
- export declare const scheduleOnTimer: TReqoreSchedule;
12
- //# sourceMappingURL=schedule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../src/helpers/schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;AAE3E,gFAAgF;AAChF,eAAO,MAAM,eAAe,EAAE,eAG7B,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scheduleOnTimer = void 0;
4
- /** Waits on the machine's clock: Reqore's schedule unless the app gives one. */
5
- var scheduleOnTimer = function (ms, fire) {
6
- var timer = setTimeout(fire, ms);
7
- return function () { return clearTimeout(timer); };
8
- };
9
- exports.scheduleOnTimer = scheduleOnTimer;
10
- //# sourceMappingURL=schedule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../src/helpers/schedule.ts"],"names":[],"mappings":";;;AAUA,gFAAgF;AACzE,IAAM,eAAe,GAAoB,UAAC,EAAE,EAAE,IAAI;IACvD,IAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,cAAM,OAAA,YAAY,CAAC,KAAK,CAAC,EAAnB,CAAmB,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B"}
@@ -1,31 +0,0 @@
1
- import { IReqoreCustomTheme, IReqoreTheme, TReqoreIntent } from '../constants/theme';
2
- import { TReqoreSurface } from './colors';
3
- import { TReqoreEffectColor, TReqoreHexColor } from '../components/Effect';
4
- /**
5
- * What an element that paints nothing (`unpainted`: transparent, or drawn at no opacity) is drawn on. The surface a
6
- * component around it hands down (`useReqoreSurface`) when one does; with none around it, the main of the
7
- * `customTheme` it was given - how a consumer says what it painted under it (a band, a card of its own) - drawn over
8
- * the page when it is translucent; undefined otherwise (the theme's surface, `getThemeSurface`). An intent is not a
9
- * surface: an element in an intent with nothing around it is drawn on the page.
10
- */
11
- export declare const getUnpaintedSurface: (theme: IReqoreTheme, customTheme: IReqoreCustomTheme | undefined, surface: TReqoreSurface | undefined, unpainted: boolean) => TReqoreSurface | undefined;
12
- /**
13
- * The color a text effect draws `color` in on `backgrounds` (`getEffectTextColor`: a theme color in the shade of it
14
- * that reads there, any other as given), or undefined where it draws none - a CSS color name, a variable, a
15
- * four-digit hex, which its text does not take either: it keeps the color it inherits. Never throws.
16
- */
17
- export declare const getDrawnEffectTextColor: (theme: IReqoreTheme, color: TReqoreEffectColor | undefined, backgrounds: TReqoreHexColor[]) => TReqoreHexColor | undefined;
18
- /**
19
- * The color a card's own mark (an entity row's icon, a callout's icon, a testimonial's avatar and quote mark) is
20
- * drawn in on `backgrounds`: its `own` color, moved to a shade that stands out by 3:1 there when it is a theme's;
21
- * else its intent's shade that does; else the card's `text`.
22
- */
23
- export declare const getCardMarkColor: (theme: IReqoreTheme, backgrounds: TReqoreHexColor[], text: TReqoreHexColor, own?: TReqoreEffectColor, intent?: TReqoreIntent) => TReqoreEffectColor;
24
- /**
25
- * The fill a clickable card paints while it is hovered: a wash of its intent (4% when it paints nothing at rest,
26
- * else 10%), or else of the theme a step lighter (8% when it paints nothing at rest), or `opaque`, the card's own.
27
- * What its styled rule paints, and what what it holds is read on as well as on its resting fill: a card's text and
28
- * its fainter text were read on the resting fill only, and a hovered row's metadata fell to 4.2:1 (qorus#646).
29
- */
30
- export declare const getCardHoverFill: (theme: IReqoreTheme, intent: TReqoreIntent | undefined, transparent: boolean | undefined, opaque: string) => string;
31
- //# sourceMappingURL=surface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../src/helpers/surface.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAUL,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAsB,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAwB/F;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,YAAY,EACnB,aAAa,kBAAkB,GAAG,SAAS,EAC3C,SAAS,cAAc,GAAG,SAAS,EACnC,WAAW,OAAO,KACjB,cAAc,GAAG,SAQnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,YAAY,EACnB,OAAO,kBAAkB,GAAG,SAAS,EACrC,aAAa,eAAe,EAAE,KAC7B,eAAe,GAAG,SAYpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,YAAY,EACnB,aAAa,eAAe,EAAE,EAC9B,MAAM,eAAe,EACrB,MAAM,kBAAkB,EACxB,SAAS,aAAa,KACrB,kBAQF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,YAAY,EACnB,QAAQ,aAAa,GAAG,SAAS,EACjC,aAAa,OAAO,GAAG,SAAS,EAChC,QAAQ,MAAM,KACb,MAKW,CAAC"}
@@ -1,87 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCardHoverFill = exports.getCardMarkColor = exports.getDrawnEffectTextColor = exports.getUnpaintedSurface = void 0;
4
- var polished_1 = require("polished");
5
- var colors_1 = require("./colors");
6
- var Effect_1 = require("../components/Effect");
7
- /**
8
- * `color` as the theme resolves it (a theme color, a shade of one, a hex), or undefined where it cannot: a CSS color
9
- * name, a variable, a four-digit hex. Never throws: a color the theme cannot read is no reason to unmount the
10
- * component that was given it.
11
- */
12
- var resolveColor = function (theme, color) {
13
- if (!color) {
14
- return undefined;
15
- }
16
- try {
17
- var resolved = (0, colors_1.getColorFromMaybeString)(theme, color);
18
- return resolved && (0, colors_1.isValidSixCharHex)(resolved) ? resolved : undefined;
19
- }
20
- catch (_a) {
21
- return undefined;
22
- }
23
- };
24
- /**
25
- * What an element that paints nothing (`unpainted`: transparent, or drawn at no opacity) is drawn on. The surface a
26
- * component around it hands down (`useReqoreSurface`) when one does; with none around it, the main of the
27
- * `customTheme` it was given - how a consumer says what it painted under it (a band, a card of its own) - drawn over
28
- * the page when it is translucent; undefined otherwise (the theme's surface, `getThemeSurface`). An intent is not a
29
- * surface: an element in an intent with nothing around it is drawn on the page.
30
- */
31
- var getUnpaintedSurface = function (theme, customTheme, surface, unpainted) {
32
- if (surface || !unpainted) {
33
- return surface;
34
- }
35
- var own = resolveColor(theme, customTheme === null || customTheme === void 0 ? void 0 : customTheme.main);
36
- return own ? (0, colors_1.getDrawnColor)(own, (0, colors_1.getThemeSurface)(theme)) : undefined;
37
- };
38
- exports.getUnpaintedSurface = getUnpaintedSurface;
39
- /**
40
- * The color a text effect draws `color` in on `backgrounds` (`getEffectTextColor`: a theme color in the shade of it
41
- * that reads there, any other as given), or undefined where it draws none - a CSS color name, a variable, a
42
- * four-digit hex, which its text does not take either: it keeps the color it inherits. Never throws.
43
- */
44
- var getDrawnEffectTextColor = function (theme, color, backgrounds) {
45
- if (!resolveColor(theme, color)) {
46
- return undefined;
47
- }
48
- try {
49
- var drawn = (0, Effect_1.getEffectTextColor)(theme, color, undefined, backgrounds);
50
- return drawn && (0, colors_1.isValidSixCharHex)(drawn) ? drawn : undefined;
51
- }
52
- catch (_a) {
53
- return undefined;
54
- }
55
- };
56
- exports.getDrawnEffectTextColor = getDrawnEffectTextColor;
57
- /**
58
- * The color a card's own mark (an entity row's icon, a callout's icon, a testimonial's avatar and quote mark) is
59
- * drawn in on `backgrounds`: its `own` color, moved to a shade that stands out by 3:1 there when it is a theme's;
60
- * else its intent's shade that does; else the card's `text`.
61
- */
62
- var getCardMarkColor = function (theme, backgrounds, text, own, intent) {
63
- var _a;
64
- if (own) {
65
- return ((_a = (0, colors_1.getReadableIconLook)(theme, backgrounds, text, 1, own).color) !== null && _a !== void 0 ? _a : own);
66
- }
67
- if (intent) {
68
- return (0, colors_1.getReadableIntentColor)(theme, intent, colors_1.READABLE_ICON_CONTRAST, backgrounds);
69
- }
70
- return text;
71
- };
72
- exports.getCardMarkColor = getCardMarkColor;
73
- /**
74
- * The fill a clickable card paints while it is hovered: a wash of its intent (4% when it paints nothing at rest,
75
- * else 10%), or else of the theme a step lighter (8% when it paints nothing at rest), or `opaque`, the card's own.
76
- * What its styled rule paints, and what what it holds is read on as well as on its resting fill: a card's text and
77
- * its fainter text were read on the resting fill only, and a hovered row's metadata fell to 4.2:1 (qorus#646).
78
- */
79
- var getCardHoverFill = function (theme, intent, transparent, opaque) {
80
- return intent
81
- ? (0, polished_1.rgba)(theme.intents[intent], transparent ? 0.04 : 0.1)
82
- : transparent
83
- ? (0, polished_1.rgba)((0, colors_1.changeLightness)((0, colors_1.getMainBackgroundColor)(theme), 0.08), 0.08)
84
- : opaque;
85
- };
86
- exports.getCardHoverFill = getCardHoverFill;
87
- //# sourceMappingURL=surface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/helpers/surface.ts"],"names":[],"mappings":"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"}
@@ -1,38 +0,0 @@
1
- import { IReqoreEffect, TReqoreHexColor } from '../components/Effect';
2
- import { IReqoreCustomTheme, IReqoreTheme } from '../constants/theme';
3
- import { TReqoreSurface } from '../helpers/colors';
4
- export interface IReqoreDrawnSurfaceOptions {
5
- theme: IReqoreTheme;
6
- customTheme?: IReqoreCustomTheme;
7
- /** It paints no fill of its own: it is on what is around it. */
8
- transparent?: boolean;
9
- /** The fill it paints, translucent or not, over what it is on. */
10
- fill: string;
11
- /** The effect it paints: what its gradient draws is what it holds is read on. */
12
- effect?: IReqoreEffect;
13
- /**
14
- * The fill it paints while hovered, when it is clickable (`getCardHoverFill`): what it holds is drawn on that
15
- * too, unless its effect paints a gradient over it.
16
- */
17
- hoverFill?: string;
18
- }
19
- export interface IReqoreDrawnSurface {
20
- /** What it is on: what a component around it says, or its customTheme's main when it paints nothing. */
21
- surface: TReqoreSurface | undefined;
22
- /** Its fill as drawn over that (the surface itself when it paints nothing). */
23
- background: TReqoreHexColor;
24
- /** Each color what it holds is drawn on: its gradient's, when its effect paints one, else its fill (and its
25
- * hover fill, when it is clickable). */
26
- backgrounds: TReqoreHexColor[];
27
- /** The text that reads on all of them. */
28
- text: TReqoreHexColor;
29
- }
30
- /**
31
- * What a card (an entity row, a callout, a testimonial, a statistic, a feature card) is drawn on and in, worked out
32
- * once for all of them, so they cannot drift apart in how they read their own colors.
33
- *
34
- * The values are one object each for as long as what they come from holds: a gradient is followed by its colors,
35
- * not by the effect object, which given inline is new on every render (and so was every surface handed down).
36
- */
37
- export declare const useReqoreDrawnSurface: ({ theme, customTheme, transparent, fill, effect, hoverFill, }: IReqoreDrawnSurfaceOptions) => IReqoreDrawnSurface;
38
- //# sourceMappingURL=useDrawnSurface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDrawnSurface.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrawnSurface.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EACb,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAqD,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGtG,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,YAAY,CAAC;IACpB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,wGAAwG;IACxG,OAAO,EAAE,cAAc,GAAG,SAAS,CAAC;IACpC,+EAA+E;IAC/E,UAAU,EAAE,eAAe,CAAC;IAC5B;6CACyC;IACzC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,0CAA0C;IAC1C,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,+DAOnC,0BAA0B,KAAG,mBAiC/B,CAAC"}