@cratis/components 4.38.1 → 4.39.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/ChatSidebar.d.ts.map +1 -1
- package/dist/esm/Chat/ChatSidebar.js +2 -2
- package/dist/esm/Chat/ChatSidebar.js.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.d.ts +1 -1
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js +5 -2
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/CommandDialog/CommandStepperContent.js +1 -1
- package/dist/esm/CommandDialog/CommandStepperContent.js.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts +7 -0
- package/dist/esm/CommandDialog/StepperCommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/StepperCommandDialog.js +4 -4
- package/dist/esm/CommandDialog/StepperCommandDialog.js.map +1 -1
- package/dist/esm/CommandForm/fields/CheckboxField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/CheckboxField.js +1 -1
- package/dist/esm/CommandForm/fields/CheckboxField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.js +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ColorPickerField.js +1 -1
- package/dist/esm/CommandForm/fields/ColorPickerField.js.map +1 -1
- package/dist/esm/CommandForm/fields/NumberField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/NumberField.js +1 -1
- package/dist/esm/CommandForm/fields/NumberField.js.map +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.js +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.js.map +1 -1
- package/dist/esm/CommandForm/fields/RadioButtonField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/RadioButtonField.js +1 -1
- package/dist/esm/CommandForm/fields/RadioButtonField.js.map +1 -1
- package/dist/esm/CommandForm/fields/RadioGroupField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/RadioGroupField.js +1 -1
- package/dist/esm/CommandForm/fields/RadioGroupField.js.map +1 -1
- package/dist/esm/CommandForm/fields/RatingField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/RatingField.js +1 -1
- package/dist/esm/CommandForm/fields/RatingField.js.map +1 -1
- package/dist/esm/CommandForm/fields/SliderField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/SliderField.js +1 -1
- package/dist/esm/CommandForm/fields/SliderField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ToggleSwitchField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ToggleSwitchField.js +1 -1
- package/dist/esm/CommandForm/fields/ToggleSwitchField.js.map +1 -1
- package/dist/esm/Common/ActionMenubar.d.ts.map +1 -1
- package/dist/esm/Common/ActionMenubar.js +1 -1
- package/dist/esm/Common/ActionMenubar.js.map +1 -1
- package/dist/esm/Common/Breadcrumbs.d.ts.map +1 -1
- package/dist/esm/Common/Breadcrumbs.js +1 -1
- package/dist/esm/Common/Breadcrumbs.js.map +1 -1
- package/dist/esm/Common/Button.d.ts.map +1 -1
- package/dist/esm/Common/Button.js +4 -1
- package/dist/esm/Common/Button.js.map +1 -1
- package/dist/esm/Common/CheckboxImplementation.d.ts.map +1 -1
- package/dist/esm/Common/CheckboxImplementation.js +1 -1
- package/dist/esm/Common/CheckboxImplementation.js.map +1 -1
- package/dist/esm/Common/ComboBox.js +1 -1
- package/dist/esm/Common/ComboBox.js.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts +14 -1
- package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
- package/dist/esm/Common/CratisComponentsProvider.js +6 -2
- package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.d.ts.map +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js +1 -1
- package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
- package/dist/esm/Common/FormElement.js +1 -1
- package/dist/esm/Common/FormElement.js.map +1 -1
- package/dist/esm/Common/IconButton.d.ts.map +1 -1
- package/dist/esm/Common/IconButton.js +4 -1
- package/dist/esm/Common/IconButton.js.map +1 -1
- package/dist/esm/Common/NumberInput.d.ts.map +1 -1
- package/dist/esm/Common/NumberInput.js +1 -1
- package/dist/esm/Common/NumberInput.js.map +1 -1
- package/dist/esm/Common/Page.d.ts +1 -1
- package/dist/esm/Common/Page.d.ts.map +1 -1
- package/dist/esm/Common/Page.js +11 -2
- package/dist/esm/Common/Page.js.map +1 -1
- package/dist/esm/Common/RadioImplementation.d.ts.map +1 -1
- package/dist/esm/Common/RadioImplementation.js +1 -1
- package/dist/esm/Common/RadioImplementation.js.map +1 -1
- package/dist/esm/Common/SurfaceImplementation.d.ts.map +1 -1
- package/dist/esm/Common/SurfaceImplementation.js +1 -1
- package/dist/esm/Common/SurfaceImplementation.js.map +1 -1
- package/dist/esm/Common/SwitchImplementation.d.ts.map +1 -1
- package/dist/esm/Common/SwitchImplementation.js +1 -1
- package/dist/esm/Common/SwitchImplementation.js.map +1 -1
- package/dist/esm/Common/Tabs.d.ts.map +1 -1
- package/dist/esm/Common/Tabs.js +1 -1
- package/dist/esm/Common/Tabs.js.map +1 -1
- package/dist/esm/Common/TagGroup.d.ts.map +1 -1
- package/dist/esm/Common/TagGroup.js +1 -1
- package/dist/esm/Common/TagGroup.js.map +1 -1
- package/dist/esm/Common/TextArea.d.ts.map +1 -1
- package/dist/esm/Common/TextArea.js +4 -1
- package/dist/esm/Common/TextArea.js.map +1 -1
- package/dist/esm/Common/TextInput.d.ts.map +1 -1
- package/dist/esm/Common/TextInput.js +4 -1
- package/dist/esm/Common/TextInput.js.map +1 -1
- package/dist/esm/Common/ToggleGroup.d.ts.map +1 -1
- package/dist/esm/Common/ToggleGroup.js +1 -1
- package/dist/esm/Common/ToggleGroup.js.map +1 -1
- package/dist/esm/Common/buttonDescriptor.d.ts +7 -0
- package/dist/esm/Common/buttonDescriptor.d.ts.map +1 -0
- package/dist/esm/Common/buttonDescriptor.js +28 -0
- package/dist/esm/Common/buttonDescriptor.js.map +1 -0
- package/dist/esm/Common/textFieldDescriptors.d.ts +7 -0
- package/dist/esm/Common/textFieldDescriptors.d.ts.map +1 -0
- package/dist/esm/Common/textFieldDescriptors.js +25 -0
- package/dist/esm/Common/textFieldDescriptors.js.map +1 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.d.ts +14 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.js +12 -0
- package/dist/esm/ComponentPicker/ComponentHighlight.js.map +1 -0
- package/dist/esm/ComponentPicker/ComponentPicker.d.ts +24 -0
- package/dist/esm/ComponentPicker/ComponentPicker.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/ComponentPicker.js +116 -0
- package/dist/esm/ComponentPicker/ComponentPicker.js.map +1 -0
- package/dist/esm/ComponentPicker/ComponentResolver.d.ts +6 -0
- package/dist/esm/ComponentPicker/ComponentResolver.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/ComponentResolver.js +4 -0
- package/dist/esm/ComponentPicker/ComponentResolver.js.map +1 -0
- package/dist/esm/ComponentPicker/HighlightFrame.d.ts +14 -0
- package/dist/esm/ComponentPicker/HighlightFrame.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/HighlightFrame.js +70 -0
- package/dist/esm/ComponentPicker/HighlightFrame.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedAncestor.d.ts +10 -0
- package/dist/esm/ComponentPicker/PickedAncestor.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedAncestor.js +4 -0
- package/dist/esm/ComponentPicker/PickedAncestor.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedComponent.d.ts +23 -0
- package/dist/esm/ComponentPicker/PickedComponent.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedComponent.js +4 -0
- package/dist/esm/ComponentPicker/PickedComponent.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.d.ts +22 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.js +4 -0
- package/dist/esm/ComponentPicker/PickedPresentationProperty.js.map +1 -0
- package/dist/esm/ComponentPicker/PickedRect.d.ts +20 -0
- package/dist/esm/ComponentPicker/PickedRect.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PickedRect.js +4 -0
- package/dist/esm/ComponentPicker/PickedRect.js.map +1 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.d.ts +25 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.js +51 -0
- package/dist/esm/ComponentPicker/PresentationPropertyEditor.js.map +1 -0
- package/dist/esm/ComponentPicker/componentElements.d.ts +14 -0
- package/dist/esm/ComponentPicker/componentElements.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/componentElements.js +18 -0
- package/dist/esm/ComponentPicker/componentElements.js.map +1 -0
- package/dist/esm/ComponentPicker/describeComponentElement.d.ts +11 -0
- package/dist/esm/ComponentPicker/describeComponentElement.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/describeComponentElement.js +63 -0
- package/dist/esm/ComponentPicker/describeComponentElement.js.map +1 -0
- package/dist/esm/ComponentPicker/index.d.ts +24 -0
- package/dist/esm/ComponentPicker/index.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/index.js +12 -0
- package/dist/esm/ComponentPicker/index.js.map +1 -0
- package/dist/esm/ComponentPicker/pickerStacking.d.ts +3 -0
- package/dist/esm/ComponentPicker/pickerStacking.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/pickerStacking.js +10 -0
- package/dist/esm/ComponentPicker/pickerStacking.js.map +1 -0
- package/dist/esm/ComponentPicker/proposedChanges.d.ts +11 -0
- package/dist/esm/ComponentPicker/proposedChanges.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/proposedChanges.js +6 -0
- package/dist/esm/ComponentPicker/proposedChanges.js.map +1 -0
- package/dist/esm/ComponentPicker/useComponentPicker.d.ts +30 -0
- package/dist/esm/ComponentPicker/useComponentPicker.d.ts.map +1 -0
- package/dist/esm/ComponentPicker/useComponentPicker.js +31 -0
- package/dist/esm/ComponentPicker/useComponentPicker.js.map +1 -0
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.d.ts.map +1 -1
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.js +1 -1
- package/dist/esm/ConfigurationEditor/OrderedItemEditor.js.map +1 -1
- package/dist/esm/ConfigurationEditor/PropertyControls.d.ts.map +1 -1
- package/dist/esm/ConfigurationEditor/PropertyControls.js +1 -1
- package/dist/esm/ConfigurationEditor/PropertyControls.js.map +1 -1
- package/dist/esm/DataPage/DataPage.js +1 -1
- package/dist/esm/DataPage/DataPage.js.map +1 -1
- package/dist/esm/DataTables/DataTableCore.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableCore.js +1 -1
- package/dist/esm/DataTables/DataTableCore.js.map +1 -1
- package/dist/esm/DataTables/DataTableHeaderCell.d.ts +2 -2
- package/dist/esm/DataTables/DataTableHeaderCell.d.ts.map +1 -1
- package/dist/esm/DataTables/DataTableHeaderCell.js +7 -2
- package/dist/esm/DataTables/DataTableHeaderCell.js.map +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.d.ts.map +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.js +1 -1
- package/dist/esm/DataTables/TablePaginatorImplementation.js.map +1 -1
- package/dist/esm/DataTables/columnDescriptor.d.ts +4 -0
- package/dist/esm/DataTables/columnDescriptor.d.ts.map +1 -0
- package/dist/esm/DataTables/columnDescriptor.js +10 -0
- package/dist/esm/DataTables/columnDescriptor.js.map +1 -0
- package/dist/esm/Dialogs/Dialog.d.ts +18 -0
- package/dist/esm/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/esm/Dialogs/Dialog.js.map +1 -1
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.d.ts +8 -0
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.d.ts.map +1 -0
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.js +6 -0
- package/dist/esm/Dialogs/DialogGlobalHeaderActions.js.map +1 -0
- package/dist/esm/Dialogs/DialogImplementation.d.ts +1 -1
- package/dist/esm/Dialogs/DialogImplementation.d.ts.map +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +22 -6
- package/dist/esm/Dialogs/DialogImplementation.js.map +1 -1
- package/dist/esm/Dialogs/dialogDescriptor.d.ts +4 -0
- package/dist/esm/Dialogs/dialogDescriptor.d.ts.map +1 -0
- package/dist/esm/Dialogs/dialogDescriptor.js +12 -0
- package/dist/esm/Dialogs/dialogDescriptor.js.map +1 -0
- package/dist/esm/Dialogs/index.d.ts +3 -0
- package/dist/esm/Dialogs/index.d.ts.map +1 -1
- package/dist/esm/Display/Avatar.d.ts.map +1 -1
- package/dist/esm/Display/Avatar.js +1 -1
- package/dist/esm/Display/Avatar.js.map +1 -1
- package/dist/esm/Display/Badge.d.ts.map +1 -1
- package/dist/esm/Display/Badge.js +1 -1
- package/dist/esm/Display/Badge.js.map +1 -1
- package/dist/esm/Display/Chip.d.ts.map +1 -1
- package/dist/esm/Display/Chip.js +1 -1
- package/dist/esm/Display/Chip.js.map +1 -1
- package/dist/esm/Display/Message.d.ts.map +1 -1
- package/dist/esm/Display/Message.js +1 -1
- package/dist/esm/Display/Message.js.map +1 -1
- package/dist/esm/Display/ProgressBarImplementation.d.ts.map +1 -1
- package/dist/esm/Display/ProgressBarImplementation.js +1 -1
- package/dist/esm/Display/ProgressBarImplementation.js.map +1 -1
- package/dist/esm/Display/ProgressSpinner.d.ts.map +1 -1
- package/dist/esm/Display/ProgressSpinner.js +1 -1
- package/dist/esm/Display/ProgressSpinner.js.map +1 -1
- package/dist/esm/Display/Skeleton.d.ts.map +1 -1
- package/dist/esm/Display/Skeleton.js +1 -1
- package/dist/esm/Display/Skeleton.js.map +1 -1
- package/dist/esm/Display/Tag.d.ts.map +1 -1
- package/dist/esm/Display/Tag.js +1 -1
- package/dist/esm/Display/Tag.js.map +1 -1
- package/dist/esm/Dropdown/DropdownImplementation.js +4 -4
- package/dist/esm/Dropdown/DropdownImplementation.js.map +1 -1
- package/dist/esm/IconPicker/IconPicker.d.ts.map +1 -1
- package/dist/esm/IconPicker/IconPicker.js +1 -1
- package/dist/esm/IconPicker/IconPicker.js.map +1 -1
- package/dist/esm/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/esm/MarkdownEditor/MarkdownEditor.js +1 -1
- package/dist/esm/MarkdownEditor/MarkdownEditor.js.map +1 -1
- package/dist/esm/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/esm/Toolbar/Toolbar.js +1 -1
- package/dist/esm/Toolbar/Toolbar.js.map +1 -1
- package/dist/esm/configuration/DialogHeaderActionsRenderer.d.ts +8 -0
- package/dist/esm/configuration/DialogHeaderActionsRenderer.d.ts.map +1 -0
- package/dist/esm/configuration/DialogHeaderActionsRenderer.js +4 -0
- package/dist/esm/configuration/DialogHeaderActionsRenderer.js.map +1 -0
- package/dist/esm/configuration/DialogHeaderContext.d.ts +13 -0
- package/dist/esm/configuration/DialogHeaderContext.d.ts.map +1 -0
- package/dist/esm/configuration/DialogHeaderContext.js +4 -0
- package/dist/esm/configuration/DialogHeaderContext.js.map +1 -0
- package/dist/esm/configuration/DialogSliceLocation.d.ts +13 -0
- package/dist/esm/configuration/DialogSliceLocation.d.ts.map +1 -0
- package/dist/esm/configuration/DialogSliceLocation.js +4 -0
- package/dist/esm/configuration/DialogSliceLocation.js.map +1 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.d.ts +12 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.d.ts.map +1 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.js +4 -0
- package/dist/esm/configuration/identity/ComponentDescriptor.js.map +1 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.d.ts +10 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.d.ts.map +1 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.js +4 -0
- package/dist/esm/configuration/identity/ComponentMarkerAttributes.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationChange.d.ts +11 -0
- package/dist/esm/configuration/identity/PresentationChange.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationChange.js +4 -0
- package/dist/esm/configuration/identity/PresentationChange.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.d.ts +22 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.js +4 -0
- package/dist/esm/configuration/identity/PresentationPropertyDescriptor.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.d.ts +3 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.js +4 -0
- package/dist/esm/configuration/identity/PresentationPropertyType.js.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.d.ts +3 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.d.ts.map +1 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.js +4 -0
- package/dist/esm/configuration/identity/PresentationPropertyValue.js.map +1 -0
- package/dist/esm/configuration/identity/RegisteredComponent.d.ts +9 -0
- package/dist/esm/configuration/identity/RegisteredComponent.d.ts.map +1 -0
- package/dist/esm/configuration/identity/RegisteredComponent.js +4 -0
- package/dist/esm/configuration/identity/RegisteredComponent.js.map +1 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.d.ts +7 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.d.ts.map +1 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.js +6 -0
- package/dist/esm/configuration/identity/componentIdentityAttributes.js.map +1 -0
- package/dist/esm/configuration/identity/componentInstances.d.ts +30 -0
- package/dist/esm/configuration/identity/componentInstances.d.ts.map +1 -0
- package/dist/esm/configuration/identity/componentInstances.js +61 -0
- package/dist/esm/configuration/identity/componentInstances.js.map +1 -0
- package/dist/esm/configuration/identity/componentMarker.d.ts +9 -0
- package/dist/esm/configuration/identity/componentMarker.d.ts.map +1 -0
- package/dist/esm/configuration/identity/componentMarker.js +7 -0
- package/dist/esm/configuration/identity/componentMarker.js.map +1 -0
- package/dist/esm/configuration/identity/describeComponent.d.ts +11 -0
- package/dist/esm/configuration/identity/describeComponent.d.ts.map +1 -0
- package/dist/esm/configuration/identity/describeComponent.js +4 -0
- package/dist/esm/configuration/identity/describeComponent.js.map +1 -0
- package/dist/esm/configuration/identity/useComponentPresentation.d.ts +15 -0
- package/dist/esm/configuration/identity/useComponentPresentation.d.ts.map +1 -0
- package/dist/esm/configuration/identity/useComponentPresentation.js +18 -0
- package/dist/esm/configuration/identity/useComponentPresentation.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/renderer/dialogStack.d.ts +2 -0
- package/dist/esm/renderer/dialogStack.d.ts.map +1 -1
- package/dist/esm/renderer/dialogStack.js +2 -1
- package/dist/esm/renderer/dialogStack.js.map +1 -1
- package/dist/esm/types/parts.d.ts +25 -2
- package/dist/esm/types/parts.d.ts.map +1 -1
- package/dist/esm/types/parts.js +25 -2
- package/dist/esm/types/parts.js.map +1 -1
- package/package.json +6 -2
|
@@ -2,6 +2,8 @@ import { forwardRef } from 'react';
|
|
|
2
2
|
import { unstable_useSlot } from '../renderer/RendererContext.js';
|
|
3
3
|
import { renderSlot } from '../renderer/renderSlot.js';
|
|
4
4
|
import { IconButtonImplementation } from './IconButtonImplementation.js';
|
|
5
|
+
import { useComponentPresentation } from '../configuration/identity/useComponentPresentation.js';
|
|
6
|
+
import { iconButtonDescriptor } from './buttonDescriptor.js';
|
|
5
7
|
|
|
6
8
|
const coreIconButtonDeclaration = Object.freeze({
|
|
7
9
|
mode: 'presentation',
|
|
@@ -10,7 +12,8 @@ const coreIconButtonDeclaration = Object.freeze({
|
|
|
10
12
|
});
|
|
11
13
|
const IconButton = forwardRef(function IconButton(props, ref) {
|
|
12
14
|
const declaration = unstable_useSlot('common.iconButton', coreIconButtonDeclaration);
|
|
13
|
-
|
|
15
|
+
const [presented, marker] = useComponentPresentation(iconButtonDescriptor, props, props.id);
|
|
16
|
+
return renderSlot(declaration, { ...presented, ...marker }, ref);
|
|
14
17
|
});
|
|
15
18
|
|
|
16
19
|
export { IconButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../Common/IconButton.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 { forwardRef, type ReactNode } from 'react';\nimport type { ButtonParts, ButtonProps } from './Button';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport { IconButtonImplementation } from './IconButtonImplementation';\n\n/** Stable Cratis-owned parts for styling an {@link IconButton}. */\nexport type IconButtonParts = ButtonParts;\n\nconst iconButtonPartsMatchManifest: ExactPartKeys<\n IconButtonParts,\n PartsOf<'IconButton'>\n> = true;\nvoid iconButtonPartsMatchManifest;\n\n/** Props for {@link IconButton}. */\nexport interface IconButtonProps extends Omit<\n ButtonProps,\n 'aria-label' | 'children' | 'icon' | 'label' | 'pt'\n> {\n /** Icon content displayed by the button. */\n icon: ReactNode;\n /** Required accessible name for the icon-only action. */\n 'aria-label': string;\n /** Cratis-owned per-part attributes inherited from {@link Button}. */\n pt?: IconButtonParts;\n}\n\nconst coreIconButtonDeclaration = Object.freeze({\n mode: 'presentation',\n fidelity: 'native',\n render: IconButtonImplementation,\n}) satisfies unstable_SlotDeclaration<'common.iconButton'>;\n\n/** An icon-only specialization of {@link Button} with one native interaction owner. */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n function IconButton(props, ref) {\n const declaration = unstable_useSlot(\n 'common.iconButton',\n coreIconButtonDeclaration,\n );\n return renderSlot(declaration,
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../Common/IconButton.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 { forwardRef, type ReactNode } from 'react';\nimport type { ButtonParts, ButtonProps } from './Button';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { unstable_useSlot } from '../renderer/RendererContext';\nimport { renderSlot } from '../renderer/renderSlot';\nimport type { unstable_SlotDeclaration } from '../renderer/slots';\nimport { IconButtonImplementation } from './IconButtonImplementation';\nimport { useComponentPresentation } from '../configuration/identity/useComponentPresentation';\nimport { iconButtonDescriptor } from './buttonDescriptor';\n\n/** Stable Cratis-owned parts for styling an {@link IconButton}. */\nexport type IconButtonParts = ButtonParts;\n\nconst iconButtonPartsMatchManifest: ExactPartKeys<\n IconButtonParts,\n PartsOf<'IconButton'>\n> = true;\nvoid iconButtonPartsMatchManifest;\n\n/** Props for {@link IconButton}. */\nexport interface IconButtonProps extends Omit<\n ButtonProps,\n 'aria-label' | 'children' | 'icon' | 'label' | 'pt'\n> {\n /** Icon content displayed by the button. */\n icon: ReactNode;\n /** Required accessible name for the icon-only action. */\n 'aria-label': string;\n /** Cratis-owned per-part attributes inherited from {@link Button}. */\n pt?: IconButtonParts;\n}\n\nconst coreIconButtonDeclaration = Object.freeze({\n mode: 'presentation',\n fidelity: 'native',\n render: IconButtonImplementation,\n}) satisfies unstable_SlotDeclaration<'common.iconButton'>;\n\n/** An icon-only specialization of {@link Button} with one native interaction owner. */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n function IconButton(props, ref) {\n const declaration = unstable_useSlot(\n 'common.iconButton',\n coreIconButtonDeclaration,\n );\n const [presented, marker] = useComponentPresentation(iconButtonDescriptor, props, props.id);\n return renderSlot(declaration, { ...presented, ...marker }, ref);\n },\n);\n"],"names":[],"mappings":";;;;;;;AAoCA,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;AAC5C,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,QAAQ,EAAE,QAAQ;AAClB,IAAA,MAAM,EAAE,wBAAwB;AACnC,CAAA,CAAyD;AAGnD,MAAM,UAAU,GAAG,UAAU,CAChC,SAAS,UAAU,CAAC,KAAK,EAAE,GAAG,EAAA;IAC1B,MAAM,WAAW,GAAG,gBAAgB,CAChC,mBAAmB,EACnB,yBAAyB,CAC5B;AACD,IAAA,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,wBAAwB,CAAC,oBAAoB,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;AAC3F,IAAA,OAAO,UAAU,CAAC,WAAW,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,CAAC;AACpE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../Common/NumberInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EAMH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAUf,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAA6B,CAAC;AAG7E,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC7B,qCAAqC;IACrC,IAAI,CAAC,EAAE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,OAAO,CAAC;IACnB,uGAAuG;IACvG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iEAAiE;IACjE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,qEAAqE;IACrE,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,gBAAgB,CAAC;CACzB;AA+DD;;;;GAIG;AACH,eAAO,MAAM,WAAW,6VA4BrB,gBAAgB,gCAyVlB,CAAC"}
|
|
@@ -114,7 +114,7 @@ const NumberInput = ({ value, onChange, onCommit, locale, useGrouping = true, mi
|
|
|
114
114
|
scheduleCommit(NumberInputCommitReason.Enter);
|
|
115
115
|
else if (event.key === 'ArrowUp' || event.key === 'ArrowDown')
|
|
116
116
|
scheduleCommit(NumberInputCommitReason.Step);
|
|
117
|
-
}, className: classNames('cratis-number-input', pt?.root?.className, className), style: pt?.root?.style, "data-cratis-part": 'root', "data-disabled": disabled || undefined, "data-invalid": invalid || undefined, "data-readonly": readOnly || undefined, "data-empty": controlledValue === null || undefined, children: ({ state }) => {
|
|
117
|
+
}, className: classNames('cratis-number-input', pt?.root?.className, className), style: pt?.root?.style, "data-cratis-part": 'root', "data-cratis-component": 'NumberInput', "data-disabled": disabled || undefined, "data-invalid": invalid || undefined, "data-readonly": readOnly || undefined, "data-empty": controlledValue === null || undefined, children: ({ state }) => {
|
|
118
118
|
const parsedValue = semanticValue(state.numberValue);
|
|
119
119
|
latestValue.current = parsedValue;
|
|
120
120
|
return (jsxs(Fragment, { children: [jsxs(Group, { ...partAttributes(pt?.group), className: classNames('cratis-number-input__group', pt?.group?.className), style: pt?.group?.style, "data-cratis-part": 'group', "data-disabled": disabled || undefined, "data-invalid": invalid || undefined, "data-readonly": readOnly || undefined, children: [jsxs("div", { className: 'cratis-number-input__control', children: [prefixId && (jsx("span", { ...partAttributes(pt?.prefix), id: prefixId, className: classNames('cratis-number-input__adornment', 'cratis-number-input__prefix', pt?.prefix?.className), style: pt?.prefix?.style, "data-cratis-part": 'prefix', "data-disabled": disabled || undefined, "data-invalid": invalid || undefined, "data-readonly": readOnly || undefined, children: prefix })), jsx(Input, { ...partAttributes(pt?.input), placeholder: placeholder, "aria-errormessage": errorId, className: classNames('cratis-number-input__input', pt?.input?.className), style: pt?.input?.style, render: (inputProps) => (jsx("input", { ...inputProps, required: required, onPaste: (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sources":["../../../Common/NumberInput.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 {\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport {\n Button,\n Group,\n Input,\n NumberField as AriaNumberField,\n} from 'react-aria-components/NumberField';\nimport { I18nProvider, useLocale } from 'react-aria-components/I18nProvider';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { NumberInputCommitReason } from './NumberInputCommitReason';\nimport type { NumberInputPartAttributes } from './NumberInputPartAttributes';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Stable Cratis-owned parts for styling a {@link NumberInput}. */\nexport interface NumberInputParts {\n /** Complete number-field wrapper. */\n root?: NumberInputPartAttributes;\n /** The bordered box holding the adornments, the input and the steppers. */\n group?: NumberInputPartAttributes;\n /** Editable localized input. */\n input?: NumberInputPartAttributes;\n /** Prefix adornment, when supplied. */\n prefix?: NumberInputPartAttributes;\n /** Suffix adornment, when supplied. */\n suffix?: NumberInputPartAttributes;\n /** Both decrement and increment buttons, distinguished by `data-step`. */\n step?: NumberInputPartAttributes;\n /** Supporting description, when supplied. */\n description?: NumberInputPartAttributes;\n /** Validation message, when supplied while invalid. */\n error?: NumberInputPartAttributes;\n}\n\nconst numberInputPartsMatchManifest: ExactPartKeys<\n NumberInputParts,\n PartsOf<'NumberInput'>\n> = true;\nvoid numberInputPartsMatchManifest;\n\n/** Props for {@link NumberInput}. */\nexport interface NumberInputProps {\n /** Controlled finite number, or `null` for an empty input. */\n value: number | null;\n /** Receives accepted semantic values. Incomplete text never emits `0` or `NaN`. */\n onChange: (value: number | null) => void;\n /**\n * Runs after a blur, Enter, full-field paste, arrow key, or step-button commit.\n * When the semantic value changes, `onChange` runs before `onCommit`.\n */\n onCommit?: (value: number | null, reason: NumberInputCommitReason) => void;\n /** BCP 47 locale override. Defaults to the nearest {@link CratisComponentsProvider}. */\n locale?: string;\n /** Enables locale grouping separators. Defaults to `true`. */\n useGrouping?: boolean;\n /** Minimum displayed fraction digits. */\n minimumFractionDigits?: number;\n /** Maximum fraction digits retained on commit and shown in the formatted value. */\n maximumFractionDigits?: number;\n /** Requires a non-empty value and exposes native required-field semantics. */\n required?: boolean;\n /** Minimum value; committed edits below it snap to this boundary. */\n min?: number;\n /** Maximum value; committed edits above it snap to this boundary. */\n max?: number;\n /** Increment, decrement, and commit snapping interval. Defaults to `1`. */\n step?: number;\n /** Visible content before the editable number; excluded from parsing. */\n prefix?: ReactNode;\n /** Visible content after the editable number; excluded from parsing. */\n suffix?: ReactNode;\n /** Placeholder shown while empty. */\n placeholder?: string;\n /** Disables editing, focus, step controls, and form submission. */\n disabled?: boolean;\n /** Prevents editing while retaining the value and focus semantics. */\n readOnly?: boolean;\n /** Renders the decrement/increment buttons. Keyboard stepping stays available when they are hidden. */\n showSteppers?: boolean;\n /** Marks the control invalid. */\n invalid?: boolean;\n /** Stable id for the editable input and external label association. */\n id?: string;\n /** Native form field name; an associated hidden input submits the semantic value. */\n name?: string;\n /** Accessible name when no external label identifies the input. */\n 'aria-label'?: string;\n /** Id of an external element that labels the input and its step actions. */\n 'aria-labelledby'?: string;\n /** Additional external description ids. */\n 'aria-describedby'?: string;\n /** Supporting description associated with the editable input. */\n description?: ReactNode;\n /** Error message rendered and associated while `invalid` is true. */\n errorMessage?: ReactNode;\n /** Additional CSS class for the root part. */\n className?: string;\n /** Cratis-owned per-part attributes. */\n pt?: NumberInputParts;\n}\n\nconst semanticValue = (value: number | null): number | null =>\n value !== null && Number.isFinite(value) ? value : null;\n\nconst finiteBound = (value: number | undefined): number | undefined =>\n value !== undefined && Number.isFinite(value) ? value : undefined;\n\nconst stepPrecision = (step: number): number => {\n const text = String(step).toLowerCase();\n const [coefficient, exponentText] = text.split('e');\n const decimals = coefficient.split('.')[1]?.length ?? 0;\n const exponent = Number(exponentText ?? 0);\n return Math.max(0, Math.min(20, decimals - exponent));\n};\n\nconst normalizeValue = (\n value: number | null,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n maximumFractionDigits: number,\n): number | null => {\n if (value === null) return null;\n const minimum = finiteBound(min);\n const maximum = finiteBound(max);\n let normalized = Math.min(\n maximum ?? Number.POSITIVE_INFINITY,\n Math.max(minimum ?? Number.NEGATIVE_INFINITY, value),\n );\n if (step !== undefined && Number.isFinite(step) && step > 0) {\n const base = minimum ?? 0;\n normalized = base + Math.round((normalized - base) / step) * step;\n if (maximum !== undefined && normalized > maximum)\n normalized = base + Math.floor((maximum - base) / step) * step;\n normalized = Math.min(\n maximum ?? Number.POSITIVE_INFINITY,\n Math.max(minimum ?? Number.NEGATIVE_INFINITY, normalized),\n );\n normalized = Number(normalized.toFixed(stepPrecision(step)));\n }\n return Number(\n new Intl.NumberFormat('en-US-u-nu-latn', {\n useGrouping: false,\n maximumFractionDigits,\n }).format(normalized),\n );\n};\n\nconst validLocale = (candidate: string | undefined, fallback: string): string => {\n if (!candidate) return fallback;\n try {\n return new Intl.Locale(candidate).toString();\n } catch {\n return fallback;\n }\n};\n\nconst partAttributes = (part: NumberInputPartAttributes | undefined) => ({\n ...part,\n style: part?.style as CSSProperties | undefined,\n});\n\n/**\n * A controlled, locale-aware number input with a Components-owned public contract.\n * Parsing, incomplete edit text, range and step normalization, keyboard behavior, mobile input\n * mode, and localized formatting remain internal to this boundary.\n */\nexport const NumberInput = ({\n value,\n onChange,\n onCommit,\n locale,\n useGrouping = true,\n minimumFractionDigits,\n maximumFractionDigits,\n required = false,\n min,\n max,\n step,\n prefix,\n suffix,\n placeholder,\n disabled = false,\n readOnly = false,\n showSteppers = true,\n invalid = false,\n id,\n name,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n description,\n errorMessage,\n className,\n pt,\n}: NumberInputProps) => {\n const generatedId = useId();\n const { locale: providerLocale } = useLocale();\n const resolvedLocale = validLocale(locale, providerLocale);\n const inputId = id ?? `cratis-number-input-${generatedId}`;\n const prefixId =\n prefix !== null && prefix !== undefined ? `${inputId}-prefix` : undefined;\n const suffixId =\n suffix !== null && suffix !== undefined ? `${inputId}-suffix` : undefined;\n const descriptionId =\n description !== null && description !== undefined\n ? `${inputId}-description`\n : undefined;\n const errorId =\n invalid && errorMessage !== null && errorMessage !== undefined\n ? `${inputId}-error`\n : undefined;\n const describedBy =\n [ariaDescribedBy, prefixId, suffixId, descriptionId, errorId]\n .filter(Boolean)\n .join(' ') || undefined;\n const controlledValue = semanticValue(value);\n const latestValue = useRef<number | null>(controlledValue);\n latestValue.current = controlledValue;\n const formatOptions = useMemo(\n () => ({\n useGrouping,\n minimumFractionDigits,\n maximumFractionDigits,\n }),\n [useGrouping, minimumFractionDigits, maximumFractionDigits],\n );\n const resolvedMaximumFractionDigits = useMemo(\n () =>\n new Intl.NumberFormat(resolvedLocale, formatOptions).resolvedOptions()\n .maximumFractionDigits ?? 3,\n [resolvedLocale, formatOptions],\n );\n const normalizedControlledValue = normalizeValue(\n controlledValue,\n min,\n max,\n step,\n resolvedMaximumFractionDigits,\n );\n const normalizationPending =\n controlledValue !== null && normalizedControlledValue !== controlledValue;\n const normalizationRequest = useRef<{\n value: number;\n normalized: number;\n } | null>(null);\n useLayoutEffect(() => {\n if (\n controlledValue === null ||\n normalizedControlledValue === null ||\n normalizedControlledValue === controlledValue\n ) {\n normalizationRequest.current = null;\n return;\n }\n const previous = normalizationRequest.current;\n if (\n previous?.value === controlledValue &&\n previous.normalized === normalizedControlledValue\n )\n return;\n normalizationRequest.current = {\n value: controlledValue,\n normalized: normalizedControlledValue,\n };\n latestValue.current = normalizedControlledValue;\n onChange(normalizedControlledValue);\n }, [controlledValue, normalizedControlledValue, onChange]);\n const displayedFormatOptions = normalizationPending\n ? {\n useGrouping,\n minimumFractionDigits: 0,\n maximumFractionDigits: 20,\n }\n : formatOptions;\n\n const emitChange = (nextValue: number) => {\n const nextSemanticValue = normalizeValue(\n semanticValue(nextValue),\n min,\n max,\n step,\n resolvedMaximumFractionDigits,\n );\n latestValue.current = nextSemanticValue;\n onChange(nextSemanticValue);\n };\n const scheduleCommit = (reason: NumberInputCommitReason) => {\n queueMicrotask(() => onCommit?.(latestValue.current, reason));\n };\n\n const field = (\n <AriaNumberField\n {...partAttributes(pt?.root)}\n id={inputId}\n name={normalizationPending ? undefined : name}\n value={controlledValue ?? Number.NaN}\n onChange={emitChange}\n minValue={min}\n maxValue={max}\n step={step}\n formatOptions={displayedFormatOptions}\n commitBehavior='validate'\n validationBehavior='aria'\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n isInvalid={invalid}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n onBlur={() => scheduleCommit(NumberInputCommitReason.Blur)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') scheduleCommit(NumberInputCommitReason.Enter);\n else if (event.key === 'ArrowUp' || event.key === 'ArrowDown')\n scheduleCommit(NumberInputCommitReason.Step);\n }}\n className={classNames('cratis-number-input', pt?.root?.className, className)}\n style={pt?.root?.style as CSSProperties | undefined}\n data-cratis-part='root'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n data-empty={controlledValue === null || undefined}\n >\n {({ state }) => {\n const parsedValue = semanticValue(state.numberValue);\n latestValue.current = parsedValue;\n return (\n <>\n <Group\n {...partAttributes(pt?.group)}\n className={classNames(\n 'cratis-number-input__group',\n pt?.group?.className,\n )}\n style={pt?.group?.style as CSSProperties | undefined}\n data-cratis-part='group'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n >\n <div className='cratis-number-input__control'>\n {prefixId && (\n <span\n {...partAttributes(pt?.prefix)}\n id={prefixId}\n className={classNames(\n 'cratis-number-input__adornment',\n 'cratis-number-input__prefix',\n pt?.prefix?.className,\n )}\n style={\n pt?.prefix?.style as CSSProperties | undefined\n }\n data-cratis-part='prefix'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n >\n {prefix}\n </span>\n )}\n <Input\n {...partAttributes(pt?.input)}\n placeholder={placeholder}\n aria-errormessage={errorId}\n className={classNames(\n 'cratis-number-input__input',\n pt?.input?.className,\n )}\n style={pt?.input?.style as CSSProperties | undefined}\n render={(inputProps) => (\n <input\n {...inputProps}\n required={required}\n onPaste={(event) => {\n const input = event.currentTarget;\n const isFullFieldPaste =\n (input.selectionStart ?? -1) === 0 &&\n input.selectionEnd ===\n input.value.length;\n inputProps.onPaste?.(event);\n // React Aria commits full-field paste text in its input handler. Emit\n // after that handler so change and commit remain one browser event\n // transaction instead of depending on queued controlled-render timing.\n if (isFullFieldPaste)\n onCommit?.(\n latestValue.current,\n NumberInputCommitReason.Paste,\n );\n }}\n aria-describedby={describedBy}\n aria-errormessage={errorId}\n data-cratis-part='input'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n />\n )}\n />\n {suffixId && (\n <span\n {...partAttributes(pt?.suffix)}\n id={suffixId}\n className={classNames(\n 'cratis-number-input__adornment',\n 'cratis-number-input__suffix',\n pt?.suffix?.className,\n )}\n style={\n pt?.suffix?.style as CSSProperties | undefined\n }\n data-cratis-part='suffix'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n >\n {suffix}\n </span>\n )}\n </div>\n {showSteppers && (\n <div className='cratis-number-input__steps'>\n <Button\n {...partAttributes(pt?.step)}\n slot='decrement'\n className={classNames(\n 'cratis-number-input__step',\n pt?.step?.className,\n )}\n style={\n pt?.step?.style as CSSProperties | undefined\n }\n onPress={() =>\n scheduleCommit(NumberInputCommitReason.Step)\n }\n render={(buttonProps) => (\n <button\n {...buttonProps}\n aria-labelledby={\n ariaLabelledBy\n ? [buttonProps.id, ariaLabelledBy]\n .filter(Boolean)\n .join(' ')\n : buttonProps['aria-labelledby']\n }\n data-cratis-part='step'\n data-step='decrement'\n data-disabled={\n buttonProps.disabled || undefined\n }\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n />\n )}\n >\n <span aria-hidden='true'>−</span>\n </Button>\n <Button\n {...partAttributes(pt?.step)}\n slot='increment'\n className={classNames(\n 'cratis-number-input__step',\n pt?.step?.className,\n )}\n style={\n pt?.step?.style as CSSProperties | undefined\n }\n onPress={() =>\n scheduleCommit(NumberInputCommitReason.Step)\n }\n render={(buttonProps) => (\n <button\n {...buttonProps}\n aria-labelledby={\n ariaLabelledBy\n ? [buttonProps.id, ariaLabelledBy]\n .filter(Boolean)\n .join(' ')\n : buttonProps['aria-labelledby']\n }\n data-cratis-part='step'\n data-step='increment'\n data-disabled={\n buttonProps.disabled || undefined\n }\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n />\n )}\n >\n <span aria-hidden='true'>+</span>\n </Button>\n </div>\n )}\n </Group>\n {descriptionId && (\n <span\n {...partAttributes(pt?.description)}\n id={descriptionId}\n className={classNames(\n 'cratis-number-input__description',\n pt?.description?.className,\n )}\n style={\n pt?.description?.style as CSSProperties | undefined\n }\n data-cratis-part='description'\n >\n {description}\n </span>\n )}\n {errorId && (\n <span\n {...partAttributes(pt?.error)}\n id={errorId}\n className={classNames(\n 'cratis-number-input__error',\n pt?.error?.className,\n )}\n style={pt?.error?.style as CSSProperties | undefined}\n data-cratis-part='error'\n data-invalid\n >\n {errorMessage}\n </span>\n )}\n </>\n );\n }}\n </AriaNumberField>\n );\n\n return resolvedLocale === providerLocale ? (\n field\n ) : (\n <I18nProvider locale={resolvedLocale}>{field}</I18nProvider>\n );\n};\n"],"names":["_jsx","AriaNumberField","_jsxs","_Fragment"],"mappings":";;;;;;;AA+GA,MAAM,aAAa,GAAG,CAAC,KAAoB,KACvC,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI;AAE3D,MAAM,WAAW,GAAG,CAAC,KAAyB,KAC1C,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,SAAS;AAErE,MAAM,aAAa,GAAG,CAAC,IAAY,KAAY;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;AACvC,IAAA,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AACnD,IAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC;IACvD,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,IAAI,CAAC,CAAC;AAC1C,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC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,WAAW,EAAA,eAAA,EAEjB,WAAW,CAAC,QAAQ,IAAI,SAAS,EAAA,cAAA,EAEvB,OAAO,IAAI,SAAS,EAAA,eAAA,EACnB,QAAQ,IAAI,SAAS,EAAA,CACtC,CACL,EAAA,QAAA,EAEDA,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EAAkB,MAAM,kBAAS,EAAA,CAC5B,CAAA,EAAA,CACP,CACT,CAAA,EAAA,CACG,EACP,aAAa,KACVA,GAAA,CAAA,MAAA,EAAA,EAAA,GACQ,cAAc,CAAC,EAAE,EAAE,WAAW,CAAC,EACnC,EAAE,EAAE,aAAa,EACjB,SAAS,EAAE,UAAU,CACjB,kCAAkC,EAClC,EAAE,EAAE,WAAW,EAAE,SAAS,CAC7B,EACD,KAAK,EACD,EAAE,EAAE,WAAW,EAAE,KAAkC,EAAA,kBAAA,EAEtC,aAAa,EAAA,QAAA,EAE7B,WAAW,EAAA,CACT,CACV,EACA,OAAO,KACJA,GAAA,CAAA,MAAA,EAAA,EAAA,GACQ,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,EAC7B,EAAE,EAAE,OAAO,EACX,SAAS,EAAE,UAAU,CACjB,4BAA4B,EAC5B,EAAE,EAAE,KAAK,EAAE,SAAS,CACvB,EACD,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAkC,EAAA,kBAAA,EACnC,OAAO,EAAA,cAAA,EAAA,IAAA,EAAA,QAAA,EAGvB,YAAY,EAAA,CACV,CACV,CAAA,EAAA,CACF;QAEX,CAAC,EAAA,CACa,CACrB;IAED,OAAO,cAAc,KAAK,cAAc,IACpC,KAAK,KAELA,GAAA,CAAC,YAAY,EAAA,EAAC,MAAM,EAAE,cAAc,EAAA,QAAA,EAAG,KAAK,EAAA,CAAgB,CAC/D;AACL;;"}
|
|
1
|
+
{"version":3,"file":"NumberInput.js","sources":["../../../Common/NumberInput.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 {\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport {\n Button,\n Group,\n Input,\n NumberField as AriaNumberField,\n} from 'react-aria-components/NumberField';\nimport { I18nProvider, useLocale } from 'react-aria-components/I18nProvider';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { NumberInputCommitReason } from './NumberInputCommitReason';\nimport type { NumberInputPartAttributes } from './NumberInputPartAttributes';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Stable Cratis-owned parts for styling a {@link NumberInput}. */\nexport interface NumberInputParts {\n /** Complete number-field wrapper. */\n root?: NumberInputPartAttributes;\n /** The bordered box holding the adornments, the input and the steppers. */\n group?: NumberInputPartAttributes;\n /** Editable localized input. */\n input?: NumberInputPartAttributes;\n /** Prefix adornment, when supplied. */\n prefix?: NumberInputPartAttributes;\n /** Suffix adornment, when supplied. */\n suffix?: NumberInputPartAttributes;\n /** Both decrement and increment buttons, distinguished by `data-step`. */\n step?: NumberInputPartAttributes;\n /** Supporting description, when supplied. */\n description?: NumberInputPartAttributes;\n /** Validation message, when supplied while invalid. */\n error?: NumberInputPartAttributes;\n}\n\nconst numberInputPartsMatchManifest: ExactPartKeys<\n NumberInputParts,\n PartsOf<'NumberInput'>\n> = true;\nvoid numberInputPartsMatchManifest;\n\n/** Props for {@link NumberInput}. */\nexport interface NumberInputProps {\n /** Controlled finite number, or `null` for an empty input. */\n value: number | null;\n /** Receives accepted semantic values. Incomplete text never emits `0` or `NaN`. */\n onChange: (value: number | null) => void;\n /**\n * Runs after a blur, Enter, full-field paste, arrow key, or step-button commit.\n * When the semantic value changes, `onChange` runs before `onCommit`.\n */\n onCommit?: (value: number | null, reason: NumberInputCommitReason) => void;\n /** BCP 47 locale override. Defaults to the nearest {@link CratisComponentsProvider}. */\n locale?: string;\n /** Enables locale grouping separators. Defaults to `true`. */\n useGrouping?: boolean;\n /** Minimum displayed fraction digits. */\n minimumFractionDigits?: number;\n /** Maximum fraction digits retained on commit and shown in the formatted value. */\n maximumFractionDigits?: number;\n /** Requires a non-empty value and exposes native required-field semantics. */\n required?: boolean;\n /** Minimum value; committed edits below it snap to this boundary. */\n min?: number;\n /** Maximum value; committed edits above it snap to this boundary. */\n max?: number;\n /** Increment, decrement, and commit snapping interval. Defaults to `1`. */\n step?: number;\n /** Visible content before the editable number; excluded from parsing. */\n prefix?: ReactNode;\n /** Visible content after the editable number; excluded from parsing. */\n suffix?: ReactNode;\n /** Placeholder shown while empty. */\n placeholder?: string;\n /** Disables editing, focus, step controls, and form submission. */\n disabled?: boolean;\n /** Prevents editing while retaining the value and focus semantics. */\n readOnly?: boolean;\n /** Renders the decrement/increment buttons. Keyboard stepping stays available when they are hidden. */\n showSteppers?: boolean;\n /** Marks the control invalid. */\n invalid?: boolean;\n /** Stable id for the editable input and external label association. */\n id?: string;\n /** Native form field name; an associated hidden input submits the semantic value. */\n name?: string;\n /** Accessible name when no external label identifies the input. */\n 'aria-label'?: string;\n /** Id of an external element that labels the input and its step actions. */\n 'aria-labelledby'?: string;\n /** Additional external description ids. */\n 'aria-describedby'?: string;\n /** Supporting description associated with the editable input. */\n description?: ReactNode;\n /** Error message rendered and associated while `invalid` is true. */\n errorMessage?: ReactNode;\n /** Additional CSS class for the root part. */\n className?: string;\n /** Cratis-owned per-part attributes. */\n pt?: NumberInputParts;\n}\n\nconst semanticValue = (value: number | null): number | null =>\n value !== null && Number.isFinite(value) ? value : null;\n\nconst finiteBound = (value: number | undefined): number | undefined =>\n value !== undefined && Number.isFinite(value) ? value : undefined;\n\nconst stepPrecision = (step: number): number => {\n const text = String(step).toLowerCase();\n const [coefficient, exponentText] = text.split('e');\n const decimals = coefficient.split('.')[1]?.length ?? 0;\n const exponent = Number(exponentText ?? 0);\n return Math.max(0, Math.min(20, decimals - exponent));\n};\n\nconst normalizeValue = (\n value: number | null,\n min: number | undefined,\n max: number | undefined,\n step: number | undefined,\n maximumFractionDigits: number,\n): number | null => {\n if (value === null) return null;\n const minimum = finiteBound(min);\n const maximum = finiteBound(max);\n let normalized = Math.min(\n maximum ?? Number.POSITIVE_INFINITY,\n Math.max(minimum ?? Number.NEGATIVE_INFINITY, value),\n );\n if (step !== undefined && Number.isFinite(step) && step > 0) {\n const base = minimum ?? 0;\n normalized = base + Math.round((normalized - base) / step) * step;\n if (maximum !== undefined && normalized > maximum)\n normalized = base + Math.floor((maximum - base) / step) * step;\n normalized = Math.min(\n maximum ?? Number.POSITIVE_INFINITY,\n Math.max(minimum ?? Number.NEGATIVE_INFINITY, normalized),\n );\n normalized = Number(normalized.toFixed(stepPrecision(step)));\n }\n return Number(\n new Intl.NumberFormat('en-US-u-nu-latn', {\n useGrouping: false,\n maximumFractionDigits,\n }).format(normalized),\n );\n};\n\nconst validLocale = (candidate: string | undefined, fallback: string): string => {\n if (!candidate) return fallback;\n try {\n return new Intl.Locale(candidate).toString();\n } catch {\n return fallback;\n }\n};\n\nconst partAttributes = (part: NumberInputPartAttributes | undefined) => ({\n ...part,\n style: part?.style as CSSProperties | undefined,\n});\n\n/**\n * A controlled, locale-aware number input with a Components-owned public contract.\n * Parsing, incomplete edit text, range and step normalization, keyboard behavior, mobile input\n * mode, and localized formatting remain internal to this boundary.\n */\nexport const NumberInput = ({\n value,\n onChange,\n onCommit,\n locale,\n useGrouping = true,\n minimumFractionDigits,\n maximumFractionDigits,\n required = false,\n min,\n max,\n step,\n prefix,\n suffix,\n placeholder,\n disabled = false,\n readOnly = false,\n showSteppers = true,\n invalid = false,\n id,\n name,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n description,\n errorMessage,\n className,\n pt,\n}: NumberInputProps) => {\n const generatedId = useId();\n const { locale: providerLocale } = useLocale();\n const resolvedLocale = validLocale(locale, providerLocale);\n const inputId = id ?? `cratis-number-input-${generatedId}`;\n const prefixId =\n prefix !== null && prefix !== undefined ? `${inputId}-prefix` : undefined;\n const suffixId =\n suffix !== null && suffix !== undefined ? `${inputId}-suffix` : undefined;\n const descriptionId =\n description !== null && description !== undefined\n ? `${inputId}-description`\n : undefined;\n const errorId =\n invalid && errorMessage !== null && errorMessage !== undefined\n ? `${inputId}-error`\n : undefined;\n const describedBy =\n [ariaDescribedBy, prefixId, suffixId, descriptionId, errorId]\n .filter(Boolean)\n .join(' ') || undefined;\n const controlledValue = semanticValue(value);\n const latestValue = useRef<number | null>(controlledValue);\n latestValue.current = controlledValue;\n const formatOptions = useMemo(\n () => ({\n useGrouping,\n minimumFractionDigits,\n maximumFractionDigits,\n }),\n [useGrouping, minimumFractionDigits, maximumFractionDigits],\n );\n const resolvedMaximumFractionDigits = useMemo(\n () =>\n new Intl.NumberFormat(resolvedLocale, formatOptions).resolvedOptions()\n .maximumFractionDigits ?? 3,\n [resolvedLocale, formatOptions],\n );\n const normalizedControlledValue = normalizeValue(\n controlledValue,\n min,\n max,\n step,\n resolvedMaximumFractionDigits,\n );\n const normalizationPending =\n controlledValue !== null && normalizedControlledValue !== controlledValue;\n const normalizationRequest = useRef<{\n value: number;\n normalized: number;\n } | null>(null);\n useLayoutEffect(() => {\n if (\n controlledValue === null ||\n normalizedControlledValue === null ||\n normalizedControlledValue === controlledValue\n ) {\n normalizationRequest.current = null;\n return;\n }\n const previous = normalizationRequest.current;\n if (\n previous?.value === controlledValue &&\n previous.normalized === normalizedControlledValue\n )\n return;\n normalizationRequest.current = {\n value: controlledValue,\n normalized: normalizedControlledValue,\n };\n latestValue.current = normalizedControlledValue;\n onChange(normalizedControlledValue);\n }, [controlledValue, normalizedControlledValue, onChange]);\n const displayedFormatOptions = normalizationPending\n ? {\n useGrouping,\n minimumFractionDigits: 0,\n maximumFractionDigits: 20,\n }\n : formatOptions;\n\n const emitChange = (nextValue: number) => {\n const nextSemanticValue = normalizeValue(\n semanticValue(nextValue),\n min,\n max,\n step,\n resolvedMaximumFractionDigits,\n );\n latestValue.current = nextSemanticValue;\n onChange(nextSemanticValue);\n };\n const scheduleCommit = (reason: NumberInputCommitReason) => {\n queueMicrotask(() => onCommit?.(latestValue.current, reason));\n };\n\n const field = (\n <AriaNumberField\n {...partAttributes(pt?.root)}\n id={inputId}\n name={normalizationPending ? undefined : name}\n value={controlledValue ?? Number.NaN}\n onChange={emitChange}\n minValue={min}\n maxValue={max}\n step={step}\n formatOptions={displayedFormatOptions}\n commitBehavior='validate'\n validationBehavior='aria'\n isDisabled={disabled}\n isReadOnly={readOnly}\n isRequired={required}\n isInvalid={invalid}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n onBlur={() => scheduleCommit(NumberInputCommitReason.Blur)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') scheduleCommit(NumberInputCommitReason.Enter);\n else if (event.key === 'ArrowUp' || event.key === 'ArrowDown')\n scheduleCommit(NumberInputCommitReason.Step);\n }}\n className={classNames('cratis-number-input', pt?.root?.className, className)}\n style={pt?.root?.style as CSSProperties | undefined}\n data-cratis-part='root'\n data-cratis-component='NumberInput'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n data-empty={controlledValue === null || undefined}\n >\n {({ state }) => {\n const parsedValue = semanticValue(state.numberValue);\n latestValue.current = parsedValue;\n return (\n <>\n <Group\n {...partAttributes(pt?.group)}\n className={classNames(\n 'cratis-number-input__group',\n pt?.group?.className,\n )}\n style={pt?.group?.style as CSSProperties | undefined}\n data-cratis-part='group'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n >\n <div className='cratis-number-input__control'>\n {prefixId && (\n <span\n {...partAttributes(pt?.prefix)}\n id={prefixId}\n className={classNames(\n 'cratis-number-input__adornment',\n 'cratis-number-input__prefix',\n pt?.prefix?.className,\n )}\n style={\n pt?.prefix?.style as CSSProperties | undefined\n }\n data-cratis-part='prefix'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n >\n {prefix}\n </span>\n )}\n <Input\n {...partAttributes(pt?.input)}\n placeholder={placeholder}\n aria-errormessage={errorId}\n className={classNames(\n 'cratis-number-input__input',\n pt?.input?.className,\n )}\n style={pt?.input?.style as CSSProperties | undefined}\n render={(inputProps) => (\n <input\n {...inputProps}\n required={required}\n onPaste={(event) => {\n const input = event.currentTarget;\n const isFullFieldPaste =\n (input.selectionStart ?? -1) === 0 &&\n input.selectionEnd ===\n input.value.length;\n inputProps.onPaste?.(event);\n // React Aria commits full-field paste text in its input handler. Emit\n // after that handler so change and commit remain one browser event\n // transaction instead of depending on queued controlled-render timing.\n if (isFullFieldPaste)\n onCommit?.(\n latestValue.current,\n NumberInputCommitReason.Paste,\n );\n }}\n aria-describedby={describedBy}\n aria-errormessage={errorId}\n data-cratis-part='input'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n />\n )}\n />\n {suffixId && (\n <span\n {...partAttributes(pt?.suffix)}\n id={suffixId}\n className={classNames(\n 'cratis-number-input__adornment',\n 'cratis-number-input__suffix',\n pt?.suffix?.className,\n )}\n style={\n pt?.suffix?.style as CSSProperties | undefined\n }\n data-cratis-part='suffix'\n data-disabled={disabled || undefined}\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n >\n {suffix}\n </span>\n )}\n </div>\n {showSteppers && (\n <div className='cratis-number-input__steps'>\n <Button\n {...partAttributes(pt?.step)}\n slot='decrement'\n className={classNames(\n 'cratis-number-input__step',\n pt?.step?.className,\n )}\n style={\n pt?.step?.style as CSSProperties | undefined\n }\n onPress={() =>\n scheduleCommit(NumberInputCommitReason.Step)\n }\n render={(buttonProps) => (\n <button\n {...buttonProps}\n aria-labelledby={\n ariaLabelledBy\n ? [buttonProps.id, ariaLabelledBy]\n .filter(Boolean)\n .join(' ')\n : buttonProps['aria-labelledby']\n }\n data-cratis-part='step'\n data-step='decrement'\n data-disabled={\n buttonProps.disabled || undefined\n }\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n />\n )}\n >\n <span aria-hidden='true'>−</span>\n </Button>\n <Button\n {...partAttributes(pt?.step)}\n slot='increment'\n className={classNames(\n 'cratis-number-input__step',\n pt?.step?.className,\n )}\n style={\n pt?.step?.style as CSSProperties | undefined\n }\n onPress={() =>\n scheduleCommit(NumberInputCommitReason.Step)\n }\n render={(buttonProps) => (\n <button\n {...buttonProps}\n aria-labelledby={\n ariaLabelledBy\n ? [buttonProps.id, ariaLabelledBy]\n .filter(Boolean)\n .join(' ')\n : buttonProps['aria-labelledby']\n }\n data-cratis-part='step'\n data-step='increment'\n data-disabled={\n buttonProps.disabled || undefined\n }\n data-invalid={invalid || undefined}\n data-readonly={readOnly || undefined}\n />\n )}\n >\n <span aria-hidden='true'>+</span>\n </Button>\n </div>\n )}\n </Group>\n {descriptionId && (\n <span\n {...partAttributes(pt?.description)}\n id={descriptionId}\n className={classNames(\n 'cratis-number-input__description',\n pt?.description?.className,\n )}\n style={\n pt?.description?.style as CSSProperties | undefined\n }\n data-cratis-part='description'\n >\n {description}\n </span>\n )}\n {errorId && (\n <span\n {...partAttributes(pt?.error)}\n id={errorId}\n className={classNames(\n 'cratis-number-input__error',\n pt?.error?.className,\n )}\n style={pt?.error?.style as CSSProperties | undefined}\n data-cratis-part='error'\n data-invalid\n >\n {errorMessage}\n </span>\n )}\n </>\n );\n }}\n </AriaNumberField>\n );\n\n return resolvedLocale === providerLocale ? (\n field\n ) : (\n <I18nProvider locale={resolvedLocale}>{field}</I18nProvider>\n );\n};\n"],"names":["_jsx","AriaNumberField","_jsxs","_Fragment"],"mappings":";;;;;;;AA+GA,MAAM,aAAa,GAAG,CAAC,KAAoB,KACvC,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI;AAE3D,MAAM,WAAW,GAAG,CAAC,KAAyB,KAC1C,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK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OAAO,EACX,SAAS,EAAE,UAAU,CACjB,4BAA4B,EAC5B,EAAE,EAAE,KAAK,EAAE,SAAS,CACvB,EACD,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAkC,EAAA,kBAAA,EACnC,OAAO,EAAA,cAAA,EAAA,IAAA,EAAA,QAAA,EAGvB,YAAY,EAAA,CACV,CACV,CAAA,EAAA,CACF;QAEX,CAAC,EAAA,CACa,CACrB;IAED,OAAO,cAAc,KAAK,cAAc,IACpC,KAAK,KAELA,GAAA,CAAC,YAAY,EAAA,EAAC,MAAM,EAAE,cAAc,EAAA,QAAA,EAAG,KAAK,EAAA,CAAgB,CAC/D;AACL;;"}
|
|
@@ -38,5 +38,5 @@ export interface PageProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
38
38
|
*
|
|
39
39
|
* @param props - {@link PageProps}.
|
|
40
40
|
*/
|
|
41
|
-
export declare const Page: (
|
|
41
|
+
export declare const Page: (incomingProps: PageProps) => import("react").JSX.Element;
|
|
42
42
|
//# sourceMappingURL=Page.d.ts.map
|
|
@@ -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;
|
|
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,gCAW5C,CAAC"}
|
package/dist/esm/Common/Page.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { describeComponent } from '../configuration/identity/describeComponent.js';
|
|
3
|
+
import { useComponentPresentation } from '../configuration/identity/useComponentPresentation.js';
|
|
2
4
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
+
const pageDescriptor = describeComponent('Page', [
|
|
6
|
+
{ name: 'title', label: 'Title', type: 'string', description: 'The page title, shown when showTitle is on.' },
|
|
7
|
+
{ name: 'showTitle', label: 'Show title', type: 'boolean', defaultValue: false },
|
|
8
|
+
{ name: 'panel', label: 'Panel', type: 'boolean', defaultValue: false },
|
|
9
|
+
]);
|
|
10
|
+
const Page = (incomingProps) => {
|
|
11
|
+
const [props, marker] = useComponentPresentation(pageDescriptor, incomingProps, incomingProps.id);
|
|
12
|
+
const { title, showTitle = false, children, panel, className, ...rest } = props;
|
|
13
|
+
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("main", { className: `cratis:overflow-hidden cratis:h-full cratis:flex cratis:flex-col cratis:flex-1 ${panel ? 'panel' : ''}`, children: children })] }));
|
|
5
14
|
};
|
|
6
15
|
|
|
7
16
|
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';\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/**\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 = ({ title, showTitle = false, children, panel, className, ...rest }
|
|
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 <main className={`cratis:overflow-hidden cratis:h-full cratis:flex cratis:flex-col cratis:flex-1 ${panel ? 'panel' : ''}`}>\n {children}\n </main>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAsCA,MAAM,cAAc,GAAG,iBAAiB,CAAY,MAAM,EAAE;AACxD,IAAA,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;AAC7G,IAAA,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE;AAChF,IAAA,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE;AAC1E,CAAA,CAAC;AAeK,MAAM,IAAI,GAAG,CAAC,aAAwB,KAAI;AAC7C,IAAA,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,wBAAwB,CAAC,cAAc,EAAE,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC;AACjG,IAAA,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK;IAC/E,QACIA,iBAAS,MAAM,EAAE,SAAS,EAAE,CAAA,uDAAA,EAA0D,SAAS,GAAG,IAAI,SAAS,CAAA,CAAE,GAAG,EAAE,EAAE,EAAA,GAAM,IAAI,EAAA,QAAA,EAAA,CAC7H,SAAS,IAAIC,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,yCAAyC,EAAA,QAAA,EAAE,KAAK,EAAA,CAAM,EAClFA,cAAM,SAAS,EAAE,CAAA,+EAAA,EAAkF,KAAK,GAAG,OAAO,GAAG,EAAE,CAAA,CAAE,YACpH,QAAQ,EAAA,CACN,CAAA,EAAA,CACL;AAEd;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioImplementation.d.ts","sourceRoot":"","sources":["../../../Common/RadioImplementation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAG1C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"RadioImplementation.d.ts","sourceRoot":"","sources":["../../../Common/RadioImplementation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAG1C,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,yGAmI/B,CAAC"}
|
|
@@ -14,7 +14,7 @@ const RadioImplementation = forwardRef(function RadioImplementation({ name, valu
|
|
|
14
14
|
const { ref, selected, synchronize } = useNativeCheckedState(effectiveChecked, effectiveDefaultChecked, forwardedRef, true);
|
|
15
15
|
return (jsxs("label", { ...pt?.root, className: ['cratis-choice', pt?.root?.className, className]
|
|
16
16
|
.filter(Boolean)
|
|
17
|
-
.join(' '), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-disabled": effectiveDisabled || undefined, "data-invalid": effectiveInvalid || undefined, "data-readonly": effectiveReadOnly || undefined, "data-selected": selected || undefined, children: [jsx("input", { ...pt?.input, ...nativeProps, ref: ref, type: 'radio', name: name, value: value, checked: effectiveChecked, defaultChecked: effectiveDefaultChecked, disabled: effectiveDisabled, readOnly: undefined, "aria-invalid": effectiveAriaInvalid, onClick: (event) => {
|
|
17
|
+
.join(' '), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-cratis-component": 'Radio', "data-disabled": effectiveDisabled || undefined, "data-invalid": effectiveInvalid || undefined, "data-readonly": effectiveReadOnly || undefined, "data-selected": selected || undefined, children: [jsx("input", { ...pt?.input, ...nativeProps, ref: ref, type: 'radio', name: name, value: value, checked: effectiveChecked, defaultChecked: effectiveDefaultChecked, disabled: effectiveDisabled, readOnly: undefined, "aria-invalid": effectiveAriaInvalid, onClick: (event) => {
|
|
18
18
|
pt?.input?.onClick?.(event);
|
|
19
19
|
onClick?.(event);
|
|
20
20
|
if (effectiveReadOnly)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioImplementation.js","sources":["../../../Common/RadioImplementation.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 { forwardRef } from 'react';\nimport type { RadioProps } from './Radio';\nimport { useNativeCheckedState } from './useNativeCheckedState';\n\n/** Core implementation for the native radio presentation slot. */\nexport const RadioImplementation = forwardRef<HTMLInputElement, RadioProps>(\n function RadioImplementation(\n {\n name,\n value,\n label,\n readOnly,\n invalid = false,\n onChange,\n className,\n style,\n pt,\n checked,\n defaultChecked,\n disabled,\n onClick,\n 'aria-invalid': ariaInvalid,\n ...nativeProps\n },\n forwardedRef,\n ) {\n const effectiveChecked = checked ?? pt?.input?.checked;\n const effectiveDefaultChecked = defaultChecked ?? pt?.input?.defaultChecked;\n const effectiveDisabled = disabled ?? pt?.input?.disabled;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly;\n const effectiveAriaInvalid =\n ariaInvalid ?? pt?.input?.['aria-invalid'] ?? (invalid || undefined);\n const effectiveInvalid =\n invalid ||\n effectiveAriaInvalid === true ||\n effectiveAriaInvalid === 'true';\n const { ref, selected, synchronize } = useNativeCheckedState(\n effectiveChecked,\n effectiveDefaultChecked,\n forwardedRef,\n true,\n );\n return (\n <label\n {...pt?.root}\n className={['cratis-choice', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n <input\n {...pt?.input}\n {...nativeProps}\n ref={ref}\n type='radio'\n name={name}\n value={value}\n checked={effectiveChecked}\n defaultChecked={effectiveDefaultChecked}\n disabled={effectiveDisabled}\n readOnly={undefined}\n aria-invalid={effectiveAriaInvalid}\n onClick={(event) => {\n pt?.input?.onClick?.(event);\n onClick?.(event);\n if (effectiveReadOnly) event.preventDefault();\n }}\n onChange={(event) => {\n pt?.input?.onChange?.(event);\n if (effectiveReadOnly || !event.currentTarget.checked) return;\n synchronize(true);\n onChange?.(true, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n className={['cratis-choice__input', pt?.input?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='input'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n <span\n {...pt?.box}\n className={['cratis-radio__box', pt?.box?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='box'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n aria-hidden='true'\n >\n <span\n {...pt?.indicator}\n className={[\n 'cratis-radio__indicator',\n pt?.indicator?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='indicator'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n </span>\n {label !== undefined && (\n <span\n {...pt?.label}\n className={['cratis-choice__label', pt?.label?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='label'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n {label}\n </span>\n )}\n </label>\n );\n },\n);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;MAQa,mBAAmB,GAAG,UAAU,CACzC,SAAS,mBAAmB,CACxB,EACI,IAAI,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,KAAK,EACL,EAAE,EACF,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,cAAc,EAAE,WAAW,EAC3B,GAAG,WAAW,EACjB,EACD,YAAY,EAAA;IAEZ,MAAM,gBAAgB,GAAG,OAAO,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IACtD,MAAM,uBAAuB,GAAG,cAAc,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc;IAC3E,MAAM,iBAAiB,GAAG,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ;IACzD,MAAM,iBAAiB,GAAG,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ;AACzD,IAAA,MAAM,oBAAoB,GACtB,WAAW,IAAI,EAAE,EAAE,KAAK,GAAG,cAAc,CAAC,KAAK,OAAO,IAAI,SAAS,CAAC;IACxE,MAAM,gBAAgB,GAClB,OAAO;AACP,QAAA,oBAAoB,KAAK,IAAI;QAC7B,oBAAoB,KAAK,MAAM;AACnC,IAAA,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,qBAAqB,CACxD,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,IAAI,CACP;AACD,IAAA,QACIA,IAAA,CAAA,OAAA,EAAA,EAAA,GACQ,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,CAAC,eAAe,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;aACtD,MAAM,CAAC,OAAO;AACd,aAAA,IAAI,CAAC,GAAG,CAAC,EACd,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAA,
|
|
1
|
+
{"version":3,"file":"RadioImplementation.js","sources":["../../../Common/RadioImplementation.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 { forwardRef } from 'react';\nimport type { RadioProps } from './Radio';\nimport { useNativeCheckedState } from './useNativeCheckedState';\n\n/** Core implementation for the native radio presentation slot. */\nexport const RadioImplementation = forwardRef<HTMLInputElement, RadioProps>(\n function RadioImplementation(\n {\n name,\n value,\n label,\n readOnly,\n invalid = false,\n onChange,\n className,\n style,\n pt,\n checked,\n defaultChecked,\n disabled,\n onClick,\n 'aria-invalid': ariaInvalid,\n ...nativeProps\n },\n forwardedRef,\n ) {\n const effectiveChecked = checked ?? pt?.input?.checked;\n const effectiveDefaultChecked = defaultChecked ?? pt?.input?.defaultChecked;\n const effectiveDisabled = disabled ?? pt?.input?.disabled;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly;\n const effectiveAriaInvalid =\n ariaInvalid ?? pt?.input?.['aria-invalid'] ?? (invalid || undefined);\n const effectiveInvalid =\n invalid ||\n effectiveAriaInvalid === true ||\n effectiveAriaInvalid === 'true';\n const { ref, selected, synchronize } = useNativeCheckedState(\n effectiveChecked,\n effectiveDefaultChecked,\n forwardedRef,\n true,\n );\n return (\n <label\n {...pt?.root}\n className={['cratis-choice', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='Radio'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n <input\n {...pt?.input}\n {...nativeProps}\n ref={ref}\n type='radio'\n name={name}\n value={value}\n checked={effectiveChecked}\n defaultChecked={effectiveDefaultChecked}\n disabled={effectiveDisabled}\n readOnly={undefined}\n aria-invalid={effectiveAriaInvalid}\n onClick={(event) => {\n pt?.input?.onClick?.(event);\n onClick?.(event);\n if (effectiveReadOnly) event.preventDefault();\n }}\n onChange={(event) => {\n pt?.input?.onChange?.(event);\n if (effectiveReadOnly || !event.currentTarget.checked) return;\n synchronize(true);\n onChange?.(true, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n className={['cratis-choice__input', pt?.input?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='input'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n <span\n {...pt?.box}\n className={['cratis-radio__box', pt?.box?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='box'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n aria-hidden='true'\n >\n <span\n {...pt?.indicator}\n className={[\n 'cratis-radio__indicator',\n pt?.indicator?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='indicator'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n </span>\n {label !== undefined && (\n <span\n {...pt?.label}\n className={['cratis-choice__label', pt?.label?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='label'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n {label}\n </span>\n )}\n </label>\n );\n },\n);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;MAQa,mBAAmB,GAAG,UAAU,CACzC,SAAS,mBAAmB,CACxB,EACI,IAAI,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,KAAK,EACL,EAAE,EACF,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,cAAc,EAAE,WAAW,EAC3B,GAAG,WAAW,EACjB,EACD,YAAY,EAAA;IAEZ,MAAM,gBAAgB,GAAG,OAAO,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IACtD,MAAM,uBAAuB,GAAG,cAAc,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc;IAC3E,MAAM,iBAAiB,GAAG,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ;IACzD,MAAM,iBAAiB,GAAG,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ;AACzD,IAAA,MAAM,oBAAoB,GACtB,WAAW,IAAI,EAAE,EAAE,KAAK,GAAG,cAAc,CAAC,KAAK,OAAO,IAAI,SAAS,CAAC;IACxE,MAAM,gBAAgB,GAClB,OAAO;AACP,QAAA,oBAAoB,KAAK,IAAI;QAC7B,oBAAoB,KAAK,MAAM;AACnC,IAAA,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,qBAAqB,CACxD,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,IAAI,CACP;AACD,IAAA,QACIA,IAAA,CAAA,OAAA,EAAA,EAAA,GACQ,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,CAAC,eAAe,E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AC,OAAO;qBACd,IAAI,CAAC,GAAG,CAAC,EAAA,kBAAA,EACG,OAAO,EAAA,eAAA,EACT,iBAAiB,IAAI,SAAS,EAAA,cAAA,EAC/B,gBAAgB,IAAI,SAAS,EAAA,eAAA,EAC5B,iBAAiB,IAAI,SAAS,EAAA,eAAA,EAC9B,QAAQ,IAAI,SAAS,EAAA,QAAA,EAEnC,KAAK,EAAA,CACH,CACV,CAAA,EAAA,CACG;AAEhB,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceImplementation.d.ts","sourceRoot":"","sources":["../../../Common/SurfaceImplementation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAW,CAAC;AAO9C,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"SurfaceImplementation.d.ts","sourceRoot":"","sources":["../../../Common/SurfaceImplementation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAW,CAAC;AAO9C,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,sGAqBjC,CAAC"}
|
|
@@ -12,7 +12,7 @@ const SurfaceImplementation = forwardRef(function SurfaceImplementation({ as: El
|
|
|
12
12
|
assignSurfaceRef(ref, element);
|
|
13
13
|
}, className: ['cratis-surface', pt?.root?.className, className]
|
|
14
14
|
.filter(Boolean)
|
|
15
|
-
.join(' '), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root' }));
|
|
15
|
+
.join(' '), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-cratis-component": 'Surface' }));
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export { SurfaceImplementation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceImplementation.js","sources":["../../../Common/SurfaceImplementation.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 { forwardRef, type ForwardedRef } from 'react';\nimport type { SurfaceProps } from './Surface';\n\nconst assignSurfaceRef = (ref: ForwardedRef<HTMLElement>, element: HTMLElement | null) => {\n if (typeof ref === 'function') ref(element);\n else if (ref) ref.current = element;\n};\n\n/** Core implementation for the semantic-surface presentation slot. */\nexport const SurfaceImplementation = forwardRef<HTMLElement, SurfaceProps>(\n function SurfaceImplementation(\n { as: Element = 'div', pt, className, style, ...nativeProps },\n ref,\n ) {\n return (\n <Element\n {...pt?.root}\n {...nativeProps}\n ref={(element) => {\n assignSurfaceRef(ref, element);\n }}\n className={['cratis-surface', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n />\n );\n },\n);\n"],"names":["_jsx"],"mappings":";;;AAMA,MAAM,gBAAgB,GAAG,CAAC,GAA8B,EAAE,OAA2B,KAAI;IACrF,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,GAAG,CAAC,OAAO,CAAC;AACtC,SAAA,IAAI,GAAG;AAAE,QAAA,GAAG,CAAC,OAAO,GAAG,OAAO;AACvC,CAAC;AAGM,MAAM,qBAAqB,GAAG,UAAU,CAC3C,SAAS,qBAAqB,CAC1B,EAAE,EAAE,EAAE,OAAO,GAAG,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,EAC7D,GAAG,EAAA;AAEH,IAAA,QACIA,GAAA,CAAC,OAAO,EAAA,EAAA,GACA,EAAE,EAAE,IAAI,EAAA,GACR,WAAW,EACf,GAAG,EAAE,CAAC,OAAO,KAAI;AACb,YAAA,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC;AAClC,QAAA,CAAC,EACD,SAAS,EAAE,CAAC,gBAAgB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;aACvD,MAAM,CAAC,OAAO;aACd,IAAI,CAAC,GAAG,CAAC,EACd,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAA,kBAAA,EACtB,MAAM,EAAA,
|
|
1
|
+
{"version":3,"file":"SurfaceImplementation.js","sources":["../../../Common/SurfaceImplementation.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 { forwardRef, type ForwardedRef } from 'react';\nimport type { SurfaceProps } from './Surface';\n\nconst assignSurfaceRef = (ref: ForwardedRef<HTMLElement>, element: HTMLElement | null) => {\n if (typeof ref === 'function') ref(element);\n else if (ref) ref.current = element;\n};\n\n/** Core implementation for the semantic-surface presentation slot. */\nexport const SurfaceImplementation = forwardRef<HTMLElement, SurfaceProps>(\n function SurfaceImplementation(\n { as: Element = 'div', pt, className, style, ...nativeProps },\n ref,\n ) {\n return (\n <Element\n {...pt?.root}\n {...nativeProps}\n ref={(element) => {\n assignSurfaceRef(ref, element);\n }}\n className={['cratis-surface', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='Surface'\n />\n );\n },\n);\n"],"names":["_jsx"],"mappings":";;;AAMA,MAAM,gBAAgB,GAAG,CAAC,GAA8B,EAAE,OAA2B,KAAI;IACrF,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,GAAG,CAAC,OAAO,CAAC;AACtC,SAAA,IAAI,GAAG;AAAE,QAAA,GAAG,CAAC,OAAO,GAAG,OAAO;AACvC,CAAC;AAGM,MAAM,qBAAqB,GAAG,UAAU,CAC3C,SAAS,qBAAqB,CAC1B,EAAE,EAAE,EAAE,OAAO,GAAG,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,EAC7D,GAAG,EAAA;AAEH,IAAA,QACIA,GAAA,CAAC,OAAO,EAAA,EAAA,GACA,EAAE,EAAE,IAAI,EAAA,GACR,WAAW,EACf,GAAG,EAAE,CAAC,OAAO,KAAI;AACb,YAAA,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC;AAClC,QAAA,CAAC,EACD,SAAS,EAAE,CAAC,gBAAgB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;aACvD,MAAM,CAAC,OAAO;aACd,IAAI,CAAC,GAAG,CAAC,EACd,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAA,kBAAA,EACtB,MAAM,EAAA,uBAAA,EACD,SAAS,EAAA,CACjC;AAEV,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchImplementation.d.ts","sourceRoot":"","sources":["../../../Common/SwitchImplementation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAG5C,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"SwitchImplementation.d.ts","sourceRoot":"","sources":["../../../Common/SwitchImplementation.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAU,CAAC;AAG5C,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,0GAgIhC,CAAC"}
|
|
@@ -14,7 +14,7 @@ const SwitchImplementation = forwardRef(function SwitchImplementation({ label, r
|
|
|
14
14
|
const { ref, selected, synchronize } = useNativeCheckedState(effectiveChecked, effectiveDefaultChecked, forwardedRef);
|
|
15
15
|
return (jsxs("label", { ...pt?.root, className: ['cratis-choice', pt?.root?.className, className]
|
|
16
16
|
.filter(Boolean)
|
|
17
|
-
.join(' '), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-disabled": effectiveDisabled || undefined, "data-invalid": effectiveInvalid || undefined, "data-readonly": effectiveReadOnly || undefined, "data-selected": selected || undefined, children: [jsx("input", { ...pt?.input, ...nativeProps, ref: ref, type: 'checkbox', role: 'switch', checked: effectiveChecked, defaultChecked: effectiveDefaultChecked, disabled: effectiveDisabled, readOnly: undefined, "aria-invalid": effectiveAriaInvalid, "aria-readonly": effectiveReadOnly || undefined, onClick: (event) => {
|
|
17
|
+
.join(' '), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-cratis-component": 'Switch', "data-disabled": effectiveDisabled || undefined, "data-invalid": effectiveInvalid || undefined, "data-readonly": effectiveReadOnly || undefined, "data-selected": selected || undefined, children: [jsx("input", { ...pt?.input, ...nativeProps, ref: ref, type: 'checkbox', role: 'switch', checked: effectiveChecked, defaultChecked: effectiveDefaultChecked, disabled: effectiveDisabled, readOnly: undefined, "aria-invalid": effectiveAriaInvalid, "aria-readonly": effectiveReadOnly || undefined, onClick: (event) => {
|
|
18
18
|
pt?.input?.onClick?.(event);
|
|
19
19
|
onClick?.(event);
|
|
20
20
|
if (effectiveReadOnly)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchImplementation.js","sources":["../../../Common/SwitchImplementation.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 { forwardRef } from 'react';\nimport type { SwitchProps } from './Switch';\nimport { useNativeCheckedState } from './useNativeCheckedState';\n\n/** Core implementation for the native switch presentation slot. */\nexport const SwitchImplementation = forwardRef<HTMLInputElement, SwitchProps>(\n function SwitchImplementation(\n {\n label,\n readOnly,\n invalid = false,\n onChange,\n className,\n style,\n pt,\n checked,\n defaultChecked,\n disabled,\n onClick,\n 'aria-invalid': ariaInvalid,\n ...nativeProps\n },\n forwardedRef,\n ) {\n const effectiveChecked = checked ?? pt?.input?.checked;\n const effectiveDefaultChecked = defaultChecked ?? pt?.input?.defaultChecked;\n const effectiveDisabled = disabled ?? pt?.input?.disabled;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly;\n const effectiveAriaInvalid =\n ariaInvalid ?? pt?.input?.['aria-invalid'] ?? (invalid || undefined);\n const effectiveInvalid =\n invalid ||\n effectiveAriaInvalid === true ||\n effectiveAriaInvalid === 'true';\n const { ref, selected, synchronize } = useNativeCheckedState(\n effectiveChecked,\n effectiveDefaultChecked,\n forwardedRef,\n );\n return (\n <label\n {...pt?.root}\n className={['cratis-choice', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n <input\n {...pt?.input}\n {...nativeProps}\n ref={ref}\n type='checkbox'\n role='switch'\n checked={effectiveChecked}\n defaultChecked={effectiveDefaultChecked}\n disabled={effectiveDisabled}\n readOnly={undefined}\n aria-invalid={effectiveAriaInvalid}\n aria-readonly={effectiveReadOnly || undefined}\n onClick={(event) => {\n pt?.input?.onClick?.(event);\n onClick?.(event);\n if (effectiveReadOnly) event.preventDefault();\n }}\n onChange={(event) => {\n pt?.input?.onChange?.(event);\n if (effectiveReadOnly) return;\n synchronize(event.currentTarget.checked);\n onChange?.(event.currentTarget.checked, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n className={['cratis-choice__input', pt?.input?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='input'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n <span\n {...pt?.control}\n className={['cratis-switch__control', pt?.control?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='control'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n aria-hidden='true'\n >\n <span\n {...pt?.handle}\n className={[\n 'cratis-switch__handle',\n pt?.handle?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='handle'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n </span>\n {label !== undefined && (\n <span\n {...pt?.label}\n className={['cratis-choice__label', pt?.label?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='label'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n {label}\n </span>\n )}\n </label>\n );\n },\n);\n"],"names":["_jsxs","_jsx"],"mappings":";;;;AAQO,MAAM,oBAAoB,GAAG,UAAU,CAC1C,SAAS,oBAAoB,CACzB,EACI,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,KAAK,EACL,EAAE,EACF,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,cAAc,EAAE,WAAW,EAC3B,GAAG,WAAW,EACjB,EACD,YAAY,EAAA;IAEZ,MAAM,gBAAgB,GAAG,OAAO,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO;IACtD,MAAM,uBAAuB,GAAG,cAAc,IAAI,EAAE,EAAE,KAAK,EAAE,cAAc;IAC3E,MAAM,iBAAiB,GAAG,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ;IACzD,MAAM,iBAAiB,GAAG,QAAQ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ;AACzD,IAAA,MAAM,oBAAoB,GACtB,WAAW,IAAI,EAAE,EAAE,KAAK,GAAG,cAAc,CAAC,KAAK,OAAO,IAAI,SAAS,CAAC;IACxE,MAAM,gBAAgB,GAClB,OAAO;AACP,QAAA,oBAAoB,KAAK,IAAI;QAC7B,oBAAoB,KAAK,MAAM;AACnC,IAAA,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,qBAAqB,CACxD,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,CACf;AACD,IAAA,QACIA,IAAA,CAAA,OAAA,EAAA,EAAA,GACQ,EAAE,EAAE,IAAI,EACZ,SAAS,EAAE,CAAC,eAAe,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;aACtD,MAAM,CAAC,OAAO;AACd,aAAA,IAAI,CAAC,GAAG,CAAC,EACd,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAA,
|
|
1
|
+
{"version":3,"file":"SwitchImplementation.js","sources":["../../../Common/SwitchImplementation.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 { forwardRef } from 'react';\nimport type { SwitchProps } from './Switch';\nimport { useNativeCheckedState } from './useNativeCheckedState';\n\n/** Core implementation for the native switch presentation slot. */\nexport const SwitchImplementation = forwardRef<HTMLInputElement, SwitchProps>(\n function SwitchImplementation(\n {\n label,\n readOnly,\n invalid = false,\n onChange,\n className,\n style,\n pt,\n checked,\n defaultChecked,\n disabled,\n onClick,\n 'aria-invalid': ariaInvalid,\n ...nativeProps\n },\n forwardedRef,\n ) {\n const effectiveChecked = checked ?? pt?.input?.checked;\n const effectiveDefaultChecked = defaultChecked ?? pt?.input?.defaultChecked;\n const effectiveDisabled = disabled ?? pt?.input?.disabled;\n const effectiveReadOnly = readOnly ?? pt?.input?.readOnly;\n const effectiveAriaInvalid =\n ariaInvalid ?? pt?.input?.['aria-invalid'] ?? (invalid || undefined);\n const effectiveInvalid =\n invalid ||\n effectiveAriaInvalid === true ||\n effectiveAriaInvalid === 'true';\n const { ref, selected, synchronize } = useNativeCheckedState(\n effectiveChecked,\n effectiveDefaultChecked,\n forwardedRef,\n );\n return (\n <label\n {...pt?.root}\n className={['cratis-choice', pt?.root?.className, className]\n .filter(Boolean)\n .join(' ')}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='Switch'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n <input\n {...pt?.input}\n {...nativeProps}\n ref={ref}\n type='checkbox'\n role='switch'\n checked={effectiveChecked}\n defaultChecked={effectiveDefaultChecked}\n disabled={effectiveDisabled}\n readOnly={undefined}\n aria-invalid={effectiveAriaInvalid}\n aria-readonly={effectiveReadOnly || undefined}\n onClick={(event) => {\n pt?.input?.onClick?.(event);\n onClick?.(event);\n if (effectiveReadOnly) event.preventDefault();\n }}\n onChange={(event) => {\n pt?.input?.onChange?.(event);\n if (effectiveReadOnly) return;\n synchronize(event.currentTarget.checked);\n onChange?.(event.currentTarget.checked, {\n source: 'user',\n nativeEvent: event.nativeEvent,\n });\n }}\n className={['cratis-choice__input', pt?.input?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='input'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n <span\n {...pt?.control}\n className={['cratis-switch__control', pt?.control?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='control'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n aria-hidden='true'\n >\n <span\n {...pt?.handle}\n className={[\n 'cratis-switch__handle',\n pt?.handle?.className,\n ]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='handle'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n />\n </span>\n {label !== undefined && (\n <span\n {...pt?.label}\n className={['cratis-choice__label', pt?.label?.className]\n .filter(Boolean)\n .join(' ')}\n data-cratis-part='label'\n data-disabled={effectiveDisabled || undefined}\n data-invalid={effectiveInvalid || undefined}\n data-readonly={effectiveReadOnly || undefined}\n data-selected={selected || undefined}\n >\n {label}\n </span>\n )}\n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,SAAS;IACtB,kCAAkC;IAClC,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,oHASd,SAAS,gCA8CX,CAAC"}
|
package/dist/esm/Common/Tabs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Tabs as Tabs$1, TabList, Tab, TabPanel } from 'react-aria-components/Tabs';
|
|
3
3
|
import { classNames } from '../ClassNames/classNames.js';
|
|
4
4
|
|
|
5
|
-
const Tabs = ({ tabs, value, onChange, disabled = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }) => (jsxs(Tabs$1, { ...pt?.root, selectedKey: value, onSelectionChange: (key) => onChange(String(key)), isDisabled: disabled, className: classNames('cratis-tabs', pt?.root?.className, className), "data-cratis-part": 'root', "data-disabled": disabled || undefined, children: [jsx(TabList, { ...pt?.list, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: classNames('cratis-tabs__list', pt?.list?.className), "data-cratis-part": 'list', children: tabs.map((tab) => (jsx(Tab, { ...pt?.tab, id: tab.id, isDisabled: tab.disabled, className: classNames('cratis-tabs__tab', pt?.tab?.className), "data-cratis-part": 'tab', "data-selected": tab.id === value || undefined, "data-disabled": disabled || tab.disabled || undefined, children: tab.label }, tab.id))) }), tabs.map((tab) => (jsx(TabPanel, { ...pt?.panel, id: tab.id, className: classNames('cratis-tabs__panel', pt?.panel?.className), "data-cratis-part": 'panel', "data-selected": tab.id === value || undefined, children: tab.content }, tab.id)))] }));
|
|
5
|
+
const Tabs = ({ tabs, value, onChange, disabled = false, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }) => (jsxs(Tabs$1, { ...pt?.root, selectedKey: value, onSelectionChange: (key) => onChange(String(key)), isDisabled: disabled, className: classNames('cratis-tabs', pt?.root?.className, className), "data-cratis-part": 'root', "data-cratis-component": 'Tabs', "data-disabled": disabled || undefined, children: [jsx(TabList, { ...pt?.list, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: classNames('cratis-tabs__list', pt?.list?.className), "data-cratis-part": 'list', children: tabs.map((tab) => (jsx(Tab, { ...pt?.tab, id: tab.id, isDisabled: tab.disabled, className: classNames('cratis-tabs__tab', pt?.tab?.className), "data-cratis-part": 'tab', "data-selected": tab.id === value || undefined, "data-disabled": disabled || tab.disabled || undefined, children: tab.label }, tab.id))) }), tabs.map((tab) => (jsx(TabPanel, { ...pt?.panel, id: tab.id, className: classNames('cratis-tabs__panel', pt?.panel?.className), "data-cratis-part": 'panel', "data-selected": tab.id === value || undefined, children: tab.content }, tab.id)))] }));
|
|
6
6
|
|
|
7
7
|
export { Tabs };
|
|
8
8
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sources":["../../../Common/Tabs.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 HTMLAttributes, type Key, type ReactNode } from 'react';\nimport {\n Tab as AriaTab,\n TabList as AriaTabList,\n TabPanel as AriaTabPanel,\n Tabs as AriaTabs,\n} from 'react-aria-components/Tabs';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Attributes a consumer may hand to one {@link Tabs} part: class, style, title and data attributes. */\nexport type TabsPartAttributes = Pick<\n HTMLAttributes<HTMLElement>,\n 'className' | 'style' | 'title'\n> & {\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/** One tab in a {@link Tabs} set. */\nexport interface TabItem {\n /** Value identifying this tab. */\n id: string;\n /** Visible label. */\n label: ReactNode;\n /** Content revealed when this tab is selected. */\n content: ReactNode;\n /** Whether the tab cannot be selected. */\n disabled?: boolean;\n}\n\n/** Stable Cratis-owned parts for styling a {@link Tabs} set. */\nexport interface TabsParts {\n /** The element wrapping list and panels. */\n root?: TabsPartAttributes;\n /** The tab list. */\n list?: TabsPartAttributes;\n /** One tab. */\n tab?: TabsPartAttributes;\n /** One panel. */\n panel?: TabsPartAttributes;\n}\n\nconst tabsPartsMatchManifest: ExactPartKeys<TabsParts, PartsOf<'Tabs'>> = true;\nvoid tabsPartsMatchManifest;\n\n/** Props for {@link Tabs}. */\nexport interface TabsProps {\n /** The tabs, in display order. */\n tabs: TabItem[];\n /** Id of the selected tab. */\n value: string;\n /** Called with the newly selected tab's id. */\n onChange: (value: string) => void;\n /** Whether every tab is disabled. */\n disabled?: boolean;\n /** Accessible name for the tab list, when no visible heading names it. */\n 'aria-label'?: string;\n /** Id of the element naming the tab list. */\n 'aria-labelledby'?: string;\n /** Extra class name for the root element. */\n className?: string;\n /** Cratis-owned per-part attributes. */\n pt?: TabsParts;\n}\n\n/**\n * A tab set: a list of tabs, each optionally revealing a panel.\n *\n * Arrow keys move between tabs and Home/End jump to the ends, with one tab stop for the whole list,\n * which is what the `tablist` role promises and a row of ordinary buttons does not keep. Each tab is\n * wired to its panel through `aria-controls`.\n *\n * Every tab owns a panel: the selected tab points at one, so a tab set without panels would name an\n * element that is not there. When the choice drives a view rendered elsewhere it is a *value* rather\n * than a panel — reach for `ToggleGroup`, which says so to assistive technology.\n */\nexport const Tabs = ({\n tabs,\n value,\n onChange,\n disabled = false,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className,\n pt,\n}: TabsProps) => (\n <AriaTabs\n {...pt?.root}\n selectedKey={value}\n onSelectionChange={(key: Key) => onChange(String(key))}\n isDisabled={disabled}\n className={classNames('cratis-tabs', pt?.root?.className, className)}\n data-cratis-part='root'\n data-disabled={disabled || undefined}\n >\n <AriaTabList\n {...pt?.list}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={classNames('cratis-tabs__list', pt?.list?.className)}\n data-cratis-part='list'\n >\n {tabs.map((tab) => (\n <AriaTab\n key={tab.id}\n {...pt?.tab}\n id={tab.id}\n isDisabled={tab.disabled}\n className={classNames('cratis-tabs__tab', pt?.tab?.className)}\n data-cratis-part='tab'\n data-selected={tab.id === value || undefined}\n data-disabled={disabled || tab.disabled || undefined}\n >\n {tab.label}\n </AriaTab>\n ))}\n </AriaTabList>\n {tabs.map((tab) => (\n <AriaTabPanel\n key={tab.id}\n {...pt?.panel}\n id={tab.id}\n className={classNames('cratis-tabs__panel', pt?.panel?.className)}\n data-cratis-part='panel'\n data-selected={tab.id === value || undefined}\n >\n {tab.content}\n </AriaTabPanel>\n ))}\n </AriaTabs>\n);\n"],"names":["_jsxs","AriaTabs","_jsx","AriaTabList","AriaTab","AriaTabPanel"],"mappings":";;;;AAgFO,MAAM,IAAI,GAAG,CAAC,EACjB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,SAAS,EACT,EAAE,GACM,MACRA,IAAA,CAACC,MAAQ,EAAA,EAAA,GACD,EAAE,EAAE,IAAI,EACZ,WAAW,EAAE,KAAK,EAClB,iBAAiB,EAAE,CAAC,GAAQ,KAAK,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EACtD,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,EAAA,kBAAA,EACnD,MAAM,EAAA,eAAA,
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../Common/Tabs.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 HTMLAttributes, type Key, type ReactNode } from 'react';\nimport {\n Tab as AriaTab,\n TabList as AriaTabList,\n TabPanel as AriaTabPanel,\n Tabs as AriaTabs,\n} from 'react-aria-components/Tabs';\nimport type { ExactPartKeys } from '../types/ExactPartKeys';\nimport type { PartsOf } from '../types/parts';\nimport { classNames } from '../ClassNames/classNames';\n\n/** Attributes a consumer may hand to one {@link Tabs} part: class, style, title and data attributes. */\nexport type TabsPartAttributes = Pick<\n HTMLAttributes<HTMLElement>,\n 'className' | 'style' | 'title'\n> & {\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/** One tab in a {@link Tabs} set. */\nexport interface TabItem {\n /** Value identifying this tab. */\n id: string;\n /** Visible label. */\n label: ReactNode;\n /** Content revealed when this tab is selected. */\n content: ReactNode;\n /** Whether the tab cannot be selected. */\n disabled?: boolean;\n}\n\n/** Stable Cratis-owned parts for styling a {@link Tabs} set. */\nexport interface TabsParts {\n /** The element wrapping list and panels. */\n root?: TabsPartAttributes;\n /** The tab list. */\n list?: TabsPartAttributes;\n /** One tab. */\n tab?: TabsPartAttributes;\n /** One panel. */\n panel?: TabsPartAttributes;\n}\n\nconst tabsPartsMatchManifest: ExactPartKeys<TabsParts, PartsOf<'Tabs'>> = true;\nvoid tabsPartsMatchManifest;\n\n/** Props for {@link Tabs}. */\nexport interface TabsProps {\n /** The tabs, in display order. */\n tabs: TabItem[];\n /** Id of the selected tab. */\n value: string;\n /** Called with the newly selected tab's id. */\n onChange: (value: string) => void;\n /** Whether every tab is disabled. */\n disabled?: boolean;\n /** Accessible name for the tab list, when no visible heading names it. */\n 'aria-label'?: string;\n /** Id of the element naming the tab list. */\n 'aria-labelledby'?: string;\n /** Extra class name for the root element. */\n className?: string;\n /** Cratis-owned per-part attributes. */\n pt?: TabsParts;\n}\n\n/**\n * A tab set: a list of tabs, each optionally revealing a panel.\n *\n * Arrow keys move between tabs and Home/End jump to the ends, with one tab stop for the whole list,\n * which is what the `tablist` role promises and a row of ordinary buttons does not keep. Each tab is\n * wired to its panel through `aria-controls`.\n *\n * Every tab owns a panel: the selected tab points at one, so a tab set without panels would name an\n * element that is not there. When the choice drives a view rendered elsewhere it is a *value* rather\n * than a panel — reach for `ToggleGroup`, which says so to assistive technology.\n */\nexport const Tabs = ({\n tabs,\n value,\n onChange,\n disabled = false,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className,\n pt,\n}: TabsProps) => (\n <AriaTabs\n {...pt?.root}\n selectedKey={value}\n onSelectionChange={(key: Key) => onChange(String(key))}\n isDisabled={disabled}\n className={classNames('cratis-tabs', pt?.root?.className, className)}\n data-cratis-part='root'\n data-cratis-component='Tabs'\n data-disabled={disabled || undefined}\n >\n <AriaTabList\n {...pt?.list}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={classNames('cratis-tabs__list', pt?.list?.className)}\n data-cratis-part='list'\n >\n {tabs.map((tab) => (\n <AriaTab\n key={tab.id}\n {...pt?.tab}\n id={tab.id}\n isDisabled={tab.disabled}\n className={classNames('cratis-tabs__tab', pt?.tab?.className)}\n data-cratis-part='tab'\n data-selected={tab.id === value || undefined}\n data-disabled={disabled || tab.disabled || undefined}\n >\n {tab.label}\n </AriaTab>\n ))}\n </AriaTabList>\n {tabs.map((tab) => (\n <AriaTabPanel\n key={tab.id}\n {...pt?.panel}\n id={tab.id}\n className={classNames('cratis-tabs__panel', pt?.panel?.className)}\n data-cratis-part='panel'\n data-selected={tab.id === value || undefined}\n >\n {tab.content}\n </AriaTabPanel>\n ))}\n </AriaTabs>\n);\n"],"names":["_jsxs","AriaTabs","_jsx","Ari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,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,aAAa,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,6OAiBlB,aAAa,gCA2Hf,CAAC"}
|
|
@@ -29,7 +29,7 @@ const TagGroup = ({ value, onChange, editable = true, placeholder, separators =
|
|
|
29
29
|
const splitOn = (text) => separators.length === 0
|
|
30
30
|
? [text]
|
|
31
31
|
: text.split(new RegExp(`[${separators.map(escapeForClass).join('')}]`));
|
|
32
|
-
return (jsxs("div", { ...pt?.root, className: classNames('cratis-tag-group', pt?.root?.className, className), "data-cratis-part": 'root', "data-disabled": disabled || undefined, "data-invalid": invalid || undefined, children: [jsx(TagGroup$1, { className: 'cratis-tag-group__group', selectionMode: 'none', onRemove: remove, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children: jsx(TagList, { ...pt?.list, items: value.map((entry) => ({ id: entry })), className: classNames('cratis-tag-group__list', pt?.list?.className), "data-cratis-part": 'list', children: (item) => (jsxs(Tag, { ...pt?.tag, id: item.id, textValue: item.id, isDisabled: disabled, className: classNames('cratis-tag-group__tag', pt?.tag?.className), "data-cratis-part": 'tag', "data-disabled": disabled || undefined, children: [jsx("span", { className: 'cratis-tag-group__tag-label', children: item.id }), !disabled && (jsx(Button, { ...pt?.remove, slot: 'remove', "aria-label": removeLabel?.(item.id), className: classNames('cratis-tag-group__remove', pt?.remove?.className), "data-cratis-part": 'remove', children: jsx("span", { "aria-hidden": 'true', children: resolvedRemoveIcon }) }))] })) }) }), editable && (jsx("input", { ...pt?.input, id: inputId, type: 'text', value: draft, disabled: disabled, placeholder: placeholder, "aria-label": ariaLabelledBy ? undefined : ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": invalid || undefined, className: classNames('cratis-tag-group__input', pt?.input?.className), "data-cratis-part": 'input', "data-invalid": invalid || undefined, onChange: (event) => setDraft(event.currentTarget.value), onKeyDown: (event) => {
|
|
32
|
+
return (jsxs("div", { ...pt?.root, className: classNames('cratis-tag-group', pt?.root?.className, className), "data-cratis-part": 'root', "data-cratis-component": 'TagGroup', "data-disabled": disabled || undefined, "data-invalid": invalid || undefined, children: [jsx(TagGroup$1, { className: 'cratis-tag-group__group', selectionMode: 'none', onRemove: remove, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children: jsx(TagList, { ...pt?.list, items: value.map((entry) => ({ id: entry })), className: classNames('cratis-tag-group__list', pt?.list?.className), "data-cratis-part": 'list', children: (item) => (jsxs(Tag, { ...pt?.tag, id: item.id, textValue: item.id, isDisabled: disabled, className: classNames('cratis-tag-group__tag', pt?.tag?.className), "data-cratis-part": 'tag', "data-disabled": disabled || undefined, children: [jsx("span", { className: 'cratis-tag-group__tag-label', children: item.id }), !disabled && (jsx(Button, { ...pt?.remove, slot: 'remove', "aria-label": removeLabel?.(item.id), className: classNames('cratis-tag-group__remove', pt?.remove?.className), "data-cratis-part": 'remove', children: jsx("span", { "aria-hidden": 'true', children: resolvedRemoveIcon }) }))] })) }) }), editable && (jsx("input", { ...pt?.input, id: inputId, type: 'text', value: draft, disabled: disabled, placeholder: placeholder, "aria-label": ariaLabelledBy ? undefined : ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": invalid || undefined, className: classNames('cratis-tag-group__input', pt?.input?.className), "data-cratis-part": 'input', "data-invalid": invalid || undefined, onChange: (event) => setDraft(event.currentTarget.value), onKeyDown: (event) => {
|
|
33
33
|
if (event.key === 'Enter' || separators.includes(event.key)) {
|
|
34
34
|
event.preventDefault();
|
|
35
35
|
add([draft]);
|