@mgamadeus/ddd-admin-ui 0.1.0-rc.4 → 0.1.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/ddd-admin-ui-specialist/SKILL.md +39 -4
- package/CHANGELOG.md +111 -0
- package/README.md +34 -10
- package/STANDARDS.md +118 -22
- package/dist/components.css +2 -2
- package/dist/form/DrawerFooter.d.ts +9 -1
- package/dist/form/DrawerFooter.d.ts.map +1 -1
- package/dist/form/DrawerFooter.js +33 -32
- package/dist/form/DrawerFooter.js.map +1 -1
- package/dist/form/FormActions.d.ts +18 -13
- package/dist/form/FormActions.d.ts.map +1 -1
- package/dist/form/FormActions.js +110 -33
- package/dist/form/FormActions.js.map +1 -1
- package/dist/form/FormDialog.d.ts +51 -0
- package/dist/form/FormDialog.d.ts.map +1 -0
- package/dist/form/FormDialog.js +75 -0
- package/dist/form/FormDialog.js.map +1 -0
- package/dist/form/FormHeader.d.ts +6 -1
- package/dist/form/FormHeader.d.ts.map +1 -1
- package/dist/form/FormHeader.js +1 -1
- package/dist/form/FormHeader.js.map +1 -1
- package/dist/form/FormSubmitButton.d.ts +6 -1
- package/dist/form/FormSubmitButton.d.ts.map +1 -1
- package/dist/form/FormSubmitButton.js +5 -2
- package/dist/form/FormSubmitButton.js.map +1 -1
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +1 -0
- package/dist/form/index.js.map +1 -1
- package/dist/form/linkSubmitButtons.d.ts +7 -0
- package/dist/form/linkSubmitButtons.d.ts.map +1 -0
- package/dist/form/linkSubmitButtons.js +27 -0
- package/dist/form/linkSubmitButtons.js.map +1 -0
- package/dist/form/saveShortcut.d.ts +25 -0
- package/dist/form/saveShortcut.d.ts.map +1 -0
- package/dist/form/saveShortcut.js +59 -0
- package/dist/form/saveShortcut.js.map +1 -0
- package/dist/form/useConfirmDialog.d.ts +3 -2
- package/dist/form/useConfirmDialog.d.ts.map +1 -1
- package/dist/form/useConfirmDialog.js +21 -18
- package/dist/form/useConfirmDialog.js.map +1 -1
- package/dist/i18n/hints.json +13 -7
- package/dist/i18n-keys.json +64 -10
- package/dist/list/Combobox.d.ts +33 -3
- package/dist/list/Combobox.d.ts.map +1 -1
- package/dist/list/Combobox.js +71 -13
- package/dist/list/Combobox.js.map +1 -1
- package/dist/list/CopyButton.d.ts +23 -0
- package/dist/list/CopyButton.d.ts.map +1 -0
- package/dist/list/CopyButton.js +28 -0
- package/dist/list/CopyButton.js.map +1 -0
- package/dist/list/EntityListBody.d.ts +2 -2
- package/dist/list/EntityListBody.d.ts.map +1 -1
- package/dist/list/EntityListBody.js +2 -2
- package/dist/list/EntityListBody.js.map +1 -1
- package/dist/list/EntityListBulkBar.d.ts +7 -1
- package/dist/list/EntityListBulkBar.d.ts.map +1 -1
- package/dist/list/EntityListBulkBar.js +5 -1
- package/dist/list/EntityListBulkBar.js.map +1 -1
- package/dist/list/EntityListEmpty.d.ts +6 -1
- package/dist/list/EntityListEmpty.d.ts.map +1 -1
- package/dist/list/EntityListEmpty.js +4 -1
- package/dist/list/EntityListEmpty.js.map +1 -1
- package/dist/list/EntityListTable.d.ts +3 -1
- package/dist/list/EntityListTable.d.ts.map +1 -1
- package/dist/list/EntityListTable.js +4 -4
- package/dist/list/EntityListTable.js.map +1 -1
- package/dist/list/filters.d.ts +8 -1
- package/dist/list/filters.d.ts.map +1 -1
- package/dist/list/filters.js +5 -2
- package/dist/list/filters.js.map +1 -1
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.d.ts.map +1 -1
- package/dist/list/index.js +1 -0
- package/dist/list/index.js.map +1 -1
- package/dist/logic/browser/storage.d.ts +17 -0
- package/dist/logic/browser/storage.d.ts.map +1 -0
- package/dist/logic/browser/storage.js +40 -0
- package/dist/logic/browser/storage.js.map +1 -0
- package/dist/logic/index.d.ts +14 -0
- package/dist/logic/index.d.ts.map +1 -1
- package/dist/logic/index.js +8 -0
- package/dist/logic/index.js.map +1 -1
- package/dist/logic/pure/confirm.d.ts +16 -0
- package/dist/logic/pure/confirm.d.ts.map +1 -1
- package/dist/logic/pure/confirm.js +12 -0
- package/dist/logic/pure/confirm.js.map +1 -1
- package/dist/logic/pure/confirmQueue.d.ts +27 -0
- package/dist/logic/pure/confirmQueue.d.ts.map +1 -0
- package/dist/logic/pure/confirmQueue.js +52 -0
- package/dist/logic/pure/confirmQueue.js.map +1 -0
- package/dist/logic/pure/dateInput.d.ts +21 -0
- package/dist/logic/pure/dateInput.d.ts.map +1 -0
- package/dist/logic/pure/dateInput.js +79 -0
- package/dist/logic/pure/dateInput.js.map +1 -0
- package/dist/logic/pure/stickyParams.d.ts +10 -0
- package/dist/logic/pure/stickyParams.d.ts.map +1 -0
- package/dist/logic/pure/stickyParams.js +31 -0
- package/dist/logic/pure/stickyParams.js.map +1 -0
- package/dist/logic/pure/writeAccess.d.ts +18 -0
- package/dist/logic/pure/writeAccess.d.ts.map +1 -0
- package/dist/logic/pure/writeAccess.js +14 -0
- package/dist/logic/pure/writeAccess.js.map +1 -0
- package/dist/logic/react/useConfirm.d.ts +14 -0
- package/dist/logic/react/useConfirm.d.ts.map +1 -0
- package/dist/logic/react/useConfirm.js +16 -0
- package/dist/logic/react/useConfirm.js.map +1 -0
- package/dist/logic/react/useLatestSearch.d.ts +18 -0
- package/dist/logic/react/useLatestSearch.d.ts.map +1 -0
- package/dist/logic/react/useLatestSearch.js +37 -0
- package/dist/logic/react/useLatestSearch.js.map +1 -0
- package/dist/logic/react/useRowSelection.d.ts +12 -2
- package/dist/logic/react/useRowSelection.d.ts.map +1 -1
- package/dist/logic/react/useRowSelection.js +16 -8
- package/dist/logic/react/useRowSelection.js.map +1 -1
- package/dist/logic/react/writeAccess.d.ts +18 -0
- package/dist/logic/react/writeAccess.d.ts.map +1 -0
- package/dist/logic/react/writeAccess.js +18 -0
- package/dist/logic/react/writeAccess.js.map +1 -0
- package/dist/next/storage.d.ts +2 -10
- package/dist/next/storage.d.ts.map +1 -1
- package/dist/next/storage.js +2 -33
- package/dist/next/storage.js.map +1 -1
- package/dist/page/DefinitionList.d.ts +7 -2
- package/dist/page/DefinitionList.d.ts.map +1 -1
- package/dist/page/DefinitionList.js +4 -1
- package/dist/page/DefinitionList.js.map +1 -1
- package/dist/page/DetailHeader.d.ts +6 -1
- package/dist/page/DetailHeader.d.ts.map +1 -1
- package/dist/page/DetailHeader.js +3 -3
- package/dist/page/DetailHeader.js.map +1 -1
- package/dist/page/EntityDetailShell.d.ts +8 -2
- package/dist/page/EntityDetailShell.d.ts.map +1 -1
- package/dist/page/EntityDetailShell.js +6 -4
- package/dist/page/EntityDetailShell.js.map +1 -1
- package/dist/page/EntityListPage.d.ts +3 -1
- package/dist/page/EntityListPage.d.ts.map +1 -1
- package/dist/page/EntityListPage.js +1 -1
- package/dist/page/EntityListPage.js.map +1 -1
- package/dist/page/EntityTabs.d.ts +2 -2
- package/dist/page/EntityTabs.d.ts.map +1 -1
- package/dist/page/EntityTabs.js +3 -2
- package/dist/page/EntityTabs.js.map +1 -1
- package/dist/page/PageFrame.d.ts +6 -1
- package/dist/page/PageFrame.d.ts.map +1 -1
- package/dist/page/PageFrame.js +1 -1
- package/dist/page/PageFrame.js.map +1 -1
- package/dist/page/PageToolbar.d.ts +4 -3
- package/dist/page/PageToolbar.d.ts.map +1 -1
- package/dist/page/PageToolbar.js +9 -4
- package/dist/page/PageToolbar.js.map +1 -1
- package/dist/page/SectionHeader.d.ts +1 -1
- package/dist/page/SectionHeader.d.ts.map +1 -1
- package/dist/page/links.d.ts +2 -17
- package/dist/page/links.d.ts.map +1 -1
- package/dist/page/links.js +3 -3
- package/dist/page/links.js.map +1 -1
- package/dist/primitives/alert.d.ts +1 -1
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/breadcrumb.d.ts.map +1 -1
- package/dist/primitives/breadcrumb.js +7 -0
- package/dist/primitives/breadcrumb.js.map +1 -1
- package/dist/primitives/command.js +1 -1
- package/dist/primitives/command.js.map +1 -1
- package/dist/primitives/confirmDialogView.d.ts +29 -0
- package/dist/primitives/confirmDialogView.d.ts.map +1 -0
- package/dist/primitives/confirmDialogView.js +63 -0
- package/dist/primitives/confirmDialogView.js.map +1 -0
- package/dist/primitives/formActionsSlot.d.ts +24 -0
- package/dist/primitives/formActionsSlot.d.ts.map +1 -0
- package/dist/primitives/formActionsSlot.js +51 -0
- package/dist/primitives/formActionsSlot.js.map +1 -0
- package/dist/primitives/index.d.ts +3 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/link.d.ts +28 -0
- package/dist/primitives/link.d.ts.map +1 -0
- package/dist/primitives/link.js +15 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/segmented-control.d.ts +8 -0
- package/dist/primitives/segmented-control.d.ts.map +1 -1
- package/dist/primitives/segmented-control.js +24 -6
- package/dist/primitives/segmented-control.js.map +1 -1
- package/dist/provider/AdminUiProvider.d.ts +4 -3
- package/dist/provider/AdminUiProvider.d.ts.map +1 -1
- package/dist/provider/AdminUiProvider.js +12 -5
- package/dist/provider/AdminUiProvider.js.map +1 -1
- package/dist/provider/ConfirmHost.d.ts +10 -0
- package/dist/provider/ConfirmHost.d.ts.map +1 -0
- package/dist/provider/ConfirmHost.js +19 -0
- package/dist/provider/ConfirmHost.js.map +1 -0
- package/dist/provider/types.d.ts +12 -0
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/showcase/coverage.d.ts.map +1 -1
- package/dist/showcase/coverage.js +6 -3
- package/dist/showcase/coverage.js.map +1 -1
- package/dist/showcase/sections/FormShowcase.d.ts.map +1 -1
- package/dist/showcase/sections/FormShowcase.js +41 -5
- package/dist/showcase/sections/FormShowcase.js.map +1 -1
- package/dist/showcase/sections/ListShowcase.d.ts.map +1 -1
- package/dist/showcase/sections/ListShowcase.js +36 -6
- package/dist/showcase/sections/ListShowcase.js.map +1 -1
- package/dist/showcase/sections/PageShowcase.d.ts.map +1 -1
- package/dist/showcase/sections/PageShowcase.js +5 -1
- package/dist/showcase/sections/PageShowcase.js.map +1 -1
- package/dist/showcase/sections/PrimitivesShowcase.d.ts.map +1 -1
- package/dist/showcase/sections/PrimitivesShowcase.js +2 -2
- package/dist/showcase/sections/PrimitivesShowcase.js.map +1 -1
- package/dist/translations/TranslationControls.d.ts.map +1 -1
- package/dist/translations/TranslationControls.js +8 -6
- package/dist/translations/TranslationControls.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useFormState } from 'react-hook-form';
|
|
4
|
+
import { useWriteAccess } from "../logic/react/writeAccess.js";
|
|
4
5
|
import { Button } from "../primitives/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* The form's primary button: `type="submit"`, disabled and relabelled while the submit is pending. Label standard:
|
|
7
8
|
* `Save` / `Saving…` on edit, `Create <Entity>` / `Creating <Entity>…` on create.
|
|
8
9
|
*/
|
|
9
|
-
export const FormSubmitButton = ({ children, pendingLabel, disabled = false, isPending = false, className, }) => {
|
|
10
|
+
export const FormSubmitButton = ({ children, pendingLabel, disabled = false, isPending = false, ignoreWriteAccess = false, className, }) => {
|
|
10
11
|
const { isSubmitting } = useFormState();
|
|
12
|
+
const writeAccess = useWriteAccess();
|
|
11
13
|
const pending = isSubmitting || isPending;
|
|
12
|
-
|
|
14
|
+
const writeBlocked = !ignoreWriteAccess && !writeAccess.allowed;
|
|
15
|
+
return (_jsx(Button, { type: "submit", disabled: disabled || pending || writeBlocked, title: writeBlocked ? writeAccess.reason : undefined, className: className, children: pending && pendingLabel ? pendingLabel : children }));
|
|
13
16
|
};
|
|
14
17
|
//# sourceMappingURL=FormSubmitButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormSubmitButton.js","sourceRoot":"","sources":["../../src/form/FormSubmitButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"FormSubmitButton.js","sourceRoot":"","sources":["../../src/form/FormSubmitButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAkBhD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,QAAQ,EACR,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,iBAAiB,GAAG,KAAK,EACzB,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,YAAY,IAAI,SAAS,CAAC;IAC1C,MAAM,YAAY,GAAG,CAAC,iBAAiB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IAChE,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,IAAI,OAAO,IAAI,YAAY,EAC7C,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACpD,SAAS,EAAE,SAAS,YAEnB,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,GAC3C,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/form/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export { Form, VisibleWhen } from './Form.js';
|
|
|
11
11
|
export type { FormProps, VisibleWhenProps } from './Form.js';
|
|
12
12
|
export { FormActions } from './FormActions.js';
|
|
13
13
|
export type { FormActionsProps } from './FormActions.js';
|
|
14
|
+
export { FormDialog } from './FormDialog.js';
|
|
15
|
+
export type { FormDialogProps } from './FormDialog.js';
|
|
14
16
|
export { FormDrawer } from './FormDrawer.js';
|
|
15
17
|
export type { FormDrawerProps } from './FormDrawer.js';
|
|
16
18
|
export { FormErrors } from './FormErrors.js';
|
package/dist/form/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,OAAO,EACP,SAAS,EACT,GAAG,EACH,YAAY,EACZ,SAAS,GACV,MAAM,6BAA6B,CAAC;AACrC,6FAA6F;AAC7F,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC1F,kGAAkG;AAClG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAA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
|
export { useIsInDrawer } from "./drawerSlots.js";
|
|
7
7
|
export { Form, VisibleWhen } from "./Form.js";
|
|
8
8
|
export { FormActions } from "./FormActions.js";
|
|
9
|
+
export { FormDialog } from "./FormDialog.js";
|
|
9
10
|
export { FormDrawer } from "./FormDrawer.js";
|
|
10
11
|
export { FormErrors } from "./FormErrors.js";
|
|
11
12
|
export { FormField, FormFieldFrame, FormSection } from "./FormField.js";
|
package/dist/form/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,OAAO,EACP,SAAS,EACT,GAAG,EACH,YAAY,EACZ,SAAS,GACV,MAAM,6BAA6B,CAAC;AAGrC,kGAAkG;AAClG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAY,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAiB,CAAC;AAQzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAkB,CAAC;AAE9C,OAAO,EAAE,gBAAgB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
|
|
|
1
|
+
/**
|
|
2
|
+
* Content portalled out of its `<form>` (a drawer's footer, a header slot) keeps submitting it: every submit button in
|
|
3
|
+
* `content` without its own `form` attribute is linked to `form` (an id is given to a form without one), also buttons
|
|
4
|
+
* that mount later.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useLinkedSubmitButtons: (content: HTMLElement | null, form: HTMLFormElement | null, fallbackFormId: string) => void;
|
|
7
|
+
//# sourceMappingURL=linkSubmitButtons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkSubmitButtons.d.ts","sourceRoot":"","sources":["../../src/form/linkSubmitButtons.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,WAAW,GAAG,IAAI,EAC3B,MAAM,eAAe,GAAG,IAAI,EAC5B,gBAAgB,MAAM,SAiBvB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useLayoutEffect } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Content portalled out of its `<form>` (a drawer's footer, a header slot) keeps submitting it: every submit button in
|
|
5
|
+
* `content` without its own `form` attribute is linked to `form` (an id is given to a form without one), also buttons
|
|
6
|
+
* that mount later.
|
|
7
|
+
*/
|
|
8
|
+
export const useLinkedSubmitButtons = (content, form, fallbackFormId) => {
|
|
9
|
+
useLayoutEffect(() => {
|
|
10
|
+
const element = content;
|
|
11
|
+
if (!form || !element)
|
|
12
|
+
return;
|
|
13
|
+
if (!form.id)
|
|
14
|
+
form.id = fallbackFormId;
|
|
15
|
+
const linkSubmitButtons = () => {
|
|
16
|
+
for (const button of element.querySelectorAll('button')) {
|
|
17
|
+
if (button.type === 'submit' && !button.hasAttribute('form'))
|
|
18
|
+
button.setAttribute('form', form.id);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
linkSubmitButtons();
|
|
22
|
+
const observer = new MutationObserver(linkSubmitButtons);
|
|
23
|
+
observer.observe(element, { childList: true, subtree: true });
|
|
24
|
+
return () => observer.disconnect();
|
|
25
|
+
}, [content, form, fallbackFormId]);
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=linkSubmitButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkSubmitButtons.js","sourceRoot":"","sources":["../../src/form/linkSubmitButtons.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAA2B,EAC3B,IAA4B,EAC5B,cAAsB,EACtB,EAAE;IACF,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QAC9B,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC;QAEvC,MAAM,iBAAiB,GAAG,GAAG,EAAE;YAC7B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACxD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;oBAAE,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YACrG,CAAC;QACH,CAAC,CAAC;QACF,iBAAiB,EAAE,CAAC;QACpB,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QACzD,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The containers the shortcut keeps to: dialogs and drawers. */
|
|
2
|
+
export declare const SAVE_SHORTCUT_CONTAINER_SELECTOR = "[role=\"dialog\"],[role=\"alertdialog\"]";
|
|
3
|
+
export interface SaveShortcutTargets {
|
|
4
|
+
form: HTMLFormElement | null;
|
|
5
|
+
/** The actions element (may be portalled out of the form: a drawer footer, a header slot). */
|
|
6
|
+
actions: HTMLElement | null;
|
|
7
|
+
}
|
|
8
|
+
type SubmitControl = HTMLButtonElement | HTMLInputElement;
|
|
9
|
+
/** The actions' own submit button linked to `form`, else any submit button the form owns (`form.elements`). */
|
|
10
|
+
export declare const findShortcutSubmitter: (form: HTMLFormElement, actions: HTMLElement | null) => SubmitControl | null;
|
|
11
|
+
/**
|
|
12
|
+
* Whether ⌘S / Ctrl+S with focus on `target` belongs to this form. In a dialog or drawer: anywhere inside the
|
|
13
|
+
* innermost container holding the target, when that is the actions' (or the form's) container. Elsewhere: focus in
|
|
14
|
+
* the form, on the actions, or nowhere (`body`, `documentElement`).
|
|
15
|
+
*/
|
|
16
|
+
export declare const isSaveShortcutInScope: (target: EventTarget | null, { form, actions }: SaveShortcutTargets) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* ⌘S / Ctrl+S submits the form, listened for on `document` (`isSaveShortcutInScope`). In scope it calls
|
|
19
|
+
* `preventDefault` (also while the submit button is disabled: nothing is submitted then); an event already
|
|
20
|
+
* `defaultPrevented` is left alone, so of two forms only one answers. Submits with
|
|
21
|
+
* `form.requestSubmit(findShortcutSubmitter(…))`, so the form's validation and `onSubmit` run.
|
|
22
|
+
*/
|
|
23
|
+
export declare const useSaveShortcut: (getTargets: () => SaveShortcutTargets) => void;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=saveShortcut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveShortcut.d.ts","sourceRoot":"","sources":["../../src/form/saveShortcut.ts"],"names":[],"mappings":"AAIA,iEAAiE;AACjE,eAAO,MAAM,gCAAgC,6CAAyC,CAAC;AAEvF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B,8FAA8F;IAC9F,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B;AAKD,KAAK,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAM1D,+GAA+G;AAC/G,eAAO,MAAM,qBAAqB,GAAI,MAAM,eAAe,EAAE,SAAS,WAAW,GAAG,IAAI,KAAG,aAAa,GAAG,IAO1G,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,WAAW,GAAG,IAAI,EAAE,mBAAmB,mBAAmB,KAAG,OAS1G,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,mBAAmB,SAgBpE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
/** The containers the shortcut keeps to: dialogs and drawers. */
|
|
4
|
+
export const SAVE_SHORTCUT_CONTAINER_SELECTOR = '[role="dialog"],[role="alertdialog"]';
|
|
5
|
+
const isSaveKey = (event) => (event.metaKey || event.ctrlKey) && !event.altKey && typeof event.key === 'string' && event.key.toLowerCase() === 's';
|
|
6
|
+
const isSubmitControl = (element) => (element instanceof HTMLButtonElement && element.type === 'submit') ||
|
|
7
|
+
(element instanceof HTMLInputElement && (element.type === 'submit' || element.type === 'image'));
|
|
8
|
+
/** The actions' own submit button linked to `form`, else any submit button the form owns (`form.elements`). */
|
|
9
|
+
export const findShortcutSubmitter = (form, actions) => {
|
|
10
|
+
const own = actions
|
|
11
|
+
? [...actions.querySelectorAll('button, input')].find((element) => isSubmitControl(element) && element.form === form)
|
|
12
|
+
: undefined;
|
|
13
|
+
return own ?? [...form.elements].find(isSubmitControl) ?? null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Whether ⌘S / Ctrl+S with focus on `target` belongs to this form. In a dialog or drawer: anywhere inside the
|
|
17
|
+
* innermost container holding the target, when that is the actions' (or the form's) container. Elsewhere: focus in
|
|
18
|
+
* the form, on the actions, or nowhere (`body`, `documentElement`).
|
|
19
|
+
*/
|
|
20
|
+
export const isSaveShortcutInScope = (target, { form, actions }) => {
|
|
21
|
+
if (!form)
|
|
22
|
+
return false;
|
|
23
|
+
const element = target instanceof Element ? target : null;
|
|
24
|
+
const container = actions?.closest(SAVE_SHORTCUT_CONTAINER_SELECTOR) ?? form.closest(SAVE_SHORTCUT_CONTAINER_SELECTOR);
|
|
25
|
+
if (container)
|
|
26
|
+
return element !== null && element.closest(SAVE_SHORTCUT_CONTAINER_SELECTOR) === container;
|
|
27
|
+
if (element === null || element === document.body || element === document.documentElement)
|
|
28
|
+
return true;
|
|
29
|
+
if (form.contains(element) || (actions?.contains(element) ?? false))
|
|
30
|
+
return true;
|
|
31
|
+
return 'form' in element && element.form === form;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* ⌘S / Ctrl+S submits the form, listened for on `document` (`isSaveShortcutInScope`). In scope it calls
|
|
35
|
+
* `preventDefault` (also while the submit button is disabled: nothing is submitted then); an event already
|
|
36
|
+
* `defaultPrevented` is left alone, so of two forms only one answers. Submits with
|
|
37
|
+
* `form.requestSubmit(findShortcutSubmitter(…))`, so the form's validation and `onSubmit` run.
|
|
38
|
+
*/
|
|
39
|
+
export const useSaveShortcut = (getTargets) => {
|
|
40
|
+
const latest = useRef(getTargets);
|
|
41
|
+
latest.current = getTargets;
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const onKeyDown = (event) => {
|
|
44
|
+
if (event.defaultPrevented || !isSaveKey(event))
|
|
45
|
+
return;
|
|
46
|
+
const targets = latest.current();
|
|
47
|
+
const form = targets.form;
|
|
48
|
+
if (!form || !form.isConnected || !isSaveShortcutInScope(event.target, targets))
|
|
49
|
+
return;
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
const submitter = findShortcutSubmitter(form, targets.actions);
|
|
52
|
+
if (submitter && !submitter.disabled)
|
|
53
|
+
form.requestSubmit(submitter);
|
|
54
|
+
};
|
|
55
|
+
document.addEventListener('keydown', onKeyDown);
|
|
56
|
+
return () => document.removeEventListener('keydown', onKeyDown);
|
|
57
|
+
}, []);
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=saveShortcut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saveShortcut.js","sourceRoot":"","sources":["../../src/form/saveShortcut.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,iEAAiE;AACjE,MAAM,CAAC,MAAM,gCAAgC,GAAG,sCAAsC,CAAC;AAQvF,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE,CACzC,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC;AAIxH,MAAM,eAAe,GAAG,CAAC,OAAgB,EAA4B,EAAE,CACrE,CAAC,OAAO,YAAY,iBAAiB,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC;IACnE,CAAC,OAAO,YAAY,gBAAgB,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC;AAEnG,+GAA+G;AAC/G,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAqB,EAAE,OAA2B,EAAwB,EAAE;IAChH,MAAM,GAAG,GAAG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,MAAM,eAAe,GAAG,CAAC,UAAqC,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC;IAC5B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE;YACzC,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAAE,OAAO;YACxD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAC1B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;gBAAE,OAAO;YACxF,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,SAAS,GAAG,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/D,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,QAAQ;gBAAE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACtE,CAAC,CAAC;QACF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAClE,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC"}
|
|
@@ -2,8 +2,9 @@ import type { ConfirmDialogApi } from '../logic/pure/confirm.js';
|
|
|
2
2
|
/** @deprecated moved to logic/pure/confirm — the re-export is removed in a later minor */
|
|
3
3
|
export type { ConfirmDialogApi, ConfirmOptions } from '../logic/pure/confirm.js';
|
|
4
4
|
/**
|
|
5
|
-
* A promise-returning confirmation, as a hook:
|
|
6
|
-
*
|
|
5
|
+
* A promise-returning confirmation, as a hook: the dialog renders where the hook's `dialog` is placed. A new call while
|
|
6
|
+
* one is open answers the open one `false`. Screens below `AdminUiProvider` use `useConfirm()` (`./logic`) instead:
|
|
7
|
+
* nothing to render, calls queue. Dialogs are only for confirmations.
|
|
7
8
|
*/
|
|
8
9
|
export declare const useConfirmDialog: () => ConfirmDialogApi;
|
|
9
10
|
//# sourceMappingURL=useConfirmDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfirmDialog.d.ts","sourceRoot":"","sources":["../../src/form/useConfirmDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useConfirmDialog.d.ts","sourceRoot":"","sources":["../../src/form/useConfirmDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,0BAA0B,CAAC;AAEjF,0FAA0F;AAC1F,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,gBAuBnC,CAAC"}
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useRef, useState } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { useTranslate } from "../i18n/index.js";
|
|
4
|
+
import { ConfirmDialogView } from "../primitives/confirmDialogView.js";
|
|
6
5
|
/**
|
|
7
|
-
* A promise-returning confirmation, as a hook:
|
|
8
|
-
*
|
|
6
|
+
* A promise-returning confirmation, as a hook: the dialog renders where the hook's `dialog` is placed. A new call while
|
|
7
|
+
* one is open answers the open one `false`. Screens below `AdminUiProvider` use `useConfirm()` (`./logic`) instead:
|
|
8
|
+
* nothing to render, calls queue. Dialogs are only for confirmations.
|
|
9
9
|
*/
|
|
10
10
|
export const useConfirmDialog = () => {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const settle = useCallback((confirmed) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const [entry, setEntry] = useState(null);
|
|
12
|
+
const pending = useRef(null);
|
|
13
|
+
const nextId = useRef(1);
|
|
14
|
+
const settle = useCallback((id, confirmed) => {
|
|
15
|
+
if (pending.current?.id !== id)
|
|
16
|
+
return;
|
|
17
|
+
pending.current.resolve(confirmed);
|
|
18
|
+
pending.current = null;
|
|
19
|
+
setEntry(null);
|
|
18
20
|
}, []);
|
|
19
|
-
const confirm = useCallback((
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const confirm = useCallback((options) => {
|
|
22
|
+
pending.current?.resolve(false);
|
|
23
|
+
const id = nextId.current;
|
|
24
|
+
nextId.current += 1;
|
|
25
|
+
setEntry({ id, options });
|
|
22
26
|
return new Promise(resolve => {
|
|
23
|
-
|
|
27
|
+
pending.current = { id, resolve };
|
|
24
28
|
});
|
|
25
29
|
}, []);
|
|
26
|
-
|
|
27
|
-
return { confirm, dialog };
|
|
30
|
+
return { confirm, dialog: _jsx(ConfirmDialogView, { entry: entry, onSettle: settle }) };
|
|
28
31
|
};
|
|
29
32
|
//# sourceMappingURL=useConfirmDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfirmDialog.js","sourceRoot":"","sources":["../../src/form/useConfirmDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,
|
|
1
|
+
{"version":3,"file":"useConfirmDialog.js","sourceRoot":"","sources":["../../src/form/useConfirmDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAA+B,MAAM,oCAAqC,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23
23
|
"Bulk actions": "Accessible name (screen-reader label) of the toolbar that appears above a list when rows are selected, holding actions that apply to all selected rows.",
|
|
24
24
|
"Cancel": "Button at the bottom of the world form that discards the entries and returns to the world list; asks for confirmation if there are unsaved changes.",
|
|
25
25
|
"Cancel__confirm-dialog": "Button on the left of a generic confirmation dialog that dismisses it without doing the action. Shown when the caller did not set its own label.",
|
|
26
|
+
"Cancel__form-dialog": "Button on the left of a dialog that holds a short form (rename, create, delete with a reason); closes the dialog without saving. Asks first when the form has unsaved changes. Shown when the caller did not set its own label.",
|
|
27
|
+
"Type “%phrase%” to confirm": "Label above the text field of a confirmation dialog for an irreversible step; the confirm button stays off until the user types the phrase exactly. %phrase% is the phrase to type (for example the name of the item to delete). Keep the quotation marks around it.",
|
|
26
28
|
"Cancel__media-picker": "Footer button of the media picker dialog; click to close the dialog without changing the chosen media item.",
|
|
27
|
-
"Cancelled": "Status badge label (short pill) in lists, cards and detail views, describing the state of a partner contract. Keep it short, like a status word.",
|
|
28
29
|
"Change__media-field-action": "Button label under a media field preview; click to open the picker and replace the currently chosen image. Shown only when an image is already set.",
|
|
29
30
|
"Clear %label%": "Accessible label of the small X button inside a text filter that empties it. %label% is the filter name, e.g. Name or Account ID.",
|
|
30
31
|
"Clear all": "Button at the bottom of a multi-select dropdown that deselects every option in the list.",
|
|
@@ -46,11 +47,9 @@
|
|
|
46
47
|
"Discard changes?": "Title of the confirmation dialog shown when the user closes a form drawer that has unsaved edits. Phrased as a question.",
|
|
47
48
|
"Discard__unsaved-changes-confirm": "Destructive confirm button of the discard dialog; clicking it closes the form and loses the unsaved edits. Imperative verb.",
|
|
48
49
|
"Dismiss": "Button in the AI translation panel that hides the finished progress list of the last translation run. Imperative.",
|
|
49
|
-
"Done": "Status badge of one language in the translation progress list: the translation finished successfully.",
|
|
50
50
|
"Edit__action": "Default accessible name and tooltip of the small pencil icon button in the top-right corner of a settings card; clicking it opens the edit form for that card. Imperative verb.",
|
|
51
51
|
"Enter %language% text…": "Placeholder of a text input in a translatable field; %language% is the name of the active language tab, e.g. 'German'.",
|
|
52
52
|
"Export to Excel": "Sample text of the outline button specimen in the UI showcase; imperative, exports a list as a spreadsheet. Maintenance UI showcase screen, Buttons section.",
|
|
53
|
-
"Failed": "Status badge label (short pill) in lists, cards and detail views, describing the state of a push notification or mail delivery attempt. Keep it short, like a status word. Also used for other status families.",
|
|
54
53
|
"Filters": "Button text in a list toolbar that opens or closes the collapsible panel with extra filters. Hidden on phones, where only the icon shows.",
|
|
55
54
|
"Form sections": "Accessible label (aria-label) of the small sticky navigation bar at the top of a long admin form (challenge, campaign) that jumps between its panels.",
|
|
56
55
|
"Grid view": "Tooltip and accessible label of the icon button in a list toolbar that switches the list to a grid of cards.",
|
|
@@ -80,7 +79,6 @@
|
|
|
80
79
|
"Request contains invalid data": "Title of the red error toast and error box above a form after the server rejected a save because one or more fields are invalid (the fields are listed below it).",
|
|
81
80
|
"Save changes": "Sample text of the primary button specimen in the UI showcase; imperative, a typical save action. Maintenance UI showcase screen, Buttons section.",
|
|
82
81
|
"Search": "Accessible label of a search input field in a list toolbar, read by screen readers. Use the plain noun or verb for searching.",
|
|
83
|
-
"Search for a command to run...": "Hidden (screen-reader only) description of the command palette dialog, telling the user to search for a command or page to run.",
|
|
84
82
|
"Search…": "Placeholder text inside a search box above a list or table, and the generic placeholder of a dropdown's search field. Ends with an ellipsis.",
|
|
85
83
|
"Sections": "Accessible name (screen reader label) of the sub-tab bar below a section heading when the heading is not plain text.",
|
|
86
84
|
"Sections__tab-navigation": "Default accessible name (screen reader label, not visible) of the tab bar under the header of a detail screen, whose tabs switch between sections of the record such as General, Teams or Rides. Plural noun.",
|
|
@@ -111,7 +109,6 @@
|
|
|
111
109
|
"Token authentication failed": "Error message from the server when the login session token is invalid or expired; the user has to sign in again.",
|
|
112
110
|
"Translate to": "Form label above the language chips in the AI translation panel of an admin form; the chips are the target languages.",
|
|
113
111
|
"Translate to selected locales": "Button in the AI translation panel that starts translating the texts into all language chips the user selected. Imperative.",
|
|
114
|
-
"Translating": "Status badge of one language in the translation progress list: the translation request is running right now.",
|
|
115
112
|
"Translating…": "Label of a button while the automatic AI translation is running for the selected languages; progress state, keep the ellipsis.",
|
|
116
113
|
"Translation failed": "Fallback error message shown in the tooltip of a failed language in the translation progress list when the server gave no message.",
|
|
117
114
|
"Unauthorized": "Short error message from the server when the request needs a valid login (session expired or missing); the user has to sign in again.",
|
|
@@ -122,10 +119,19 @@
|
|
|
122
119
|
"Upload__media-picker": "Button in the media picker dialog header; click to choose image files from the computer and upload them as new media items.",
|
|
123
120
|
"Uploading…__media-picker": "Button label in the media picker dialog while selected image files are being uploaded; the button is disabled meanwhile.",
|
|
124
121
|
"View": "Label and accessible name of the toggle on the Home screen that switches between the Timeline and Kanban views.",
|
|
125
|
-
"Waiting": "Short form of the status 'Waiting for Customer', on a compact status button in the support ticket sidebar. Keep it to one short word.",
|
|
126
122
|
"Wrong credentials.": "Error message on the login page when the e-mail address / username or the password is wrong.",
|
|
127
123
|
"Yes": "Option of a yes/no filter in the filter panel of a list; selecting it shows only records where the flag is set.",
|
|
128
124
|
"Yes__boolean-flag": "Default label of a yes/no flag cell in a list table, shown with a green check when the flag is on, e.g. Active column.",
|
|
129
125
|
"You have unsaved changes. Closing now will lose them.": "Body text of the discard confirmation dialog, warning that closing the form drawer throws away the user's unsaved edits.",
|
|
130
|
-
"Row number": "Screen-reader name of the narrow '#' column at the start of a list table that numbers the loaded rows 1, 2, 3 …"
|
|
126
|
+
"Row number": "Screen-reader name of the narrow '#' column at the start of a list table that numbers the loaded rows 1, 2, 3 …",
|
|
127
|
+
"Clear": "Accessible name and tooltip of the small × inside a picker (combobox) that removes the picked value, leaving the field empty.",
|
|
128
|
+
"Copied": "Toast after a copy button put a value (an id, a link, a code) on the clipboard.",
|
|
129
|
+
"Could not copy": "Error toast when the browser refused to put a value on the clipboard (no permission or an insecure page).",
|
|
130
|
+
"Create “%term%”": "Last row of a picker's search list: creates a new entry named by the typed text (%term%) because no existing entry has that name.",
|
|
131
|
+
"Search for a command to run…": "Hidden (screen-reader only) description of the command palette dialog, telling the user to search for a command or page to run.",
|
|
132
|
+
"Waiting__translation-status": "Short form of the status 'Waiting for Customer', on a compact status button in the support ticket sidebar. Keep it to one short word.",
|
|
133
|
+
"Translating__translation-status": "Status badge of one language in the translation progress list: the translation request is running right now.",
|
|
134
|
+
"Done__translation-status": "Status badge of one language in the translation progress list: the translation finished successfully.",
|
|
135
|
+
"Failed__translation-status": "Status badge label (short pill) in lists, cards and detail views, describing the state of a push notification or mail delivery attempt. Keep it short, like a status word. Also used for other status families.",
|
|
136
|
+
"Cancelled__translation-status": "Status badge label (short pill) in lists, cards and detail views, describing the state of a partner contract. Keep it short, like a status word."
|
|
131
137
|
}
|
package/dist/i18n-keys.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@mgamadeus/ddd-admin-ui",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.6",
|
|
4
4
|
"generatedBy": "scripts/build-i18n-manifest.mjs",
|
|
5
5
|
"keys": [
|
|
6
6
|
{
|
|
@@ -129,10 +129,19 @@
|
|
|
129
129
|
"text": "Cancel",
|
|
130
130
|
"context": "confirm-dialog",
|
|
131
131
|
"files": [
|
|
132
|
-
"
|
|
132
|
+
"primitives/confirmDialogView.tsx"
|
|
133
133
|
],
|
|
134
134
|
"hint": "Button on the left of a generic confirmation dialog that dismisses it without doing the action. Shown when the caller did not set its own label."
|
|
135
135
|
},
|
|
136
|
+
{
|
|
137
|
+
"key": "Cancel__form-dialog",
|
|
138
|
+
"text": "Cancel",
|
|
139
|
+
"context": "form-dialog",
|
|
140
|
+
"files": [
|
|
141
|
+
"form/FormDialog.tsx"
|
|
142
|
+
],
|
|
143
|
+
"hint": "Button on the left of a dialog that holds a short form (rename, create, delete with a reason); closes the dialog without saving. Asks first when the form has unsaved changes. Shown when the caller did not set its own label."
|
|
144
|
+
},
|
|
136
145
|
{
|
|
137
146
|
"key": "Cancel__media-picker",
|
|
138
147
|
"text": "Cancel",
|
|
@@ -143,8 +152,9 @@
|
|
|
143
152
|
"hint": "Footer button of the media picker dialog; click to close the dialog without changing the chosen media item."
|
|
144
153
|
},
|
|
145
154
|
{
|
|
146
|
-
"key": "
|
|
155
|
+
"key": "Cancelled__translation-status",
|
|
147
156
|
"text": "Cancelled",
|
|
157
|
+
"context": "translation-status",
|
|
148
158
|
"files": [
|
|
149
159
|
"translations/TranslationControls.tsx"
|
|
150
160
|
],
|
|
@@ -159,6 +169,14 @@
|
|
|
159
169
|
],
|
|
160
170
|
"hint": "Button label under a media field preview; click to open the picker and replace the currently chosen image. Shown only when an image is already set."
|
|
161
171
|
},
|
|
172
|
+
{
|
|
173
|
+
"key": "Clear",
|
|
174
|
+
"text": "Clear",
|
|
175
|
+
"files": [
|
|
176
|
+
"list/Combobox.tsx"
|
|
177
|
+
],
|
|
178
|
+
"hint": "Accessible name and tooltip of the small × inside a picker (combobox) that removes the picked value, leaving the field empty."
|
|
179
|
+
},
|
|
162
180
|
{
|
|
163
181
|
"key": "Clear %label%",
|
|
164
182
|
"text": "Clear %label%",
|
|
@@ -274,10 +292,18 @@
|
|
|
274
292
|
"text": "Confirm",
|
|
275
293
|
"context": "confirm-dialog",
|
|
276
294
|
"files": [
|
|
277
|
-
"
|
|
295
|
+
"primitives/confirmDialogView.tsx"
|
|
278
296
|
],
|
|
279
297
|
"hint": "Button on the right of a generic confirmation dialog that carries out the action asked about. Shown when the caller did not set its own label."
|
|
280
298
|
},
|
|
299
|
+
{
|
|
300
|
+
"key": "Copied",
|
|
301
|
+
"text": "Copied",
|
|
302
|
+
"files": [
|
|
303
|
+
"list/CopyButton.tsx"
|
|
304
|
+
],
|
|
305
|
+
"hint": "Toast after a copy button put a value (an id, a link, a code) on the clipboard."
|
|
306
|
+
},
|
|
281
307
|
{
|
|
282
308
|
"key": "Copy ID",
|
|
283
309
|
"text": "Copy ID",
|
|
@@ -295,6 +321,22 @@
|
|
|
295
321
|
],
|
|
296
322
|
"hint": "Accessible label (screen reader and tooltip) of the small button that copies the record ID to the clipboard, shown in the metadata block of every detail screen. %id% is the record ID, for example 4711 or a UUID. Imperative tone."
|
|
297
323
|
},
|
|
324
|
+
{
|
|
325
|
+
"key": "Could not copy",
|
|
326
|
+
"text": "Could not copy",
|
|
327
|
+
"files": [
|
|
328
|
+
"list/CopyButton.tsx"
|
|
329
|
+
],
|
|
330
|
+
"hint": "Error toast when the browser refused to put a value on the clipboard (no permission or an insecure page)."
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"key": "Create “%term%”",
|
|
334
|
+
"text": "Create “%term%”",
|
|
335
|
+
"files": [
|
|
336
|
+
"list/Combobox.tsx"
|
|
337
|
+
],
|
|
338
|
+
"hint": "Last row of a picker's search list: creates a new entry named by the typed text (%term%) because no existing entry has that name."
|
|
339
|
+
},
|
|
298
340
|
{
|
|
299
341
|
"key": "Created__entity-metadata",
|
|
300
342
|
"text": "Created",
|
|
@@ -331,8 +373,9 @@
|
|
|
331
373
|
"hint": "Button in the AI translation panel that hides the finished progress list of the last translation run. Imperative."
|
|
332
374
|
},
|
|
333
375
|
{
|
|
334
|
-
"key": "
|
|
376
|
+
"key": "Done__translation-status",
|
|
335
377
|
"text": "Done",
|
|
378
|
+
"context": "translation-status",
|
|
336
379
|
"files": [
|
|
337
380
|
"translations/TranslationControls.tsx"
|
|
338
381
|
],
|
|
@@ -364,8 +407,9 @@
|
|
|
364
407
|
"hint": "Sample text of the outline button specimen in the UI showcase; imperative, exports a list as a spreadsheet. Maintenance UI showcase screen, Buttons section."
|
|
365
408
|
},
|
|
366
409
|
{
|
|
367
|
-
"key": "
|
|
410
|
+
"key": "Failed__translation-status",
|
|
368
411
|
"text": "Failed",
|
|
412
|
+
"context": "translation-status",
|
|
369
413
|
"files": [
|
|
370
414
|
"translations/TranslationControls.tsx"
|
|
371
415
|
],
|
|
@@ -620,8 +664,8 @@
|
|
|
620
664
|
"hint": "Accessible label of a search input field in a list toolbar, read by screen readers. Use the plain noun or verb for searching."
|
|
621
665
|
},
|
|
622
666
|
{
|
|
623
|
-
"key": "Search for a command to run
|
|
624
|
-
"text": "Search for a command to run
|
|
667
|
+
"key": "Search for a command to run…",
|
|
668
|
+
"text": "Search for a command to run…",
|
|
625
669
|
"files": [
|
|
626
670
|
"primitives/command.tsx"
|
|
627
671
|
],
|
|
@@ -875,8 +919,9 @@
|
|
|
875
919
|
"hint": "Button in the AI translation panel that starts translating the texts into all language chips the user selected. Imperative."
|
|
876
920
|
},
|
|
877
921
|
{
|
|
878
|
-
"key": "
|
|
922
|
+
"key": "Translating__translation-status",
|
|
879
923
|
"text": "Translating",
|
|
924
|
+
"context": "translation-status",
|
|
880
925
|
"files": [
|
|
881
926
|
"translations/TranslationControls.tsx"
|
|
882
927
|
],
|
|
@@ -899,6 +944,14 @@
|
|
|
899
944
|
],
|
|
900
945
|
"hint": "Fallback error message shown in the tooltip of a failed language in the translation progress list when the server gave no message."
|
|
901
946
|
},
|
|
947
|
+
{
|
|
948
|
+
"key": "Type “%phrase%” to confirm",
|
|
949
|
+
"text": "Type “%phrase%” to confirm",
|
|
950
|
+
"files": [
|
|
951
|
+
"primitives/confirmDialogView.tsx"
|
|
952
|
+
],
|
|
953
|
+
"hint": "Label above the text field of a confirmation dialog for an irreversible step; the confirm button stays off until the user types the phrase exactly. %phrase% is the phrase to type (for example the name of the item to delete). Keep the quotation marks around it."
|
|
954
|
+
},
|
|
902
955
|
{
|
|
903
956
|
"key": "Unauthorized",
|
|
904
957
|
"text": "Unauthorized",
|
|
@@ -967,8 +1020,9 @@
|
|
|
967
1020
|
"hint": "Label and accessible name of the toggle on the Home screen that switches between the Timeline and Kanban views."
|
|
968
1021
|
},
|
|
969
1022
|
{
|
|
970
|
-
"key": "
|
|
1023
|
+
"key": "Waiting__translation-status",
|
|
971
1024
|
"text": "Waiting",
|
|
1025
|
+
"context": "translation-status",
|
|
972
1026
|
"files": [
|
|
973
1027
|
"translations/TranslationControls.tsx"
|
|
974
1028
|
],
|
package/dist/list/Combobox.d.ts
CHANGED
|
@@ -5,10 +5,16 @@ export interface ComboboxOption {
|
|
|
5
5
|
/** Second line in the list (e.g. an id or a parent). */
|
|
6
6
|
description?: string;
|
|
7
7
|
icon?: ReactNode;
|
|
8
|
+
/** Heading the option is listed under; groups keep the order in which they first appear. */
|
|
9
|
+
group?: string;
|
|
10
|
+
/** A small marker after the label (a count, a status). */
|
|
11
|
+
badge?: ReactNode;
|
|
8
12
|
}
|
|
13
|
+
/** Wait (ms) after the last keystroke before `onSearch` runs. */
|
|
14
|
+
export declare const COMBOBOX_SEARCH_DEBOUNCE_MS = 300;
|
|
9
15
|
export interface ComboboxProps {
|
|
10
16
|
options: readonly ComboboxOption[];
|
|
11
|
-
/** `''` = nothing picked. */
|
|
17
|
+
/** `''` = nothing picked (unless an option has the value `''`: then it is an ordinary option). */
|
|
12
18
|
value: string;
|
|
13
19
|
onChange: (value: string) => void;
|
|
14
20
|
placeholder?: string;
|
|
@@ -24,9 +30,33 @@ export interface ComboboxProps {
|
|
|
24
30
|
*/
|
|
25
31
|
shape?: 'field' | 'pill';
|
|
26
32
|
id?: string;
|
|
33
|
+
/** Classes of the trigger; with `clearable`, of the wrapper around trigger and clear button (size it there). */
|
|
27
34
|
className?: string;
|
|
28
35
|
'aria-label'?: string;
|
|
36
|
+
/**
|
|
37
|
+
* A clear control (`value` → `''`) while something is picked; picking the picked option again clears it too. Without
|
|
38
|
+
* it, picking the picked option keeps the value.
|
|
39
|
+
*/
|
|
40
|
+
clearable?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Server search: the block stops filtering and calls this with the typed term, debounced
|
|
43
|
+
* (`COMBOBOX_SEARCH_DEBOUNCE_MS`), and with `''` when the popover closes. Pass the answer as `options` and
|
|
44
|
+
* `isSearching` while a request runs; until the answer to the current term is in, the list shows the searching
|
|
45
|
+
* state, never the previous term's options. Drop answers to older terms (`useLatestSearch` does both).
|
|
46
|
+
*/
|
|
47
|
+
onSearch?: (term: string) => void;
|
|
48
|
+
/** A search request is in flight (with `onSearch`). */
|
|
49
|
+
isSearching?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Offers a "Create “…”" row while the trimmed term matches no option label (case-insensitive). Choosing it calls this
|
|
52
|
+
* with the trimmed term, closes the popover and clears the term; the host creates the entry and sets `value`.
|
|
53
|
+
*/
|
|
54
|
+
onRequestCreate?: (term: string) => void;
|
|
55
|
+
/** The picked option when it is not among `options` (a server search result list without it): its label shows. */
|
|
56
|
+
selectedOption?: ComboboxOption;
|
|
57
|
+
/** Classes of the popover (e.g. a wider list than the trigger). */
|
|
58
|
+
popoverClassName?: string;
|
|
29
59
|
}
|
|
30
|
-
/** Single-choice combobox with a search field
|
|
31
|
-
export declare const Combobox: ({ options: rawOptions, value, onChange, placeholder, searchPlaceholder, emptyMessage, isLoading, disabled, size, shape, id, className, "aria-label": ariaLabel, }: ComboboxProps) => import("react").JSX.Element;
|
|
60
|
+
/** Single-choice combobox with a search field: client-side filtering, or a server search through `onSearch`. */
|
|
61
|
+
export declare const Combobox: ({ options: rawOptions, value, onChange, placeholder, searchPlaceholder, emptyMessage, isLoading, disabled, size, shape, id, className, "aria-label": ariaLabel, clearable, onSearch, isSearching, onRequestCreate, selectedOption, popoverClassName, }: ComboboxProps) => import("react").JSX.Element;
|
|
32
62
|
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../src/list/Combobox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../src/list/Combobox.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAmBpE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAA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