@phis/ui 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/controls/phi-address-control.d.ts +23 -0
- package/components/controls/phi-address-control.js +43 -0
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-country-select-control.d.ts +22 -0
- package/components/controls/phi-country-select-control.js +16 -0
- package/components/controls/phi-dialog-control.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.js +5 -3
- package/components/controls/phi-drawer-control.d.ts +7 -5
- package/components/controls/phi-float-button-control.d.ts +8 -1
- package/components/controls/phi-float-button-control.js +19 -3
- package/components/controls/phi-form-control.js +64 -9
- package/components/controls/phi-modal-control-adapter.d.ts +1 -1
- package/components/controls/phi-modal-control-adapter.js +14 -37
- package/components/controls/phi-modal-control.d.ts +5 -5
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-overlay-control-contract.d.ts +52 -17
- package/components/controls/phi-overlay-control-contract.js +55 -30
- package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
- package/components/controls/phi-reveal-once-dialog-control.js +52 -0
- package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
- package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
- package/components/forms/extended-form-field-controls.d.ts +1 -1
- package/components/forms/extended-form-field-controls.js +23 -7
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-option-flags.d.ts +20 -0
- package/components/forms/form-option-flags.js +38 -0
- package/components/forms/form-provider-contract.d.ts +28 -0
- package/components/forms/form-provider-contract.js +45 -2
- package/components/forms/form-provider-registry.d.ts +11 -1
- package/components/forms/money-field-currency-key.d.ts +6 -0
- package/components/forms/money-field-currency-key.js +14 -0
- package/components/forms/money-field.d.ts +26 -3
- package/components/forms/money-field.js +54 -4
- package/components/forms/shared-form-provider-registry.js +13 -0
- package/components/forms/structured-field-labels.d.ts +24 -0
- package/components/forms/structured-field-labels.js +43 -0
- package/components/forms/structured-form-field-controls.d.ts +12 -0
- package/components/forms/structured-form-field-controls.js +65 -0
- package/components/overlays/phi-overlay-container-client.js +2 -2
- package/components/regions/phi-cms-region-shell.js +2 -2
- package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
- package/components/regions/presets/navigation-redirect.d.ts +4 -1
- package/components/regions/presets/navigation-redirect.js +6 -3
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/root/phi-root-theme-resolver.js +3 -0
- package/components/shell/phi-antd-icon.d.ts +1 -8
- package/components/shell/phi-antd-icon.js +1 -227
- package/components/shell/phi-icon-names.d.ts +19 -0
- package/components/shell/phi-icon-names.js +264 -0
- package/components/shell/phi-icon.d.ts +2 -11
- package/components/shell/phi-icon.js +4 -32
- package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
- package/components/widgets/client/shared/phi-command-buttons.js +10 -4
- package/components/widgets/client/shared/phi-rendered-value.js +32 -6
- package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
- package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
- package/components/widgets/config/background.d.ts +3 -2
- package/components/widgets/config/choice-shared.d.ts +10 -1
- package/components/widgets/config/choice-shared.js +8 -2
- package/components/widgets/label-sets/admin-locales.js +1 -1
- package/components/widgets/label-sets/admin-users.d.ts +2 -5
- package/components/widgets/label-sets/admin-users.js +4 -10
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -0
- package/components/widgets/label-sets/profile.js +28 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/effects.d.ts +3 -2
- package/components/widgets/label-types/effects.js +1 -2
- package/components/widgets/label-types/search-results.d.ts +2 -2
- package/components/widgets/label-types/search-results.js +1 -2
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/components/widgets/server/builder-chrome.d.ts +4 -1
- package/components/widgets/server/builder-chrome.js +2 -2
- package/components/widgets/shared/markdown-body-client.d.ts +26 -0
- package/components/widgets/shared/markdown-body-client.js +31 -1
- package/components/widgets/shared/markdown-render.d.ts +10 -2
- package/components/widgets/shared/markdown-render.js +35 -13
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +25 -0
- package/constants/customer-file.js +26 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +12 -0
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -0
- package/gateway/form-handler-request.d.ts +22 -0
- package/gateway/form-handler-request.js +40 -0
- package/gateway/label-set.d.ts +15 -2
- package/gateway/label-set.js +60 -22
- package/gateway/site-form-route.js +11 -2
- package/helpers/address-field.d.ts +43 -0
- package/helpers/address-field.js +68 -0
- package/helpers/cms-dialog.d.ts +5 -20
- package/helpers/cms-dialog.js +8 -13
- package/helpers/cms-page-catalog.d.ts +10 -0
- package/helpers/cms-page-catalog.js +19 -0
- package/helpers/cms-preset-nodes.d.ts +4 -4
- package/helpers/cms-preset-nodes.js +1 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/country-names.d.ts +12 -0
- package/helpers/country-names.js +14 -0
- package/helpers/money-amount.d.ts +7 -0
- package/helpers/money-amount.js +15 -0
- package/helpers/phi-metadata.d.ts +33 -1
- package/helpers/phi-metadata.js +62 -1
- package/helpers/preset-table-check.d.ts +34 -0
- package/helpers/preset-table-check.js +124 -0
- package/helpers/preset-text-source-check.d.ts +4 -1
- package/helpers/preset-text-source-check.js +6 -1
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +30 -5
- package/helpers/public-route-claims.d.ts +9 -1
- package/helpers/public-route-claims.js +23 -3
- package/helpers/record-fields.d.ts +1 -5
- package/helpers/record-fields.js +15 -6
- package/helpers/route-address-check.d.ts +22 -2
- package/helpers/route-address-check.js +29 -8
- package/helpers/site-address-row.d.ts +23 -0
- package/helpers/site-address-row.js +36 -0
- package/helpers/surface-style.d.ts +8 -1
- package/helpers/surface-style.js +12 -2
- package/helpers/thread-inbox-row.d.ts +20 -0
- package/helpers/thread-inbox-row.js +26 -0
- package/helpers/translation-format.d.ts +26 -0
- package/helpers/translation-format.js +31 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +2 -2
- package/module-records.js +1 -0
- package/next/area-route.js +34 -1
- package/next/root-route.js +4 -5
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
- package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
- package/plugins/runtime-modules/accounting/data-providers.js +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
- package/plugins/runtime-modules/accounting/ids.js +23 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
- package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/app/client-data-providers.js +9 -0
- package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
- package/plugins/runtime-modules/app/data-providers.js +80 -0
- package/plugins/runtime-modules/app/definition.d.ts +131 -0
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +46 -1
- package/plugins/runtime-modules/app/forms.js +195 -1
- package/plugins/runtime-modules/app/ids.d.ts +7 -0
- package/plugins/runtime-modules/app/ids.js +8 -0
- package/plugins/runtime-modules/app/module.d.ts +131 -0
- package/plugins/runtime-modules/app/presets.js +3 -6
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
- package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.d.ts +3 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +4 -7
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
- package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
- package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
- package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
- package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
- package/plugins/runtime-modules/blog/presets.d.ts +4 -0
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
- package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
- package/plugins/runtime-modules/builder/controller/client.d.ts +5 -5
- package/plugins/runtime-modules/builder/controller/client.js +2 -1
- package/plugins/runtime-modules/builder/controller/definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/definition.js +7 -0
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +72 -18
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +8 -10
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +10 -0
- package/plugins/runtime-modules/builder/developer-workspace-store.js +35 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +6 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
- package/plugins/runtime-modules/builder/persistence.d.ts +4 -1
- package/plugins/runtime-modules/builder/persistence.js +14 -3
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
- package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
- package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
- package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
- package/plugins/runtime-modules/client-manifests/app.js +3 -0
- package/plugins/runtime-modules/client-manifests/builder.js +10 -0
- package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
- package/plugins/runtime-modules/contracts.js +31 -1
- package/plugins/runtime-modules/core/definition.d.ts +28 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +28 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
- package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
- package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
- package/plugins/runtime-modules/core/widgets/spacer/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
- package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
- package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
- package/plugins/runtime-modules/descriptor-compiler.js +44 -16
- package/plugins/runtime-modules/editor/presets.d.ts +4 -0
- package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/localization/presets.d.ts +4 -0
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
- package/plugins/runtime-modules/news/presets.d.ts +4 -0
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +46 -39
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
- package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/client.js +50 -46
- package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/table.js +16 -5
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/definition.js +1 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
- package/plugins/runtime-modules/threads/data-providers.js +85 -0
- package/plugins/runtime-modules/threads/definition.d.ts +115 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +3 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
- package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
- package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
- package/plugins/runtime-modules/user-management/data-providers.js +101 -3
- package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
- package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
- package/plugins/runtime-modules/user-management/ids.js +9 -0
- package/plugins/runtime-modules/user-management/presets.js +17 -1
- package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
- package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
- package/server-helpers/cms-page-record.d.ts +9 -1
- package/server-helpers/cms-page-record.js +11 -1
- package/server-helpers/cms-request.js +8 -5
- package/server-helpers/link-preview-image.d.ts +30 -0
- package/server-helpers/link-preview-image.js +57 -0
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/builder-scaffold.css +7 -1
- package/styles/layout-authoring-scaffold.css +27 -0
- package/styles/shell.css +30 -6
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-tokens.d.ts +2 -1
- package/theme/phi-theme-tokens.js +2 -0
- package/types/cms-module-descriptors.d.ts +14 -0
- package/types/cms-overlay.d.ts +13 -6
- package/types/cms-overlay.js +6 -22
- package/types/cms-plugins.d.ts +14 -2
- package/types/cms.d.ts +10 -0
- package/types/core-widget-placements.d.ts +3 -3
- package/types/link-preview.d.ts +19 -0
- package/types/link-preview.js +19 -0
- package/types/record-provider.d.ts +22 -1
- package/types/site-theme.d.ts +27 -0
- package/types/table-embed.d.ts +48 -0
- package/types/table-embed.js +1 -0
- package/types/table-widget.d.ts +14 -0
- package/types/widget-runtime.d.ts +3 -0
- package/types.d.ts +1 -0
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PhisSiteAddressInput } from "@phis/contracts/users";
|
|
2
|
+
import { type PhiAddressPart } from "../../helpers/address-field";
|
|
3
|
+
export type PhiAddressControlLabels = Record<PhiAddressPart, string>;
|
|
4
|
+
export type PhiAddressControlProps = {
|
|
5
|
+
/** The id of the first part's input, so a label outside the control can name it. */
|
|
6
|
+
id?: string;
|
|
7
|
+
value: PhisSiteAddressInput;
|
|
8
|
+
labels: PhiAddressControlLabels;
|
|
9
|
+
/** A sentence per part that is wrong, shown under it. */
|
|
10
|
+
errors?: Partial<Record<PhiAddressPart, string>>;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
onChange?: (next: PhisSiteAddressInput) => void;
|
|
14
|
+
/** A part was left, so whoever validates may now say what is wrong with it. */
|
|
15
|
+
onPartBlur?: (part: PhiAddressPart) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One postal address in the shape Core writes (`PhisSiteAddressInput`): name, company, two street lines,
|
|
19
|
+
* postal code and city, region and the country -- chosen with `PhiCountrySelectControl`. Each part has its
|
|
20
|
+
* label above it and its sentence under it when it is wrong; required parts carry the marker. The value is
|
|
21
|
+
* the whole address, an empty optional part `null`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function PhiAddressControl({ id, value, labels, errors, disabled, readOnly, onChange, onPartBlur, }: PhiAddressControlProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { PHI_ADDRESS_PART_MAX_LENGTHS, PHI_ADDRESS_REQUIRED_PARTS, writePhiAddressFieldPart, } from "../../helpers/address-field";
|
|
5
|
+
import { usePhiConfig } from "../root/phi-config-provider";
|
|
6
|
+
import { PhiCountrySelectControl } from "./phi-country-select-control";
|
|
7
|
+
import { PhiTextControl } from "./phi-text-control";
|
|
8
|
+
const AUTOCOMPLETE = {
|
|
9
|
+
name: "name",
|
|
10
|
+
companyName: "organization",
|
|
11
|
+
line1: "address-line1",
|
|
12
|
+
line2: "address-line2",
|
|
13
|
+
postalCode: "postal-code",
|
|
14
|
+
city: "address-level2",
|
|
15
|
+
region: "address-level1",
|
|
16
|
+
};
|
|
17
|
+
/* Two parts share a row where they are short: postal code beside city, region beside country. */
|
|
18
|
+
const ROWS = [
|
|
19
|
+
["name"],
|
|
20
|
+
["companyName"],
|
|
21
|
+
["line1"],
|
|
22
|
+
["line2"],
|
|
23
|
+
["postalCode", "city"],
|
|
24
|
+
["region", "country"],
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* One postal address in the shape Core writes (`PhisSiteAddressInput`): name, company, two street lines,
|
|
28
|
+
* postal code and city, region and the country -- chosen with `PhiCountrySelectControl`. Each part has its
|
|
29
|
+
* label above it and its sentence under it when it is wrong; required parts carry the marker. The value is
|
|
30
|
+
* the whole address, an empty optional part `null`.
|
|
31
|
+
*/
|
|
32
|
+
export function PhiAddressControl({ id, value, labels, errors, disabled, readOnly, onChange, onPartBlur, }) {
|
|
33
|
+
const { token } = usePhiConfig();
|
|
34
|
+
const ownId = useId();
|
|
35
|
+
const partId = (part) => (part === "name" && id ? id : `${ownId}-${part}`);
|
|
36
|
+
const write = (part, next) => onChange?.(writePhiAddressFieldPart(value, part, next));
|
|
37
|
+
const renderPart = (part) => {
|
|
38
|
+
const required = PHI_ADDRESS_REQUIRED_PARTS.includes(part);
|
|
39
|
+
const error = errors?.[part];
|
|
40
|
+
return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingXXS, minWidth: 0 }, children: [_jsxs("label", { htmlFor: partId(part), style: { color: token.colorTextHeading, fontSize: token.fontSizeSM }, children: [required ? _jsx("span", { "aria-hidden": true, style: { color: token.colorError, marginInlineEnd: "0.25em" }, children: "*" }) : null, labels[part]] }), part === "country" ? (_jsx(PhiCountrySelectControl, { id: partId(part), value: value.country, disabled: disabled, readOnly: readOnly, onBlur: () => onPartBlur?.(part), onChange: (next) => write(part, next) })) : (_jsx(PhiTextControl, { id: partId(part), value: value[part] ?? "", disabled: disabled, readOnly: readOnly, autoComplete: AUTOCOMPLETE[part], maxLength: PHI_ADDRESS_PART_MAX_LENGTHS[part], onBlur: () => onPartBlur?.(part), onChange: (next) => write(part, next) })), error ? (_jsx("span", { role: "alert", style: { color: token.colorError, fontSize: token.fontSizeSM }, children: error })) : null] }, part));
|
|
41
|
+
};
|
|
42
|
+
return (_jsx("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingSM, width: "100%", minWidth: 0 }, children: ROWS.map((row) => row.length === 1 ? renderPart(row[0]) : (_jsx("div", { style: { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(10rem, 1fr))", gap: token.paddingSM }, children: row.map(renderPart) }, row.join("-")))) }));
|
|
43
|
+
}
|
|
@@ -20,6 +20,8 @@ export type PhiColorControlProps = PhiPickerTransactionCallbacks<string | null>
|
|
|
20
20
|
defaultValue?: string;
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
allowClear?: boolean;
|
|
23
|
+
/** Offer no transparency: the alpha slider is gone and a picked colour with alpha is made opaque. */
|
|
24
|
+
disabledAlpha?: boolean;
|
|
23
25
|
mode?: PhiColorPickerMode;
|
|
24
26
|
open?: boolean;
|
|
25
27
|
showText?: boolean;
|
|
@@ -33,4 +35,4 @@ export type PhiColorControlProps = PhiPickerTransactionCallbacks<string | null>
|
|
|
33
35
|
renderPanel?: (panel: ReactNode) => ReactNode;
|
|
34
36
|
onClear?: () => void;
|
|
35
37
|
};
|
|
36
|
-
export declare function PhiColorControl({ value, defaultValue, disabled, allowClear, mode, open, showText, trigger, placement, size, children, presets, getPopupContainer, popupClassName, renderPanel, onChange, onCommit, onDiscard, onOpenChange, onClear, }: PhiColorControlProps): import("react").JSX.Element;
|
|
38
|
+
export declare function PhiColorControl({ value, defaultValue, disabled, allowClear, disabledAlpha, mode, open, showText, trigger, placement, size, children, presets, getPopupContainer, popupClassName, renderPanel, onChange, onCommit, onDiscard, onOpenChange, onClear, }: PhiColorControlProps): import("react").JSX.Element;
|
|
@@ -56,7 +56,7 @@ function resolveCssValue(nextValue, fallbackCss) {
|
|
|
56
56
|
function resolveAntdMode(mode) {
|
|
57
57
|
return mode === "both" ? ["single", "gradient"] : mode;
|
|
58
58
|
}
|
|
59
|
-
export function PhiColorControl({ value = null, defaultValue = "#f0f0f0", disabled, allowClear, mode = "single", open, showText, trigger, placement = "auto", size, children, presets = [], getPopupContainer, popupClassName, renderPanel, onChange, onCommit, onDiscard, onOpenChange, onClear, }) {
|
|
59
|
+
export function PhiColorControl({ value = null, defaultValue = "#f0f0f0", disabled, allowClear, disabledAlpha, mode = "single", open, showText, trigger, placement = "auto", size, children, presets = [], getPopupContainer, popupClassName, renderPanel, onChange, onCommit, onDiscard, onOpenChange, onClear, }) {
|
|
60
60
|
const { token } = theme.useToken();
|
|
61
61
|
const picker = usePhiImmediatePicker({
|
|
62
62
|
value,
|
|
@@ -93,7 +93,7 @@ export function PhiColorControl({ value = null, defaultValue = "#f0f0f0", disabl
|
|
|
93
93
|
colors: [...preset.colors],
|
|
94
94
|
defaultOpen: preset.defaultOpen,
|
|
95
95
|
}));
|
|
96
|
-
return (_jsx(ColorPicker, { mode: resolveAntdMode(mode), value: resolveAntdColorValue(resolvePhiColorReferences(picker.value, references), defaultValue), open: picker.open, disabled: disabled, allowClear: allowClear, trigger: trigger, placement: placement === "auto" ? undefined : placement, size: size, showText: resolvedShowText, presets: antdPresets, getPopupContainer: getPopupContainer, classNames: { popup: { root: joinPhiClassNames("phi-color-widget-popup", popupClassName) } }, styles: {
|
|
96
|
+
return (_jsx(ColorPicker, { mode: resolveAntdMode(mode), value: resolveAntdColorValue(resolvePhiColorReferences(picker.value, references), defaultValue), open: picker.open, disabled: disabled, allowClear: allowClear, disabledAlpha: disabledAlpha, trigger: trigger, placement: placement === "auto" ? undefined : placement, size: size, showText: resolvedShowText, presets: antdPresets, getPopupContainer: getPopupContainer, classNames: { popup: { root: joinPhiClassNames("phi-color-widget-popup", popupClassName) } }, styles: {
|
|
97
97
|
root: {
|
|
98
98
|
display: "inline-flex",
|
|
99
99
|
alignItems: "center",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
import type { PhiControlSize } from "../../types/control";
|
|
3
|
+
export type PhiCountrySelectControlProps = {
|
|
4
|
+
id?: string;
|
|
5
|
+
/** An ISO 3166-1 alpha-2 code, uppercase; anything else shows as no choice. */
|
|
6
|
+
value?: string | null;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
allowClear?: boolean;
|
|
12
|
+
size?: PhiControlSize;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
onChange: (code: string | null) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A country chosen from ISO 3166-1, by name in the page's language: the Select Control with every code
|
|
19
|
+
* of `PHI_ISO_3166_ALPHA2_CODES` named through `Intl.DisplayNames` and sorted as the language sorts,
|
|
20
|
+
* searchable by name and by code. What it holds is the code.
|
|
21
|
+
*/
|
|
22
|
+
export declare function PhiCountrySelectControl({ id, value, placeholder, ariaLabel, disabled, readOnly, allowClear, size, style, onBlur, onChange, }: PhiCountrySelectControlProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { listPhiCountryOptions } from "../../helpers/country-names";
|
|
5
|
+
import { usePhiIntlLocale } from "../root/phi-intl-locale";
|
|
6
|
+
import { PhiSelectControl } from "./phi-select-control";
|
|
7
|
+
/**
|
|
8
|
+
* A country chosen from ISO 3166-1, by name in the page's language: the Select Control with every code
|
|
9
|
+
* of `PHI_ISO_3166_ALPHA2_CODES` named through `Intl.DisplayNames` and sorted as the language sorts,
|
|
10
|
+
* searchable by name and by code. What it holds is the code.
|
|
11
|
+
*/
|
|
12
|
+
export function PhiCountrySelectControl({ id, value, placeholder, ariaLabel, disabled, readOnly, allowClear, size, style, onBlur, onChange, }) {
|
|
13
|
+
const locale = usePhiIntlLocale();
|
|
14
|
+
const options = useMemo(() => listPhiCountryOptions(locale), [locale]);
|
|
15
|
+
return (_jsx(PhiSelectControl, { id: id, value: value && options.some((option) => option.value === value) ? value : undefined, placeholder: placeholder, ariaLabel: ariaLabel, disabled: disabled, readOnly: readOnly, allowClear: allowClear, size: size, options: options, style: style ?? { width: "100%" }, onBlur: onBlur, onChange: (next) => onChange(typeof next === "string" && next ? next : null) }));
|
|
16
|
+
}
|
|
@@ -74,7 +74,7 @@ export type PhiDialogControlProps = {
|
|
|
74
74
|
presentation?: "modal" | "drawer";
|
|
75
75
|
/** The edge a Drawer comes from. */
|
|
76
76
|
placement?: PhiDrawerControlProps["placement"];
|
|
77
|
-
/** A Drawer's width
|
|
77
|
+
/** A Drawer's size, a block's pair: its `width`, or its `height` from the top or bottom. */
|
|
78
78
|
size?: PhiDrawerControlProps["size"];
|
|
79
79
|
onDismiss?: (source: PhiOverlayCloseSource) => void;
|
|
80
80
|
afterOpenChange?: (open: boolean) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PhiDrawerControlProps } from "./phi-drawer-control";
|
|
2
|
-
export declare function PhiDrawerControlAdapter({ open, title, header, body, footer, closable, keyboard, mask, mountPolicy, placement, size, maxSize, resizable, push, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }: PhiDrawerControlProps): import("react").JSX.Element;
|
|
2
|
+
export declare function PhiDrawerControlAdapter({ open, title, header, body, footer, closable, keyboard, mask, mountPolicy, placement, size, minSize, maxSize, resizable, push, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }: PhiDrawerControlProps): import("react").JSX.Element;
|
|
@@ -6,21 +6,22 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
import { Drawer } from "antd";
|
|
8
8
|
import { PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
|
|
9
|
-
import { PHI_OVERLAY_DEFAULT_MASK, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
|
|
9
|
+
import { PHI_OVERLAY_DEFAULT_MASK, resolvePhiDrawerGeometry, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
|
|
10
10
|
import { usePhiHydrated } from "../state/use-phi-hydrated";
|
|
11
11
|
const PHI_DRAWER_HEADER_MIN_BLOCK_SIZE = `calc(var(--phi-control-height) + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
|
|
12
12
|
/** Where a title starts when the close button stands before it: past the button, not beneath it. */
|
|
13
13
|
const PHI_DRAWER_TITLE_AFTER_CLOSE = `calc(${PHI_SPACE.sm} + var(--phi-control-height) + ${PHI_SPACE.xs})`;
|
|
14
|
-
export function PhiDrawerControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", placement = "right", size, maxSize, resizable = false, push = false, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
|
|
14
|
+
export function PhiDrawerControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", placement = "right", size, minSize, maxSize, resizable = false, push = false, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
|
|
15
15
|
const hydrated = usePhiHydrated();
|
|
16
16
|
const resolvedMask = resolvePhiOverlayMaskPresentation(mask);
|
|
17
|
+
const geometry = resolvePhiDrawerGeometry({ size, minSize, maxSize, placement });
|
|
17
18
|
const closeAtInlineStart = placement === "right";
|
|
18
19
|
// A drawer with nothing to say in its header draws none: no title, no header content, no close button.
|
|
19
20
|
const hasHeaderContent = header != null || title != null;
|
|
20
21
|
const hasHeader = hasHeaderContent || closable;
|
|
21
22
|
const titleInset = closable && closeAtInlineStart ? PHI_DRAWER_TITLE_AFTER_CLOSE : PHI_SPACE.lg;
|
|
22
23
|
const renderedTitle = hasHeaderContent ? (_jsxs("div", { style: { display: "grid", minBlockSize: PHI_DRAWER_HEADER_MIN_BLOCK_SIZE, minWidth: 0, position: "relative", width: "100%" }, children: [header, title == null ? null : (_jsx("div", { style: { insetInlineStart: titleInset, minWidth: 0, position: "absolute", top: "50%", transform: "translateY(-50%)", zIndex: 1 }, children: title }))] })) : null;
|
|
23
|
-
return (_jsx(Drawer, { open: open, title: renderedTitle, closable: closable ? { placement: closeAtInlineStart ? "start" : "end" } : false, keyboard: keyboard, mask: resolvedMask.adapterMask, destroyOnHidden: mountPolicy === "remount", forceRender: hydrated && mountPolicy === "eager", placement: placement, size: size, maxSize:
|
|
24
|
+
return (_jsx(Drawer, { open: open, title: renderedTitle, closable: closable ? { placement: closeAtInlineStart ? "start" : "end" } : false, keyboard: keyboard, mask: resolvedMask.adapterMask, destroyOnHidden: mountPolicy === "remount", forceRender: hydrated && mountPolicy === "eager", placement: placement, size: geometry.size, maxSize: geometry.resizeMaxSize, resizable: resizable, push: push, zIndex: zIndex, footer: footer ?? null, focusable: { trap: true, focusTriggerAfterClose: true }, styles: {
|
|
24
25
|
mask: resolvedMask.maskStyle,
|
|
25
26
|
wrapper: {
|
|
26
27
|
/*
|
|
@@ -31,6 +32,7 @@ export function PhiDrawerControlAdapter({ open, title, header, body, footer, clo
|
|
|
31
32
|
*/
|
|
32
33
|
background: "var(--phi-color-bg-elevated)",
|
|
33
34
|
...containerStyle,
|
|
35
|
+
...geometry.style,
|
|
34
36
|
padding: 0,
|
|
35
37
|
},
|
|
36
38
|
section: {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { PhiCmsOverlayConfig,
|
|
2
|
-
import type { PhiOverlayControlCommonProps } from "./phi-overlay-control-contract";
|
|
3
|
-
|
|
1
|
+
import type { PhiCmsOverlayConfig, PhiOverlayPushBehaviour } from "../../types/cms-overlay";
|
|
2
|
+
import type { PhiOverlayControlCommonProps, PhiOverlayControlGeometryProps } from "./phi-overlay-control-contract";
|
|
3
|
+
/**
|
|
4
|
+
* `size`, `minSize` and `maxSize` are the block's pairs; the Drawer draws the axis it opens along
|
|
5
|
+
* (`resolvePhiDrawerGeometry`).
|
|
6
|
+
*/
|
|
7
|
+
export type PhiDrawerControlProps = PhiOverlayControlCommonProps & PhiOverlayControlGeometryProps & {
|
|
4
8
|
placement?: PhiCmsOverlayConfig["placement"];
|
|
5
|
-
size?: PhiCmsOverlaySize;
|
|
6
|
-
maxSize?: number;
|
|
7
9
|
resizable?: boolean;
|
|
8
10
|
push?: PhiOverlayPushBehaviour;
|
|
9
11
|
zIndex?: number;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { PhiToolbarControlItem } from "./phi-toolbar-control";
|
|
2
2
|
export type PhiFloatButtonControlPlacement = "bottom-end" | "bottom-start" | "top-end" | "top-start";
|
|
3
|
+
/**
|
|
4
|
+
* How large the buttons are. A Float Button is drawn at the large control height by Ant Design; that is
|
|
5
|
+
* `medium` here, and `small` steps one down the Theme's control heights. The ladder has no step above
|
|
6
|
+
* it, so there is no `large`.
|
|
7
|
+
*/
|
|
8
|
+
export type PhiFloatButtonControlSize = "small" | "medium";
|
|
3
9
|
export type PhiFloatButtonControlGroup = {
|
|
4
10
|
/** How the group opens. Left out, it is always open: every button stands in the corner. */
|
|
5
11
|
trigger?: "click" | "hover";
|
|
@@ -24,6 +30,7 @@ export type PhiFloatButtonControlProps = {
|
|
|
24
30
|
* floating over the editor could neither be seen in its slot nor selected there.
|
|
25
31
|
*/
|
|
26
32
|
inPlace?: boolean;
|
|
33
|
+
size?: PhiFloatButtonControlSize;
|
|
27
34
|
disabled?: boolean;
|
|
28
35
|
onActivate?: (key: string) => void;
|
|
29
36
|
};
|
|
@@ -36,4 +43,4 @@ export type PhiFloatButtonControlProps = {
|
|
|
36
43
|
* on a Float Button and are not imitated: `danger`, and `loading`, which disables the button instead of
|
|
37
44
|
* spinning.
|
|
38
45
|
*/
|
|
39
|
-
export declare function PhiFloatButtonControl({ items, placement, offset, shape, group, inPlace, disabled, onActivate, }: PhiFloatButtonControlProps): import("react").JSX.Element | null;
|
|
46
|
+
export declare function PhiFloatButtonControl({ items, placement, offset, shape, group, inPlace, size, disabled, onActivate, }: PhiFloatButtonControlProps): import("react").JSX.Element | null;
|
|
@@ -5,6 +5,21 @@ import { createPortal } from "react-dom";
|
|
|
5
5
|
import { FloatButton } from "antd";
|
|
6
6
|
import { PhiIcon } from "../shell/phi-icon";
|
|
7
7
|
import { usePhiHydrated } from "../state/use-phi-hydrated";
|
|
8
|
+
import { PHI_CONTROL } from "../../theme/antd-css-var-contract";
|
|
9
|
+
/*
|
|
10
|
+
* Ant Design sizes the button by its own variable (`--ant-float-btn-size`, under the component prefix, as
|
|
11
|
+
* the Select's are) and opens a group's list from the trigger by the same length plus the padding.
|
|
12
|
+
*/
|
|
13
|
+
function resolveSizeStyle(size) {
|
|
14
|
+
if (size !== "small")
|
|
15
|
+
return undefined;
|
|
16
|
+
return { "--ant-float-btn-size": PHI_CONTROL.md };
|
|
17
|
+
}
|
|
18
|
+
function resolveGroupSizeStyle(size) {
|
|
19
|
+
if (size !== "small")
|
|
20
|
+
return undefined;
|
|
21
|
+
return { "--ant-float-btn-list-trigger-offset": `calc(${PHI_CONTROL.md} + var(--phi-padding))` };
|
|
22
|
+
}
|
|
8
23
|
/**
|
|
9
24
|
* Where a fixed button is drawn: on `document.body`, outside every box of the page.
|
|
10
25
|
*
|
|
@@ -47,7 +62,8 @@ function resolveCornerStyle(placement, offset, inPlace) {
|
|
|
47
62
|
* on a Float Button and are not imitated: `danger`, and `loading`, which disables the button instead of
|
|
48
63
|
* spinning.
|
|
49
64
|
*/
|
|
50
|
-
export function PhiFloatButtonControl({ items, placement = "bottom-end", offset, shape = "circle", group, inPlace = false, disabled, onActivate, }) {
|
|
65
|
+
export function PhiFloatButtonControl({ items, placement = "bottom-end", offset, shape = "circle", group, inPlace = false, size, disabled, onActivate, }) {
|
|
66
|
+
const sizeStyle = resolveSizeStyle(size);
|
|
51
67
|
const visibleItems = items.filter((item) => item.visible !== false);
|
|
52
68
|
if (visibleItems.length === 0) {
|
|
53
69
|
return null;
|
|
@@ -65,9 +81,9 @@ export function PhiFloatButtonControl({ items, placement = "bottom-end", offset,
|
|
|
65
81
|
}
|
|
66
82
|
: undefined,
|
|
67
83
|
/* A single button carries the corner itself; inside a group, the group does. */
|
|
68
|
-
style: visibleItems.length === 1 && index === 0 ? cornerStyle :
|
|
84
|
+
style: visibleItems.length === 1 && index === 0 ? { ...cornerStyle, ...sizeStyle } : sizeStyle, onClick: item.readOnly || !onActivate ? undefined : () => onActivate(item.key) }, item.key));
|
|
69
85
|
});
|
|
70
|
-
const placed = buttons.length === 1 ? buttons[0] : (_jsx(FloatButton.Group, { trigger: group?.trigger, icon: group?.icon ? _jsx(PhiIcon, { name: group.icon, size: "inherit" }) : undefined, placement: group?.direction ?? (placement.startsWith("top") ? "bottom" : "top"), shape: shape, style: cornerStyle, children: buttons }));
|
|
86
|
+
const placed = buttons.length === 1 ? buttons[0] : (_jsx(FloatButton.Group, { trigger: group?.trigger, icon: group?.icon ? _jsx(PhiIcon, { name: group.icon, size: "inherit" }) : undefined, placement: group?.direction ?? (placement.startsWith("top") ? "bottom" : "top"), shape: shape, style: { ...cornerStyle, ...resolveGroupSizeStyle(size) }, children: buttons }));
|
|
71
87
|
/* In place it stays in its slot, where the Builder's canvas can show and select it. */
|
|
72
88
|
return inPlace ? placed : _jsx(PhiFloatButtonPortal, { children: placed });
|
|
73
89
|
}
|
|
@@ -9,6 +9,8 @@ import { PhiAlertControl } from "./phi-alert-control";
|
|
|
9
9
|
import { PhiDescriptionHint } from "./phi-description-tooltip-icon";
|
|
10
10
|
import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_FIELD_UNAVAILABLE_DEFAULT_LABEL, PHI_FORM_FIELD_UNAVAILABLE_LABEL_KEY, PHI_FORM_VALIDATION_PROVIDER_KEYS, } from "../forms/form-provider-contract";
|
|
11
11
|
import { phiFormCellOpensColumn, phiFormControlGridColumn, phiFormFieldFollowsLayoutColumns, phiFormLabelGridColumn, resolvePhiFormGridPlacement, resolvePhiFormLayout, PHI_FORM_RESPONSIVE_MODES, resolvePhiFormText, shouldPhiFormSubmitOnKeyDown, } from "../forms/form-descriptor-contract";
|
|
12
|
+
import { readPhiMoneyFieldCurrencyFieldKey } from "../forms/money-field-currency-key";
|
|
13
|
+
import { collectFormOptionFlagFieldKeys, resolveFormChosenOptionFlags, } from "../forms/form-option-flags";
|
|
12
14
|
import { PHI_SHARED_FORM_PROVIDER_REGISTRY } from "../forms/shared-form-provider-registry";
|
|
13
15
|
import { resolvePhiControlOptionsDependencies, usePhiControlOptionsProvider, } from "./phi-options-provider";
|
|
14
16
|
/** The id Ant Design gives a Form Item's control: the form's name and the field's key, joined by `_`. */
|
|
@@ -60,6 +62,16 @@ function collectPhiFormWatchedKeys(fields) {
|
|
|
60
62
|
if (dependency.source === "form")
|
|
61
63
|
keys.add(dependency.valuePath.split(".")[0] ?? "");
|
|
62
64
|
}
|
|
65
|
+
const currencyField = field.fieldProviderKey === PHI_FORM_FIELD_PROVIDER_KEYS.money
|
|
66
|
+
? readPhiMoneyFieldCurrencyFieldKey(field.config)
|
|
67
|
+
: null;
|
|
68
|
+
if (currencyField !== null) {
|
|
69
|
+
// A key no field of the Form has would leave the amount with no currency for good, silently.
|
|
70
|
+
if (currencyField === field.key || !fields.some((other) => other.key === currencyField)) {
|
|
71
|
+
throw new Error(`The money field "${field.key}" takes its currency from "${currencyField}", which is no other field of its Form.`);
|
|
72
|
+
}
|
|
73
|
+
keys.add(currencyField);
|
|
74
|
+
}
|
|
63
75
|
}
|
|
64
76
|
keys.delete("");
|
|
65
77
|
return [...keys].sort();
|
|
@@ -72,7 +84,7 @@ function pickPhiFormWatchedValues(values, keys) {
|
|
|
72
84
|
}
|
|
73
85
|
return picked;
|
|
74
86
|
}
|
|
75
|
-
function PhiResolvedFormFieldControl({ id, provider, field, label, description, labels, formConfig, placeholder, disabled, readOnly, value, checked, onChange, formContext, formValues, mediaLimits, }) {
|
|
87
|
+
function PhiResolvedFormFieldControl({ id, provider, field, label, description, labels, formConfig, placeholder, disabled, readOnly, value, checked, onChange, formContext, formValues, mediaLimits, onChosenOptionFlags, }) {
|
|
76
88
|
const staticOptions = useMemo(() => field.options?.map((option) => ({
|
|
77
89
|
...option,
|
|
78
90
|
label: resolvePhiFormText(option.label, labels, formConfig),
|
|
@@ -128,11 +140,18 @@ function PhiResolvedFormFieldControl({ id, provider, field, label, description,
|
|
|
128
140
|
if (value != null && value !== "")
|
|
129
141
|
onChange?.(undefined);
|
|
130
142
|
}, [onChange, requiredDependencyKey, value]);
|
|
143
|
+
const chosenOptionFlags = onChosenOptionFlags
|
|
144
|
+
? resolveFormChosenOptionFlags(resolvedOptions.options, value)
|
|
145
|
+
: undefined;
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
onChosenOptionFlags?.(chosenOptionFlags);
|
|
148
|
+
}, [chosenOptionFlags, onChosenOptionFlags]);
|
|
149
|
+
useEffect(() => () => onChosenOptionFlags?.(undefined), [onChosenOptionFlags]);
|
|
131
150
|
const Control = provider.Control;
|
|
132
151
|
const controlLabel = field.controlLabel
|
|
133
152
|
? resolvePhiFormText(field.controlLabel, labels, formConfig)
|
|
134
153
|
: undefined;
|
|
135
|
-
return (_jsxs(_Fragment, { children: [_jsx(Control, { id: id, field: field, label: label, description: description, controlLabel: controlLabel, labels: labels, formConfig: formConfig, placeholder: placeholder, options: resolvedOptions.options, onSearch: resolvedOptions.search.enabled ? setSearchDraft : undefined, filterOptionsLocally: resolvedOptions.search.filterLocally, disabled: disabled, readOnly: readOnly, value: value, checked: checked, onChange: onChange, formContext: formContext, ...(mediaLimits ? { mediaLimits } : {}) }), resolvedOptions.warning ? (_jsx(PhiAlertControl, { level: "warning", showIcon: true, title: resolvedOptions.warning })) : null] }));
|
|
154
|
+
return (_jsxs(_Fragment, { children: [_jsx(Control, { id: id, field: field, label: label, description: description, controlLabel: controlLabel, labels: labels, formConfig: formConfig, placeholder: placeholder, options: resolvedOptions.options, onSearch: resolvedOptions.search.enabled ? setSearchDraft : undefined, filterOptionsLocally: resolvedOptions.search.filterLocally, disabled: disabled, readOnly: readOnly, value: value, checked: checked, onChange: onChange, formContext: formContext, ...(formValues ? { formValues } : {}), ...(mediaLimits ? { mediaLimits } : {}) }), resolvedOptions.warning ? (_jsx(PhiAlertControl, { level: "warning", showIcon: true, title: resolvedOptions.warning })) : null] }));
|
|
136
155
|
}
|
|
137
156
|
// One empty object for every form without controllers, so the fields drawn are not recomputed on
|
|
138
157
|
// every render for a new `{}`.
|
|
@@ -239,8 +258,10 @@ export const PhiFormControl = forwardRef(function PhiFormControl({ descriptor, r
|
|
|
239
258
|
async function submit(values) {
|
|
240
259
|
const holds = [...submitHoldsRef.current];
|
|
241
260
|
if (holds.length > 0) {
|
|
242
|
-
form.setFields(holds.
|
|
243
|
-
|
|
261
|
+
form.setFields(holds.flatMap(([name, { reason, onRefused }]) => onRefused ? [] : [{ name, errors: [reason] }]));
|
|
262
|
+
for (const [, { onRefused }] of holds)
|
|
263
|
+
onRefused?.();
|
|
264
|
+
onValidationFailed?.({ valid: false, errors: Object.fromEntries(holds.map(([name, { reason }]) => [name, [reason]])) });
|
|
244
265
|
return;
|
|
245
266
|
}
|
|
246
267
|
setSubmitting(true);
|
|
@@ -290,20 +311,52 @@ export const PhiFormControl = forwardRef(function PhiFormControl({ descriptor, r
|
|
|
290
311
|
const selectWatchedFormValues = useCallback((values) => pickPhiFormWatchedValues(values, watchedFormKeys), [watchedFormKeys]);
|
|
291
312
|
const watchedFormValues = Form.useWatch(selectWatchedFormValues, { form, preserve: true });
|
|
292
313
|
const formValues = useMemo(() => watchedFormValues ?? pickPhiFormWatchedValues(resolvedInitialValues, watchedFormKeys), [resolvedInitialValues, watchedFormKeys, watchedFormValues]);
|
|
314
|
+
/*
|
|
315
|
+
* What an `optionFlag` condition reads: the flags of the option chosen in each field one of them names.
|
|
316
|
+
* Written-out options are known here and answered during the render, the server's included; a
|
|
317
|
+
* Provider's are known only to the field that resolved them, which reports them once it has.
|
|
318
|
+
*/
|
|
319
|
+
const optionFlagFieldKeys = useMemo(() => collectFormOptionFlagFieldKeys(descriptor.fields), [descriptor.fields]);
|
|
320
|
+
const [reportedOptionFlags, setReportedOptionFlags] = useState({});
|
|
321
|
+
const optionFlagReporters = useMemo(() => new Map([...optionFlagFieldKeys].map((key) => [
|
|
322
|
+
key,
|
|
323
|
+
(flags) => setReportedOptionFlags((current) => {
|
|
324
|
+
if (current[key] === flags)
|
|
325
|
+
return current;
|
|
326
|
+
const next = { ...current };
|
|
327
|
+
if (flags === undefined)
|
|
328
|
+
delete next[key];
|
|
329
|
+
else
|
|
330
|
+
next[key] = flags;
|
|
331
|
+
return next;
|
|
332
|
+
}),
|
|
333
|
+
])), [optionFlagFieldKeys]);
|
|
334
|
+
const formOptionFlags = useMemo(() => {
|
|
335
|
+
const flags = {};
|
|
336
|
+
for (const key of optionFlagFieldKeys) {
|
|
337
|
+
const field = descriptor.fields.find((entry) => entry.key === key);
|
|
338
|
+
const chosen = field?.optionsProvider
|
|
339
|
+
? reportedOptionFlags[key]
|
|
340
|
+
: resolveFormChosenOptionFlags(field?.options, formValues[key]);
|
|
341
|
+
if (chosen !== undefined)
|
|
342
|
+
flags[key] = chosen;
|
|
343
|
+
}
|
|
344
|
+
return flags;
|
|
345
|
+
}, [descriptor.fields, formValues, optionFlagFieldKeys, reportedOptionFlags]);
|
|
293
346
|
const fieldFormContext = useMemo(() => ({
|
|
294
347
|
getValues: () => form.getFieldsValue(true),
|
|
295
|
-
holdSubmit: (fieldKey, reason) => {
|
|
348
|
+
holdSubmit: (fieldKey, reason, onRefused) => {
|
|
296
349
|
const holds = submitHoldsRef.current;
|
|
297
350
|
const held = holds.get(fieldKey);
|
|
298
351
|
if (reason == null) {
|
|
299
352
|
holds.delete(fieldKey);
|
|
300
353
|
// The sentence a refused submit left on the field goes with the hold; any other error stays.
|
|
301
|
-
if (held != null && form.getFieldError(fieldKey).includes(held)) {
|
|
354
|
+
if (held != null && form.getFieldError(fieldKey).includes(held.reason)) {
|
|
302
355
|
form.setFields([{ name: fieldKey, errors: [] }]);
|
|
303
356
|
}
|
|
304
357
|
return;
|
|
305
358
|
}
|
|
306
|
-
holds.set(fieldKey, reason);
|
|
359
|
+
holds.set(fieldKey, onRefused ? { reason, onRefused } : { reason });
|
|
307
360
|
},
|
|
308
361
|
setValues: (values) => {
|
|
309
362
|
form.setFields(Object.entries(values).map(([name, value]) => ({ name, value, touched: true })));
|
|
@@ -324,8 +377,9 @@ export const PhiFormControl = forwardRef(function PhiFormControl({ descriptor, r
|
|
|
324
377
|
!field.visibleWhen ||
|
|
325
378
|
evaluatePhiRuntimeConditionExpression(field.visibleWhen, {
|
|
326
379
|
form: formValues,
|
|
380
|
+
formOptionFlags,
|
|
327
381
|
controllers: conditionControllerStates,
|
|
328
|
-
}) === "matched"), [activeRegistry, conditionControllerStates, descriptor.fields, formValues]);
|
|
382
|
+
}) === "matched"), [activeRegistry, conditionControllerStates, descriptor.fields, formOptionFlags, formValues]);
|
|
329
383
|
/*
|
|
330
384
|
* Where every part of every field lies, at each of the three widths, worked out before anything is
|
|
331
385
|
* drawn. Labels and controls are direct children of the form's grid and name their own row and
|
|
@@ -477,6 +531,7 @@ export const PhiFormControl = forwardRef(function PhiFormControl({ descriptor, r
|
|
|
477
531
|
const fieldDisabled = field.disabledWhen
|
|
478
532
|
? evaluatePhiRuntimeConditionExpression(field.disabledWhen, {
|
|
479
533
|
form: formValues,
|
|
534
|
+
formOptionFlags,
|
|
480
535
|
controllers: conditionControllerStates,
|
|
481
536
|
})
|
|
482
537
|
: "not-matched";
|
|
@@ -518,6 +573,6 @@ export const PhiFormControl = forwardRef(function PhiFormControl({ descriptor, r
|
|
|
518
573
|
...resolveHoneypotStyle(provider.presentation),
|
|
519
574
|
}, children: _jsx(Form.Item, { name: field.key, messageVariables: { label: labelText ?? field.key }, hidden: hidden, valuePropName: provider.valuePropName, dependencies: dependencies, required: required, rules: resolvedRules.length === 0 ? undefined : resolvedRules, style: { marginBottom: 0 }, children: _jsx(PhiResolvedFormFieldControl, { provider: provider, field: field, label: providerLabel, description: providerDescription, labels: labels, formConfig: formConfig, placeholder: field.placeholder
|
|
520
575
|
? resolvePhiFormText(field.placeholder, labels, formConfig)
|
|
521
|
-
: undefined, disabled: disabled || submitting || readOnly || field.config?.disabled === true || fieldDisabled !== "not-matched", readOnly: readOnly, formContext: fieldFormContext, formValues: formValues, mediaLimits: mediaLimits }) }) })] }, field.key));
|
|
576
|
+
: undefined, disabled: disabled || submitting || readOnly || field.config?.disabled === true || fieldDisabled !== "not-matched", readOnly: readOnly, formContext: fieldFormContext, formValues: formValues, mediaLimits: mediaLimits, onChosenOptionFlags: field.optionsProvider ? optionFlagReporters.get(field.key) : undefined }) }) })] }, field.key));
|
|
522
577
|
}) }) }));
|
|
523
578
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { PhiModalControlProps } from "./phi-modal-control";
|
|
2
|
-
export declare function PhiModalControlAdapter({ open, title, header, body, footer, closable, keyboard, mask, mountPolicy, centered, controlSize, size,
|
|
2
|
+
export declare function PhiModalControlAdapter({ open, title, header, body, footer, closable, keyboard, mask, mountPolicy, centered, controlSize, size, minSize, maxSize, toldSize, rootClassName, containerStyle, onDismiss, afterOpenChange, panelRef, }: PhiModalControlProps): import("react").JSX.Element;
|
|
@@ -5,38 +5,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
* Everything Ant Design's Modal brings -- the dialog, its motion and focus trap -- is paid by the pages
|
|
6
6
|
* that open one, not by every page that could.
|
|
7
7
|
*/
|
|
8
|
-
import { useEffect, useRef
|
|
8
|
+
import { useEffect, useRef } from "react";
|
|
9
9
|
import { Modal } from "antd";
|
|
10
10
|
import { PHI_CONTROL, PHI_SPACE } from "../../theme/antd-css-var-contract";
|
|
11
11
|
import { resolvePhiMotionDurationMs } from "../../helpers/motion";
|
|
12
12
|
import { usePhiConfig } from "../root/phi-config-provider";
|
|
13
|
-
import {
|
|
13
|
+
import { PHI_OVERLAY_DEFAULT_MASK, resolvePhiModalGeometry, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
|
|
14
14
|
import { usePhiHydrated } from "../state/use-phi-hydrated";
|
|
15
|
-
const PHI_MODAL_MODE_QUERIES = [
|
|
16
|
-
`(min-width: ${PHI_MODAL_RESPONSIVE_MIN_WIDTH.medium}px)`,
|
|
17
|
-
`(min-width: ${PHI_MODAL_RESPONSIVE_MIN_WIDTH.wide}px)`,
|
|
18
|
-
];
|
|
19
|
-
/** The viewport crosses one of the Modal's two thresholds far less often than it resizes. */
|
|
20
|
-
function subscribeModalMode(onChange) {
|
|
21
|
-
const queries = PHI_MODAL_MODE_QUERIES.map((query) => window.matchMedia(query));
|
|
22
|
-
for (const query of queries)
|
|
23
|
-
query.addEventListener("change", onChange);
|
|
24
|
-
return () => {
|
|
25
|
-
for (const query of queries)
|
|
26
|
-
query.removeEventListener("change", onChange);
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function readModalMode() {
|
|
30
|
-
return resolvePhiModalResponsiveMode(window.innerWidth);
|
|
31
|
-
}
|
|
32
|
-
function readServerModalMode() {
|
|
33
|
-
return "compact";
|
|
34
|
-
}
|
|
35
|
-
const PHI_MODAL_WIDTH_BY_CONTROL_SIZE = {
|
|
36
|
-
small: 520,
|
|
37
|
-
medium: 720,
|
|
38
|
-
large: 960,
|
|
39
|
-
};
|
|
40
15
|
/** What a dialog opens on: the first thing to type into or choose from, never a button or a hint. */
|
|
41
16
|
const PHI_MODAL_FIRST_FIELD_SELECTOR = [
|
|
42
17
|
"input:not([type=hidden]):not(:disabled)",
|
|
@@ -56,10 +31,11 @@ const PHI_MODAL_TAB_STOP_SELECTOR = [
|
|
|
56
31
|
/** About a second: a Form that loads its descriptor late still gets the focus, a slower one does not. */
|
|
57
32
|
const PHI_MODAL_FIRST_FIELD_MAX_FRAMES = 60;
|
|
58
33
|
const PHI_MODAL_HEADER_MIN_BLOCK_SIZE = `calc(${PHI_CONTROL.md} + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
|
|
59
|
-
export function PhiModalControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", centered = false, controlSize, size,
|
|
34
|
+
export function PhiModalControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", centered = false, controlSize, size, minSize, maxSize, toldSize, rootClassName, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
|
|
60
35
|
const { token } = usePhiConfig();
|
|
61
36
|
const hydrated = usePhiHydrated();
|
|
62
|
-
const
|
|
37
|
+
const geometry = resolvePhiModalGeometry({ size, minSize, maxSize, toldSize, controlSize });
|
|
38
|
+
const blockSize = geometry.blockSize;
|
|
63
39
|
const bodyMeasureRef = useRef(null);
|
|
64
40
|
const bodyContentRef = useRef(null);
|
|
65
41
|
const dialogRef = useRef(null);
|
|
@@ -67,7 +43,7 @@ export function PhiModalControlAdapter({ open, title, header, body, footer, clos
|
|
|
67
43
|
useEffect(() => {
|
|
68
44
|
const bodyMeasure = bodyMeasureRef.current;
|
|
69
45
|
const bodyContent = bodyContentRef.current;
|
|
70
|
-
if (!open || !bodyMeasure || !bodyContent ||
|
|
46
|
+
if (!open || !bodyMeasure || !bodyContent || blockSize != null || typeof ResizeObserver === "undefined") {
|
|
71
47
|
return undefined;
|
|
72
48
|
}
|
|
73
49
|
let targetBlockSize = bodyContent.getBoundingClientRect().height;
|
|
@@ -105,7 +81,7 @@ export function PhiModalControlAdapter({ open, title, header, body, footer, clos
|
|
|
105
81
|
resizeAnimationRef.current?.cancel();
|
|
106
82
|
resizeAnimationRef.current = null;
|
|
107
83
|
};
|
|
108
|
-
}, [open,
|
|
84
|
+
}, [open, blockSize, token.motionDurationMid, token.motionEaseInOut]);
|
|
109
85
|
/*
|
|
110
86
|
* Ant Design's lock moves the focus to the first focusable element, which is the close button, so a
|
|
111
87
|
* dialog with a Form could not be typed into until Tab was pressed. The field may mount a few frames
|
|
@@ -156,11 +132,11 @@ export function PhiModalControlAdapter({ open, title, header, body, footer, clos
|
|
|
156
132
|
transform: "translateY(-50%)",
|
|
157
133
|
zIndex: 1,
|
|
158
134
|
}, children: title }))] }));
|
|
159
|
-
const resolvedWidth = size?.width ?? resolvePhiModalWidth(width, controlSize == null ? undefined : PHI_MODAL_WIDTH_BY_CONTROL_SIZE[controlSize], mode);
|
|
160
135
|
// The wrapper covers the viewport; letting the pointer through means opening it, not just the mask.
|
|
161
136
|
const passesOutsidePointer = !resolvedMask.capturesOutsidePointer;
|
|
162
|
-
return (_jsx(Modal, { open: open, title: renderedTitle, closable: closable, keyboard: keyboard, mask: resolvedMask.adapterMask, destroyOnHidden: mountPolicy === "remount", forceRender: hydrated && mountPolicy === "eager", centered: centered, width:
|
|
163
|
-
|
|
137
|
+
return (_jsx(Modal, { open: open, title: renderedTitle, closable: closable, keyboard: keyboard, mask: resolvedMask.adapterMask, destroyOnHidden: mountPolicy === "remount", forceRender: hydrated && mountPolicy === "eager", centered: centered, width: geometry.width, style: {
|
|
138
|
+
...(geometry.minWidth == null ? null : { minWidth: geometry.minWidth }),
|
|
139
|
+
maxWidth: geometry.maxWidth,
|
|
164
140
|
transition: `width ${token.motionDurationMid} ${token.motionEaseInOut}`,
|
|
165
141
|
}, rootClassName: rootClassName, footer: footer ?? null, focusable: { trap: true, focusTriggerAfterClose: true }, styles: {
|
|
166
142
|
mask: resolvedMask.maskStyle,
|
|
@@ -170,8 +146,9 @@ export function PhiModalControlAdapter({ open, title, header, body, footer, clos
|
|
|
170
146
|
display: "flex",
|
|
171
147
|
flexDirection: "column",
|
|
172
148
|
gap: 0,
|
|
173
|
-
...(
|
|
174
|
-
|
|
149
|
+
...(blockSize == null ? {} : { blockSize }),
|
|
150
|
+
...(geometry.minBlockSize == null ? {} : { minBlockSize: geometry.minBlockSize }),
|
|
151
|
+
maxBlockSize: geometry.maxBlockSize,
|
|
175
152
|
overflow: "hidden",
|
|
176
153
|
...containerStyle,
|
|
177
154
|
padding: 0,
|
|
@@ -220,6 +197,6 @@ export function PhiModalControlAdapter({ open, title, header, body, footer, clos
|
|
|
220
197
|
minWidth: 0,
|
|
221
198
|
overflow: "hidden",
|
|
222
199
|
width: "100%",
|
|
223
|
-
...(
|
|
200
|
+
...(blockSize == null ? {} : { minBlockSize: "100%" }),
|
|
224
201
|
}, children: _jsx("div", { ref: bodyContentRef, "data-phi-modal-body-content": "true", style: { minWidth: 0, width: "100%" }, children: body }) }) }));
|
|
225
202
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { PhiControlSize } from "../../types/control";
|
|
2
2
|
import type { PhiRenderableBlockSize } from "../../types/renderable-block";
|
|
3
|
-
import type {
|
|
4
|
-
export type PhiModalControlProps = PhiOverlayControlCommonProps & {
|
|
3
|
+
import type { PhiOverlayControlCommonProps, PhiOverlayControlGeometryProps } from "./phi-overlay-control-contract";
|
|
4
|
+
export type PhiModalControlProps = PhiOverlayControlCommonProps & PhiOverlayControlGeometryProps & {
|
|
5
5
|
centered?: boolean;
|
|
6
|
+
/** The width step where `size` names no width (`PHI_MODAL_WIDTH_BY_CONTROL_SIZE`). */
|
|
6
7
|
controlSize?: PhiControlSize;
|
|
7
|
-
size
|
|
8
|
-
|
|
9
|
-
width?: PhiModalWidth;
|
|
8
|
+
/** What a `size` Signal told the open Modal; each axis it names stands over the stated `size`. */
|
|
9
|
+
toldSize?: PhiRenderableBlockSize | null;
|
|
10
10
|
rootClassName?: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
@@ -128,6 +128,7 @@ export declare function usePhiControlOptionsProvider<TValue extends string | num
|
|
|
128
128
|
description?: string;
|
|
129
129
|
icon?: string;
|
|
130
130
|
parentValue?: TValue;
|
|
131
|
+
flags?: number;
|
|
131
132
|
}[] | null;
|
|
132
133
|
optionsProvider?: PhiControlOptionsProviderConfig | null;
|
|
133
134
|
sourceConfig?: Record<string, unknown> | null;
|