@mgamadeus/ddd-admin-ui 0.1.0-rc.3 → 0.1.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/ddd-admin-ui-specialist/SKILL.md +17 -2
- package/CHANGELOG.md +76 -0
- package/README.md +51 -8
- package/STANDARDS.md +55 -5
- package/dist/components.css +10 -5
- package/dist/form/FormActions.d.ts.map +1 -1
- package/dist/form/FormActions.js +7 -2
- package/dist/form/FormActions.js.map +1 -1
- package/dist/i18n/hints.json +11 -7
- package/dist/i18n-keys.json +45 -8
- package/dist/list/Combobox.d.ts +33 -3
- package/dist/list/Combobox.d.ts.map +1 -1
- package/dist/list/Combobox.js +71 -13
- package/dist/list/Combobox.js.map +1 -1
- package/dist/list/CopyButton.d.ts +23 -0
- package/dist/list/CopyButton.d.ts.map +1 -0
- package/dist/list/CopyButton.js +28 -0
- package/dist/list/CopyButton.js.map +1 -0
- package/dist/list/EntityListBody.d.ts +2 -2
- package/dist/list/EntityListBody.d.ts.map +1 -1
- package/dist/list/EntityListBody.js +2 -2
- package/dist/list/EntityListBody.js.map +1 -1
- package/dist/list/EntityListEmpty.d.ts +6 -1
- package/dist/list/EntityListEmpty.d.ts.map +1 -1
- package/dist/list/EntityListEmpty.js +4 -1
- package/dist/list/EntityListEmpty.js.map +1 -1
- package/dist/list/EntityListTable.d.ts +12 -3
- package/dist/list/EntityListTable.d.ts.map +1 -1
- package/dist/list/EntityListTable.js +8 -7
- package/dist/list/EntityListTable.js.map +1 -1
- package/dist/list/filters.d.ts +8 -1
- package/dist/list/filters.d.ts.map +1 -1
- package/dist/list/filters.js +5 -2
- package/dist/list/filters.js.map +1 -1
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.d.ts.map +1 -1
- package/dist/list/index.js +1 -0
- package/dist/list/index.js.map +1 -1
- package/dist/logic/browser/storage.d.ts +17 -0
- package/dist/logic/browser/storage.d.ts.map +1 -0
- package/dist/logic/browser/storage.js +40 -0
- package/dist/logic/browser/storage.js.map +1 -0
- package/dist/logic/index.d.ts +8 -1
- package/dist/logic/index.d.ts.map +1 -1
- package/dist/logic/index.js +4 -0
- package/dist/logic/index.js.map +1 -1
- package/dist/logic/pure/confirm.d.ts +4 -0
- package/dist/logic/pure/confirm.d.ts.map +1 -1
- package/dist/logic/pure/confirm.js.map +1 -1
- package/dist/logic/pure/dateInput.d.ts +21 -0
- package/dist/logic/pure/dateInput.d.ts.map +1 -0
- package/dist/logic/pure/dateInput.js +79 -0
- package/dist/logic/pure/dateInput.js.map +1 -0
- package/dist/logic/pure/listSort.d.ts +11 -3
- package/dist/logic/pure/listSort.d.ts.map +1 -1
- package/dist/logic/pure/listSort.js +9 -5
- package/dist/logic/pure/listSort.js.map +1 -1
- package/dist/logic/pure/stickyParams.d.ts +10 -0
- package/dist/logic/pure/stickyParams.d.ts.map +1 -0
- package/dist/logic/pure/stickyParams.js +31 -0
- package/dist/logic/pure/stickyParams.js.map +1 -0
- package/dist/logic/react/useLatestSearch.d.ts +18 -0
- package/dist/logic/react/useLatestSearch.d.ts.map +1 -0
- package/dist/logic/react/useLatestSearch.js +37 -0
- package/dist/logic/react/useLatestSearch.js.map +1 -0
- package/dist/logic/react/useRowSelection.d.ts +12 -2
- package/dist/logic/react/useRowSelection.d.ts.map +1 -1
- package/dist/logic/react/useRowSelection.js +16 -8
- package/dist/logic/react/useRowSelection.js.map +1 -1
- package/dist/next/storage.d.ts +2 -10
- package/dist/next/storage.d.ts.map +1 -1
- package/dist/next/storage.js +2 -33
- package/dist/next/storage.js.map +1 -1
- package/dist/page/DefinitionList.d.ts +7 -2
- package/dist/page/DefinitionList.d.ts.map +1 -1
- package/dist/page/DefinitionList.js +4 -1
- package/dist/page/DefinitionList.js.map +1 -1
- package/dist/page/EntityDetailShell.d.ts +2 -2
- package/dist/page/EntityDetailShell.d.ts.map +1 -1
- package/dist/page/EntityDetailShell.js +3 -2
- package/dist/page/EntityDetailShell.js.map +1 -1
- package/dist/page/EntityListPage.d.ts +3 -1
- package/dist/page/EntityListPage.d.ts.map +1 -1
- package/dist/page/EntityListPage.js +1 -1
- package/dist/page/EntityListPage.js.map +1 -1
- package/dist/page/EntityTabs.d.ts +2 -2
- package/dist/page/EntityTabs.d.ts.map +1 -1
- package/dist/page/EntityTabs.js +3 -2
- package/dist/page/EntityTabs.js.map +1 -1
- package/dist/page/PageFrame.d.ts +6 -1
- package/dist/page/PageFrame.d.ts.map +1 -1
- package/dist/page/PageFrame.js +1 -1
- package/dist/page/PageFrame.js.map +1 -1
- package/dist/page/PageToolbar.d.ts +2 -2
- package/dist/page/PageToolbar.d.ts.map +1 -1
- package/dist/page/PageToolbar.js +3 -2
- package/dist/page/PageToolbar.js.map +1 -1
- package/dist/page/SectionHeader.d.ts +1 -1
- package/dist/page/SectionHeader.d.ts.map +1 -1
- package/dist/page/links.d.ts +2 -17
- package/dist/page/links.d.ts.map +1 -1
- package/dist/page/links.js +3 -3
- package/dist/page/links.js.map +1 -1
- package/dist/primitives/breadcrumb.d.ts.map +1 -1
- package/dist/primitives/breadcrumb.js +7 -0
- package/dist/primitives/breadcrumb.js.map +1 -1
- package/dist/primitives/command.js +1 -1
- package/dist/primitives/command.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/link.d.ts +28 -0
- package/dist/primitives/link.d.ts.map +1 -0
- package/dist/primitives/link.js +15 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/segmented-control.d.ts +65 -0
- package/dist/primitives/segmented-control.d.ts.map +1 -0
- package/dist/primitives/segmented-control.js +224 -0
- package/dist/primitives/segmented-control.js.map +1 -0
- package/dist/primitives/segmentedControlNavigation.d.ts +31 -0
- package/dist/primitives/segmentedControlNavigation.d.ts.map +1 -0
- package/dist/primitives/segmentedControlNavigation.js +65 -0
- package/dist/primitives/segmentedControlNavigation.js.map +1 -0
- package/dist/provider/AdminUiProvider.d.ts +3 -3
- package/dist/provider/AdminUiProvider.d.ts.map +1 -1
- package/dist/provider/AdminUiProvider.js +5 -4
- package/dist/provider/AdminUiProvider.js.map +1 -1
- package/dist/provider/types.d.ts +6 -0
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/scripts/build-i18n-manifest.mjs +9 -3
- package/dist/showcase/Showcase.d.ts +35 -0
- package/dist/showcase/Showcase.d.ts.map +1 -0
- package/dist/showcase/Showcase.js +47 -0
- package/dist/showcase/Showcase.js.map +1 -0
- package/dist/showcase/coverage.d.ts +11 -0
- package/dist/showcase/coverage.d.ts.map +1 -0
- package/dist/showcase/coverage.js +80 -0
- package/dist/showcase/coverage.js.map +1 -0
- package/dist/showcase/index.d.ts +6 -0
- package/dist/showcase/index.d.ts.map +1 -0
- package/dist/showcase/index.js +5 -0
- package/dist/showcase/index.js.map +1 -0
- package/dist/showcase/sections/FormShowcase.d.ts +3 -0
- package/dist/showcase/sections/FormShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/FormShowcase.js +26 -0
- package/dist/showcase/sections/FormShowcase.js.map +1 -0
- package/dist/showcase/sections/GlassShowcase.d.ts +3 -0
- package/dist/showcase/sections/GlassShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/GlassShowcase.js +19 -0
- package/dist/showcase/sections/GlassShowcase.js.map +1 -0
- package/dist/showcase/sections/ListShowcase.d.ts +13 -0
- package/dist/showcase/sections/ListShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/ListShowcase.js +97 -0
- package/dist/showcase/sections/ListShowcase.js.map +1 -0
- package/dist/showcase/sections/MediaShowcase.d.ts +3 -0
- package/dist/showcase/sections/MediaShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/MediaShowcase.js +28 -0
- package/dist/showcase/sections/MediaShowcase.js.map +1 -0
- package/dist/showcase/sections/OptionalShowcase.d.ts +14 -0
- package/dist/showcase/sections/OptionalShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/OptionalShowcase.js +32 -0
- package/dist/showcase/sections/OptionalShowcase.js.map +1 -0
- package/dist/showcase/sections/PageShowcase.d.ts +3 -0
- package/dist/showcase/sections/PageShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/PageShowcase.js +41 -0
- package/dist/showcase/sections/PageShowcase.js.map +1 -0
- package/dist/showcase/sections/PrimitivesShowcase.d.ts +13 -0
- package/dist/showcase/sections/PrimitivesShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/PrimitivesShowcase.js +40 -0
- package/dist/showcase/sections/PrimitivesShowcase.js.map +1 -0
- package/dist/showcase/sections/TranslationsShowcase.d.ts +3 -0
- package/dist/showcase/sections/TranslationsShowcase.d.ts.map +1 -0
- package/dist/showcase/sections/TranslationsShowcase.js +30 -0
- package/dist/showcase/sections/TranslationsShowcase.js.map +1 -0
- package/dist/tokens.json +17 -1
- package/dist/translations/TranslationControls.d.ts.map +1 -1
- package/dist/translations/TranslationControls.js +8 -6
- package/dist/translations/TranslationControls.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard and pointer mechanics of `SegmentedControl`, as pure functions: which option a key or a pointer position
|
|
3
|
+
* lands on. Disabled options are skipped; arrows wrap around; in a right-to-left control the horizontal arrows swap.
|
|
4
|
+
*/
|
|
5
|
+
/** The keys the control handles; anything else is left to the browser. */
|
|
6
|
+
export type SegmentedKey = 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End';
|
|
7
|
+
export declare const isSegmentedKey: (key: string) => key is SegmentedKey;
|
|
8
|
+
/**
|
|
9
|
+
* The index a key moves to from `current` among `disabled.length` options (`disabled[i]` true = skipped). Arrow right /
|
|
10
|
+
* down go forward (left in RTL), arrow left / up go back, Home / End to the first / last enabled option. `current` when
|
|
11
|
+
* no other enabled option exists.
|
|
12
|
+
*/
|
|
13
|
+
export declare const segmentedIndexForKey: (disabled: readonly boolean[], current: number, key: SegmentedKey, direction?: "ltr" | "rtl") => number;
|
|
14
|
+
/** One option's horizontal extent on screen (px, viewport coordinates). */
|
|
15
|
+
export interface SegmentedRect {
|
|
16
|
+
left: number;
|
|
17
|
+
right: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The enabled option under a pointer at `x` during a drag: the option whose extent holds `x`, else the nearest one
|
|
21
|
+
* (a pointer dragged past the ends lands on the first / last). `-1` when every option is disabled.
|
|
22
|
+
*/
|
|
23
|
+
export declare const segmentedIndexAtPoint: (rects: readonly SegmentedRect[], disabled: readonly boolean[], x: number) => number;
|
|
24
|
+
/** A touch drag starts only after this much horizontal movement (px), and only when it is more horizontal than vertical. */
|
|
25
|
+
export declare const SEGMENTED_TOUCH_SLOP = 8;
|
|
26
|
+
/**
|
|
27
|
+
* Does a pointer movement of (`dx`, `dy`) since the press start a drag? Mouse and pen at once; touch only past the slop
|
|
28
|
+
* and mostly sideways, so a vertical swipe keeps scrolling the page. `'abandon'`: a touch that moved vertically first.
|
|
29
|
+
*/
|
|
30
|
+
export declare const segmentedDragDecision: (pointerType: string, dx: number, dy: number) => "drag" | "wait" | "abandon";
|
|
31
|
+
//# sourceMappingURL=segmentedControlNavigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmentedControlNavigation.d.ts","sourceRoot":"","sources":["../../src/primitives/segmentedControlNavigation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;AAIjG,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,GAAG,IAAI,YAA4C,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,SAAS,OAAO,EAAE,EAC5B,SAAS,MAAM,EACf,KAAK,YAAY,EACjB,YAAW,KAAK,GAAG,KAAa,KAC/B,MAgBF,CAAC;AAEF,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,SAAS,aAAa,EAAE,EAAE,UAAU,SAAS,OAAO,EAAE,EAAE,GAAG,MAAM,KAAG,MAYhH,CAAC;AAEF,4HAA4H;AAC5H,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,EACnB,IAAI,MAAM,EACV,IAAI,MAAM,KACT,MAAM,GAAG,MAAM,GAAG,SAMpB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard and pointer mechanics of `SegmentedControl`, as pure functions: which option a key or a pointer position
|
|
3
|
+
* lands on. Disabled options are skipped; arrows wrap around; in a right-to-left control the horizontal arrows swap.
|
|
4
|
+
*/
|
|
5
|
+
const SEGMENTED_KEYS = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'];
|
|
6
|
+
export const isSegmentedKey = (key) => SEGMENTED_KEYS.includes(key);
|
|
7
|
+
/**
|
|
8
|
+
* The index a key moves to from `current` among `disabled.length` options (`disabled[i]` true = skipped). Arrow right /
|
|
9
|
+
* down go forward (left in RTL), arrow left / up go back, Home / End to the first / last enabled option. `current` when
|
|
10
|
+
* no other enabled option exists.
|
|
11
|
+
*/
|
|
12
|
+
export const segmentedIndexForKey = (disabled, current, key, direction = 'ltr') => {
|
|
13
|
+
const count = disabled.length;
|
|
14
|
+
if (count === 0)
|
|
15
|
+
return current;
|
|
16
|
+
const enabled = (index) => !disabled[index];
|
|
17
|
+
if (key === 'Home' || key === 'End') {
|
|
18
|
+
const order = Array.from({ length: count }, (_, index) => index);
|
|
19
|
+
if (key === 'End')
|
|
20
|
+
order.reverse();
|
|
21
|
+
return order.find(enabled) ?? current;
|
|
22
|
+
}
|
|
23
|
+
const forwardKey = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
|
|
24
|
+
const step = key === forwardKey || key === 'ArrowDown' ? 1 : -1;
|
|
25
|
+
for (let offset = 1; offset < count; offset += 1) {
|
|
26
|
+
const index = (((current + step * offset) % count) + count) % count;
|
|
27
|
+
if (enabled(index))
|
|
28
|
+
return index;
|
|
29
|
+
}
|
|
30
|
+
return current;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The enabled option under a pointer at `x` during a drag: the option whose extent holds `x`, else the nearest one
|
|
34
|
+
* (a pointer dragged past the ends lands on the first / last). `-1` when every option is disabled.
|
|
35
|
+
*/
|
|
36
|
+
export const segmentedIndexAtPoint = (rects, disabled, x) => {
|
|
37
|
+
let best = -1;
|
|
38
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
39
|
+
rects.forEach((rect, index) => {
|
|
40
|
+
if (disabled[index])
|
|
41
|
+
return;
|
|
42
|
+
const distance = x < rect.left ? rect.left - x : x > rect.right ? x - rect.right : 0;
|
|
43
|
+
if (distance < bestDistance) {
|
|
44
|
+
best = index;
|
|
45
|
+
bestDistance = distance;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return best;
|
|
49
|
+
};
|
|
50
|
+
/** A touch drag starts only after this much horizontal movement (px), and only when it is more horizontal than vertical. */
|
|
51
|
+
export const SEGMENTED_TOUCH_SLOP = 8;
|
|
52
|
+
/**
|
|
53
|
+
* Does a pointer movement of (`dx`, `dy`) since the press start a drag? Mouse and pen at once; touch only past the slop
|
|
54
|
+
* and mostly sideways, so a vertical swipe keeps scrolling the page. `'abandon'`: a touch that moved vertically first.
|
|
55
|
+
*/
|
|
56
|
+
export const segmentedDragDecision = (pointerType, dx, dy) => {
|
|
57
|
+
if (pointerType !== 'touch')
|
|
58
|
+
return 'drag';
|
|
59
|
+
const horizontal = Math.abs(dx);
|
|
60
|
+
const vertical = Math.abs(dy);
|
|
61
|
+
if (horizontal < SEGMENTED_TOUCH_SLOP && vertical < SEGMENTED_TOUCH_SLOP)
|
|
62
|
+
return 'wait';
|
|
63
|
+
return horizontal > vertical ? 'drag' : 'abandon';
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=segmentedControlNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmentedControlNavigation.js","sourceRoot":"","sources":["../../src/primitives/segmentedControlNavigation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,cAAc,GAAsB,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE7G,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAuB,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAEjG;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAA4B,EAC5B,OAAe,EACf,GAAiB,EACjB,YAA2B,KAAK,EACxB,EAAE;IACV,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC9B,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAChC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;QACjE,IAAI,GAAG,KAAK,KAAK;YAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;IACxC,CAA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AAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,4HAA4H;AAC5H,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,WAAmB,EACnB,EAAU,EACV,EAAU,EACmB,EAAE;IAC/B,IAAI,WAAW,KAAK,OAAO;QAAE,OAAO,MAAM,CAAC;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9B,IAAI,UAAU,GAAG,oBAAoB,IAAI,QAAQ,GAAG,oBAAoB;QAAE,OAAO,MAAM,CAAC;IACxF,OAAO,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -2,8 +2,8 @@ import type { AdminUiProviderProps } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* The one provider of the package: registers the host's notification adapter, feeds the translation store from a
|
|
4
4
|
* host store, renders the tooltip provider and the portal container, and hands the host adapters (storage keys,
|
|
5
|
-
* router hooks, upload, markdown editor, AI translation) to packaged screens through `useAdminUi()
|
|
6
|
-
*
|
|
5
|
+
* router hooks, upload, markdown editor, AI translation) to packaged screens through `useAdminUi()`, and sets the link
|
|
6
|
+
* component of every block (`linkComponent`). Blocks never read `useAdminUi()`: they take adapters as props.
|
|
7
7
|
*/
|
|
8
|
-
export declare const AdminUiProvider: ({ children, translations, notifications, storageKey, useUrlStateAdapter, useDrawerUrlAdapter, portalContainer, tooltipDelayMs, upload, renderMarkdownEditor, aiTranslation, preserveSearchParams, }: AdminUiProviderProps) => import("react").JSX.Element;
|
|
8
|
+
export declare const AdminUiProvider: ({ children, translations, notifications, storageKey, useUrlStateAdapter, useDrawerUrlAdapter, portalContainer, tooltipDelayMs, upload, renderMarkdownEditor, aiTranslation, preserveSearchParams, linkComponent, }: AdminUiProviderProps) => import("react").JSX.Element;
|
|
9
9
|
//# sourceMappingURL=AdminUiProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminUiProvider.d.ts","sourceRoot":"","sources":["../../src/provider/AdminUiProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AdminUiProvider.d.ts","sourceRoot":"","sources":["../../src/provider/AdminUiProvider.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAuB,oBAAoB,EAAsB,MAAM,YAAY,CAAC;AAgBhG;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,oNAc7B,oBAAoB,gCA+BtB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useLayoutEffect, useMemo } from 'react';
|
|
4
4
|
import { setTranslations } from "../i18n/store.js";
|
|
5
5
|
import { setNotificationAdapter } from "../logic/pure/notify.js";
|
|
6
|
+
import { LinkComponentProvider } from "../primitives/link.js";
|
|
6
7
|
import { PortalContainerProvider } from "../primitives/portal.js";
|
|
7
8
|
import { TooltipProvider } from "../primitives/tooltip.js";
|
|
8
9
|
import { AdminUiContext } from "./adminUiContext.js";
|
|
@@ -22,10 +23,10 @@ const TranslationBridge = ({ adapter }) => {
|
|
|
22
23
|
/**
|
|
23
24
|
* The one provider of the package: registers the host's notification adapter, feeds the translation store from a
|
|
24
25
|
* host store, renders the tooltip provider and the portal container, and hands the host adapters (storage keys,
|
|
25
|
-
* router hooks, upload, markdown editor, AI translation) to packaged screens through `useAdminUi()
|
|
26
|
-
*
|
|
26
|
+
* router hooks, upload, markdown editor, AI translation) to packaged screens through `useAdminUi()`, and sets the link
|
|
27
|
+
* component of every block (`linkComponent`). Blocks never read `useAdminUi()`: they take adapters as props.
|
|
27
28
|
*/
|
|
28
|
-
export const AdminUiProvider = ({ children, translations, notifications, storageKey = defaultStorageKey, useUrlStateAdapter, useDrawerUrlAdapter, portalContainer, tooltipDelayMs, upload, renderMarkdownEditor, aiTranslation, preserveSearchParams, }) => {
|
|
29
|
+
export const AdminUiProvider = ({ children, translations, notifications, storageKey = defaultStorageKey, useUrlStateAdapter, useDrawerUrlAdapter, portalContainer, tooltipDelayMs, upload, renderMarkdownEditor, aiTranslation, preserveSearchParams, linkComponent, }) => {
|
|
29
30
|
// A layout effect: registered before any child's ordinary effect can raise a toast.
|
|
30
31
|
useLayoutEffect(() => {
|
|
31
32
|
if (!notifications)
|
|
@@ -42,6 +43,6 @@ export const AdminUiProvider = ({ children, translations, notifications, storage
|
|
|
42
43
|
aiTranslation,
|
|
43
44
|
preserveSearchParams,
|
|
44
45
|
}), [storageKey, useUrlStateAdapter, useDrawerUrlAdapter, upload, renderMarkdownEditor, aiTranslation, preserveSearchParams]);
|
|
45
|
-
return (_jsxs(AdminUiContext.Provider, { value: value, children: [translations && _jsx(TranslationBridge, { adapter: translations }), _jsx(TooltipProvider, { delayDuration: tooltipDelayMs, children: _jsx(PortalContainerProvider, { container: portalContainer, children: children }) })] }));
|
|
46
|
+
return (_jsxs(AdminUiContext.Provider, { value: value, children: [translations && _jsx(TranslationBridge, { adapter: translations }), _jsx(TooltipProvider, { delayDuration: tooltipDelayMs, children: _jsx(PortalContainerProvider, { container: portalContainer, children: linkComponent ? _jsx(LinkComponentProvider, { linkComponent: linkComponent, children: children }) : children }) })] }));
|
|
46
47
|
};
|
|
47
48
|
//# sourceMappingURL=AdminUiProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminUiProvider.js","sourceRoot":"","sources":["../../src/provider/AdminUiProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,kB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CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,UAAU;QACV,kBAAkB;QAClB,mBAAmB;QACnB,MAAM;QACN,oBAAoB;QACpB,aAAa;QACb,oBAAoB;KACrB,CAAC,EACF,CAAC,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,CAAC,CACzH,CAAC;IAEF,OAAO,CACL,MAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,aAClC,YAAY,IAAI,KAAC,iBAAiB,IAAC,OAAO,EAAE,YAAY,GAAI,EAC7D,KAAC,eAAe,IAAC,aAAa,EAAE,cAAc,YAC5C,KAAC,uBAAuB,IAAC,SAAS,EAAE,eAAe,YAChD,aAAa,CAAC,CAAC,CAAC,KAAC,qBAAqB,IAAC,aAAa,EAAE,aAAa,YAAG,QAAQ,GAAyB,CAAC,CAAC,CAAC,QAAQ,GAC3F,GACV,IACM,CAC3B,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/provider/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { NotificationAdapter } from '../logic/pure/notify.js';
|
|
|
5
5
|
import type { EntityDrawerUrlAdapter } from '../logic/pure/entityDrawer.js';
|
|
6
6
|
import type { UrlStateAdapter } from '../logic/pure/urlListState.js';
|
|
7
7
|
import type { MediaUploadAdapter } from '../media/types.js';
|
|
8
|
+
import type { PageLinkComponent } from '../primitives/link.js';
|
|
8
9
|
import type { MarkdownEditorRenderArgs } from '../translations/TranslatableMarkdown.js';
|
|
9
10
|
export type { NotificationAdapter, NotifyAction, NotifyOptions } from '../logic/pure/notify.js';
|
|
10
11
|
/** Feeds the package's one translation store from a host-owned store. Absent: the host calls `setTranslations`. */
|
|
@@ -53,6 +54,11 @@ export interface AdminUiProviderProps {
|
|
|
53
54
|
* may still set them. Absent = none.
|
|
54
55
|
*/
|
|
55
56
|
preserveSearchParams?: readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
* The app's router link for every block that renders a link (tabs, back links, the Add button); a block's own
|
|
59
|
+
* `linkComponent` prop still wins. Wrap the router link with `withStickyParams` to keep sticky search parameters.
|
|
60
|
+
*/
|
|
61
|
+
linkComponent?: PageLinkComponent;
|
|
56
62
|
}
|
|
57
63
|
export interface AdminUiContextValue extends Required<Pick<AdminUiProviderProps, 'storageKey'>> {
|
|
58
64
|
useUrlStateAdapter?: UseUrlStateAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/provider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEzF,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEhG,mHAAmH;AACnH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAChD,WAAW,EAAE,MAAM;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,wDAAwD;QACxD,YAAY,EAAE,YAAY,CAAC;QAC3B,6CAA6C;QAC7C,YAAY,EAAE,QAAQ,CAAC,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CAAC,EAAE,oBAAoB,CAAC,sBAAsB,CAAC,CAAC;IACpE,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
//
|
|
13
13
|
// Scan rules (the same as the host export): string literals passed to `t()`, `translateText()` and `m()` with an
|
|
14
14
|
// optional `{ context }`, and `<Translate context>…</Translate>` elements; a file containing the marker
|
|
15
|
-
// `@translations-ignore-file` is skipped; tests are skipped
|
|
15
|
+
// `@translations-ignore-file` is skipped; tests are skipped; the `showcase` entry (a development page with
|
|
16
|
+
// developer-facing English) is skipped. Key = text, or `${text}__${context}` with a context.
|
|
16
17
|
import { existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
17
18
|
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
18
19
|
import { fileURLToPath } from 'node:url';
|
|
@@ -40,6 +41,9 @@ const CONTEXT = new RegExp(String.raw`context\s*:\s*(${LITERAL})`);
|
|
|
40
41
|
const ELEMENT = /<Translate\b([^>]*)>([^<{}]+)<\/Translate>/g;
|
|
41
42
|
const ELEMENT_CONTEXT = /context=(?:"([^"]*)"|'([^']*)'|\{\s*['"]([^'"]*)['"]\s*\})/;
|
|
42
43
|
const IGNORE_MARKER = '@translations-ignore-file';
|
|
44
|
+
/** Entry folders whose texts are not UI texts of the blocks: the showcase is a development page. */
|
|
45
|
+
const IGNORED_ENTRIES = ['showcase'];
|
|
46
|
+
const inIgnoredEntry = name => IGNORED_ENTRIES.some(entry => name.startsWith(`${entry}/`));
|
|
43
47
|
|
|
44
48
|
const unquote = literal =>
|
|
45
49
|
literal
|
|
@@ -60,7 +64,8 @@ const sourceFiles = () => {
|
|
|
60
64
|
if (sourceMode) {
|
|
61
65
|
return walk(sourceRoot)
|
|
62
66
|
.filter(path => /\.(ts|tsx)$/.test(path) && !/\.test\.tsx?$/.test(path) && !path.endsWith('.d.ts'))
|
|
63
|
-
.map(path => ({ path, name: toPosix(relative(sourceRoot, path)) }))
|
|
67
|
+
.map(path => ({ path, name: toPosix(relative(sourceRoot, path)) }))
|
|
68
|
+
.filter(file => !inIgnoredEntry(file.name));
|
|
64
69
|
}
|
|
65
70
|
// built JS keeps the calls and the comments; the path is the dist path with the source's extension (`.ts` or
|
|
66
71
|
// `.tsx`, read from the file's source map)
|
|
@@ -72,7 +77,8 @@ const sourceFiles = () => {
|
|
|
72
77
|
const map = existsSync(mapPath) ? JSON.parse(readFileSync(mapPath, 'utf8')) : null;
|
|
73
78
|
const extension = /\.tsx?$/.exec(map?.sources?.[0] ?? '')?.[0] ?? '.js';
|
|
74
79
|
return { path, name: toPosix(relative(distRoot, path)).replace(/\.js$/, extension) };
|
|
75
|
-
})
|
|
80
|
+
})
|
|
81
|
+
.filter(file => !inIgnoredEntry(file.name));
|
|
76
82
|
};
|
|
77
83
|
|
|
78
84
|
const scan = ({ path, name }) => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type NotifySonnerLoader } from './sections/OptionalShowcase.js';
|
|
3
|
+
/** One section of the showcase: a heading and what it draws. Hosts append their own (`Showcase.sections`). */
|
|
4
|
+
export interface ShowcaseSection {
|
|
5
|
+
/** Stable id: the section's anchor (`#showcase-<id>`) and React key. */
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export type ShowcaseTheme = 'light' | 'dark';
|
|
12
|
+
export interface ShowcaseProps {
|
|
13
|
+
/** The host's own sections, drawn after the package's. */
|
|
14
|
+
sections?: readonly ShowcaseSection[];
|
|
15
|
+
/** Which themes to draw, side by side on wide screens (default both). Dark is a `.dark` ancestor, as in the host. */
|
|
16
|
+
themes?: readonly ShowcaseTheme[];
|
|
17
|
+
/**
|
|
18
|
+
* Loads `./notify-sonner` for its section; only a host with `sonner` passes it:
|
|
19
|
+
* `loadNotifySonner={() => import('@mgamadeus/ddd-admin-ui/notify-sonner')}`. Without it, or when the import fails
|
|
20
|
+
* (the peer is missing), the section says it is skipped.
|
|
21
|
+
*/
|
|
22
|
+
loadNotifySonner?: NotifySonnerLoader;
|
|
23
|
+
/** Leave out package sections by id (`primitives`, `list`, `page`, `form`, `translations`, `media`, `glass`, `notify-sonner`, `next`). */
|
|
24
|
+
omit?: readonly string[];
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Every block of the package in the host's theme, light and dark, one section per entry; the host appends its own
|
|
29
|
+
* sections. A development page: mount it on a route of the host (below `AdminUiProvider`, which brings the tooltip
|
|
30
|
+
* provider) to judge the theme, the tokens and the blocks in one place. Optional peers stay optional: the
|
|
31
|
+
* `./notify-sonner` section loads only through `loadNotifySonner` and is skipped without it; `./next` is described,
|
|
32
|
+
* never imported. Texts are developer-facing English and not part of the text manifest.
|
|
33
|
+
*/
|
|
34
|
+
export declare const Showcase: ({ sections, themes, loadNotifySonner, omit, className }: ShowcaseProps) => import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=Showcase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Showcase.d.ts","sourceRoot":"","sources":["../../src/showcase/Showcase.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAQjD,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAK9G,8GAA8G;AAC9G,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,qHAAqH;IACrH,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,0IAA0I;IAC1I,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiDD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,yDAAuF,aAAa,gCAS5H,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { PortalContainerProvider } from "../primitives/index.js";
|
|
5
|
+
import { cn } from "../primitives/cn.js";
|
|
6
|
+
import { FormShowcase } from "./sections/FormShowcase.js";
|
|
7
|
+
import { GlassShowcase } from "./sections/GlassShowcase.js";
|
|
8
|
+
import { ListShowcase } from "./sections/ListShowcase.js";
|
|
9
|
+
import { MediaShowcase } from "./sections/MediaShowcase.js";
|
|
10
|
+
import { NextShowcase, NotifySonnerShowcase } from "./sections/OptionalShowcase.js";
|
|
11
|
+
import { PageShowcase } from "./sections/PageShowcase.js";
|
|
12
|
+
import { PrimitivesShowcase } from "./sections/PrimitivesShowcase.js";
|
|
13
|
+
import { TranslationsShowcase } from "./sections/TranslationsShowcase.js";
|
|
14
|
+
/** The package's sections, one per entry, in import-matrix order. */
|
|
15
|
+
const packageSections = (loadNotifySonner) => [
|
|
16
|
+
{ id: 'primitives', title: './primitives', description: 'Buttons, fields, overlays, tables, the segmented control.', content: _jsx(PrimitivesShowcase, {}) },
|
|
17
|
+
{ id: 'list', title: './list', description: 'List card, toolbar, filters, table and grid, cells, pickers.', content: _jsx(ListShowcase, {}) },
|
|
18
|
+
{ id: 'page', title: './page', description: 'Page frame and header, detail shell, cards and toolbars.', content: _jsx(PageShowcase, {}) },
|
|
19
|
+
{ id: 'form', title: './form', description: 'Form shell, fields, sections, actions, errors, drawer.', content: _jsx(FormShowcase, {}) },
|
|
20
|
+
{ id: 'translations', title: './translations', description: 'Inputs per content locale and the translation controls.', content: _jsx(TranslationsShowcase, {}) },
|
|
21
|
+
{ id: 'media', title: './media', description: 'Media field, preview and picker.', content: _jsx(MediaShowcase, {}) },
|
|
22
|
+
{ id: 'glass', title: './glass', description: 'Glass pills, quick filters, collapsible cards, groups and rows.', content: _jsx(GlassShowcase, {}) },
|
|
23
|
+
{
|
|
24
|
+
id: 'notify-sonner',
|
|
25
|
+
title: './notify-sonner',
|
|
26
|
+
description: 'Toasts through sonner (optional peer, loaded lazily).',
|
|
27
|
+
content: _jsx(NotifySonnerShowcase, { load: loadNotifySonner }),
|
|
28
|
+
},
|
|
29
|
+
{ id: 'next', title: './next', description: 'Next.js adapters (optional peer): hooks, no markup.', content: _jsx(NextShowcase, {}) },
|
|
30
|
+
];
|
|
31
|
+
const ThemePane = ({ theme, sections }) => {
|
|
32
|
+
// dialogs, menus and tooltips of a pane open inside it, so the dark pane's overlays are dark too
|
|
33
|
+
const [portal, setPortal] = useState(null);
|
|
34
|
+
return (_jsxs("div", { "data-showcase-theme": theme, className: cn('min-w-0 flex-1 rounded-3xl bg-background p-4 text-foreground md:p-6', theme === 'dark' && 'dark'), children: [_jsxs(PortalContainerProvider, { container: portal, children: [_jsx("p", { className: "mb-6 text-[11.5px] font-bold tracking-[0.08em] text-muted-foreground uppercase", children: theme }), _jsx("div", { className: "space-y-12", children: sections.map(section => (_jsxs("section", { id: `showcase-${section.id}-${theme}`, "aria-labelledby": `showcase-${section.id}-${theme}-title`, children: [_jsxs("header", { className: "mb-4 border-b pb-2", children: [_jsx("h2", { id: `showcase-${section.id}-${theme}-title`, className: "text-title-section font-bold", children: section.title }), section.description && _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: section.description })] }), section.content] }, section.id))) })] }), _jsx("div", { ref: setPortal, className: theme === 'dark' ? 'dark' : undefined })] }));
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Every block of the package in the host's theme, light and dark, one section per entry; the host appends its own
|
|
38
|
+
* sections. A development page: mount it on a route of the host (below `AdminUiProvider`, which brings the tooltip
|
|
39
|
+
* provider) to judge the theme, the tokens and the blocks in one place. Optional peers stay optional: the
|
|
40
|
+
* `./notify-sonner` section loads only through `loadNotifySonner` and is skipped without it; `./next` is described,
|
|
41
|
+
* never imported. Texts are developer-facing English and not part of the text manifest.
|
|
42
|
+
*/
|
|
43
|
+
export const Showcase = ({ sections = [], themes = ['light', 'dark'], loadNotifySonner, omit = [], className }) => {
|
|
44
|
+
const all = [...packageSections(loadNotifySonner).filter(section => !omit.includes(section.id)), ...sections];
|
|
45
|
+
return (_jsx("div", { "data-showcase": true, className: cn('flex flex-col gap-6 xl:flex-row', className), children: themes.map(theme => (_jsx(ThemePane, { theme: theme, sections: all }, theme))) }));
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=Showcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Showcase.js","sourceRoot":"","sources":["../../src/showcase/Showcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAA2B,MAAM,gCAAiC,CAAC;AAC9G,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;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,gBAAgB,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAiB,EAAE,EAAE;IAC/H,MAAM,GAAG,GAAG,CAAC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,CAAC;IAC9G,OAAO,CACL,qCAAmB,SAAS,EAAE,EAAE,CAAC,iCAAiC,EAAE,SAAS,CAAC,YAC3E,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACnB,KAAC,SAAS,IAAa,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAlC,KAAK,CAAiC,CACvD,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which exported components of each entry the showcase draws (`shown`), and why the others are not drawn on their own
|
|
3
|
+
* (`notShown`: parts drawn by a shown block, providers, contexts). The package's tests compare it with the entries'
|
|
4
|
+
* exports, so a new block without a showcase sample fails them.
|
|
5
|
+
*/
|
|
6
|
+
export interface ShowcaseEntryCoverage {
|
|
7
|
+
shown: readonly string[];
|
|
8
|
+
notShown: Readonly<Record<string, string>>;
|
|
9
|
+
}
|
|
10
|
+
export declare const SHOWCASE_COVERAGE: Readonly<Record<string, ShowcaseEntryCoverage>>;
|
|
11
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/showcase/coverage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAID,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CA6E7E,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const DRAWN_BY = (block) => `drawn by ${block}`;
|
|
2
|
+
export const SHOWCASE_COVERAGE = {
|
|
3
|
+
primitives: {
|
|
4
|
+
shown: [
|
|
5
|
+
'Alert', 'AlertDescription', 'AlertTitle', 'Badge', 'Breadcrumb', 'BreadcrumbEllipsis', 'BreadcrumbItem', 'BreadcrumbLink',
|
|
6
|
+
'BreadcrumbList', 'BreadcrumbPage', 'BreadcrumbSeparator', 'Button', 'Card', 'CardAction', 'CardContent', 'CardDescription',
|
|
7
|
+
'CardFooter', 'CardHeader', 'CardTitle', 'Checkbox', 'Collapsible', 'CollapsibleContent', 'CollapsibleTrigger', 'Command',
|
|
8
|
+
'CommandDialog', 'CommandEmpty', 'CommandGroup', 'CommandInput', 'CommandItem', 'CommandList', 'CommandSeparator',
|
|
9
|
+
'CommandShortcut', 'Dialog', 'DialogClose', 'DialogContent', 'DialogDescription', 'DialogFooter', 'DialogHeader',
|
|
10
|
+
'DialogTitle', 'DialogTrigger', 'DropdownMenu', 'DropdownMenuCheckboxItem', 'DropdownMenuContent', 'DropdownMenuGroup',
|
|
11
|
+
'DropdownMenuItem', 'DropdownMenuLabel', 'DropdownMenuSeparator', 'DropdownMenuSub', 'DropdownMenuSubContent',
|
|
12
|
+
'DropdownMenuSubTrigger', 'DropdownMenuTrigger', 'Input', 'Label', 'Popover', 'PopoverAnchor', 'PopoverContent',
|
|
13
|
+
'PopoverDescription', 'PopoverHeader', 'PopoverTitle', 'PopoverTrigger', 'PortalContainerProvider', 'SegmentedControl',
|
|
14
|
+
'Select', 'SelectContent', 'SelectGroup', 'SelectItem', 'SelectLabel', 'SelectSeparator', 'SelectTrigger', 'SelectValue',
|
|
15
|
+
'Separator', 'Sheet', 'SheetClose', 'SheetContent', 'SheetDescription', 'SheetFooter', 'SheetHeader', 'SheetTitle',
|
|
16
|
+
'SheetTrigger', 'Skeleton', 'Switch', 'Table', 'TableBody', 'TableCaption', 'TableCell', 'TableFooter', 'TableHead',
|
|
17
|
+
'TableHeader', 'TableRow', 'Textarea', 'Tooltip', 'TooltipContent', 'TooltipTrigger',
|
|
18
|
+
],
|
|
19
|
+
notShown: {
|
|
20
|
+
DialogOverlay: DRAWN_BY('DialogContent'),
|
|
21
|
+
DialogPortal: DRAWN_BY('DialogContent'),
|
|
22
|
+
DropdownMenuPortal: DRAWN_BY('DropdownMenuContent'),
|
|
23
|
+
SelectScrollDownButton: DRAWN_BY('SelectContent'),
|
|
24
|
+
SelectScrollUpButton: DRAWN_BY('SelectContent'),
|
|
25
|
+
PortalContainerContext: 'a context (PortalContainerProvider is shown)',
|
|
26
|
+
AnchorLink: 'the default link of every block (drawn by the ./page tabs and back links)',
|
|
27
|
+
LinkComponentContext: 'a context (set by AdminUiProvider.linkComponent)',
|
|
28
|
+
LinkComponentProvider: 'mounted by AdminUiProvider when linkComponent is set',
|
|
29
|
+
TooltipProvider: 'mounted once by AdminUiProvider',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
list: {
|
|
33
|
+
shown: [
|
|
34
|
+
'BooleanCell', 'ChipToggleGroup', 'Combobox', 'CopyButton', 'DateCell', 'EmptyValue', 'EntityListBody', 'EntityListBulkBar',
|
|
35
|
+
'EntityListCard', 'EntityListEmpty', 'EntityListGrid', 'EntityListGridSkeleton', 'EntityListLoadMore', 'EntityListTable',
|
|
36
|
+
'EntityListToolbar', 'EntityListViewToggle', 'FilterDateRange', 'FilterField', 'FilterMultiSelect', 'FilterPanel',
|
|
37
|
+
'FilterSelect', 'FilterText', 'IdCell', 'ImageCell', 'MultiSelect', 'SearchField', 'StatusBadge', 'Tag',
|
|
38
|
+
],
|
|
39
|
+
notShown: { EntityListPage: 'deprecated re-export; shown under ./page' },
|
|
40
|
+
},
|
|
41
|
+
page: {
|
|
42
|
+
shown: [
|
|
43
|
+
'AddEntityButton', 'AnchorLink', 'CardGrid', 'DefinitionList', 'DetailHeader', 'EditableCard', 'EntityDetailShell',
|
|
44
|
+
'EntityListPage', 'EntityMetadata', 'EntityTabs', 'ExportButton', 'IconValue', 'IconValueRow', 'MoreActionsMenu',
|
|
45
|
+
'PageFrame', 'PageHeader', 'PageSections', 'PageToolbar', 'SectionHeader', 'StatusCallout', 'StatusCalloutAction',
|
|
46
|
+
],
|
|
47
|
+
notShown: {},
|
|
48
|
+
},
|
|
49
|
+
form: {
|
|
50
|
+
shown: [
|
|
51
|
+
'DrawerFooter', 'Form', 'FormActions', 'FormDrawer', 'FormErrors', 'FormField', 'FormFieldFrame', 'FormHeader',
|
|
52
|
+
'FormJumpBar', 'FormSection', 'FormSubmitButton', 'FormWrapper', 'VisibleWhen',
|
|
53
|
+
],
|
|
54
|
+
notShown: { UnsavedChangesContext: 'a context (used by FormDrawer)' },
|
|
55
|
+
},
|
|
56
|
+
translations: {
|
|
57
|
+
shown: [
|
|
58
|
+
'FormTranslatableInput', 'FormTranslatableMarkdown', 'TranslatableField', 'TranslatableInput', 'TranslatableMarkdown',
|
|
59
|
+
'TranslationControls',
|
|
60
|
+
],
|
|
61
|
+
notShown: {},
|
|
62
|
+
},
|
|
63
|
+
media: {
|
|
64
|
+
shown: ['FormMediaItemField', 'MediaItemField', 'MediaItemPickerDialog', 'MediaPreview'],
|
|
65
|
+
notShown: {},
|
|
66
|
+
},
|
|
67
|
+
glass: {
|
|
68
|
+
shown: ['ActionRow', 'CollapsibleCard', 'GlassGroup', 'GlassPill', 'QuickFilterPills'],
|
|
69
|
+
notShown: {},
|
|
70
|
+
},
|
|
71
|
+
provider: {
|
|
72
|
+
shown: [],
|
|
73
|
+
notShown: { AdminUiProvider: 'the host mounts it above the showcase' },
|
|
74
|
+
},
|
|
75
|
+
'notify-sonner': {
|
|
76
|
+
shown: [],
|
|
77
|
+
notShown: { Toaster: 'mounted once by the host; the section sends toasts through sonnerNotifications' },
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../src/showcase/coverage.ts"],"names":[],"mappings":"AAUA,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,YAAY,KAAK,EAAE,CAAC;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAoD;IAChF,UAAU,EAAE;QACV,KAAK,EAAE;YACL,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB;YAC1H,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB;YAC3H,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS;YACzH,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB;YACjH,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc;YAChH,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,mBAAmB;YACtH,kBAAkB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,wBAAwB;YAC7G,wBAAwB,EAAE,qBAAqB,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB;YAC/G,oBAAoB,EAAE,eAAe,EAAE,cAAc,EAA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EAAE,OAAO,EAAE,gFAAgF,EAAE;KACxG;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Showcase } from './Showcase.js';
|
|
2
|
+
export type { ShowcaseProps, ShowcaseSection, ShowcaseTheme } from './Showcase.js';
|
|
3
|
+
export type { NotifySonnerLoader, NotifySonnerModule } from './sections/OptionalShowcase.js';
|
|
4
|
+
export { SHOWCASE_COVERAGE } from './coverage.js';
|
|
5
|
+
export type { ShowcaseEntryCoverage } from './coverage.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpF,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The showcase entry: one development page that draws every block of the package in the host's theme. Not for
|
|
2
|
+
// production screens; its texts are developer-facing English and stay out of the text manifest.
|
|
3
|
+
export { Showcase } from "./Showcase.js";
|
|
4
|
+
export { SHOWCASE_COVERAGE } from "./coverage.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/showcase/index.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,gGAAgG;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/FormShowcase.tsx"],"names":[],"mappings":"AAuFA,4BAA4B;AAC5B,eAAO,MAAM,YAAY,mCAyBxB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { DrawerFooter, Form, FORM_PANEL_SCROLL_MARGIN_CLASS, FormActions, FormDrawer, FormErrors, FormField, FormFieldFrame, FormHeader, FormJumpBar, FormSection, FormSubmitButton, FormWrapper, VisibleWhen, } from "../../form/index.js";
|
|
6
|
+
import { fieldEquals } from "../../logic/index.js";
|
|
7
|
+
import { Button, Input, Switch } from "../../primitives/index.js";
|
|
8
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
9
|
+
const SERVER_ERROR = {
|
|
10
|
+
message: 'Could not save',
|
|
11
|
+
validationErrors: [{ propertyName: 'email', path: 'email', errorMessage: 'is not a valid address' }],
|
|
12
|
+
};
|
|
13
|
+
const ShowcaseFormBody = ({ idPrefix, onClose }) => {
|
|
14
|
+
const form = useForm({ defaultValues: { name: 'Sample', email: 'not-an-address', hasNote: true, note: '' } });
|
|
15
|
+
const [error, setError] = useState(null);
|
|
16
|
+
return (_jsxs(Form, { form: form, onSubmit: () => setError(SERVER_ERROR), children: [_jsx(FormErrors, { error: error }), _jsx(FormJumpBar, { panels: [
|
|
17
|
+
{ id: `${idPrefix}-general`, label: 'General' },
|
|
18
|
+
{ id: `${idPrefix}-details`, label: 'Details' },
|
|
19
|
+
] }), _jsx("div", { id: `${idPrefix}-general`, className: FORM_PANEL_SCROLL_MARGIN_CLASS, children: _jsxs(FormSection, { title: "General", description: "The basics.", children: [_jsx(FormField, { name: "name", label: "Name", required: true, description: "Shown in lists.", children: ({ field, control, disabled }) => _jsx(Input, { ...control, ...field, disabled: disabled }) }), _jsx(FormField, { name: "email", label: "Email", children: ({ field, control }) => _jsx(Input, { ...control, ...field, type: "email" }) })] }) }), _jsx("div", { id: `${idPrefix}-details`, className: FORM_PANEL_SCROLL_MARGIN_CLASS, children: _jsxs(FormSection, { title: "Details", children: [_jsx(FormField, { name: "hasNote", label: "Add a note", children: ({ field, control }) => _jsx(Switch, { id: control.id, checked: field.value, onCheckedChange: field.onChange }) }), _jsx(VisibleWhen, { condition: fieldEquals('hasNote', true), children: _jsx(FormField, { name: "note", label: "Note", children: ({ field, control }) => _jsx(Input, { ...control, ...field }) }) }), _jsx(FormFieldFrame, { label: "Unbound field", description: "FormFieldFrame outside a form value.", children: control => _jsx(Input, { ...control, placeholder: "Free input" }) })] }) }), _jsx(FormActions, { sticky: false, secondary: _jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Cancel" }), primary: _jsx(FormSubmitButton, { children: "Save" }) })] }));
|
|
20
|
+
};
|
|
21
|
+
/** The `./form` section. */
|
|
22
|
+
export const FormShowcase = () => {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
return (_jsxs(Samples, { children: [_jsx(Sample, { title: "FormWrapper, FormHeader, Form, FormJumpBar, FormSection, FormField, FormErrors, FormActions", children: _jsxs("div", { className: "w-full", children: [_jsx(FormHeader, { title: "Edit item", description: "A form page." }), _jsx(FormWrapper, { children: _jsx(ShowcaseFormBody, { idPrefix: "showcase-form-page" }) })] }) }), _jsxs(Sample, { title: "FormDrawer, DrawerFooter", children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(true), children: "Open form drawer" }), _jsxs(FormDrawer, { open: open, onClose: () => setOpen(false), title: "Edit item", metadata: { id: 42 }, children: [_jsx(ShowcaseFormBody, { idPrefix: "showcase-form-drawer", onClose: () => setOpen(false) }), _jsx(DrawerFooter, { children: _jsx("span", { className: "text-xs text-muted-foreground", children: "DrawerFooter content" }) })] })] })] }));
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=FormShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/FormShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,8BAA8B,EAC9B,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,UAAU,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAwB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAA0B,CAAC;AAS3D,MAAM,YAAY,GAAoB;IACpC,OAAO,EAAE,gBAAgB;IACzB,gBAAgB,EAAE,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,CAAC;CACrG,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAA8C,EAAE,EAAE;IAC7F,MAAM,IAAI,GAAG,OAAO,CAAqB,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAClI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAyB,IAAI,CAAC,CAAC;IACjE,OAAO,CACL,MAAC,IAAI,IAAC,IAAI,EAAE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AE,CAAC,OAAO,CAAC,IAAI,CAAC,iCAE7C,EACT,MAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,EAAC,WAAW,EAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,aAC3F,KAAC,gBAAgB,IAAC,QAAQ,EAAC,sBAAsB,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAI,EACnF,KAAC,YAAY,cACX,eAAM,SAAS,EAAC,+BAA+B,qCAA4B,GAC9D,IACJ,IACN,IACD,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/GlassShowcase.tsx"],"names":[],"mappings":"AAcA,6BAA6B;AAC7B,eAAO,MAAM,aAAa,mCAiCzB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Palette, Star } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { ActionRow, CollapsibleCard, GlassGroup, GlassPill, QuickFilterPills } from "../../glass/index.js";
|
|
6
|
+
import { Sample, Samples } from "./PrimitivesShowcase.js";
|
|
7
|
+
const STATUS_OPTIONS = [
|
|
8
|
+
{ value: 'ACTIVE', label: 'Active', count: 12 },
|
|
9
|
+
{ value: 'PAUSED', label: 'Paused', count: 3 },
|
|
10
|
+
{ value: 'FAILED', label: 'Failed', count: 0 },
|
|
11
|
+
];
|
|
12
|
+
/** The `./glass` section. */
|
|
13
|
+
export const GlassShowcase = () => {
|
|
14
|
+
const [status, setStatus] = useState('');
|
|
15
|
+
const [statuses, setStatuses] = useState(['ACTIVE']);
|
|
16
|
+
const [pill, setPill] = useState(true);
|
|
17
|
+
return (_jsxs(Samples, { children: [_jsxs(Sample, { title: "GlassPill, QuickFilterPills", children: [_jsx(GlassPill, { icon: _jsx(Star, {}), count: 4, active: pill, "aria-pressed": pill, onClick: () => setPill(value => !value), children: "Featured" }), _jsx(GlassPill, { size: "sm", as: "span", children: "Static pill" }), _jsx(QuickFilterPills, { "aria-label": "Status quick filters", allLabel: "All statuses", options: STATUS_OPTIONS, value: status, onChange: setStatus }), _jsx(QuickFilterPills, { "aria-label": "Status quick filters (multi)", mode: "multi", options: STATUS_OPTIONS, value: statuses, onChange: setStatuses, size: "sm" })] }), _jsxs(Sample, { title: "CollapsibleCard", children: [_jsx(CollapsibleCard, { title: "Glass card", description: "Open by default", icon: _jsx(Palette, {}), defaultOpen: true, className: "w-full", children: _jsx("p", { className: "text-sm", children: "Content of a glass collapsible card." }) }), _jsx(CollapsibleCard, { title: "Solid card, compact", variant: "solid", density: "compact", className: "w-full", children: _jsx("p", { className: "text-sm", children: "Content of a solid collapsible card." }) })] }), _jsxs(Sample, { title: "GlassGroup, ActionRow", children: [_jsxs(GlassGroup, { title: "Running", count: 2, emptyText: "Nothing running", className: "w-full", children: [_jsx(ActionRow, { interactive: true, chevron: true, title: "Sample item 1", description: "Workspace North", tone: "success", toneLabel: "Active" }), _jsx(ActionRow, { interactive: true, chevron: true, title: "Sample item 2", description: "Workspace South", tone: "warning", toneLabel: "Paused" })] }), _jsx(GlassGroup, { title: "Empty group", count: 0, emptyText: "Nothing here", className: "w-full" })] })] }));
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=GlassShowcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GlassShowcase.js","sourceRoot":"","sources":["../../../src/showcase/sections/GlassShowcase.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,OA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,CACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ShowcaseRow {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
owner: string;
|
|
5
|
+
status: 'ACTIVE' | 'PAUSED' | 'FAILED';
|
|
6
|
+
featured: boolean;
|
|
7
|
+
created: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const SHOWCASE_STATUS: Readonly<Record<"ACTIVE" | "PAUSED" | "FAILED", import("../../list/StatusBadge.js").StatusDefinition>>;
|
|
10
|
+
export declare const SHOWCASE_ROWS: ShowcaseRow[];
|
|
11
|
+
/** The `./list` section. */
|
|
12
|
+
export declare const ListShowcase: () => import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=ListShowcase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListShowcase.d.ts","sourceRoot":"","sources":["../../../src/showcase/sections/ListShowcase.tsx"],"names":[],"mappings":"AA0CA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,yGAI1B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,WAAW,EAOpC,CAAC;AA4GJ,4BAA4B;AAC5B,eAAO,MAAM,YAAY,mCAgIxB,CAAC"}
|