@cratis/components 4.31.0 → 4.33.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/compat-manifest.json +11 -11
- package/dist/esm/CommandDialog/CommandDialog.d.ts +3 -2
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +10 -0
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/DataPage/DataPage.d.ts +8 -0
- package/dist/esm/DataPage/DataPage.d.ts.map +1 -1
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/dist/esm/DataTables/DataTableBody.d.ts +3 -1
- package/dist/esm/DataTables/DataTableBody.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableBody.js +2 -2
- package/dist/esm/DataTables/DataTableBody.js.map +1 -1
- package/dist/esm/DataTables/DataTableCore.d.ts +7 -1
- package/dist/esm/DataTables/DataTableCore.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableCore.js +8 -3
- package/dist/esm/DataTables/DataTableCore.js.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +8 -0
- package/dist/esm/DataTables/DataTableForObservableQuery.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableForObservableQuery.js +2 -2
- package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.d.ts +8 -0
- package/dist/esm/DataTables/DataTableForQuery.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableForQuery.js +2 -2
- package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
- package/dist/esm/DataTables/DataTableMessageOverrides.d.ts +1 -0
- package/dist/esm/DataTables/DataTableMessageOverrides.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableMessageOverrides.js.map +1 -1
- package/dist/esm/DataTables/DataTableMessages.d.ts +2 -0
- package/dist/esm/DataTables/DataTableMessages.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableMessages.js.map +1 -1
- package/dist/esm/DataTables/matchesFilterEntry.d.ts +7 -0
- package/dist/esm/DataTables/matchesFilterEntry.d.ts.map +1 -1
- package/dist/esm/DataTables/matchesFilterEntry.js +3 -1
- package/dist/esm/DataTables/matchesFilterEntry.js.map +1 -1
- package/dist/esm/DataTables/useDataTableMessages.d.ts +2 -1
- package/dist/esm/DataTables/useDataTableMessages.d.ts.map +1 -1
- package/dist/esm/DataTables/useDataTableMessages.js +6 -1
- package/dist/esm/DataTables/useDataTableMessages.js.map +1 -1
- package/dist/esm/DataTables/useServerQuery.d.ts +2 -1
- package/dist/esm/DataTables/useServerQuery.d.ts.map +1 -1
- package/dist/esm/DataTables/useServerQuery.js +2 -1
- package/dist/esm/DataTables/useServerQuery.js.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts +2 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +60 -2
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchesFilterEntry.js","sources":["../../../DataTables/matchesFilterEntry.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n DataTableFilterMatchMode,\n type DataTableFilterConstraint,\n type DataTableFilterEntry,\n} from './DataTableFilterMeta';\nimport { resolveDataTableFilterMatcher } from './DataTableFilterMatcherRegistry';\n\nconst dateNumber = (value: unknown) => {\n // A cloned Date is normalized in place so caller-owned Date instances (row\n // values and filter constraints alike) are never mutated by comparison.\n const date =\n value instanceof Date ? new Date(value.getTime()) : new Date(String(value));\n return Number.isNaN(date.getTime()) ? undefined : date.setHours(0, 0, 0, 0);\n};\n\n/**\n * The first constraint of a filter entry, which is what the column filter menu edits.\n * @param entry The filter entry, if any.\n * @returns Its first constraint, or undefined.\n */\nexport const firstConstraint = (\n entry: DataTableFilterEntry | undefined,\n): DataTableFilterConstraint | undefined =>\n entry && 'constraints' in entry ? entry.constraints[0] : entry;\n\nconst builtInMatches = (\n value: unknown,\n constraint: DataTableFilterConstraint,\n): boolean => {\n const filter = constraint.value;\n const mode = constraint.matchMode ?? DataTableFilterMatchMode.Contains;\n if (filter === null || filter === undefined || filter === '') return true;\n\n const valueText = String(value ?? '').toLocaleLowerCase();\n const filterText = String(filter).toLocaleLowerCase();\n const valueNumber = typeof value === 'number' ? value : Number(value);\n const filterNumber = typeof filter === 'number' ? filter : Number(filter);\n\n switch (mode) {\n case DataTableFilterMatchMode.StartsWith:\n return valueText.startsWith(filterText);\n case DataTableFilterMatchMode.Contains:\n return valueText.includes(filterText);\n case DataTableFilterMatchMode.NotContains:\n return !valueText.includes(filterText);\n case DataTableFilterMatchMode.EndsWith:\n return valueText.endsWith(filterText);\n case DataTableFilterMatchMode.Equals:\n return Object.is(value, filter) || valueText === filterText;\n case DataTableFilterMatchMode.NotEquals:\n return !(Object.is(value, filter) || valueText === filterText);\n case DataTableFilterMatchMode.In:\n return Array.isArray(filter) && filter.some((item) => Object.is(item, value));\n case DataTableFilterMatchMode.Between:\n return (\n Array.isArray(filter) &&\n filter.length >= 2 &&\n valueNumber >= Number(filter[0]) &&\n valueNumber <= Number(filter[1])\n );\n case DataTableFilterMatchMode.LessThan:\n return valueNumber < filterNumber;\n case DataTableFilterMatchMode.LessThanOrEqual:\n return valueNumber <= filterNumber;\n case DataTableFilterMatchMode.GreaterThan:\n return valueNumber > filterNumber;\n case DataTableFilterMatchMode.GreaterThanOrEqual:\n return valueNumber >= filterNumber;\n case DataTableFilterMatchMode.DateIs:\n return dateNumber(value) === dateNumber(filter);\n case DataTableFilterMatchMode.DateIsNot:\n return dateNumber(value) !== dateNumber(filter);\n case DataTableFilterMatchMode.DateBefore:\n return (dateNumber(value) ?? Infinity) < (dateNumber(filter) ?? -Infinity);\n case DataTableFilterMatchMode.DateAfter:\n return (dateNumber(value) ?? -Infinity) > (dateNumber(filter) ?? Infinity);\n default:\n return resolveDataTableFilterMatcher(String(mode))?.(value, filter) ?? false;\n }\n};\n\n/**\n * Whether a value satisfies a filter entry, combining its constraints with the entry's operator.\n * @param value The row value.\n * @param entry The filter entry.\n * @returns True when the value matches.\n */\nexport const matchesFilterEntry = (value: unknown, entry: DataTableFilterEntry) => {\n if (!('constraints' in entry)) return builtInMatches(value, entry);\n if (entry.constraints.length === 0) return true;\n\n const matches = entry.constraints.map((constraint) =>\n builtInMatches(value, constraint),\n );\n return entry.operator?.toLowerCase() === 'or'\n ? matches.some(Boolean)\n : matches.every(Boolean);\n};\n"],"names":[],"mappings":";;;AAUA,MAAM,UAAU,GAAG,CAAC,KAAc,KAAI;IAGlC,MAAM,IAAI,GACN,KAAK,YAAY,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/E,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC/E,CAAC;AAOM,MAAM,eAAe,GAAG,CAC3B,KAAuC,KAEvC,KAAK,IAAI,aAAa,IAAI,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG;AAE7D,MAAM,cAAc,GAAG,CACnB,KAAc,EACd,UAAqC,KAC5B;AACT,IAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK;IAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,IAAI,wBAAwB,CAAC,QAAQ;IACtE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,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AAO;AACjC,YAAA,QACI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBACrB,MAAM,CAAC,MAAM,IAAI,CAAC;AAClB,gBAAA,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAChC,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAExC,KAAK,wBAAwB,CAAC,QAAQ;YAClC,OAAO,WAAW,GAAG,YAAY;QACrC,KAAK,wBAAwB,CAAC,eAAe;YACzC,OAAO,WAAW,IAAI,YAAY;QACtC,KAAK,wBAAwB,CAAC,WAAW;YACrC,OAAO,WAAW,GAAG,YAAY;QACrC,KAAK,wBAAwB,CAAC,kBAAkB;YAC5C,OAAO,WAAW,IAAI,YAAY;QACtC,KAAK,wBAAwB,CAAC,MAAM;YAChC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,MAAM,CAAC;QACnD,KAAK,wBAAwB,CAAC,SAAS;YACnC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,MAAM,CAAC;QACnD,KAAK,wBAAwB,CAAC,UAAU;AACpC,YAAA,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,QAAQ,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC9E,KAAK,wBAAwB,CAAC,SAAS;AACnC,YAAA,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC;AAC9E,QAAA;AACI,YAAA,OAAO,6BAA6B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,EAAE,MAAM,CAAC,IAAI,KAAK;;AAExF,CAAC;
|
|
1
|
+
{"version":3,"file":"matchesFilterEntry.js","sources":["../../../DataTables/matchesFilterEntry.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n DataTableFilterMatchMode,\n type DataTableFilterConstraint,\n type DataTableFilterEntry,\n} from './DataTableFilterMeta';\nimport { resolveDataTableFilterMatcher } from './DataTableFilterMatcherRegistry';\n\nconst dateNumber = (value: unknown) => {\n // A cloned Date is normalized in place so caller-owned Date instances (row\n // values and filter constraints alike) are never mutated by comparison.\n const date =\n value instanceof Date ? new Date(value.getTime()) : new Date(String(value));\n return Number.isNaN(date.getTime()) ? undefined : date.setHours(0, 0, 0, 0);\n};\n\n/**\n * The first constraint of a filter entry, which is what the column filter menu edits.\n * @param entry The filter entry, if any.\n * @returns Its first constraint, or undefined.\n */\nexport const firstConstraint = (\n entry: DataTableFilterEntry | undefined,\n): DataTableFilterConstraint | undefined =>\n entry && 'constraints' in entry ? entry.constraints[0] : entry;\n\nconst builtInMatches = (\n value: unknown,\n constraint: DataTableFilterConstraint,\n): boolean => {\n const filter = constraint.value;\n const mode = constraint.matchMode ?? DataTableFilterMatchMode.Contains;\n if (filter === null || filter === undefined || filter === '') return true;\n\n const valueText = String(value ?? '').toLocaleLowerCase();\n const filterText = String(filter).toLocaleLowerCase();\n const valueNumber = typeof value === 'number' ? value : Number(value);\n const filterNumber = typeof filter === 'number' ? filter : Number(filter);\n\n switch (mode) {\n case DataTableFilterMatchMode.StartsWith:\n return valueText.startsWith(filterText);\n case DataTableFilterMatchMode.Contains:\n return valueText.includes(filterText);\n case DataTableFilterMatchMode.NotContains:\n return !valueText.includes(filterText);\n case DataTableFilterMatchMode.EndsWith:\n return valueText.endsWith(filterText);\n case DataTableFilterMatchMode.Equals:\n return Object.is(value, filter) || valueText === filterText;\n case DataTableFilterMatchMode.NotEquals:\n return !(Object.is(value, filter) || valueText === filterText);\n case DataTableFilterMatchMode.In:\n return Array.isArray(filter) && filter.some((item) => Object.is(item, value));\n case DataTableFilterMatchMode.Between:\n return (\n Array.isArray(filter) &&\n filter.length >= 2 &&\n valueNumber >= Number(filter[0]) &&\n valueNumber <= Number(filter[1])\n );\n case DataTableFilterMatchMode.LessThan:\n return valueNumber < filterNumber;\n case DataTableFilterMatchMode.LessThanOrEqual:\n return valueNumber <= filterNumber;\n case DataTableFilterMatchMode.GreaterThan:\n return valueNumber > filterNumber;\n case DataTableFilterMatchMode.GreaterThanOrEqual:\n return valueNumber >= filterNumber;\n case DataTableFilterMatchMode.DateIs:\n return dateNumber(value) === dateNumber(filter);\n case DataTableFilterMatchMode.DateIsNot:\n return dateNumber(value) !== dateNumber(filter);\n case DataTableFilterMatchMode.DateBefore:\n return (dateNumber(value) ?? Infinity) < (dateNumber(filter) ?? -Infinity);\n case DataTableFilterMatchMode.DateAfter:\n return (dateNumber(value) ?? -Infinity) > (dateNumber(filter) ?? Infinity);\n default:\n return resolveDataTableFilterMatcher(String(mode))?.(value, filter) ?? false;\n }\n};\n\nconst hasConstraintValue = (constraint: DataTableFilterConstraint) =>\n constraint.value !== null && constraint.value !== undefined && constraint.value !== '';\n\n/**\n * Whether a filter entry narrows rows at all. Entries without a value match every row, so a table\n * holding only placeholder entries such as `{ value: null }` is not filtered.\n * @param entry The filter entry.\n * @returns True when at least one of its constraints has a value.\n */\nexport const isFilterEntryActive = (entry: DataTableFilterEntry) =>\n 'constraints' in entry ? entry.constraints.some(hasConstraintValue) : hasConstraintValue(entry);\n\n/**\n * Whether a value satisfies a filter entry, combining its constraints with the entry's operator.\n * @param value The row value.\n * @param entry The filter entry.\n * @returns True when the value matches.\n */\nexport const matchesFilterEntry = (value: unknown, entry: DataTableFilterEntry) => {\n if (!('constraints' in entry)) return builtInMatches(value, entry);\n if (entry.constraints.length === 0) return true;\n\n const matches = entry.constraints.map((constraint) =>\n builtInMatches(value, constraint),\n );\n return entry.operator?.toLowerCase() === 'or'\n ? matches.some(Boolean)\n : matches.every(Boolean);\n};\n"],"names":[],"mappings":";;;AAUA,MAAM,UAAU,GAAG,CAAC,KAAc,KAAI;IAGlC,MAAM,IAAI,GACN,KAAK,YAAY,IAAI,GAAG,IAAI,IAAI,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,UAAE,OAAO,CAAC,IAAI,CAAC,OAAO;AACtB,UAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;AAChC;;"}
|
|
@@ -3,7 +3,8 @@ import type { DataTableMessages } from './DataTableMessages.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Resolves each table message from its prop, then the provider's `dataTable` messages, then the default.
|
|
5
5
|
* @param overrides The messages passed as props.
|
|
6
|
+
* @param isServerMode Whether the server, not the loaded page, applies search and filters.
|
|
6
7
|
* @returns The messages to show.
|
|
7
8
|
*/
|
|
8
|
-
export declare const useDataTableMessages: (overrides: DataTableMessageOverrides) => DataTableMessages;
|
|
9
|
+
export declare const useDataTableMessages: (overrides: DataTableMessageOverrides, isServerMode?: boolean) => DataTableMessages;
|
|
9
10
|
//# sourceMappingURL=useDataTableMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableMessages.d.ts","sourceRoot":"","sources":["../../../DataTables/useDataTableMessages.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAE7D
|
|
1
|
+
{"version":3,"file":"useDataTableMessages.d.ts","sourceRoot":"","sources":["../../../DataTables/useDataTableMessages.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,cAClB,yBAAyB,6BAErC,iBAiCF,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { useCratisComponentsConfig } from '../configuration/CratisComponentsCont
|
|
|
7
7
|
import '../Notifications/toast.js';
|
|
8
8
|
import '../renderer/RendererContext.js';
|
|
9
9
|
|
|
10
|
-
const useDataTableMessages = (overrides) => {
|
|
10
|
+
const useDataTableMessages = (overrides, isServerMode = false) => {
|
|
11
11
|
const { messages } = useCratisComponentsConfig();
|
|
12
12
|
const dataTableMessages = messages?.dataTable;
|
|
13
13
|
return {
|
|
@@ -26,6 +26,11 @@ const useDataTableMessages = (overrides) => {
|
|
|
26
26
|
resolvedUnauthorizedMessage: overrides.unauthorizedMessage ??
|
|
27
27
|
dataTableMessages?.unauthorized ??
|
|
28
28
|
'You are not authorized to view this data.',
|
|
29
|
+
resolvedFilteredEmptyMessage: overrides.filteredEmptyMessage ??
|
|
30
|
+
(isServerMode
|
|
31
|
+
? (dataTableMessages?.filteredEmptyServer ?? 'No rows match the search.')
|
|
32
|
+
: (dataTableMessages?.filteredEmpty ??
|
|
33
|
+
'No rows on this page match the search.')),
|
|
29
34
|
};
|
|
30
35
|
};
|
|
31
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableMessages.js","sources":["../../../DataTables/useDataTableMessages.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport type { DataTableMessageOverrides } from './DataTableMessageOverrides';\nimport type { DataTableMessages } from './DataTableMessages';\n\n/**\n * Resolves each table message from its prop, then the provider's `dataTable` messages, then the default.\n * @param overrides The messages passed as props.\n * @returns The messages to show.\n */\nexport const useDataTableMessages = (\n overrides: DataTableMessageOverrides,\n): DataTableMessages => {\n const { messages } = useCratisComponentsConfig();\n const dataTableMessages = messages?.dataTable;\n return {\n resolvedSelectionAriaLabel:\n overrides.selectionAriaLabel ?? dataTableMessages?.selectRow ?? 'Select row',\n resolvedSelectAllAriaLabel:\n overrides.selectAllAriaLabel ??\n dataTableMessages?.selectAllRows ??\n 'Select all rows',\n resolvedGlobalSearchPlaceholder:\n overrides.globalSearchPlaceholder ?? dataTableMessages?.search ?? 'Search…',\n resolvedGlobalSearchAriaLabel:\n overrides.globalSearchAriaLabel ??\n dataTableMessages?.searchAriaLabel ??\n 'Search table',\n resolvedLoadingMessage:\n overrides.loadingMessage ?? dataTableMessages?.loading ?? 'Loading…',\n resolvedFailureMessage:\n overrides.failureMessage ??\n dataTableMessages?.failed ??\n 'Could not load data.',\n resolvedUnauthorizedMessage:\n overrides.unauthorizedMessage ??\n dataTableMessages?.unauthorized ??\n 'You are not authorized to view this data.',\n };\n};\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useDataTableMessages.js","sources":["../../../DataTables/useDataTableMessages.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport type { DataTableMessageOverrides } from './DataTableMessageOverrides';\nimport type { DataTableMessages } from './DataTableMessages';\n\n/**\n * Resolves each table message from its prop, then the provider's `dataTable` messages, then the default.\n * @param overrides The messages passed as props.\n * @param isServerMode Whether the server, not the loaded page, applies search and filters.\n * @returns The messages to show.\n */\nexport const useDataTableMessages = (\n overrides: DataTableMessageOverrides,\n isServerMode = false,\n): DataTableMessages => {\n const { messages } = useCratisComponentsConfig();\n const dataTableMessages = messages?.dataTable;\n return {\n resolvedSelectionAriaLabel:\n overrides.selectionAriaLabel ?? dataTableMessages?.selectRow ?? 'Select row',\n resolvedSelectAllAriaLabel:\n overrides.selectAllAriaLabel ??\n dataTableMessages?.selectAllRows ??\n 'Select all rows',\n resolvedGlobalSearchPlaceholder:\n overrides.globalSearchPlaceholder ?? dataTableMessages?.search ?? 'Search…',\n resolvedGlobalSearchAriaLabel:\n overrides.globalSearchAriaLabel ??\n dataTableMessages?.searchAriaLabel ??\n 'Search table',\n resolvedLoadingMessage:\n overrides.loadingMessage ?? dataTableMessages?.loading ?? 'Loading…',\n resolvedFailureMessage:\n overrides.failureMessage ??\n dataTableMessages?.failed ??\n 'Could not load data.',\n resolvedUnauthorizedMessage:\n overrides.unauthorizedMessage ??\n dataTableMessages?.unauthorized ??\n 'You are not authorized to view this data.',\n resolvedFilteredEmptyMessage:\n overrides.filteredEmptyMessage ??\n (isServerMode\n ? (dataTableMessages?.filteredEmptyServer ?? 'No rows match the search.')\n : (dataTableMessages?.filteredEmpty ??\n 'No rows on this page match the search.')),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;AAaO,MAAM,oBAAoB,GAAG,CAChC,SAAoC,EACpC,YAAY,GAAG,KAAK,KACD;AACnB,IAAA,MAAM,EAAE,QAAQ,EAAE,GAAG,yBAAyB,EAAE;AAChD,IAAA,MAAM,iBAAiB,GAAG,QAAQ,EAAE,SAAS;IAC7C,OAAO;QACH,0BAA0B,EACtB,SAAS,CAAC,kBAAkB,IAAI,iBAAiB,EAAE,SAAS,IAAI,YAAY;QAChF,0BAA0B,EACtB,SAAS,CAAC,kBAAkB;AAC5B,YAAA,iBAAiB,EAAE,aAAa;YAChC,iBAAiB;QACrB,+BAA+B,EAC3B,SAAS,CAAC,uBAAuB,IAAI,iBAAiB,EAAE,MAAM,IAAI,SAAS;QAC/E,6BAA6B,EACzB,SAAS,CAAC,qBAAqB;AAC/B,YAAA,iBAAiB,EAAE,eAAe;YAClC,cAAc;QAClB,sBAAsB,EAClB,SAAS,CAAC,cAAc,IAAI,iBAAiB,EAAE,OAAO,IAAI,UAAU;QACxE,sBAAsB,EAClB,SAAS,CAAC,cAAc;AACxB,YAAA,iBAAiB,EAAE,MAAM;YACzB,sBAAsB;QAC1B,2BAA2B,EACvB,SAAS,CAAC,mBAAmB;AAC7B,YAAA,iBAAiB,EAAE,YAAY;YAC/B,2CAA2C;QAC/C,4BAA4B,EACxB,SAAS,CAAC,oBAAoB;AAC9B,aAAC;AACG,mBAAG,iBAAiB,EAAE,mBAAmB,IAAI,2BAA2B;AACxE,mBAAG,iBAAiB,EAAE,aAAa;AACjC,oBAAA,wCAAwC,CAAC,CAAC;KACvD;AACL;;"}
|
|
@@ -26,7 +26,8 @@ export interface ServerQueryBinding<TArguments extends object> {
|
|
|
26
26
|
* @param serverQuery - The server mode options, or undefined for loaded-page mode.
|
|
27
27
|
* @param queryArguments - The arguments the table was given.
|
|
28
28
|
* @param defaultFilters - The initial column filters.
|
|
29
|
+
* @param onGlobalFilterChange - Notified of every search text change, as typed.
|
|
29
30
|
* @returns The arguments to query with and the table props for server mode.
|
|
30
31
|
*/
|
|
31
|
-
export declare const useServerQuery: <TArguments extends object>(serverQuery: DataTableServerQuery<TArguments> | undefined, queryArguments: TArguments | undefined, defaultFilters: DataTableFilterMeta | undefined) => ServerQueryBinding<TArguments>;
|
|
32
|
+
export declare const useServerQuery: <TArguments extends object>(serverQuery: DataTableServerQuery<TArguments> | undefined, queryArguments: TArguments | undefined, defaultFilters: DataTableFilterMeta | undefined, onGlobalFilterChange?: (globalFilter: string) => void) => ServerQueryBinding<TArguments>;
|
|
32
33
|
//# sourceMappingURL=useServerQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useServerQuery.d.ts","sourceRoot":"","sources":["../../../DataTables/useServerQuery.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAAuB,CAAC;AAEjE,OAAO,EAEH,KAAK,oBAAoB,EAC5B,MAAM,2BAAwB,CAAC;AAIhC,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACtC;AAED,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACpC,kBAAkB,CAAC,MAAM,CAAC,EACxB,eAAe,GACf,MAAM,GACN,cAAc,GACd,SAAS,GACT,UAAU,GACV,cAAc,GAC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AU,GAAG,SAAS,kBACtB,mBAAmB,GAAG,SAAS,yBACxB,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,KACtD,kBAAkB,CAAC,UAAU,CAuD/B,CAAC"}
|
|
@@ -10,7 +10,7 @@ const toSorting = (sort, sortFields) => sort
|
|
|
10
10
|
? SortDirection.descending
|
|
11
11
|
: SortDirection.ascending)
|
|
12
12
|
: Sorting.none;
|
|
13
|
-
const useServerQuery = (serverQuery, queryArguments, defaultFilters) => {
|
|
13
|
+
const useServerQuery = (serverQuery, queryArguments, defaultFilters, onGlobalFilterChange) => {
|
|
14
14
|
const [sort, setSort] = useState(null);
|
|
15
15
|
const [filters, setFilters] = useState(defaultFilters ?? {});
|
|
16
16
|
const [searchText, setSearchText] = useState('');
|
|
@@ -43,6 +43,7 @@ const useServerQuery = (serverQuery, queryArguments, defaultFilters) => {
|
|
|
43
43
|
},
|
|
44
44
|
globalFilter: searchText,
|
|
45
45
|
onGlobalFilterChange: (next) => {
|
|
46
|
+
onGlobalFilterChange?.(next);
|
|
46
47
|
setSearchText(next);
|
|
47
48
|
clearTimeout(searchTimerRef.current);
|
|
48
49
|
const apply = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useServerQuery.js","sources":["../../../DataTables/useServerQuery.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useRef, useState } from 'react';\nimport { SortDirection, Sorting } from '@cratis/arc/queries';\nimport type { DataTableCoreProps } from './DataTableCore';\nimport type { DataTableFilterMeta } from './DataTableFilterMeta';\nimport { DataTableRowProcessing } from './DataTableRowProcessing';\nimport {\n defaultServerQuerySearchDebounceMilliseconds,\n type DataTableServerQuery,\n} from './DataTableServerQuery';\nimport type { DataTableSort } from './DataTableSort';\nimport { DataTableSortDirection } from './DataTableSortDirection';\n\n/** The sorting and paging delegates of an Arc paging hook. */\nexport interface ServerQueryControls {\n setSorting: (sorting: Sorting) => unknown;\n setPage: (page: number) => unknown;\n}\n\n/** The table props that hand a table's sort, filter and search state to the server. */\nexport type ServerQueryTableProps = Pick<\n DataTableCoreProps<object>,\n | 'rowProcessing'\n | 'sort'\n | 'onSortChange'\n | 'filters'\n | 'onFilter'\n | 'globalFilter'\n | 'onGlobalFilterChange'\n>;\n\n/** What a bound table needs to run in server mode, or to run unchanged without it. */\nexport interface ServerQueryBinding<TArguments extends object> {\n /** The arguments to perform the query with. */\n queryArguments: TArguments | undefined;\n /**\n * Builds the table props that drive the query through the paging hook's delegates.\n * @param controls - The paging hook's sorting and paging delegates.\n * @returns No props without a server query, so the table keeps its loaded-page behavior.\n */\n tableProps(controls: ServerQueryControls): ServerQueryTableProps;\n}\n\nconst firstPage = 0;\n\nconst toSorting = (\n sort: DataTableSort | null,\n sortFields: Readonly<Record<string, string>> | undefined,\n): Sorting =>\n sort\n ? new Sorting(\n sortFields?.[sort.field] ?? sort.field,\n sort.direction === DataTableSortDirection.Descending\n ? SortDirection.descending\n : SortDirection.ascending,\n )\n : Sorting.none;\n\n/**\n * Keeps a bound table's sort, filter and search state for server mode and turns it into Arc sorting\n * and query arguments. Without a server query it passes the arguments through and adds no table props.\n * @param serverQuery - The server mode options, or undefined for loaded-page mode.\n * @param queryArguments - The arguments the table was given.\n * @param defaultFilters - The initial column filters.\n * @returns The arguments to query with and the table props for server mode.\n */\nexport const useServerQuery = <TArguments extends object>(\n serverQuery: DataTableServerQuery<TArguments> | undefined,\n queryArguments: TArguments | undefined,\n defaultFilters: DataTableFilterMeta | undefined,\n): ServerQueryBinding<TArguments> => {\n const [sort, setSort] = useState<DataTableSort | null>(null);\n const [filters, setFilters] = useState<DataTableFilterMeta>(defaultFilters ?? {});\n const [searchText, setSearchText] = useState('');\n const [appliedSearch, setAppliedSearch] = useState('');\n const appliedSearchRef = useRef('');\n const searchTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n useEffect(() => () => clearTimeout(searchTimerRef.current), []);\n\n if (!serverQuery) {\n return { queryArguments, tableProps: () => ({}) };\n }\n\n const debounceMilliseconds =\n serverQuery.searchDebounceMilliseconds ?? defaultServerQuerySearchDebounceMilliseconds;\n const serverArguments = {\n ...queryArguments,\n ...serverQuery.toArguments({ filters, globalFilter: appliedSearch }),\n } as TArguments;\n\n return {\n queryArguments: serverArguments,\n tableProps: ({ setSorting, setPage }) => ({\n rowProcessing: DataTableRowProcessing.None,\n sort,\n onSortChange: (next) => {\n setSort(next);\n setSorting(toSorting(next, serverQuery.sortFields));\n setPage(firstPage);\n },\n filters,\n onFilter: (next) => {\n setFilters(next);\n setPage(firstPage);\n },\n globalFilter: searchText,\n onGlobalFilterChange: (next) => {\n setSearchText(next);\n clearTimeout(searchTimerRef.current);\n const apply = () => {\n if (next === appliedSearchRef.current) return;\n appliedSearchRef.current = next;\n setAppliedSearch(next);\n setPage(firstPage);\n };\n if (debounceMilliseconds > 0) {\n searchTimerRef.current = setTimeout(apply, debounceMilliseconds);\n } else {\n apply();\n }\n },\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;AA6CA,MAAM,SAAS,GAAG,CAAC;AAEnB,MAAM,SAAS,GAAG,CACd,IAA0B,EAC1B,UAAwD,KAExD;MACM,IAAI,OAAO,CACT,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,EACtC,IAAI,CAAC,SAAS,KAAK,sBAAsB,CAAC;UACpC,aAAa,CAAC;AAChB,UAAE,aAAa,CAAC,SAAS;AAEjC,MAAE,OAAO,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"useServerQuery.js","sources":["../../../DataTables/useServerQuery.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useEffect, useRef, useState } from 'react';\nimport { SortDirection, Sorting } from '@cratis/arc/queries';\nimport type { DataTableCoreProps } from './DataTableCore';\nimport type { DataTableFilterMeta } from './DataTableFilterMeta';\nimport { DataTableRowProcessing } from './DataTableRowProcessing';\nimport {\n defaultServerQuerySearchDebounceMilliseconds,\n type DataTableServerQuery,\n} from './DataTableServerQuery';\nimport type { DataTableSort } from './DataTableSort';\nimport { DataTableSortDirection } from './DataTableSortDirection';\n\n/** The sorting and paging delegates of an Arc paging hook. */\nexport interface ServerQueryControls {\n setSorting: (sorting: Sorting) => unknown;\n setPage: (page: number) => unknown;\n}\n\n/** The table props that hand a table's sort, filter and search state to the server. */\nexport type ServerQueryTableProps = Pick<\n DataTableCoreProps<object>,\n | 'rowProcessing'\n | 'sort'\n | 'onSortChange'\n | 'filters'\n | 'onFilter'\n | 'globalFilter'\n | 'onGlobalFilterChange'\n>;\n\n/** What a bound table needs to run in server mode, or to run unchanged without it. */\nexport interface ServerQueryBinding<TArguments extends object> {\n /** The arguments to perform the query with. */\n queryArguments: TArguments | undefined;\n /**\n * Builds the table props that drive the query through the paging hook's delegates.\n * @param controls - The paging hook's sorting and paging delegates.\n * @returns No props without a server query, so the table keeps its loaded-page behavior.\n */\n tableProps(controls: ServerQueryControls): ServerQueryTableProps;\n}\n\nconst firstPage = 0;\n\nconst toSorting = (\n sort: DataTableSort | null,\n sortFields: Readonly<Record<string, string>> | undefined,\n): Sorting =>\n sort\n ? new Sorting(\n sortFields?.[sort.field] ?? sort.field,\n sort.direction === DataTableSortDirection.Descending\n ? SortDirection.descending\n : SortDirection.ascending,\n )\n : Sorting.none;\n\n/**\n * Keeps a bound table's sort, filter and search state for server mode and turns it into Arc sorting\n * and query arguments. Without a server query it passes the arguments through and adds no table props.\n * @param serverQuery - The server mode options, or undefined for loaded-page mode.\n * @param queryArguments - The arguments the table was given.\n * @param defaultFilters - The initial column filters.\n * @param onGlobalFilterChange - Notified of every search text change, as typed.\n * @returns The arguments to query with and the table props for server mode.\n */\nexport const useServerQuery = <TArguments extends object>(\n serverQuery: DataTableServerQuery<TArguments> | undefined,\n queryArguments: TArguments | undefined,\n defaultFilters: DataTableFilterMeta | undefined,\n onGlobalFilterChange?: (globalFilter: string) => void,\n): ServerQueryBinding<TArguments> => {\n const [sort, setSort] = useState<DataTableSort | null>(null);\n const [filters, setFilters] = useState<DataTableFilterMeta>(defaultFilters ?? {});\n const [searchText, setSearchText] = useState('');\n const [appliedSearch, setAppliedSearch] = useState('');\n const appliedSearchRef = useRef('');\n const searchTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n useEffect(() => () => clearTimeout(searchTimerRef.current), []);\n\n if (!serverQuery) {\n return { queryArguments, tableProps: () => ({}) };\n }\n\n const debounceMilliseconds =\n serverQuery.searchDebounceMilliseconds ?? defaultServerQuerySearchDebounceMilliseconds;\n const serverArguments = {\n ...queryArguments,\n ...serverQuery.toArguments({ filters, globalFilter: appliedSearch }),\n } as TArguments;\n\n return {\n queryArguments: serverArguments,\n tableProps: ({ setSorting, setPage }) => ({\n rowProcessing: DataTableRowProcessing.None,\n sort,\n onSortChange: (next) => {\n setSort(next);\n setSorting(toSorting(next, serverQuery.sortFields));\n setPage(firstPage);\n },\n filters,\n onFilter: (next) => {\n setFilters(next);\n setPage(firstPage);\n },\n globalFilter: searchText,\n onGlobalFilterChange: (next) => {\n onGlobalFilterChange?.(next);\n setSearchText(next);\n clearTimeout(searchTimerRef.current);\n const apply = () => {\n if (next === appliedSearchRef.current) return;\n appliedSearchRef.current = next;\n setAppliedSearch(next);\n setPage(firstPage);\n };\n if (debounceMilliseconds > 0) {\n searchTimerRef.current = setTimeout(apply, debounceMilliseconds);\n } else {\n apply();\n }\n },\n }),\n };\n};\n"],"names":[],"mappings":";;;;;;AA6CA,MAAM,SAAS,GAAG,CAAC;AAEnB,MAAM,SAAS,GAAG,CACd,IAA0B,EAC1B,UAAwD,KAExD;MACM,IAAI,OAAO,CACT,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,EACtC,IAAI,CAAC,SAAS,KAAK,sBAAsB,CAAC;UACpC,aAAa,CAAC;AAChB,UAAE,aAAa,CAAC,SAA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WAAW,CAAC,UAAU,CAAC,CAAC;gBACnD,OAAO,CAAC,SAAS,CAAC;YACtB,CAAC;YACD,OAAO;AACP,YAAA,QAAQ,EAAE,CAAC,IAAI,KAAI;gBACf,UAAU,CAAC,IAAI,CAAC;gBAChB,OAAO,CAAC,SAAS,CAAC;YACtB,CAAC;AACD,YAAA,YAAY,EAAE,UAAU;AACxB,YAAA,oBAAoB,EAAE,CAAC,IAAI,KAAI;AAC3B,gBAAA,oBAAoB,GAAG,IAAI,CAAC;gBAC5B,aAAa,CAAC,IAAI,CAAC;AACnB,gBAAA,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC;gBACpC,MAAM,KAAK,GAAG,MAAK;AACf,oBAAA,IAAI,IAAI,KAAK,gBAAgB,CAAC,OAAO;wBAAE;AACvC,oBAAA,gBAAgB,CAAC,OAAO,GAAG,IAAI;oBAC/B,gBAAgB,CAAC,IAAI,CAAC;oBACtB,OAAO,CAAC,SAAS,CAAC;AACtB,gBAAA,CAAC;AACD,gBAAA,IAAI,oBAAoB,GAAG,CAAC,EAAE;oBAC1B,cAAc,CAAC,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,oBAAoB,CAAC;gBACpE;qBAAO;AACH,oBAAA,KAAK,EAAE;gBACX;YACJ,CAAC;SACJ,CAAC;KACL;AACL;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import type { DialogProps } from './Dialog.js';
|
|
2
3
|
/**
|
|
3
4
|
* A modal dialog with Arc host integration, typed footer actions, busy/validity
|
|
4
5
|
* state, controlled dismissal, and stable Cratis-owned styling parts.
|
|
5
6
|
*/
|
|
6
|
-
export declare const DialogImplementation: ({ title, subtitle, placement, closeIcon, visible, onClose, onConfirm, onCancel, buttons, initialFocus, children, width, style, contentStyle, isValid, isBusy, okLabel, cancelLabel, yesLabel, noLabel, closeAriaLabel, dismissable, className, pt, }: DialogProps) =>
|
|
7
|
+
export declare const DialogImplementation: ({ title, subtitle, placement, closeIcon, visible, onClose, onConfirm, onCancel, buttons, initialFocus, children, width, style, contentStyle, isValid, isBusy, okLabel, cancelLabel, yesLabel, noLabel, closeAriaLabel, dismissable, className, pt, }: DialogProps) => React.JSX.Element | null;
|
|
7
8
|
//# sourceMappingURL=DialogImplementation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogImplementation.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogImplementation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DialogImplementation.d.ts","sourceRoot":"","sources":["../../../Dialogs/DialogImplementation.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAiC5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,yPAyB9B,WAAW,6BAkdb,CAAC"}
|
|
@@ -16,6 +16,17 @@ import { classNames } from '../ClassNames/classNames.js';
|
|
|
16
16
|
import { openDialogTier, closeDialogTier, DIALOG_ZINDEX_TOKEN, dialogZIndexForTier } from '../renderer/dialogStack.js';
|
|
17
17
|
import { DialogStackContext } from '../renderer/DialogStackContext.js';
|
|
18
18
|
|
|
19
|
+
const visuallyHidden = {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
width: 1,
|
|
22
|
+
height: 1,
|
|
23
|
+
margin: -1,
|
|
24
|
+
padding: 0,
|
|
25
|
+
overflow: 'hidden',
|
|
26
|
+
clipPath: 'inset(50%)',
|
|
27
|
+
whiteSpace: 'nowrap',
|
|
28
|
+
border: 0,
|
|
29
|
+
};
|
|
19
30
|
const subscribeToBrowserEnvironment = () => () => undefined;
|
|
20
31
|
const useIsBrowser = () => useSyncExternalStore(subscribeToBrowserEnvironment, () => true, () => false);
|
|
21
32
|
const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon, visible = true, onClose, onConfirm, onCancel, buttons = DialogButtons.OkCancel, initialFocus = DialogInitialFocus.Confirm, children, width = '450px', style, contentStyle, isValid, isBusy = false, okLabel, cancelLabel, yesLabel, noLabel, closeAriaLabel, dismissable, className, pt, }) => {
|
|
@@ -27,6 +38,8 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
27
38
|
const resolvedYesLabel = yesLabel ?? dialogMessages?.yes ?? 'Yes';
|
|
28
39
|
const resolvedNoLabel = noLabel ?? dialogMessages?.no ?? 'No';
|
|
29
40
|
const resolvedCloseAriaLabel = closeAriaLabel ?? dialogMessages?.close ?? 'Close';
|
|
41
|
+
const resolvedRefusedMessage = dialogMessages?.refused ??
|
|
42
|
+
'The action was not completed. Review the dialog and try again.';
|
|
30
43
|
const icon = useCratisIcon();
|
|
31
44
|
const resolvedCloseIcon = icon('close', '×', closeIcon);
|
|
32
45
|
let contextCloseDialog;
|
|
@@ -43,6 +56,9 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
43
56
|
const titleRef = useRef(null);
|
|
44
57
|
const confirmRef = useRef(null);
|
|
45
58
|
const cancelRef = useRef(null);
|
|
59
|
+
const [refusals, setRefusals] = useState(0);
|
|
60
|
+
const handledRefusals = useRef(0);
|
|
61
|
+
const [announcement, setAnnouncement] = useState(null);
|
|
46
62
|
const isDialogValid = isValid !== false;
|
|
47
63
|
const hasDismissingButton = typeof buttons === 'number' && buttons !== DialogButtons.Ok;
|
|
48
64
|
const resolvedInitialFocus = initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton
|
|
@@ -75,8 +91,38 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
75
91
|
const frame = requestAnimationFrame(() => target?.focus());
|
|
76
92
|
return () => cancelAnimationFrame(frame);
|
|
77
93
|
}, [focusesConfirmButton, focusesDismissingButton, visible]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!visible || !isBusy)
|
|
96
|
+
return;
|
|
97
|
+
setAnnouncement(null);
|
|
98
|
+
const active = document.activeElement;
|
|
99
|
+
if (active && active !== document.body)
|
|
100
|
+
return;
|
|
101
|
+
if (confirmRef.current) {
|
|
102
|
+
confirmRef.current.focus();
|
|
103
|
+
}
|
|
104
|
+
else if (titleRef.current) {
|
|
105
|
+
titleRef.current.tabIndex = -1;
|
|
106
|
+
titleRef.current.focus();
|
|
107
|
+
}
|
|
108
|
+
}, [isBusy, visible]);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (refusals === handledRefusals.current || isBusy)
|
|
111
|
+
return;
|
|
112
|
+
handledRefusals.current = refusals;
|
|
113
|
+
const confirm = confirmRef.current;
|
|
114
|
+
if (confirm && !confirm.disabled) {
|
|
115
|
+
confirm.focus();
|
|
116
|
+
}
|
|
117
|
+
else if (titleRef.current) {
|
|
118
|
+
titleRef.current.tabIndex = -1;
|
|
119
|
+
titleRef.current.focus();
|
|
120
|
+
}
|
|
121
|
+
setAnnouncement({ key: refusals, text: resolvedRefusedMessage });
|
|
122
|
+
}, [refusals, isBusy, resolvedRefusedMessage]);
|
|
78
123
|
const handleClose = async (result) => {
|
|
79
124
|
let shouldCloseThroughContext = true;
|
|
125
|
+
const isConfirming = result === DialogResult.Ok || result === DialogResult.Yes;
|
|
80
126
|
if (result === DialogResult.Ok || result === DialogResult.Yes) {
|
|
81
127
|
if (onConfirm) {
|
|
82
128
|
const closeResult = await onConfirm();
|
|
@@ -97,10 +143,22 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
97
143
|
}
|
|
98
144
|
if (shouldCloseThroughContext)
|
|
99
145
|
contextCloseDialog?.(result);
|
|
146
|
+
else if (isConfirming)
|
|
147
|
+
setRefusals((count) => count + 1);
|
|
100
148
|
};
|
|
101
149
|
const footerButton = (result, label, primary, focused) => (jsxs("button", { ...(primary ? pt?.confirm : pt?.cancel), type: 'button', className: classNames('cratis-dialog__button', primary
|
|
102
150
|
? 'cratis-dialog__button--primary'
|
|
103
|
-
: 'cratis-dialog__button--secondary', primary ? pt?.confirm?.className : pt?.cancel?.className), "data-cratis-part": primary ? 'confirm' : 'cancel', "data-disabled": (primary ? !isDialogValid || isBusy : isBusy) || undefined, "data-busy": isBusy || undefined, ref: primary ? confirmRef : focused ? cancelRef : undefined, onClick: () =>
|
|
151
|
+
: 'cratis-dialog__button--secondary', primary ? pt?.confirm?.className : pt?.cancel?.className), "data-cratis-part": primary ? 'confirm' : 'cancel', "data-disabled": (primary ? !isDialogValid || isBusy : isBusy) || undefined, "data-busy": isBusy || undefined, ref: primary ? confirmRef : focused ? cancelRef : undefined, onClick: () => {
|
|
152
|
+
if (isBusy)
|
|
153
|
+
return;
|
|
154
|
+
void handleClose(result);
|
|
155
|
+
}, onKeyDown: primary
|
|
156
|
+
? (event) => {
|
|
157
|
+
if (event.repeat && (event.key === 'Enter' || event.key === ' '))
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
}
|
|
160
|
+
: undefined, disabled: primary ? !isDialogValid : isBusy, autoFocus: focused, "aria-disabled": primary && isBusy ? true : undefined, "aria-busy": primary && isBusy ? true : undefined, children: [primary && isBusy && (jsx("span", { className: 'cratis-dialog__spinner', "aria-hidden": 'true' })), jsx("span", { children: label })] }, `${result}-${label}`));
|
|
161
|
+
const isFooterScopeBusy = isBusy && typeof buttons !== 'number';
|
|
104
162
|
const predefinedFooter = () => {
|
|
105
163
|
if (typeof buttons !== 'number')
|
|
106
164
|
return buttons;
|
|
@@ -117,7 +175,7 @@ const DialogImplementation = ({ title, subtitle, placement = 'center', closeIcon
|
|
|
117
175
|
return null;
|
|
118
176
|
}
|
|
119
177
|
};
|
|
120
|
-
const dialogDocument = (jsx(DialogStackContext.Provider, { value: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN, children: jsx(Dialog, { className: 'cratis-dialog__document', "aria-describedby": hasSubtitle ? subtitleId : undefined, children: jsxs(Fragment, { children: [jsxs("header", { ...pt?.header, className: classNames('cratis-dialog__header', pt?.header?.className), style: pt?.header?.style, "data-cratis-part": 'header', children: [jsx(Heading, { ...pt?.title, slot: 'title', tabIndex: focusesTitle ? -1 : undefined, ref: titleRef, className: classNames('cratis-dialog__title', pt?.title?.className), style: pt?.title?.style, "data-cratis-part": 'title', children: title }), hasSubtitle && (jsx("p", { ...pt?.subtitle, id: subtitleId, className: classNames('cratis-dialog__subtitle', pt?.subtitle?.className), style: pt?.subtitle?.style, "data-cratis-part": 'subtitle', children: subtitle })), allowsDismissal && (jsx("button", { ...pt?.close, type: 'button', disabled: isBusy, className: classNames('cratis-dialog__close', pt?.close?.className), "data-cratis-part": 'close', "data-disabled": isBusy || undefined, "data-busy": isBusy || undefined, "aria-label": resolvedCloseAriaLabel, onClick: () => void handleClose(DialogResult.Cancelled), children: jsx("span", { "aria-hidden": 'true', children: resolvedCloseIcon }) }))] }), jsx("div", { ...pt?.content, className: classNames('cratis-dialog__content', pt?.content?.className), style: { ...pt?.content?.style, ...contentStyle }, "data-cratis-part": 'content', "data-open": visible || undefined, "data-busy": isBusy || undefined, children: jsx("fieldset", { className: 'cratis-dialog__busy-scope', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled: isBusy, inert: isBusy, "aria-busy": isBusy || undefined, children: children }) }), buttons !== null && (jsx("footer", { ...pt?.footer, className: classNames('cratis-dialog__footer', pt?.footer?.className), style: pt?.footer?.style, "data-cratis-part": 'footer', children: jsx("fieldset", { className: 'cratis-dialog__busy-scope cratis-dialog__busy-scope--footer', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled:
|
|
178
|
+
const dialogDocument = (jsx(DialogStackContext.Provider, { value: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN, children: jsx(Dialog, { className: 'cratis-dialog__document', "aria-describedby": hasSubtitle ? subtitleId : undefined, children: jsxs(Fragment, { children: [jsxs("header", { ...pt?.header, className: classNames('cratis-dialog__header', pt?.header?.className), style: pt?.header?.style, "data-cratis-part": 'header', children: [jsx(Heading, { ...pt?.title, slot: 'title', tabIndex: focusesTitle ? -1 : undefined, ref: titleRef, className: classNames('cratis-dialog__title', pt?.title?.className), style: pt?.title?.style, "data-cratis-part": 'title', children: title }), hasSubtitle && (jsx("p", { ...pt?.subtitle, id: subtitleId, className: classNames('cratis-dialog__subtitle', pt?.subtitle?.className), style: pt?.subtitle?.style, "data-cratis-part": 'subtitle', children: subtitle })), allowsDismissal && (jsx("button", { ...pt?.close, type: 'button', disabled: isBusy, className: classNames('cratis-dialog__close', pt?.close?.className), "data-cratis-part": 'close', "data-disabled": isBusy || undefined, "data-busy": isBusy || undefined, "aria-label": resolvedCloseAriaLabel, onClick: () => void handleClose(DialogResult.Cancelled), children: jsx("span", { "aria-hidden": 'true', children: resolvedCloseIcon }) }))] }), jsx("div", { ...pt?.content, className: classNames('cratis-dialog__content', pt?.content?.className), style: { ...pt?.content?.style, ...contentStyle }, "data-cratis-part": 'content', "data-open": visible || undefined, "data-busy": isBusy || undefined, children: jsx("fieldset", { className: 'cratis-dialog__busy-scope', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled: isBusy, inert: isBusy, "aria-busy": isBusy || undefined, children: children }) }), buttons !== null && (jsx("footer", { ...pt?.footer, className: classNames('cratis-dialog__footer', pt?.footer?.className), style: pt?.footer?.style, "data-cratis-part": 'footer', children: jsx("fieldset", { className: 'cratis-dialog__busy-scope cratis-dialog__busy-scope--footer', "data-cratis-part": 'busy-scope', "data-busy": isBusy || undefined, disabled: isFooterScopeBusy, inert: isFooterScopeBusy, "aria-busy": isBusy || undefined, children: predefinedFooter() }) })), jsx("div", { className: 'cratis-dialog__live-region', style: visuallyHidden, role: 'status', "aria-live": 'polite', "aria-atomic": 'true', children: announcement && jsx("span", { children: announcement.text }, announcement.key) })] }) }) }));
|
|
121
179
|
const dialogStyle = { width, ...pt?.root?.style, ...style };
|
|
122
180
|
if (!isBrowser) {
|
|
123
181
|
if (!visible)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogImplementation.js","sources":["../../../Dialogs/DialogImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogResult, DialogButtons, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { Dialog as AriaDialog, Heading } from 'react-aria-components/Dialog';\nimport { Modal, ModalOverlay } from 'react-aria-components/Modal';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { DialogInitialFocus } from './DialogInitialFocus';\nimport type { DialogProps } from './Dialog';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport {\n DIALOG_ZINDEX_TOKEN,\n closeDialogTier,\n dialogZIndexForTier,\n openDialogTier,\n} from '../renderer/dialogStack';\nimport { DialogStackContext } from '../renderer/DialogStackContext';\nimport { classNames } from '../ClassNames/classNames';\n\nconst subscribeToBrowserEnvironment = () => () => undefined;\nconst useIsBrowser = () =>\n useSyncExternalStore(\n subscribeToBrowserEnvironment,\n () => true,\n () => false,\n );\n\n/**\n * A modal dialog with Arc host integration, typed footer actions, busy/validity\n * state, controlled dismissal, and stable Cratis-owned styling parts.\n */\nexport const DialogImplementation = ({\n title,\n subtitle,\n placement = 'center',\n closeIcon,\n visible = true,\n onClose,\n onConfirm,\n onCancel,\n buttons = DialogButtons.OkCancel,\n initialFocus = DialogInitialFocus.Confirm,\n children,\n width = '450px',\n style,\n contentStyle,\n isValid,\n isBusy = false,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n closeAriaLabel,\n dismissable,\n className,\n pt,\n}: DialogProps) => {\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const { messages } = useCratisComponentsConfig();\n const dialogMessages = messages?.dialog;\n const resolvedOkLabel = okLabel ?? dialogMessages?.ok ?? 'Ok';\n const resolvedCancelLabel = cancelLabel ?? dialogMessages?.cancel ?? 'Cancel';\n const resolvedYesLabel = yesLabel ?? dialogMessages?.yes ?? 'Yes';\n const resolvedNoLabel = noLabel ?? dialogMessages?.no ?? 'No';\n const resolvedCloseAriaLabel = closeAriaLabel ?? dialogMessages?.close ?? 'Close';\n const icon = useCratisIcon();\n const resolvedCloseIcon = icon('close', '×', closeIcon);\n let contextCloseDialog: ((result: DialogResult) => void) | undefined;\n try {\n const context = useDialogContext();\n contextCloseDialog = context?.closeDialog;\n } catch {\n contextCloseDialog = undefined;\n }\n\n const isBrowser = useIsBrowser();\n const subtitleId = useId();\n const hasSubtitle = subtitle !== undefined && subtitle !== null && subtitle !== false;\n const titleRef = useRef<HTMLHeadingElement>(null);\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n\n const isDialogValid = isValid !== false;\n const hasDismissingButton =\n typeof buttons === 'number' && buttons !== DialogButtons.Ok;\n const resolvedInitialFocus =\n initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton\n ? DialogInitialFocus.Content\n : initialFocus;\n const focusesConfirmButton = resolvedInitialFocus === DialogInitialFocus.Confirm;\n const focusesDismissingButton = resolvedInitialFocus === DialogInitialFocus.Cancel;\n const focusesTitle = resolvedInitialFocus === DialogInitialFocus.Content;\n const allowsDismissal = dismissable ?? typeof buttons === 'number';\n const isDismissable = allowsDismissal && !isBusy;\n\n // Assigns this dialog a strictly increasing tier for as long as it is visible, so a second\n // dialog opened while this one is still open - from anywhere, not necessarily as a React\n // child of this one - stacks above it rather than colliding on the same static z-index.\n const [dialogTier, setDialogTier] = useState<number | null>(null);\n useLayoutEffect(() => {\n if (!visible) {\n setDialogTier(null);\n return;\n }\n const tier = openDialogTier();\n setDialogTier(tier);\n return () => closeDialogTier(tier);\n }, [visible]);\n const resolvedZIndex = dialogTier === null ? undefined : dialogZIndexForTier(dialogTier);\n\n useEffect(() => {\n if (!visible) return;\n const target = focusesConfirmButton\n ? confirmRef.current\n : focusesDismissingButton\n ? cancelRef.current\n : titleRef.current;\n const frame = requestAnimationFrame(() => target?.focus());\n return () => cancelAnimationFrame(frame);\n }, [focusesConfirmButton, focusesDismissingButton, visible]);\n\n const handleClose = async (result: DialogResult) => {\n let shouldCloseThroughContext = true;\n\n if (result === DialogResult.Ok || result === DialogResult.Yes) {\n if (onConfirm) {\n const closeResult = await onConfirm();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n } else if (onCancel) {\n const closeResult = await onCancel();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n\n if (shouldCloseThroughContext) contextCloseDialog?.(result);\n };\n\n const footerButton = (\n result: DialogResult,\n label: string,\n primary: boolean,\n focused: boolean,\n ) => (\n <button\n key={`${result}-${label}`}\n {...(primary ? pt?.confirm : pt?.cancel)}\n type='button'\n className={classNames(\n 'cratis-dialog__button',\n primary\n ? 'cratis-dialog__button--primary'\n : 'cratis-dialog__button--secondary',\n primary ? pt?.confirm?.className : pt?.cancel?.className,\n )}\n data-cratis-part={primary ? 'confirm' : 'cancel'}\n data-disabled={(primary ? !isDialogValid || isBusy : isBusy) || undefined}\n data-busy={isBusy || undefined}\n ref={primary ? confirmRef : focused ? cancelRef : undefined}\n onClick={() => void handleClose(result)}\n disabled={primary ? !isDialogValid || isBusy : isBusy}\n autoFocus={focused}\n aria-busy={primary && isBusy ? true : undefined}\n >\n {primary && isBusy && (\n <span className='cratis-dialog__spinner' aria-hidden='true' />\n )}\n <span>{label}</span>\n </button>\n );\n\n const predefinedFooter = () => {\n if (typeof buttons !== 'number') return buttons;\n\n switch (buttons) {\n case DialogButtons.Ok:\n return footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n );\n case DialogButtons.OkCancel:\n return (\n <>\n {footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNo:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.No,\n resolvedNoLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNoCancel:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(DialogResult.No, resolvedNoLabel, false, false)}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n default:\n return null;\n }\n };\n\n const dialogDocument = (\n <DialogStackContext.Provider value={resolvedZIndex ?? DIALOG_ZINDEX_TOKEN}>\n <AriaDialog\n className='cratis-dialog__document'\n aria-describedby={hasSubtitle ? subtitleId : undefined}\n >\n <>\n <header\n {...pt?.header}\n className={classNames('cratis-dialog__header', pt?.header?.className)}\n style={pt?.header?.style}\n data-cratis-part='header'\n >\n <Heading\n {...pt?.title}\n slot='title'\n tabIndex={focusesTitle ? -1 : undefined}\n ref={titleRef}\n className={classNames(\n 'cratis-dialog__title',\n pt?.title?.className,\n )}\n style={pt?.title?.style}\n data-cratis-part='title'\n >\n {title}\n </Heading>\n {hasSubtitle && (\n <p\n {...pt?.subtitle}\n id={subtitleId}\n className={classNames(\n 'cratis-dialog__subtitle',\n pt?.subtitle?.className,\n )}\n style={pt?.subtitle?.style}\n data-cratis-part='subtitle'\n >\n {subtitle}\n </p>\n )}\n {allowsDismissal && (\n <button\n {...pt?.close}\n type='button'\n disabled={isBusy}\n className={classNames(\n 'cratis-dialog__close',\n pt?.close?.className,\n )}\n data-cratis-part='close'\n data-disabled={isBusy || undefined}\n data-busy={isBusy || undefined}\n aria-label={resolvedCloseAriaLabel}\n onClick={() => void handleClose(DialogResult.Cancelled)}\n >\n <span aria-hidden='true'>{resolvedCloseIcon}</span>\n </button>\n )}\n </header>\n <div\n {...pt?.content}\n className={classNames(\n 'cratis-dialog__content',\n pt?.content?.className,\n )}\n style={{ ...pt?.content?.style, ...contentStyle }}\n data-cratis-part='content'\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <fieldset\n className='cratis-dialog__busy-scope'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isBusy}\n inert={isBusy}\n aria-busy={isBusy || undefined}\n >\n {children}\n </fieldset>\n </div>\n {buttons !== null && (\n <footer\n {...pt?.footer}\n className={classNames(\n 'cratis-dialog__footer',\n pt?.footer?.className,\n )}\n style={pt?.footer?.style}\n data-cratis-part='footer'\n >\n <fieldset\n className='cratis-dialog__busy-scope cratis-dialog__busy-scope--footer'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isBusy}\n inert={isBusy}\n aria-busy={isBusy || undefined}\n >\n {predefinedFooter()}\n </fieldset>\n </footer>\n )}\n </>\n </AriaDialog>\n </DialogStackContext.Provider>\n );\n\n const dialogStyle = { width, ...pt?.root?.style, ...style };\n\n // useSyncExternalStore supplies the server snapshot during hydration, so this\n // fallback is identical on the server and on the client's first render. React\n // switches to the portaled React Aria modal only after hydration completes.\n if (!isBrowser) {\n if (!visible) return null;\n return (\n <div\n {...pt?.backdrop}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <section\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </section>\n </div>\n </div>\n );\n }\n\n return (\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <ModalOverlay\n {...pt?.backdrop}\n isOpen={visible}\n onOpenChange={(open) => {\n if (!open && !isBusy) void handleClose(DialogResult.Cancelled);\n }}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={!isDismissable}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <Modal\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </Modal>\n </div>\n </ModalOverlay>\n </UNSAFE_PortalProvider>\n );\n};\n"],"names":["_jsxs","_jsx","_Fragment","AriaDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAM,6BAA6B,GAAG,MAAM,MAAM,SAAS;AAC3D,MAAM,YAAY,GAAG,MACjB,oBAAoB,CAChB,6BAA6B,EAC7B,MAAM,IAAI,EACV,MAAM,KAAK,CACd;AAME,MAAM,oBAAoB,GAAG,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,SAAS,EACT,OAAO,GAAG,IAAI,EACd,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,GAAG,aAAa,CAAC,QAAQ,EAChC,YAA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AC,YAAY,CAAC,SAAS,CAAC;YAClE,CAAC,EACD,aAAa,EAAE,aAAa,EAC5B,yBAAyB,EAAE,CAAC,aAAa,EACzC,SAAS,EAAE,UAAU,CAAC,yBAAyB,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,EACzE,KAAK,EAAE;gBACH,MAAM,EAAE,cAAc,IAAI,mBAAmB;AAC7C,gBAAA,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK;aACzB,EAAA,kBAAA,EACgB,UAAU,oBACX,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,eACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE9BA,GAAA,CAAA,KAAA,EAAA,EAAA,GACQ,EAAE,EAAE,UAAU,EAClB,SAAS,EAAE,UAAU,CACjB,2BAA2B,EAC3B,EAAE,EAAE,UAAU,EAAE,SAAS,CAC5B,EACD,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,sBACX,YAAY,EAAA,gBAAA,EACb,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,EAAA,WAAA,EACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE9BA,IAAC,KAAK,EAAA,EAAA,GACE,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,UAAU,CACjB,eAAe,EACf,EAAE,EAAE,IAAI,EAAE,SAAS,EACnB,SAAS,CACZ,EACD,KAAK,EAAE,WAAW,EAAA,kBAAA,EACD,MAAM,oBACP,SAAS,EAAA,WAAA,EACd,OAAO,IAAI,SAAS,eACpB,MAAM,IAAI,SAAS,EAAA,QAAA,EAE7B,cAAc,GACX,EAAA,CACN,EAAA,CACK,EAAA,CACK;AAEhC;;"}
|
|
1
|
+
{"version":3,"file":"DialogImplementation.js","sources":["../../../Dialogs/DialogImplementation.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogResult, DialogButtons, useDialogContext } from '@cratis/arc.react/dialogs';\nimport { Dialog as AriaDialog, Heading } from 'react-aria-components/Dialog';\nimport { Modal, ModalOverlay } from 'react-aria-components/Modal';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport type React from 'react';\nimport { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { DialogInitialFocus } from './DialogInitialFocus';\nimport type { DialogProps } from './Dialog';\nimport { useCratisComponentsConfig } from '../Common/CratisComponentsProvider';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport {\n DIALOG_ZINDEX_TOKEN,\n closeDialogTier,\n dialogZIndexForTier,\n openDialogTier,\n} from '../renderer/dialogStack';\nimport { DialogStackContext } from '../renderer/DialogStackContext';\nimport { classNames } from '../ClassNames/classNames';\n\n// Inline rather than in Dialog.css: the packed aggregate stylesheet has a reviewed size budget.\nconst visuallyHidden: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n padding: 0,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\nconst subscribeToBrowserEnvironment = () => () => undefined;\nconst useIsBrowser = () =>\n useSyncExternalStore(\n subscribeToBrowserEnvironment,\n () => true,\n () => false,\n );\n\n/**\n * A modal dialog with Arc host integration, typed footer actions, busy/validity\n * state, controlled dismissal, and stable Cratis-owned styling parts.\n */\nexport const DialogImplementation = ({\n title,\n subtitle,\n placement = 'center',\n closeIcon,\n visible = true,\n onClose,\n onConfirm,\n onCancel,\n buttons = DialogButtons.OkCancel,\n initialFocus = DialogInitialFocus.Confirm,\n children,\n width = '450px',\n style,\n contentStyle,\n isValid,\n isBusy = false,\n okLabel,\n cancelLabel,\n yesLabel,\n noLabel,\n closeAriaLabel,\n dismissable,\n className,\n pt,\n}: DialogProps) => {\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const { messages } = useCratisComponentsConfig();\n const dialogMessages = messages?.dialog;\n const resolvedOkLabel = okLabel ?? dialogMessages?.ok ?? 'Ok';\n const resolvedCancelLabel = cancelLabel ?? dialogMessages?.cancel ?? 'Cancel';\n const resolvedYesLabel = yesLabel ?? dialogMessages?.yes ?? 'Yes';\n const resolvedNoLabel = noLabel ?? dialogMessages?.no ?? 'No';\n const resolvedCloseAriaLabel = closeAriaLabel ?? dialogMessages?.close ?? 'Close';\n const resolvedRefusedMessage =\n dialogMessages?.refused ??\n 'The action was not completed. Review the dialog and try again.';\n const icon = useCratisIcon();\n const resolvedCloseIcon = icon('close', '×', closeIcon);\n let contextCloseDialog: ((result: DialogResult) => void) | undefined;\n try {\n const context = useDialogContext();\n contextCloseDialog = context?.closeDialog;\n } catch {\n contextCloseDialog = undefined;\n }\n\n const isBrowser = useIsBrowser();\n const subtitleId = useId();\n const hasSubtitle = subtitle !== undefined && subtitle !== null && subtitle !== false;\n const titleRef = useRef<HTMLHeadingElement>(null);\n const confirmRef = useRef<HTMLButtonElement>(null);\n const cancelRef = useRef<HTMLButtonElement>(null);\n\n const [refusals, setRefusals] = useState(0);\n const handledRefusals = useRef(0);\n const [announcement, setAnnouncement] = useState<{ key: number; text: string } | null>(null);\n const isDialogValid = isValid !== false;\n const hasDismissingButton =\n typeof buttons === 'number' && buttons !== DialogButtons.Ok;\n const resolvedInitialFocus =\n initialFocus === DialogInitialFocus.Cancel && !hasDismissingButton\n ? DialogInitialFocus.Content\n : initialFocus;\n const focusesConfirmButton = resolvedInitialFocus === DialogInitialFocus.Confirm;\n const focusesDismissingButton = resolvedInitialFocus === DialogInitialFocus.Cancel;\n const focusesTitle = resolvedInitialFocus === DialogInitialFocus.Content;\n const allowsDismissal = dismissable ?? typeof buttons === 'number';\n const isDismissable = allowsDismissal && !isBusy;\n\n // Assigns this dialog a strictly increasing tier for as long as it is visible, so a second\n // dialog opened while this one is still open - from anywhere, not necessarily as a React\n // child of this one - stacks above it rather than colliding on the same static z-index.\n const [dialogTier, setDialogTier] = useState<number | null>(null);\n useLayoutEffect(() => {\n if (!visible) {\n setDialogTier(null);\n return;\n }\n const tier = openDialogTier();\n setDialogTier(tier);\n return () => closeDialogTier(tier);\n }, [visible]);\n const resolvedZIndex = dialogTier === null ? undefined : dialogZIndexForTier(dialogTier);\n\n useEffect(() => {\n if (!visible) return;\n const target = focusesConfirmButton\n ? confirmRef.current\n : focusesDismissingButton\n ? cancelRef.current\n : titleRef.current;\n const frame = requestAnimationFrame(() => target?.focus());\n return () => cancelAnimationFrame(frame);\n }, [focusesConfirmButton, focusesDismissingButton, visible]);\n\n // Keyboard focus must never be stranded on <body> while work is in flight: the confirm\n // button stays focusable (aria-disabled), and a focus held by a now-inert field moves to it.\n useEffect(() => {\n if (!visible || !isBusy) return;\n setAnnouncement(null);\n const active = document.activeElement;\n if (active && active !== document.body) return;\n if (confirmRef.current) {\n confirmRef.current.focus();\n } else if (titleRef.current) {\n titleRef.current.tabIndex = -1;\n titleRef.current.focus();\n }\n }, [isBusy, visible]);\n\n // A refused confirm (the dialog stays open) returns focus to the confirm button, or to the\n // title when confirm is not enabled, and announces the outcome through the live region.\n useEffect(() => {\n // Each refusal is handled once: a later busy-to-idle change, such as a successful retry,\n // must neither move focus nor announce the earlier refusal again.\n if (refusals === handledRefusals.current || isBusy) return;\n handledRefusals.current = refusals;\n const confirm = confirmRef.current;\n if (confirm && !confirm.disabled) {\n confirm.focus();\n } else if (titleRef.current) {\n titleRef.current.tabIndex = -1;\n titleRef.current.focus();\n }\n setAnnouncement({ key: refusals, text: resolvedRefusedMessage });\n }, [refusals, isBusy, resolvedRefusedMessage]);\n\n const handleClose = async (result: DialogResult) => {\n let shouldCloseThroughContext = true;\n const isConfirming = result === DialogResult.Ok || result === DialogResult.Yes;\n\n if (result === DialogResult.Ok || result === DialogResult.Yes) {\n if (onConfirm) {\n const closeResult = await onConfirm();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n } else if (onCancel) {\n const closeResult = await onCancel();\n shouldCloseThroughContext = closeResult === true;\n } else if (onClose) {\n const closeResult = await onClose(result);\n shouldCloseThroughContext = closeResult !== false;\n }\n\n if (shouldCloseThroughContext) contextCloseDialog?.(result);\n else if (isConfirming) setRefusals((count) => count + 1);\n };\n\n const footerButton = (\n result: DialogResult,\n label: string,\n primary: boolean,\n focused: boolean,\n ) => (\n <button\n key={`${result}-${label}`}\n {...(primary ? pt?.confirm : pt?.cancel)}\n type='button'\n className={classNames(\n 'cratis-dialog__button',\n primary\n ? 'cratis-dialog__button--primary'\n : 'cratis-dialog__button--secondary',\n primary ? pt?.confirm?.className : pt?.cancel?.className,\n )}\n data-cratis-part={primary ? 'confirm' : 'cancel'}\n data-disabled={(primary ? !isDialogValid || isBusy : isBusy) || undefined}\n data-busy={isBusy || undefined}\n ref={primary ? confirmRef : focused ? cancelRef : undefined}\n onClick={() => {\n if (isBusy) return;\n void handleClose(result);\n }}\n onKeyDown={\n primary\n ? (event) => {\n // A held key must not re-submit when focus returns after a refusal.\n if (event.repeat && (event.key === 'Enter' || event.key === ' '))\n event.preventDefault();\n }\n : undefined\n }\n disabled={primary ? !isDialogValid : isBusy}\n autoFocus={focused}\n aria-disabled={primary && isBusy ? true : undefined}\n aria-busy={primary && isBusy ? true : undefined}\n >\n {primary && isBusy && (\n <span className='cratis-dialog__spinner' aria-hidden='true' />\n )}\n <span>{label}</span>\n </button>\n );\n\n // The predefined footer keeps the confirm button focusable while busy, so only a custom\n // footer needs the whole scope disabled; predefined secondary buttons disable themselves.\n const isFooterScopeBusy = isBusy && typeof buttons !== 'number';\n\n const predefinedFooter = () => {\n if (typeof buttons !== 'number') return buttons;\n\n switch (buttons) {\n case DialogButtons.Ok:\n return footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n );\n case DialogButtons.OkCancel:\n return (\n <>\n {footerButton(\n DialogResult.Ok,\n resolvedOkLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNo:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(\n DialogResult.No,\n resolvedNoLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n case DialogButtons.YesNoCancel:\n return (\n <>\n {footerButton(\n DialogResult.Yes,\n resolvedYesLabel,\n true,\n focusesConfirmButton,\n )}\n {footerButton(DialogResult.No, resolvedNoLabel, false, false)}\n {footerButton(\n DialogResult.Cancelled,\n resolvedCancelLabel,\n false,\n focusesDismissingButton,\n )}\n </>\n );\n default:\n return null;\n }\n };\n\n const dialogDocument = (\n <DialogStackContext.Provider value={resolvedZIndex ?? DIALOG_ZINDEX_TOKEN}>\n <AriaDialog\n className='cratis-dialog__document'\n aria-describedby={hasSubtitle ? subtitleId : undefined}\n >\n <>\n <header\n {...pt?.header}\n className={classNames('cratis-dialog__header', pt?.header?.className)}\n style={pt?.header?.style}\n data-cratis-part='header'\n >\n <Heading\n {...pt?.title}\n slot='title'\n tabIndex={focusesTitle ? -1 : undefined}\n ref={titleRef}\n className={classNames(\n 'cratis-dialog__title',\n pt?.title?.className,\n )}\n style={pt?.title?.style}\n data-cratis-part='title'\n >\n {title}\n </Heading>\n {hasSubtitle && (\n <p\n {...pt?.subtitle}\n id={subtitleId}\n className={classNames(\n 'cratis-dialog__subtitle',\n pt?.subtitle?.className,\n )}\n style={pt?.subtitle?.style}\n data-cratis-part='subtitle'\n >\n {subtitle}\n </p>\n )}\n {allowsDismissal && (\n <button\n {...pt?.close}\n type='button'\n disabled={isBusy}\n className={classNames(\n 'cratis-dialog__close',\n pt?.close?.className,\n )}\n data-cratis-part='close'\n data-disabled={isBusy || undefined}\n data-busy={isBusy || undefined}\n aria-label={resolvedCloseAriaLabel}\n onClick={() => void handleClose(DialogResult.Cancelled)}\n >\n <span aria-hidden='true'>{resolvedCloseIcon}</span>\n </button>\n )}\n </header>\n <div\n {...pt?.content}\n className={classNames(\n 'cratis-dialog__content',\n pt?.content?.className,\n )}\n style={{ ...pt?.content?.style, ...contentStyle }}\n data-cratis-part='content'\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <fieldset\n className='cratis-dialog__busy-scope'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isBusy}\n inert={isBusy}\n aria-busy={isBusy || undefined}\n >\n {children}\n </fieldset>\n </div>\n {buttons !== null && (\n <footer\n {...pt?.footer}\n className={classNames(\n 'cratis-dialog__footer',\n pt?.footer?.className,\n )}\n style={pt?.footer?.style}\n data-cratis-part='footer'\n >\n <fieldset\n className='cratis-dialog__busy-scope cratis-dialog__busy-scope--footer'\n data-cratis-part='busy-scope'\n data-busy={isBusy || undefined}\n disabled={isFooterScopeBusy}\n inert={isFooterScopeBusy}\n aria-busy={isBusy || undefined}\n >\n {predefinedFooter()}\n </fieldset>\n </footer>\n )}\n <div\n className='cratis-dialog__live-region'\n style={visuallyHidden}\n role='status'\n aria-live='polite'\n aria-atomic='true'\n >\n {announcement && <span key={announcement.key}>{announcement.text}</span>}\n </div>\n </>\n </AriaDialog>\n </DialogStackContext.Provider>\n );\n\n const dialogStyle = { width, ...pt?.root?.style, ...style };\n\n // useSyncExternalStore supplies the server snapshot during hydration, so this\n // fallback is identical on the server and on the client's first render. React\n // switches to the portaled React Aria modal only after hydration completes.\n if (!isBrowser) {\n if (!visible) return null;\n return (\n <div\n {...pt?.backdrop}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <section\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </section>\n </div>\n </div>\n );\n }\n\n return (\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <ModalOverlay\n {...pt?.backdrop}\n isOpen={visible}\n onOpenChange={(open) => {\n if (!open && !isBusy) void handleClose(DialogResult.Cancelled);\n }}\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={!isDismissable}\n className={classNames('cratis-dialog__backdrop', pt?.backdrop?.className)}\n style={{\n zIndex: resolvedZIndex ?? DIALOG_ZINDEX_TOKEN,\n ...pt?.backdrop?.style,\n }}\n data-cratis-part='backdrop'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <div\n {...pt?.positioner}\n className={classNames(\n 'cratis-dialog__positioner',\n pt?.positioner?.className,\n )}\n style={pt?.positioner?.style}\n data-cratis-part='positioner'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n <Modal\n {...pt?.root}\n className={classNames(\n 'cratis-dialog',\n pt?.root?.className,\n className,\n )}\n style={dialogStyle}\n data-cratis-part='root'\n data-placement={placement}\n data-open={visible || undefined}\n data-busy={isBusy || undefined}\n >\n {dialogDocument}\n </Modal>\n </div>\n </ModalOverlay>\n </UNSAFE_PortalProvider>\n );\n};\n"],"names":["_jsxs","_jsx","_Fragment","AriaDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,MAAM,cAAc,GAAwB;AACxC,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,EAAE;AACV,IAAA,OAAO,EAAE,CAAC;AACV,IAAA,QAAQ,EAAE,QAAQ;A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