@cratis/components 4.40.1 → 4.41.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/Chat/Kit/Emoji/EmojiOptions.d.ts +13 -0
- package/dist/esm/Chat/Kit/Emoji/EmojiOptions.d.ts.map +1 -0
- package/dist/esm/Chat/Kit/Emoji/EmojiOptions.js +12 -0
- package/dist/esm/Chat/Kit/Emoji/EmojiOptions.js.map +1 -0
- package/dist/esm/Chat/Kit/Emoji/EmojiPicker.d.ts +2 -2
- package/dist/esm/Chat/Kit/Emoji/EmojiPicker.d.ts.map +1 -1
- package/dist/esm/Chat/Kit/Emoji/EmojiPicker.js +7 -9
- package/dist/esm/Chat/Kit/Emoji/EmojiPicker.js.map +1 -1
- package/dist/esm/Chat/Kit/Emoji/movePickerFocus.d.ts +4 -0
- package/dist/esm/Chat/Kit/Emoji/movePickerFocus.d.ts.map +1 -0
- package/dist/esm/Chat/Kit/Emoji/movePickerFocus.js +21 -0
- package/dist/esm/Chat/Kit/Emoji/movePickerFocus.js.map +1 -0
- package/dist/esm/Chat/Kit/Emoji/useEmojiPickerFocus.d.ts +3 -0
- package/dist/esm/Chat/Kit/Emoji/useEmojiPickerFocus.d.ts.map +1 -0
- package/dist/esm/Chat/Kit/Emoji/useEmojiPickerFocus.js +15 -0
- package/dist/esm/Chat/Kit/Emoji/useEmojiPickerFocus.js.map +1 -0
- package/dist/esm/Chat/Kit/ReactionPicker.d.ts.map +1 -1
- package/dist/esm/Chat/Kit/ReactionPicker.js +8 -22
- package/dist/esm/Chat/Kit/ReactionPicker.js.map +1 -1
- package/dist/esm/Chat/Kit/useReactionPickerFocus.d.ts +7 -0
- package/dist/esm/Chat/Kit/useReactionPickerFocus.d.ts.map +1 -0
- package/dist/esm/Chat/Kit/useReactionPickerFocus.js +28 -0
- package/dist/esm/Chat/Kit/useReactionPickerFocus.js.map +1 -0
- package/dist/esm/CommandForm/fields/CalendarField.d.ts +2 -0
- package/dist/esm/CommandForm/fields/CalendarField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/CalendarField.js +1 -1
- package/dist/esm/CommandForm/fields/CalendarField.js.map +1 -1
- package/dist/esm/Common/DatePickerInput.d.ts +2 -0
- package/dist/esm/Common/DatePickerInput.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerInput.js.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js +3 -3
- package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
- package/dist/esm/Common/DatePickerPopover.d.ts +2 -1
- package/dist/esm/Common/DatePickerPopover.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerPopover.js +1 -1
- package/dist/esm/Common/DatePickerPopover.js.map +1 -1
- package/dist/esm/Common/Page.d.ts +2 -0
- package/dist/esm/Common/Page.d.ts.map +1 -1
- package/dist/esm/Common/Page.js +3 -2
- package/dist/esm/Common/Page.js.map +1 -1
- package/dist/esm/Common/useDatePickerAccessibility.d.ts +10 -0
- package/dist/esm/Common/useDatePickerAccessibility.d.ts.map +1 -0
- package/dist/esm/Common/useDatePickerAccessibility.js +14 -0
- package/dist/esm/Common/useDatePickerAccessibility.js.map +1 -0
- package/dist/esm/DataPage/DataPage.d.ts +2 -0
- package/dist/esm/DataPage/DataPage.d.ts.map +1 -1
- package/dist/esm/DataPage/DataPage.js +1 -1
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/package.json +1 -1
package/compat-manifest.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{
|
|
69
69
|
"name": "@cratis/components",
|
|
70
70
|
"role": "core",
|
|
71
|
-
"version": "4.
|
|
71
|
+
"version": "4.41.0",
|
|
72
72
|
"releaseMajorRange": ">=4 <5",
|
|
73
73
|
"independentRelease": false,
|
|
74
74
|
"private": false,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
{
|
|
93
93
|
"name": "@cratis/eslint-plugin-components",
|
|
94
94
|
"role": "eslint",
|
|
95
|
-
"version": "4.
|
|
95
|
+
"version": "4.41.0",
|
|
96
96
|
"releaseMajorRange": ">=4 <5",
|
|
97
97
|
"independentRelease": false,
|
|
98
98
|
"private": false,
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
{
|
|
106
106
|
"name": "@cratis/components.migrator",
|
|
107
107
|
"role": "migrator",
|
|
108
|
-
"version": "4.
|
|
108
|
+
"version": "4.41.0",
|
|
109
109
|
"releaseMajorRange": ">=4 <5",
|
|
110
110
|
"independentRelease": false,
|
|
111
111
|
"private": false,
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
{
|
|
117
117
|
"name": "@cratis/components.conformance",
|
|
118
118
|
"role": "conformance",
|
|
119
|
-
"version": "4.
|
|
119
|
+
"version": "4.41.0",
|
|
120
120
|
"releaseMajorRange": ">=4 <5",
|
|
121
121
|
"independentRelease": false,
|
|
122
122
|
"private": false,
|
|
123
123
|
"packageAccess": "public",
|
|
124
124
|
"peerDependencies": {
|
|
125
|
-
"@cratis/components": "4.
|
|
125
|
+
"@cratis/components": "4.41.0",
|
|
126
126
|
"react": "^19.0.0",
|
|
127
127
|
"react-dom": "^19.0.0"
|
|
128
128
|
},
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
{
|
|
133
133
|
"name": "@cratis/components.mui",
|
|
134
134
|
"role": "renderer-adapter",
|
|
135
|
-
"version": "4.
|
|
135
|
+
"version": "4.41.0",
|
|
136
136
|
"releaseMajorRange": ">=4 <5",
|
|
137
137
|
"independentRelease": false,
|
|
138
138
|
"private": false,
|
|
139
139
|
"packageAccess": "public",
|
|
140
140
|
"peerDependencies": {
|
|
141
|
-
"@cratis/components": "4.
|
|
141
|
+
"@cratis/components": "4.41.0",
|
|
142
142
|
"@emotion/react": ">=11.5 <12",
|
|
143
143
|
"@emotion/styled": ">=11.11 <12",
|
|
144
144
|
"@mui/material": ">=9 <10",
|
|
@@ -188,13 +188,13 @@
|
|
|
188
188
|
{
|
|
189
189
|
"name": "@cratis/components.primereact",
|
|
190
190
|
"role": "renderer-adapter",
|
|
191
|
-
"version": "4.
|
|
191
|
+
"version": "4.41.0",
|
|
192
192
|
"releaseMajorRange": ">=4 <5",
|
|
193
193
|
"independentRelease": false,
|
|
194
194
|
"private": false,
|
|
195
195
|
"packageAccess": "public",
|
|
196
196
|
"peerDependencies": {
|
|
197
|
-
"@cratis/components": "4.
|
|
197
|
+
"@cratis/components": "4.41.0",
|
|
198
198
|
"@primereact/core": ">=11 <12",
|
|
199
199
|
"@primereact/ui": ">=11 <12",
|
|
200
200
|
"@primeuix/themes": ">=3 <4",
|
|
@@ -256,13 +256,13 @@
|
|
|
256
256
|
{
|
|
257
257
|
"name": "@cratis/components.primereact10",
|
|
258
258
|
"role": "renderer-adapter",
|
|
259
|
-
"version": "4.
|
|
259
|
+
"version": "4.41.0",
|
|
260
260
|
"releaseMajorRange": ">=4 <5",
|
|
261
261
|
"independentRelease": false,
|
|
262
262
|
"private": false,
|
|
263
263
|
"packageAccess": "public",
|
|
264
264
|
"peerDependencies": {
|
|
265
|
-
"@cratis/components": "4.
|
|
265
|
+
"@cratis/components": "4.41.0",
|
|
266
266
|
"primereact": ">=10.9.9 <11",
|
|
267
267
|
"react": "^19.0.0",
|
|
268
268
|
"react-dom": "^19.0.0"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface EmojiOptionsProps {
|
|
2
|
+
emojis: readonly string[];
|
|
3
|
+
ownEmoji?: string;
|
|
4
|
+
columns?: number;
|
|
5
|
+
label: string;
|
|
6
|
+
className: string;
|
|
7
|
+
optionClassName: string;
|
|
8
|
+
onPick: (emoji: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/** A single-tab-stop group of emoji actions; item updates retain a valid focus entry. */
|
|
11
|
+
export declare const EmojiOptions: ({ emojis, ownEmoji, columns, label, className, optionClassName, onPick }: EmojiOptionsProps) => import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=EmojiOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiOptions.d.ts","sourceRoot":"","sources":["../../../../../Chat/Kit/Emoji/EmojiOptions.tsx"],"names":[],"mappings":"AAMA,UAAU,iBAAiB;IACvB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,6EAAkF,iBAAiB,gCAqB3H,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { movePickerFocus } from './movePickerFocus.js';
|
|
4
|
+
|
|
5
|
+
const EmojiOptions = ({ emojis, ownEmoji, columns = 1, label, className, optionClassName, onPick }) => {
|
|
6
|
+
const [focusedEmoji, setFocusedEmoji] = useState(ownEmoji);
|
|
7
|
+
const active = emojis.includes(focusedEmoji ?? '') ? focusedEmoji : emojis[0];
|
|
8
|
+
return (jsx("div", { role: 'group', "aria-label": label, className: className, onKeyDown: (event) => movePickerFocus(event, columns), children: emojis.map((emoji) => (jsx("button", { type: 'button', "data-picker-item": true, tabIndex: active === emoji ? 0 : -1, "aria-pressed": emoji === ownEmoji, className: `${optionClassName}${emoji === ownEmoji ? ` ${optionClassName}--selected` : ''}`, onFocus: () => setFocusedEmoji(emoji), onClick: () => onPick(emoji), children: emoji }, emoji))) }));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { EmojiOptions };
|
|
12
|
+
//# sourceMappingURL=EmojiOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiOptions.js","sources":["../../../../../Chat/Kit/Emoji/EmojiOptions.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 { useState } from 'react';\nimport { movePickerFocus } from './movePickerFocus';\n\ninterface EmojiOptionsProps {\n emojis: readonly string[];\n ownEmoji?: string;\n columns?: number;\n label: string;\n className: string;\n optionClassName: string;\n onPick: (emoji: string) => void;\n}\n\n/** A single-tab-stop group of emoji actions; item updates retain a valid focus entry. */\nexport const EmojiOptions = ({ emojis, ownEmoji, columns = 1, label, className, optionClassName, onPick }: EmojiOptionsProps) => {\n const [focusedEmoji, setFocusedEmoji] = useState(ownEmoji);\n const active = emojis.includes(focusedEmoji ?? '') ? focusedEmoji : emojis[0];\n return (\n <div role='group' aria-label={label} className={className} onKeyDown={(event) => movePickerFocus(event, columns)}>\n {emojis.map((emoji) => (\n <button\n key={emoji}\n type='button'\n data-picker-item\n tabIndex={active === emoji ? 0 : -1}\n aria-pressed={emoji === ownEmoji}\n className={`${optionClassName}${emoji === ownEmoji ? ` ${optionClassName}--selected` : ''}`}\n onFocus={() => setFocusedEmoji(emoji)}\n onClick={() => onPick(emoji)}\n >\n {emoji}\n </button>\n ))}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;MAiBa,YAAY,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAqB,KAAI;IAC5H,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAC1D,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,GAAG,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC;IAC7E,QACIA,GAAA,CAAA,KAAA,EAAA,EAAK,IAAI,EAAC,OAAO,gBAAa,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,KAAK,KAAK,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,EAAA,QAAA,EAC3G,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,MACdA,GAAA,CAAA,QAAA,EAAA,EAEI,IAAI,EAAC,QAAQ,4BAEb,QAAQ,EAAE,MAAM,KAAK,KAAK,GAAG,CAAC,GAAG,EAAE,EAAA,cAAA,EACrB,KAAK,KAAK,QAAQ,EAChC,SAAS,EAAE,CAAA,EAAG,eAAe,CAAA,EAAG,KAAK,KAAK,QAAQ,GAAG,CAAA,CAAA,EAAI,eAAe,CAAA,UAAA,CAAY,GAAG,EAAE,CAAA,CAAE,EAC3F,OAAO,EAAE,MAAM,eAAe,CAAC,KAAK,CAAC,EACrC,OAAO,EAAE,MAAM,MAAM,CAAC,KAAK,CAAC,EAAA,QAAA,EAE3B,KAAK,EAAA,EATD,KAAK,CAUL,CACZ,CAAC,EAAA,CACA;AAEd;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EmojiCategoryKey } from './EmojiCategoryKey.js';
|
|
2
2
|
/** Overrides for the picker's labels. Any field left unset falls back to a literal English default. */
|
|
3
3
|
export interface EmojiPickerLabels {
|
|
4
|
-
/** Accessible label for the picker
|
|
4
|
+
/** Accessible label for the picker group. Defaults to `'All emojis'`. */
|
|
5
5
|
allEmojis?: string;
|
|
6
|
-
/** Accessible label for the emoji
|
|
6
|
+
/** Accessible label for the emoji button group. Defaults to `'Pick an emoji'`. */
|
|
7
7
|
pickEmoji?: string;
|
|
8
8
|
/** Accessible label for the category tab list. Defaults to `'Emoji categories'`. */
|
|
9
9
|
emojiCategories?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiPicker.d.ts","sourceRoot":"","sources":["../../../../../Chat/Kit/Emoji/EmojiPicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmojiPicker.d.ts","sourceRoot":"","sources":["../../../../../Chat/Kit/Emoji/EmojiPicker.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AA6BtD,uGAAuG;AACvG,MAAM,WAAW,iBAAiB;IAC9B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8FAA8F;IAC9F,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1D;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC,6FAA6F;IAC7F,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,iCAAkC,gBAAgB,gCAqCzE,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Tabs, TabList, Tab, TabPanel } from 'react-aria-components/Tabs';
|
|
4
|
+
import { EmojiOptions } from './EmojiOptions.js';
|
|
5
|
+
import { useEmojiPickerFocus } from './useEmojiPickerFocus.js';
|
|
3
6
|
import { EMOJI_CATALOG } from './emojiCatalog.js';
|
|
4
7
|
import { EmojiCategoryKey } from './EmojiCategoryKey.js';
|
|
5
8
|
|
|
@@ -27,14 +30,9 @@ const DEFAULT_CATEGORY_LABELS = {
|
|
|
27
30
|
};
|
|
28
31
|
const EmojiPicker = ({ ownEmoji, onPick, labels }) => {
|
|
29
32
|
const [category, setCategory] = useState(EmojiCategoryKey.Smileys);
|
|
30
|
-
const
|
|
31
|
-
const showCategory = (key) => {
|
|
32
|
-
setCategory(key);
|
|
33
|
-
gridRef.current?.scrollTo({ top: 0 });
|
|
34
|
-
};
|
|
35
|
-
const emojis = EMOJI_CATALOG.find((section) => section.key === category)?.emojis ?? [];
|
|
33
|
+
const rootRef = useEmojiPickerFocus();
|
|
36
34
|
const categoryLabel = (key) => labels?.categories?.[key] ?? DEFAULT_CATEGORY_LABELS[key];
|
|
37
|
-
return (
|
|
35
|
+
return (jsx("div", { ref: rootRef, className: 'emoji-picker', role: 'group', "aria-label": labels?.allEmojis ?? 'All emojis', children: jsxs(Tabs, { selectedKey: category, onSelectionChange: (key) => setCategory(key), className: 'emoji-picker__categories', children: [jsx(TabList, { className: 'emoji-picker__tabs', "aria-label": labels?.emojiCategories ?? 'Emoji categories', children: EMOJI_CATALOG.map((section) => (jsx(Tab, { id: section.key, "aria-label": categoryLabel(section.key), className: ({ isSelected }) => `emoji-picker__tab${isSelected ? ' emoji-picker__tab--current' : ''}`, children: jsx("span", { title: categoryLabel(section.key), children: CATEGORY_GLYPHS[section.key] }) }, section.key))) }), EMOJI_CATALOG.map((section) => (jsx(TabPanel, { id: section.key, children: jsx(EmojiOptions, { emojis: section.emojis, ownEmoji: ownEmoji, columns: 8, label: labels?.pickEmoji ?? 'Pick an emoji', className: 'emoji-picker__grid', optionClassName: 'emoji-picker__emoji', onPick: onPick }) }, section.key)))] }) }));
|
|
38
36
|
};
|
|
39
37
|
|
|
40
38
|
export { EmojiPicker };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiPicker.js","sources":["../../../../../Chat/Kit/Emoji/EmojiPicker.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 {
|
|
1
|
+
{"version":3,"file":"EmojiPicker.js","sources":["../../../../../Chat/Kit/Emoji/EmojiPicker.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 { useState } from 'react';\nimport { Tab, TabList, TabPanel, Tabs } from 'react-aria-components/Tabs';\nimport { EmojiOptions } from './EmojiOptions';\nimport { useEmojiPickerFocus } from './useEmojiPickerFocus';\nimport { EMOJI_CATALOG } from './emojiCatalog';\nimport { EmojiCategoryKey } from './EmojiCategoryKey';\n\n/** The tab glyph for each section — the picker's own labels are its icons, as pickers of this kind are. */\nconst CATEGORY_GLYPHS: Record<EmojiCategoryKey, string> = {\n [EmojiCategoryKey.Smileys]: '😀',\n [EmojiCategoryKey.People]: '👋',\n [EmojiCategoryKey.Nature]: '🐻',\n [EmojiCategoryKey.Food]: '🍔',\n [EmojiCategoryKey.Activity]: '⚽',\n [EmojiCategoryKey.Travel]: '🚗',\n [EmojiCategoryKey.Objects]: '💡',\n [EmojiCategoryKey.Symbols]: '❤️',\n [EmojiCategoryKey.Flags]: '🏳️',\n};\n\n/** The literal English defaults for each category's accessible name/title, used when\n * {@link EmojiPickerLabels.categories} does not override a given key. */\nconst DEFAULT_CATEGORY_LABELS: Record<EmojiCategoryKey, string> = {\n [EmojiCategoryKey.Smileys]: 'Smileys',\n [EmojiCategoryKey.People]: 'People',\n [EmojiCategoryKey.Nature]: 'Animals & nature',\n [EmojiCategoryKey.Food]: 'Food & drink',\n [EmojiCategoryKey.Activity]: 'Activity',\n [EmojiCategoryKey.Travel]: 'Travel & places',\n [EmojiCategoryKey.Objects]: 'Objects',\n [EmojiCategoryKey.Symbols]: 'Symbols',\n [EmojiCategoryKey.Flags]: 'Flags',\n};\n\n/** Overrides for the picker's labels. Any field left unset falls back to a literal English default. */\nexport interface EmojiPickerLabels {\n /** Accessible label for the picker group. Defaults to `'All emojis'`. */\n allEmojis?: string;\n /** Accessible label for the emoji button group. Defaults to `'Pick an emoji'`. */\n pickEmoji?: string;\n /** Accessible label for the category tab list. Defaults to `'Emoji categories'`. */\n emojiCategories?: string;\n /** Per-category accessible names/titles. Unset categories fall back to their English name. */\n categories?: Partial<Record<EmojiCategoryKey, string>>;\n}\n\n/**\n * Props for the full emoji picker the quick row's last button opens — every emoji offered, in the\n * sections a picker is expected to have. Only the selected section is mounted.\n */\nexport interface EmojiPickerProps {\n /** The emoji the viewer already gave, marked so picking it again reads as taking it back. */\n ownEmoji?: string;\n\n /** Invoked with the emoji that was picked. */\n onPick: (emoji: string) => void;\n\n /** Overrides for the picker's labels. Unset fields fall back to literal English defaults. */\n labels?: EmojiPickerLabels;\n}\n\n/**\n * The full emoji picker the quick row's last button opens — every emoji offered, in the sections a\n * picker is expected to have.\n *\n * Only the selected section is mounted. A thousand buttons at once is what makes a picker of this kind\n * feel slow to open, and there is never more than one section on screen to look at anyway.\n */\nexport const EmojiPicker = ({ ownEmoji, onPick, labels }: EmojiPickerProps) => {\n const [category, setCategory] = useState(EmojiCategoryKey.Smileys);\n const rootRef = useEmojiPickerFocus();\n const categoryLabel = (key: EmojiCategoryKey) =>\n labels?.categories?.[key] ?? DEFAULT_CATEGORY_LABELS[key];\n\n return (\n <div ref={rootRef} className='emoji-picker' role='group' aria-label={labels?.allEmojis ?? 'All emojis'}>\n <Tabs selectedKey={category} onSelectionChange={(key) => setCategory(key as EmojiCategoryKey)} className='emoji-picker__categories'>\n <TabList className='emoji-picker__tabs' aria-label={labels?.emojiCategories ?? 'Emoji categories'}>\n {EMOJI_CATALOG.map((section) => (\n <Tab\n key={section.key}\n id={section.key}\n aria-label={categoryLabel(section.key)}\n className={({ isSelected }) => `emoji-picker__tab${isSelected ? ' emoji-picker__tab--current' : ''}`}\n >\n <span title={categoryLabel(section.key)}>{CATEGORY_GLYPHS[section.key]}</span>\n </Tab>\n ))}\n </TabList>\n {EMOJI_CATALOG.map((section) => (\n <TabPanel key={section.key} id={section.key}>\n <EmojiOptions\n emojis={section.emojis}\n ownEmoji={ownEmoji}\n columns={8}\n label={labels?.pickEmoji ?? 'P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,CAAC,YAAY,IACT,MAAM,EAAE,OAAO,CAAC,MAAM,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,EACV,KAAK,EAAE,MAAM,EAAE,SAAS,IAAI,eAAe,EAC3C,SAAS,EAAC,oBAAoB,EAC9B,eAAe,EAAC,qBAAqB,EACrC,MAAM,EAAE,MAAM,GAChB,EAAA,EATS,OAAO,CAAC,GAAG,CAUf,CACd,CAAC,CAAA,EAAA,CACC,EAAA,CACL;AAEd;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
/** Moves focus within a picker composite; activation remains the native button's responsibility. */
|
|
3
|
+
export declare const movePickerFocus: (event: KeyboardEvent<HTMLElement>, columns?: number) => void;
|
|
4
|
+
//# sourceMappingURL=movePickerFocus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"movePickerFocus.d.ts","sourceRoot":"","sources":["../../../../../Chat/Kit/Emoji/movePickerFocus.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,oGAAoG;AACpG,eAAO,MAAM,eAAe,UAAW,aAAa,CAAC,WAAW,CAAC,2BAgBhE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const movePickerFocus = (event, columns = 1) => {
|
|
2
|
+
const items = Array.from(event.currentTarget.querySelectorAll('[data-picker-item]:not(:disabled)'));
|
|
3
|
+
const index = items.indexOf(event.target);
|
|
4
|
+
const destinations = {
|
|
5
|
+
ArrowRight: (index + 1) % items.length,
|
|
6
|
+
ArrowDown: index + columns < items.length ? index + columns : index,
|
|
7
|
+
ArrowLeft: (index - 1 + items.length) % items.length,
|
|
8
|
+
ArrowUp: Math.max(index - columns, index % columns),
|
|
9
|
+
Home: 0,
|
|
10
|
+
End: items.length - 1,
|
|
11
|
+
};
|
|
12
|
+
const destination = destinations[event.key];
|
|
13
|
+
if (index < 0 || destination === undefined)
|
|
14
|
+
return;
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
items[destination]?.focus();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { movePickerFocus };
|
|
21
|
+
//# sourceMappingURL=movePickerFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"movePickerFocus.js","sources":["../../../../../Chat/Kit/Emoji/movePickerFocus.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 type { KeyboardEvent } from 'react';\n\n/** Moves focus within a picker composite; activation remains the native button's responsibility. */\nexport const movePickerFocus = (event: KeyboardEvent<HTMLElement>, columns = 1) => {\n const items = Array.from(event.currentTarget.querySelectorAll<HTMLButtonElement>('[data-picker-item]:not(:disabled)'));\n const index = items.indexOf(event.target as HTMLButtonElement);\n const destinations: Record<string, number> = {\n ArrowRight: (index + 1) % items.length,\n ArrowDown: index + columns < items.length ? index + columns : index,\n ArrowLeft: (index - 1 + items.length) % items.length,\n ArrowUp: Math.max(index - columns, index % columns),\n Home: 0,\n End: items.length - 1,\n };\n const destination = destinations[event.key];\n if (index < 0 || destination === undefined) return;\n event.preventDefault();\n event.stopPropagation();\n items[destination]?.focus();\n};\n"],"names":[],"mappings":"AAMO,MAAM,eAAe,GAAG,CAAC,KAAiC,EAAE,OAAO,GAAG,CAAC,KAAI;AAC9E,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAoB,mCAAmC,CAAC,CAAC;IACtH,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAA2B,CAAC;AAC9D,IAAA,MAAM,YAAY,GAA2B;QACzC,UAAU,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM;AACtC,QAAA,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK;AACnE,QAAA,SAAS,EAAE,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM;AACpD,QAAA,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC;AACnD,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;KACxB;IACD,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC;AAC3C,IAAA,IAAI,KAAK,GAAG,CAAC,IAAI,WAAW,KAAK,SAAS;QAAE;IAC5C,KAAK,CAAC,cAAc,EAAE;IACtB,KAAK,CAAC,eAAe,EAAE;AACvB,IAAA,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE;AAC/B;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEmojiPickerFocus.d.ts","sourceRoot":"","sources":["../../../../../Chat/Kit/Emoji/useEmojiPickerFocus.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,eAAO,MAAM,mBAAmB,wDAS/B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useEmojiPickerFocus = () => {
|
|
4
|
+
const rootRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const frame = requestAnimationFrame(() => {
|
|
7
|
+
rootRef.current?.querySelector('[role="tab"][aria-selected="true"]')?.focus();
|
|
8
|
+
});
|
|
9
|
+
return () => cancelAnimationFrame(frame);
|
|
10
|
+
}, []);
|
|
11
|
+
return rootRef;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { useEmojiPickerFocus };
|
|
15
|
+
//# sourceMappingURL=useEmojiPickerFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEmojiPickerFocus.js","sources":["../../../../../Chat/Kit/Emoji/useEmojiPickerFocus.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 } from 'react';\n\n/** Enters the selected category after React Aria has mounted its lazy tab collection. */\nexport const useEmojiPickerFocus = () => {\n const rootRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n const frame = requestAnimationFrame(() => {\n rootRef.current?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, []);\n return rootRef;\n};\n"],"names":[],"mappings":";;AAMO,MAAM,mBAAmB,GAAG,MAAK;AACpC,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC;IAC5C,SAAS,CAAC,MAAK;AACX,QAAA,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAK;YACrC,OAAO,CAAC,OAAO,EAAE,aAAa,CAAc,oCAAoC,CAAC,EAAE,KAAK,EAAE;AAC9F,QAAA,CAAC,CAAC;AACF,QAAA,OAAO,MAAM,oBAAoB,CAAC,KAAK,CAAC;IAC5C,CAAC,EAAE,EAAE,CAAC;AACN,IAAA,OAAO,OAAO;AAClB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionPicker.d.ts","sourceRoot":"","sources":["../../../../Chat/Kit/ReactionPicker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"ReactionPicker.d.ts","sourceRoot":"","sources":["../../../../Chat/Kit/ReactionPicker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAAuB,CAAC;AAGjE;eACe;AACf,MAAM,WAAW,oBAAoB;IACjC,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;0BACsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAE3C;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAE1C,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC,yFAAyF;IACzF,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,oBAAoB,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,2EAQxB,mBAAmB,gCAwErB,CAAC"}
|
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useId, useState } from 'react';
|
|
3
|
+
import { FocusScope } from 'react-aria';
|
|
4
|
+
import { EmojiOptions } from './Emoji/EmojiOptions.js';
|
|
3
5
|
import { EmojiPicker } from './Emoji/EmojiPicker.js';
|
|
4
6
|
import { recentEmojis, rememberEmoji } from './Emoji/recentEmojis.js';
|
|
7
|
+
import { useReactionPickerFocus } from './useReactionPickerFocus.js';
|
|
5
8
|
|
|
6
9
|
const ReactionPicker = ({ ownEmoji, reactions = [], memory, anchorRef, onPick, onDismiss, labels, }) => {
|
|
7
|
-
const rootRef =
|
|
10
|
+
const { rootRef, onKeyDown } = useReactionPickerFocus(anchorRef, onDismiss);
|
|
11
|
+
const fullPickerId = useId();
|
|
8
12
|
const store = memory ?? (typeof window === 'undefined' ? undefined : window.localStorage);
|
|
9
13
|
const [quickEmojis, setQuickEmojis] = useState(() => store ? recentEmojis(store) : []);
|
|
10
14
|
const [showingAll, setShowingAll] = useState(false);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const handlePointerDown = (event) => {
|
|
13
|
-
const target = event.target;
|
|
14
|
-
if (rootRef.current?.contains(target) || anchorRef?.current?.contains(target))
|
|
15
|
-
return;
|
|
16
|
-
onDismiss();
|
|
17
|
-
};
|
|
18
|
-
const handleKeyDown = (event) => {
|
|
19
|
-
if (event.key === 'Escape')
|
|
20
|
-
onDismiss();
|
|
21
|
-
};
|
|
22
|
-
document.addEventListener('pointerdown', handlePointerDown, true);
|
|
23
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
24
|
-
return () => {
|
|
25
|
-
document.removeEventListener('pointerdown', handlePointerDown, true);
|
|
26
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
27
|
-
};
|
|
28
|
-
}, [onDismiss, anchorRef]);
|
|
29
15
|
const pick = (emoji) => {
|
|
30
16
|
if (store)
|
|
31
17
|
setQuickEmojis(rememberEmoji(store, emoji));
|
|
32
18
|
onPick(emoji);
|
|
33
19
|
};
|
|
34
|
-
return (jsxs("div", { ref: rootRef, className: 'reaction-picker', children: [jsxs("div", { className: 'reaction-picker__quick', children: [jsx(
|
|
20
|
+
return (jsx(FocusScope, { restoreFocus: true, autoFocus: true, children: jsxs("div", { ref: rootRef, className: 'reaction-picker', onKeyDown: onKeyDown, children: [jsxs("div", { className: 'reaction-picker__quick', children: [jsx(EmojiOptions, { emojis: quickEmojis, ownEmoji: ownEmoji, label: labels?.pickEmoji ?? 'Pick an emoji', className: 'reaction-picker__options', optionClassName: 'reaction-picker__item', onPick: pick }), jsx("button", { type: 'button', className: `reaction-picker__more${showingAll ? ' reaction-picker__more--open' : ''}`, title: labels?.allEmojis ?? 'All emojis', "aria-label": labels?.allEmojis ?? 'All emojis', "aria-expanded": showingAll, "aria-controls": showingAll ? fullPickerId : undefined, onClick: () => setShowingAll((open) => !open), children: "\u263A" })] }), showingAll && (jsx("div", { id: fullPickerId, children: jsx(EmojiPicker, { ownEmoji: ownEmoji, onPick: pick, labels: labels?.emojiPicker }) })), !showingAll && reactions.length > 0 && (jsx("div", { className: 'reaction-picker__given', children: reactions.flatMap((reaction) => reaction.users.map((user) => (jsxs("div", { className: 'reaction-picker__given-row', children: [jsx("span", { className: 'reaction-picker__given-emoji', children: reaction.emoji }), jsx("span", { className: 'reaction-picker__given-name', children: user.name })] }, `${reaction.emoji}-${user.id.toString()}`)))) }))] }) }));
|
|
35
21
|
};
|
|
36
22
|
|
|
37
23
|
export { ReactionPicker };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactionPicker.js","sources":["../../../../Chat/Kit/ReactionPicker.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 { RefObject, useEffect, useRef, useState } from 'react';\nimport { EmojiPicker, type EmojiPickerLabels } from './Emoji/EmojiPicker';\nimport { recentEmojis, rememberEmoji } from './Emoji/recentEmojis';\nimport type { EmojiMemory } from './Emoji/EmojiMemory';\nimport type { ChatMessageReaction } from './ChatMessageReaction';\n\n/** Overrides for the picker's own labels. Any field left unset falls back to a literal English\n * default. */\nexport interface ReactionPickerLabels {\n /** Accessible label for the quick row. Defaults to `'Pick an emoji'`. */\n pickEmoji?: string;\n /** Tooltip/accessible label for the \"more\" button that opens the full picker. Defaults to\n * `'All emojis'`. */\n allEmojis?: string;\n /** Labels forwarded to the full {@link EmojiPicker} when it is opened. */\n emojiPicker?: EmojiPickerLabels;\n}\n\n/**\n * Props for the popover a reaction button opens: the emojis this person reached for most recently,\n * and a muted button at the end that opens the full picker — the shape Apple's tapback bar established,\n * where the quick row answers almost every reaction and the rest is one click further away.\n */\nexport interface ReactionPickerProps {\n /** The emoji the viewer already gave, highlighted so picking it again reads as \"remove\". */\n ownEmoji?: string;\n\n /**\n * The reactions already on the message. Shown as a list of who gave what underneath the quick row,\n * so somebody opening the picker can see where the message stands without a second gesture.\n */\n reactions?: readonly ChatMessageReaction[];\n\n /**\n * Where the recently used emojis are remembered. Defaults to the browser's local storage; a spec\n * (or a host without storage) can pass its own.\n */\n memory?: EmojiMemory;\n\n /**\n * The button that opened the picker. A click on it is that button's business — without this the\n * picker would dismiss on the way down and the button would reopen it on the way up, leaving a\n * toggle that never closes.\n */\n anchorRef?: RefObject<HTMLElement | null>;\n\n /** Invoked with the emoji that was picked. */\n onPick: (emoji: string) => void;\n\n /** Invoked when the picker should close without a pick (an outside click, or Escape). */\n onDismiss: () => void;\n\n /** Overrides for the picker's labels. Unset fields fall back to literal English defaults. */\n labels?: ReactionPickerLabels;\n}\n\n/**\n * The popover a reaction button opens: the emojis this person reached for most recently, and a muted\n * button at the end that opens the full picker — the shape Apple's tapback bar established, where the\n * quick row answers almost every reaction and the rest is one click further away.\n *\n * Picking the emoji already given is how a reaction is taken back; the caller decides\n * give/change/revoke from what was clicked.\n */\nexport const ReactionPicker = ({\n ownEmoji,\n reactions = [],\n memory,\n anchorRef,\n onPick,\n onDismiss,\n labels,\n}: ReactionPickerProps) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const store =\n memory ?? (typeof window === 'undefined' ? undefined : window.localStorage);\n const [quickEmojis, setQuickEmojis] = useState(() =>\n store ? recentEmojis(store) : [],\n );\n const [showingAll, setShowingAll] = useState(false);\n\n useEffect(() => {\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (rootRef.current?.contains(target) || anchorRef?.current?.contains(target))\n return;\n onDismiss();\n };\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') onDismiss();\n };\n\n // Capture phase, so board items that stop pointerdown propagation for their own\n // gestures still dismiss the picker.\n document.addEventListener('pointerdown', handlePointerDown, true);\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown, true);\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [onDismiss, anchorRef]);\n\n const pick = (emoji: string) => {\n // Remembered before it is handed on: the caller closes the picker, and the row has to already\n // be in its new order the next time it opens.\n if (store) setQuickEmojis(rememberEmoji(store, emoji));\n onPick(emoji);\n };\n\n return (\n <div ref={rootRef} className='reaction-picker'>\n <div className='reaction-picker__quick'>\n <div\n role='listbox'\n aria-label={labels?.pickEmoji ?? 'Pick an emoji'}\n className='reaction-picker__options'\n >\n {quickEmojis.map((emoji) => (\n <button\n key={emoji}\n type='button'\n role='option'\n aria-selected={emoji === ownEmoji}\n className={`reaction-picker__item${emoji === ownEmoji ? ' reaction-picker__item--selected' : ''}`}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => pick(emoji)}\n >\n {emoji}\n </button>\n ))}\n </div>\n <button\n type='button'\n className={`reaction-picker__more${showingAll ? ' reaction-picker__more--open' : ''}`}\n title={labels?.allEmojis ?? 'All emojis'}\n aria-label={labels?.allEmojis ?? 'All emojis'}\n aria-expanded={showingAll}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => setShowingAll((open) => !open)}\n >\n ☺\n </button>\n </div>\n {showingAll && (\n <EmojiPicker\n ownEmoji={ownEmoji}\n onPick={pick}\n labels={labels?.emojiPicker}\n />\n )}\n {!showingAll && reactions.length > 0 && (\n <div className='reaction-picker__given'>\n {reactions.flatMap((reaction) =>\n reaction.users.map((user) => (\n <div\n key={`${reaction.emoji}-${user.id.toString()}`}\n className='reaction-picker__given-row'\n >\n <span className='reaction-picker__given-emoji'>\n {reaction.emoji}\n </span>\n <span className='reaction-picker__given-name'>\n {user.name}\n </span>\n </div>\n )),\n )}\n </div>\n )}\n </div>\n );\n};\n"],"names":["_jsxs","_jsx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E,SAAS,IAAI,YAAY,EAAA,eAAA,EAC9B,UAAU,EACzB,WAAW,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,cAAc,EAAE,EAC9C,OAAO,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,EAAA,QAAA,EAAA,QAAA,EAAA,CAGxC,CAAA,EAAA,CACP,EACL,UAAU,KACPA,GAAA,CAAC,WAAW,EAAA,EACR,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,MAAM,EAAE,WAAW,EAAA,CAC7B,CACL,EACA,CAAC,UAAU,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,KAChCA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,wBAAwB,EAAA,QAAA,EAClC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,KACxB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,MACpBD,IAAA,CAAA,KAAA,EAAA,EAEI,SAAS,EAAC,4BAA4B,EAAA,QAAA,EAAA,CAEtCC,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,8BAA8B,EAAA,QAAA,EACzC,QAAQ,CAAC,KAAK,EAAA,CACZ,EACPA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,6BAA6B,EAAA,QAAA,EACxC,IAAI,CAAC,IAAI,EAAA,CACP,CAAA,EAAA,EARF,CAAA,EAAG,QAAQ,CAAC,KAAK,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAA,CAAE,CAS5C,CACT,CAAC,CACL,EAAA,CACC,CACT,CAAA,EAAA,CACC;AAEd;;"}
|
|
1
|
+
{"version":3,"file":"ReactionPicker.js","sources":["../../../../Chat/Kit/ReactionPicker.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 { RefObject, useId, useState } from 'react';\nimport { FocusScope } from 'react-aria';\nimport { EmojiOptions } from './Emoji/EmojiOptions';\nimport { EmojiPicker, type EmojiPickerLabels } from './Emoji/EmojiPicker';\nimport { recentEmojis, rememberEmoji } from './Emoji/recentEmojis';\nimport type { EmojiMemory } from './Emoji/EmojiMemory';\nimport type { ChatMessageReaction } from './ChatMessageReaction';\nimport { useReactionPickerFocus } from './useReactionPickerFocus';\n\n/** Overrides for the picker's own labels. Any field left unset falls back to a literal English\n * default. */\nexport interface ReactionPickerLabels {\n /** Accessible label for the quick row. Defaults to `'Pick an emoji'`. */\n pickEmoji?: string;\n /** Tooltip/accessible label for the \"more\" button that opens the full picker. Defaults to\n * `'All emojis'`. */\n allEmojis?: string;\n /** Labels forwarded to the full {@link EmojiPicker} when it is opened. */\n emojiPicker?: EmojiPickerLabels;\n}\n\n/**\n * Props for the popover a reaction button opens: the emojis this person reached for most recently,\n * and a muted button at the end that opens the full picker — the shape Apple's tapback bar established,\n * where the quick row answers almost every reaction and the rest is one click further away.\n */\nexport interface ReactionPickerProps {\n /** The emoji the viewer already gave, highlighted so picking it again reads as \"remove\". */\n ownEmoji?: string;\n\n /**\n * The reactions already on the message. Shown as a list of who gave what underneath the quick row,\n * so somebody opening the picker can see where the message stands without a second gesture.\n */\n reactions?: readonly ChatMessageReaction[];\n\n /**\n * Where the recently used emojis are remembered. Defaults to the browser's local storage; a spec\n * (or a host without storage) can pass its own.\n */\n memory?: EmojiMemory;\n\n /**\n * The button that opened the picker. A click on it is that button's business — without this the\n * picker would dismiss on the way down and the button would reopen it on the way up, leaving a\n * toggle that never closes.\n */\n anchorRef?: RefObject<HTMLElement | null>;\n\n /** Invoked with the emoji that was picked. */\n onPick: (emoji: string) => void;\n\n /** Invoked when the picker should close without a pick (an outside click, or Escape). */\n onDismiss: () => void;\n\n /** Overrides for the picker's labels. Unset fields fall back to literal English defaults. */\n labels?: ReactionPickerLabels;\n}\n\n/**\n * The popover a reaction button opens: the emojis this person reached for most recently, and a muted\n * button at the end that opens the full picker — the shape Apple's tapback bar established, where the\n * quick row answers almost every reaction and the rest is one click further away.\n *\n * Picking the emoji already given is how a reaction is taken back; the caller decides\n * give/change/revoke from what was clicked.\n */\nexport const ReactionPicker = ({\n ownEmoji,\n reactions = [],\n memory,\n anchorRef,\n onPick,\n onDismiss,\n labels,\n}: ReactionPickerProps) => {\n const { rootRef, onKeyDown } = useReactionPickerFocus(anchorRef, onDismiss);\n const fullPickerId = useId();\n const store =\n memory ?? (typeof window === 'undefined' ? undefined : window.localStorage);\n const [quickEmojis, setQuickEmojis] = useState(() =>\n store ? recentEmojis(store) : [],\n );\n const [showingAll, setShowingAll] = useState(false);\n\n const pick = (emoji: string) => {\n // Remembered before it is handed on: the caller closes the picker, and the row has to already\n // be in its new order the next time it opens.\n if (store) setQuickEmojis(rememberEmoji(store, emoji));\n onPick(emoji);\n };\n\n return (\n <FocusScope restoreFocus autoFocus>\n <div ref={rootRef} className='reaction-picker' onKeyDown={onKeyDown}>\n <div className='reaction-picker__quick'>\n <EmojiOptions\n emojis={quickEmojis}\n ownEmoji={ownEmoji}\n label={labels?.pickEmoji ?? 'Pick an emoji'}\n className='reaction-picker__options'\n optionClassName='reaction-picker__item'\n onPick={pick}\n />\n <button\n type='button'\n className={`reaction-picker__more${showingAll ? ' reaction-picker__more--open' : ''}`}\n title={labels?.allEmojis ?? 'All emojis'}\n aria-label={labels?.allEmojis ?? 'All emojis'}\n aria-expanded={showingAll}\n aria-controls={showingAll ? fullPickerId : undefined}\n onClick={() => setShowingAll((open) => !open)}\n >\n ☺\n </button>\n </div>\n {showingAll && (\n <div id={fullPickerId}>\n <EmojiPicker\n ownEmoji={ownEmoji}\n onPick={pick}\n labels={labels?.emojiPicker}\n />\n </div>\n )}\n {!showingAll && reactions.length > 0 && (\n <div className='reaction-picker__given'>\n {reactions.flatMap((reaction) =>\n reaction.users.map((user) => (\n <div\n key={`${reaction.emoji}-${user.id.toString()}`}\n className='reaction-picker__given-row'\n >\n <span className='reaction-picker__given-emoji'>\n {reaction.emoji}\n </span>\n <span className='reaction-picker__given-name'>\n {user.name}\n </span>\n </div>\n )),\n )}\n </div>\n )}\n </div>\n </FocusScope>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;MAsEa,cAAc,GAAG,CAAC,EAC3B,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,MAAM,EACN,SAAS,EACT,MAAM,EACN,SAAS,EACT,MAAM,GACY,KAAI;AACtB,IAAA,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,sBAAsB,CAAC,SAAS,EAAE,SAAS,CAAC;AAC3E,IAAA,MAAM,YAAY,GAAG,KAAK,EAAE;IAC5B,MAAM,KAAK,GACP,MAAM,KAAK,OAAO,MAAM,KAAK,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IAC/E,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,MAC3C,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,CACnC;IACD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AAEnD,IAAA,MAAM,IAAI,GAAG,CAAC,KAAa,KAAI;AAG3B,QAAA,IAAI,KAAK;YAAE,cAAc,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACtD,MAAM,CAAC,KAAK,CAAC;AACjB,IAAA,CAAC;IAED,QACIA,GAAA,CAAC,UAAU,EAAA,EAAC,YAAY,QAAC,SAAS,EAAA,IAAA,EAAA,QAAA,EAC9BC,IAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,iBAAiB,EAAC,SAAS,EAAE,SAAS,EAAA,QAAA,EAAA,CAC/DA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,wBAAwB,EAAA,QAAA,EAAA,CACnCD,GAAA,CAAC,YAAY,EAAA,EACT,MAAM,E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M,SAAS,EAAC,6BAA6B,EAAA,QAAA,EACxC,IAAI,CAAC,IAAI,EAAA,CACP,CAAA,EAAA,EARF,CAAA,EAAG,QAAQ,CAAC,KAAK,CAAA,CAAA,EAAI,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAA,CAAE,CAS5C,CACT,CAAC,CACL,EAAA,CACC,CACT,CAAA,EAAA,CACC,EAAA,CACG;AAErB;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type KeyboardEvent, type RefObject } from 'react';
|
|
2
|
+
/** Keeps picker dismissal local to its focus scope while respecting the opening button. */
|
|
3
|
+
export declare const useReactionPickerFocus: (anchorRef: RefObject<HTMLElement | null> | undefined, onDismiss: () => void) => {
|
|
4
|
+
rootRef: RefObject<HTMLDivElement | null>;
|
|
5
|
+
onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useReactionPickerFocus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactionPickerFocus.d.ts","sourceRoot":"","sources":["../../../../Chat/Kit/useReactionPickerFocus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAE9E,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,cAAe,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,aAAa,MAAM,IAAI;;uBAiBpF,aAAa,CAAC,cAAc,CAAC;CAQ1D,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useReactionPickerFocus = (anchorRef, onDismiss) => {
|
|
4
|
+
const rootRef = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const handlePointerDown = (event) => {
|
|
7
|
+
const target = event.target;
|
|
8
|
+
if (rootRef.current?.contains(target) || anchorRef?.current?.contains(target))
|
|
9
|
+
return;
|
|
10
|
+
onDismiss();
|
|
11
|
+
};
|
|
12
|
+
document.addEventListener('pointerdown', handlePointerDown, true);
|
|
13
|
+
return () => {
|
|
14
|
+
document.removeEventListener('pointerdown', handlePointerDown, true);
|
|
15
|
+
};
|
|
16
|
+
}, [onDismiss, anchorRef]);
|
|
17
|
+
const onKeyDown = (event) => {
|
|
18
|
+
if (event.key !== 'Escape')
|
|
19
|
+
return;
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
onDismiss();
|
|
23
|
+
};
|
|
24
|
+
return { rootRef, onKeyDown };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { useReactionPickerFocus };
|
|
28
|
+
//# sourceMappingURL=useReactionPickerFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactionPickerFocus.js","sources":["../../../../Chat/Kit/useReactionPickerFocus.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 { type KeyboardEvent, type RefObject, useEffect, useRef } from 'react';\n\n/** Keeps picker dismissal local to its focus scope while respecting the opening button. */\nexport const useReactionPickerFocus = (anchorRef: RefObject<HTMLElement | null> | undefined, onDismiss: () => void) => {\n const rootRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node;\n if (rootRef.current?.contains(target) || anchorRef?.current?.contains(target))\n return;\n onDismiss();\n };\n // Capture phase, so items that stop pointerdown propagation still dismiss the picker.\n document.addEventListener('pointerdown', handlePointerDown, true);\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown, true);\n };\n }, [onDismiss, anchorRef]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Escape') return;\n event.preventDefault();\n event.stopPropagation();\n onDismiss();\n };\n\n return { rootRef, onKeyDown };\n};\n"],"names":[],"mappings":";;MAMa,sBAAsB,GAAG,CAAC,SAAoD,EAAE,SAAqB,KAAI;AAClH,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC;IAE5C,SAAS,CAAC,MAAK;AACX,QAAA,MAAM,iBAAiB,GAAG,CAAC,KAAmB,KAAI;AAC9C,YAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAc;AACnC,YAAA,IAAI,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC;gBACzE;AACJ,YAAA,SAAS,EAAE;AACf,QAAA,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,iBAAiB,EAAE,IAAI,CAAC;AACjE,QAAA,OAAO,MAAK;YACR,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,iBAAiB,EAAE,IAAI,CAAC;AACxE,QAAA,CAAC;AACL,IAAA,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAE1B,IAAA,MAAM,SAAS,GAAG,CAAC,KAAoC,KAAI;AACvD,QAAA,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ;YAAE;QAC5B,KAAK,CAAC,cAAc,EAAE;QACtB,KAAK,CAAC,eAAe,EAAE;AACvB,QAAA,SAAS,EAAE;AACf,IAAA,CAAC;AAED,IAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;AACjC;;"}
|
|
@@ -10,6 +10,8 @@ interface CalendarFieldComponentProps extends WrappedFieldProps<Date | null>, Fi
|
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
/** legacy date format mask (e.g. `'yy-mm-dd'`). */
|
|
12
12
|
dateFormat?: string;
|
|
13
|
+
/** Localized accessible name for the calendar trigger. Defaults to "Open calendar". */
|
|
14
|
+
openCalendarLabel?: string;
|
|
13
15
|
/** When true, renders a trailing calendar icon button. */
|
|
14
16
|
showIcon?: boolean;
|
|
15
17
|
/** When true, includes time selection alongside the date. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarField.d.ts","sourceRoot":"","sources":["../../../../CommandForm/fields/CalendarField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAEH,KAAK,0BAA0B,EAClC,MAAM,iCAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEH,KAAK,uBAAuB,EAC/B,MAAM,yBAAsB,CAAC;AAE9B;;GAEG;AACH,UAAU,2BACN,SAAQ,iBAAiB,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,uBAAuB;IAC/D,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,mEAAmE;IACnE,EAAE,CAAC,EAAE,0BAA0B,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"CalendarField.d.ts","sourceRoot":"","sources":["../../../../CommandForm/fields/CalendarField.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAEH,KAAK,0BAA0B,EAClC,MAAM,iCAA8B,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEH,KAAK,uBAAuB,EAC/B,MAAM,yBAAsB,CAAC;AAE9B;;GAEG;AACH,UAAU,2BACN,SAAQ,iBAAiB,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,uBAAuB;IAC/D,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,uFAAuF;IACvF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,sDAAsD;IACtD,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,mEAAmE;IACnE,EAAE,CAAC,EAAE,0BAA0B,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,0NAoCzB,CAAC"}
|
|
@@ -9,7 +9,7 @@ const CalendarField = asCommandFormField((props) => {
|
|
|
9
9
|
ariaLabel: props.pt?.input?.['aria-label'],
|
|
10
10
|
ariaDescribedBy: props.pt?.input?.['aria-describedby'],
|
|
11
11
|
});
|
|
12
|
-
return (jsxs(Fragment, { children: [jsx(DatePickerInput, { id: accessibility.controlId, "aria-label": accessibility.ariaLabel, "aria-describedby": accessibility.ariaDescribedBy, value: props.value, onChange: (value) => props.onChange(value), onBlur: props.onBlur, invalid: props.invalid, placeholder: props.placeholder, dateFormat: props.dateFormat, showIcon: props.showIcon, showTime: props.showTime, hourFormat: props.hourFormat, minDate: props.minDate, maxDate: props.maxDate, isNonModal: props.isNonModal, className: props.className, pt: props.pt, ptOptions: props.ptOptions, unstyled: props.unstyled }), accessibility.hiddenError] }));
|
|
12
|
+
return (jsxs(Fragment, { children: [jsx(DatePickerInput, { id: accessibility.controlId, "aria-label": accessibility.ariaLabel, "aria-describedby": accessibility.ariaDescribedBy, value: props.value, onChange: (value) => props.onChange(value), onBlur: props.onBlur, invalid: props.invalid, placeholder: props.placeholder, dateFormat: props.dateFormat, showIcon: props.showIcon, openCalendarLabel: props.openCalendarLabel, showTime: props.showTime, hourFormat: props.hourFormat, minDate: props.minDate, maxDate: props.maxDate, isNonModal: props.isNonModal, className: props.className, pt: props.pt, ptOptions: props.ptOptions, unstyled: props.unstyled }), accessibility.hiddenError] }));
|
|
13
13
|
}, { defaultValue: null });
|
|
14
14
|
|
|
15
15
|
export { CalendarField };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarField.js","sources":["../../../../CommandForm/fields/CalendarField.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 { asCommandFormField, type WrappedFieldProps } from '@cratis/arc.react/commands';\nimport {\n DatePickerInput,\n type DatePickerInputPassThrough,\n} from '../../Common/DatePickerInput';\nimport React from 'react';\nimport {\n useFieldAccessibility,\n type FieldAccessibilityProps,\n} from './fieldAccessibility';\n\n/**\n * Component-level props for {@link CalendarField}.\n */\ninterface CalendarFieldComponentProps\n extends WrappedFieldProps<Date | null>, FieldAccessibilityProps {\n /** Placeholder text shown when no date is selected. */\n placeholder?: string;\n\n /** legacy date format mask (e.g. `'yy-mm-dd'`). */\n dateFormat?: string;\n\n /** When true, renders a trailing calendar icon button. */\n showIcon?: boolean;\n\n /** When true, includes time selection alongside the date. */\n showTime?: boolean;\n\n /** Hour format used when {@link showTime} is true. */\n hourFormat?: '12' | '24';\n\n /** Earliest selectable date. */\n minDate?: Date;\n\n /** Latest selectable date. */\n maxDate?: Date;\n\n /**\n * Keep outside controls interactive while the calendar is open. An outside\n * click dismisses the popover and reaches its target. Defaults to false.\n */\n isNonModal?: boolean;\n\n /** Extra CSS class name combined with the default `w-full`. */\n className?: string;\n\n /** Cratis-owned per-part attributes applied to the date picker. */\n pt?: DatePickerInputPassThrough;\n\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\n/**\n * A date (or date-time) picker field bound to a `Date | null` property on a\n * Cratis Arc command. Set `showTime` to add a time selector alongside the\n * date. See {@link InputTextField} for the full `value={c => c.prop}`\n * binding model.\n *\n * ```tsx\n * <CalendarField value={c => c.dueDate}\n * title=\"Due date\"\n * showIcon\n * minDate={new Date()} />\n * ```\n */\nexport const CalendarField = asCommandFormField<CalendarFieldComponentProps>(\n (props) => {\n const accessibility = useFieldAccessibility(props, {\n id: props.pt?.input?.id,\n ariaLabel: props.pt?.input?.['aria-label'],\n ariaDescribedBy: props.pt?.input?.['aria-describedby'],\n });\n return (\n <>\n <DatePickerInput\n id={accessibility.controlId}\n aria-label={accessibility.ariaLabel}\n aria-describedby={accessibility.ariaDescribedBy}\n value={props.value}\n onChange={(value) => props.onChange(value)}\n onBlur={props.onBlur}\n invalid={props.invalid}\n placeholder={props.placeholder}\n dateFormat={props.dateFormat}\n showIcon={props.showIcon}\n showTime={props.showTime}\n hourFormat={props.hourFormat}\n minDate={props.minDate}\n maxDate={props.maxDate}\n isNonModal={props.isNonModal}\n className={props.className}\n pt={props.pt}\n ptOptions={props.ptOptions}\n unstyled={props.unstyled}\n />\n {accessibility.hiddenError}\n </>\n );\n },\n { defaultValue: null },\n);\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CalendarField.js","sources":["../../../../CommandForm/fields/CalendarField.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 { asCommandFormField, type WrappedFieldProps } from '@cratis/arc.react/commands';\nimport {\n DatePickerInput,\n type DatePickerInputPassThrough,\n} from '../../Common/DatePickerInput';\nimport React from 'react';\nimport {\n useFieldAccessibility,\n type FieldAccessibilityProps,\n} from './fieldAccessibility';\n\n/**\n * Component-level props for {@link CalendarField}.\n */\ninterface CalendarFieldComponentProps\n extends WrappedFieldProps<Date | null>, FieldAccessibilityProps {\n /** Placeholder text shown when no date is selected. */\n placeholder?: string;\n\n /** legacy date format mask (e.g. `'yy-mm-dd'`). */\n dateFormat?: string;\n\n /** Localized accessible name for the calendar trigger. Defaults to \"Open calendar\". */\n openCalendarLabel?: string;\n\n /** When true, renders a trailing calendar icon button. */\n showIcon?: boolean;\n\n /** When true, includes time selection alongside the date. */\n showTime?: boolean;\n\n /** Hour format used when {@link showTime} is true. */\n hourFormat?: '12' | '24';\n\n /** Earliest selectable date. */\n minDate?: Date;\n\n /** Latest selectable date. */\n maxDate?: Date;\n\n /**\n * Keep outside controls interactive while the calendar is open. An outside\n * click dismisses the popover and reaches its target. Defaults to false.\n */\n isNonModal?: boolean;\n\n /** Extra CSS class name combined with the default `w-full`. */\n className?: string;\n\n /** Cratis-owned per-part attributes applied to the date picker. */\n pt?: DatePickerInputPassThrough;\n\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\n/**\n * A date (or date-time) picker field bound to a `Date | null` property on a\n * Cratis Arc command. Set `showTime` to add a time selector alongside the\n * date. See {@link InputTextField} for the full `value={c => c.prop}`\n * binding model.\n *\n * ```tsx\n * <CalendarField value={c => c.dueDate}\n * title=\"Due date\"\n * showIcon\n * minDate={new Date()} />\n * ```\n */\nexport const CalendarField = asCommandFormField<CalendarFieldComponentProps>(\n (props) => {\n const accessibility = useFieldAccessibility(props, {\n id: props.pt?.input?.id,\n ariaLabel: props.pt?.input?.['aria-label'],\n ariaDescribedBy: props.pt?.input?.['aria-describedby'],\n });\n return (\n <>\n <DatePickerInput\n id={accessibility.controlId}\n aria-label={accessibility.ariaLabel}\n aria-describedby={accessibility.ariaDescribedBy}\n value={props.value}\n onChange={(value) => props.onChange(value)}\n onBlur={props.onBlur}\n invalid={props.invalid}\n placeholder={props.placeholder}\n dateFormat={props.dateFormat}\n showIcon={props.showIcon}\n openCalendarLabel={props.openCalendarLabel}\n showTime={props.showTime}\n hourFormat={props.hourFormat}\n minDate={props.minDate}\n maxDate={props.maxDate}\n isNonModal={props.isNonModal}\n className={props.className}\n pt={props.pt}\n ptOptions={props.ptOptions}\n unstyled={props.unstyled}\n />\n {accessibility.hiddenError}\n </>\n );\n },\n { defaultValue: null },\n);\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;MA+Ea,aAAa,GAAG,kBAAkB,CAC3C,CAAC,KAAK,KAAI;AACN,IAAA,MAAM,aAAa,GAAG,qBAAqB,CAAC,KAAK,EAAE;AAC/C,QAAA,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QACvB,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,GAAG,YAAY,CAAC;QAC1C,eAAe,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,GAAG,kBAAkB,CAAC;AACzD,KAAA,CAAC;AACF,IAAA,QACIA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACIC,GAAA,CAAC,eAAe,EAAA,EACZ,EAAE,EAAE,aAAa,CAAC,SAAS,EAAA,YAAA,EACf,aAAa,CAAC,SAAS,EAAA,kBAAA,EACjB,aAAa,CAAC,eAAe,EAC/C,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,QAAQ,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC1C,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAA,CAC1B,EACD,aAAa,CAAC,WAAW,CAAA,EAAA,CAC3B;AAEX,CAAC,EACD,EAAE,YAAY,EAAE,IAAI,EAAE;;"}
|
|
@@ -104,6 +104,8 @@ export interface DatePickerInputProps {
|
|
|
104
104
|
* @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.
|
|
105
105
|
*/
|
|
106
106
|
unstyled?: boolean;
|
|
107
|
+
/** Localized accessible name for the calendar trigger. Defaults to the provider's label or "Open calendar". */
|
|
108
|
+
openCalendarLabel?: string;
|
|
107
109
|
/** Localized label for the Today action. */
|
|
108
110
|
todayLabel?: string;
|
|
109
111
|
/** Localized label for the Clear action. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateP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AI,CAAC;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,wCAAwC;IACxC,EAAE,CAAC,EAAE,0BAA0B,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+GAA+G;IAC/G,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAQD;;;GAGG;AACH,eAAO,MAAM,eAAe,UAAW,oBAAoB,+FAG1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInput.js","sources":["../../../Common/DatePickerInput.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 type {\n ButtonHTMLAttributes,\n CSSProperties,\n FocusEventHandler,\n HTMLAttributes,\n} from 'react';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport { DatePickerInputImplementation } from './DatePickerInputImplementation';\n\ninterface DatePickerPartAttributes extends Omit<\n HTMLAttributes<HTMLElement>,\n 'defaultValue' | 'onChange' | 'role'\n> {\n id?: string;\n className?: string;\n style?: CSSProperties;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-invalid'?: boolean;\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n}\n\ntype DatePickerButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'value'\n>;\n\n/** Stable Cratis-owned parts for styling a {@link DatePickerInput}. */\nexport interface DatePickerInputPassThrough {\n /** Outer wrapper. */\n root?: DatePickerPartAttributes;\n /** Focusable segmented-input group. */\n group?: DatePickerPartAttributes;\n /** Segmented date input. */\n input?: DatePickerPartAttributes;\n /** Visible empty-value placeholder. */\n placeholder?: DatePickerPartAttributes;\n /** Individual editable date/time segment. */\n segment?: DatePickerPartAttributes;\n /** Calendar popup trigger. */\n trigger?: DatePickerButtonAttributes;\n /** Portaled calendar popover. */\n popover?: DatePickerPartAttributes;\n /** Calendar dialog. */\n dialog?: DatePickerPartAttributes;\n /** Calendar root. */\n calendar?: DatePickerPartAttributes;\n /** Calendar navigation header. */\n header?: DatePickerPartAttributes;\n /** Current month/year heading. */\n heading?: DatePickerPartAttributes;\n /** Previous-month action. */\n previous?: DatePickerButtonAttributes;\n /** Next-month action. */\n next?: DatePickerButtonAttributes;\n /** Calendar grid. */\n grid?: DatePickerPartAttributes;\n /** One calendar cell. */\n cell?: DatePickerPartAttributes;\n /** Today/clear action row. */\n buttonBar?: DatePickerPartAttributes;\n /** Today action; disabled and non-interactive when today falls outside `minDate`/`maxDate`. */\n today?: DatePickerButtonAttributes;\n /** Clear action. */\n clear?: DatePickerButtonAttributes;\n}\n\n/** Props for {@link DatePickerInput}. */\nexport interface DatePickerInputProps {\n /** Controlled JavaScript date value. */\n value: Date | null;\n /** Invoked with the selected JavaScript date or `null` and optional change-origin metadata. */\n onChange: ChangeHandler<Date | null>;\n /** Invoked when focus leaves the picker wrapper. */\n onBlur?: FocusEventHandler<HTMLElement>;\n /** Marks the picker invalid. */\n invalid?: boolean;\n /** Disables every picker control. */\n disabled?: boolean;\n /** Prevents editing while retaining focus semantics. */\n readOnly?: boolean;\n /** DOM id for the segmented-input group. */\n id?: string;\n /** Shows Today and Clear actions. */\n showButtonBar?: boolean;\n /**\n * Keep outside controls interactive while the calendar is open. An outside\n * click dismisses the popover and reaches its target. Defaults to false.\n */\n isNonModal?: boolean;\n /** Visible text while no date is selected. */\n placeholder?: string;\n /** Deprecated renderer mask; locale controls formatting now. */\n dateFormat?: string;\n /** Shows the calendar trigger button. Defaults to `true`. */\n showIcon?: boolean;\n /** Adds hour/minute segments. */\n showTime?: boolean;\n /** Preferred 12- or 24-hour cycle. */\n hourFormat?: '12' | '24';\n /** Earliest selectable date. */\n minDate?: Date;\n /** Latest selectable date. */\n maxDate?: Date;\n /** Extra class name for the outer wrapper. */\n className?: string;\n /** Inline style for the outer wrapper. */\n style?: CSSProperties;\n /** Cratis-owned per-part attributes. */\n pt?: DatePickerInputPassThrough;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n /** Localized label for the Today action. */\n todayLabel?: string;\n /** Localized label for the Clear action. */\n clearLabel?: string;\n /** Accessible name when no external label is supplied. */\n 'aria-label'?: string;\n /** Id of the element that labels the picker. */\n 'aria-labelledby'?: string;\n /** Id of the element that describes the picker. */\n 'aria-describedby'?: string;\n}\n\nconst coreDatePickerDeclaration = Object.freeze({\n mode: 'atomic',\n fidelity: 'native',\n render: DatePickerInputImplementation,\n}) satisfies unstable_SlotDeclaration<'display.datePicker'>;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInput = (props: DatePickerInputProps) => {\n const declaration = unstable_useSlot('display.datePicker', coreDatePickerDeclaration);\n return renderSlot(declaration, props);\n};\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"DatePickerInput.js","sources":["../../../Common/DatePickerInput.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 type {\n ButtonHTMLAttributes,\n CSSProperties,\n FocusEventHandler,\n HTMLAttributes,\n} from 'react';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport { DatePickerInputImplementation } from './DatePickerInputImplementation';\n\ninterface DatePickerPartAttributes extends Omit<\n HTMLAttributes<HTMLElement>,\n 'defaultValue' | 'onChange' | 'role'\n> {\n id?: string;\n className?: string;\n style?: CSSProperties;\n disabled?: boolean;\n readOnly?: boolean;\n placeholder?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-invalid'?: boolean;\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n}\n\ntype DatePickerButtonAttributes = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick' | 'value'\n>;\n\n/** Stable Cratis-owned parts for styling a {@link DatePickerInput}. */\nexport interface DatePickerInputPassThrough {\n /** Outer wrapper. */\n root?: DatePickerPartAttributes;\n /** Focusable segmented-input group. */\n group?: DatePickerPartAttributes;\n /** Segmented date input. */\n input?: DatePickerPartAttributes;\n /** Visible empty-value placeholder. */\n placeholder?: DatePickerPartAttributes;\n /** Individual editable date/time segment. */\n segment?: DatePickerPartAttributes;\n /** Calendar popup trigger. */\n trigger?: DatePickerButtonAttributes;\n /** Portaled calendar popover. */\n popover?: DatePickerPartAttributes;\n /** Calendar dialog. */\n dialog?: DatePickerPartAttributes;\n /** Calendar root. */\n calendar?: DatePickerPartAttributes;\n /** Calendar navigation header. */\n header?: DatePickerPartAttributes;\n /** Current month/year heading. */\n heading?: DatePickerPartAttributes;\n /** Previous-month action. */\n previous?: DatePickerButtonAttributes;\n /** Next-month action. */\n next?: DatePickerButtonAttributes;\n /** Calendar grid. */\n grid?: DatePickerPartAttributes;\n /** One calendar cell. */\n cell?: DatePickerPartAttributes;\n /** Today/clear action row. */\n buttonBar?: DatePickerPartAttributes;\n /** Today action; disabled and non-interactive when today falls outside `minDate`/`maxDate`. */\n today?: DatePickerButtonAttributes;\n /** Clear action. */\n clear?: DatePickerButtonAttributes;\n}\n\n/** Props for {@link DatePickerInput}. */\nexport interface DatePickerInputProps {\n /** Controlled JavaScript date value. */\n value: Date | null;\n /** Invoked with the selected JavaScript date or `null` and optional change-origin metadata. */\n onChange: ChangeHandler<Date | null>;\n /** Invoked when focus leaves the picker wrapper. */\n onBlur?: FocusEventHandler<HTMLElement>;\n /** Marks the picker invalid. */\n invalid?: boolean;\n /** Disables every picker control. */\n disabled?: boolean;\n /** Prevents editing while retaining focus semantics. */\n readOnly?: boolean;\n /** DOM id for the segmented-input group. */\n id?: string;\n /** Shows Today and Clear actions. */\n showButtonBar?: boolean;\n /**\n * Keep outside controls interactive while the calendar is open. An outside\n * click dismisses the popover and reaches its target. Defaults to false.\n */\n isNonModal?: boolean;\n /** Visible text while no date is selected. */\n placeholder?: string;\n /** Deprecated renderer mask; locale controls formatting now. */\n dateFormat?: string;\n /** Shows the calendar trigger button. Defaults to `true`. */\n showIcon?: boolean;\n /** Adds hour/minute segments. */\n showTime?: boolean;\n /** Preferred 12- or 24-hour cycle. */\n hourFormat?: '12' | '24';\n /** Earliest selectable date. */\n minDate?: Date;\n /** Latest selectable date. */\n maxDate?: Date;\n /** Extra class name for the outer wrapper. */\n className?: string;\n /** Inline style for the outer wrapper. */\n style?: CSSProperties;\n /** Cratis-owned per-part attributes. */\n pt?: DatePickerInputPassThrough;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n /** Localized accessible name for the calendar trigger. Defaults to the provider's label or \"Open calendar\". */\n openCalendarLabel?: string;\n /** Localized label for the Today action. */\n todayLabel?: string;\n /** Localized label for the Clear action. */\n clearLabel?: string;\n /** Accessible name when no external label is supplied. */\n 'aria-label'?: string;\n /** Id of the element that labels the picker. */\n 'aria-labelledby'?: string;\n /** Id of the element that describes the picker. */\n 'aria-describedby'?: string;\n}\n\nconst coreDatePickerDeclaration = Object.freeze({\n mode: 'atomic',\n fidelity: 'native',\n render: DatePickerInputImplementation,\n}) satisfies unstable_SlotDeclaration<'display.datePicker'>;\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInput = (props: DatePickerInputProps) => {\n const declaration = unstable_useSlot('display.datePicker', coreDatePickerDeclaration);\n return renderSlot(declaration, props);\n};\n"],"names":[],"mappings":";;;;AA8IA,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;AAC5C,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE,6BAA6B;AACxC,CAAA,CAA0D;AAMpD,MAAM,eAAe,GAAG,CAAC,KAA2B,KAAI;IAC3D,MAAM,WAAW,GAAG,gBAAgB,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;AACrF,IAAA,OAAO,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;AACzC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInputImplementation.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerInputImplementation.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"DatePickerInputImplementation.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerInputImplementation.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAmB,CAAC;AAe9D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,UAAW,oBAAoB,gCA0GxE,CAAC"}
|
|
@@ -11,6 +11,7 @@ import { DatePickerPopover } from './DatePickerPopover.js';
|
|
|
11
11
|
import { asDate, asDateValue } from './datePickerValues.js';
|
|
12
12
|
import { triggerStateAttributes, rootStateAttributes } from './datePickerStateAttributes.js';
|
|
13
13
|
import { useDatePickerState } from './useDatePickerState.js';
|
|
14
|
+
import { useDatePickerAccessibility } from './useDatePickerAccessibility.js';
|
|
14
15
|
|
|
15
16
|
const resolveHourCycle = (hourFormat) => {
|
|
16
17
|
if (hourFormat === '12')
|
|
@@ -22,6 +23,7 @@ const DatePickerInputImplementation = (props) => {
|
|
|
22
23
|
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
|
23
24
|
const overlayEnvironment = unstable_useOverlayEnvironment();
|
|
24
25
|
const state = useDatePickerState(props);
|
|
26
|
+
const { calendarId, triggerLabel, triggerAttributes } = useDatePickerAccessibility(props, state.datePickerMessages?.openCalendar);
|
|
25
27
|
const { effectiveDisabled, effectiveReadOnly } = state;
|
|
26
28
|
const fieldState = {
|
|
27
29
|
invalid: state.effectiveInvalid,
|
|
@@ -42,9 +44,7 @@ const DatePickerInputImplementation = (props) => {
|
|
|
42
44
|
return (jsx("div", { ...pt?.root, className: state.rootClassName, style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-cratis-component": 'DatePickerInput', ...rootStateAttributes(fieldState, isPickerOpen), onBlur: onBlur, children: jsx(UNSAFE_PortalProvider, { getContainer: overlayEnvironment.getContainer, children: jsx(DatePicker, { value: asDateValue(value, showTime), onChange: (next) => onChange(asDate(next), { source: 'user' }), isDisabled: effectiveDisabled, isReadOnly: effectiveReadOnly, isInvalid: state.effectiveInvalid, isOpen: isPickerOpen, onOpenChange: (nextIsOpen) => {
|
|
43
45
|
if (!nextIsOpen || !effectiveReadOnly)
|
|
44
46
|
setIsPickerOpen(nextIsOpen);
|
|
45
|
-
}, minValue: state.minValue, maxValue: state.maxValue, granularity: showTime ? 'minute' : 'day', hourCycle: resolveHourCycle(hourFormat), "aria-label": state.effectiveAriaLabel, "aria-labelledby": state.effectiveAriaLabelledby, "aria-describedby": state.effectiveAriaDescribedby, className: 'cratis-date-picker__picker', children: ({ isOpen }) => (jsxs(Fragment, { children: [jsxs(DatePickerGroup, { pt: pt, inputId: state.inputId, state: fieldState, isOpen: isOpen, children: [jsx(DatePickerDateInput, { pt: pt, inputPartAttributes: state.inputPartAttributes, placeholder: state.effectivePlaceholder, state: fieldState, isOpen: isOpen }), jsx(DatePickerPlaceholder, { pt: pt, placeholder: state.effectivePlaceholder, selected: fieldState.selected }), showIcon && (jsx(Button, { ...asReactAriaButtonProps(pt?.trigger), isDisabled: effectiveDisabled || effectiveReadOnly, className: classNames('cratis-date-picker__trigger', pt?.trigger?.className), "data-cratis-part": 'trigger', render: (triggerProps) => (jsx("button", { ...triggerProps, ...triggerStateAttributes(fieldState, isOpen) })), "aria-label":
|
|
46
|
-
state.datePickerMessages?.openCalendar ??
|
|
47
|
-
'Open calendar', children: jsx("span", { "aria-hidden": 'true', children: "\u25A6" }) }))] }), jsx(DatePickerPopover, { pt: pt, isNonModal: isNonModal, zIndex: state.resolvedPopoverZIndex, buttonBar: buttonBar })] })) }) }) }));
|
|
47
|
+
}, minValue: state.minValue, maxValue: state.maxValue, granularity: showTime ? 'minute' : 'day', hourCycle: resolveHourCycle(hourFormat), "aria-label": state.effectiveAriaLabel, "aria-labelledby": state.effectiveAriaLabelledby, "aria-describedby": state.effectiveAriaDescribedby, className: 'cratis-date-picker__picker', children: ({ isOpen }) => (jsxs(Fragment, { children: [jsxs(DatePickerGroup, { pt: pt, inputId: state.inputId, state: fieldState, isOpen: isOpen, children: [jsx(DatePickerDateInput, { pt: pt, inputPartAttributes: state.inputPartAttributes, placeholder: state.effectivePlaceholder, state: fieldState, isOpen: isOpen }), jsx(DatePickerPlaceholder, { pt: pt, placeholder: state.effectivePlaceholder, selected: fieldState.selected }), showIcon && (jsx(Button, { ...asReactAriaButtonProps(pt?.trigger), isDisabled: effectiveDisabled || effectiveReadOnly, className: classNames('cratis-date-picker__trigger', pt?.trigger?.className), "data-cratis-part": 'trigger', render: (triggerProps) => (jsx("button", { ...triggerProps, ...triggerStateAttributes(fieldState, isOpen), ...triggerAttributes(isOpen) })), "aria-label": triggerLabel, children: jsx("span", { "aria-hidden": 'true', children: "\u25A6" }) }))] }), jsx(DatePickerPopover, { id: calendarId, pt: pt, isNonModal: isNonModal, zIndex: state.resolvedPopoverZIndex, buttonBar: buttonBar })] })) }) }) }));
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export { DatePickerInputImplementation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerInputImplementation.js","sources":["../../../Common/DatePickerInputImplementation.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 { useState } from 'react';\nimport {\n Button,\n DatePicker as AriaDatePicker,\n} from 'react-aria-components/DatePicker';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { asReactAriaButtonProps } from './reactAriaProps';\nimport type { DatePickerInputProps } from './DatePickerInput';\nimport { classNames } from '../ClassNames/classNames';\nimport { DatePickerDateInput } from './DatePickerDateInput';\nimport { DatePickerGroup, DatePickerPlaceholder } from './DatePickerGroup';\nimport { DatePickerPopover } from './DatePickerPopover';\nimport { asDate, asDateValue } from './datePickerValues';\nimport { rootStateAttributes, triggerStateAttributes } from './datePickerStateAttributes';\nimport { useDatePickerState } from './useDatePickerState';\n\nconst resolveHourCycle = (hourFormat: DatePickerInputProps['hourFormat']) => {\n if (hourFormat === '12') return 12;\n return hourFormat === '24' ? 24 : undefined;\n};\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInputImplementation = (props: DatePickerInputProps) => {\n const { value, onChange, onBlur, showButtonBar, isNonModal = false, showIcon = true, showTime, hourFormat, style, pt } = props;\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const state = useDatePickerState(props);\n const { effectiveDisabled, effectiveReadOnly } = state;\n const fieldState = {\n invalid: state.effectiveInvalid,\n disabled: effectiveDisabled,\n readOnly: effectiveReadOnly,\n selected: value !== null,\n };\n const buttonBar = showButtonBar ? {\n pt,\n todayLabel: state.resolvedTodayLabel,\n clearLabel: state.resolvedClearLabel,\n actionsDisabled: state.actionsDisabled,\n clearDisabled: state.clearDisabled,\n isTodayOutOfBounds: state.isTodayOutOfBounds,\n todayDate: state.todayDate,\n onChange,\n } : null;\n\n return (\n <div\n {...pt?.root}\n className={state.rootClassName}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='DatePickerInput'\n {...rootStateAttributes(fieldState, isPickerOpen)}\n onBlur={onBlur}\n >\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <AriaDatePicker\n value={asDateValue(value, showTime)}\n onChange={(next) => onChange(asDate(next), { source: 'user' })}\n isDisabled={effectiveDisabled}\n isReadOnly={effectiveReadOnly}\n isInvalid={state.effectiveInvalid}\n isOpen={isPickerOpen}\n onOpenChange={(nextIsOpen) => {\n if (!nextIsOpen || !effectiveReadOnly) setIsPickerOpen(nextIsOpen);\n }}\n minValue={state.minValue}\n maxValue={state.maxValue}\n granularity={showTime ? 'minute' : 'day'}\n hourCycle={resolveHourCycle(hourFormat)}\n aria-label={state.effectiveAriaLabel}\n aria-labelledby={state.effectiveAriaLabelledby}\n aria-describedby={state.effectiveAriaDescribedby}\n className='cratis-date-picker__picker'\n >\n {({ isOpen }) => (\n <>\n <DatePickerGroup pt={pt} inputId={state.inputId} state={fieldState} isOpen={isOpen}>\n <DatePickerDateInput\n pt={pt}\n inputPartAttributes={state.inputPartAttributes}\n placeholder={state.effectivePlaceholder}\n state={fieldState}\n isOpen={isOpen}\n />\n <DatePickerPlaceholder\n pt={pt}\n placeholder={state.effectivePlaceholder}\n selected={fieldState.selected}\n />\n {showIcon && (\n <Button\n {...asReactAriaButtonProps(pt?.trigger)}\n isDisabled={\n effectiveDisabled || effectiveReadOnly\n }\n className={classNames(\n 'cratis-date-picker__trigger',\n pt?.trigger?.className,\n )}\n data-cratis-part='trigger'\n render={(triggerProps) => (\n <button\n {...triggerProps}\n {...triggerStateAttributes(fieldState, isOpen)}\n />\n )}\n aria-label={\n pt?.trigger?.['aria-label'] ??\n state.datePickerMessages?.openCalendar ??\n 'Open calendar'\n }\n >\n <span aria-hidden='true'>▦</span>\n </Button>\n )}\n </DatePickerGroup>\n <DatePickerPopover\n pt={pt}\n isNonModal={isNonModal}\n zIndex={state.resolvedPopoverZIndex}\n buttonBar={buttonBar}\n />\n </>\n )}\n </AriaDatePicker>\n </UNSAFE_PortalProvider>\n </div>\n );\n};\n"],"names":["_jsx","AriaDatePicker","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAM,gBAAgB,GAAG,CAAC,UAA8C,KAAI;IACxE,IAAI,UAAU,KAAK,IAAI;AAAE,QAAA,OAAO,EAAE;IAClC,OAAO,UAAU,KAAK,IAAI,GAAG,EAAE,GAAG,SAAS;AAC/C,CAAC;AAMM,MAAM,6BAA6B,GAAG,CAAC,KAA2B,KAAI;IACzE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,GAAG,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK;IAC9H,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACvD,IAAA,MAAM,kBAAkB,GAAG,8BAA8B,EAAE;AAC3D,IAAA,MAA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,EAC7B,EAAE,EAAE,OAAO,EAAE,SAAS,CACzB,EAAA,kBAAA,EACgB,SAAS,EAC1B,MAAM,EAAE,CAAC,YAAY,MACjBA,GAAA,CAAA,QAAA,EAAA,EAAA,GACQ,YAAY,KACZ,sBAAsB,CAAC,UAAU,EAAE,MAAM,CAAC,EAAA,CAChD,CACL,gBAEG,EAAE,EAAE,OAAO,GAAG,YAAY,CAAC;wCAC3B,KAAK,CAAC,kBAAkB,EAAE,YAAY;AACtC,wCAAA,eAAe,EAAA,QAAA,EAGnBA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAA,QAAA,EAAA,QAAA,EAAA,CAAS,GAC5B,CACZ,CAAA,EAAA,CACa,EAClBA,GAAA,CAAC,iBAAiB,EAAA,EACd,EAAE,EAAE,EAAE,EACN,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,KAAK,CAAC,qBAAqB,EACnC,SAAS,EAAE,SAAS,EAAA,CACtB,IACH,CACN,EAAA,CACY,EAAA,CACG,EAAA,CACtB;AAEd;;"}
|
|
1
|
+
{"version":3,"file":"DatePickerInputImplementation.js","sources":["../../../Common/DatePickerInputImplementation.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 { useState } from 'react';\nimport {\n Button,\n DatePicker as AriaDatePicker,\n} from 'react-aria-components/DatePicker';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { unstable_useOverlayEnvironment } from '../renderer/RendererContext';\nimport { asReactAriaButtonProps } from './reactAriaProps';\nimport type { DatePickerInputProps } from './DatePickerInput';\nimport { classNames } from '../ClassNames/classNames';\nimport { DatePickerDateInput } from './DatePickerDateInput';\nimport { DatePickerGroup, DatePickerPlaceholder } from './DatePickerGroup';\nimport { DatePickerPopover } from './DatePickerPopover';\nimport { asDate, asDateValue } from './datePickerValues';\nimport { rootStateAttributes, triggerStateAttributes } from './datePickerStateAttributes';\nimport { useDatePickerState } from './useDatePickerState';\nimport { useDatePickerAccessibility } from './useDatePickerAccessibility';\n\nconst resolveHourCycle = (hourFormat: DatePickerInputProps['hourFormat']) => {\n if (hourFormat === '12') return 12;\n return hourFormat === '24' ? 24 : undefined;\n};\n\n/**\n * An internationalized date or date-time picker with Cratis-owned markup parts.\n * The public boundary remains `Date | null`; React Aria's calendar values stay internal.\n */\nexport const DatePickerInputImplementation = (props: DatePickerInputProps) => {\n const { value, onChange, onBlur, showButtonBar, isNonModal = false, showIcon = true, showTime, hourFormat, style, pt } = props;\n const [isPickerOpen, setIsPickerOpen] = useState(false);\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const state = useDatePickerState(props);\n const { calendarId, triggerLabel, triggerAttributes } = useDatePickerAccessibility(props, state.datePickerMessages?.openCalendar);\n const { effectiveDisabled, effectiveReadOnly } = state;\n const fieldState = {\n invalid: state.effectiveInvalid,\n disabled: effectiveDisabled,\n readOnly: effectiveReadOnly,\n selected: value !== null,\n };\n const buttonBar = showButtonBar ? {\n pt,\n todayLabel: state.resolvedTodayLabel,\n clearLabel: state.resolvedClearLabel,\n actionsDisabled: state.actionsDisabled,\n clearDisabled: state.clearDisabled,\n isTodayOutOfBounds: state.isTodayOutOfBounds,\n todayDate: state.todayDate,\n onChange,\n } : null;\n\n return (\n <div\n {...pt?.root}\n className={state.rootClassName}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='DatePickerInput'\n {...rootStateAttributes(fieldState, isPickerOpen)}\n onBlur={onBlur}\n >\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <AriaDatePicker\n value={asDateValue(value, showTime)}\n onChange={(next) => onChange(asDate(next), { source: 'user' })}\n isDisabled={effectiveDisabled}\n isReadOnly={effectiveReadOnly}\n isInvalid={state.effectiveInvalid}\n isOpen={isPickerOpen}\n onOpenChange={(nextIsOpen) => {\n if (!nextIsOpen || !effectiveReadOnly) setIsPickerOpen(nextIsOpen);\n }}\n minValue={state.minValue}\n maxValue={state.maxValue}\n granularity={showTime ? 'minute' : 'day'}\n hourCycle={resolveHourCycle(hourFormat)}\n aria-label={state.effectiveAriaLabel}\n aria-labelledby={state.effectiveAriaLabelledby}\n aria-describedby={state.effectiveAriaDescribedby}\n className='cratis-date-picker__picker'\n >\n {({ isOpen }) => (\n <>\n <DatePickerGroup pt={pt} inputId={state.inputId} state={fieldState} isOpen={isOpen}>\n <DatePickerDateInput\n pt={pt}\n inputPartAttributes={state.inputPartAttributes}\n placeholder={state.effectivePlaceholder}\n state={fieldState}\n isOpen={isOpen}\n />\n <DatePickerPlaceholder\n pt={pt}\n placeholder={state.effectivePlaceholder}\n selected={fieldState.selected}\n />\n {showIcon && (\n <Button\n {...asReactAriaButtonProps(pt?.trigger)}\n isDisabled={\n effectiveDisabled || effectiveReadOnly\n }\n className={classNames(\n 'cratis-date-picker__trigger',\n pt?.trigger?.className,\n )}\n data-cratis-part='trigger'\n render={(triggerProps) => (\n <button\n {...triggerProps}\n {...triggerStateAttributes(fieldState, isOpen)}\n {...triggerAttributes(isOpen)}\n />\n )}\n aria-label={triggerLabel}\n >\n <span aria-hidden='true'>▦</span>\n </Button>\n )}\n </DatePickerGroup>\n <DatePickerPopover\n id={calendarId}\n pt={pt}\n isNonModal={isNonModal}\n zIndex={state.resolvedPopoverZIndex}\n buttonBar={buttonBar}\n />\n </>\n )}\n </AriaDatePicker>\n </UNSAFE_PortalProvider>\n </div>\n );\n};\n"],"names":["_jsx","AriaDatePicker","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAM,gBAAgB,GAAG,CAAC,UAA8C,KAAI;IACxE,IAAI,UAAU,KAAK,IAAI;AAAE,QAAA,OAAO,EAAE;IAClC,OAAO,UAAU,KAAK,IAAI,GAAG,EAAE,GAAG,SAAS;AAC/C,CAAC;AAMM,MAAM,6BAA6B,GAAG,CAAC,KAA2B,KAAI;IACzE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE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K,CAAC,mBAAmB,EAC9C,WAAW,EAAE,KAAK,CAAC,oBAAoB,EACvC,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,EAAA,CAChB,EACFA,GAAA,CAAC,qBAAqB,EAAA,EAClB,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,KAAK,CAAC,oBAAoB,EACvC,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAA,CAC/B,EACD,QAAQ,KACLA,GAAA,CAAC,MAAM,EAAA,EAAA,GACC,sBAAsB,CAAC,EAAE,EAAE,OAAO,CAAC,EACvC,UAAU,EACN,iBAAiB,IAAI,iBAAiB,EAE1C,SAAS,EAAE,UAAU,CACjB,6BAA6B,EAC7B,EAAE,EAAE,OAAO,EAAE,SAAS,CACzB,EAAA,kBAAA,EACgB,SAAS,EAC1B,MAAM,EAAE,CAAC,YAAY,MACjBA,GAAA,CAAA,QAAA,EAAA,EAAA,GACQ,YAAY,EAAA,GACZ,sBAAsB,CAAC,UAAU,EAAE,MAAM,CAAC,EAAA,GAC1C,iBAAiB,CAAC,MAAM,CAAC,EAAA,CAC/B,CACL,EAAA,YAAA,EACW,YAAY,EAAA,QAAA,EAExBA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,EAAA,QAAA,EAAA,QAAA,EAAA,CAAS,EAAA,CAC5B,CACZ,CAAA,EAAA,CACa,EAClBA,GAAA,CAAC,iBAAiB,EAAA,EACd,EAAE,EAAE,UAAU,EACd,EAAE,EAAE,EAAE,EACN,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,KAAK,CAAC,qBAAqB,EACnC,SAAS,EAAE,SAAS,EAAA,CACtB,CAAA,EAAA,CACH,CACN,EAAA,CACY,EAAA,CACG,EAAA,CACtB;AAEd;;"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type DatePickerButtonBarProps } from './DatePickerButtonBar.js';
|
|
2
2
|
import type { DatePickerInputPassThrough } from './DatePickerInput.js';
|
|
3
3
|
interface DatePickerPopoverProps {
|
|
4
|
+
id: string;
|
|
4
5
|
pt: DatePickerInputPassThrough | undefined;
|
|
5
6
|
isNonModal: boolean;
|
|
6
7
|
zIndex: string;
|
|
7
8
|
buttonBar: DatePickerButtonBarProps | null;
|
|
8
9
|
}
|
|
9
10
|
/** The portaled popover with the calendar dialog and, when requested, the Today and Clear actions. */
|
|
10
|
-
export declare const DatePickerPopover: ({ pt, isNonModal, zIndex, buttonBar }: DatePickerPopoverProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const DatePickerPopover: ({ id, pt, isNonModal, zIndex, buttonBar }: DatePickerPopoverProps) => import("react").JSX.Element;
|
|
11
12
|
export {};
|
|
12
13
|
//# sourceMappingURL=DatePickerPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerPopover.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerPopover.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,0BAAuB,CAAC;AAE3F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAmB,CAAC;AAEpE,UAAU,sBAAsB;IAC5B,EAAE,EAAE,0BAA0B,GAAG,SAAS,CAAC;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,wBAAwB,GAAG,IAAI,CAAC;CAC9C;AAED,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DatePickerPopover.d.ts","sourceRoot":"","sources":["../../../Common/DatePickerPopover.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,0BAAuB,CAAC;AAE3F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAmB,CAAC;AAEpE,UAAU,sBAAsB;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,0BAA0B,GAAG,SAAS,CAAC;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,wBAAwB,GAAG,IAAI,CAAC;CAC9C;AAED,sGAAsG;AACtG,eAAO,MAAM,iBAAiB,8CAA+C,sBAAsB,gCAqBlG,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { classNames } from '../ClassNames/classNames.js';
|
|
|
5
5
|
import { DatePickerButtonBar } from './DatePickerButtonBar.js';
|
|
6
6
|
import { DatePickerCalendar } from './DatePickerCalendar.js';
|
|
7
7
|
|
|
8
|
-
const DatePickerPopover = ({ pt, isNonModal, zIndex, buttonBar }) => (jsx(Popover, { ...pt?.popover, isNonModal: isNonModal, className: classNames('cratis-date-picker__popover', pt?.popover?.className), style: { zIndex, ...pt?.popover?.style }, "data-cratis-part": 'popover', "data-open": true, placement: 'bottom start', children: jsxs(Dialog, { ...pt?.dialog, className: classNames('cratis-date-picker__dialog', pt?.dialog?.className), "data-cratis-part": 'dialog', "data-open": true, children: [jsx(DatePickerCalendar, { pt: pt }), buttonBar && jsx(DatePickerButtonBar, { ...buttonBar })] }) }));
|
|
8
|
+
const DatePickerPopover = ({ id, pt, isNonModal, zIndex, buttonBar }) => (jsx(Popover, { ...pt?.popover, isNonModal: isNonModal, className: classNames('cratis-date-picker__popover', pt?.popover?.className), style: { zIndex, ...pt?.popover?.style }, "data-cratis-part": 'popover', "data-open": true, placement: 'bottom start', children: jsxs(Dialog, { ...pt?.dialog, id: id, className: classNames('cratis-date-picker__dialog', pt?.dialog?.className), "data-cratis-part": 'dialog', "data-open": true, children: [jsx(DatePickerCalendar, { pt: pt }), buttonBar && jsx(DatePickerButtonBar, { ...buttonBar })] }) }));
|
|
9
9
|
|
|
10
10
|
export { DatePickerPopover };
|
|
11
11
|
//# sourceMappingURL=DatePickerPopover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerPopover.js","sources":["../../../Common/DatePickerPopover.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 { Popover } from 'react-aria-components/DatePicker';\nimport { Dialog } from 'react-aria-components/Dialog';\nimport { classNames } from '../ClassNames/classNames';\nimport { DatePickerButtonBar, type DatePickerButtonBarProps } from './DatePickerButtonBar';\nimport { DatePickerCalendar } from './DatePickerCalendar';\nimport type { DatePickerInputPassThrough } from './DatePickerInput';\n\ninterface DatePickerPopoverProps {\n pt: DatePickerInputPassThrough | undefined;\n isNonModal: boolean;\n zIndex: string;\n buttonBar: DatePickerButtonBarProps | null;\n}\n\n/** The portaled popover with the calendar dialog and, when requested, the Today and Clear actions. */\nexport const DatePickerPopover = ({ pt, isNonModal, zIndex, buttonBar }: DatePickerPopoverProps) => (\n <Popover\n {...pt?.popover}\n isNonModal={isNonModal}\n className={classNames('cratis-date-picker__popover', pt?.popover?.className)}\n style={{ zIndex, ...pt?.popover?.style }}\n data-cratis-part='popover'\n data-open\n placement='bottom start'\n >\n <Dialog\n {...pt?.dialog}\n className={classNames('cratis-date-picker__dialog', pt?.dialog?.className)}\n data-cratis-part='dialog'\n data-open\n >\n <DatePickerCalendar pt={pt} />\n {buttonBar && <DatePickerButtonBar {...buttonBar} />}\n </Dialog>\n </Popover>\n);\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"DatePickerPopover.js","sources":["../../../Common/DatePickerPopover.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 { Popover } from 'react-aria-components/DatePicker';\nimport { Dialog } from 'react-aria-components/Dialog';\nimport { classNames } from '../ClassNames/classNames';\nimport { DatePickerButtonBar, type DatePickerButtonBarProps } from './DatePickerButtonBar';\nimport { DatePickerCalendar } from './DatePickerCalendar';\nimport type { DatePickerInputPassThrough } from './DatePickerInput';\n\ninterface DatePickerPopoverProps {\n id: string;\n pt: DatePickerInputPassThrough | undefined;\n isNonModal: boolean;\n zIndex: string;\n buttonBar: DatePickerButtonBarProps | null;\n}\n\n/** The portaled popover with the calendar dialog and, when requested, the Today and Clear actions. */\nexport const DatePickerPopover = ({ id, pt, isNonModal, zIndex, buttonBar }: DatePickerPopoverProps) => (\n <Popover\n {...pt?.popover}\n isNonModal={isNonModal}\n className={classNames('cratis-date-picker__popover', pt?.popover?.className)}\n style={{ zIndex, ...pt?.popover?.style }}\n data-cratis-part='popover'\n data-open\n placement='bottom start'\n >\n <Dialog\n {...pt?.dialog}\n id={id}\n className={classNames('cratis-date-picker__dialog', pt?.dialog?.className)}\n data-cratis-part='dialog'\n data-open\n >\n <DatePickerCalendar pt={pt} />\n {buttonBar && <DatePickerButtonBar {...buttonBar} />}\n </Dialog>\n </Popover>\n);\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;MAmBa,iBAAiB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAA0B,MAC/FA,GAAA,CAAC,OAAO,EAAA,EAAA,GACA,EAAE,EAAE,OAAO,EACf,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,CAAC,6BAA6B,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,EAC5E,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAA,kBAAA,EACvB,SAAS,EAAA,WAAA,EAAA,IAAA,EAE1B,SAAS,EAAC,cAAc,EAAA,QAAA,EAExBC,IAAA,CAAC,MAAM,EAAA,EAAA,GACC,EAAE,EAAE,MAAM,EACd,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,UAAU,CAAC,4BAA4B,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAA,kBAAA,EACzD,QAAQ,gCAGzBD,GAAA,CAAC,kBAAkB,EAAA,EAAC,EAAE,EAAE,EAAE,GAAI,EAC7B,SAAS,IAAIA,GAAA,CAAC,mBAAmB,EAAA,EAAA,GAAK,SAAS,EAAA,CAAI,CAAA,EAAA,CAC/C,EAAA,CACH;;"}
|
|
@@ -17,6 +17,8 @@ export interface PageProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
17
17
|
* trail rendered inside `children` instead.
|
|
18
18
|
*/
|
|
19
19
|
showTitle?: boolean;
|
|
20
|
+
/** Whether the content region is a main landmark. Defaults to true; set false inside an existing main. */
|
|
21
|
+
landmark?: boolean;
|
|
20
22
|
/** Page body content. */
|
|
21
23
|
children?: ReactNode;
|
|
22
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../Common/Page.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlD;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC7D;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB;AASD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,kBAAmB,SAAS,
|
|
1
|
+
{"version":3,"file":"Page.d.ts","sourceRoot":"","sources":["../../../Common/Page.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlD;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC7D;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB;AASD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,kBAAmB,SAAS,gCAY5C,CAAC"}
|
package/dist/esm/Common/Page.js
CHANGED
|
@@ -9,8 +9,9 @@ const pageDescriptor = describeComponent('Page', [
|
|
|
9
9
|
]);
|
|
10
10
|
const Page = (incomingProps) => {
|
|
11
11
|
const [props, marker] = useComponentPresentation(pageDescriptor, incomingProps, incomingProps.id);
|
|
12
|
-
const { title, showTitle = false, children, panel, className, ...rest } = props;
|
|
13
|
-
|
|
12
|
+
const { title, showTitle = false, landmark = true, children, panel, className, ...rest } = props;
|
|
13
|
+
const Content = landmark ? 'main' : 'div';
|
|
14
|
+
return (jsxs("div", { ...marker, className: `cratis:flex cratis:flex-col cratis:h-full cratis:flex-1${className ? ` ${className}` : ''}`, ...rest, children: [showTitle && jsx("h1", { className: 'cratis:text-3xl cratis:mt-3 cratis:mb-4', children: title }), jsx(Content, { className: `cratis:overflow-hidden cratis:h-full cratis:flex cratis:flex-col cratis:flex-1 ${panel ? 'panel' : ''}`, children: children })] }));
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export { Page };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sources":["../../../Common/Page.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 { HTMLAttributes, ReactNode } from 'react';\nimport { describeComponent } from '../configuration/identity/describeComponent';\nimport { useComponentPresentation } from '../configuration/identity/useComponentPresentation';\n\n/**\n * Props for {@link Page}. Extends the standard `div` attributes so callers can\n * forward `id`, `aria-*`, `data-*`, custom styles, and event handlers to the\n * root element.\n */\nexport interface PageProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Title of the page. Always passed in; only rendered when {@link showTitle}\n * is true, but kept on every page so it's available for browser tab titles\n * and accessibility tooling.\n */\n title: string;\n\n /**\n * When true, renders the title as a level-1 heading at the top of the page.\n * Defaults to `false` because many pages use a custom header or breadcrumb\n * trail rendered inside `children` instead.\n */\n showTitle?: boolean;\n\n /** Page body content. */\n children?: ReactNode;\n\n /**\n * When true, adds a `panel` class to the main content region for the\n * application's own CSS. Page applies no panel styling itself.\n */\n panel?: boolean\n}\n\n/** Presentation props of {@link Page}. */\nconst pageDescriptor = describeComponent<PageProps>('Page', [\n { name: 'title', label: 'Title', type: 'string', description: 'The page title, shown when showTitle is on.' },\n { name: 'showTitle', label: 'Show title', type: 'boolean', defaultValue: false },\n { name: 'panel', label: 'Panel', type: 'boolean', defaultValue: false },\n]);\n\n/**\n * Top-level page layout primitive. Renders a flex column that fills its parent\n * vertically, with an optional title heading and a `panel` class hook on the\n * main content area. Intended as the root element of every routable view.\n *\n * ```tsx\n * <Page title=\"Authors\" showTitle panel>\n * <AuthorList />\n * </Page>\n * ```\n *\n * @param props - {@link PageProps}.\n */\nexport const Page = (incomingProps: PageProps) => {\n const [props, marker] = useComponentPresentation(pageDescriptor, incomingProps, incomingProps.id);\n const { title, showTitle = false, children, panel, className, ...rest } = props;\n return (\n <div {...marker} className={`cratis:flex cratis:flex-col cratis:h-full cratis:flex-1${className ? ` ${className}` : ''}`} {...rest}>\n {showTitle && <h1 className='cratis:text-3xl cratis:mt-3 cratis:mb-4'>{title}</h1>}\n <
|
|
1
|
+
{"version":3,"file":"Page.js","sources":["../../../Common/Page.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 { HTMLAttributes, ReactNode } from 'react';\nimport { describeComponent } from '../configuration/identity/describeComponent';\nimport { useComponentPresentation } from '../configuration/identity/useComponentPresentation';\n\n/**\n * Props for {@link Page}. Extends the standard `div` attributes so callers can\n * forward `id`, `aria-*`, `data-*`, custom styles, and event handlers to the\n * root element.\n */\nexport interface PageProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Title of the page. Always passed in; only rendered when {@link showTitle}\n * is true, but kept on every page so it's available for browser tab titles\n * and accessibility tooling.\n */\n title: string;\n\n /**\n * When true, renders the title as a level-1 heading at the top of the page.\n * Defaults to `false` because many pages use a custom header or breadcrumb\n * trail rendered inside `children` instead.\n */\n showTitle?: boolean;\n\n /** Whether the content region is a main landmark. Defaults to true; set false inside an existing main. */\n landmark?: boolean;\n\n /** Page body content. */\n children?: ReactNode;\n\n /**\n * When true, adds a `panel` class to the main content region for the\n * application's own CSS. Page applies no panel styling itself.\n */\n panel?: boolean\n}\n\n/** Presentation props of {@link Page}. */\nconst pageDescriptor = describeComponent<PageProps>('Page', [\n { name: 'title', label: 'Title', type: 'string', description: 'The page title, shown when showTitle is on.' },\n { name: 'showTitle', label: 'Show title', type: 'boolean', defaultValue: false },\n { name: 'panel', label: 'Panel', type: 'boolean', defaultValue: false },\n]);\n\n/**\n * Top-level page layout primitive. Renders a flex column that fills its parent\n * vertically, with an optional title heading and a `panel` class hook on the\n * main content area. Intended as the root element of every routable view.\n *\n * ```tsx\n * <Page title=\"Authors\" showTitle panel>\n * <AuthorList />\n * </Page>\n * ```\n *\n * @param props - {@link PageProps}.\n */\nexport const Page = (incomingProps: PageProps) => {\n const [props, marker] = useComponentPresentation(pageDescriptor, incomingProps, incomingProps.id);\n const { title, showTitle = false, landmark = true, children, panel, className, ...rest } = props;\n const Content = landmark ? 'main' : 'div';\n return (\n <div {...marker} className={`cratis:flex cratis:flex-col cratis:h-full cratis:flex-1${className ? ` ${className}` : ''}`} {...rest}>\n {showTitle && <h1 className='cratis:text-3xl cratis:mt-3 cratis:mb-4'>{title}</h1>}\n <Content className={`cratis:overflow-hidden cratis:h-full cratis:flex cratis:flex-col cratis:flex-1 ${panel ? 'panel' : ''}`}>\n {children}\n </Content>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAyCA,MAAM,cAAc,GAAG,iBAAiB,CAAY,MAAM,EAAE;AACxD,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
1
|
+
import type { DatePickerInputProps } from './DatePickerInput.js';
|
|
2
|
+
/** Resolves the calendar name and connects its trigger to the caller's or generated dialog ID. */
|
|
3
|
+
export declare const useDatePickerAccessibility: (props: DatePickerInputProps, openCalendarMessage: string | undefined) => {
|
|
4
|
+
calendarId: string;
|
|
5
|
+
triggerLabel: string;
|
|
6
|
+
triggerAttributes: (isOpen: boolean) => {
|
|
7
|
+
'aria-controls': string | undefined;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useDatePickerAccessibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDatePickerAccessibility.d.ts","sourceRoot":"","sources":["../../../Common/useDatePickerAccessibility.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAmB,CAAC;AAE9D,kGAAkG;AAClG,eAAO,MAAM,0BAA0B,UAAW,oBAAoB,uBAAuB,MAAM,GAAG,SAAS;;;gCAIxE,OAAO;QACtC,eAAe;;CAItB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useId } from 'react';
|
|
2
|
+
|
|
3
|
+
const useDatePickerAccessibility = (props, openCalendarMessage) => {
|
|
4
|
+
const generatedId = useId();
|
|
5
|
+
const calendarId = props.pt?.dialog?.id ?? generatedId;
|
|
6
|
+
const triggerLabel = props.openCalendarLabel ?? props.pt?.trigger?.['aria-label'] ?? openCalendarMessage ?? 'Open calendar';
|
|
7
|
+
const triggerAttributes = (isOpen) => ({
|
|
8
|
+
'aria-controls': isOpen ? calendarId : undefined,
|
|
9
|
+
});
|
|
10
|
+
return { calendarId, triggerLabel, triggerAttributes };
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { useDatePickerAccessibility };
|
|
14
|
+
//# sourceMappingURL=useDatePickerAccessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDatePickerAccessibility.js","sources":["../../../Common/useDatePickerAccessibility.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 { useId } from 'react';\nimport type { DatePickerInputProps } from './DatePickerInput';\n\n/** Resolves the calendar name and connects its trigger to the caller's or generated dialog ID. */\nexport const useDatePickerAccessibility = (props: DatePickerInputProps, openCalendarMessage: string | undefined) => {\n const generatedId = useId();\n const calendarId = props.pt?.dialog?.id ?? generatedId;\n const triggerLabel = props.openCalendarLabel ?? props.pt?.trigger?.['aria-label'] ?? openCalendarMessage ?? 'Open calendar';\n const triggerAttributes = (isOpen: boolean) => ({\n 'aria-controls': isOpen ? calendarId : undefined,\n });\n\n return { calendarId, triggerLabel, triggerAttributes };\n};\n"],"names":[],"mappings":";;MAOa,0BAA0B,GAAG,CAAC,KAA2B,EAAE,mBAAuC,KAAI;AAC/G,IAAA,MAAM,WAAW,GAAG,KAAK,EAAE;IAC3B,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,WAAW;AACtD,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,YAAY,CAAC,IAAI,mBAAmB,IAAI,eAAe;AAC3H,IAAA,MAAM,iBAAiB,GAAG,CAAC,MAAe,MAAM;QAC5C,eAAe,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;AACnD,KAAA,CAAC;AAEF,IAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE;AAC1D;;"}
|
|
@@ -95,6 +95,8 @@ export interface DataPageProps<TQuery extends IQueryFor<TDataType, TArguments> |
|
|
|
95
95
|
* The title of the page
|
|
96
96
|
*/
|
|
97
97
|
title: string;
|
|
98
|
+
/** Whether the page content is a main landmark. Defaults to true; set false inside an existing main. */
|
|
99
|
+
landmark?: boolean;
|
|
98
100
|
/**
|
|
99
101
|
* Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.
|
|
100
102
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.d.ts","sourceRoot":"","sources":["../../../DataPage/DataPage.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAEzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAA6B,CAAC;AAElE,OAAO,KAAK,EACR,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,iCAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gDAA6C,CAAC;AACjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAoC,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAWxD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC1B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,WAAY,aAAa,SAE7C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,k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BAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;0BA+GG,MAAM,SACA,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,GAChC,SAAS,CAAC,SAAS,EAAE,EAAE,UAAU,CAAC,GAClC,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC,GAC1C,mBAAmB,CAAC,SAAS,EAAE,EAAE,UAAU,CAAC,EAClD,SAAS,SAAS,MAAM,EACxB,UAAU,SAAS,MAAM,EAEzB,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC;;;;;;AA+DvD,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -74,7 +74,7 @@ const DataPage = (props) => {
|
|
|
74
74
|
selectedItems,
|
|
75
75
|
onSelectedItemsChange: selectedItemsChanged,
|
|
76
76
|
};
|
|
77
|
-
return (jsx(DataPageContext.Provider, { value: context, children: jsx(Page, { title: props.title, panel: true, style: pageStyle, "data-cratis-component": 'DataPage', children: props.detailsComponent ? (jsxs(Allotment, { className: 'cratis:h-full', proportionalLayout: false, children: [jsx(Allotment.Pane, { children: jsx(DataPageLayout, { children: props.children }) }), selectedItem && (jsx(Allotment.Pane, { preferredSize: '450px', children: jsx(props.detailsComponent, { item: selectedItem, onRefresh: props.onRefresh }) }))] })) : (jsx(DataPageLayout, { children: props.children })) }) }));
|
|
77
|
+
return (jsx(DataPageContext.Provider, { value: context, children: jsx(Page, { title: props.title, landmark: props.landmark, panel: true, style: pageStyle, "data-cratis-component": 'DataPage', children: props.detailsComponent ? (jsxs(Allotment, { className: 'cratis:h-full', proportionalLayout: false, children: [jsx(Allotment.Pane, { children: jsx(DataPageLayout, { children: props.children }) }), selectedItem && (jsx(Allotment.Pane, { preferredSize: '450px', children: jsx(props.detailsComponent, { item: selectedItem, onRefresh: props.onRefresh }) }))] })) : (jsx(DataPageLayout, { children: props.children })) }) }));
|
|
78
78
|
};
|
|
79
79
|
DataPage.MenuItem = MenuItem;
|
|
80
80
|
DataPage.MenuItems = MenuItems;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.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 { type CSSProperties, type ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { ActionMenubar, type ActionMenuItem } from '../Common/ActionMenubar';\nimport type { ButtonParts } from '../Common/Button';\nimport { type IObservableQueryFor, type IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport type { DataTableParts } from '../DataTables/DataTableCore';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport type {\n TablePaginatorParts,\n TablePaginatorProps,\n} from '../DataTables/TablePaginator';\nimport type { DataTableFilterMeta } from '../DataTables/DataTableFilterMeta';\nimport type { DataTableSelectionChangeEvent } from '../DataTables/DataTableSelectionChangeEvent';\nimport type { DataTableServerQuery } from '../DataTables/DataTableServerQuery';\nimport { Allotment } from 'allotment';\nimport type { Constructor } from '@cratis/fundamentals';\nimport { DataPageLayout } from './DataPageLayout';\n\n// Allotment ships its layout as a stylesheet rather than inline styles, and a pane only becomes\n// the absolutely positioned, full-height box the split view assumes once that stylesheet is on\n// the page. It used to be pulled in here with a bare `import 'allotment/dist/style.css'`, but a\n// CSS import inside the JS graph is precisely what stops the published ESM from loading in Node\n// (Cratis/Components#118). The rules now ship inside this package's own `./styles` entry point,\n// which the build concatenates from every component stylesheet plus this third-party one — so a\n// consumer still gets a working split view, from the single stylesheet they already import.\n\n/**\n * Props for {@link MenuItem} — a single action in a {@link DataPage}'s\n * action bar.\n */\nexport interface MenuItemProps {\n /** Icon component rendered before the label (e.g. a react-icons icon). */\n icon?: React.ComponentType<{ className?: string }>;\n /** The visible label. */\n label?: string;\n /** Invoked when the item is activated. */\n command?: () => void;\n /** When true, the item is greyed out regardless of selection. */\n disabled?: boolean;\n /**\n * When true, the menu item is disabled while no row is selected in the\n * surrounding {@link DataPage}. Use it for context-sensitive actions like\n * \"Edit\" or \"Delete\" that require a selection.\n */\n disableOnUnselected?: boolean;\n}\n\n/**\n * Declarative menu item for use inside `<DataPage.MenuItems>`. Renders nothing\n * directly; the surrounding {@link MenuItems} component reads its props and\n * forwards them to the action menubar.\n */\nexport const MenuItem = (_props: MenuItemProps) => {\n return null;\n};\n\n/**\n * Props for {@link MenuItems}.\n */\nexport interface MenuItemsProps {\n /** One or more `<DataPage.MenuItem>` elements. */\n children: ReactNode;\n}\n\n/**\n * Props for {@link Columns}.\n */\nexport interface ColumnsProps {\n /** Cratis-owned `<Column>` markers describing each visible column. */\n children: ReactNode;\n}\n\n/**\n * The action bar is an intrinsically sized item in the page's layout column —\n * it takes the height its menubar needs and never gives any of it up, so the\n * table region below it is the only part that has to adapt to the space left.\n */\nconst actionsStyle: CSSProperties = { flexShrink: 0 };\n\n/**\n * The table region takes every pixel the action bar leaves and no more.\n * `minHeight: 0` is the load-bearing half: without it the region's automatic\n * minimum keeps it at content height, the column grows past the page, and the\n * table's paginator ends up below the clipped edge.\n */\nconst tableRegionStyle: CSSProperties = { flexGrow: 1, flexBasis: 0, minHeight: 0 };\n\n/**\n * The floor a `DataPage` falls back to when its ancestors give it no height at\n * all. A page that renders as an empty sliver is indistinguishable from a\n * broken one, so a contract-violating consumer gets a small but usable page\n * instead of nothing.\n */\nconst pageStyle: CSSProperties = { minHeight: '20rem' };\n\n/**\n * Renders an action menubar at the top of a {@link DataPage}, populated from\n * `<DataPage.MenuItem>` children. Each menu item's `disableOnUnselected` flag\n * is automatically honored against the current row selection.\n *\n * Use as `<DataPage.MenuItems>` inside a `<DataPage>`.\n */\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = useDataPageContext();\n const isDisabled =\n context.selectionMode === 'multiple'\n ? context.selectedItems.length === 0\n : !context.selectedItem;\n\n const items = useMemo(() => {\n const menuItems: ActionMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type === MenuItem) {\n const Icon = child.props.icon;\n menuItems.push({\n label: child.props.label,\n command: child.props.command,\n icon: Icon ? <Icon className='cratis:mr-2' /> : undefined,\n disabled:\n (child.props.disabled ?? false) ||\n (isDisabled && (child.props.disableOnUnselected ?? false)),\n });\n }\n });\n\n return menuItems;\n }, [children, isDisabled]);\n\n return (\n <div\n className='cratis-data-page-actions cratis:px-4 cratis:py-2'\n style={actionsStyle}\n >\n <ActionMenubar\n aria-label={context.actionsAriaLabel ?? 'Actions'}\n model={items}\n className={context.menubarClassName}\n pt={context.menubarPt}\n ptOptions={context.menubarPtOptions}\n unstyled={context.menubarUnstyled}\n />\n </div>\n );\n};\n\n/**\n * Renders the data table at the body of a {@link DataPage}. Automatically\n * selects between {@link DataTableForQuery} (snapshot query) and\n * {@link DataTableForObservableQuery} (real-time observable) based on the\n * `query` type provided to the surrounding `<DataPage>`.\n *\n * Use as `<DataPage.Columns>` inside a `<DataPage>`, with Cratis-owned `<Column>`\n * children defining the table columns.\n */\nexport const Columns = ({ children }: ColumnsProps) => {\n const context = useDataPageContext();\n const isSnapshotQuery = context.query.prototype instanceof QueryFor;\n // SAFETY: The runtime prototype check above narrows a constructor shape that\n // TypeScript cannot discriminate after the generic DataPage context is erased.\n const snapshotQuery = context.query as Constructor<\n IQueryFor<object, object> | IQueryFor<object[], object>\n >;\n const observableQuery = context.query as Constructor<\n IObservableQueryFor<object, object> | IObservableQueryFor<object[], object>\n >;\n\n return (\n <div className='cratis-data-page-table' style={tableRegionStyle}>\n {isSnapshotQuery ? (\n <DataTableForQuery\n {...context}\n query={snapshotQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForQuery>\n ) : (\n <DataTableForObservableQuery\n {...context}\n query={observableQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForObservableQuery>\n )}\n </div>\n );\n};\n\n/**\n * Props passed to the optional details component rendered on the right pane\n * of a {@link DataPage} when a row is selected.\n *\n * @typeParam TDataType - The type of the selected item.\n */\nexport interface IDetailsComponentProps<TDataType> {\n /** The currently-selected row. */\n item: TDataType;\n\n /**\n * The caller's {@link DataPageProps.onRefresh} callback, forwarded unchanged\n * to the details component. Invoking it does not make DataPage refetch.\n */\n onRefresh?: () => void;\n}\n\ninterface IDataPageContext extends DataPageProps<\n IQueryFor<object, object> | IObservableQueryFor<object, object>,\n object,\n object\n> {\n selectedItem: object | null | undefined;\n onSelectionChanged: (event: DataTableSelectionChangeEvent<object>) => void;\n selectedItems: object[];\n onSelectedItemsChange: (items: object[]) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext | null>(null);\n\nfunction useDataPageContext(): IDataPageContext {\n const context = React.useContext(DataPageContext);\n if (!context) {\n throw new Error('useDataPageContext must be used within a DataPage component');\n }\n return context;\n}\n\n/**\n * Props for {@link DataPage}.\n *\n * @typeParam TQuery - The query class — either a snapshot `IQueryFor` or a real-time `IObservableQueryFor`.\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type, or `object` if the query takes none.\n */\nexport interface DataPageProps<\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n> {\n /**\n * The title of the page\n */\n title: string;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<TDataType>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The message to show instead of {@link emptyMessage} when a search or column filter is active\n * and no rows are shown. Defaults to a localizable message that says only the loaded page was\n * searched, or, with `serverQuery`, a neutral \"No rows match the search.\".\n */\n filteredEmptyMessage?: ReactNode;\n\n /** Notified of every change to the search text, as typed. */\n onGlobalFilterChange?: (globalFilter: string) => void;\n\n /** Message shown while loading without rows. */\n loadingMessage?: ReactNode;\n /** Message shown when the query fails. */\n failureMessage?: ReactNode;\n /** Message shown when access is denied. */\n unauthorizedMessage?: ReactNode;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: TDataType | undefined | null;\n\n /**\n * Callback for when the selection changes, including replacement or removal of its query row.\n * With a controlled selection, the consumer must accept the new value. Without a callback,\n * the controlled value and its details remain unchanged even if the query row disappears.\n */\n onSelectionChange?(event: DataTableSelectionChangeEvent<TDataType>): void;\n\n /**\n * The row selection mode. Defaults to `'single'`. Use `'multiple'` for a page whose actions\n * operate on a set of rows - it adds per-row checkboxes and a select-all header checkbox, and\n * reports through {@link onSelectedItemsChange}.\n */\n selectionMode?: 'single' | 'multiple';\n\n /**\n * The currently selected rows, for `selectionMode='multiple'`. Leave undefined to let the page\n * own the selection.\n */\n selectedItems?: TDataType[];\n\n /**\n * Callback for when a multiple selection changes, with the full selected set.\n */\n onSelectedItemsChange?(items: TDataType[]): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /** Placeholder for the loaded-page search input. */\n globalSearchPlaceholder?: string;\n\n /** Accessible name for the loaded-page search input. */\n globalSearchAriaLabel?: string;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n\n /**\n * @deprecated Filtering is always applied to the currently loaded page.\n * This compatibility prop no longer toggles behavior and does not change\n * server-reported pagination totals. Retained for source compatibility only.\n */\n clientFiltering?: boolean;\n\n /**\n * Opts the page's table into server mode: the query sorts, filters and searches the complete\n * result before paging, and the table renders the rows as returned. Leave undefined to sort,\n * filter and search the loaded page. See {@link DataTableServerQuery}.\n */\n serverQuery?: DataTableServerQuery<TArguments>;\n\n /** Optional callback forwarded to the details component as `onRefresh`; DataPage does not invoke it or refetch when it is called. */\n onRefresh?(): void;\n\n /**\n * Extra CSS class name forwarded to the inner DataTable root.\n */\n tableClassName?: string;\n\n /** Cratis-owned per-part attributes applied to the inner table. */\n tablePt?: DataTableParts;\n\n /**\n * @deprecated Cratis table parts always merge. Remove this renderer-era option.\n */\n tablePtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `tablePt` and CSS instead.\n */\n tableUnstyled?: boolean;\n\n /** Shows numbered page buttons in the query table paginator. Defaults to false. */\n pageLinks?: TablePaginatorProps['pageLinks'];\n\n /** Extra CSS class name forwarded to the query table paginator. */\n paginatorClassName?: string;\n\n /** Cratis-owned attributes applied to the query table paginator. */\n paginatorPt?: TablePaginatorParts;\n\n /**\n * @deprecated Cratis paginator parts always merge. Remove this renderer-era option.\n */\n paginatorPtOptions?: object;\n\n /** Accessible paginator labels. Override any value to localize it. */\n paginatorAriaLabels?: TablePaginatorProps['ariaLabels'];\n\n /**\n * Extra CSS class name forwarded to the action menubar root.\n */\n menubarClassName?: string;\n\n /** Cratis-owned part attributes applied to the action menubar's buttons. */\n menubarPt?: ButtonParts;\n\n /**\n * @deprecated Cratis menubar parts always merge. Remove this renderer-era option.\n */\n menubarPtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `menubarPt` and CSS instead.\n */\n menubarUnstyled?: boolean;\n\n /**\n * Accessible name for the action menubar (toolbar). Override to localize.\n * Defaults to `'Actions'`.\n */\n actionsAriaLabel?: string;\n}\n\n/**\n * A page primitive that combines an action menubar, a query-backed data\n * table, and an optional details pane into one layout. Designed as the\n * default rendering for \"list view\" pages in an Arc app.\n *\n * ## What `TQuery` is\n *\n * `TQuery` is the auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# read model query. Two flavors are accepted and\n * **selected automatically at runtime** based on the class hierarchy:\n *\n * - **`IQueryFor<TDataType, TArguments>`** — a snapshot query. Re-fetched\n * when `queryArguments` change or when the page is mounted. Rendered\n * through {@link DataTableForQuery} internally.\n * - **`IObservableQueryFor<TDataType, TArguments>`** — a real-time\n * subscription. Connects to the backend over WebSocket and re-renders\n * automatically whenever the underlying read model changes server-side.\n * Rendered through {@link DataTableForObservableQuery} internally.\n *\n * You don't pick which inner table to use — `DataPage` inspects the\n * prototype chain (`context.query.prototype instanceof QueryFor`) and\n * mounts the correct one.\n *\n * ## Declarative composition\n *\n * Three children build up the page:\n *\n * - **`<DataPage.MenuItems>`** wraps `<DataPage.MenuItem>` elements that\n * become the action `Menubar` at the top. Each item declares its `icon`,\n * `label`, and `command` (an `onClick` handler). Items can be marked\n * `disableOnUnselected` so they automatically grey out until the user\n * picks a row — useful for Edit / Delete actions that need a target.\n *\n * - **`<DataPage.Columns>`** wraps Cratis-owned `<Column>` markers that\n * describe the visible columns. The columns themselves are\n * Cratis-owned — the documented `ColumnProps` surface is\n * supported here (sorting, filtering, custom body templates, …).\n *\n * - **`detailsComponent`** (optional) is a React component rendered in a\n * right-hand pane via Allotment when a row is selected. It receives the\n * selected item as `item` and the caller's `onRefresh` callback, if\n * supplied. DataPage does not refetch when the details component invokes it.\n *\n * ## Selection lifecycle\n *\n * `DataPage` keeps the current selection in local state and threads it to\n * the inner table, the menubar (`disableOnUnselected` items follow it),\n * and the optional details pane. The `onSelectionChange` prop is invoked\n * after every change if the consumer also needs to react to it.\n *\n * ```tsx\n * <DataPage<AllAuthors, Author, never>\n * title=\"Authors\"\n * query={AllAuthors} // proxy from C#\n * detailsComponent={AuthorDetails}>\n * <DataPage.MenuItems>\n * <DataPage.MenuItem icon={FaPlus} label=\"Add\" command={onAdd} />\n * <DataPage.MenuItem icon={FaPencil} label=\"Edit\" command={onEdit}\n * disableOnUnselected />\n * <DataPage.MenuItem icon={FaTrash} label=\"Delete\" command={onDelete}\n * disableOnUnselected />\n * </DataPage.MenuItems>\n * <DataPage.Columns>\n * <Column field=\"name\" header=\"Name\" sortable />\n * <Column field=\"email\" header=\"Email\" />\n * </DataPage.Columns>\n * </DataPage>\n * ```\n *\n * ## Height — `DataPage` needs a bounded ancestor\n *\n * `DataPage` fills the height it is given and divides it between the action\n * bar and the table region, so the table's paginator always sits at the\n * bottom of the page rather than below its edge. It cannot invent that height:\n * every element from the page root down sizes as a percentage of its parent,\n * so **some ancestor has to have a definite height**.\n *\n * ```tsx\n * // ✅ the router outlet, a sized container, or a flex child with min-height\n * <div style={{ height: '100vh' }}>\n * <DataPage … />\n * </div>\n *\n * // ❌ nothing above resolves to a height — the table grows to its content\n * <div>\n * <DataPage … />\n * </div>\n * ```\n *\n * Without one, the page falls back to a small fixed height so it stays\n * usable instead of collapsing to nothing.\n *\n * ## Styling\n *\n * The inner DataTable and action toolbar each have their own per-slot props:\n * `tablePt` / `tableUnstyled` / `tableClassName` for the table;\n * `paginatorPt` / `paginatorClassName` / `paginatorAriaLabels` for paging;\n * `menubarPt` / `menubarPtOptions` / `menubarUnstyled` / `menubarClassName` for\n * the action toolbar's stable button parts (the action bar is implemented as\n * a button toolbar, so `menubarPt` targets the stable Cratis button parts). See the\n * [pass-through cheat sheet](../../Documentation/Styling/pass-through.md) for\n * the full slot reference.\n *\n * @typeParam TQuery - The query class (proxy generated from a C# read model query).\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type.\n * @param props - {@link DataPageProps}.\n */\nconst DataPage = <\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n>(\n props: DataPageProps<TQuery, TDataType, TArguments>,\n) => {\n const [internalSelection, setInternalSelection] = React.useState<\n TDataType | null | undefined\n >(props.selection);\n const selectedItem =\n props.selection === undefined ? internalSelection : props.selection;\n\n const selectionChanged = (event: DataTableSelectionChangeEvent<TDataType>) => {\n if (props.selection === undefined) setInternalSelection(event.value);\n props.onSelectionChange?.(event);\n };\n\n const [internalSelectedItems, setInternalSelectedItems] = React.useState<TDataType[]>(\n props.selectedItems ?? [],\n );\n const selectedItems = props.selectedItems ?? internalSelectedItems;\n\n const selectedItemsChanged = (items: TDataType[]) => {\n if (props.selectedItems === undefined) setInternalSelectedItems(items);\n props.onSelectedItemsChange?.(items);\n };\n\n // SAFETY: React context cannot retain this component's generic parameters. The\n // provider and every consumer are nested in the same DataPage invocation, so the\n // erased object-level context never crosses between differently typed pages.\n const context = {\n ...props,\n selectedItem,\n onSelectionChanged: selectionChanged,\n selectedItems,\n onSelectedItemsChange: selectedItemsChanged,\n } as unknown as IDataPageContext;\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} panel={true} style={pageStyle} data-cratis-component='DataPage'>\n {props.detailsComponent ? (\n <Allotment className='cratis:h-full' proportionalLayout={false}>\n <Allotment.Pane>\n <DataPageLayout>{props.children}</DataPageLayout>\n </Allotment.Pane>\n {selectedItem && (\n <Allotment.Pane preferredSize='450px'>\n <props.detailsComponent\n item={selectedItem}\n onRefresh={props.onRefresh}\n />\n </Allotment.Pane>\n )}\n </Allotment>\n ) : (\n <DataPageLayout>{props.children}</DataPageLayout>\n )}\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItem = MenuItem;\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAyDO,MAAM,QAAQ,GAAG,CAAC,MAAqB,KAAI;AAC9C,IAAA,OAAO,IAAI;AACf;AAuBA,MAA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CAAC,OAAO,GAAG,OAAO;;"}
|
|
1
|
+
{"version":3,"file":"DataPage.js","sources":["../../../DataPage/DataPage.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 { type CSSProperties, type ReactNode, useMemo } from 'react';\nimport { Page } from '../Common/Page';\nimport React from 'react';\nimport { ActionMenubar, type ActionMenuItem } from '../Common/ActionMenubar';\nimport type { ButtonParts } from '../Common/Button';\nimport { type IObservableQueryFor, type IQueryFor, QueryFor } from '@cratis/arc/queries';\nimport { DataTableForObservableQuery } from '../DataTables/DataTableForObservableQuery';\nimport type { DataTableParts } from '../DataTables/DataTableCore';\nimport { DataTableForQuery } from '../DataTables/DataTableForQuery';\nimport type {\n TablePaginatorParts,\n TablePaginatorProps,\n} from '../DataTables/TablePaginator';\nimport type { DataTableFilterMeta } from '../DataTables/DataTableFilterMeta';\nimport type { DataTableSelectionChangeEvent } from '../DataTables/DataTableSelectionChangeEvent';\nimport type { DataTableServerQuery } from '../DataTables/DataTableServerQuery';\nimport { Allotment } from 'allotment';\nimport type { Constructor } from '@cratis/fundamentals';\nimport { DataPageLayout } from './DataPageLayout';\n\n// Allotment ships its layout as a stylesheet rather than inline styles, and a pane only becomes\n// the absolutely positioned, full-height box the split view assumes once that stylesheet is on\n// the page. It used to be pulled in here with a bare `import 'allotment/dist/style.css'`, but a\n// CSS import inside the JS graph is precisely what stops the published ESM from loading in Node\n// (Cratis/Components#118). The rules now ship inside this package's own `./styles` entry point,\n// which the build concatenates from every component stylesheet plus this third-party one — so a\n// consumer still gets a working split view, from the single stylesheet they already import.\n\n/**\n * Props for {@link MenuItem} — a single action in a {@link DataPage}'s\n * action bar.\n */\nexport interface MenuItemProps {\n /** Icon component rendered before the label (e.g. a react-icons icon). */\n icon?: React.ComponentType<{ className?: string }>;\n /** The visible label. */\n label?: string;\n /** Invoked when the item is activated. */\n command?: () => void;\n /** When true, the item is greyed out regardless of selection. */\n disabled?: boolean;\n /**\n * When true, the menu item is disabled while no row is selected in the\n * surrounding {@link DataPage}. Use it for context-sensitive actions like\n * \"Edit\" or \"Delete\" that require a selection.\n */\n disableOnUnselected?: boolean;\n}\n\n/**\n * Declarative menu item for use inside `<DataPage.MenuItems>`. Renders nothing\n * directly; the surrounding {@link MenuItems} component reads its props and\n * forwards them to the action menubar.\n */\nexport const MenuItem = (_props: MenuItemProps) => {\n return null;\n};\n\n/**\n * Props for {@link MenuItems}.\n */\nexport interface MenuItemsProps {\n /** One or more `<DataPage.MenuItem>` elements. */\n children: ReactNode;\n}\n\n/**\n * Props for {@link Columns}.\n */\nexport interface ColumnsProps {\n /** Cratis-owned `<Column>` markers describing each visible column. */\n children: ReactNode;\n}\n\n/**\n * The action bar is an intrinsically sized item in the page's layout column —\n * it takes the height its menubar needs and never gives any of it up, so the\n * table region below it is the only part that has to adapt to the space left.\n */\nconst actionsStyle: CSSProperties = { flexShrink: 0 };\n\n/**\n * The table region takes every pixel the action bar leaves and no more.\n * `minHeight: 0` is the load-bearing half: without it the region's automatic\n * minimum keeps it at content height, the column grows past the page, and the\n * table's paginator ends up below the clipped edge.\n */\nconst tableRegionStyle: CSSProperties = { flexGrow: 1, flexBasis: 0, minHeight: 0 };\n\n/**\n * The floor a `DataPage` falls back to when its ancestors give it no height at\n * all. A page that renders as an empty sliver is indistinguishable from a\n * broken one, so a contract-violating consumer gets a small but usable page\n * instead of nothing.\n */\nconst pageStyle: CSSProperties = { minHeight: '20rem' };\n\n/**\n * Renders an action menubar at the top of a {@link DataPage}, populated from\n * `<DataPage.MenuItem>` children. Each menu item's `disableOnUnselected` flag\n * is automatically honored against the current row selection.\n *\n * Use as `<DataPage.MenuItems>` inside a `<DataPage>`.\n */\nexport const MenuItems = ({ children }: MenuItemsProps) => {\n const context = useDataPageContext();\n const isDisabled =\n context.selectionMode === 'multiple'\n ? context.selectedItems.length === 0\n : !context.selectedItem;\n\n const items = useMemo(() => {\n const menuItems: ActionMenuItem[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<MenuItemProps>(child) && child.type === MenuItem) {\n const Icon = child.props.icon;\n menuItems.push({\n label: child.props.label,\n command: child.props.command,\n icon: Icon ? <Icon className='cratis:mr-2' /> : undefined,\n disabled:\n (child.props.disabled ?? false) ||\n (isDisabled && (child.props.disableOnUnselected ?? false)),\n });\n }\n });\n\n return menuItems;\n }, [children, isDisabled]);\n\n return (\n <div\n className='cratis-data-page-actions cratis:px-4 cratis:py-2'\n style={actionsStyle}\n >\n <ActionMenubar\n aria-label={context.actionsAriaLabel ?? 'Actions'}\n model={items}\n className={context.menubarClassName}\n pt={context.menubarPt}\n ptOptions={context.menubarPtOptions}\n unstyled={context.menubarUnstyled}\n />\n </div>\n );\n};\n\n/**\n * Renders the data table at the body of a {@link DataPage}. Automatically\n * selects between {@link DataTableForQuery} (snapshot query) and\n * {@link DataTableForObservableQuery} (real-time observable) based on the\n * `query` type provided to the surrounding `<DataPage>`.\n *\n * Use as `<DataPage.Columns>` inside a `<DataPage>`, with Cratis-owned `<Column>`\n * children defining the table columns.\n */\nexport const Columns = ({ children }: ColumnsProps) => {\n const context = useDataPageContext();\n const isSnapshotQuery = context.query.prototype instanceof QueryFor;\n // SAFETY: The runtime prototype check above narrows a constructor shape that\n // TypeScript cannot discriminate after the generic DataPage context is erased.\n const snapshotQuery = context.query as Constructor<\n IQueryFor<object, object> | IQueryFor<object[], object>\n >;\n const observableQuery = context.query as Constructor<\n IObservableQueryFor<object, object> | IObservableQueryFor<object[], object>\n >;\n\n return (\n <div className='cratis-data-page-table' style={tableRegionStyle}>\n {isSnapshotQuery ? (\n <DataTableForQuery\n {...context}\n query={snapshotQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForQuery>\n ) : (\n <DataTableForObservableQuery\n {...context}\n query={observableQuery}\n selection={context.selectedItem}\n onSelectionChange={context.onSelectionChanged}\n className={context.tableClassName}\n pt={context.tablePt}\n ptOptions={context.tablePtOptions}\n unstyled={context.tableUnstyled}\n >\n {children}\n </DataTableForObservableQuery>\n )}\n </div>\n );\n};\n\n/**\n * Props passed to the optional details component rendered on the right pane\n * of a {@link DataPage} when a row is selected.\n *\n * @typeParam TDataType - The type of the selected item.\n */\nexport interface IDetailsComponentProps<TDataType> {\n /** The currently-selected row. */\n item: TDataType;\n\n /**\n * The caller's {@link DataPageProps.onRefresh} callback, forwarded unchanged\n * to the details component. Invoking it does not make DataPage refetch.\n */\n onRefresh?: () => void;\n}\n\ninterface IDataPageContext extends DataPageProps<\n IQueryFor<object, object> | IObservableQueryFor<object, object>,\n object,\n object\n> {\n selectedItem: object | null | undefined;\n onSelectionChanged: (event: DataTableSelectionChangeEvent<object>) => void;\n selectedItems: object[];\n onSelectedItemsChange: (items: object[]) => void;\n}\n\nconst DataPageContext = React.createContext<IDataPageContext | null>(null);\n\nfunction useDataPageContext(): IDataPageContext {\n const context = React.useContext(DataPageContext);\n if (!context) {\n throw new Error('useDataPageContext must be used within a DataPage component');\n }\n return context;\n}\n\n/**\n * Props for {@link DataPage}.\n *\n * @typeParam TQuery - The query class — either a snapshot `IQueryFor` or a real-time `IObservableQueryFor`.\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type, or `object` if the query takes none.\n */\nexport interface DataPageProps<\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n> {\n /**\n * The title of the page\n */\n title: string;\n\n /** Whether the page content is a main landmark. Defaults to true; set false inside an existing main. */\n landmark?: boolean;\n\n /**\n * Children to render, for this it means menu items and columns. Use <DataPage.MenuItems> and <DataPage.Columns> for this.\n */\n children: ReactNode;\n\n /**\n * Component to render when the selection changes\n */\n detailsComponent?: React.FC<IDetailsComponentProps<TDataType>>;\n\n /**\n * The type of query to use\n */\n query: Constructor<TQuery>;\n\n /**\n * Optional arguments to pass to the query\n */\n queryArguments?: TArguments;\n\n /**\n * The message to show when there is no data\n */\n emptyMessage: string;\n\n /**\n * The message to show instead of {@link emptyMessage} when a search or column filter is active\n * and no rows are shown. Defaults to a localizable message that says only the loaded page was\n * searched, or, with `serverQuery`, a neutral \"No rows match the search.\".\n */\n filteredEmptyMessage?: ReactNode;\n\n /** Notified of every change to the search text, as typed. */\n onGlobalFilterChange?: (globalFilter: string) => void;\n\n /** Message shown while loading without rows. */\n loadingMessage?: ReactNode;\n /** Message shown when the query fails. */\n failureMessage?: ReactNode;\n /** Message shown when access is denied. */\n unauthorizedMessage?: ReactNode;\n\n /**\n * The key to use for the data\n */\n dataKey?: string | undefined;\n\n /**\n * The current selection.\n */\n selection?: TDataType | undefined | null;\n\n /**\n * Callback for when the selection changes, including replacement or removal of its query row.\n * With a controlled selection, the consumer must accept the new value. Without a callback,\n * the controlled value and its details remain unchanged even if the query row disappears.\n */\n onSelectionChange?(event: DataTableSelectionChangeEvent<TDataType>): void;\n\n /**\n * The row selection mode. Defaults to `'single'`. Use `'multiple'` for a page whose actions\n * operate on a set of rows - it adds per-row checkboxes and a select-all header checkbox, and\n * reports through {@link onSelectedItemsChange}.\n */\n selectionMode?: 'single' | 'multiple';\n\n /**\n * The currently selected rows, for `selectionMode='multiple'`. Leave undefined to let the page\n * own the selection.\n */\n selectedItems?: TDataType[];\n\n /**\n * Callback for when a multiple selection changes, with the full selected set.\n */\n onSelectedItemsChange?(items: TDataType[]): void;\n\n /**\n * Fields to use for global filtering\n */\n globalFilterFields?: string[] | undefined;\n\n /** Placeholder for the loaded-page search input. */\n globalSearchPlaceholder?: string;\n\n /** Accessible name for the loaded-page search input. */\n globalSearchAriaLabel?: string;\n\n /**\n * Default filters to use\n */\n defaultFilters?: DataTableFilterMeta;\n\n /**\n * @deprecated Filtering is always applied to the currently loaded page.\n * This compatibility prop no longer toggles behavior and does not change\n * server-reported pagination totals. Retained for source compatibility only.\n */\n clientFiltering?: boolean;\n\n /**\n * Opts the page's table into server mode: the query sorts, filters and searches the complete\n * result before paging, and the table renders the rows as returned. Leave undefined to sort,\n * filter and search the loaded page. See {@link DataTableServerQuery}.\n */\n serverQuery?: DataTableServerQuery<TArguments>;\n\n /** Optional callback forwarded to the details component as `onRefresh`; DataPage does not invoke it or refetch when it is called. */\n onRefresh?(): void;\n\n /**\n * Extra CSS class name forwarded to the inner DataTable root.\n */\n tableClassName?: string;\n\n /** Cratis-owned per-part attributes applied to the inner table. */\n tablePt?: DataTableParts;\n\n /**\n * @deprecated Cratis table parts always merge. Remove this renderer-era option.\n */\n tablePtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `tablePt` and CSS instead.\n */\n tableUnstyled?: boolean;\n\n /** Shows numbered page buttons in the query table paginator. Defaults to false. */\n pageLinks?: TablePaginatorProps['pageLinks'];\n\n /** Extra CSS class name forwarded to the query table paginator. */\n paginatorClassName?: string;\n\n /** Cratis-owned attributes applied to the query table paginator. */\n paginatorPt?: TablePaginatorParts;\n\n /**\n * @deprecated Cratis paginator parts always merge. Remove this renderer-era option.\n */\n paginatorPtOptions?: object;\n\n /** Accessible paginator labels. Override any value to localize it. */\n paginatorAriaLabels?: TablePaginatorProps['ariaLabels'];\n\n /**\n * Extra CSS class name forwarded to the action menubar root.\n */\n menubarClassName?: string;\n\n /** Cratis-owned part attributes applied to the action menubar's buttons. */\n menubarPt?: ButtonParts;\n\n /**\n * @deprecated Cratis menubar parts always merge. Remove this renderer-era option.\n */\n menubarPtOptions?: object;\n\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `menubarPt` and CSS instead.\n */\n menubarUnstyled?: boolean;\n\n /**\n * Accessible name for the action menubar (toolbar). Override to localize.\n * Defaults to `'Actions'`.\n */\n actionsAriaLabel?: string;\n}\n\n/**\n * A page primitive that combines an action menubar, a query-backed data\n * table, and an optional details pane into one layout. Designed as the\n * default rendering for \"list view\" pages in an Arc app.\n *\n * ## What `TQuery` is\n *\n * `TQuery` is the auto-generated TypeScript class produced by the Arc proxy\n * generator from a C# read model query. Two flavors are accepted and\n * **selected automatically at runtime** based on the class hierarchy:\n *\n * - **`IQueryFor<TDataType, TArguments>`** — a snapshot query. Re-fetched\n * when `queryArguments` change or when the page is mounted. Rendered\n * through {@link DataTableForQuery} internally.\n * - **`IObservableQueryFor<TDataType, TArguments>`** — a real-time\n * subscription. Connects to the backend over WebSocket and re-renders\n * automatically whenever the underlying read model changes server-side.\n * Rendered through {@link DataTableForObservableQuery} internally.\n *\n * You don't pick which inner table to use — `DataPage` inspects the\n * prototype chain (`context.query.prototype instanceof QueryFor`) and\n * mounts the correct one.\n *\n * ## Declarative composition\n *\n * Three children build up the page:\n *\n * - **`<DataPage.MenuItems>`** wraps `<DataPage.MenuItem>` elements that\n * become the action `Menubar` at the top. Each item declares its `icon`,\n * `label`, and `command` (an `onClick` handler). Items can be marked\n * `disableOnUnselected` so they automatically grey out until the user\n * picks a row — useful for Edit / Delete actions that need a target.\n *\n * - **`<DataPage.Columns>`** wraps Cratis-owned `<Column>` markers that\n * describe the visible columns. The columns themselves are\n * Cratis-owned — the documented `ColumnProps` surface is\n * supported here (sorting, filtering, custom body templates, …).\n *\n * - **`detailsComponent`** (optional) is a React component rendered in a\n * right-hand pane via Allotment when a row is selected. It receives the\n * selected item as `item` and the caller's `onRefresh` callback, if\n * supplied. DataPage does not refetch when the details component invokes it.\n *\n * ## Selection lifecycle\n *\n * `DataPage` keeps the current selection in local state and threads it to\n * the inner table, the menubar (`disableOnUnselected` items follow it),\n * and the optional details pane. The `onSelectionChange` prop is invoked\n * after every change if the consumer also needs to react to it.\n *\n * ```tsx\n * <DataPage<AllAuthors, Author, never>\n * title=\"Authors\"\n * query={AllAuthors} // proxy from C#\n * detailsComponent={AuthorDetails}>\n * <DataPage.MenuItems>\n * <DataPage.MenuItem icon={FaPlus} label=\"Add\" command={onAdd} />\n * <DataPage.MenuItem icon={FaPencil} label=\"Edit\" command={onEdit}\n * disableOnUnselected />\n * <DataPage.MenuItem icon={FaTrash} label=\"Delete\" command={onDelete}\n * disableOnUnselected />\n * </DataPage.MenuItems>\n * <DataPage.Columns>\n * <Column field=\"name\" header=\"Name\" sortable />\n * <Column field=\"email\" header=\"Email\" />\n * </DataPage.Columns>\n * </DataPage>\n * ```\n *\n * ## Height — `DataPage` needs a bounded ancestor\n *\n * `DataPage` fills the height it is given and divides it between the action\n * bar and the table region, so the table's paginator always sits at the\n * bottom of the page rather than below its edge. It cannot invent that height:\n * every element from the page root down sizes as a percentage of its parent,\n * so **some ancestor has to have a definite height**.\n *\n * ```tsx\n * // ✅ the router outlet, a sized container, or a flex child with min-height\n * <div style={{ height: '100vh' }}>\n * <DataPage … />\n * </div>\n *\n * // ❌ nothing above resolves to a height — the table grows to its content\n * <div>\n * <DataPage … />\n * </div>\n * ```\n *\n * Without one, the page falls back to a small fixed height so it stays\n * usable instead of collapsing to nothing.\n *\n * ## Styling\n *\n * The inner DataTable and action toolbar each have their own per-slot props:\n * `tablePt` / `tableUnstyled` / `tableClassName` for the table;\n * `paginatorPt` / `paginatorClassName` / `paginatorAriaLabels` for paging;\n * `menubarPt` / `menubarPtOptions` / `menubarUnstyled` / `menubarClassName` for\n * the action toolbar's stable button parts (the action bar is implemented as\n * a button toolbar, so `menubarPt` targets the stable Cratis button parts). See the\n * [pass-through cheat sheet](../../Documentation/Styling/pass-through.md) for\n * the full slot reference.\n *\n * @typeParam TQuery - The query class (proxy generated from a C# read model query).\n * @typeParam TDataType - The row type returned by the query.\n * @typeParam TArguments - The query's argument object type.\n * @param props - {@link DataPageProps}.\n */\nconst DataPage = <\n TQuery extends\n | IQueryFor<TDataType, TArguments>\n | IQueryFor<TDataType[], TArguments>\n | IObservableQueryFor<TDataType, TArguments>\n | IObservableQueryFor<TDataType[], TArguments>,\n TDataType extends object,\n TArguments extends object,\n>(\n props: DataPageProps<TQuery, TDataType, TArguments>,\n) => {\n const [internalSelection, setInternalSelection] = React.useState<\n TDataType | null | undefined\n >(props.selection);\n const selectedItem =\n props.selection === undefined ? internalSelection : props.selection;\n\n const selectionChanged = (event: DataTableSelectionChangeEvent<TDataType>) => {\n if (props.selection === undefined) setInternalSelection(event.value);\n props.onSelectionChange?.(event);\n };\n\n const [internalSelectedItems, setInternalSelectedItems] = React.useState<TDataType[]>(\n props.selectedItems ?? [],\n );\n const selectedItems = props.selectedItems ?? internalSelectedItems;\n\n const selectedItemsChanged = (items: TDataType[]) => {\n if (props.selectedItems === undefined) setInternalSelectedItems(items);\n props.onSelectedItemsChange?.(items);\n };\n\n // SAFETY: React context cannot retain this component's generic parameters. The\n // provider and every consumer are nested in the same DataPage invocation, so the\n // erased object-level context never crosses between differently typed pages.\n const context = {\n ...props,\n selectedItem,\n onSelectionChanged: selectionChanged,\n selectedItems,\n onSelectedItemsChange: selectedItemsChanged,\n } as unknown as IDataPageContext;\n\n return (\n <DataPageContext.Provider value={context}>\n <Page title={props.title} landmark={props.landmark} panel={true} style={pageStyle} data-cratis-component='DataPage'>\n {props.detailsComponent ? (\n <Allotment className='cratis:h-full' proportionalLayout={false}>\n <Allotment.Pane>\n <DataPageLayout>{props.children}</DataPageLayout>\n </Allotment.Pane>\n {selectedItem && (\n <Allotment.Pane preferredSize='450px'>\n <props.detailsComponent\n item={selectedItem}\n onRefresh={props.onRefresh}\n />\n </Allotment.Pane>\n )}\n </Allotment>\n ) : (\n <DataPageLayout>{props.children}</DataPageLayout>\n )}\n </Page>\n </DataPageContext.Provider>\n );\n};\n\nDataPage.MenuItem = MenuItem;\nDataPage.MenuItems = MenuItems;\nDataPage.Columns = Columns;\n\nexport { DataPage };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAyDO,MAAM,QAAQ,GAAG,CAAC,MAAqB,KAAI;AAC9C,IAAA,OAAO,IAAI;AACf;AAuBA,MAAM,YAAY,GAAkB,EAAE,UAAU,EAAE,CAAC,EAAE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