@cosmicdrift/kumiko-renderer 0.415.0 → 0.417.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/dist/app/action-form-body.d.ts +2 -5
- package/dist/app/action-form-body.js +50 -22
- package/dist/app/action-form-support.d.ts +4 -1
- package/dist/app/action-form-support.js +8 -4
- package/dist/app/client-actions.js +6 -4
- package/dist/app/config-edit-body.js +83 -82
- package/dist/app/entity-list-screen.js +1 -1
- package/dist/app/extension-sections.d.ts +2 -0
- package/dist/app/header-actions-bar.d.ts +3 -1
- package/dist/app/header-actions-bar.js +12 -4
- package/dist/app/locked-screen-header.d.ts +2 -0
- package/dist/app/locked-screen-header.js +8 -1
- package/dist/app/projection-detail-body.js +29 -8
- package/dist/app/projection-detail-guidance.d.ts +2 -1
- package/dist/app/projection-detail-guidance.js +45 -30
- package/dist/app/projection-detail-header-model.d.ts +1 -1
- package/dist/app/projection-detail-header-model.js +14 -6
- package/dist/app/projection-detail-header-region.js +25 -9
- package/dist/app/projection-detail-header.d.ts +2 -0
- package/dist/app/projection-detail-header.js +31 -4
- package/dist/app/projection-detail-navigation.d.ts +4 -0
- package/dist/app/projection-detail-navigation.js +5 -1
- package/dist/app/projection-list-shim.js +1 -0
- package/dist/app/row-actions.d.ts +4 -0
- package/dist/app/row-actions.js +19 -3
- package/dist/app/screen-shared.d.ts +1 -0
- package/dist/app/screen-shared.js +23 -3
- package/dist/app/use-projection-detail-actions.d.ts +16 -1
- package/dist/app/use-projection-detail-actions.js +23 -3
- package/dist/app/use-projection-detail-data.d.ts +2 -0
- package/dist/app/use-projection-detail-data.js +53 -10
- package/dist/app/use-projection-list-data.js +1 -1
- package/dist/card-options.d.ts +2 -0
- package/dist/components/ai-assist-payload.d.ts +2 -0
- package/dist/components/ai-assist-payload.js +8 -0
- package/dist/components/choice-chip-class.d.ts +1 -0
- package/dist/components/choice-chip-class.js +9 -0
- package/dist/components/edit-mounts.d.ts +3 -2
- package/dist/components/edit-mounts.js +2 -2
- package/dist/components/grid-cell-for-field.js +1 -1
- package/dist/components/multi-select-chips.d.ts +10 -0
- package/dist/components/multi-select-chips.js +19 -0
- package/dist/components/narrow-description.d.ts +3 -0
- package/dist/components/narrow-description.js +12 -0
- package/dist/components/related-list-section.d.ts +5 -3
- package/dist/components/related-list-section.js +52 -35
- package/dist/components/related-photo-grid.d.ts +11 -0
- package/dist/components/related-photo-grid.js +54 -0
- package/dist/components/render-edit-action-button.d.ts +2 -2
- package/dist/components/render-edit-field-grid.d.ts +12 -3
- package/dist/components/render-edit-field-grid.js +60 -18
- package/dist/components/render-edit-fields-section.js +45 -11
- package/dist/components/render-edit-header-actions.d.ts +2 -1
- package/dist/components/render-edit-header-actions.js +18 -1
- package/dist/components/render-edit-layout.js +5 -3
- package/dist/components/render-edit-logic.js +1 -0
- package/dist/components/render-edit-section-kinds.js +59 -10
- package/dist/components/render-edit-titles.js +1 -1
- package/dist/components/render-edit-types.d.ts +22 -1
- package/dist/components/render-field-ai-assist.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +90 -0
- package/dist/components/render-field-choice-inputs.js +4 -0
- package/dist/components/render-field-control.d.ts +1 -1
- package/dist/components/render-field-control.js +19 -9
- package/dist/components/render-field-value-chips.d.ts +9 -0
- package/dist/components/render-field-value-chips.js +47 -0
- package/dist/components/render-field-write-only.js +12 -4
- package/dist/components/render-list-hint-columns.d.ts +2 -0
- package/dist/components/render-list-hint-columns.js +43 -5
- package/dist/components/render-list-reference-columns.js +2 -4
- package/dist/components/render-list-row-tone.d.ts +2 -0
- package/dist/components/render-list-row-tone.js +6 -0
- package/dist/components/render-list-table-props.d.ts +13 -2
- package/dist/components/render-list-table-props.js +9 -3
- package/dist/components/render-list-types.d.ts +4 -0
- package/dist/components/render-list.js +12 -4
- package/dist/components/use-render-edit-sections.js +5 -1
- package/dist/components/use-render-list-columns.js +3 -3
- package/dist/components/write-form-registry.d.ts +13 -0
- package/dist/components/write-form-registry.js +6 -0
- package/dist/components/write-form-section.d.ts +5 -1
- package/dist/components/write-form-section.js +55 -16
- package/dist/headless/form/form-controller.d.ts +1 -0
- package/dist/headless/form/form-controller.js +1 -1
- package/dist/headless/format/index.d.ts +1 -0
- package/dist/headless/format/index.js +21 -0
- package/dist/headless/format/phone.d.ts +1 -0
- package/dist/headless/format/phone.js +8 -0
- package/dist/headless/format/relative-time.d.ts +15 -0
- package/dist/headless/format/relative-time.js +63 -0
- package/dist/headless/format/safe-locale.d.ts +1 -0
- package/dist/headless/format/safe-locale.js +13 -0
- package/dist/headless/index.d.ts +2 -2
- package/dist/headless/index.js +2 -2
- package/dist/headless/view-model/edit.d.ts +3 -2
- package/dist/headless/view-model/edit.js +162 -36
- package/dist/headless/view-model/field-text.d.ts +9 -0
- package/dist/headless/view-model/field-text.js +19 -0
- package/dist/headless/view-model/index.d.ts +1 -0
- package/dist/headless/view-model/index.js +1 -0
- package/dist/headless/view-model/list.js +6 -0
- package/dist/headless/view-model/types.d.ts +76 -5
- package/dist/hooks/use-list-table.js +11 -6
- package/dist/i18n-defaults.js +9 -2
- package/dist/index.d.ts +1 -1
- package/dist/primitives-record-guidance.d.ts +32 -1
- package/dist/primitives-share-types.d.ts +82 -0
- package/dist/primitives-share-types.js +1 -0
- package/dist/primitives.d.ts +44 -86
- package/dist/web/app/bold-markup.d.ts +3 -0
- package/dist/web/app/bold-markup.js +14 -0
- package/dist/web/app/dashboard-body.js +8 -3
- package/dist/web/app/dashboard-list-panel.js +8 -4
- package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
- package/dist/web/app/dashboard-panel-columns.js +14 -0
- package/dist/web/app/dashboard-panels.js +31 -3
- package/dist/web/app/dashboard-shared.d.ts +3 -1
- package/dist/web/app/dashboard-shared.js +4 -4
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
- package/dist/web/app/dashboard-stat-group-panel.js +24 -3
- package/dist/web/app/dashboard-text-panel.d.ts +1 -0
- package/dist/web/app/dashboard-text-panel.js +18 -11
- package/dist/web/app/relative-time.d.ts +0 -5
- package/dist/web/app/relative-time.js +11 -21
- package/dist/web/components/config-cascade.d.ts +2 -1
- package/dist/web/components/config-cascade.js +16 -4
- package/dist/web/drawn-icons.js +2 -1
- package/dist/web/layout/header-action-pinned.d.ts +4 -2
- package/dist/web/layout/header-action-pinned.js +13 -4
- package/dist/web/layout/header-overflow-menu.d.ts +2 -0
- package/dist/web/layout/header-overflow-menu.js +2 -0
- package/dist/web/layout/notification-bell.js +12 -3
- package/dist/web/layout/page-header-slot.d.ts +2 -0
- package/dist/web/layout/page-header-slot.js +4 -0
- package/dist/web/layout/screen-focus.js +4 -1
- package/dist/web/layout/shell-header.js +13 -5
- package/dist/web/primitives/banner.js +24 -8
- package/dist/web/primitives/card.js +5 -3
- package/dist/web/primitives/combobox.js +2 -2
- package/dist/web/primitives/data-table/actions-column.js +1 -1
- package/dist/web/primitives/data-table/card-body.d.ts +1 -1
- package/dist/web/primitives/data-table/card-body.js +37 -14
- package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
- package/dist/web/primitives/data-table/card-frame.js +3 -0
- package/dist/web/primitives/data-table/card-row.js +34 -10
- package/dist/web/primitives/data-table/card-sort-select.js +1 -1
- package/dist/web/primitives/data-table/card-view.js +1 -1
- package/dist/web/primitives/data-table/data-cell-props.d.ts +4 -1
- package/dist/web/primitives/data-table/data-cell-props.js +3 -0
- package/dist/web/primitives/data-table/density.d.ts +3 -1
- package/dist/web/primitives/data-table/density.js +11 -4
- package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
- package/dist/web/primitives/data-table/row-click-guard.js +19 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -5
- package/dist/web/primitives/data-table/sort-options-select.js +2 -2
- package/dist/web/primitives/data-table/sortable-header.js +4 -4
- package/dist/web/primitives/data-table/table-body.js +3 -1
- package/dist/web/primitives/data-table/table-chrome.js +1 -3
- package/dist/web/primitives/data-table/table-content.js +6 -6
- package/dist/web/primitives/data-table/table-data-cell.js +31 -17
- package/dist/web/primitives/data-table/table-header-row.js +1 -1
- package/dist/web/primitives/data-table/table-view.js +1 -1
- package/dist/web/primitives/data-table/toolbar.js +6 -7
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
- package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
- package/dist/web/primitives/data-table-cell.d.ts +17 -3
- package/dist/web/primitives/data-table-cell.js +130 -36
- package/dist/web/primitives/data-table.js +1 -1
- package/dist/web/primitives/default-form.d.ts +1 -1
- package/dist/web/primitives/default-form.js +15 -11
- package/dist/web/primitives/drawer.js +2 -3
- package/dist/web/primitives/facet-filter.d.ts +1 -1
- package/dist/web/primitives/facet-filter.js +2 -5
- package/dist/web/primitives/facet-search-filter.js +1 -1
- package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
- package/dist/web/primitives/facet-trigger-label.js +4 -7
- package/dist/web/primitives/field.js +15 -8
- package/dist/web/primitives/form-footer-parts.js +6 -3
- package/dist/web/primitives/form.js +6 -8
- package/dist/web/primitives/index.js +4 -0
- package/dist/web/primitives/inline-suffix.d.ts +2 -0
- package/dist/web/primitives/inline-suffix.js +5 -0
- package/dist/web/primitives/input-choice-kinds.js +12 -2
- package/dist/web/primitives/input-number-kinds.js +2 -2
- package/dist/web/primitives/input-text-kinds.js +1 -1
- package/dist/web/primitives/layout-elements.d.ts +4 -4
- package/dist/web/primitives/layout-elements.js +50 -13
- package/dist/web/primitives/layout.d.ts +1 -1
- package/dist/web/primitives/layout.js +1 -1
- package/dist/web/primitives/locale-number.d.ts +0 -1
- package/dist/web/primitives/locale-number.js +1 -13
- package/dist/web/primitives/money-input.js +10 -8
- package/dist/web/primitives/narrow-pinned-footer.js +7 -3
- package/dist/web/primitives/number-input.d.ts +2 -1
- package/dist/web/primitives/number-input.js +11 -5
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +8 -1
- package/dist/web/primitives/pager.js +12 -21
- package/dist/web/primitives/photo-grid.d.ts +3 -0
- package/dist/web/primitives/photo-grid.js +6 -0
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +7 -16
- package/dist/web/primitives/record-summary.d.ts +1 -1
- package/dist/web/primitives/record-summary.js +8 -3
- package/dist/web/primitives/row-actions.js +38 -24
- package/dist/web/primitives/step-list.d.ts +3 -0
- package/dist/web/primitives/step-list.js +11 -0
- package/dist/web/primitives/use-container-narrow.d.ts +12 -0
- package/dist/web/primitives/use-container-narrow.js +42 -0
- package/dist/web/ui/input.js +1 -1
- package/dist/web/ui/textarea.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.js +6 -3
- package/dist/web/widgets/dashboard-list.d.ts +6 -1
- package/dist/web/widgets/dashboard-list.js +12 -7
- package/dist/web/widgets/drawer-panel-class.js +1 -1
- package/dist/web/widgets/progress-list.js +1 -1
- package/dist/web/widgets/stat-box-cell.js +1 -1
- package/package.json +5 -5
- package/src/changes.json +105 -0
- package/src/web/styles.css +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import { InsideDrawerProvider, useInsideDrawer, useTranslation, } from "../../index.js";
|
|
4
4
|
import { cn } from "../lib/cn.js";
|
|
@@ -15,14 +15,18 @@ import { unsavedStatusText } from "./form-footer-parts.js";
|
|
|
15
15
|
function FormSummaryBox({ summary, testId }) {
|
|
16
16
|
if (summary === undefined)
|
|
17
17
|
return null;
|
|
18
|
-
return (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-summary` : undefined, className: "flex flex-col gap-
|
|
18
|
+
return (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-summary` : undefined, className: "flex flex-col gap-[3px] rounded-[9px] border border-l-[3px] border-border-strong border-l-primary bg-card px-4 py-[13px]", children: [_jsx("span", { className: "text-[15px] leading-[21px] font-semibold text-foreground", children: summary.title }), summary.subtitle !== undefined && (_jsx("span", { className: "text-[13.5px] text-foreground-secondary", children: summary.subtitle }))] }));
|
|
19
19
|
}
|
|
20
|
-
function DrawerFormLayout({ onSubmit, focusFirstErrorKey, subtitle, actions, secondaryActions, summary, testId, children, }) {
|
|
21
|
-
return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-6 py-5", children: [_jsx(FormSummaryBox, { summary: summary, testId: testId }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-[13px] text-foreground-secondary", children: subtitle })), _jsx(InsideFormContext.Provider, { value: true, children: _jsx(ScreenFormContext.Provider, { value: true, children: _jsx(InsideDrawerProvider, { value: false, children: _jsx(DrawerBodyContext.Provider, { value: true, children: _jsx("div", { className: "flex flex-col gap-5", children: children }) }) }) }) })] }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex h-16 shrink-0 items-center justify-end gap-2 border-t border-border px-6", children: [secondaryActions, actions] }))] }));
|
|
20
|
+
function DrawerFormLayout({ onSubmit, focusFirstErrorKey, subtitle, actions, secondaryActions, summary, topBanner, testId, children, }) {
|
|
21
|
+
return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-6 py-5", children: [topBanner, _jsx(FormSummaryBox, { summary: summary, testId: testId }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-[13px] text-foreground-secondary", children: subtitle })), _jsx(InsideFormContext.Provider, { value: true, children: _jsx(ScreenFormContext.Provider, { value: true, children: _jsx(InsideDrawerProvider, { value: false, children: _jsx(DrawerBodyContext.Provider, { value: true, children: _jsx("div", { className: "flex flex-col gap-5", children: children }) }) }) }) })] }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex h-16 shrink-0 items-center justify-end gap-2 border-t border-border px-6", children: [secondaryActions, actions] }))] }));
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
const insideDrawer = useInsideDrawer();
|
|
23
|
+
function EmbeddedFormLayout({ onSubmit, focusFirstErrorKey, actions, secondaryActions, unsavedCount, testId, children, }) {
|
|
25
24
|
const t = useTranslation();
|
|
25
|
+
return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex w-full flex-col gap-6", children: [_jsx(FormSections, { chromeless: true, stickyActions: undefined, fillHeight: false, screenForm: true, children: children }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex flex-wrap items-center gap-2", children: [actions, secondaryActions, unsavedCount !== undefined && unsavedCount > 0 && (_jsxs("span", { "data-testid": testId !== undefined ? `${testId}-unsaved` : undefined, className: "flex items-center gap-2 text-[13px] text-foreground-secondary", children: [_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-status-active", "aria-hidden": "true" }), unsavedStatusText(t, unsavedCount)] }))] }))] }));
|
|
26
|
+
}
|
|
27
|
+
export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, subtitle, actions, secondaryActions, testId, width, stickyActions, headerRegion, titleAction, fillHeight, chromeless, screenForm, unsavedCount, sectionNav, sideRail, summary, topBanner, }) {
|
|
28
|
+
const insideDrawer = useInsideDrawer();
|
|
29
|
+
const bodyWithTopBanner = topBanner === undefined ? (children) : (_jsxs(_Fragment, { children: [topBanner, children] }));
|
|
26
30
|
const isEmbeddedForm = useContext(EmbeddedFormContext);
|
|
27
31
|
const contextWidth = useContext(ScreenWidthContext);
|
|
28
32
|
// Embedded (AuthCard etc.): bare <form>, stacked fields with gap; the
|
|
@@ -31,17 +35,17 @@ export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, sub
|
|
|
31
35
|
return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: cn("flex flex-col gap-4",
|
|
32
36
|
// Bare forms stack sections without a card; without a divider a
|
|
33
37
|
// section boundary reads as a layout gap, not structure.
|
|
34
|
-
"[&>section:not(:first-child)]:border-t"), children: [headerRegion, _jsx(InsideFormContext.Provider, { value: true, children:
|
|
38
|
+
"[&>section:not(:first-child)]:border-t"), children: [headerRegion, _jsx(InsideFormContext.Provider, { value: true, children: bodyWithTopBanner }), (secondaryActions !== undefined || actions !== undefined) && (_jsxs("div", { className: "flex items-center justify-end gap-2", children: [secondaryActions, actions] }))] }));
|
|
35
39
|
}
|
|
36
40
|
if (insideDrawer) {
|
|
37
|
-
return (_jsx(DrawerFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, subtitle: subtitle, actions: actions, secondaryActions: secondaryActions, summary: summary, testId: testId, children: children }));
|
|
41
|
+
return (_jsx(DrawerFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, subtitle: subtitle, actions: actions, secondaryActions: secondaryActions, summary: summary, topBanner: topBanner, testId: testId, children: children }));
|
|
38
42
|
}
|
|
39
43
|
if (isEmbeddedForm) {
|
|
40
|
-
return (
|
|
44
|
+
return (_jsx(EmbeddedFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, actions: actions, secondaryActions: secondaryActions, unsavedCount: unsavedCount, testId: testId, children: bodyWithTopBanner }));
|
|
41
45
|
}
|
|
42
46
|
const isScreenForm = screenForm === true && fillHeight === true && chromeless !== true;
|
|
43
47
|
const screenFormWidth = width ?? contextWidth;
|
|
44
|
-
const sections = (_jsx(FormSections, { chromeless: chromeless === true, stickyActions: stickyActions, fillHeight: fillHeight, screenForm: isScreenForm, children: children }));
|
|
48
|
+
const sections = (_jsx(FormSections, { chromeless: chromeless === true, stickyActions: stickyActions, fillHeight: fillHeight, screenForm: isScreenForm, children: isScreenForm ? children : bodyWithTopBanner }));
|
|
45
49
|
const footer = (_jsx(FormFooter, { actions: actions, secondaryActions: secondaryActions, testId: testId, chromeless: chromeless === true, stickyActions: stickyActions, fillHeight: fillHeight, ...(unsavedCount !== undefined && { unsavedCount }), railed: sideRail !== undefined }));
|
|
46
50
|
// Screen form: no card. A padded scroll surface holds the form column and,
|
|
47
51
|
// from xl, the section navigation; the footer stays pinned below it.
|
|
@@ -49,7 +53,7 @@ export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, sub
|
|
|
49
53
|
const showsSectionNav = sectionNav !== undefined && sectionNav.length >= SECTION_NAV_MIN_ITEMS;
|
|
50
54
|
return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [sideRail, _jsx("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: cn("min-h-0 flex-1 overflow-y-auto", screenPaddingClassName), children: _jsxs("div", { className: "flex gap-18", children: [_jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-9", screenFormWidth !== undefined
|
|
51
55
|
? screenFormColumnWidthClassName[screenFormWidth]
|
|
52
|
-
: "max-w-[640px]"), children: [_jsx(InsideScreenFormColumnContext.Provider, { value: true, children: headerRegion }), _jsx(FormTitleBlock, { title: title, subtitle: subtitle, titleAction: titleAction, testId: testId, bordered: false, fillHeight: false }), _jsx(FormSummaryBox, { summary: summary, testId: testId }), sections] }), showsSectionNav && _jsx(FormSectionNav, { items: sectionNav })] }) })] }), footer] }));
|
|
56
|
+
: "max-w-[640px]"), children: [headerRegion !== undefined && (_jsx("div", { className: "flex flex-col gap-9", children: _jsx(InsideScreenFormColumnContext.Provider, { value: true, children: headerRegion }) })), _jsx(FormTitleBlock, { title: title, subtitle: subtitle, titleAction: titleAction, testId: testId, bordered: false, fillHeight: false }), topBanner, _jsx(FormSummaryBox, { summary: summary, testId: testId }), sections] }), showsSectionNav && _jsx(FormSectionNav, { items: sectionNav })] }) })] }), footer] }));
|
|
53
57
|
}
|
|
54
58
|
// Pinned footer (fillHeight + stickyActions): the footer is a full-bleed
|
|
55
59
|
// sibling BELOW the padded shell, so the shell's bottom inset does not float
|
|
@@ -8,10 +8,9 @@ import { XIcon } from "lucide-react";
|
|
|
8
8
|
import { useTranslation } from "../../index.js";
|
|
9
9
|
import { SheetTitle } from "../ui/sheet.js";
|
|
10
10
|
import { Drawer } from "../widgets/drawer.js";
|
|
11
|
-
const DRAWER_WIDTH_PX = 480;
|
|
12
11
|
const DRAWER_DIM_PERCENT = 32;
|
|
13
|
-
const PANEL_CLASS = "bg-
|
|
12
|
+
const PANEL_CLASS = "bg-background border-border-strong shadow-[-12px_0_32px_rgb(0_0_0/0.14)]";
|
|
14
13
|
export function DefaultDrawer({ open, onOpenChange, title, subtitle, children, testId, }) {
|
|
15
14
|
const t = useTranslation();
|
|
16
|
-
return (_jsxs(Drawer, { open: open, onOpenChange: onOpenChange, testId: testId, variant: "flush", side: "right",
|
|
15
|
+
return (_jsxs(Drawer, { open: open, onOpenChange: onOpenChange, testId: testId, variant: "flush", side: "right", backdrop: { dimPercent: DRAWER_DIM_PERCENT }, showCloseButton: false, panelClassName: PANEL_CLASS, fillBody: true, children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-header` : undefined, className: "flex min-h-14 shrink-0 items-center gap-3 border-b border-border py-2 pr-3 pl-6", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(SheetTitle, { className: "text-base font-semibold", children: title ?? "" }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-sm text-muted-foreground", children: subtitle }))] }), _jsx("button", { type: "button", "aria-label": t("kumiko.dialog.close"), onClick: () => onOpenChange(false), className: "flex size-8 items-center justify-center rounded-md text-foreground-secondary hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden", children: _jsx(XIcon, { className: "size-4" }) })] }), _jsx("div", { "data-testid": testId !== undefined ? `${testId}-body` : undefined, onSubmit: (e) => e.stopPropagation(), className: "flex min-h-0 flex-1 flex-col", children: children })] }));
|
|
17
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { DataTableDateRangeFacet, DataTableFacet } from "../../index.ts";
|
|
3
3
|
import "../react-css-custom-properties.ts";
|
|
4
4
|
export declare function FacetFilter({ facet, selected, onChange, dense, pill, }: {
|
|
5
5
|
facet: DataTableFacet;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDown } from "lucide-react";
|
|
3
3
|
import { Fragment } from "react";
|
|
4
|
-
import { useOptionalTranslation, } from "../../index.js";
|
|
5
4
|
import { cn } from "../lib/cn.js";
|
|
6
5
|
import { Badge } from "../ui/badge.js";
|
|
7
6
|
import { Button as UiButton } from "../ui/button.js";
|
|
@@ -35,7 +34,7 @@ function FacetSelect({ facet, selected, onChange, dense, pill, }) {
|
|
|
35
34
|
// A stale URL can name an entry the facet does not offer; showing "all" then would misstate the list.
|
|
36
35
|
const active = chips.find((chip) => sameValueSet(selected, chip.values)) ??
|
|
37
36
|
(isFiltered ? undefined : chips[0]);
|
|
38
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES, isFiltered && "border-primary"), "data-testid": `facet-${facet.field}`, children: [_jsx("span", { className: "text-muted-foreground", children: active === undefined ? facet.label : `${facet.label}: ` }), active !== undefined && (_jsx("span", { "data-testid": `facet-${facet.field}-value`, className: isFiltered ? "font-medium text-primary" : "text-foreground", children: active.label })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-56 overflow-y-auto", children: _jsx(DropdownMenuRadioGroup, { value: active?.id ?? "", onValueChange: (id) => {
|
|
37
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES, isFiltered && "border-primary"), "data-testid": `facet-${facet.field}`, children: [_jsx("span", { className: "text-muted-foreground", children: active === undefined || !isFiltered ? facet.label : `${facet.label}: ` }), active !== undefined && isFiltered && (_jsx("span", { "data-testid": `facet-${facet.field}-value`, className: isFiltered ? "font-medium text-primary" : "text-foreground", children: active.label })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-56 overflow-y-auto", children: _jsx(DropdownMenuRadioGroup, { value: active?.id ?? "", onValueChange: (id) => {
|
|
39
38
|
if (id === active?.id)
|
|
40
39
|
return;
|
|
41
40
|
const chip = chips.find((candidate) => candidate.id === id);
|
|
@@ -46,8 +45,6 @@ function FacetSelect({ facet, selected, onChange, dense, pill, }) {
|
|
|
46
45
|
// Faceted filter dropdown: outline button (like shadcn's "Columns" toggle) +
|
|
47
46
|
// multi-select checkboxes. Active selection -> count badge on the button.
|
|
48
47
|
export function FacetFilter({ facet, selected, onChange, dense = false, pill = false, }) {
|
|
49
|
-
const translate = useOptionalTranslation();
|
|
50
|
-
const allLabel = translate?.("kumiko.list.filter.all") ?? "All";
|
|
51
48
|
const toggle = (value, checked) => {
|
|
52
49
|
const next = checked ? [...selected, value] : selected.filter((v) => v !== value);
|
|
53
50
|
onChange(facet.field, next);
|
|
@@ -61,7 +58,7 @@ export function FacetFilter({ facet, selected, onChange, dense = false, pill = f
|
|
|
61
58
|
if (facet.onSearchChange !== undefined) {
|
|
62
59
|
return (_jsx(FacetSearchFilter, { facet: facet, onSearchChange: facet.onSearchChange, selected: selected, onChange: onChange, dense: dense, pill: pill }));
|
|
63
60
|
}
|
|
64
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ?
|
|
61
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? _jsx(FacetTriggerLabel, { label: facet.label }) : facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-44 overflow-y-auto", children: facet.options.map((opt) => (_jsx(DropdownMenuCheckboxItem, { checked: selected.includes(opt.value), onCheckedChange: (checked) => toggle(opt.value, checked), onSelect: (e) => e.preventDefault(), "data-testid": `facet-${facet.field}-${opt.value}`, children: opt.label }, opt.value))) })] }));
|
|
65
62
|
}
|
|
66
63
|
// Time-range filter: two native <input type="date"> instead of a
|
|
67
64
|
// dropdown — the browser supplies the calendar, the locale and the keyboard
|
|
@@ -26,7 +26,7 @@ export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, d
|
|
|
26
26
|
const toggle = (value) => {
|
|
27
27
|
onChange(facet.field, selected.includes(value) ? selected.filter((v) => v !== value) : [...selected, value]);
|
|
28
28
|
};
|
|
29
|
-
return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ?
|
|
29
|
+
return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? _jsx(FacetTriggerLabel, { label: facet.label }) : facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "z-50 w-64 rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none", children: _jsxs(Command, { shouldFilter: false, children: [_jsxs("div", { className: "relative", children: [_jsx(Command.Input, { value: searchTerm, onValueChange: setSearchTerm, placeholder: t("kumiko.combobox.search-placeholder"), "data-testid": `facet-${facet.field}-search`, className: "flex h-9 w-full border-0 border-b border-border bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground" }), facet.searching === true && (_jsx(Loader2, { className: "absolute right-2 top-2.5 h-4 w-4 animate-spin text-muted-foreground" }))] }), _jsxs(Command.List, { className: "max-h-64 overflow-y-auto p-1", children: [_jsx(Command.Empty, { className: "py-3 text-center text-sm text-muted-foreground", children: facet.searching === true
|
|
30
30
|
? t("kumiko.combobox.loading")
|
|
31
31
|
: t("kumiko.combobox.empty") }), facet.options.map((opt) => (_jsxs(Command.Item, { value: opt.value, onSelect: () => toggle(opt.value), "data-testid": `facet-${facet.field}-${opt.value}`, className: "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground", children: [selected.includes(opt.value) && (_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(Check, { className: "h-4 w-4" }) })), opt.label] }, opt.value)))] })] }) }) })] }));
|
|
32
32
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
export declare const FACET_PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
|
|
3
|
-
export declare function FacetTriggerLabel({
|
|
4
|
-
readonly field: string;
|
|
3
|
+
export declare function FacetTriggerLabel({ label }: {
|
|
5
4
|
readonly label: string;
|
|
6
|
-
readonly emptyValueLabel: string;
|
|
7
|
-
readonly showEmptyValue: boolean;
|
|
8
5
|
}): ReactNode;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export const FACET_PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!showEmptyValue)
|
|
7
|
-
return _jsx("span", { className: "text-muted-foreground", children: label });
|
|
8
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: `${label}: ` }), _jsx("span", { "data-testid": `facet-${field}-value`, className: "text-foreground", children: emptyValueLabel })] }));
|
|
3
|
+
// A facet with nothing chosen names itself only, like the boards ("Property ▾").
|
|
4
|
+
export function FacetTriggerLabel({ label }) {
|
|
5
|
+
return _jsx("span", { className: "text-muted-foreground", children: label });
|
|
9
6
|
}
|
|
@@ -39,12 +39,19 @@ export function DefaultField(props) {
|
|
|
39
39
|
.join(" ");
|
|
40
40
|
return (_jsx(FieldLabelledContext.Provider, { value: props.label !== "", children: _jsx(FieldDescriptionContext.Provider, { value: describedBy === "" ? undefined : describedBy, children: _jsx(DefaultFieldBody, { ...props }) }) }));
|
|
41
41
|
}
|
|
42
|
+
function FieldLabelElement({ id, label, required, layout, hideLabel, hasError, }) {
|
|
43
|
+
const hideRequiredMarker = useContext(HideRequiredMarkerContext);
|
|
44
|
+
return (_jsxs(UiLabel, { id: fieldLabelId(id), htmlFor: id, className: cn("min-w-0 gap-0 text-[13px]", hasError ? "text-destructive" : "text-foreground", hideLabel === true && "sr-only"), children: [_jsx("span", { className: layout === "inline" || layout === "row" ? undefined : "truncate", title: typeof label === "string" ? label : undefined, children: label }), required === true && !hideRequiredMarker && (_jsx("span", { "data-required": true, className: "ml-0.5 shrink-0 text-destructive", children: "*" }))] }));
|
|
45
|
+
}
|
|
46
|
+
function FieldErrors({ id, testId, issues, }) {
|
|
47
|
+
const t = useTranslation();
|
|
48
|
+
return (_jsx("div", { id: fieldErrorId(id), role: "alert", "data-testid": testId !== undefined ? `${testId}-errors` : undefined, className: "order-1 text-xs text-destructive", children: issues.map((issue) => (_jsx("div", { children: fieldIssueText(t, issue) }, `${issue.path}:${issue.code}`))) }));
|
|
49
|
+
}
|
|
42
50
|
function DefaultFieldBody({ id, label, required, issues, labelAppendix, fieldAppendix, appendixPlacement, description, status, children, layout, accent, hideLabel, testId, changed, }) {
|
|
43
51
|
const t = useTranslation();
|
|
44
|
-
const hideRequiredMarker = useContext(HideRequiredMarkerContext);
|
|
45
52
|
const hasError = issues !== undefined && issues.length > 0;
|
|
46
|
-
const labelEl = (
|
|
47
|
-
const errorsEl = hasError ?
|
|
53
|
+
const labelEl = (_jsx(FieldLabelElement, { id: id, label: label, required: required, layout: layout, hideLabel: hideLabel, hasError: hasError }));
|
|
54
|
+
const errorsEl = hasError ? _jsx(FieldErrors, { id: id, testId: testId, issues: issues }) : null;
|
|
48
55
|
// Inline (boolean/checkbox): Control links, Label rechts — shadcn-Muster.
|
|
49
56
|
if (layout === "inline") {
|
|
50
57
|
return (_jsxs("div", { "data-testid": testId, className: "flex flex-col gap-1.5", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FieldLayoutContext.Provider, { value: "inline", children: children }), labelEl, labelAppendix !== undefined && labelAppendix] }), errorsEl] }));
|
|
@@ -55,14 +62,14 @@ function DefaultFieldBody({ id, label, required, issues, labelAppendix, fieldApp
|
|
|
55
62
|
// Settings row: label/help/origin on the left, control on the right. The
|
|
56
63
|
// hairlines between rows come from the list Grid, not from the row itself.
|
|
57
64
|
if (layout === "row") {
|
|
58
|
-
return (_jsxs("div", { "data-testid": testId, className: cn("group/row relative grid gap-x-6 gap-y-2 py-4 @
|
|
65
|
+
return (_jsxs("div", { "data-testid": testId, className: cn("group/row relative grid gap-x-6 gap-y-2 py-4 @sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] @sm:grid-rows-[auto_auto_auto_1fr] @sm:gap-y-0",
|
|
59
66
|
// Switch rows keep label left / switch right when stacked.
|
|
60
|
-
"@max-
|
|
67
|
+
"@max-sm:has-[[data-slot=switch]]:grid-cols-[minmax(0,1fr)_auto]", accent === true && "@max-sm:pl-3"), children: [accent === true && (_jsx("span", { "aria-hidden": "true", "data-testid": testId !== undefined ? `${testId}-accent` : undefined, className: "absolute inset-y-3 w-0.5 bg-status-active @max-sm:left-0 @sm:-left-4" })), _jsxs("div", { className: "flex min-w-0 items-center gap-2 @sm:col-start-1 @sm:row-start-1", children: [labelEl, changedMarker, labelAppendix !== undefined && labelAppendix, statusEl !== null && _jsx("span", { className: "ml-auto", children: statusEl })] }), description !== undefined && (_jsx("div", { id: fieldDescriptionId(id), "data-testid": testId !== undefined ? `${testId}-description` : undefined, className: "min-w-0 text-sm text-muted-foreground @sm:col-start-1 @sm:row-start-2 @sm:mt-1 @max-sm:group-has-[[data-slot=switch]]/row:col-span-2", children: description })), _jsxs("div", { className: "flex min-w-0 flex-col gap-1.5 has-[[data-slot=switch]]:items-end @sm:col-start-2 @sm:row-span-4 @sm:row-start-1 @max-sm:group-has-[[data-slot=switch]]/row:col-start-2 @max-sm:group-has-[[data-slot=switch]]/row:row-start-1", children: [_jsx(FieldLayoutContext.Provider, { value: "row", children: children }), errorsEl] }), fieldAppendix !== undefined && (_jsx("div", { className: "min-w-0 @sm:col-start-1 @sm:row-start-3 @sm:mt-1 @max-sm:group-has-[[data-slot=switch]]/row:col-span-2", children: fieldAppendix }))] }));
|
|
61
68
|
}
|
|
62
69
|
return (_jsxs("div", { "data-testid": testId, ...(belowControl && fieldAppendix !== undefined && { "data-appendix-below": "" }), className: "flex flex-col gap-1.5", children: [hideLabel === true &&
|
|
63
70
|
changedMarker === null &&
|
|
64
71
|
labelAppendix === undefined &&
|
|
65
|
-
statusEl === null ? (labelEl) : (_jsxs("div", { className: "flex items-center
|
|
72
|
+
statusEl === null ? (labelEl) : (_jsxs("div", { className: "flex items-center gap-2", children: [changedMarker !== null ? (_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [labelEl, changedMarker] })) : (labelEl), labelAppendix !== undefined && labelAppendix, statusEl] })), !belowControl && fieldAppendix !== undefined && fieldAppendix, children, description !== undefined && (_jsx("div", { id: fieldDescriptionId(id), "data-testid": testId !== undefined ? `${testId}-description` : undefined, className: "order-1 text-[13px] text-muted-foreground", children: description })), errorsEl, belowControl && fieldAppendix !== undefined && (_jsx("div", { className: "order-1", children: fieldAppendix }))] }));
|
|
66
73
|
}
|
|
67
74
|
// ---- Input ----
|
|
68
75
|
// Field-icon registry: `EditFieldSpec.icon`/`InputProps.icon` sets a
|
|
@@ -171,9 +178,9 @@ export function RadioListSelect({ id, name, value, onChange, options, variant =
|
|
|
171
178
|
// the box height from the content and makes the `rows` attribute inert.
|
|
172
179
|
// A declared row count therefore only survives as a min-height floor: the field
|
|
173
180
|
// starts at `rows` lines tall and still grows with its content. The addend is
|
|
174
|
-
// the textarea frame
|
|
181
|
+
// the textarea frame: py-2 top+bottom plus the 1.5px borders.
|
|
175
182
|
export function textareaMinHeight(rows) {
|
|
176
|
-
return { minHeight: `calc(${rows} * 1lh + 1rem +
|
|
183
|
+
return { minHeight: `calc(${rows} * 1lh + 1rem + 3px)` };
|
|
177
184
|
}
|
|
178
185
|
export function withInlineDisabledHint(option) {
|
|
179
186
|
if (option.disabled !== true || option.description === undefined)
|
|
@@ -19,9 +19,9 @@ export function renderNarrowPinnedFooter(model, nodes, keyboardInset) {
|
|
|
19
19
|
: undefined, testId: testId, keyboardInset: keyboardInset }));
|
|
20
20
|
}
|
|
21
21
|
export function footerRowClassName(model) {
|
|
22
|
-
const { pinned, chromeless, fillHeight
|
|
22
|
+
const { pinned, chromeless, fillHeight } = model;
|
|
23
23
|
return cn(pinned
|
|
24
|
-
?
|
|
24
|
+
? "flex h-14 shrink-0 items-center justify-end gap-2 border-t border-border bg-card px-6"
|
|
25
25
|
: "flex flex-col-reverse gap-3 py-3 sm:flex-row sm:items-center sm:justify-between sm:py-4", !pinned && !chromeless && "px-[var(--card-padding)]", !pinned && !chromeless && cardFooterBorder, !pinned && fillHeight === true && "shrink-0");
|
|
26
26
|
}
|
|
27
27
|
export function renderUnsavedStatus(model, unsavedCount) {
|
|
@@ -36,7 +36,10 @@ export function renderSecondaryActionsGroup(model) {
|
|
|
36
36
|
return (_jsx("div", { "data-testid": testId !== undefined ? `${testId}-actions-secondary` : undefined, className: cn(
|
|
37
37
|
// min-h-11: link-variant buttons (Copy link) are h-auto and would fall
|
|
38
38
|
// below the 24px touch-target minimum on narrow viewports.
|
|
39
|
-
"flex flex-wrap items-center gap-2 max-sm:[&_button]:min-h-11 max-sm:[&_button]:px-2 max-sm:[&_button]:text-xs", pinned && hasNonPrimaryOverflow && "mr-auto"
|
|
39
|
+
"flex flex-wrap items-center gap-2 max-sm:[&_button]:min-h-11 max-sm:[&_button]:px-2 max-sm:[&_button]:text-xs", pinned && hasNonPrimaryOverflow && "mr-auto",
|
|
40
|
+
// An align: "start" action (marked data-footer-align) rides the group's inner mr-auto to the
|
|
41
|
+
// left edge, so the group has to span the free width of the pinned row.
|
|
42
|
+
pinned && "has-[[data-footer-align=start]]:flex-1"), children: renderedSecondary }));
|
|
40
43
|
}
|
|
41
44
|
export function renderPrimaryActionsGroup(model) {
|
|
42
45
|
const { testId, pinned, stickyActions, fixedFooterStyle, renderedActions } = model;
|
|
@@ -128,15 +128,13 @@ function isPrimaryStickyAction(node) {
|
|
|
128
128
|
const props = node.props;
|
|
129
129
|
return props.type === "submit" || props[STICKY_PRIMARY_ACTION_PROP] === true;
|
|
130
130
|
}
|
|
131
|
-
// `actions` from render-edit.tsx arrives as a
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
// as the whole value, so the Fragment's own children are unwrapped first.
|
|
131
|
+
// `actions` from render-edit.tsx arrives as a Fragment whose children are Fragments again
|
|
132
|
+
// (one per action group); Children.toArray keeps nested Fragments as single elements, so they
|
|
133
|
+
// are unwrapped recursively or the footer would see one opaque node and fold it into "…".
|
|
135
134
|
function flattenActionNodes(node) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return Children.toArray(node);
|
|
135
|
+
return Children.toArray(node).flatMap((child) => isValidElement(child) && child.type === Fragment
|
|
136
|
+
? flattenActionNodes(child.props.children)
|
|
137
|
+
: [child]);
|
|
140
138
|
}
|
|
141
139
|
function splitStickyActions(stickyActions, actions, secondaryActions) {
|
|
142
140
|
// Only split when sticky: the non-sticky (regular, non-wizard) footer must
|
|
@@ -15,12 +15,14 @@ import { DefaultLightbox } from "./lightbox.js";
|
|
|
15
15
|
import { DefaultMetric, DefaultMetricBand } from "./metric.js";
|
|
16
16
|
import { DefaultModal } from "./modal.js";
|
|
17
17
|
import { DefaultPageHeader } from "./page-header.js";
|
|
18
|
+
import { DefaultPhotoGrid } from "./photo-grid.js";
|
|
18
19
|
import { PromoPanel } from "./promo-panel.js";
|
|
19
20
|
import { DefaultRecordBreadcrumb } from "./record-breadcrumb.js";
|
|
20
21
|
import { DefaultRecordSteps } from "./record-steps.js";
|
|
21
22
|
import { DefaultRecordSummary } from "./record-summary.js";
|
|
22
23
|
import { CopyButton, ShareButton } from "./share-actions.js";
|
|
23
24
|
import { DefaultStatusBadge } from "./status-badge.js";
|
|
25
|
+
import { DefaultStepList } from "./step-list.js";
|
|
24
26
|
import { StickyActionBar } from "./sticky-action-bar.js";
|
|
25
27
|
import { DefaultTabs } from "./tabs.js";
|
|
26
28
|
import "../react-css-custom-properties.js";
|
|
@@ -72,6 +74,8 @@ export const defaultPrimitives = {
|
|
|
72
74
|
Metric: DefaultMetric,
|
|
73
75
|
MetricBand: DefaultMetricBand,
|
|
74
76
|
RecordBreadcrumb: DefaultRecordBreadcrumb,
|
|
77
|
+
PhotoGrid: DefaultPhotoGrid,
|
|
78
|
+
StepList: DefaultStepList,
|
|
75
79
|
RecordSummary: DefaultRecordSummary,
|
|
76
80
|
RecordSteps: DefaultRecordSteps,
|
|
77
81
|
PageHeader: DefaultPageHeader,
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from "../../index.js";
|
|
2
3
|
import { Checkbox } from "../ui/checkbox.js";
|
|
3
4
|
import { Switch } from "../ui/switch.js";
|
|
4
5
|
import { ComboboxInput } from "./combobox.js";
|
|
5
|
-
import { RadioListSelect, SegmentedSelect, withInlineDisabledHint, withoutSegmentedSelectPlaceholder, } from "./field.js";
|
|
6
|
+
import { fieldLabelId, RadioListSelect, SegmentedSelect, withInlineDisabledHint, withoutSegmentedSelectPlaceholder, } from "./field.js";
|
|
6
7
|
import { stateProps } from "./input-optional-props.js";
|
|
7
8
|
import { resolveSelectPresentation } from "./input-select-presentation.js";
|
|
9
|
+
import { SegmentedControl } from "./segmented-select.js";
|
|
8
10
|
// layout="inline" (checkbox lists like MultiSelectCheckboxes, the
|
|
9
11
|
// BooleanField widget) keeps the checkbox optics; the standard form
|
|
10
12
|
// field (render-field.tsx, layout="stacked") gets the switch.
|
|
11
|
-
|
|
13
|
+
// A settings row (layout="row") shows the flag as an Off/On segment, not a switch.
|
|
14
|
+
function BooleanSegment(props) {
|
|
15
|
+
const t = useTranslation();
|
|
16
|
+
return (_jsx(SegmentedControl, { id: props.id, name: props.name, value: props.value ? "on" : "off", onChange: (next) => props.onChange(next === "on"), options: [
|
|
17
|
+
{ value: "off", label: t("kumiko.config.cascade.off") },
|
|
18
|
+
{ value: "on", label: t("kumiko.config.cascade.on") },
|
|
19
|
+
], disabled: props.disabled, required: props.required, hasError: props.hasError, labelProps: { "aria-labelledby": fieldLabelId(props.id) } }));
|
|
20
|
+
}
|
|
21
|
+
export const renderBooleanKind = (props, { booleanLayout }) => booleanLayout === "row" ? (_jsx(BooleanSegment, { ...props })) : booleanLayout === "inline" ? (_jsx(Checkbox, { id: props.id, name: props.name, disabled: props.disabled, "aria-required": props.required, "aria-invalid": props.hasError === true ? true : undefined, checked: props.value, onCheckedChange: (checked) => props.onChange(checked === true) })) : (_jsx(Switch, { id: props.id, name: props.name, disabled: props.disabled, "aria-required": props.required, "aria-invalid": props.hasError === true ? true : undefined, checked: props.value, onCheckedChange: (checked) => props.onChange(checked === true), className: "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40" }));
|
|
12
22
|
function normalizeSelectOptions(options) {
|
|
13
23
|
return options.map((o) => (typeof o === "string" ? { value: o, label: o } : o));
|
|
14
24
|
}
|
|
@@ -9,8 +9,8 @@ export const renderNumberKind = (props) => {
|
|
|
9
9
|
// Icon, input and unit share this one box, and the grid cell sizes the
|
|
10
10
|
// box rather than the bare input: anchored to a wider wrapper, the unit
|
|
11
11
|
// would sit next to a narrower input instead of inside it.
|
|
12
|
-
const numberField = (_jsxs("div", { "data-slot": "number-field", className: "relative", children: [NumberIcon !== undefined && _jsx(NumberIcon, { "aria-hidden": "true", className: FIELD_ICON_CLASS }), _jsx(NumberInput, { id: props.id, name: props.name, value: props.value, onChange: props.onChange, disabled: props.disabled, required: props.required, hasError: props.hasError, testId: props.testId, ...(props.unit !== undefined && { ariaDescribedBy: unitSuffixId(props.id) }), ...(props.locale !== undefined && { locale: props.locale }), ...(props.grouping !== undefined && { grouping: props.grouping }), ...(props.integer !== undefined && { integer: props.integer }), ...(props.placeholder !== undefined && { placeholder: props.placeholder }), className: cn(NumberIcon !== undefined ? "pl-8" : undefined, props.unit !== undefined ? "pr-8" : undefined) }), props.unit !== undefined && (_jsx("span", { id: unitSuffixId(props.id), className: "pointer-events-none absolute right-2.5 top-1/2 max-w-[40%] -translate-y-1/2 truncate text-sm text-muted-foreground", children: props.unit }))] }));
|
|
13
|
-
return withInputAddons(props, numberField);
|
|
12
|
+
const numberField = (_jsxs("div", { "data-slot": "number-field", className: "relative", children: [NumberIcon !== undefined && _jsx(NumberIcon, { "aria-hidden": "true", className: FIELD_ICON_CLASS }), _jsx(NumberInput, { id: props.id, name: props.name, value: props.value, onChange: props.onChange, disabled: props.disabled, required: props.required, hasError: props.hasError, testId: props.testId, ...(props.unit !== undefined && { ariaDescribedBy: unitSuffixId(props.id) }), ...(props.locale !== undefined && { locale: props.locale }), ...(props.grouping !== undefined && { grouping: props.grouping }), ...(props.integer !== undefined && { integer: props.integer }), ...(props.suffix !== undefined && { suffix: props.suffix }), ...(props.placeholder !== undefined && { placeholder: props.placeholder }), className: cn(NumberIcon !== undefined ? "pl-8" : undefined, props.unit !== undefined ? "pr-8" : undefined) }), props.unit !== undefined && (_jsx("span", { id: unitSuffixId(props.id), className: "pointer-events-none absolute right-2.5 top-1/2 max-w-[40%] -translate-y-1/2 truncate text-sm text-muted-foreground", children: props.unit }))] }));
|
|
13
|
+
return withInputAddons({ ...props, suffix: undefined }, numberField);
|
|
14
14
|
};
|
|
15
15
|
export const renderRangeKind = (props, { common }) => (_jsx("input", { type: "range", ...common, min: props.min, max: props.max, step: props.step ?? 1, value: props.value, onChange: (e) => props.onChange(Number(e.target.value)), className: "w-full accent-primary" }));
|
|
16
16
|
export const renderMoneyKind = (props) => (_jsx(MoneyInput, { id: props.id, name: props.name, value: props.value, onChange: props.onChange, currency: props.currency ?? "EUR", ...(props.locale !== undefined && { locale: props.locale }), ...stateProps(props) }));
|
|
@@ -36,4 +36,4 @@ function textareaShortcutProps({ onKeyDown, onSubmitShortcut }) {
|
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
export const renderTextareaKind = (props, { common }) => (_jsx(Textarea, { ...common, ...props.dataAttributes, readOnly: props.readOnly, value: props.value, onChange: (e) => props.onChange(e.target.value), rows: props.rows ?? 4, className: "resize-y", ...(props.placeholder !== undefined && { placeholder: props.placeholder }),
|
|
39
|
+
export const renderTextareaKind = (props, { common }) => (_jsx(Textarea, { ...common, ...props.dataAttributes, readOnly: props.readOnly, value: props.value, onChange: (e) => props.onChange(e.target.value), rows: props.rows ?? 4, className: "resize-y", ...(props.placeholder !== undefined && { placeholder: props.placeholder }), style: textareaMinHeight(props.rows ?? 4), ...textareaShortcutProps(props) }));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type MouseEvent, type ReactNode } from "react";
|
|
2
2
|
import type { FillContainerProps, GridCellProps, GridProps, HeadingProps, LinkProps, ProgressProps, SectionProps, StepBarProps, TextProps, WizardStepGroupProps } from "../../index.ts";
|
|
3
3
|
import "../react-css-custom-properties.ts";
|
|
4
|
-
export declare function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, children, actions, variant, layout, testId, icon, }: SectionProps): ReactNode;
|
|
4
|
+
export declare function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, children, actions, variant, layout, titleStyle, hint, testId, icon, }: SectionProps): ReactNode;
|
|
5
5
|
export declare function DefaultFillContainer({ children, testId, grow, className, }: FillContainerProps): ReactNode;
|
|
6
|
-
export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, }: GridProps): ReactNode;
|
|
7
|
-
export declare function DefaultGridCell({ span, width, children }: GridCellProps): ReactNode;
|
|
8
|
-
export declare function DefaultText({ variant, decorative, children, testId, }: TextProps): ReactNode;
|
|
6
|
+
export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, facts, }: GridProps): ReactNode;
|
|
7
|
+
export declare function DefaultGridCell({ span, width, hideOnNarrow, children }: GridCellProps): ReactNode;
|
|
8
|
+
export declare function DefaultText({ variant, decorative, concealed, narrow, children, testId, }: TextProps): ReactNode;
|
|
9
9
|
export declare function isPlainPrimaryClick(event: MouseEvent): boolean;
|
|
10
10
|
export declare function DefaultLink({ href, variant, target, rel, onPress, className, children, testId, dataAttributes, }: LinkProps): ReactNode;
|
|
11
11
|
export declare function DefaultProgress({ value, tone, ariaLabel, testId }: ProgressProps): ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, useContext } from "react";
|
|
3
3
|
import { isSafeHref } from "../../headless/index.js";
|
|
4
4
|
import { Icon } from "../icons.js";
|
|
@@ -9,7 +9,28 @@ import { StepBar } from "../widgets/step-bar.js";
|
|
|
9
9
|
import "../react-css-custom-properties.js";
|
|
10
10
|
import { cardSurface } from "./card-styles.js";
|
|
11
11
|
import { DrawerBodyContext, InsideFormContext, ScreenFormContext } from "./contexts.js";
|
|
12
|
-
|
|
12
|
+
// Desktop boards print the hint under the data, phone boards above it.
|
|
13
|
+
const SECTION_HINT_CLASS = "m-0 mt-3 text-[12.5px] text-muted-foreground max-sm:order-first max-sm:mb-3 max-sm:mt-0";
|
|
14
|
+
function SectionHint({ text, textNarrow, testId }) {
|
|
15
|
+
if (textNarrow !== undefined) {
|
|
16
|
+
return (_jsx("p", { "data-testid": testId, className: SECTION_HINT_CLASS, children: _jsx(NarrowText, { text: text, narrow: textNarrow }) }));
|
|
17
|
+
}
|
|
18
|
+
const end = text.indexOf(". ");
|
|
19
|
+
const first = end === -1 ? text : text.slice(0, end + 1);
|
|
20
|
+
const rest = end === -1 ? "" : text.slice(end + 1);
|
|
21
|
+
return (_jsxs("p", { "data-testid": testId, className: SECTION_HINT_CLASS, children: [_jsx("strong", { className: "font-semibold", children: first }), rest] }));
|
|
22
|
+
}
|
|
23
|
+
// The flex column lets the phone hint jump above the content via `order-first`.
|
|
24
|
+
function withSectionHint(children, hint) {
|
|
25
|
+
if (hint === undefined)
|
|
26
|
+
return children;
|
|
27
|
+
return (_jsxs("div", { className: "flex flex-col", children: [children, _jsx(SectionHint, { ...hint })] }));
|
|
28
|
+
}
|
|
29
|
+
function NarrowText({ text, narrow }) {
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "max-sm:hidden", children: text }), _jsx("span", { className: "sm:hidden", children: narrow })] }));
|
|
31
|
+
}
|
|
32
|
+
export function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, children, actions, variant = "default", layout = "stacked", titleStyle = "heading", hint, testId, icon, }) {
|
|
33
|
+
const labelTitle = titleStyle === "label";
|
|
13
34
|
const insideForm = useContext(InsideFormContext);
|
|
14
35
|
const insideScreenForm = useContext(ScreenFormContext);
|
|
15
36
|
// h3 instead of CardTitle (= div): keeps the heading semantics for
|
|
@@ -21,7 +42,9 @@ export function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, child
|
|
|
21
42
|
// footer — a title-less section still draws the row when actions are
|
|
22
43
|
// present, so a hideTitle tabs-Section with `actions` isn't stranded.
|
|
23
44
|
const TitleTag = insideScreenForm ? "h2" : "h3";
|
|
24
|
-
const titleBlock = title !== undefined || subtitle !== undefined ? (_jsxs("div", { className: "flex min-w-48 flex-1 flex-col gap-1", children: [title !== undefined && (_jsxs(TitleTag, { "data-
|
|
45
|
+
const titleBlock = title !== undefined || subtitle !== undefined ? (_jsxs("div", { className: "flex min-w-48 flex-1 flex-col gap-1", children: [title !== undefined && (_jsxs(TitleTag, { "data-section-title": "", "data-testid": testId !== undefined ? `${testId}-title` : undefined, className: cn("flex items-center gap-2", labelTitle
|
|
46
|
+
? "text-[12.5px] font-semibold uppercase leading-none tracking-[0.06em] text-muted-foreground"
|
|
47
|
+
: "text-base font-semibold leading-none tracking-tight"), children: [icon !== undefined && _jsx(Icon, { name: icon, className: "size-4 text-muted-foreground" }), title] })), subtitle !== undefined && (_jsx("div", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: cn("text-sm text-muted-foreground", insideScreenForm && "text-[13px] text-foreground-secondary", subtitleBelowLgOnly === true && "lg:hidden"), children: subtitle }))] })) : null;
|
|
25
48
|
const header = titleBlock !== null || actions !== undefined ? (_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-x-4 gap-y-3", children: [titleBlock, actions !== undefined && (_jsx("div", { "data-testid": testId !== undefined ? `${testId}-actions` : undefined, className: "ml-auto flex shrink-0 items-center gap-2", children: actions }))] })) : null;
|
|
26
49
|
// Inside a form: divider-less section WITHOUT a card surface of its own.
|
|
27
50
|
// The separator lines BETWEEN sections come from the divide-y wrapper in
|
|
@@ -33,8 +56,10 @@ export function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, child
|
|
|
33
56
|
// gap only needs to read as roughly double the gap-4 field row
|
|
34
57
|
// spacing, not triple it.
|
|
35
58
|
insideScreenForm
|
|
36
|
-
?
|
|
37
|
-
|
|
59
|
+
? labelTitle
|
|
60
|
+
? "flex scroll-mt-4 flex-col gap-2 [&:not(:first-of-type)]:pt-6"
|
|
61
|
+
: "flex scroll-mt-4 flex-col gap-4 [&:not(:first-of-type)]:border-t [&:not(:first-of-type)]:border-border [&:not(:first-of-type)]:pt-7"
|
|
62
|
+
: "flex flex-col gap-4 px-6 py-4", variant === "destructive" && "border-l-2 border-destructive/40", layout === "settings-list" && "@container max-w-[944px]"), children: [header, withSectionHint(children, hint)] }));
|
|
38
63
|
}
|
|
39
64
|
// Standalone: own card, header flows into the body (no divider).
|
|
40
65
|
// overflow-hidden clips the card's own corner radius correctly for
|
|
@@ -43,7 +68,7 @@ export function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, child
|
|
|
43
68
|
// directly into `children`) WOULD get silently clipped — verify this
|
|
44
69
|
// against any new standalone-section content that renders its own
|
|
45
70
|
// non-portaled overlay.
|
|
46
|
-
return (_jsx("div", { "data-slot": "card", "data-testid": testId, className: cn(cardSurface(), "overflow-hidden", variant === "destructive" && "border-destructive/40"), children: _jsxs("div", { className: "flex flex-col gap-4 px-6 py-6", children: [header, children] }) }));
|
|
71
|
+
return (_jsx("div", { "data-slot": "card", "data-testid": testId, className: cn(cardSurface(), "overflow-hidden", variant === "destructive" && "border-destructive/40"), children: _jsxs("div", { className: "flex flex-col gap-4 px-6 py-6", children: [header, withSectionHint(children, hint)] }) }));
|
|
47
72
|
}
|
|
48
73
|
export function DefaultFillContainer({ children, testId, grow, className, }) {
|
|
49
74
|
// flex-1 only on request (`grow`, set under fillScreenHeight): without it the
|
|
@@ -52,7 +77,7 @@ export function DefaultFillContainer({ children, testId, grow, className, }) {
|
|
|
52
77
|
return (_jsx("div", { "data-testid": testId, className: cn("flex min-h-0 flex-col", grow === true && "flex-1", className), children: children }));
|
|
53
78
|
}
|
|
54
79
|
const DRAWER_FIELD_CELL_WIDTH_CLASS = {
|
|
55
|
-
money: "w-full
|
|
80
|
+
money: "w-full [&_label]:whitespace-nowrap",
|
|
56
81
|
select: "w-full",
|
|
57
82
|
};
|
|
58
83
|
const FIELD_CELL_WIDTH_CLASS = {
|
|
@@ -67,7 +92,7 @@ const FIELD_CELL_WIDTH_CLASS = {
|
|
|
67
92
|
// switch (1.15rem) gets (h-9 input − switch) / 2 margin to sit on the input line.
|
|
68
93
|
toggle: "w-auto min-w-40 shrink-0 self-start [&_[data-slot=switch]]:my-[0.55rem]",
|
|
69
94
|
};
|
|
70
|
-
export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, }) {
|
|
95
|
+
export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, facts, }) {
|
|
71
96
|
const insideDrawerBody = useContext(DrawerBodyContext);
|
|
72
97
|
const groupProps = ariaLabelledBy !== undefined
|
|
73
98
|
? { role: "group", "aria-labelledby": ariaLabelledBy }
|
|
@@ -75,6 +100,13 @@ export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ar
|
|
|
75
100
|
if (list === true) {
|
|
76
101
|
return (_jsx("div", { ...groupProps, "data-testid": testId, className: "flex flex-col divide-y divide-border", children: children }));
|
|
77
102
|
}
|
|
103
|
+
if (facts === true && typeof columns === "number") {
|
|
104
|
+
const factStyle = {
|
|
105
|
+
"--grid-cols": `repeat(${columns}, minmax(0, 1fr))`,
|
|
106
|
+
"--grid-cols-narrow": `repeat(${Math.min(columns, 2)}, minmax(0, 1fr))`,
|
|
107
|
+
};
|
|
108
|
+
return (_jsx("div", { ...groupProps, "data-testid": testId, "data-facts": "", className: "grid gap-x-6 gap-y-3 [grid-template-columns:var(--grid-cols-narrow)] sm:[grid-template-columns:var(--grid-cols)] [&_label]:text-[12.5px] [&_label]:font-normal [&_label]:text-muted-foreground [&_[data-testid^=field-value-]]:text-sm [&_[data-testid^=field-value-]:not([data-concealed])]:font-medium [&_[data-testid^=field-value-]:not([data-concealed])]:text-foreground", style: factStyle, children: children }));
|
|
109
|
+
}
|
|
78
110
|
if (flow === true) {
|
|
79
111
|
return (_jsx("div", { ...groupProps, "data-testid": testId, className: cn("flex gap-4", insideDrawerBody
|
|
80
112
|
? "flex-col items-start"
|
|
@@ -89,7 +121,7 @@ export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ar
|
|
|
89
121
|
// self-sized tiles) instead of N equal-width, container-stretched tracks.
|
|
90
122
|
// maxRows/scrolling don't apply — the row just wraps.
|
|
91
123
|
if (columns === "auto") {
|
|
92
|
-
return (_jsx("div", { ...groupProps, "data-testid": testId, className: "flex flex-wrap items-center gap-4", children: children }));
|
|
124
|
+
return (_jsx("div", { ...groupProps, "data-testid": testId, className: cn("flex flex-wrap items-center", tight === true ? "gap-2" : "gap-4"), children: children }));
|
|
93
125
|
}
|
|
94
126
|
// Responsive: mobile (< sm = 640px) stays single-column, from sm on the
|
|
95
127
|
// author-declared column count applies. The inline style writes a CSS
|
|
@@ -118,10 +150,10 @@ export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ar
|
|
|
118
150
|
};
|
|
119
151
|
return (_jsx("div", { ...groupProps, "data-testid": testId, className: "grid gap-[var(--kumiko-grid-gap,1rem)] grid-cols-1 sm:[grid-template-columns:var(--grid-cols)]", style: style, children: children }));
|
|
120
152
|
}
|
|
121
|
-
export function DefaultGridCell({ span, width, children }) {
|
|
153
|
+
export function DefaultGridCell({ span, width, hideOnNarrow, children }) {
|
|
122
154
|
const insideDrawerBody = useContext(DrawerBodyContext);
|
|
123
155
|
if (width !== undefined) {
|
|
124
|
-
return (_jsx("div", { className: cn("min-w-0 max-w-full", width === "full" && "sm:[grid-column:1/-1]", insideDrawerBody
|
|
156
|
+
return (_jsx("div", { className: cn("min-w-0 max-w-full", hideOnNarrow === true && "max-sm:hidden", width === "full" && "sm:[grid-column:1/-1]", insideDrawerBody
|
|
125
157
|
? (DRAWER_FIELD_CELL_WIDTH_CLASS[width] ?? FIELD_CELL_WIDTH_CLASS[width])
|
|
126
158
|
: FIELD_CELL_WIDTH_CLASS[width]), children: children }));
|
|
127
159
|
}
|
|
@@ -129,9 +161,14 @@ export function DefaultGridCell({ span, width, children }) {
|
|
|
129
161
|
// Below `sm` the grid has one explicit column (see DefaultGrid); an unconditional
|
|
130
162
|
// `span N` there would add implicit auto columns that squeeze the fr column.
|
|
131
163
|
const style = { "--grid-span": s };
|
|
132
|
-
return (_jsx("div", { className: "min-w-0 sm:[grid-column:span_var(--grid-span)]", style: style, children: children }));
|
|
164
|
+
return (_jsx("div", { className: cn("min-w-0 sm:[grid-column:span_var(--grid-span)]", hideOnNarrow === true && "max-sm:hidden"), style: style, children: children }));
|
|
133
165
|
}
|
|
134
|
-
export function DefaultText({ variant = "body", decorative, children, testId, }) {
|
|
166
|
+
export function DefaultText({ variant = "body", decorative, concealed, narrow, children, testId, }) {
|
|
167
|
+
if (narrow !== undefined)
|
|
168
|
+
return _jsx(NarrowText, { text: children, narrow: narrow });
|
|
169
|
+
if (concealed === true) {
|
|
170
|
+
return (_jsxs("span", { "data-testid": testId, "data-concealed": "", className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [_jsx(Icon, { name: "lock", className: "size-3.5 shrink-0" }), children] }));
|
|
171
|
+
}
|
|
135
172
|
switch (variant) {
|
|
136
173
|
case "code":
|
|
137
174
|
return (_jsx("code", { "data-testid": testId, className: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm", children: children }));
|
|
@@ -3,7 +3,7 @@ import type { FormWidth } from "../../index.ts";
|
|
|
3
3
|
export type ScreenWidth = FormWidth;
|
|
4
4
|
export declare const screenWidthClassName: Record<ScreenWidth, string>;
|
|
5
5
|
export declare const screenFormColumnWidthClassName: Record<ScreenWidth, string>;
|
|
6
|
-
export declare const screenPaddingClassName = "px-4 pb-6 pt-5 md:px-
|
|
6
|
+
export declare const screenPaddingClassName = "px-4 pb-6 pt-5 md:px-6 md:pb-10 md:pt-7";
|
|
7
7
|
export declare const screenDockedBottomClassName = "sticky -bottom-6 -mb-6 mt-auto bg-card pb-6 md:-bottom-10 md:-mb-10 md:pb-10";
|
|
8
8
|
declare const STACK_GAP: {
|
|
9
9
|
readonly sm: "gap-2";
|
|
@@ -20,7 +20,7 @@ export const screenFormColumnWidthClassName = {
|
|
|
20
20
|
// is the one the settings screens use, so a list, a dashboard and a form start
|
|
21
21
|
// at the same edge. The bottom inset keeps the last field or table row off the
|
|
22
22
|
// viewport edge.
|
|
23
|
-
export const screenPaddingClassName = "px-4 pb-6 pt-5 md:px-
|
|
23
|
+
export const screenPaddingClassName = "px-4 pb-6 pt-5 md:px-6 md:pb-10 md:pt-7";
|
|
24
24
|
// Sticky element at the bottom of a screen scroll that covers the bottom padding of
|
|
25
25
|
// screenPaddingClassName (sticky stops at the content box) and overlaps it at rest (negative margin).
|
|
26
26
|
// Keep offsets, margin and padding in step with it; bg-card is the surface of the main content area.
|