@cratis/components 4.24.0 → 4.25.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/Common/CratisComponentsProvider.d.ts +2 -0
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/ConfigurationEditor/ConfigurationDestination.d.ts +13 -0
- package/dist/esm/ConfigurationEditor/ConfigurationDestination.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationDestination.js +4 -0
- package/dist/esm/ConfigurationEditor/ConfigurationDestination.js.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditor.d.ts +27 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditor.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditor.js +13 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditor.js.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.d.ts +6 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.js +4 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.js.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.d.ts +28 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.js +16 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.js.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.d.ts +20 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.js +4 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.js.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.d.ts +5 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.js +4 -0
- package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.js.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationIconReference.d.ts +17 -0
- package/dist/esm/ConfigurationEditor/ConfigurationIconReference.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/ConfigurationIconReference.js +4 -0
- package/dist/esm/ConfigurationEditor/ConfigurationIconReference.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItem.d.ts +16 -0
- package/dist/esm/ConfigurationEditor/OrderedItem.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItem.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItem.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.d.ts +23 -0
- package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.d.ts +22 -0
- package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.js +23 -0
- package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.d.ts +74 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.js +188 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.d.ts +43 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemField.d.ts +3 -0
- package/dist/esm/ConfigurationEditor/OrderedItemField.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemField.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemField.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.d.ts +9 -0
- package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconField.d.ts +32 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconField.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconField.js +26 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconField.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.d.ts +26 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemLabels.d.ts +47 -0
- package/dist/esm/ConfigurationEditor/OrderedItemLabels.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemLabels.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemLabels.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemOperation.d.ts +3 -0
- package/dist/esm/ConfigurationEditor/OrderedItemOperation.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemOperation.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemOperation.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemProposal.d.ts +45 -0
- package/dist/esm/ConfigurationEditor/OrderedItemProposal.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemProposal.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemProposal.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRow.d.ts +5 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRow.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRow.js +59 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRow.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRowProps.d.ts +43 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRowProps.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRowProps.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemRowProps.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemValidation.d.ts +7 -0
- package/dist/esm/ConfigurationEditor/OrderedItemValidation.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemValidation.js +4 -0
- package/dist/esm/ConfigurationEditor/OrderedItemValidation.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyChangeProposal.d.ts +15 -0
- package/dist/esm/ConfigurationEditor/PropertyChangeProposal.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyChangeProposal.js +4 -0
- package/dist/esm/ConfigurationEditor/PropertyChangeProposal.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyChoice.d.ts +8 -0
- package/dist/esm/ConfigurationEditor/PropertyChoice.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyChoice.js +4 -0
- package/dist/esm/ConfigurationEditor/PropertyChoice.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControl.d.ts +17 -0
- package/dist/esm/ConfigurationEditor/PropertyControl.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControl.js +88 -0
- package/dist/esm/ConfigurationEditor/PropertyControl.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControls.d.ts +40 -0
- package/dist/esm/ConfigurationEditor/PropertyControls.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControls.js +41 -0
- package/dist/esm/ConfigurationEditor/PropertyControls.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsLabels.d.ts +18 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsLabels.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsLabels.js +4 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsLabels.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsParts.d.ts +31 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsParts.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsParts.js +4 -0
- package/dist/esm/ConfigurationEditor/PropertyControlsParts.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyDescriptor.d.ts +55 -0
- package/dist/esm/ConfigurationEditor/PropertyDescriptor.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyDescriptor.js +4 -0
- package/dist/esm/ConfigurationEditor/PropertyDescriptor.js.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyGroup.d.ts +16 -0
- package/dist/esm/ConfigurationEditor/PropertyGroup.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/PropertyGroup.js +4 -0
- package/dist/esm/ConfigurationEditor/PropertyGroup.js.map +1 -0
- package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.d.ts +4 -0
- package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.js +25 -0
- package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.js.map +1 -0
- package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.d.ts +4 -0
- package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.js +12 -0
- package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.js.map +1 -0
- package/dist/esm/ConfigurationEditor/index.d.ts +32 -0
- package/dist/esm/ConfigurationEditor/index.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/index.js +7 -0
- package/dist/esm/ConfigurationEditor/index.js.map +1 -0
- package/dist/esm/ConfigurationEditor/moveOrderedItem.d.ts +5 -0
- package/dist/esm/ConfigurationEditor/moveOrderedItem.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/moveOrderedItem.js +9 -0
- package/dist/esm/ConfigurationEditor/moveOrderedItem.js.map +1 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.d.ts +10 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.js +7 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.js.map +1 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.d.ts +6 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.js +4 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.js.map +1 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.d.ts +4 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.js +13 -0
- package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.js.map +1 -0
- package/dist/esm/ConfigurationEditor/validateOrderedItem.d.ts +18 -0
- package/dist/esm/ConfigurationEditor/validateOrderedItem.d.ts.map +1 -0
- package/dist/esm/ConfigurationEditor/validateOrderedItem.js +21 -0
- package/dist/esm/ConfigurationEditor/validateOrderedItem.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarButton.d.ts +4 -1
- package/dist/esm/Toolbar/ToolbarButton.d.ts.map +1 -1
- package/dist/esm/Toolbar/ToolbarButton.js +12 -2
- package/dist/esm/Toolbar/ToolbarButton.js.map +1 -1
- package/dist/esm/Toolbar/ToolbarDrawerContext.d.ts +13 -0
- package/dist/esm/Toolbar/ToolbarDrawerContext.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerContext.js +7 -0
- package/dist/esm/Toolbar/ToolbarDrawerContext.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerItem.d.ts +23 -0
- package/dist/esm/Toolbar/ToolbarDrawerItem.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerItem.js +4 -0
- package/dist/esm/Toolbar/ToolbarDrawerItem.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerPlacement.d.ts +57 -0
- package/dist/esm/Toolbar/ToolbarDrawerPlacement.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerPlacement.js +51 -0
- package/dist/esm/Toolbar/ToolbarDrawerPlacement.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerTile.d.ts +43 -0
- package/dist/esm/Toolbar/ToolbarDrawerTile.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarDrawerTile.js +31 -0
- package/dist/esm/Toolbar/ToolbarDrawerTile.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarFolder.d.ts +51 -5
- package/dist/esm/Toolbar/ToolbarFolder.d.ts.map +1 -1
- package/dist/esm/Toolbar/ToolbarFolder.js +109 -10
- package/dist/esm/Toolbar/ToolbarFolder.js.map +1 -1
- package/dist/esm/Toolbar/ToolbarFolderPresentation.d.ts +8 -0
- package/dist/esm/Toolbar/ToolbarFolderPresentation.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarFolderPresentation.js +4 -0
- package/dist/esm/Toolbar/ToolbarFolderPresentation.js.map +1 -0
- package/dist/esm/Toolbar/index.d.ts +2 -0
- package/dist/esm/Toolbar/index.d.ts.map +1 -1
- package/dist/esm/configuration/CratisComponentsDefaults.d.ts.map +1 -1
- package/dist/esm/configuration/CratisComponentsDefaults.js +1 -0
- package/dist/esm/configuration/CratisComponentsDefaults.js.map +1 -1
- package/dist/esm/styles.ConfigurationEditor.css +710 -0
- package/dist/esm/styles.IconPicker.css +5 -0
- package/dist/esm/styles.Toolbar.css +174 -0
- package/dist/esm/styles.css +425 -0
- package/dist/esm/types/parts.d.ts +41 -1
- package/dist/esm/types/parts.d.ts.map +1 -1
- package/dist/esm/types/parts.js +41 -1
- package/dist/esm/types/parts.js.map +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OrderedItem } from './OrderedItem.js';
|
|
2
|
+
import type { OrderedItemCapabilities } from './OrderedItemCapabilities.js';
|
|
3
|
+
import type { OrderedItemLabels } from './OrderedItemLabels.js';
|
|
4
|
+
import type { OrderedItemValidation } from './OrderedItemValidation.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validates an item as it would be after a change: first the rules the editor owns, then the host's.
|
|
7
|
+
* The result is empty when the item is valid.
|
|
8
|
+
*
|
|
9
|
+
* @param item The item as it would be.
|
|
10
|
+
* @param items The collection as it would be.
|
|
11
|
+
* @param capabilities What the host allows.
|
|
12
|
+
* @param labels The strings to report with.
|
|
13
|
+
* @param validate The host's rules, if any.
|
|
14
|
+
*/
|
|
15
|
+
export declare const validateOrderedItem: <TItem extends OrderedItem>(item: TItem, items: ReadonlyArray<TItem>, capabilities: OrderedItemCapabilities, labels: Required<OrderedItemLabels>, validate?: (item: TItem, items: ReadonlyArray<TItem>) => OrderedItemValidation | undefined) => OrderedItemValidation;
|
|
16
|
+
/** Whether a validation result holds any message. */
|
|
17
|
+
export declare const hasOrderedItemValidation: (validation: OrderedItemValidation | undefined) => boolean;
|
|
18
|
+
//# sourceMappingURL=validateOrderedItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateOrderedItem.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/validateOrderedItem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AACjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAAyB,CAAC;AAGrE;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,SAAS,WAAW,QACnD,KAAK,SACJ,aAAa,CAAC,KAAK,CAAC,gBACb,uBAAuB,UAC7B,QAAQ,CAAC,iBAAiB,CAAC,aACxB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,qBAAqB,GAAG,SAAS,KAC3F,qBAcF,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,wBAAwB,eAAgB,qBAAqB,GAAG,SAAS,KAAG,OACqC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { resolveOrderedItemFieldAccess } from './resolveOrderedItemFieldAccess.js';
|
|
2
|
+
|
|
3
|
+
const validateOrderedItem = (item, items, capabilities, labels, validate) => {
|
|
4
|
+
const messages = {};
|
|
5
|
+
if (resolveOrderedItemFieldAccess(capabilities, 'label') === 'editable' && item.label.trim().length === 0) {
|
|
6
|
+
messages.label = labels.labelRequired;
|
|
7
|
+
}
|
|
8
|
+
const supplied = validate?.(item, items);
|
|
9
|
+
if (supplied) {
|
|
10
|
+
for (const [key, message] of Object.entries(supplied)) {
|
|
11
|
+
if (typeof message === 'string' && message.length > 0 && messages[key] === undefined) {
|
|
12
|
+
messages[key] = message;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return messages;
|
|
17
|
+
};
|
|
18
|
+
const hasOrderedItemValidation = (validation) => validation !== undefined && Object.values(validation).some((message) => typeof message === 'string' && message.length > 0);
|
|
19
|
+
|
|
20
|
+
export { hasOrderedItemValidation, validateOrderedItem };
|
|
21
|
+
//# sourceMappingURL=validateOrderedItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateOrderedItem.js","sources":["../../../ConfigurationEditor/validateOrderedItem.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 { OrderedItem } from './OrderedItem';\nimport type { OrderedItemCapabilities } from './OrderedItemCapabilities';\nimport type { OrderedItemLabels } from './OrderedItemLabels';\nimport type { OrderedItemValidation } from './OrderedItemValidation';\nimport { resolveOrderedItemFieldAccess } from './resolveOrderedItemFieldAccess';\n\n/**\n * Validates an item as it would be after a change: first the rules the editor owns, then the host's.\n * The result is empty when the item is valid.\n *\n * @param item The item as it would be.\n * @param items The collection as it would be.\n * @param capabilities What the host allows.\n * @param labels The strings to report with.\n * @param validate The host's rules, if any.\n */\nexport const validateOrderedItem = <TItem extends OrderedItem>(\n item: TItem,\n items: ReadonlyArray<TItem>,\n capabilities: OrderedItemCapabilities,\n labels: Required<OrderedItemLabels>,\n validate?: (item: TItem, items: ReadonlyArray<TItem>) => OrderedItemValidation | undefined,\n): OrderedItemValidation => {\n const messages: OrderedItemValidation = {};\n if (resolveOrderedItemFieldAccess(capabilities, 'label') === 'editable' && item.label.trim().length === 0) {\n messages.label = labels.labelRequired;\n }\n const supplied = validate?.(item, items);\n if (supplied) {\n for (const [key, message] of Object.entries(supplied)) {\n if (typeof message === 'string' && message.length > 0 && messages[key as keyof OrderedItemValidation] === undefined) {\n messages[key as keyof OrderedItemValidation] = message;\n }\n }\n }\n return messages;\n};\n\n/** Whether a validation result holds any message. */\nexport const hasOrderedItemValidation = (validation: OrderedItemValidation | undefined): boolean =>\n validation !== undefined && Object.values(validation).some((message) => typeof message === 'string' && message.length > 0);\n"],"names":[],"mappings":";;AAmBO,MAAM,mBAAmB,GAAG,CAC/B,IAAW,EACX,KAA2B,EAC3B,YAAqC,EACrC,MAAmC,EACnC,QAA0F,KACnE;IACvB,MAAM,QAAQ,GAA0B,EAAE;IAC1C,IAAI,6BAA6B,CAAC,YAAY,EAAE,OAAO,CAAC,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AACvG,QAAA,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,aAAa;IACzC;IACA,MAAM,QAAQ,GAAG,QAAQ,GAAG,IAAI,EAAE,KAAK,CAAC;IACxC,IAAI,QAAQ,EAAE;AACV,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AACnD,YAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAkC,CAAC,KAAK,SAAS,EAAE;AACjH,gBAAA,QAAQ,CAAC,GAAkC,CAAC,GAAG,OAAO;YAC1D;QACJ;IACJ;AACA,IAAA,OAAO,QAAQ;AACnB;AAGO,MAAM,wBAAwB,GAAG,CAAC,UAA6C,KAClF,UAAU,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;;"}
|
|
@@ -48,6 +48,9 @@ export interface ToolbarButtonProps {
|
|
|
48
48
|
/**
|
|
49
49
|
* An icon button with a tooltip, intended to be placed inside a {@link Toolbar}.
|
|
50
50
|
* Uses the shared {@link Tooltip} component for consistent hover labels.
|
|
51
|
+
*
|
|
52
|
+
* Inside a drawer {@link ToolbarFolder} the button renders as a labeled tile instead, with its
|
|
53
|
+
* `title` always visible, so a drawer can be composed from children as well as from `items`.
|
|
51
54
|
*/
|
|
52
|
-
export declare const ToolbarButton: (
|
|
55
|
+
export declare const ToolbarButton: (props: ToolbarButtonProps) => import("react").JSX.Element;
|
|
53
56
|
//# sourceMappingURL=ToolbarButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarButton.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,oBAAoB,EACpB,cAAc,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarButton.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,oBAAoB,EACpB,cAAc,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAQzD,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IAC/B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAC/C,oBAAoB;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IACvC,gCAAgC;IAChC,KAAK,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IAC/B,2FAA2F;IAC3F,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,2GAA2G;IAC3G,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;IAEd,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,yEAAyE;IACzE,eAAe,CAAC,EAAE,eAAe,CAAC;IAElC,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qCAAqC;IACrC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACpF;AAuHD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,UAAW,kBAAkB,gCAuBtD,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { IconDisplay } from '../Common/Icon.js';
|
|
3
3
|
import { Tooltip } from '../Common/Tooltip.js';
|
|
4
4
|
import { useToolbarDragContext } from './ToolbarDragContext.js';
|
|
5
|
+
import { useToolbarDrawer } from './ToolbarDrawerContext.js';
|
|
6
|
+
import { ToolbarDrawerTile } from './ToolbarDrawerTile.js';
|
|
5
7
|
import { useToolbarFolderMode } from './ToolbarFolderContext.js';
|
|
6
8
|
import { useToolbarItemVisibility } from './ToolbarItemVisibilityContext.js';
|
|
7
9
|
import { useRovingTool } from '../Common/ToolbarRovingContext.js';
|
|
8
10
|
|
|
9
|
-
const
|
|
11
|
+
const ToolbarButtonContent = ({ icon, text, title, active, onClick, tooltipPosition = 'right', draggable, data, onDragStart, className, pt, }) => {
|
|
10
12
|
const dragContext = useToolbarDragContext();
|
|
11
13
|
const folderMode = useToolbarFolderMode();
|
|
12
14
|
const isToolbarItemVisible = useToolbarItemVisibility();
|
|
@@ -30,6 +32,14 @@ const ToolbarButton = ({ icon, text, title, active, onClick, tooltipPosition = '
|
|
|
30
32
|
const buttonContent = hasText ? (jsx("span", { ...pt?.label, className: `toolbar-button__text ${pt?.label?.className ?? ''}`, "data-cratis-part": 'label', children: text })) : resolvedIcon === null ? null : (jsx("span", { ...pt?.icon, className: pt?.icon?.className, "data-cratis-part": 'icon', children: jsx(IconDisplay, { icon: resolvedIcon, className: 'cratis:text-lg' }) }));
|
|
31
33
|
return (jsx(Tooltip, { content: title, position: tooltipPosition, disabled: !isToolbarItemVisible, children: jsx("button", { "aria-pressed": active, ...pt?.root, ...rovingTool, type: 'button', "aria-label": title, onClick: onClick, draggable: isDraggable, onDragStart: isDraggable ? handleDragStart : undefined, className: `toolbar-button ${buttonSizeClass} cratis:flex cratis:items-center cratis:justify-center cratis:rounded-lg cratis:cursor-pointer ${activeClass} ${draggableClass} ${pt?.root?.className ?? ''} ${className ?? ''}`, "data-cratis-part": 'button', "data-active": active || undefined, "data-selected": active || undefined, children: buttonContent }) }));
|
|
32
34
|
};
|
|
35
|
+
const ToolbarButton = (props) => {
|
|
36
|
+
const drawer = useToolbarDrawer();
|
|
37
|
+
const dragContext = useToolbarDragContext();
|
|
38
|
+
if (drawer === null) {
|
|
39
|
+
return jsx(ToolbarButtonContent, { ...props });
|
|
40
|
+
}
|
|
41
|
+
return (jsx(ToolbarDrawerTile, { title: props.title, icon: props.icon, active: props.active, draggable: props.draggable ?? dragContext.draggable, data: props.data, onClick: props.onClick, onDragStart: props.onDragStart, className: props.className, root: props.pt?.root, iconPart: props.pt?.icon, label: props.pt?.label }));
|
|
42
|
+
};
|
|
33
43
|
|
|
34
44
|
export { ToolbarButton };
|
|
35
45
|
//# sourceMappingURL=ToolbarButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.js","sources":["../../../Toolbar/ToolbarButton.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 HTMLAttributes,\n} from 'react';\nimport { IconDisplay } from '../Common/Icon';\nimport type { Icon } from '../Common/Icon';\nimport { Tooltip } from '../Common/Tooltip';\nimport type { TooltipPosition } from '../Common/Tooltip';\nimport { useToolbarDragContext } from './ToolbarDragContext';\nimport { useToolbarFolderMode } from './ToolbarFolderContext';\nimport { useToolbarItemVisibility } from './ToolbarItemVisibilityContext';\nimport { useRovingTool } from '../Common/ToolbarRovingContext';\n\n/** Stable part attributes for {@link ToolbarButton}. */\nexport interface ToolbarButtonParts {\n /** Native button root. */\n root?: ButtonHTMLAttributes<HTMLButtonElement>;\n /** Icon wrapper. */\n icon?: HTMLAttributes<HTMLSpanElement>;\n /** Text/title label wrapper. */\n label?: HTMLAttributes<HTMLSpanElement>;\n}\n\n/** Props for the {@link ToolbarButton} component. */\nexport interface ToolbarButtonProps {\n /** React icon node or consumer-owned icon-font class. Components installs no icon font. */\n icon?: Icon;\n\n /** Optional text-first content (for example `120%`); when non-empty it renders instead of {@link icon}. */\n text?: string;\n\n /** Title text shown when the user hovers over the button. */\n title: string;\n\n /** Whether the button is currently in the active/selected state. */\n active?: boolean;\n\n /** Callback invoked when the button is clicked. */\n onClick?: () => void;\n\n /** Position of the tooltip relative to the button (default: 'right'). */\n tooltipPosition?: TooltipPosition;\n\n /** Extra class name for the native button. */\n className?: string;\n\n /** Stable button part attributes. */\n pt?: ToolbarButtonParts;\n\n /**\n * Whether this button can be dragged onto a surface.\n * When omitted the value is inherited from the parent {@link Toolbar}'s `draggable` prop.\n */\n draggable?: boolean;\n\n /**\n * Optional data associated with this button for identification during drag & drop.\n * The value is passed to {@link onDragStart} and serialised onto the HTML5\n * `DataTransfer` object as `application/json` so drop targets can read it.\n */\n data?: unknown;\n\n /**\n * Callback invoked when a drag operation starts on this button.\n * Receives the button's {@link data} and the originating drag event.\n */\n onDragStart?: (data: unknown, event: React.DragEvent<HTMLButtonElement>) => void;\n}\n\n/**\n * An icon button with a tooltip, intended to be placed inside a {@link Toolbar}.\n * Uses the shared {@link Tooltip} component for consistent hover labels.\n */\nexport const ToolbarButton = ({\n icon,\n text,\n title,\n active,\n onClick,\n tooltipPosition = 'right',\n draggable,\n data,\n onDragStart,\n className,\n pt,\n}: ToolbarButtonProps) => {\n const dragContext = useToolbarDragContext();\n const folderMode = useToolbarFolderMode();\n const isToolbarItemVisible = useToolbarItemVisibility();\n const rovingTool = useRovingTool<HTMLButtonElement>(pt?.root?.tabIndex, pt?.root?.onFocus);\n const isListMode = folderMode === 'list';\n const isDraggable = draggable ?? dragContext.draggable;\n\n const handleDragStart = (event: React.DragEvent<HTMLButtonElement>) => {\n event.dataTransfer.setData('application/json', JSON.stringify(data ?? null));\n event.dataTransfer.effectAllowed = 'copy';\n onDragStart?.(data, event);\n dragContext.onItemDragStart?.(data, event);\n };\n\n const activeClass = active ? 'toolbar-button--active' : '';\n const draggableClass = isDraggable ? 'toolbar-button--draggable' : '';\n const hasText = typeof text === 'string' && text.length > 0;\n const resolvedIcon = icon !== undefined && icon !== null && (typeof icon !== 'string' || icon.length > 0) ? icon : null;\n\n // List mode: icon + title label rendered side by side (no floating tooltip needed).\n if (isListMode) {\n return (\n <button\n aria-pressed={active}\n {...pt?.root}\n {...rovingTool}\n type='button'\n aria-label={title}\n onClick={onClick}\n draggable={isDraggable}\n onDragStart={isDraggable ? handleDragStart : undefined}\n className={`toolbar-button toolbar-button--list cratis:h-10 cratis:px-3 cratis:w-full cratis:flex cratis:items-center cratis:justify-start cratis:gap-2 cratis:rounded-lg cratis:cursor-pointer ${activeClass} ${draggableClass} ${pt?.root?.className ?? ''} ${className ?? ''}`}\n data-cratis-part='button'\n data-active={active || undefined}\n data-selected={active || undefined}\n >\n {resolvedIcon !== null && (\n <span\n {...pt?.icon}\n className={pt?.icon?.className}\n data-cratis-part='icon'\n >\n <IconDisplay\n icon={resolvedIcon}\n className='cratis:text-lg cratis:flex-shrink-0'\n />\n </span>\n )}\n <span\n {...pt?.label}\n className={`toolbar-button__label ${pt?.label?.className ?? ''}`}\n data-cratis-part='label'\n >\n {title}\n </span>\n </button>\n );\n }\n\n const buttonSizeClass = hasText ? 'cratis:h-10 cratis:px-3 cratis:min-w-[4rem]' : 'cratis:w-10 cratis:h-10';\n const buttonContent = hasText ? (\n <span\n {...pt?.label}\n className={`toolbar-button__text ${pt?.label?.className ?? ''}`}\n data-cratis-part='label'\n >\n {text}\n </span>\n ) : resolvedIcon === null ? null : (\n <span\n {...pt?.icon}\n className={pt?.icon?.className}\n data-cratis-part='icon'\n >\n <IconDisplay icon={resolvedIcon} className='cratis:text-lg' />\n </span>\n );\n\n return (\n <Tooltip\n content={title}\n position={tooltipPosition}\n disabled={!isToolbarItemVisible}\n >\n <button\n aria-pressed={active}\n {...pt?.root}\n {...rovingTool}\n type='button'\n aria-label={title}\n onClick={onClick}\n draggable={isDraggable}\n onDragStart={isDraggable ? handleDragStart : undefined}\n className={`toolbar-button ${buttonSizeClass} cratis:flex cratis:items-center cratis:justify-center cratis:rounded-lg cratis:cursor-pointer ${activeClass} ${draggableClass} ${pt?.root?.className ?? ''} ${className ?? ''}`}\n data-cratis-part='button'\n data-active={active || undefined}\n data-selected={active || undefined}\n >\n {buttonContent}\n </button>\n </Tooltip>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AA4EO,MAAM,aAAa,GAAG,CAAC,EAC1B,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,eAAe,GAAG,OAAO,EACzB,SAAS,EACT,IAAI,EACJ,WAAW,EACX,SAAS,EACT,EAAE,GACe,KAAI;AACrB,IAAA,MAAM,WAAW,GAAG,qBAAqB,EAAE;AAC3C,IAAA,MAAM,UAAU,GAAG,oBAAoB,EAAE;AACzC,IAAA,MAAM,oBAAoB,GAAG,wBAAwB,EAAE;AACvD,IAAA,MAAM,UAAU,GAAG,aAAa,CAAoB,EAAE,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AA,EAEvBA,GAAA,CAAC,WAAW,IAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAC,gBAAgB,EAAA,CAAG,EAAA,CAC3D,CACV;AAED,IAAA,QACIA,GAAA,CAAC,OAAO,IACJ,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,CAAC,oBAAoB,EAAA,QAAA,EAE/BA,GAAA,CAAA,QAAA,EAAA,EAAA,cAAA,EACkB,MAAM,EAAA,GAChB,EAAE,EAAE,IAAI,KACR,UAAU,EACd,IAAI,EAAC,QAAQ,gBACD,KAAK,EACjB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,EACtB,WAAW,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,EACtD,SAAS,EAAE,CAAA,eAAA,EAAkB,eAAe,CAAA,+FAAA,EAAkG,WAAW,IAAI,cAAc,CAAA,CAAA,EAAI,EAAE,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE,CAAA,CAAA,EAAI,SAAS,IAAI,EAAE,EAAE,EAAA,kBAAA,EAC5M,QAAQ,iBACZ,MAAM,IAAI,SAAS,EAAA,eAAA,EACjB,MAAM,IAAI,SAAS,EAAA,QAAA,EAEjC,aAAa,EAAA,CACT,EAAA,CACH;AAElB;;"}
|
|
1
|
+
{"version":3,"file":"ToolbarButton.js","sources":["../../../Toolbar/ToolbarButton.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 HTMLAttributes,\n} from 'react';\nimport { IconDisplay } from '../Common/Icon';\nimport type { Icon } from '../Common/Icon';\nimport { Tooltip } from '../Common/Tooltip';\nimport type { TooltipPosition } from '../Common/Tooltip';\nimport { useToolbarDragContext } from './ToolbarDragContext';\nimport { useToolbarDrawer } from './ToolbarDrawerContext';\nimport { ToolbarDrawerTile } from './ToolbarDrawerTile';\nimport { useToolbarFolderMode } from './ToolbarFolderContext';\nimport { useToolbarItemVisibility } from './ToolbarItemVisibilityContext';\nimport { useRovingTool } from '../Common/ToolbarRovingContext';\n\n/** Stable part attributes for {@link ToolbarButton}. */\nexport interface ToolbarButtonParts {\n /** Native button root. */\n root?: ButtonHTMLAttributes<HTMLButtonElement>;\n /** Icon wrapper. */\n icon?: HTMLAttributes<HTMLSpanElement>;\n /** Text/title label wrapper. */\n label?: HTMLAttributes<HTMLSpanElement>;\n}\n\n/** Props for the {@link ToolbarButton} component. */\nexport interface ToolbarButtonProps {\n /** React icon node or consumer-owned icon-font class. Components installs no icon font. */\n icon?: Icon;\n\n /** Optional text-first content (for example `120%`); when non-empty it renders instead of {@link icon}. */\n text?: string;\n\n /** Title text shown when the user hovers over the button. */\n title: string;\n\n /** Whether the button is currently in the active/selected state. */\n active?: boolean;\n\n /** Callback invoked when the button is clicked. */\n onClick?: () => void;\n\n /** Position of the tooltip relative to the button (default: 'right'). */\n tooltipPosition?: TooltipPosition;\n\n /** Extra class name for the native button. */\n className?: string;\n\n /** Stable button part attributes. */\n pt?: ToolbarButtonParts;\n\n /**\n * Whether this button can be dragged onto a surface.\n * When omitted the value is inherited from the parent {@link Toolbar}'s `draggable` prop.\n */\n draggable?: boolean;\n\n /**\n * Optional data associated with this button for identification during drag & drop.\n * The value is passed to {@link onDragStart} and serialised onto the HTML5\n * `DataTransfer` object as `application/json` so drop targets can read it.\n */\n data?: unknown;\n\n /**\n * Callback invoked when a drag operation starts on this button.\n * Receives the button's {@link data} and the originating drag event.\n */\n onDragStart?: (data: unknown, event: React.DragEvent<HTMLButtonElement>) => void;\n}\n\nconst ToolbarButtonContent = ({\n icon,\n text,\n title,\n active,\n onClick,\n tooltipPosition = 'right',\n draggable,\n data,\n onDragStart,\n className,\n pt,\n}: ToolbarButtonProps) => {\n const dragContext = useToolbarDragContext();\n const folderMode = useToolbarFolderMode();\n const isToolbarItemVisible = useToolbarItemVisibility();\n const rovingTool = useRovingTool<HTMLButtonElement>(pt?.root?.tabIndex, pt?.root?.onFocus);\n const isListMode = folderMode === 'list';\n const isDraggable = draggable ?? dragContext.draggable;\n\n const handleDragStart = (event: React.DragEvent<HTMLButtonElement>) => {\n event.dataTransfer.setData('application/json', JSON.stringify(data ?? null));\n event.dataTransfer.effectAllowed = 'copy';\n onDragStart?.(data, event);\n dragContext.onItemDragStart?.(data, event);\n };\n\n const activeClass = active ? 'toolbar-button--active' : '';\n const draggableClass = isDraggable ? 'toolbar-button--draggable' : '';\n const hasText = typeof text === 'string' && text.length > 0;\n const resolvedIcon = icon !== undefined && icon !== null && (typeof icon !== 'string' || icon.length > 0) ? icon : null;\n\n // List mode: icon + title label rendered side by side (no floating tooltip needed).\n if (isListMode) {\n return (\n <button\n aria-pressed={active}\n {...pt?.root}\n {...rovingTool}\n type='button'\n aria-label={title}\n onClick={onClick}\n draggable={isDraggable}\n onDragStart={isDraggable ? handleDragStart : undefined}\n className={`toolbar-button toolbar-button--list cratis:h-10 cratis:px-3 cratis:w-full cratis:flex cratis:items-center cratis:justify-start cratis:gap-2 cratis:rounded-lg cratis:cursor-pointer ${activeClass} ${draggableClass} ${pt?.root?.className ?? ''} ${className ?? ''}`}\n data-cratis-part='button'\n data-active={active || undefined}\n data-selected={active || undefined}\n >\n {resolvedIcon !== null && (\n <span\n {...pt?.icon}\n className={pt?.icon?.className}\n data-cratis-part='icon'\n >\n <IconDisplay\n icon={resolvedIcon}\n className='cratis:text-lg cratis:flex-shrink-0'\n />\n </span>\n )}\n <span\n {...pt?.label}\n className={`toolbar-button__label ${pt?.label?.className ?? ''}`}\n data-cratis-part='label'\n >\n {title}\n </span>\n </button>\n );\n }\n\n const buttonSizeClass = hasText ? 'cratis:h-10 cratis:px-3 cratis:min-w-[4rem]' : 'cratis:w-10 cratis:h-10';\n const buttonContent = hasText ? (\n <span\n {...pt?.label}\n className={`toolbar-button__text ${pt?.label?.className ?? ''}`}\n data-cratis-part='label'\n >\n {text}\n </span>\n ) : resolvedIcon === null ? null : (\n <span\n {...pt?.icon}\n className={pt?.icon?.className}\n data-cratis-part='icon'\n >\n <IconDisplay icon={resolvedIcon} className='cratis:text-lg' />\n </span>\n );\n\n return (\n <Tooltip\n content={title}\n position={tooltipPosition}\n disabled={!isToolbarItemVisible}\n >\n <button\n aria-pressed={active}\n {...pt?.root}\n {...rovingTool}\n type='button'\n aria-label={title}\n onClick={onClick}\n draggable={isDraggable}\n onDragStart={isDraggable ? handleDragStart : undefined}\n className={`toolbar-button ${buttonSizeClass} cratis:flex cratis:items-center cratis:justify-center cratis:rounded-lg cratis:cursor-pointer ${activeClass} ${draggableClass} ${pt?.root?.className ?? ''} ${className ?? ''}`}\n data-cratis-part='button'\n data-active={active || undefined}\n data-selected={active || undefined}\n >\n {buttonContent}\n </button>\n </Tooltip>\n );\n};\n\n/**\n * An icon button with a tooltip, intended to be placed inside a {@link Toolbar}.\n * Uses the shared {@link Tooltip} component for consistent hover labels.\n *\n * Inside a drawer {@link ToolbarFolder} the button renders as a labeled tile instead, with its\n * `title` always visible, so a drawer can be composed from children as well as from `items`.\n */\nexport const ToolbarButton = (props: ToolbarButtonProps) => {\n const drawer = useToolbarDrawer();\n const dragContext = useToolbarDragContext();\n\n if (drawer === null) {\n return <ToolbarButtonContent {...props} />;\n }\n\n return (\n <ToolbarDrawerTile\n title={props.title}\n icon={props.icon}\n active={props.active}\n draggable={props.draggable ?? dragContext.draggable}\n data={props.data}\n onClick={props.onClick}\n onDragStart={props.onDragStart}\n className={props.className}\n root={props.pt?.root}\n iconPart={props.pt?.icon}\n label={props.pt?.label}\n />\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AA0EA,MAAM,oBAAoB,GAAG,CAAC,EAC1B,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,OAAO,EACP,eAAe,GAAG,OAAO,EACzB,SAAS,EACT,IAAI,EACJ,WAAW,EACX,SAAS,EACT,EAAE,GACe,KAAI;AACrB,IAAA,MAAM,WAAW,GAAG,qBAAqB,EAA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iB,EAAA,EACd,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,EACnD,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EACpB,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EACxB,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAA,CACxB;AAEV;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal context a drawer {@link ToolbarFolder} provides to the tiles inside it. Its presence is
|
|
3
|
+
* what makes a {@link ToolbarButton} render as a labeled tile instead of an icon-only cell.
|
|
4
|
+
*/
|
|
5
|
+
export interface ToolbarDrawerContextValue {
|
|
6
|
+
/** Reports that a tile drag started or ended, so the drawer can reflect the drag lifecycle. */
|
|
7
|
+
setDragging: (dragging: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
/** Context provided by a drawer {@link ToolbarFolder}; `null` everywhere else. */
|
|
10
|
+
export declare const ToolbarDrawerContext: import("react").Context<ToolbarDrawerContextValue | null>;
|
|
11
|
+
/** Returns the enclosing drawer, or `null` when the caller is not inside a drawer folder. */
|
|
12
|
+
export declare const useToolbarDrawer: () => ToolbarDrawerContextValue | null;
|
|
13
|
+
//# sourceMappingURL=ToolbarDrawerContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerContext.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarDrawerContext.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACtC,+FAA+F;IAC/F,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,2DAAwD,CAAC;AAE1F,6FAA6F;AAC7F,eAAO,MAAM,gBAAgB,QAAO,yBAAyB,GAAG,IAAwC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const ToolbarDrawerContext = createContext(null);
|
|
4
|
+
const useToolbarDrawer = () => useContext(ToolbarDrawerContext);
|
|
5
|
+
|
|
6
|
+
export { ToolbarDrawerContext, useToolbarDrawer };
|
|
7
|
+
//# sourceMappingURL=ToolbarDrawerContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerContext.js","sources":["../../../Toolbar/ToolbarDrawerContext.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 { createContext, useContext } from 'react';\n\n/**\n * Internal context a drawer {@link ToolbarFolder} provides to the tiles inside it. Its presence is\n * what makes a {@link ToolbarButton} render as a labeled tile instead of an icon-only cell.\n */\nexport interface ToolbarDrawerContextValue {\n /** Reports that a tile drag started or ended, so the drawer can reflect the drag lifecycle. */\n setDragging: (dragging: boolean) => void;\n}\n\n/** Context provided by a drawer {@link ToolbarFolder}; `null` everywhere else. */\nexport const ToolbarDrawerContext = createContext<ToolbarDrawerContextValue | null>(null);\n\n/** Returns the enclosing drawer, or `null` when the caller is not inside a drawer folder. */\nexport const useToolbarDrawer = (): ToolbarDrawerContextValue | null => useContext(ToolbarDrawerContext);\n"],"names":[],"mappings":";;MAea,oBAAoB,GAAG,aAAa,CAAmC,IAAI;AAGjF,MAAM,gBAAgB,GAAG,MAAwC,UAAU,CAAC,oBAAoB;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Icon } from '../Common/Icon.js';
|
|
2
|
+
/**
|
|
3
|
+
* One entry of a catalogue shown as a labeled tile inside a drawer {@link ToolbarFolder}.
|
|
4
|
+
*
|
|
5
|
+
* The drawer never interprets {@link payload}: the exact value supplied here is delivered unchanged
|
|
6
|
+
* to the consumer when the tile is activated and when it is dragged, so the consumer decides what
|
|
7
|
+
* the item means and where it is inserted.
|
|
8
|
+
*/
|
|
9
|
+
export interface ToolbarDrawerItem {
|
|
10
|
+
/** Stable identity of the item. Used as the React key and never derived from {@link title}. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Always-visible, localizable tile label. Also the tile's accessible name. */
|
|
13
|
+
title: string;
|
|
14
|
+
/** Icon shown above the label. */
|
|
15
|
+
icon: Icon;
|
|
16
|
+
/** Consumer-owned data delivered unchanged on activation and on drag. */
|
|
17
|
+
payload: unknown;
|
|
18
|
+
/** Whether the item is unavailable. A disabled tile stays focusable so its reason can be read. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Explanation shown as the tile description when {@link disabled}. */
|
|
21
|
+
disabledReason?: string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ToolbarDrawerItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerItem.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarDrawerItem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAgB,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B,+FAA+F;IAC/F,EAAE,EAAE,MAAM,CAAC;IAEX,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,IAAI,EAAE,IAAI,CAAC;IAEX,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IAEjB,kGAAkG;IAClG,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerItem.js","sourceRoot":"","sources":["../../../Toolbar/ToolbarDrawerItem.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","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 { Icon } from '../Common/Icon';\n\n/**\n * One entry of a catalogue shown as a labeled tile inside a drawer {@link ToolbarFolder}.\n *\n * The drawer never interprets {@link payload}: the exact value supplied here is delivered unchanged\n * to the consumer when the tile is activated and when it is dragged, so the consumer decides what\n * the item means and where it is inserted.\n */\nexport interface ToolbarDrawerItem {\n /** Stable identity of the item. Used as the React key and never derived from {@link title}. */\n id: string;\n\n /** Always-visible, localizable tile label. Also the tile's accessible name. */\n title: string;\n\n /** Icon shown above the label. */\n icon: Icon;\n\n /** Consumer-owned data delivered unchanged on activation and on drag. */\n payload: unknown;\n\n /** Whether the item is unavailable. A disabled tile stays focusable so its reason can be read. */\n disabled?: boolean;\n\n /** Explanation shown as the tile description when {@link disabled}. */\n disabledReason?: string;\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** Edges of an element, in viewport coordinates. */
|
|
2
|
+
export interface ToolbarDrawerRectangle {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
right: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
}
|
|
8
|
+
/** Inputs for {@link resolveToolbarDrawerPlacement}. */
|
|
9
|
+
export interface ToolbarDrawerPlacementRequest {
|
|
10
|
+
/** The folder trigger the drawer is anchored to. */
|
|
11
|
+
trigger: ToolbarDrawerRectangle;
|
|
12
|
+
/** Natural (unconstrained) size of the drawer. */
|
|
13
|
+
panel: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
/** Size of the viewport the drawer has to stay inside. */
|
|
18
|
+
viewport: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/** Orientation of the owning toolbar. */
|
|
23
|
+
orientation: 'vertical' | 'horizontal';
|
|
24
|
+
/** Preferred side for a vertical toolbar. A horizontal toolbar prefers `'bottom'`. */
|
|
25
|
+
preferredHorizontalSide: 'right' | 'left';
|
|
26
|
+
/** Space kept between the drawer and the trigger. */
|
|
27
|
+
gap: number;
|
|
28
|
+
/** Space kept between the drawer and the viewport edge. */
|
|
29
|
+
margin: number;
|
|
30
|
+
}
|
|
31
|
+
/** Where a drawer ends up relative to its trigger. */
|
|
32
|
+
export interface ToolbarDrawerPlacement {
|
|
33
|
+
/** The side of the trigger the drawer opens towards. */
|
|
34
|
+
side: 'right' | 'left' | 'top' | 'bottom';
|
|
35
|
+
/** Offset along the cross axis that keeps the drawer inside the viewport. */
|
|
36
|
+
shift: number;
|
|
37
|
+
/**
|
|
38
|
+
* Offset along the opening axis, towards the trigger. Non-zero only when the drawer fits on
|
|
39
|
+
* neither side, so it overlaps the toolbar rather than leaving the viewport.
|
|
40
|
+
*/
|
|
41
|
+
mainShift: number;
|
|
42
|
+
/** Largest height the drawer may take before it scrolls. */
|
|
43
|
+
maxHeight: number;
|
|
44
|
+
/** Largest width the drawer may take. */
|
|
45
|
+
maxWidth: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decides which side of its trigger a drawer opens towards and how far it has to move along the
|
|
49
|
+
* cross axis to stay inside the viewport.
|
|
50
|
+
*
|
|
51
|
+
* A drawer first tries its preferred side, flips to the opposite side when it does not fit there
|
|
52
|
+
* and the opposite side offers more room, and finally slides along the cross axis. When it fits on
|
|
53
|
+
* neither side it moves back over the toolbar instead of leaving the viewport. When the drawer is
|
|
54
|
+
* larger than the viewport allows, `maxHeight` and `maxWidth` bound it so its content scrolls.
|
|
55
|
+
*/
|
|
56
|
+
export declare const resolveToolbarDrawerPlacement: (request: ToolbarDrawerPlacementRequest) => ToolbarDrawerPlacement;
|
|
57
|
+
//# sourceMappingURL=ToolbarDrawerPlacement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerPlacement.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarDrawerPlacement.ts"],"names":[],"mappings":"AAGA,oDAAoD;AACpD,MAAM,WAAW,sBAAsB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,wDAAwD;AACxD,MAAM,WAAW,6BAA6B;IAC1C,oDAAoD;IACpD,OAAO,EAAE,sBAAsB,CAAC;IAChC,kDAAkD;IAClD,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,0DAA0D;IAC1D,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,yCAAyC;IACzC,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,sFAAsF;IACtF,uBAAuB,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1C,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,sDAAsD;AACtD,MAAM,WAAW,sBAAsB;IACnC,wDAAwD;IACxD,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC1C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;CACpB;AASD;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,YAAa,6BAA6B,KAAG,sBA2CtF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const clampShift = (start, size, limit, margin) => {
|
|
2
|
+
const minimumStart = margin;
|
|
3
|
+
const maximumStart = Math.max(minimumStart, limit - margin - size);
|
|
4
|
+
const clamped = Math.min(Math.max(start, minimumStart), maximumStart);
|
|
5
|
+
return clamped - start;
|
|
6
|
+
};
|
|
7
|
+
const resolveToolbarDrawerPlacement = (request) => {
|
|
8
|
+
const { trigger, panel, viewport, orientation, preferredHorizontalSide, gap, margin } = request;
|
|
9
|
+
const maxHeight = Math.max(0, viewport.height - margin * 2);
|
|
10
|
+
const maxWidth = Math.max(0, viewport.width - margin * 2);
|
|
11
|
+
const panelWidth = Math.min(panel.width, maxWidth);
|
|
12
|
+
const panelHeight = Math.min(panel.height, maxHeight);
|
|
13
|
+
if (orientation === 'horizontal') {
|
|
14
|
+
const roomBelow = viewport.height - margin - trigger.bottom - gap;
|
|
15
|
+
const roomAbove = trigger.top - margin - gap;
|
|
16
|
+
const fitsBelow = roomBelow >= panelHeight;
|
|
17
|
+
const fitsAbove = roomAbove >= panelHeight;
|
|
18
|
+
const side = fitsBelow || (!fitsAbove && roomBelow >= roomAbove) ? 'bottom' : 'top';
|
|
19
|
+
const centered = (trigger.left + trigger.right) / 2 - panelWidth / 2;
|
|
20
|
+
const overflow = Math.max(0, panelHeight - (side === 'bottom' ? roomBelow : roomAbove));
|
|
21
|
+
return {
|
|
22
|
+
side,
|
|
23
|
+
shift: clampShift(centered, panelWidth, viewport.width, margin),
|
|
24
|
+
mainShift: side === 'bottom' ? -overflow : overflow,
|
|
25
|
+
maxHeight,
|
|
26
|
+
maxWidth,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const roomRight = viewport.width - margin - trigger.right - gap;
|
|
30
|
+
const roomLeft = trigger.left - margin - gap;
|
|
31
|
+
const preferredRoom = preferredHorizontalSide === 'right' ? roomRight : roomLeft;
|
|
32
|
+
const oppositeRoom = preferredHorizontalSide === 'right' ? roomLeft : roomRight;
|
|
33
|
+
const fitsPreferred = preferredRoom >= panelWidth;
|
|
34
|
+
const fitsOpposite = oppositeRoom >= panelWidth;
|
|
35
|
+
const flip = !fitsPreferred && (fitsOpposite || oppositeRoom > preferredRoom);
|
|
36
|
+
const side = flip
|
|
37
|
+
? (preferredHorizontalSide === 'right' ? 'left' : 'right')
|
|
38
|
+
: preferredHorizontalSide;
|
|
39
|
+
const centered = (trigger.top + trigger.bottom) / 2 - panelHeight / 2;
|
|
40
|
+
const overflow = Math.max(0, panelWidth - (side === 'right' ? roomRight : roomLeft));
|
|
41
|
+
return {
|
|
42
|
+
side,
|
|
43
|
+
shift: clampShift(centered, panelHeight, viewport.height, margin),
|
|
44
|
+
mainShift: side === 'right' ? -overflow : overflow,
|
|
45
|
+
maxHeight,
|
|
46
|
+
maxWidth,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { resolveToolbarDrawerPlacement };
|
|
51
|
+
//# sourceMappingURL=ToolbarDrawerPlacement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerPlacement.js","sources":["../../../Toolbar/ToolbarDrawerPlacement.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\n/** Edges of an element, in viewport coordinates. */\nexport interface ToolbarDrawerRectangle {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}\n\n/** Inputs for {@link resolveToolbarDrawerPlacement}. */\nexport interface ToolbarDrawerPlacementRequest {\n /** The folder trigger the drawer is anchored to. */\n trigger: ToolbarDrawerRectangle;\n /** Natural (unconstrained) size of the drawer. */\n panel: { width: number; height: number };\n /** Size of the viewport the drawer has to stay inside. */\n viewport: { width: number; height: number };\n /** Orientation of the owning toolbar. */\n orientation: 'vertical' | 'horizontal';\n /** Preferred side for a vertical toolbar. A horizontal toolbar prefers `'bottom'`. */\n preferredHorizontalSide: 'right' | 'left';\n /** Space kept between the drawer and the trigger. */\n gap: number;\n /** Space kept between the drawer and the viewport edge. */\n margin: number;\n}\n\n/** Where a drawer ends up relative to its trigger. */\nexport interface ToolbarDrawerPlacement {\n /** The side of the trigger the drawer opens towards. */\n side: 'right' | 'left' | 'top' | 'bottom';\n /** Offset along the cross axis that keeps the drawer inside the viewport. */\n shift: number;\n /**\n * Offset along the opening axis, towards the trigger. Non-zero only when the drawer fits on\n * neither side, so it overlaps the toolbar rather than leaving the viewport.\n */\n mainShift: number;\n /** Largest height the drawer may take before it scrolls. */\n maxHeight: number;\n /** Largest width the drawer may take. */\n maxWidth: number;\n}\n\nconst clampShift = (start: number, size: number, limit: number, margin: number): number => {\n const minimumStart = margin;\n const maximumStart = Math.max(minimumStart, limit - margin - size);\n const clamped = Math.min(Math.max(start, minimumStart), maximumStart);\n return clamped - start;\n};\n\n/**\n * Decides which side of its trigger a drawer opens towards and how far it has to move along the\n * cross axis to stay inside the viewport.\n *\n * A drawer first tries its preferred side, flips to the opposite side when it does not fit there\n * and the opposite side offers more room, and finally slides along the cross axis. When it fits on\n * neither side it moves back over the toolbar instead of leaving the viewport. When the drawer is\n * larger than the viewport allows, `maxHeight` and `maxWidth` bound it so its content scrolls.\n */\nexport const resolveToolbarDrawerPlacement = (request: ToolbarDrawerPlacementRequest): ToolbarDrawerPlacement => {\n const { trigger, panel, viewport, orientation, preferredHorizontalSide, gap, margin } = request;\n const maxHeight = Math.max(0, viewport.height - margin * 2);\n const maxWidth = Math.max(0, viewport.width - margin * 2);\n const panelWidth = Math.min(panel.width, maxWidth);\n const panelHeight = Math.min(panel.height, maxHeight);\n\n if (orientation === 'horizontal') {\n const roomBelow = viewport.height - margin - trigger.bottom - gap;\n const roomAbove = trigger.top - margin - gap;\n const fitsBelow = roomBelow >= panelHeight;\n const fitsAbove = roomAbove >= panelHeight;\n const side = fitsBelow || (!fitsAbove && roomBelow >= roomAbove) ? 'bottom' : 'top';\n const centered = (trigger.left + trigger.right) / 2 - panelWidth / 2;\n const overflow = Math.max(0, panelHeight - (side === 'bottom' ? roomBelow : roomAbove));\n return {\n side,\n shift: clampShift(centered, panelWidth, viewport.width, margin),\n mainShift: side === 'bottom' ? -overflow : overflow,\n maxHeight,\n maxWidth,\n };\n }\n\n const roomRight = viewport.width - margin - trigger.right - gap;\n const roomLeft = trigger.left - margin - gap;\n const preferredRoom = preferredHorizontalSide === 'right' ? roomRight : roomLeft;\n const oppositeRoom = preferredHorizontalSide === 'right' ? roomLeft : roomRight;\n const fitsPreferred = preferredRoom >= panelWidth;\n const fitsOpposite = oppositeRoom >= panelWidth;\n const flip = !fitsPreferred && (fitsOpposite || oppositeRoom > preferredRoom);\n const side = flip\n ? (preferredHorizontalSide === 'right' ? 'left' : 'right')\n : preferredHorizontalSide;\n const centered = (trigger.top + trigger.bottom) / 2 - panelHeight / 2;\n const overflow = Math.max(0, panelWidth - (side === 'right' ? roomRight : roomLeft));\n return {\n side,\n shift: clampShift(centered, panelHeight, viewport.height, margin),\n mainShift: side === 'right' ? -overflow : overflow,\n maxHeight,\n maxWidth,\n };\n};\n"],"names":[],"mappings":"AA8CA,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,KAAa,EAAE,MAAc,KAAY;IACtF,MAAM,YAAY,GAAG,MAAM;AAC3B,IAAA,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AAClE,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC;IACrE,OAAO,OAAO,GAAG,KAAK;AAC1B,CAAC;AAWM,MAAM,6BAA6B,GAAG,CAAC,OAAsC,KAA4B;AAC5G,IAAA,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM,E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HTMLAttributes } from 'react';
|
|
2
|
+
import type { Icon } from '../Common/Icon.js';
|
|
3
|
+
/** Props for the internal labeled tile rendered inside a drawer {@link ToolbarFolder}. */
|
|
4
|
+
export interface ToolbarDrawerTileProps {
|
|
5
|
+
/** Always-visible label and accessible name. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Icon shown above the label. */
|
|
8
|
+
icon?: Icon;
|
|
9
|
+
/** Whether the tile is the active/selected one. */
|
|
10
|
+
active?: boolean;
|
|
11
|
+
/** Whether the tile is unavailable. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Explanation of why the tile is unavailable. */
|
|
14
|
+
disabledReason?: string;
|
|
15
|
+
/** Whether the tile can be dragged. */
|
|
16
|
+
draggable: boolean;
|
|
17
|
+
/** Data delivered to drag callbacks and serialized onto the `DataTransfer`. */
|
|
18
|
+
data?: unknown;
|
|
19
|
+
/** Catalogue identity exposed as `data-item-id` so styling and tests can address one tile. */
|
|
20
|
+
itemId?: string;
|
|
21
|
+
/** Called when the tile is activated by pointer, Enter or Space. */
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
/** Called when a drag starts on the tile. */
|
|
24
|
+
onDragStart?: (data: unknown, event: DragEvent<HTMLButtonElement>) => void;
|
|
25
|
+
/** Called when a drag that started on the tile ends, whether dropped or cancelled. */
|
|
26
|
+
onDragEnd?: (data: unknown, event: DragEvent<HTMLButtonElement>) => void;
|
|
27
|
+
/** Extra class name for the native button. */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** Attributes for the native button. */
|
|
30
|
+
root?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
31
|
+
/** Attributes for the icon wrapper. */
|
|
32
|
+
iconPart?: HTMLAttributes<HTMLSpanElement>;
|
|
33
|
+
/** Attributes for the label. */
|
|
34
|
+
label?: HTMLAttributes<HTMLSpanElement>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A labeled drawer tile: a prominent icon with an always-visible title.
|
|
38
|
+
*
|
|
39
|
+
* A disabled tile stays focusable and reports `aria-disabled` so assistive technology can still
|
|
40
|
+
* read why it is unavailable; it neither activates nor drags.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ToolbarDrawerTile: ({ title, icon, active, disabled, disabledReason, draggable, data, itemId, onClick, onDragStart, onDragEnd, className, root, iconPart, label, }: ToolbarDrawerTileProps) => import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=ToolbarDrawerTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerTile.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarDrawerTile.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE9F,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAgB,CAAC;AAK3C,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACnC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,mDAAmD;IACnD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC3E,sFAAsF;IACtF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACzE,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,IAAI,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAC/C,uCAAuC;IACvC,QAAQ,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAC3C,gCAAgC;IAChC,KAAK,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,mJAgB3B,sBAAsB,gCAkExB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { IconDisplay } from '../Common/Icon.js';
|
|
4
|
+
import { useRovingTool } from '../Common/ToolbarRovingContext.js';
|
|
5
|
+
import { useToolbarDragContext } from './ToolbarDragContext.js';
|
|
6
|
+
import { useToolbarDrawer } from './ToolbarDrawerContext.js';
|
|
7
|
+
|
|
8
|
+
const ToolbarDrawerTile = ({ title, icon, active, disabled, disabledReason, draggable, data, itemId, onClick, onDragStart, onDragEnd, className, root, iconPart, label, }) => {
|
|
9
|
+
const dragContext = useToolbarDragContext();
|
|
10
|
+
const drawer = useToolbarDrawer();
|
|
11
|
+
const rovingTool = useRovingTool(root?.tabIndex, root?.onFocus);
|
|
12
|
+
const reasonId = useId();
|
|
13
|
+
const isDraggable = draggable && !disabled;
|
|
14
|
+
const hasReason = disabled === true && typeof disabledReason === 'string' && disabledReason.length > 0;
|
|
15
|
+
const resolvedIcon = icon !== undefined && icon !== null && (typeof icon !== 'string' || icon.length > 0) ? icon : null;
|
|
16
|
+
const handleDragStart = (event) => {
|
|
17
|
+
event.dataTransfer.setData('application/json', JSON.stringify(data ?? null));
|
|
18
|
+
event.dataTransfer.effectAllowed = 'copy';
|
|
19
|
+
drawer?.setDragging(true);
|
|
20
|
+
onDragStart?.(data, event);
|
|
21
|
+
dragContext.onItemDragStart?.(data, event);
|
|
22
|
+
};
|
|
23
|
+
const handleDragEnd = (event) => {
|
|
24
|
+
drawer?.setDragging(false);
|
|
25
|
+
onDragEnd?.(data, event);
|
|
26
|
+
};
|
|
27
|
+
return (jsxs("button", { "aria-pressed": active, ...root, ...rovingTool, type: 'button', title: hasReason ? disabledReason : root?.title, "aria-disabled": disabled || undefined, "aria-describedby": hasReason ? reasonId : root?.['aria-describedby'], onClick: disabled ? undefined : onClick, draggable: isDraggable, onDragStart: isDraggable ? handleDragStart : undefined, onDragEnd: isDraggable ? handleDragEnd : undefined, className: `toolbar-button toolbar-drawer-tile ${isDraggable ? 'toolbar-button--draggable' : ''} ${active ? 'toolbar-button--active' : ''} ${root?.className ?? ''} ${className ?? ''}`, "data-cratis-part": 'toolbar-folder-tile', "data-item-id": itemId, "data-disabled": disabled || undefined, "data-active": active || undefined, "data-selected": active || undefined, children: [resolvedIcon !== null && (jsx("span", { "aria-hidden": 'true', ...iconPart, className: `toolbar-drawer-tile__icon ${iconPart?.className ?? ''}`, "data-cratis-part": 'toolbar-folder-tile-icon', children: jsx(IconDisplay, { icon: resolvedIcon, className: 'cratis:text-2xl' }) })), jsx("span", { ...label, className: `toolbar-drawer-tile__label ${label?.className ?? ''}`, "data-cratis-part": 'toolbar-folder-tile-label', children: title }), hasReason && (jsx("span", { id: reasonId, className: 'toolbar-drawer-tile__reason', children: disabledReason }))] }));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { ToolbarDrawerTile };
|
|
31
|
+
//# sourceMappingURL=ToolbarDrawerTile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarDrawerTile.js","sources":["../../../Toolbar/ToolbarDrawerTile.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 { useId, type ButtonHTMLAttributes, type DragEvent, type HTMLAttributes } from 'react';\nimport { IconDisplay } from '../Common/Icon';\nimport type { Icon } from '../Common/Icon';\nimport { useRovingTool } from '../Common/ToolbarRovingContext';\nimport { useToolbarDragContext } from './ToolbarDragContext';\nimport { useToolbarDrawer } from './ToolbarDrawerContext';\n\n/** Props for the internal labeled tile rendered inside a drawer {@link ToolbarFolder}. */\nexport interface ToolbarDrawerTileProps {\n /** Always-visible label and accessible name. */\n title: string;\n /** Icon shown above the label. */\n icon?: Icon;\n /** Whether the tile is the active/selected one. */\n active?: boolean;\n /** Whether the tile is unavailable. */\n disabled?: boolean;\n /** Explanation of why the tile is unavailable. */\n disabledReason?: string;\n /** Whether the tile can be dragged. */\n draggable: boolean;\n /** Data delivered to drag callbacks and serialized onto the `DataTransfer`. */\n data?: unknown;\n /** Catalogue identity exposed as `data-item-id` so styling and tests can address one tile. */\n itemId?: string;\n /** Called when the tile is activated by pointer, Enter or Space. */\n onClick?: () => void;\n /** Called when a drag starts on the tile. */\n onDragStart?: (data: unknown, event: DragEvent<HTMLButtonElement>) => void;\n /** Called when a drag that started on the tile ends, whether dropped or cancelled. */\n onDragEnd?: (data: unknown, event: DragEvent<HTMLButtonElement>) => void;\n /** Extra class name for the native button. */\n className?: string;\n /** Attributes for the native button. */\n root?: ButtonHTMLAttributes<HTMLButtonElement>;\n /** Attributes for the icon wrapper. */\n iconPart?: HTMLAttributes<HTMLSpanElement>;\n /** Attributes for the label. */\n label?: HTMLAttributes<HTMLSpanElement>;\n}\n\n/**\n * A labeled drawer tile: a prominent icon with an always-visible title.\n *\n * A disabled tile stays focusable and reports `aria-disabled` so assistive technology can still\n * read why it is unavailable; it neither activates nor drags.\n */\nexport const ToolbarDrawerTile = ({\n title,\n icon,\n active,\n disabled,\n disabledReason,\n draggable,\n data,\n itemId,\n onClick,\n onDragStart,\n onDragEnd,\n className,\n root,\n iconPart,\n label,\n}: ToolbarDrawerTileProps) => {\n const dragContext = useToolbarDragContext();\n const drawer = useToolbarDrawer();\n const rovingTool = useRovingTool<HTMLButtonElement>(root?.tabIndex, root?.onFocus);\n const reasonId = useId();\n const isDraggable = draggable && !disabled;\n const hasReason = disabled === true && typeof disabledReason === 'string' && disabledReason.length > 0;\n const resolvedIcon = icon !== undefined && icon !== null && (typeof icon !== 'string' || icon.length > 0) ? icon : null;\n\n const handleDragStart = (event: DragEvent<HTMLButtonElement>) => {\n event.dataTransfer.setData('application/json', JSON.stringify(data ?? null));\n event.dataTransfer.effectAllowed = 'copy';\n drawer?.setDragging(true);\n onDragStart?.(data, event);\n dragContext.onItemDragStart?.(data, event);\n };\n\n const handleDragEnd = (event: DragEvent<HTMLButtonElement>) => {\n drawer?.setDragging(false);\n onDragEnd?.(data, event);\n };\n\n return (\n <button\n aria-pressed={active}\n {...root}\n {...rovingTool}\n type='button'\n title={hasReason ? disabledReason : root?.title}\n aria-disabled={disabled || undefined}\n aria-describedby={hasReason ? reasonId : root?.['aria-describedby']}\n onClick={disabled ? undefined : onClick}\n draggable={isDraggable}\n onDragStart={isDraggable ? handleDragStart : undefined}\n onDragEnd={isDraggable ? handleDragEnd : undefined}\n className={`toolbar-button toolbar-drawer-tile ${isDraggable ? 'toolbar-button--draggable' : ''} ${active ? 'toolbar-button--active' : ''} ${root?.className ?? ''} ${className ?? ''}`}\n data-cratis-part='toolbar-folder-tile'\n data-item-id={itemId}\n data-disabled={disabled || undefined}\n data-active={active || undefined}\n data-selected={active || undefined}\n >\n {resolvedIcon !== null && (\n <span\n aria-hidden='true'\n {...iconPart}\n className={`toolbar-drawer-tile__icon ${iconPart?.className ?? ''}`}\n data-cratis-part='toolbar-folder-tile-icon'\n >\n <IconDisplay icon={resolvedIcon} className='cratis:text-2xl' />\n </span>\n )}\n <span\n {...label}\n className={`toolbar-drawer-tile__label ${label?.className ?? ''}`}\n data-cratis-part='toolbar-folder-tile-label'\n >\n {title}\n </span>\n {hasReason && (\n <span id={reasonId} className='toolbar-drawer-tile__reason'>\n {disabledReason}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AC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAC,iBAAiB,EAAA,CAAG,GAC5D,CACV,EACDA,iBACQ,KAAK,EACT,SAAS,EAAE,CAAA,2BAAA,EAA8B,KAAK,EAAE,SAAS,IAAI,EAAE,CAAA,CAAE,EAAA,kBAAA,EAChD,2BAA2B,EAAA,QAAA,EAE3C,KAAK,GACH,EACN,SAAS,KACNA,GAAA,CAAA,MAAA,EAAA,EAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAC,6BAA6B,EAAA,QAAA,EACtD,cAAc,EAAA,CACZ,CACV,CAAA,EAAA,CACI;AAEjB;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
1
|
+
import { type ButtonHTMLAttributes, type DragEvent, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import type { Icon } from '../Common/Icon.js';
|
|
3
3
|
import type { TooltipPosition } from '../Common/Tooltip.js';
|
|
4
|
+
import type { ToolbarDrawerItem } from './ToolbarDrawerItem.js';
|
|
5
|
+
import type { ToolbarFolderPresentation } from './ToolbarFolderPresentation.js';
|
|
4
6
|
import type { ToolbarFolderMode } from './ToolbarFolderContext.js';
|
|
5
7
|
/** Stable part attributes for {@link ToolbarFolder}. */
|
|
6
8
|
export interface ToolbarFolderParts {
|
|
@@ -10,6 +12,18 @@ export interface ToolbarFolderParts {
|
|
|
10
12
|
trigger?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
11
13
|
/** Expanded item panel. */
|
|
12
14
|
panel?: HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
/** Drawer presentation: the header row holding the title and the close action. */
|
|
16
|
+
drawerHeader?: HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
/** Drawer presentation: the visible heading. */
|
|
18
|
+
drawerTitle?: HTMLAttributes<HTMLSpanElement>;
|
|
19
|
+
/** Drawer presentation: the native close button. */
|
|
20
|
+
drawerClose?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
21
|
+
/** Drawer presentation: each labeled tile rendered from `items`. */
|
|
22
|
+
tile?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
23
|
+
/** Drawer presentation: the icon wrapper inside each tile rendered from `items`. */
|
|
24
|
+
tileIcon?: HTMLAttributes<HTMLSpanElement>;
|
|
25
|
+
/** Drawer presentation: the label inside each tile rendered from `items`. */
|
|
26
|
+
tileLabel?: HTMLAttributes<HTMLSpanElement>;
|
|
13
27
|
}
|
|
14
28
|
/** Props for the {@link ToolbarFolder} component. */
|
|
15
29
|
export interface ToolbarFolderProps {
|
|
@@ -28,14 +42,42 @@ export interface ToolbarFolderProps {
|
|
|
28
42
|
* - `'list'` — items are stacked vertically with the icon and title label shown side by side.
|
|
29
43
|
*/
|
|
30
44
|
mode?: ToolbarFolderMode;
|
|
31
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* How the expanded panel is presented (default: `'compact'`, the existing popout).
|
|
47
|
+
* Set `'drawer'` for a headed panel with a visible title, a close action and labeled tiles.
|
|
48
|
+
*/
|
|
49
|
+
presentation?: ToolbarFolderPresentation;
|
|
50
|
+
/** Maximum number of columns to render before adding more rows (default: 5, or 3 for the drawer). Not used in `list` mode. */
|
|
32
51
|
maxColumns?: number;
|
|
52
|
+
/** Drawer presentation: visible heading. Defaults to {@link title}. */
|
|
53
|
+
heading?: string;
|
|
54
|
+
/** Drawer presentation: accessible name of the close button. Falls back to `messages.toolbar.closeDrawer`, then `Close`. */
|
|
55
|
+
closeLabel?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Drawer presentation: a data-driven catalogue rendered as labeled tiles before any `children`.
|
|
58
|
+
* Each item's `payload` is delivered unchanged to {@link onActivate} and on drag; items are never
|
|
59
|
+
* normalized or filtered.
|
|
60
|
+
*/
|
|
61
|
+
items?: ReadonlyArray<ToolbarDrawerItem>;
|
|
62
|
+
/** Drawer presentation: called when a catalogue tile is activated by click, Enter or Space. The consumer decides the insertion target. */
|
|
63
|
+
onActivate?: (item: ToolbarDrawerItem) => void;
|
|
64
|
+
/** Drawer presentation: called when a drag of a catalogue tile starts. */
|
|
65
|
+
onItemDragStart?: (item: ToolbarDrawerItem, event: DragEvent<HTMLButtonElement>) => void;
|
|
66
|
+
/** Drawer presentation: called when a drag of a catalogue tile ends, whether it was dropped or cancelled. */
|
|
67
|
+
onItemDragEnd?: (item: ToolbarDrawerItem, event: DragEvent<HTMLButtonElement>) => void;
|
|
68
|
+
/** Drawer presentation: whether catalogue tiles can be dragged (default: `true`). */
|
|
69
|
+
draggable?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Drawer presentation: close the drawer after a tile is activated or a drag is dropped
|
|
72
|
+
* (default: `false`, so several items can be inserted in a row). A cancelled drag never closes it.
|
|
73
|
+
*/
|
|
74
|
+
closeOnInsert?: boolean;
|
|
33
75
|
/** Extra class name for the folder root. */
|
|
34
76
|
className?: string;
|
|
35
77
|
/** Stable folder attributes. */
|
|
36
78
|
pt?: ToolbarFolderParts;
|
|
37
|
-
/** The toolbar buttons shown when the folder is expanded. */
|
|
38
|
-
children
|
|
79
|
+
/** The toolbar buttons shown when the folder is expanded. Optional when a drawer supplies `items`. */
|
|
80
|
+
children?: ReactNode;
|
|
39
81
|
}
|
|
40
82
|
/**
|
|
41
83
|
* A toolbar folder that reveals a panel of buttons when clicked.
|
|
@@ -45,6 +87,10 @@ export interface ToolbarFolderProps {
|
|
|
45
87
|
*
|
|
46
88
|
* **List mode**: items are stacked vertically with their icon and title label rendered
|
|
47
89
|
* side by side — useful when labels add important context to icon-only buttons.
|
|
90
|
+
*
|
|
91
|
+
* **Drawer presentation** (`presentation='drawer'`): a headed panel with a visible title, a close
|
|
92
|
+
* action and labeled icon tiles. Tiles come from a data-driven `items` catalogue and/or `children`.
|
|
93
|
+
* The drawer only presents the palette: dropping a tile and deciding what it creates stay with the consumer.
|
|
48
94
|
*/
|
|
49
|
-
export declare const ToolbarFolder: ({ icon, title, tooltipPosition, folderDirection, mode, maxColumns, className, pt, children, }: ToolbarFolderProps) => import("react").JSX.Element;
|
|
95
|
+
export declare const ToolbarFolder: ({ icon, title, tooltipPosition, folderDirection, mode, presentation, maxColumns, heading, closeLabel, items: catalogue, onActivate, onItemDragStart, onItemDragEnd, draggable, closeOnInsert, className, pt, children, }: ToolbarFolderProps) => import("react").JSX.Element;
|
|
50
96
|
//# sourceMappingURL=ToolbarFolder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarFolder.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarFolder.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ToolbarFolder.d.ts","sourceRoot":"","sources":["../../../Toolbar/ToolbarFolder.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEH,KAAK,oBAAoB,EAEzB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,SAAS,EAQjB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAMzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAA6B,CAAC;AAM7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAAwB,CAAC;AAEhE,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IAC/B,+CAA+C;IAC/C,IAAI,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IACtC,6BAA6B;IAC7B,OAAO,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAClD,2BAA2B;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;IACvC,kFAAkF;IAClF,YAAY,CAAC,EAAE,cAAc,CAAC,c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