@phis/ui 0.4.4 → 0.4.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/README.md +9 -3
- package/cms/plugins.d.ts +1 -0
- package/cms/plugins.js +2 -0
- package/components/cms/phi-cms-root-layout.js +30 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +12 -4
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +4 -1
- package/components/controls/phi-ribbon-control.js +5 -3
- package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
- package/components/controls/phi-ribbon-wrap-control.js +8 -2
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/regions/clients/cms-region-container-client.js +11 -1
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +10 -0
- package/components/regions/phi-cms-region-shell.js +53 -7
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +12 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
- package/components/root/phi-shell-chrome-overlay.js +7 -1
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-cms-shell.d.ts +7 -1
- package/components/shell/phi-cms-shell.js +4 -2
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/config/background.d.ts +20 -0
- package/components/widgets/config/background.js +44 -2
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/label-sets/background.js +2 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-types/background.d.ts +1 -0
- package/components/widgets/label-types/background.js +1 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/card-body-client.d.ts +11 -0
- package/components/widgets/shared/card-body-client.js +32 -4
- package/components/widgets/shared/collection-source-failure.d.ts +26 -0
- package/components/widgets/shared/collection-source-failure.js +42 -0
- package/components/widgets/shared/markdown-render.js +16 -3
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/surface-style.js +33 -11
- package/module-dashboard-cards.d.ts +1 -0
- package/module-dashboard-cards.js +1 -0
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +94 -0
- package/plugins/runtime-modules/core/widgets/card/config.js +38 -0
- package/plugins/runtime-modules/core/widgets/card/editor.js +8 -1
- package/plugins/runtime-modules/core/widgets/card/server.js +4 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/styles/controls.css +10 -5
- package/styles/gradients.css +101 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +64 -0
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +5 -1
- package/theme/phi-theme-tokens.js +14 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,11 @@ It does not own:
|
|
|
50
50
|
`createPhiNextStaticAreaLayout`, and the Area bridges in `@phis/ui/next/areas/<area>`). They hold no CMS,
|
|
51
51
|
locale, or access logic. Behavior fixes arrive by updating the package, not by editing the Site.
|
|
52
52
|
- Install Module packages with `phis module add --site <site key> --package <name>`, rebuild, and enable
|
|
53
|
-
the Module per Area in the Builder.
|
|
53
|
+
the Module per Area in the Builder. `--spec <version or workspace:*>` also writes the package into the
|
|
54
|
+
Site's dependencies (without it the package must already resolve; nothing is fetched), and `--path
|
|
55
|
+
<site root>` names the Site when it is not the Site's configured source path. A package resolves through
|
|
56
|
+
its `exports`, which point into `dist`, so a local or workspace package must be built (`pnpm build`)
|
|
57
|
+
before it is added, and rebuilt after every change for the Site to see it.
|
|
54
58
|
- The Site boundary, the route graph, fonts, and metadata are [NEXT_INTEGRATION.md](./NEXT_INTEGRATION.md).
|
|
55
59
|
|
|
56
60
|
## For Module authors
|
|
@@ -68,9 +72,9 @@ The root export (`@phis/ui`) is not an integration surface; import from the grou
|
|
|
68
72
|
|
|
69
73
|
| Group | Entry points |
|
|
70
74
|
| --- | --- |
|
|
71
|
-
| Next.js Site | `next/area-route`, `next/areas/<area>`, `next/areas/<area>-client`, `next/root-route`, `next/root-error-page`, `next/global-error`, `next/site-bridge`, `next/site-proxy`, `next/proxy-runtime`, `next/route-handlers`, `next/seo-routes`, `next/overlay-zones`, `next/overlay-zones-client`, `next/cache-handler`, `next/runtime-module-client-boundary` |
|
|
75
|
+
| Next.js Site | `next/config` (`withPhiNextConfig` for the Site's `next.config`), `next/area-route`, `next/areas/<area>`, `next/areas/<area>-client`, `next/root-route`, `next/root-error-page`, `next/global-error`, `next/site-bridge`, `next/site-proxy`, `next/proxy-runtime`, `next/route-handlers`, `next/seo-routes`, `next/overlay-zones`, `next/overlay-zones-client`, `next/cache-handler`, `next/runtime-module-client-boundary` |
|
|
72
76
|
| CMS rendering | `cms`, `cms/root-layout`, `cms/root-page`, `cms/root-slot-page`, `cms/error-page`, `cms/request`, `cms/plugins`, `cms/plugins/<area>` |
|
|
73
|
-
| Module packages | `module`, `module/client`, `module/authoring-client`, `module/labels`, `module/dashboard-cards`, `module/projection`, `module/projection/client`, `module/projection/authoring-client`, `module/site-modules`, `module/site-modules-client` |
|
|
77
|
+
| Module packages | `module`, `module/client`, `module/authoring-client`, `module/labels`, `module/dashboard-cards`, `module/records`, `module/projection`, `module/projection/client`, `module/projection/authoring-client`, `module/site-modules`, `module/site-modules-client` |
|
|
74
78
|
| Runtime Clients | `runtime`, `runtime/controller-client`, `runtime/render-client`, `runtime/signal-client`, `runtime/data-provider-client`, `runtime/authoring-client`, `runtime/authoring-manifest-client`, `runtime/calendar-adapter-client`, `runtime/user-state-client`, `runtime/client-manifests/<area>` |
|
|
75
79
|
| UI | `widgets`, `core-widgets`, `widget-config`, `controls`, `controls/config`, `controls/date-time`, `layouts`, `shells`, `root`, `navigation`, `forms`, `forms/client`, `media`, `references`, `state`, `theme` |
|
|
76
80
|
| Builder | `builder-api-route` |
|
|
@@ -99,6 +103,8 @@ graph.
|
|
|
99
103
|
| Tables, Trees, Collections | [TABLES.md](./TABLES.md), [TREES.md](./TREES.md), [COLLECTIONS.md](./COLLECTIONS.md) |
|
|
100
104
|
| Overlays | [OVERLAYS.md](./OVERLAYS.md) |
|
|
101
105
|
| Conversation surfaces | [THREADS.md](./THREADS.md) |
|
|
106
|
+
| Area Dashboards and Module cards | [DASHBOARD.md](./DASHBOARD.md) |
|
|
107
|
+
| Content entries (blog, news) and their Pages | [CONTENT_ENTRIES.md](./CONTENT_ENTRIES.md) |
|
|
102
108
|
| Builder | [BUILDER.md](./BUILDER.md) |
|
|
103
109
|
| Settings | [SETTINGS.md](./SETTINGS.md) |
|
|
104
110
|
| Access and visibility | [ACCESS.md](./ACCESS.md) |
|
package/cms/plugins.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { PhiCmsSiteBridge } from "../types/cms-plugins";
|
|
2
|
+
export { definePhiPassiveWidgetRenderers } from "../plugins/factories/widget-renderers";
|
|
2
3
|
export { assertPhiCmsPresetTreeContract, buildPhiCmsPresetIdentityKey, compilePhiCmsActiveRouteTable, compilePhiCmsDescriptorCatalog, instantiatePhiCmsAreaShellPreset, instantiatePhiCmsRoutePreset, instantiatePhiCmsThemePreset, instantiatePhiCmsThemePresets, normalizePhiCmsRoutePath, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, resolvePhiCmsRoutePreset, resolvePhiCmsRoutePresetByPageId, resolvePhiCmsRoutePresetByIdentity, resolvePhiCmsThemePresetBinding, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
3
4
|
export { buildPhiRuntimeModulePackageRoutePrefix, readPhiRuntimeModulePackageRouteParts, } from "../helpers/runtime-module-route-path";
|
|
4
5
|
export { assertPhiRuntimeModuleCatalog, createPhiRuntimeModuleCatalog, buildPhiRuntimeModuleControllerDescriptor, buildPhiRuntimeModuleDataProviderDescriptor, extendPhiRuntimeModuleCatalog, } from "../plugins/runtime-modules/contracts";
|
package/cms/plugins.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// A package's Widget draws its Preview inert the way a Core Widget does, rather than live.
|
|
2
|
+
export { definePhiPassiveWidgetRenderers } from "../plugins/factories/widget-renderers";
|
|
1
3
|
export { assertPhiCmsPresetTreeContract, buildPhiCmsPresetIdentityKey, compilePhiCmsActiveRouteTable, compilePhiCmsDescriptorCatalog, instantiatePhiCmsAreaShellPreset, instantiatePhiCmsRoutePreset, instantiatePhiCmsThemePreset, instantiatePhiCmsThemePresets, normalizePhiCmsRoutePath, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, resolvePhiCmsRoutePreset, resolvePhiCmsRoutePresetByPageId, resolvePhiCmsRoutePresetByIdentity, resolvePhiCmsThemePresetBinding, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
2
4
|
export { buildPhiRuntimeModulePackageRoutePrefix, readPhiRuntimeModulePackageRouteParts, } from "../helpers/runtime-module-route-path";
|
|
3
5
|
export { assertPhiRuntimeModuleCatalog, createPhiRuntimeModuleCatalog, buildPhiRuntimeModuleControllerDescriptor, buildPhiRuntimeModuleDataProviderDescriptor, extendPhiRuntimeModuleCatalog, } from "../plugins/runtime-modules/contracts";
|
|
@@ -255,8 +255,37 @@ export async function PhiCmsAreaShell({ root, cmsBridge, children, chrome = "she
|
|
|
255
255
|
extent: headerTopExtent,
|
|
256
256
|
stack: headerTopReveal === "scroll-up" ? headerTopExtent : 0,
|
|
257
257
|
};
|
|
258
|
+
/*
|
|
259
|
+
* The room the two Area bands hold, where their configs state a height: what a Hero stands behind on
|
|
260
|
+
* the first paint (`styles/shell.css`, "Hero at the top"). A `header_top` the browser decides holds
|
|
261
|
+
* what it was just resolved to hold.
|
|
262
|
+
*/
|
|
263
|
+
const headerTopBandRoom = !hasRenderableHeaderTop
|
|
264
|
+
? 0
|
|
265
|
+
: headerTopBehaviour != null
|
|
266
|
+
? headerTopRoom.extent
|
|
267
|
+
: readPhiShellChromePanePixels(headerTopBand?.height);
|
|
268
|
+
const headerMainBandRoom = hasRenderableHeaderMain
|
|
269
|
+
? readPhiShellChromePanePixels(readPhiShellChromePaneBand(headerMainRegion?.config)?.height)
|
|
270
|
+
: 0;
|
|
271
|
+
/*
|
|
272
|
+
* The Page's own `header_bottom` where it states a height, so a Hero's words start below it on the first
|
|
273
|
+
* paint too; a band sized by its content is the browser's to measure.
|
|
274
|
+
*/
|
|
275
|
+
const resolvedPage = scope.rootScope.resolvedRequest?.page;
|
|
276
|
+
const pageHeaderBottom = resolvedPage?.regions.find((region) => region.regionType === PhiCmsRegionType.HeaderBottom);
|
|
277
|
+
const headerBottomBandRoom = !resolvedPage
|
|
278
|
+
? null
|
|
279
|
+
: pageHeaderBottom
|
|
280
|
+
? readPhiShellChromePanePixels(readPhiShellChromePaneBand(pageHeaderBottom.config)?.height)
|
|
281
|
+
: 0;
|
|
282
|
+
const headerBandRoom = {
|
|
283
|
+
...(headerTopBandRoom == null ? {} : { "--phi-shell-band-top": `${headerTopBandRoom}px` }),
|
|
284
|
+
...(headerMainBandRoom == null ? {} : { "--phi-shell-band-main": `${headerMainBandRoom}px` }),
|
|
285
|
+
...(headerBottomBandRoom == null ? {} : { "--phi-shell-band-bottom": `${headerBottomBandRoom}px` }),
|
|
286
|
+
};
|
|
258
287
|
const headerPaneStickyTop = resolvePhiShellHeaderPaneStickyTop(headerTopBand, hasRenderableHeaderMain ? readPhiShellChromePaneBand(headerMainRegion?.config) : null, headerTopBehaviour, headerTopRoom);
|
|
259
|
-
return (_jsx(PhiCmsShell, { content: children, headerPaneStickyTop: headerPaneStickyTop, headerTopRoom: headerTopBehaviour == null ? undefined : {
|
|
288
|
+
return (_jsx(PhiCmsShell, { content: children, headerPaneStickyTop: headerPaneStickyTop, headerBandRoom: headerBandRoom, headerTopRoom: headerTopBehaviour == null ? undefined : {
|
|
260
289
|
[PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY]: `${headerTopRoom.extent}px`,
|
|
261
290
|
[PHI_SHELL_HEADER_TOP_STACK_PROPERTY]: `${headerTopRoom.stack}px`,
|
|
262
291
|
}, headerTop: hasRenderableHeaderTop ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_top", regionTypes: [PhiCmsRegionType.HeaderTop], registry: runtimeRegistry })) : undefined, headerMain: hasRenderableHeaderMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_main", regionTypes: [PhiCmsRegionType.HeaderMain], registry: runtimeRegistry })) : undefined, headerBottom: headerBottom, hero: hero, siderLeft: hasRenderableSiderLeft ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "sider_left", regionTypes: [PhiCmsRegionType.SiderLeft], stackGap: 0, registry: runtimeRegistry })) : undefined, siderRight: siderRight, siderLeftFullHeight: hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.FullHeight) && hasRenderableSiderLeft, footerTop: footerTop, drawer: drawer, footerMain: hasRenderableFooterMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_main", regionTypes: [PhiCmsRegionType.Footer], registry: runtimeRegistry })) : undefined, footerBottom: hasRenderableFooterBottom ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_bottom", regionTypes: [PhiCmsRegionType.FooterBottom], registry: runtimeRegistry })) : undefined }));
|
|
@@ -54,6 +54,11 @@ export type PhiBackgroundControlProps = {
|
|
|
54
54
|
* for it.
|
|
55
55
|
*/
|
|
56
56
|
baseKinds?: readonly PhiCmsBackgroundWidgetConfig["base"]["kind"][];
|
|
57
|
+
/**
|
|
58
|
+
* Whether the surface draws an Overlay over its Base. A Theme gradient slot is one run and nothing
|
|
59
|
+
* over it, so it offers none; absent is offered.
|
|
60
|
+
*/
|
|
61
|
+
overlay?: boolean;
|
|
57
62
|
renderMediaPicker?: (props: {
|
|
58
63
|
purpose: "preview" | "field";
|
|
59
64
|
value?: number | null;
|
|
@@ -75,4 +80,4 @@ export type PhiBackgroundControlProps = {
|
|
|
75
80
|
editTransaction?: PhiBackgroundEditTransaction;
|
|
76
81
|
onChange?: (value: PhiCmsBackgroundWidgetConfig) => void;
|
|
77
82
|
};
|
|
78
|
-
export declare function PhiBackgroundControl({ value, config, disabled, mode, labels, colorPickerLabels, colorPickerPlacement, motionModes, filters, imageSourceKinds, baseKinds, renderMediaPicker, editTransaction, onChange, }: PhiBackgroundControlProps): import("react").JSX.Element;
|
|
83
|
+
export declare function PhiBackgroundControl({ value, config, disabled, mode, labels, colorPickerLabels, colorPickerPlacement, motionModes, filters, imageSourceKinds, baseKinds, overlay: overlayOffered, renderMediaPicker, editTransaction, onChange, }: PhiBackgroundControlProps): import("react").JSX.Element;
|
|
@@ -61,7 +61,7 @@ function toPickerValue(background) {
|
|
|
61
61
|
function resolveStoredSolidColor(color) {
|
|
62
62
|
return color;
|
|
63
63
|
}
|
|
64
|
-
export function PhiBackgroundControl({ value, config, disabled = false, mode = "control", labels = PHI_BACKGROUND_WIDGET_DEFAULT_LABELS, colorPickerLabels = PHI_COLOR_PICKER_DEFAULT_LABELS, colorPickerPlacement, motionModes = PHI_BACKGROUND_MOTION_MODES, filters = PHI_BACKGROUND_FILTERS, imageSourceKinds = PHI_BACKGROUND_IMAGE_SOURCE_KINDS, baseKinds = PHI_BACKGROUND_BASE_KINDS, renderMediaPicker, editTransaction, onChange, }) {
|
|
64
|
+
export function PhiBackgroundControl({ value, config, disabled = false, mode = "control", labels = PHI_BACKGROUND_WIDGET_DEFAULT_LABELS, colorPickerLabels = PHI_COLOR_PICKER_DEFAULT_LABELS, colorPickerPlacement, motionModes = PHI_BACKGROUND_MOTION_MODES, filters = PHI_BACKGROUND_FILTERS, imageSourceKinds = PHI_BACKGROUND_IMAGE_SOURCE_KINDS, baseKinds = PHI_BACKGROUND_BASE_KINDS, overlay: overlayOffered = true, renderMediaPicker, editTransaction, onChange, }) {
|
|
65
65
|
const { token } = theme.useToken();
|
|
66
66
|
const colorPickerPresets = usePhiColorControlPresets({ labels: colorPickerLabels });
|
|
67
67
|
const currentValue = useMemo(() => normalizePhiBackgroundWidgetConfig(value ?? config ?? null), [value, config]);
|
|
@@ -211,6 +211,7 @@ export function PhiBackgroundControl({ value, config, disabled = false, mode = "
|
|
|
211
211
|
];
|
|
212
212
|
const filterKindCatalog = [
|
|
213
213
|
{ value: "none", label: labels.common.none },
|
|
214
|
+
{ value: "clear", label: labels.filter.clear },
|
|
214
215
|
{ value: "glass", label: labels.filter.glass },
|
|
215
216
|
{ value: "haze", label: labels.filter.haze },
|
|
216
217
|
{ value: "blur", label: labels.filter.blur },
|
|
@@ -230,7 +231,7 @@ export function PhiBackgroundControl({ value, config, disabled = false, mode = "
|
|
|
230
231
|
* A `theme` Base is the Theme's Overlay whole -- its own Overlay and pane included -- so the Background
|
|
231
232
|
* offers nothing to lay over it, and the Filter segment has nothing to offer either.
|
|
232
233
|
*/
|
|
233
|
-
const offersOverlay = currentValue.base.kind !== "theme";
|
|
234
|
+
const offersOverlay = overlayOffered && currentValue.base.kind !== "theme";
|
|
234
235
|
useEffect(() => {
|
|
235
236
|
if (currentValue.base.kind === "color") {
|
|
236
237
|
lastColorBaseRef.current = currentValue.base;
|
|
@@ -662,7 +663,14 @@ export function PhiBackgroundControl({ value, config, disabled = false, mode = "
|
|
|
662
663
|
return (_jsx(ConfigPreviewShell, { expanded: canOpenPreview, children: renderPreviewPicker() }));
|
|
663
664
|
}
|
|
664
665
|
const showPreview = mode !== "config";
|
|
665
|
-
|
|
666
|
+
/*
|
|
667
|
+
* Only what can be changed is shown. One Base kind is no choice, so its Select goes; and where the
|
|
668
|
+
* preview is drawn, a click on it opens the colour or gradient picker, so the second picker beside it
|
|
669
|
+
* would only repeat it.
|
|
670
|
+
*/
|
|
671
|
+
const soleBaseKind = baseKinds.length === 1;
|
|
672
|
+
const basePickerInPreview = soleBaseKind && showPreview;
|
|
673
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [showPreview ? (_jsx(ConfigPreviewShell, { expanded: canOpenPreview, children: renderPreviewPicker() })) : null, soleBaseKind ? null : _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingXS, width: "100%" }, children: [_jsx(Typography.Text, { children: labels.sections.base }), _jsx(PhiSelectControl, { ariaLabel: labels.sections.base, disabled: isDisabled, value: currentValue.base.kind, options: baseKindOptions, style: { width: "100%" }, onChange: (next) => {
|
|
666
674
|
if (next != null)
|
|
667
675
|
updateBaseKind(next);
|
|
668
676
|
} })] }), currentValue.base.kind === "image" ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingSM, width: "100%" }, children: [_jsxs(Flex, { align: "center", justify: "space-between", gap: token.paddingXS, wrap: false, style: { width: "100%" }, children: [_jsx(Typography.Text, { children: labels.sections.image }), currentValue.base.sourceKind === "asset" && currentValue.base.assetId != null ? (_jsx(Typography.Text, { type: "secondary", style: { fontSize: token.fontSizeSM, textAlign: "right" }, children: currentValue.base.assetId })) : null] }), _jsxs("div", { style: {
|
|
@@ -691,7 +699,7 @@ export function PhiBackgroundControl({ value, config, disabled = false, mode = "
|
|
|
691
699
|
}, children: [_jsx(Select, { value: currentValue.base.position ?? "center", disabled: isDisabled, style: { width: "100%" }, options: backgroundPositionOptions, onChange: (next) => updateImageField("position", next) }), _jsx(Select, { value: currentValue.base.size ?? "cover", disabled: isDisabled, style: { width: "100%" }, options: backgroundSizeOptions, onChange: (next) => updateImageField("size", next) }), _jsx(Select, { value: currentValue.base.repeat ?? "no-repeat", disabled: isDisabled, style: { width: "100%" }, options: backgroundRepeatOptions, onChange: (next) => updateImageField("repeat", next) })] }), backgroundMotionOptions.length > 1 ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingXS, width: "100%" }, children: [_jsx(Typography.Text, { children: labels.sections.motion }), _jsx(PhiSegmentedControl, { block: true, value: activeMotionMode, options: backgroundMotionOptions, disabled: isDisabled, onChange: updateMotionMode }), activeParallaxMotion ? (_jsxs(_Fragment, { children: [_jsx(Typography.Text, { children: labels.motion.strength }), _jsx(PhiSliderControl, { min: 0, max: 1, step: 0.05, ariaLabel: labels.motion.strength, value: activeParallaxMotion.strength ?? resolvePhiBackgroundParallaxDefaultStrength(activeParallaxMotion.travel), disabled: isDisabled, tooltipSuffix: "\u00D7", style: { width: "100%" }, onChange: (strength) => {
|
|
692
700
|
beginSliderEdit();
|
|
693
701
|
updateParallaxMotion({ strength });
|
|
694
|
-
}, onChangeComplete: commitSliderEdit }), _jsx(Typography.Text, { children: labels.motion.direction }), _jsx(PhiSegmentedControl, { block: true, value: activeParallaxMotion.direction ?? "natural", options: backgroundMotionDirectionOptions, disabled: isDisabled, onChange: (direction) => updateParallaxMotion({ direction }) }), _jsx(Typography.Text, { children: labels.motion.travel }), _jsx(PhiSegmentedControl, { block: true, value: activeParallaxMotion.travel ?? "rate", options: backgroundMotionTravelOptions, disabled: isDisabled, onChange: (travel) => updateParallaxMotion({ travel }) })] })) : null] })) : null] })) : currentValue.base.kind === "color" || currentValue.base.kind === "gradient" ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingSM, width: "100%" }, children: [currentValue.base.kind === "color" ? (_jsxs(Flex, { align: "center", justify: "space-between", gap: token.paddingSM, wrap: "wrap", children: [_jsx(Typography.Text, { children: labels.base.color }), _jsx(PhiColorControl, { ...colorPickerTransaction, value: currentValue.base.color, disabled: isDisabled, presets: colorPickerPresets, placement: colorPickerPlacement, onChange: (value) => {
|
|
702
|
+
}, onChangeComplete: commitSliderEdit }), _jsx(Typography.Text, { children: labels.motion.direction }), _jsx(PhiSegmentedControl, { block: true, value: activeParallaxMotion.direction ?? "natural", options: backgroundMotionDirectionOptions, disabled: isDisabled, onChange: (direction) => updateParallaxMotion({ direction }) }), _jsx(Typography.Text, { children: labels.motion.travel }), _jsx(PhiSegmentedControl, { block: true, value: activeParallaxMotion.travel ?? "rate", options: backgroundMotionTravelOptions, disabled: isDisabled, onChange: (travel) => updateParallaxMotion({ travel }) })] })) : null] })) : null] })) : currentValue.base.kind === "color" || currentValue.base.kind === "gradient" ? (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingSM, width: "100%" }, children: [basePickerInPreview ? null : currentValue.base.kind === "color" ? (_jsxs(Flex, { align: "center", justify: "space-between", gap: token.paddingSM, wrap: "wrap", children: [_jsx(Typography.Text, { children: labels.base.color }), _jsx(PhiColorControl, { ...colorPickerTransaction, value: currentValue.base.color, disabled: isDisabled, presets: colorPickerPresets, placement: colorPickerPlacement, onChange: (value) => {
|
|
695
703
|
if (value != null)
|
|
696
704
|
updateBaseFromCss(value);
|
|
697
705
|
} })] })) : (_jsxs(Flex, { align: "center", justify: "space-between", gap: token.paddingSM, wrap: "wrap", children: [_jsx(Typography.Text, { children: labels.base.gradient }), _jsx(PhiColorControl, { ...colorPickerTransaction, mode: "gradient", value: derivedPickerValue, disabled: isDisabled, presets: colorPickerPresets, placement: colorPickerPlacement, onChange: (value) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, type Ref } from "react";
|
|
2
2
|
import type { ButtonProps } from "antd";
|
|
3
3
|
import type { PhiControlSize } from "../../types/control";
|
|
4
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
4
5
|
import type { PhiButtonType } from "./phi-button-types";
|
|
5
6
|
export type PhiControlBadgePresentation = {
|
|
6
7
|
enabled?: boolean;
|
|
@@ -54,6 +55,17 @@ export type PhiButtonControlProps = {
|
|
|
54
55
|
* not a kind of button -- it is any kind of button, drawn for a background it does not own.
|
|
55
56
|
*/
|
|
56
57
|
ghost?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Fills the button with one of the Theme's gradient slots (theme/phi-theme-gradients.ts), whatever
|
|
60
|
+
* `type` says: it is drawn as a primary button with the run over it (`styles/gradients.css`), so the
|
|
61
|
+
* primary colour stays its edge and where the run is not drawn -- a disabled button -- its fallback.
|
|
62
|
+
*/
|
|
63
|
+
gradient?: PhiThemeGradientKey;
|
|
64
|
+
/**
|
|
65
|
+
* Draws the button as a frosted pane of the ground of the mode it stands in, for a button over a picture
|
|
66
|
+
* or a gradient -- where `ghost` keeps the outline and loses the words in a busy background.
|
|
67
|
+
*/
|
|
68
|
+
glass?: boolean;
|
|
57
69
|
disabled?: boolean;
|
|
58
70
|
/**
|
|
59
71
|
* Shown as it is and answering nothing: no hover, no press, no click -- where `disabled` greys it out.
|
|
@@ -80,4 +92,4 @@ export type PhiButtonControlProps = {
|
|
|
80
92
|
ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
|
|
81
93
|
onClick?: () => void;
|
|
82
94
|
};
|
|
83
|
-
export declare function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type, shape, danger, ghost, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }: PhiButtonControlProps): import("react").JSX.Element;
|
|
95
|
+
export declare function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type, shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }: PhiButtonControlProps): import("react").JSX.Element;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { lazy, Suspense } from "react";
|
|
4
4
|
import { Button } from "antd";
|
|
5
|
+
import { PHI_THEME_GRADIENT_CSS_VARS, } from "../../theme/phi-theme-gradients";
|
|
5
6
|
import { PhiLink } from "../navigation/phi-link";
|
|
6
7
|
import { PhiHoverText } from "./phi-hover-text";
|
|
7
8
|
/*
|
|
@@ -10,14 +11,31 @@ import { PhiHoverText } from "./phi-hover-text";
|
|
|
10
11
|
* that draws a Button.
|
|
11
12
|
*/
|
|
12
13
|
const PhiLazyBadge = lazy(() => import("antd/es/badge"));
|
|
13
|
-
|
|
14
|
+
const PHI_GLASS_BUTTON_FILTER = "blur(12px) saturate(140%)";
|
|
15
|
+
export function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type = "default", shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }) {
|
|
14
16
|
const visibleTooltip = typeof label === "string" && typeof tooltip === "string" && label === tooltip
|
|
15
17
|
? null
|
|
16
18
|
: tooltip;
|
|
17
19
|
const inert = disabled || (!readOnly && !onClick && !href && htmlType !== "submit");
|
|
18
|
-
const
|
|
20
|
+
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
21
|
+
const paintedStyle = gradientVars
|
|
22
|
+
? {
|
|
23
|
+
...style,
|
|
24
|
+
"--phi-control-gradient": `var(${gradientVars.paint})`,
|
|
25
|
+
"--phi-control-gradient-text": `var(${gradientVars.text})`,
|
|
26
|
+
}
|
|
27
|
+
: glass
|
|
28
|
+
/* Inline, as the Shell's panes frost: a `backdrop-filter` in a stylesheet does not survive the build. */
|
|
29
|
+
? { ...style, backdropFilter: PHI_GLASS_BUTTON_FILTER, WebkitBackdropFilter: PHI_GLASS_BUTTON_FILTER }
|
|
30
|
+
: style;
|
|
31
|
+
const paintedClassName = [
|
|
32
|
+
className,
|
|
33
|
+
gradientVars ? "phi-btn-gradient" : null,
|
|
34
|
+
glass && !gradientVars ? "phi-btn-glass" : null,
|
|
35
|
+
].filter(Boolean).join(" ") || undefined;
|
|
36
|
+
const button = (_jsx(Button, { ref: ref, className: paintedClassName, "aria-label": ariaLabel, "aria-pressed": ariaPressed, type: gradientVars ? "primary" : glass ? "default" : type, shape: shape, danger: danger, ghost: ghost, disabled: inert, loading: loading, htmlType: htmlType, block: block, size: size,
|
|
19
37
|
/* Not a pointer target at all, so the Button's own hover and press states never start. */
|
|
20
|
-
style: readOnly ? { ...
|
|
38
|
+
style: readOnly ? { ...paintedStyle, pointerEvents: "none" } : paintedStyle, "aria-disabled": readOnly || undefined, icon: icon, onClick: readOnly ? undefined : onClick, children: label }));
|
|
21
39
|
/*
|
|
22
40
|
* Through `PhiLink`, which is where this house decides between a client navigation and a plain
|
|
23
41
|
* anchor -- and where `target="_blank"` and `rel` are one decision rather than two props that can
|
|
@@ -71,7 +71,7 @@ export function PhiPillDropdownControl({ items, selectedKeys, open, onOpenChange
|
|
|
71
71
|
return (_jsx(PhiDropdownControl, { items: items, selectedKeys: selectedKeys, open: open, onOpenChange: onOpenChange, children: _jsxs("button", { ref: triggerRef, type: "button", className: ["phi-dropdown-control", className].filter(Boolean).join(" "), style: {
|
|
72
72
|
display: "inline-flex",
|
|
73
73
|
alignItems: "center",
|
|
74
|
-
gap:
|
|
74
|
+
gap: "var(--ant-padding-xs)",
|
|
75
75
|
fontSize: "inherit",
|
|
76
76
|
color: "inherit",
|
|
77
77
|
background: "transparent",
|
|
@@ -79,5 +79,5 @@ export function PhiPillDropdownControl({ items, selectedKeys, open, onOpenChange
|
|
|
79
79
|
padding: 0,
|
|
80
80
|
cursor: canOpen ? "pointer" : "default",
|
|
81
81
|
...style,
|
|
82
|
-
}, "aria-haspopup": canOpen ? "menu" : undefined, onMouseEnter: onIntent, onFocus: onIntent, onClick: onIntent, children: [leading, hasLabel && pill ? (_jsx("span", { className: "phi-dropdown-control__pill", children: _jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap:
|
|
82
|
+
}, "aria-haspopup": canOpen ? "menu" : undefined, onMouseEnter: onIntent, onFocus: onIntent, onClick: onIntent, children: [leading, hasLabel && pill ? (_jsx("span", { className: "phi-dropdown-control__pill", children: _jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: "var(--ant-padding-xxs)" }, children: [_jsx("span", { children: label }), chevron] }) })) : (_jsxs(_Fragment, { children: [hasLabel ? _jsx("span", { children: label }) : null, chevron] }))] }) }));
|
|
83
83
|
}
|
|
@@ -17,7 +17,8 @@ export function PhiMediaAssetTileControl({ asset, minColumnWidth, selected = fal
|
|
|
17
17
|
const { token } = usePhiConfig();
|
|
18
18
|
const compact = size === "small";
|
|
19
19
|
const assetTileIconSize = compact ? 20 : 24;
|
|
20
|
-
|
|
20
|
+
// A tile's captions are labels, not body text: the small step of the scale at either tile size.
|
|
21
|
+
const assetTileLabelFontSize = token.fontSizeSM;
|
|
21
22
|
const isSelectable = Boolean(onSelect) && !disabled;
|
|
22
23
|
const isPublic = isPhiMediaAssetPublic(asset.deliveryPolicy, asset.lifecycleStatus);
|
|
23
24
|
const isRestricted = !isPublic;
|
|
@@ -61,7 +62,7 @@ export function PhiMediaAssetTileControl({ asset, minColumnWidth, selected = fal
|
|
|
61
62
|
position: "absolute",
|
|
62
63
|
left: "0.375rem",
|
|
63
64
|
top: "0.375rem",
|
|
64
|
-
color:
|
|
65
|
+
color: token.colorTextLightSolid,
|
|
65
66
|
fontSize: assetTileLabelFontSize,
|
|
66
67
|
lineHeight: 1,
|
|
67
68
|
textShadow: "0 1px 2px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.85)",
|
|
@@ -70,7 +71,7 @@ export function PhiMediaAssetTileControl({ asset, minColumnWidth, selected = fal
|
|
|
70
71
|
position: "absolute",
|
|
71
72
|
top: "0.375rem",
|
|
72
73
|
right: "0.375rem",
|
|
73
|
-
color:
|
|
74
|
+
color: token.colorTextLightSolid,
|
|
74
75
|
fontSize: assetTileLabelFontSize,
|
|
75
76
|
lineHeight: 1,
|
|
76
77
|
textShadow: "0 1px 2px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.85)",
|
|
@@ -89,16 +90,16 @@ export function PhiMediaAssetTileControl({ asset, minColumnWidth, selected = fal
|
|
|
89
90
|
color: token.colorTextLightSolid,
|
|
90
91
|
fontSize: assetTileLabelFontSize,
|
|
91
92
|
lineHeight: 1,
|
|
92
|
-
}, children: asset.title ?? asset.originalName }) })] }), showTypeLabel || showDeleteAction ? (_jsxs(Flex, { align: "center", justify: "space-between", gap: token.paddingXS,
|
|
93
|
+
}, children: asset.title ?? asset.originalName }) })] }), showTypeLabel || showDeleteAction ? (_jsxs(Flex, { align: "center", justify: "space-between", gap: token.paddingXS, style: {
|
|
93
94
|
minHeight: token.controlHeightSM,
|
|
94
95
|
paddingInline: compact ? token.paddingXS : token.paddingSM,
|
|
95
|
-
|
|
96
|
-
}, children: [showTypeLabel ? (_jsx(Typography.Text, { ellipsis: true, style: {
|
|
96
|
+
}, children: [showTypeLabel ? (_jsx(Typography.Text, { ellipsis: { tooltip: resolvePhiMediaAssetTypeLabel(asset.kind, asset.contentType, asset.originalName) }, style: {
|
|
97
97
|
display: "block",
|
|
98
|
+
flex: "1 1 auto",
|
|
98
99
|
minWidth: 0,
|
|
99
|
-
color:
|
|
100
|
+
color: token.colorText,
|
|
100
101
|
fontSize: assetTileLabelFontSize,
|
|
101
|
-
}, children: resolvePhiMediaAssetTypeLabel(asset.kind, asset.contentType, asset.originalName) })) : _jsx("span", {}), showDeleteAction && onDelete ? (_jsx("span", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { ariaLabel: deleteLabel, icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), type: "text", size: "small", danger: true, loading: deleting, disabled: disabled, onClick: () => onDelete(asset) }) })) : null] })) : null] }));
|
|
102
|
+
}, children: resolvePhiMediaAssetTypeLabel(asset.kind, asset.contentType, asset.originalName) })) : _jsx("span", {}), showDeleteAction && onDelete ? (_jsx("span", { style: { flex: "none" }, onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { ariaLabel: deleteLabel, icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), type: "text", size: "small", danger: true, loading: deleting, disabled: disabled, onClick: () => onDelete(asset) }) })) : null] })) : null] }));
|
|
102
103
|
}
|
|
103
104
|
export function PhiMediaAssetCollectionSkeletonControl({ mode, gap, minColumnWidth, active = true, count = 10, size = "medium", }) {
|
|
104
105
|
const { token } = usePhiConfig();
|
|
@@ -120,11 +121,10 @@ export function PhiMediaAssetCollectionSkeletonControl({ mode, gap, minColumnWid
|
|
|
120
121
|
}, children: _jsx(PhiSkeletonControl, { presentation: "input", active: active, fill: true, style: { display: "block", maxWidth: "100%", borderRadius: 0 } }) }), _jsxs(Flex, { style: {
|
|
121
122
|
minHeight: token.controlHeightSM,
|
|
122
123
|
paddingInline: compact ? token.paddingXS : token.paddingSM,
|
|
123
|
-
background: "rgba(255, 255, 255, 0.78)",
|
|
124
124
|
}, align: "center", justify: "space-between", gap: token.paddingXS, children: [_jsx(PhiSkeletonControl, { presentation: "input", active: active, size: "small", style: {
|
|
125
125
|
width: "55%",
|
|
126
126
|
minWidth: 0,
|
|
127
|
-
height: token.
|
|
127
|
+
height: token.fontSizeSM * token.lineHeightSM,
|
|
128
128
|
} }), _jsx(PhiSkeletonControl, { presentation: "button", active: active, size: "small", shape: "circle", style: {
|
|
129
129
|
width: token.controlHeightSM,
|
|
130
130
|
minWidth: token.controlHeightSM,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProgressProps } from "antd";
|
|
2
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
2
3
|
/**
|
|
3
4
|
* How far along something is.
|
|
4
5
|
*
|
|
@@ -11,5 +12,12 @@ import type { ProgressProps } from "antd";
|
|
|
11
12
|
* about a percentage is specific to uploading, and the next caller that shows one of something else
|
|
12
13
|
* would have had to widen it or write a second one.
|
|
13
14
|
*/
|
|
14
|
-
export type PhiProgressControlProps = ProgressProps
|
|
15
|
-
|
|
15
|
+
export type PhiProgressControlProps = ProgressProps & {
|
|
16
|
+
/**
|
|
17
|
+
* A Theme gradient slot the bar is filled with. A line bar only: Ant Design paints a line's stroke as a
|
|
18
|
+
* CSS background, which takes the slot's custom property, while a circle draws an SVG stroke that can
|
|
19
|
+
* take a colour only -- there the bar keeps the colour it is given.
|
|
20
|
+
*/
|
|
21
|
+
gradient?: PhiThemeGradientKey;
|
|
22
|
+
};
|
|
23
|
+
export declare function PhiProgressControl({ gradient, ...props }: PhiProgressControlProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Progress } from "antd";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
5
|
+
export function PhiProgressControl({ gradient, ...props }) {
|
|
6
|
+
const lineGradient = gradient && (props.type ?? "line") === "line"
|
|
7
|
+
? `var(${PHI_THEME_GRADIENT_CSS_VARS[gradient].paint})`
|
|
8
|
+
: undefined;
|
|
9
|
+
return _jsx(Progress, { ...props, ...(lineGradient ? { strokeColor: lineGradient } : {}) });
|
|
6
10
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { CSSProperties, MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
2
3
|
export type PhiRibbonControlProps = {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
/** The band's ground; absent, the Theme's primary. Its words are the light text on any ground. */
|
|
5
6
|
color?: string;
|
|
7
|
+
/** A Theme gradient slot to fill the band with instead; its words then take the slot's text colour. */
|
|
8
|
+
gradient?: PhiThemeGradientKey;
|
|
6
9
|
/**
|
|
7
10
|
* Where the band stands: `corner` flush with the box's top and end edge, its top end corner the box's
|
|
8
11
|
* own; `edge` a small padding down the end edge. Either way it floats: nothing in the box moves for it.
|
|
@@ -35,4 +38,4 @@ export type PhiRibbonControlProps = {
|
|
|
35
38
|
* clicks, so a card that is a link stays one under its band; with one it has to take the pointer to be
|
|
36
39
|
* pointed at, and hands a click on through `onClick`.
|
|
37
40
|
*/
|
|
38
|
-
export declare function PhiRibbonControl({ children, color, placement, style, fullText, onClick }: PhiRibbonControlProps): import("react").JSX.Element;
|
|
41
|
+
export declare function PhiRibbonControl({ children, color, gradient, placement, style, fullText, onClick }: PhiRibbonControlProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PHI_COLOR, PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
|
|
3
|
+
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
3
4
|
import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
|
|
4
5
|
/**
|
|
5
6
|
* A band of words at the end edge of a box: "Popular", "New", "-20 %".
|
|
@@ -18,7 +19,8 @@ import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
|
|
|
18
19
|
* clicks, so a card that is a link stays one under its band; with one it has to take the pointer to be
|
|
19
20
|
* pointed at, and hands a click on through `onClick`.
|
|
20
21
|
*/
|
|
21
|
-
export function PhiRibbonControl({ children, color, placement = "edge", style, fullText, onClick }) {
|
|
22
|
+
export function PhiRibbonControl({ children, color, gradient, placement = "edge", style, fullText, onClick }) {
|
|
23
|
+
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
22
24
|
const radius = "var(--phi-control-radius-sm)";
|
|
23
25
|
const position = placement === "corner"
|
|
24
26
|
? {
|
|
@@ -40,8 +42,8 @@ export function PhiRibbonControl({ children, color, placement = "edge", style, f
|
|
|
40
42
|
maxWidth: "70%",
|
|
41
43
|
boxSizing: "border-box",
|
|
42
44
|
paddingInline: PHI_SPACE.sm,
|
|
43
|
-
background: color ?? PHI_COLOR.primary,
|
|
44
|
-
color: PHI_COLOR.textLightSolid,
|
|
45
|
+
background: gradientVars ? `var(${gradientVars.paint})` : color ?? PHI_COLOR.primary,
|
|
46
|
+
color: gradientVars ? `var(${gradientVars.text})` : PHI_COLOR.textLightSolid,
|
|
45
47
|
fontSize: PHI_FONT_SIZE.sm,
|
|
46
48
|
fontWeight: 600,
|
|
47
49
|
lineHeight: 2,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
2
3
|
export type PhiRibbonWrapControlProps = {
|
|
3
4
|
/** The box the ribbon hangs on. */
|
|
4
5
|
children: ReactNode;
|
|
@@ -6,6 +7,11 @@ export type PhiRibbonWrapControlProps = {
|
|
|
6
7
|
text: ReactNode;
|
|
7
8
|
/** The ribbon's ground; absent, the Theme's primary. The fold under it is a darker shade of it. */
|
|
8
9
|
color?: string;
|
|
10
|
+
/**
|
|
11
|
+
* A Theme gradient slot to fill the ribbon with. The fold under it keeps one colour -- `color`, else the
|
|
12
|
+
* Theme's primary -- because Ant Design draws it as a border, which takes a colour and no run.
|
|
13
|
+
*/
|
|
14
|
+
gradient?: PhiThemeGradientKey;
|
|
9
15
|
/** Takes the pointer, for an editor that writes in the ribbon; otherwise clicks pass to the box. */
|
|
10
16
|
interactive?: boolean;
|
|
11
17
|
className?: string;
|
|
@@ -23,4 +29,4 @@ export type PhiRibbonWrapControlProps = {
|
|
|
23
29
|
* Imported from its own module, not from `antd`'s Badge: the Badge brings its scroll-number motion along,
|
|
24
30
|
* which a ribbon never uses.
|
|
25
31
|
*/
|
|
26
|
-
export declare function PhiRibbonWrapControl({ children, text, color, interactive, className }: PhiRibbonWrapControlProps): import("react").JSX.Element;
|
|
32
|
+
export declare function PhiRibbonWrapControl({ children, text, color, gradient, interactive, className }: PhiRibbonWrapControlProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import Ribbon from "antd/es/badge/Ribbon";
|
|
4
|
+
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
4
5
|
/**
|
|
5
6
|
* A ribbon that hangs over a box's end edge, with a fold behind it: Ant Design's `Badge.Ribbon`.
|
|
6
7
|
*
|
|
@@ -14,8 +15,13 @@ import Ribbon from "antd/es/badge/Ribbon";
|
|
|
14
15
|
* Imported from its own module, not from `antd`'s Badge: the Badge brings its scroll-number motion along,
|
|
15
16
|
* which a ribbon never uses.
|
|
16
17
|
*/
|
|
17
|
-
export function PhiRibbonWrapControl({ children, text, color, interactive = false, className }) {
|
|
18
|
-
const
|
|
18
|
+
export function PhiRibbonWrapControl({ children, text, color, gradient, interactive = false, className }) {
|
|
19
|
+
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
20
|
+
const indicator = {
|
|
21
|
+
zIndex: 4,
|
|
22
|
+
...(interactive ? {} : { pointerEvents: "none" }),
|
|
23
|
+
...(gradientVars ? { background: `var(${gradientVars.paint})`, color: `var(${gradientVars.text})` } : {}),
|
|
24
|
+
};
|
|
19
25
|
/*
|
|
20
26
|
* An editor's field in the ribbon measures itself against the ribbon, which is as wide as its words:
|
|
21
27
|
* empty, both were nothing, and only the fold showed. Room for a word, as the inner band keeps it.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PhiControlSize } from "../../types/control";
|
|
2
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
2
3
|
import type { PhiControlOption } from "./phi-control-options";
|
|
3
4
|
export type PhiSegmentedControlProps<TValue extends string | number = string> = {
|
|
4
5
|
/**
|
|
@@ -12,8 +13,10 @@ export type PhiSegmentedControlProps<TValue extends string | number = string> =
|
|
|
12
13
|
readOnly?: boolean;
|
|
13
14
|
block?: boolean;
|
|
14
15
|
size?: PhiControlSize;
|
|
16
|
+
/** A Theme gradient slot the selected segment is filled with; its words take the slot's text colour. */
|
|
17
|
+
gradient?: PhiThemeGradientKey;
|
|
15
18
|
onFocus?: () => void;
|
|
16
19
|
onBlur?: () => void;
|
|
17
20
|
onChange?: (value: TValue) => void;
|
|
18
21
|
};
|
|
19
|
-
export declare function PhiSegmentedControl<TValue extends string | number = string>({ value, label, options, disabled, readOnly, block, size, onFocus, onBlur, onChange, }: PhiSegmentedControlProps<TValue>): import("react").JSX.Element;
|
|
22
|
+
export declare function PhiSegmentedControl<TValue extends string | number = string>({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }: PhiSegmentedControlProps<TValue>): import("react").JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Segmented } from "antd";
|
|
4
|
+
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
4
5
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
5
|
-
export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, onFocus, onBlur, onChange, }) {
|
|
6
|
+
export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }) {
|
|
6
7
|
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
8
|
+
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
7
9
|
const control = (_jsx(Segmented, { "aria-labelledby": labelledBy, block: block, value: value, disabled: disabled || readOnly || !onChange, options: options.map((option) => ({
|
|
8
10
|
value: option.value,
|
|
9
11
|
label: option.label,
|
|
@@ -15,6 +17,15 @@ export function PhiSegmentedControl({ value, label, options, disabled, readOnly,
|
|
|
15
17
|
*/
|
|
16
18
|
title: "",
|
|
17
19
|
tooltip: option.description || undefined,
|
|
18
|
-
})), size: size, onChange: (nextValue) => onChange?.(nextValue), onFocus: onFocus, onBlur: onBlur,
|
|
20
|
+
})), size: size, onChange: (nextValue) => onChange?.(nextValue), onFocus: onFocus, onBlur: onBlur, className: gradientVars ? "phi-segmented-gradient" : undefined, style: {
|
|
21
|
+
minWidth: 0,
|
|
22
|
+
width: block ? "100%" : undefined,
|
|
23
|
+
...(gradientVars
|
|
24
|
+
? {
|
|
25
|
+
"--phi-control-gradient": `var(${gradientVars.paint})`,
|
|
26
|
+
"--phi-control-gradient-text": `var(${gradientVars.text})`,
|
|
27
|
+
}
|
|
28
|
+
: {}),
|
|
29
|
+
} }));
|
|
19
30
|
return _jsx(PhiLabeledControl, { label: label, labelId: labelId, fill: block, children: control });
|
|
20
31
|
}
|
|
@@ -15,6 +15,8 @@ export type PhiSurfaceControlLabels = {
|
|
|
15
15
|
shadow: string;
|
|
16
16
|
tone: string;
|
|
17
17
|
tones: Record<PhiSurfaceTone, string>;
|
|
18
|
+
/** The switch for a ground of its own in dark mode; the two grounds are then named by `tones`. */
|
|
19
|
+
backgroundPerMode?: string;
|
|
18
20
|
};
|
|
19
21
|
export type PhiSurfaceControlProps = {
|
|
20
22
|
value?: PhiSurface | null;
|
|
@@ -5,6 +5,7 @@ import { PhiBackgroundControl } from "./phi-background-control";
|
|
|
5
5
|
import { PhiBorderControl } from "./phi-border-control";
|
|
6
6
|
import { PhiFlexControl } from "./phi-flex-control";
|
|
7
7
|
import { PhiSegmentedControl } from "./phi-segmented-control";
|
|
8
|
+
import { PhiSwitchControl } from "./phi-switch-control";
|
|
8
9
|
import { PhiShadowControl } from "./phi-shadow-control";
|
|
9
10
|
import { PhiDividerControl } from "./phi-divider-control";
|
|
10
11
|
import { PHI_CMS_BORDER_SOURCES, resolvePhiCmsBorderSource, } from "../../types/cms-border-source";
|
|
@@ -23,6 +24,7 @@ const PHI_SURFACE_CONTROL_DEFAULT_LABELS = {
|
|
|
23
24
|
dark: "Dark",
|
|
24
25
|
inverse: "Inverse",
|
|
25
26
|
},
|
|
27
|
+
backgroundPerMode: "Own background in dark mode",
|
|
26
28
|
};
|
|
27
29
|
/** Read only where the Border labels have not arrived; the words themselves live in their label set. */
|
|
28
30
|
const PHI_BORDER_SOURCE_FALLBACK_LABELS = {
|
|
@@ -71,6 +73,10 @@ export function PhiSurfaceControl({ value, onChange, disabled = false, labels =
|
|
|
71
73
|
* next selected node) drops it, one this Control wrote keeps it.
|
|
72
74
|
*/
|
|
73
75
|
const [customChosen, setCustomChosen] = useState(false);
|
|
76
|
+
/* Which of the two grounds is open, where the Surface has one per mode. */
|
|
77
|
+
const [backgroundMode, setBackgroundMode] = useState("light");
|
|
78
|
+
const perMode = current.backgroundDark != null;
|
|
79
|
+
const editedMode = perMode ? backgroundMode : "light";
|
|
74
80
|
const [seenValue, setSeenValue] = useState(value);
|
|
75
81
|
const [writtenValue, setWrittenValue] = useState(undefined);
|
|
76
82
|
if (seenValue !== value) {
|
|
@@ -102,7 +108,16 @@ export function PhiSurfaceControl({ value, onChange, disabled = false, labels =
|
|
|
102
108
|
{ value: "none", label: labels.styles.none },
|
|
103
109
|
...PHI_SURFACE_PRESET_IDS.map((id) => ({ value: id, label: labels.styles[id] })),
|
|
104
110
|
{ value: "custom", label: labels.styles.custom },
|
|
105
|
-
], block: true, disabled: isDisabled, onChange: chooseStyle })] }), tone ? (_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.tone }), _jsx(PhiSegmentedControl, { value: current.tone ?? "inherit", options: PHI_SURFACE_TONES.map((entry) => ({ value: entry, label: labels.tones[entry] })), block: true, disabled: isDisabled, onChange: (next) => patch({ tone: next === "inherit" ? undefined : next }) })] })) : null, style === "custom" ? (_jsxs(_Fragment, { children: [_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.background }), _jsx(
|
|
111
|
+
], block: true, disabled: isDisabled, onChange: chooseStyle })] }), tone ? (_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.tone }), _jsx(PhiSegmentedControl, { value: current.tone ?? "inherit", options: PHI_SURFACE_TONES.map((entry) => ({ value: entry, label: labels.tones[entry] })), block: true, disabled: isDisabled, onChange: (next) => patch({ tone: next === "inherit" ? undefined : next }) })] })) : null, style === "custom" ? (_jsxs(_Fragment, { children: [_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.background }), _jsx(PhiSwitchControl, { label: labels.backgroundPerMode ?? PHI_SURFACE_CONTROL_DEFAULT_LABELS.backgroundPerMode, checked: perMode, disabled: isDisabled, onChange: (checked) => {
|
|
112
|
+
// Switched on, the dark ground starts as a copy of the light one, to be changed from there.
|
|
113
|
+
setBackgroundMode(checked ? "dark" : "light");
|
|
114
|
+
patch({ backgroundDark: checked ? (current.background ?? { base: { kind: "none" } }) : undefined });
|
|
115
|
+
} }), perMode ? (_jsx(PhiSegmentedControl, { value: editedMode, options: [
|
|
116
|
+
{ value: "light", label: labels.tones.light },
|
|
117
|
+
{ value: "dark", label: labels.tones.dark },
|
|
118
|
+
], block: true, disabled: isDisabled, onChange: setBackgroundMode })) : null, _jsx(PhiBackgroundControl, { mode: "control", disabled: isDisabled, value: (editedMode === "dark" ? current.backgroundDark : current.background) ?? null, onChange: (next) => patch(editedMode === "dark"
|
|
119
|
+
? { backgroundDark: next ?? { base: { kind: "none" } } }
|
|
120
|
+
: { background: next }), labels: backgroundLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: colorPickerPlacement, filters: backgroundFilters, renderMediaPicker: renderMediaPicker }, editedMode)] }), _jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.border }), _jsx(PhiSegmentedControl, { value: borderSource, options: PHI_CMS_BORDER_SOURCES.map((source) => ({
|
|
106
121
|
value: source,
|
|
107
122
|
label: borderLabels?.sources?.[source] ?? PHI_BORDER_SOURCE_FALLBACK_LABELS[source],
|
|
108
123
|
})), block: true, disabled: isDisabled, onChange: (nextSource) => patch({ borderSource: nextSource }) }), borderSource === "custom" ? (_jsx(PhiBorderControl, { mode: "control", disabled: isDisabled, value: current.border ?? null, onChange: (border) => patch({ border, borderSource: "custom" }), labels: borderLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: colorPickerPlacement })) : null] }), _jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.shadow }), _jsx(PhiShadowControl, { mode: "control", disabled: isDisabled, value: current.shadow ?? null, onChange: (shadow) => patch({ shadow }) })] })] })) : null] }));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { PhiControlSize } from "../../types/control";
|
|
3
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
3
4
|
export type PhiSwitchControlProps = {
|
|
4
5
|
/** The DOM id of the input, so a `<label for>` outside the control can name it. */
|
|
5
6
|
id?: string;
|
|
@@ -13,6 +14,8 @@ export type PhiSwitchControlProps = {
|
|
|
13
14
|
/** What the switch reads while off. */
|
|
14
15
|
uncheckedLabel?: ReactNode;
|
|
15
16
|
size?: Exclude<PhiControlSize, "large">;
|
|
17
|
+
/** A Theme gradient slot the switch is filled with while on, instead of the primary colour. */
|
|
18
|
+
gradient?: PhiThemeGradientKey;
|
|
16
19
|
onChange?: (checked: boolean) => void;
|
|
17
20
|
};
|
|
18
|
-
export declare function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, onChange, }: PhiSwitchControlProps): import("react").JSX.Element;
|
|
21
|
+
export declare function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }: PhiSwitchControlProps): import("react").JSX.Element;
|