@aivex/ui 1.2.0-dev.59 → 1.2.0-dev.60
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/README.md +64 -19
- package/dist/DESIGN.md +1 -1
- package/dist/components/Accordion/Accordion.cjs +2 -0
- package/dist/components/Accordion/Accordion.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.d.cts +111 -0
- package/dist/components/Accordion/Accordion.d.ts +111 -0
- package/dist/components/Accordion/Accordion.js +75 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/index.d.cts +2 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.js +11 -11
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.js +13 -13
- package/dist/components/BreadCrumb/BreadCrumb.cjs +1 -1
- package/dist/components/BreadCrumb/BreadCrumb.cjs.map +1 -1
- package/dist/components/BreadCrumb/BreadCrumb.js +13 -15
- package/dist/components/BreadCrumb/BreadCrumb.js.map +1 -1
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.d.cts +6 -5
- package/dist/components/Button/Button.d.ts +6 -5
- package/dist/components/Button/Button.js +36 -33
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +27 -27
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.d.cts +9 -8
- package/dist/components/Card/Card.d.ts +9 -8
- package/dist/components/Card/Card.js +25 -22
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.cts +17 -18
- package/dist/components/Checkbox/Checkbox.d.ts +17 -18
- package/dist/components/Checkbox/Checkbox.js +31 -42
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/ChipsCheckbox.cjs +1 -1
- package/dist/components/Checkbox/ChipsCheckbox.cjs.map +1 -1
- package/dist/components/Checkbox/ChipsCheckbox.d.cts +10 -8
- package/dist/components/Checkbox/ChipsCheckbox.d.ts +10 -8
- package/dist/components/Checkbox/ChipsCheckbox.js +19 -37
- package/dist/components/Checkbox/ChipsCheckbox.js.map +1 -1
- package/dist/components/Coachmark/Coachmark.cjs +1 -1
- package/dist/components/Coachmark/Coachmark.cjs.map +1 -1
- package/dist/components/Coachmark/Coachmark.d.cts +29 -25
- package/dist/components/Coachmark/Coachmark.d.ts +29 -25
- package/dist/components/Coachmark/Coachmark.js +91 -83
- package/dist/components/Coachmark/Coachmark.js.map +1 -1
- package/dist/components/Coachmark/index.d.cts +1 -1
- package/dist/components/Coachmark/index.d.ts +1 -1
- package/dist/components/Comment/CommentInput.cjs +1 -1
- package/dist/components/Comment/CommentInput.js +7 -7
- package/dist/components/Comment/MentionInput.cjs +1 -1
- package/dist/components/Comment/MentionInput.cjs.map +1 -1
- package/dist/components/Comment/MentionInput.js +3 -1
- package/dist/components/Comment/MentionInput.js.map +1 -1
- package/dist/components/Comment/useMentionSuggestion.cjs +1 -1
- package/dist/components/Comment/useMentionSuggestion.cjs.map +1 -1
- package/dist/components/Comment/useMentionSuggestion.js +1 -1
- package/dist/components/Comment/useMentionSuggestion.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.cjs +2 -0
- package/dist/components/ContextMenu/ContextMenu.cjs.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.d.cts +72 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +72 -0
- package/dist/components/ContextMenu/ContextMenu.js +56 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/ContextMenu/index.d.cts +2 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/DataGrid/DataGrid.cjs.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +33 -33
- package/dist/components/DataGrid/DataGrid.js.map +1 -1
- package/dist/components/DataGrid/DataGridColumnSettings.cjs +1 -1
- package/dist/components/DataGrid/DataGridColumnSettings.cjs.map +1 -1
- package/dist/components/DataGrid/DataGridColumnSettings.d.cts +1 -1
- package/dist/components/DataGrid/DataGridColumnSettings.d.ts +1 -1
- package/dist/components/DataGrid/DataGridColumnSettings.js +30 -31
- package/dist/components/DataGrid/DataGridColumnSettings.js.map +1 -1
- package/dist/components/DataGrid/DataGridPrimitives.cjs +1 -1
- package/dist/components/DataGrid/DataGridPrimitives.cjs.map +1 -1
- package/dist/components/DataGrid/DataGridPrimitives.d.cts +10 -12
- package/dist/components/DataGrid/DataGridPrimitives.d.ts +10 -12
- package/dist/components/DataGrid/DataGridPrimitives.js +43 -37
- package/dist/components/DataGrid/DataGridPrimitives.js.map +1 -1
- package/dist/components/Dialog/Dialog.cjs +1 -1
- package/dist/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/Dialog/Dialog.d.cts +15 -5
- package/dist/components/Dialog/Dialog.d.ts +15 -5
- package/dist/components/Dialog/Dialog.js +61 -49
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.cjs.map +1 -1
- package/dist/components/Divider/Divider.js +6 -6
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.d.cts +34 -22
- package/dist/components/Drawer/Drawer.d.ts +34 -22
- package/dist/components/Drawer/Drawer.js +80 -72
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.cjs +2 -0
- package/dist/components/EmptyState/EmptyState.cjs.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.cts +61 -0
- package/dist/components/EmptyState/EmptyState.d.ts +61 -0
- package/dist/components/EmptyState/EmptyState.js +50 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/EmptyState/index.d.cts +2 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/Field/Field.cjs +1 -1
- package/dist/components/Field/Field.cjs.map +1 -1
- package/dist/components/Field/Field.d.cts +45 -34
- package/dist/components/Field/Field.d.ts +45 -34
- package/dist/components/Field/Field.js +46 -65
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/FieldStateContext.cjs +2 -0
- package/dist/components/Field/FieldStateContext.cjs.map +1 -0
- package/dist/components/Field/FieldStateContext.d.cts +12 -0
- package/dist/components/Field/FieldStateContext.d.ts +12 -0
- package/dist/components/Field/FieldStateContext.js +14 -0
- package/dist/components/Field/FieldStateContext.js.map +1 -0
- package/dist/components/HoverCard/HoverCard.cjs +2 -0
- package/dist/components/HoverCard/HoverCard.cjs.map +1 -0
- package/dist/components/HoverCard/HoverCard.d.cts +61 -0
- package/dist/components/HoverCard/HoverCard.d.ts +61 -0
- package/dist/components/HoverCard/HoverCard.js +44 -0
- package/dist/components/HoverCard/HoverCard.js.map +1 -0
- package/dist/components/HoverCard/index.d.cts +2 -0
- package/dist/components/HoverCard/index.d.ts +2 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.cjs.map +1 -1
- package/dist/components/Icon/index.js +12 -12
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/IconButton/IconButton.cjs +1 -1
- package/dist/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.d.cts +6 -5
- package/dist/components/IconButton/IconButton.d.ts +6 -5
- package/dist/components/IconButton/IconButton.js +31 -28
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/InputBase/InputBase.cjs +1 -1
- package/dist/components/InputBase/InputBase.cjs.map +1 -1
- package/dist/components/InputBase/InputBase.js +8 -8
- package/dist/components/Logo/index.cjs +1 -1
- package/dist/components/Logo/index.cjs.map +1 -1
- package/dist/components/Logo/index.d.cts +21 -2
- package/dist/components/Logo/index.d.ts +21 -2
- package/dist/components/Logo/index.js +487 -2
- package/dist/components/Logo/index.js.map +1 -1
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.cjs.map +1 -1
- package/dist/components/Menu/Menu.d.cts +80 -43
- package/dist/components/Menu/Menu.d.ts +80 -43
- package/dist/components/Menu/Menu.js +144 -122
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Messagebox/Messagebox.cjs +1 -1
- package/dist/components/Messagebox/Messagebox.cjs.map +1 -1
- package/dist/components/Messagebox/Messagebox.js +27 -27
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.cts +22 -9
- package/dist/components/Modal/Modal.d.ts +22 -9
- package/dist/components/Modal/Modal.js +95 -98
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/ModalBase.cjs +1 -1
- package/dist/components/Modal/ModalBase.cjs.map +1 -1
- package/dist/components/Modal/ModalBase.d.cts +32 -23
- package/dist/components/Modal/ModalBase.d.ts +32 -23
- package/dist/components/Modal/ModalBase.js +35 -23
- package/dist/components/Modal/ModalBase.js.map +1 -1
- package/dist/components/Nav/Nav.cjs +1 -1
- package/dist/components/Nav/Nav.js +19 -19
- package/dist/components/NumberField/NumberField.cjs +2 -0
- package/dist/components/NumberField/NumberField.cjs.map +1 -0
- package/dist/components/NumberField/NumberField.d.cts +79 -0
- package/dist/components/NumberField/NumberField.d.ts +79 -0
- package/dist/components/NumberField/NumberField.js +65 -0
- package/dist/components/NumberField/NumberField.js.map +1 -0
- package/dist/components/NumberField/index.d.cts +2 -0
- package/dist/components/NumberField/index.d.ts +2 -0
- package/dist/components/Overlay/Overlay.cjs +1 -1
- package/dist/components/Overlay/Overlay.js +6 -6
- package/dist/components/Pagination/Pagination.cjs +1 -1
- package/dist/components/Pagination/Pagination.js +20 -20
- package/dist/components/Panel/Panel.cjs +1 -1
- package/dist/components/Panel/Panel.js +25 -25
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.cjs.map +1 -1
- package/dist/components/Popover/Popover.d.cts +32 -28
- package/dist/components/Popover/Popover.d.ts +32 -28
- package/dist/components/Popover/Popover.js +50 -46
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/index.d.cts +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.cjs.map +1 -1
- package/dist/components/Radio/Radio.d.cts +47 -18
- package/dist/components/Radio/Radio.d.ts +47 -18
- package/dist/components/Radio/Radio.js +43 -33
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/index.d.cts +2 -2
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/ScrollArea/ScrollArea.cjs +1 -1
- package/dist/components/ScrollArea/ScrollArea.cjs.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.d.cts +25 -8
- package/dist/components/ScrollArea/ScrollArea.d.ts +25 -8
- package/dist/components/ScrollArea/ScrollArea.js +50 -30
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/components/ScrollArea/index.d.cts +1 -1
- package/dist/components/ScrollArea/index.d.ts +1 -1
- package/dist/components/Segmented/Segmented.cjs +1 -1
- package/dist/components/Segmented/Segmented.cjs.map +1 -1
- package/dist/components/Segmented/Segmented.d.cts +20 -5
- package/dist/components/Segmented/Segmented.d.ts +20 -5
- package/dist/components/Segmented/Segmented.js +18 -18
- package/dist/components/Segmented/Segmented.js.map +1 -1
- package/dist/components/SelectBox/SelectBox.cjs +1 -1
- package/dist/components/SelectBox/SelectBox.cjs.map +1 -1
- package/dist/components/SelectBox/SelectBox.d.cts +13 -15
- package/dist/components/SelectBox/SelectBox.d.ts +13 -15
- package/dist/components/SelectBox/SelectBox.js +64 -56
- package/dist/components/SelectBox/SelectBox.js.map +1 -1
- package/dist/components/SelectButton/SelectButton.cjs +1 -1
- package/dist/components/SelectButton/SelectButton.cjs.map +1 -1
- package/dist/components/SelectButton/SelectButton.d.cts +13 -10
- package/dist/components/SelectButton/SelectButton.d.ts +13 -10
- package/dist/components/SelectButton/SelectButton.js +6 -6
- package/dist/components/SelectButton/SelectButton.js.map +1 -1
- package/dist/components/ShapeEditor/_components/ContextMenu.cjs +1 -1
- package/dist/components/ShapeEditor/_components/ContextMenu.cjs.map +1 -1
- package/dist/components/ShapeEditor/_components/ContextMenu.d.cts +2 -2
- package/dist/components/ShapeEditor/_components/ContextMenu.d.ts +2 -2
- package/dist/components/ShapeEditor/_components/ContextMenu.js +32 -32
- package/dist/components/ShapeEditor/_components/ContextMenu.js.map +1 -1
- package/dist/components/ShapeEditor/_components/Minimap.cjs +1 -1
- package/dist/components/ShapeEditor/_components/Minimap.cjs.map +1 -1
- package/dist/components/ShapeEditor/_components/Minimap.js +7 -10
- package/dist/components/ShapeEditor/_components/Minimap.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.cts +4 -4
- package/dist/components/Skeleton/Skeleton.d.ts +4 -4
- package/dist/components/Skeleton/Skeleton.js +12 -9
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Slider/Slider.cjs +1 -1
- package/dist/components/Slider/Slider.cjs.map +1 -1
- package/dist/components/Slider/Slider.d.cts +21 -8
- package/dist/components/Slider/Slider.d.ts +21 -8
- package/dist/components/Slider/Slider.js +37 -32
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.d.cts +6 -4
- package/dist/components/Switch/Switch.d.ts +6 -4
- package/dist/components/Switch/Switch.js +26 -23
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Tab/Tab.cjs +1 -1
- package/dist/components/Tab/Tab.cjs.map +1 -1
- package/dist/components/Tab/Tab.d.cts +47 -16
- package/dist/components/Tab/Tab.d.ts +47 -16
- package/dist/components/Tab/Tab.js +17 -13
- package/dist/components/Tab/Tab.js.map +1 -1
- package/dist/components/Tag/Tag.cjs +1 -1
- package/dist/components/Tag/Tag.cjs.map +1 -1
- package/dist/components/Tag/Tag.js +16 -16
- package/dist/components/Tagbox/Tagbox.cjs +1 -1
- package/dist/components/Tagbox/Tagbox.cjs.map +1 -1
- package/dist/components/Tagbox/Tagbox.d.cts +8 -10
- package/dist/components/Tagbox/Tagbox.d.ts +8 -10
- package/dist/components/Tagbox/Tagbox.js +63 -61
- package/dist/components/Tagbox/Tagbox.js.map +1 -1
- package/dist/components/Textarea/Textarea.cjs +1 -1
- package/dist/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.d.cts +4 -6
- package/dist/components/Textarea/Textarea.d.ts +4 -6
- package/dist/components/Textarea/Textarea.js +44 -40
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textbox/Textbox.cjs +1 -1
- package/dist/components/Textbox/Textbox.cjs.map +1 -1
- package/dist/components/Textbox/Textbox.d.cts +4 -6
- package/dist/components/Textbox/Textbox.d.ts +4 -6
- package/dist/components/Textbox/Textbox.js +46 -44
- package/dist/components/Textbox/Textbox.js.map +1 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.cjs.map +1 -1
- package/dist/components/Toast/Toast.d.cts +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -1
- package/dist/components/Toast/Toast.js +18 -18
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.cjs +1 -1
- package/dist/components/ToggleButton/ToggleButton.cjs.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.js +13 -13
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.cts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.js +37 -26
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/TruncatedText/TruncatedText.cjs +1 -1
- package/dist/components/TruncatedText/TruncatedText.cjs.map +1 -1
- package/dist/components/TruncatedText/TruncatedText.js +64 -51
- package/dist/components/TruncatedText/TruncatedText.js.map +1 -1
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.cjs.map +1 -1
- package/dist/components/Typography/Typography.js +5 -5
- package/dist/components/UploadArea/UploadArea.cjs +1 -1
- package/dist/components/UploadArea/UploadArea.js +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +63 -58
- package/dist/llms-full.txt +877 -290
- package/dist/llms.txt +16 -11
- package/dist/styles.css +1 -1
- package/dist/utils/PortalEventBoundary.cjs +2 -0
- package/dist/utils/PortalEventBoundary.cjs.map +1 -0
- package/dist/utils/PortalEventBoundary.d.cts +13 -0
- package/dist/utils/PortalEventBoundary.d.ts +13 -0
- package/dist/utils/PortalEventBoundary.js +12 -0
- package/dist/utils/PortalEventBoundary.js.map +1 -0
- package/dist/utils/Primitive.cjs +2 -0
- package/dist/utils/Primitive.cjs.map +1 -0
- package/dist/utils/Primitive.d.cts +9 -0
- package/dist/utils/Primitive.d.ts +9 -0
- package/dist/utils/Primitive.js +15 -0
- package/dist/utils/Primitive.js.map +1 -0
- package/dist/utils/popupArrow.cjs +2 -0
- package/dist/utils/popupArrow.cjs.map +1 -0
- package/dist/utils/popupArrow.d.cts +14 -0
- package/dist/utils/popupArrow.d.ts +14 -0
- package/dist/utils/popupArrow.js +26 -0
- package/dist/utils/popupArrow.js.map +1 -0
- package/dist/utils/popupPositioning.cjs +2 -0
- package/dist/utils/popupPositioning.cjs.map +1 -0
- package/dist/utils/popupPositioning.d.cts +11 -0
- package/dist/utils/popupPositioning.d.ts +11 -0
- package/dist/utils/popupPositioning.js +25 -0
- package/dist/utils/popupPositioning.js.map +1 -0
- package/dist/utils/useComposedRefs.cjs +2 -0
- package/dist/utils/useComposedRefs.cjs.map +1 -0
- package/dist/utils/useComposedRefs.d.cts +6 -0
- package/dist/utils/useComposedRefs.d.ts +6 -0
- package/dist/utils/useComposedRefs.js +22 -0
- package/dist/utils/useComposedRefs.js.map +1 -0
- package/dist/utils/useControllableState.cjs.map +1 -1
- package/dist/utils/useControllableState.d.cts +1 -1
- package/dist/utils/useControllableState.d.ts +1 -1
- package/dist/utils/useControllableState.js.map +1 -1
- package/dist/utils/useModalFocus.cjs +2 -0
- package/dist/utils/useModalFocus.cjs.map +1 -0
- package/dist/utils/useModalFocus.d.cts +31 -0
- package/dist/utils/useModalFocus.d.ts +31 -0
- package/dist/utils/useModalFocus.js +28 -0
- package/dist/utils/useModalFocus.js.map +1 -0
- package/package.json +2 -16
- package/dist/utils/useModalAutoFocus.cjs +0 -2
- package/dist/utils/useModalAutoFocus.cjs.map +0 -1
- package/dist/utils/useModalAutoFocus.d.cts +0 -11
- package/dist/utils/useModalAutoFocus.d.ts +0 -11
- package/dist/utils/useModalAutoFocus.js +0 -22
- package/dist/utils/useModalAutoFocus.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
declare const sizeStyles: {
|
|
3
|
+
readonly lg: {
|
|
4
|
+
readonly container: "aivex:gap-5";
|
|
5
|
+
readonly text: "aivex:gap-2";
|
|
6
|
+
readonly title: "aivex:text-heading-lg";
|
|
7
|
+
readonly description: "aivex:text-body-lg-regular";
|
|
8
|
+
};
|
|
9
|
+
readonly md: {
|
|
10
|
+
readonly container: "aivex:gap-4";
|
|
11
|
+
readonly text: "aivex:gap-2";
|
|
12
|
+
readonly title: "aivex:text-heading-md";
|
|
13
|
+
readonly description: "aivex:text-body-lg-regular";
|
|
14
|
+
};
|
|
15
|
+
readonly sm: {
|
|
16
|
+
readonly container: "aivex:gap-3";
|
|
17
|
+
readonly text: "aivex:gap-1";
|
|
18
|
+
readonly title: "aivex:text-heading-sm";
|
|
19
|
+
readonly description: "aivex:text-body-md-regular";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
23
|
+
/** 제목 위에 놓는 그림. 보통 `@aivex/ui/illustration`의 Illustration을 크기에 맞는 폭으로 넘긴다. */
|
|
24
|
+
illustration?: ReactNode;
|
|
25
|
+
/** 무엇이 비어 있는지 알리는 한 줄 제목 */
|
|
26
|
+
title: ReactNode;
|
|
27
|
+
/** 왜 비어 있는지, 무엇을 하면 되는지 알리는 안내 문구. 줄바꿈(\n)을 그대로 보여 준다. */
|
|
28
|
+
description?: ReactNode;
|
|
29
|
+
/** 안내 문구 아래에 놓는 버튼 등의 액션 */
|
|
30
|
+
action?: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* 크기. lg는 화면 본문, md는 카드·섹션, sm은 모달·패널 안
|
|
33
|
+
* @default "md"
|
|
34
|
+
*/
|
|
35
|
+
size?: keyof typeof sizeStyles;
|
|
36
|
+
ref?: Ref<HTMLDivElement>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 목록·검색 결과·화면에 보여 줄 내용이 없을 때 그 자리를 채우는 빈 상태 안내.
|
|
40
|
+
*
|
|
41
|
+
* 일러스트·제목·안내 문구·액션을 세로 가운데로 쌓는다. 부모를 꽉 채우지는 않으므로 가운데에
|
|
42
|
+
* 두려면 부모에서 정렬하거나 `className`으로 높이를 준다. 그림은 메인 번들을 가볍게 두려고
|
|
43
|
+
* 슬롯으로 받는다 — 권장 폭은 lg 250px, md 168px, sm 126px이다.
|
|
44
|
+
* 불러오기 실패는 빈 상태가 아니므로 Messagebox나 별도 오류 화면으로 알린다.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* import { Button, EmptyState } from "@aivex/ui";
|
|
49
|
+
* import { Illustration } from "@aivex/ui/illustration";
|
|
50
|
+
*
|
|
51
|
+
* <EmptyState
|
|
52
|
+
* size="lg"
|
|
53
|
+
* illustration={<Illustration type="no-data" width={250} />}
|
|
54
|
+
* title="데이터셋이 없습니다"
|
|
55
|
+
* description="이미지를 올려 첫 데이터셋을 만들어 보세요."
|
|
56
|
+
* action={<Button>데이터셋 만들기</Button>}
|
|
57
|
+
* />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function EmptyState({ illustration, title, description, action, size, className, ref, ...props }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
export { EmptyState };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../utils.js";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/EmptyState/EmptyState.tsx
|
|
5
|
+
var r = {
|
|
6
|
+
lg: {
|
|
7
|
+
container: "aivex:gap-5",
|
|
8
|
+
text: "aivex:gap-2",
|
|
9
|
+
title: "aivex:text-heading-lg",
|
|
10
|
+
description: "aivex:text-body-lg-regular"
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
container: "aivex:gap-4",
|
|
14
|
+
text: "aivex:gap-2",
|
|
15
|
+
title: "aivex:text-heading-md",
|
|
16
|
+
description: "aivex:text-body-lg-regular"
|
|
17
|
+
},
|
|
18
|
+
sm: {
|
|
19
|
+
container: "aivex:gap-3",
|
|
20
|
+
text: "aivex:gap-1",
|
|
21
|
+
title: "aivex:text-heading-sm",
|
|
22
|
+
description: "aivex:text-body-md-regular"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function i({ illustration: i, title: a, description: o, action: s, size: c = "md", className: l, ref: u, ...d }) {
|
|
26
|
+
let f = r[c];
|
|
27
|
+
return /* @__PURE__ */ n("div", {
|
|
28
|
+
ref: u,
|
|
29
|
+
className: e("aivex:flex aivex:flex-col aivex:items-center aivex:justify-center aivex:text-center", f.container, l),
|
|
30
|
+
...d,
|
|
31
|
+
children: [
|
|
32
|
+
i,
|
|
33
|
+
/* @__PURE__ */ n("div", {
|
|
34
|
+
className: e("aivex:flex aivex:flex-col aivex:items-center", f.text),
|
|
35
|
+
children: [/* @__PURE__ */ t("p", {
|
|
36
|
+
className: e("aivex:m-0 aivex:text-text-primary", f.title),
|
|
37
|
+
children: a
|
|
38
|
+
}), o ? /* @__PURE__ */ t("p", {
|
|
39
|
+
className: e("aivex:m-0 aivex:whitespace-pre-line aivex:text-text-secondary", f.description),
|
|
40
|
+
children: o
|
|
41
|
+
}) : null]
|
|
42
|
+
}),
|
|
43
|
+
s
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { i as EmptyState };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=EmptyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.js","names":[],"sources":["../../../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\n\n// 크기 단계는 aivops·aivdata가 각자 쓰던 빈 상태 사양을 합친 것이다.\n// lg는 화면 본문(일러스트 250px), md는 카드·섹션(168px), sm은 모달·패널(126~180px).\nconst sizeStyles = {\n lg: {\n container: \"aivex:gap-5\",\n text: \"aivex:gap-2\",\n title: \"aivex:text-heading-lg\",\n description: \"aivex:text-body-lg-regular\",\n },\n md: {\n container: \"aivex:gap-4\",\n text: \"aivex:gap-2\",\n title: \"aivex:text-heading-md\",\n description: \"aivex:text-body-lg-regular\",\n },\n sm: {\n container: \"aivex:gap-3\",\n text: \"aivex:gap-1\",\n title: \"aivex:text-heading-sm\",\n description: \"aivex:text-body-md-regular\",\n },\n} as const;\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** 제목 위에 놓는 그림. 보통 `@aivex/ui/illustration`의 Illustration을 크기에 맞는 폭으로 넘긴다. */\n illustration?: ReactNode;\n /** 무엇이 비어 있는지 알리는 한 줄 제목 */\n title: ReactNode;\n /** 왜 비어 있는지, 무엇을 하면 되는지 알리는 안내 문구. 줄바꿈(\\n)을 그대로 보여 준다. */\n description?: ReactNode;\n /** 안내 문구 아래에 놓는 버튼 등의 액션 */\n action?: ReactNode;\n /**\n * 크기. lg는 화면 본문, md는 카드·섹션, sm은 모달·패널 안\n * @default \"md\"\n */\n size?: keyof typeof sizeStyles;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 목록·검색 결과·화면에 보여 줄 내용이 없을 때 그 자리를 채우는 빈 상태 안내.\n *\n * 일러스트·제목·안내 문구·액션을 세로 가운데로 쌓는다. 부모를 꽉 채우지는 않으므로 가운데에\n * 두려면 부모에서 정렬하거나 `className`으로 높이를 준다. 그림은 메인 번들을 가볍게 두려고\n * 슬롯으로 받는다 — 권장 폭은 lg 250px, md 168px, sm 126px이다.\n * 불러오기 실패는 빈 상태가 아니므로 Messagebox나 별도 오류 화면으로 알린다.\n *\n * @example\n * ```tsx\n * import { Button, EmptyState } from \"@aivex/ui\";\n * import { Illustration } from \"@aivex/ui/illustration\";\n *\n * <EmptyState\n * size=\"lg\"\n * illustration={<Illustration type=\"no-data\" width={250} />}\n * title=\"데이터셋이 없습니다\"\n * description=\"이미지를 올려 첫 데이터셋을 만들어 보세요.\"\n * action={<Button>데이터셋 만들기</Button>}\n * />\n * ```\n */\nfunction EmptyState({\n illustration,\n title,\n description,\n action,\n size = \"md\",\n className,\n ref,\n ...props\n}: EmptyStateProps) {\n const styles = sizeStyles[size];\n\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:flex-col aivex:items-center aivex:justify-center aivex:text-center\",\n styles.container,\n className,\n )}\n {...props}\n >\n {illustration}\n <div className={cn(\"aivex:flex aivex:flex-col aivex:items-center\", styles.text)}>\n <p className={cn(\"aivex:m-0 aivex:text-text-primary\", styles.title)}>{title}</p>\n {description ? (\n <p\n className={cn(\n \"aivex:m-0 aivex:whitespace-pre-line aivex:text-text-secondary\",\n styles.description,\n )}\n >\n {description}\n </p>\n ) : null}\n </div>\n {action}\n </div>\n );\n}\n\nexport { EmptyState };\n"],"mappings":";;;;AAKA,IAAM,IAAa;CACjB,IAAI;EACF,WAAW;EACX,MAAM;EACN,OAAO;EACP,aAAa;EACd;CACD,IAAI;EACF,WAAW;EACX,MAAM;EACN,OAAO;EACP,aAAa;EACd;CACD,IAAI;EACF,WAAW;EACX,MAAM;EACN,OAAO;EACP,aAAa;EACd;CACF;AAyCD,SAAS,EAAW,EAClB,iBACA,UACA,gBACA,WACA,UAAO,MACP,cACA,QACA,GAAG,KACe;CAClB,IAAM,IAAS,EAAW;AAE1B,QACE,kBAAC,OAAD;EACO;EACL,WAAW,EACT,uFACA,EAAO,WACP,EACD;EACD,GAAI;YAPN;GASG;GACD,kBAAC,OAAD;IAAK,WAAW,EAAG,gDAAgD,EAAO,KAAK;cAA/E,CACE,kBAAC,KAAD;KAAG,WAAW,EAAG,qCAAqC,EAAO,MAAM;eAAG;KAAU,CAAA,EAC/E,IACC,kBAAC,KAAD;KACE,WAAW,EACT,iEACA,EAAO,YACR;eAEA;KACC,CAAA,GACF,KACA;;GACL;GACG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`)
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`./FieldStateContext.cjs`);let n=require(`react`),r=require(`react/jsx-runtime`),i=require(`class-variance-authority`),a=require(`@base-ui/react/field`);var o=(0,i.cva)(`aivex:flex aivex:w-full`,{variants:{orientation:{vertical:`aivex:flex-col aivex:gap-xs`,horizontal:`aivex:flex-row aivex:items-center aivex:gap-sm aivex:has-[[data-slot=field-content]]:items-start`}},defaultVariants:{orientation:`vertical`}});function s({className:i,orientation:s,invalid:c=!1,disabled:l=!1,ref:u,...d}){let f=(0,n.useMemo)(()=>({invalid:c,disabled:l}),[c,l]);return(0,r.jsx)(t.FieldStateContext.Provider,{value:f,children:(0,r.jsx)(a.Field.Root,{ref:u,invalid:c,disabled:l,className:e.cn(o({orientation:s}),i),...d})})}function c({className:n,ref:i,...o}){let{invalid:s,disabled:c}=t.useFieldState();return(0,r.jsx)(a.Field.Label,{ref:i,className:e.cn(`aivex:text-label-md aivex:text-text-secondary aivex:cursor-pointer aivex:select-none`,c&&`aivex:cursor-not-allowed aivex:text-text-disabled`,!c&&s&&`aivex:text-text-danger`,n),...o})}function l({className:t,ref:n,...i}){return(0,r.jsx)(`div`,{ref:n,"data-slot":`field-content`,className:e.cn(`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:gap-2xs`,t),...i})}function u({ref:e,...t}){return(0,r.jsx)(a.Field.Control,{ref:e,...t})}function d({className:n,ref:i,...o}){let{disabled:s}=t.useFieldState();return(0,r.jsx)(a.Field.Description,{ref:i,className:e.cn(`aivex:text-caption-md aivex:text-text-secondary`,s&&`aivex:text-text-disabled`,n),...o})}function f({className:n,children:i,ref:o,...s}){let{invalid:c}=t.useFieldState();return!c||!i?null:(0,r.jsx)(a.Field.Error,{match:!0,ref:o,render:(0,r.jsx)(`p`,{}),role:`alert`,className:e.cn(`aivex:text-caption-md aivex:text-text-danger`,n),...s,children:i})}exports.Field=s,exports.FieldContent=l,exports.FieldControl=u,exports.FieldDescription=d,exports.FieldError=f,exports.FieldLabel=c,exports.fieldVariants=o;
|
|
2
2
|
//# sourceMappingURL=Field.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.cjs","names":[],"sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport {\n cloneElement,\n createContext,\n type HTMLAttributes,\n isValidElement,\n type LabelHTMLAttributes,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useState,\n} from \"react\";\nimport { cn } from \"@/utils/cn\";\n\ninterface FieldContextValue {\n /** 컨트롤과 라벨을 연결하는 id */\n controlId: string;\n descriptionId: string;\n errorId: string;\n invalid: boolean;\n disabled: boolean;\n /** 렌더된 FieldDescription·FieldError가 있을 때만 컨트롤의 aria-describedby에 그 id를 넣는다. */\n hasDescription: boolean;\n hasError: boolean;\n /** 마운트 시 호출해 존재를 알리고, 반환된 함수로 해제한다. */\n registerDescription: () => () => void;\n registerError: () => () => void;\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null);\n\nfunction useFieldContext() {\n const context = useContext(FieldContext);\n if (!context) {\n throw new Error(\"Field 하위 컴포넌트는 <Field> 내부에서 사용해야 합니다.\");\n }\n return context;\n}\n\n/** Field 루트의 배치(orientation) 클래스를 만드는 cva 변형. */\nconst fieldVariants = cva(\"aivex:flex aivex:w-full\", {\n variants: {\n orientation: {\n /** 라벨이 위, 컨트롤이 아래 (Textbox 등) */\n vertical: \"aivex:flex-col aivex:gap-xs\",\n /**\n * 컨트롤이 좌측, 라벨/설명이 우측 (Checkbox/Radio/Switch 등).\n * 기본은 중앙 정렬(단일 라벨), FieldContent(라벨+설명) 포함 시 상단 정렬.\n */\n horizontal:\n \"aivex:flex-row aivex:items-center aivex:gap-sm aivex:has-[[data-slot=field-content]]:items-start\",\n },\n },\n defaultVariants: { orientation: \"vertical\" },\n});\n\nexport interface FieldProps\n extends HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof fieldVariants> {\n /** 외부에서 id를 지정. 없으면 자동 생성 */\n fieldId?: string;\n /**\n * 에러 상태. FieldControl이 컨트롤에 `aria-invalid`와 에러 id(`aria-describedby`)를 주입하고,\n * FieldLabel이 위험색으로 바뀐다. Textbox·Textarea·Tagbox·SelectBox는 이 aria-invalid만으로 에러 스타일이 켜진다.\n * @default false\n */\n invalid?: boolean;\n /**\n * 비활성 상태. 라벨·설명을 비활성색으로 바꾸고, FieldControl이 컨트롤에 `disabled`를 전달한다.\n * 컨트롤에 직접 준 `disabled`가 있으면 그 값이 우선한다.\n * @default false\n */\n disabled?: boolean;\n /** 루트 div ref */\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 라벨·설명·에러를 입력 컨트롤과 id/aria로 연결하는 폼 필드 래퍼.\n * 어떤 컨트롤(Textbox, SelectBox, Checkbox 등)과도 조합하는 합성 프리미티브로, react-hook-form 등\n * 특정 폼 라이브러리에 종속되지 않는다. 컨트롤은 반드시 FieldControl로 감싸야 라벨(htmlFor)·aria가 연결된다.\n * `orientation=\"vertical\"`(기본)은 라벨 위·컨트롤 아래, `\"horizontal\"`은 Checkbox/Radio/Switch처럼 컨트롤 좌측·라벨 우측.\n *\n * @example\n * ```tsx\n * import { Field, FieldControl, FieldDescription, FieldError, FieldLabel, Textbox } from \"@aivex/ui\";\n *\n * <Field invalid={!!error}>\n * <FieldLabel>이메일</FieldLabel>\n * <FieldControl>\n * <Textbox value={email} onValueChange={setEmail} placeholder=\"name@company.com\" />\n * </FieldControl>\n * <FieldDescription>회사 이메일을 입력해 주세요.</FieldDescription>\n * <FieldError>{error}</FieldError>\n * </Field>\n * ```\n *\n * @example\n * ```tsx\n * import { Checkbox, Field, FieldContent, FieldControl, FieldDescription, FieldLabel } from \"@aivex/ui\";\n *\n * <Field orientation=\"horizontal\">\n * <FieldControl>\n * <Checkbox defaultChecked />\n * </FieldControl>\n * <FieldContent>\n * <FieldLabel>마케팅 정보 수신 동의</FieldLabel>\n * <FieldDescription>언제든 해지할 수 있습니다.</FieldDescription>\n * </FieldContent>\n * </Field>\n * ```\n */\nfunction Field({\n className,\n orientation,\n fieldId,\n invalid = false,\n disabled = false,\n ref,\n ...props\n}: FieldProps) {\n const generatedId = useId();\n const controlId = fieldId ?? generatedId;\n\n const [descriptionCount, setDescriptionCount] = useState(0);\n const [errorCount, setErrorCount] = useState(0);\n const registerDescription = useCallback(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, []);\n const registerError = useCallback(() => {\n setErrorCount((count) => count + 1);\n return () => setErrorCount((count) => count - 1);\n }, []);\n const value: FieldContextValue = {\n controlId,\n descriptionId: `${controlId}-description`,\n errorId: `${controlId}-error`,\n invalid,\n disabled,\n hasDescription: descriptionCount > 0,\n hasError: errorCount > 0,\n registerDescription,\n registerError,\n };\n\n return (\n <FieldContext.Provider value={value}>\n <div\n ref={ref}\n className={cn(fieldVariants({ orientation }), className)}\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n {...props}\n />\n </FieldContext.Provider>\n );\n}\n\nexport interface FieldLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {\n /** label 요소 ref */\n ref?: Ref<HTMLLabelElement>;\n}\n\n/** FieldControl의 컨트롤에 htmlFor로 자동 연결되는 라벨. invalid면 위험색, disabled면 비활성색. */\nfunction FieldLabel({ className, ref, ...props }: FieldLabelProps) {\n const { controlId, invalid, disabled } = useFieldContext();\n\n return (\n // biome-ignore lint/a11y/noLabelWithoutControl: htmlFor={controlId}로 FieldControl의 컨트롤과 연결됨\n <label\n ref={ref}\n htmlFor={controlId}\n className={cn(\n \"aivex:text-label-md aivex:text-text-secondary aivex:cursor-pointer aivex:select-none\",\n disabled && \"aivex:cursor-not-allowed aivex:text-text-disabled\",\n !disabled && invalid && \"aivex:text-text-danger\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldContentProps extends HTMLAttributes<HTMLDivElement> {\n /** 루트 div ref */\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 가로 배치(Checkbox 등)에서 라벨과 설명을 세로로 묶는 그룹.\n */\nfunction FieldContent({ className, ref, ...props }: FieldContentProps) {\n return (\n <div\n ref={ref}\n data-slot=\"field-content\"\n className={cn(\n \"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:gap-2xs\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Field가 disabled면 컨트롤에도 disabled를 넘긴다. Slot은 자식 props를 우선하므로 `disabled={undefined}`처럼\n * 값 없이 넘어온 prop까지 Field 값을 덮어쓴다. 그래서 자식 값이 undefined일 때만 직접 채운다.\n */\nfunction withFieldDisabled(children: ReactNode, disabled: boolean) {\n if (!disabled || !isValidElement<{ disabled?: boolean }>(children)) return children;\n if (children.props.disabled !== undefined) return children;\n return cloneElement(children, { disabled: true });\n}\n\nexport interface FieldControlProps {\n /** id/aria를 주입받을 단일 컨트롤 요소 */\n children: ReactNode;\n}\n\n/**\n * 컨트롤(단일 요소)을 감싸 id/aria-describedby/aria-invalid와 Field의 disabled를 자동 주입한다.\n * 자식은 id/aria-* 를 내부 input 으로 전달하는 컴포넌트여야 한다(Textbox, Textarea, Tagbox, SelectBox,\n * SelectButton, Checkbox, Radio, Switch 등). DOM 래퍼 없이 자식에 props만 병합한다(Radix Slot).\n */\nfunction FieldControl({ children }: FieldControlProps) {\n const { controlId, descriptionId, errorId, invalid, disabled, hasDescription, hasError } =\n useFieldContext();\n // 없는 요소의 id를 가리키지 않도록 실제로 렌더된 설명·에러만 연결한다.\n const describedBy =\n [hasDescription && descriptionId, invalid && hasError && errorId].filter(Boolean).join(\" \") ||\n undefined;\n\n return (\n <Slot id={controlId} aria-describedby={describedBy} aria-invalid={invalid || undefined}>\n {withFieldDisabled(children, disabled)}\n </Slot>\n );\n}\n\nexport interface FieldDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /** p 요소 ref */\n ref?: Ref<HTMLParagraphElement>;\n}\n\n/** 컨트롤의 보조 설명 문구. 컨트롤의 aria-describedby로 자동 연결된다. */\nfunction FieldDescription({ className, ref, ...props }: FieldDescriptionProps) {\n const { descriptionId, disabled, registerDescription } = useFieldContext();\n useEffect(registerDescription, [registerDescription]);\n\n return (\n <p\n ref={ref}\n id={descriptionId}\n className={cn(\n \"aivex:text-caption-md aivex:text-text-secondary\",\n disabled && \"aivex:text-text-disabled\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldErrorProps extends HTMLAttributes<HTMLParagraphElement> {\n /** p 요소 ref */\n ref?: Ref<HTMLParagraphElement>;\n}\n\n/**\n * 에러 메시지(`role=\"alert\"`). Field가 invalid이고 children이 있을 때만 렌더되며, 그때 컨트롤의\n * aria-describedby에 연결된다. 그래서 메시지는 늘 두고 Field의 `invalid`로 보이고 숨긴다.\n */\nfunction FieldError({ className, children, ref, ...props }: FieldErrorProps) {\n const { errorId, invalid, registerError } = useFieldContext();\n // 컨트롤의 aria-describedby가 errorId를 가리키는 조건(invalid)과 맞춘다.\n const visible = invalid && Boolean(children);\n useEffect(() => (visible ? registerError() : undefined), [visible, registerError]);\n\n if (!visible) return null;\n\n return (\n <p\n ref={ref}\n id={errorId}\n role=\"alert\"\n className={cn(\"aivex:text-caption-md aivex:text-text-danger\", className)}\n {...props}\n >\n {children}\n </p>\n );\n}\n\nexport {\n Field,\n FieldContent,\n FieldControl,\n FieldDescription,\n FieldError,\n FieldLabel,\n fieldVariants,\n};\n"],"mappings":"2OAmCA,IAAM,GAAA,EAAA,EAAA,eAAuD,KAAK,CAElE,SAAS,GAAkB,CACzB,IAAM,GAAA,EAAA,EAAA,YAAqB,EAAa,CACxC,GAAI,CAAC,EACH,MAAU,MAAM,wCAAwC,CAE1D,OAAO,EAIT,IAAM,GAAA,EAAA,EAAA,KAAoB,0BAA2B,CACnD,SAAU,CACR,YAAa,CAEX,SAAU,8BAKV,WACE,mGACH,CACF,CACD,gBAAiB,CAAE,YAAa,WAAY,CAC7C,CAAC,CA0DF,SAAS,EAAM,CACb,YACA,cACA,UACA,UAAU,GACV,WAAW,GACX,MACA,GAAG,GACU,CACb,IAAM,GAAA,EAAA,EAAA,QAAqB,CACrB,EAAY,GAAW,EAEvB,CAAC,EAAkB,IAAA,EAAA,EAAA,UAAgC,EAAE,CACrD,CAAC,EAAY,IAAA,EAAA,EAAA,UAA0B,EAAE,CACzC,GAAA,EAAA,EAAA,kBACJ,EAAqB,GAAU,EAAQ,EAAE,KAC5B,EAAqB,GAAU,EAAQ,EAAE,EACrD,EAAE,CAAC,CACA,GAAA,EAAA,EAAA,kBACJ,EAAe,GAAU,EAAQ,EAAE,KACtB,EAAe,GAAU,EAAQ,EAAE,EAC/C,EAAE,CAAC,CACA,EAA2B,CAC/B,YACA,cAAe,GAAG,EAAU,cAC5B,QAAS,GAAG,EAAU,QACtB,UACA,WACA,eAAgB,EAAmB,EACnC,SAAU,EAAa,EACvB,sBACA,gBACD,CAED,OACE,EAAA,EAAA,KAAC,EAAa,SAAd,CAA8B,kBAC5B,EAAA,EAAA,KAAC,MAAD,CACO,MACL,UAAW,EAAA,GAAG,EAAc,CAAE,cAAa,CAAC,CAAE,EAAU,CACxD,eAAc,GAAW,IAAA,GACzB,gBAAe,GAAY,IAAA,GAC3B,GAAI,EACJ,CAAA,CACoB,CAAA,CAU5B,SAAS,EAAW,CAAE,YAAW,MAAK,GAAG,GAA0B,CACjE,GAAM,CAAE,YAAW,UAAS,YAAa,GAAiB,CAE1D,OAEE,EAAA,EAAA,KAAC,QAAD,CACO,MACL,QAAS,EACT,UAAW,EAAA,GACT,uFACA,GAAY,oDACZ,CAAC,GAAY,GAAW,yBACxB,EACD,CACD,GAAI,EACJ,CAAA,CAYN,SAAS,EAAa,CAAE,YAAW,MAAK,GAAG,GAA4B,CACrE,OACE,EAAA,EAAA,KAAC,MAAD,CACO,MACL,YAAU,gBACV,UAAW,EAAA,GACT,qEACA,EACD,CACD,GAAI,EACJ,CAAA,CAQN,SAAS,EAAkB,EAAqB,EAAmB,CAGjE,MAFI,CAAC,GAAY,EAAA,EAAA,EAAA,gBAAwC,EAAS,EAC9D,EAAS,MAAM,WAAa,IAAA,GAAkB,GAClD,EAAA,EAAA,cAAoB,EAAU,CAAE,SAAU,GAAM,CAAC,CAanD,SAAS,EAAa,CAAE,YAA+B,CACrD,GAAM,CAAE,YAAW,gBAAe,UAAS,UAAS,WAAU,iBAAgB,YAC5E,GAAiB,CAMnB,OACE,EAAA,EAAA,KAAC,EAAA,KAAD,CAAM,GAAI,EAAW,mBAJrB,CAAC,GAAkB,EAAe,GAAW,GAAY,EAAQ,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,EAC3F,IAAA,GAGoD,eAAc,GAAW,IAAA,YAC1E,EAAkB,EAAU,EAAS,CACjC,CAAA,CAUX,SAAS,EAAiB,CAAE,YAAW,MAAK,GAAG,GAAgC,CAC7E,GAAM,CAAE,gBAAe,WAAU,uBAAwB,GAAiB,CAG1E,OAFA,EAAA,EAAA,WAAU,EAAqB,CAAC,EAAoB,CAAC,EAGnD,EAAA,EAAA,KAAC,IAAD,CACO,MACL,GAAI,EACJ,UAAW,EAAA,GACT,kDACA,GAAY,2BACZ,EACD,CACD,GAAI,EACJ,CAAA,CAaN,SAAS,EAAW,CAAE,YAAW,WAAU,MAAK,GAAG,GAA0B,CAC3E,GAAM,CAAE,UAAS,UAAS,iBAAkB,GAAiB,CAEvD,EAAU,GAAW,EAAQ,EAKnC,OAJA,EAAA,EAAA,eAAiB,EAAU,GAAe,CAAG,IAAA,GAAY,CAAC,EAAS,EAAc,CAAC,CAE7E,GAGH,EAAA,EAAA,KAAC,IAAD,CACO,MACL,GAAI,EACJ,KAAK,QACL,UAAW,EAAA,GAAG,+CAAgD,EAAU,CACxE,GAAI,EAEH,WACC,CAAA,CAXe"}
|
|
1
|
+
{"version":3,"file":"Field.cjs","names":[],"sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as FieldPrimitive } from \"@base-ui/react/field\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type HTMLAttributes, type Ref, useMemo } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { FieldStateContext, useFieldState } from \"./FieldStateContext\";\n\n/** Field 루트의 배치(orientation) 클래스를 만드는 cva 변형. */\nconst fieldVariants = cva(\"aivex:flex aivex:w-full\", {\n variants: {\n orientation: {\n /** 라벨이 위, 컨트롤이 아래 (Textbox 등) */\n vertical: \"aivex:flex-col aivex:gap-xs\",\n /**\n * 컨트롤이 좌측, 라벨/설명이 우측 (Checkbox/Radio/Switch 등).\n * 기본은 중앙 정렬(단일 라벨), FieldContent(라벨+설명) 포함 시 상단 정렬.\n */\n horizontal:\n \"aivex:flex-row aivex:items-center aivex:gap-sm aivex:has-[[data-slot=field-content]]:items-start\",\n },\n },\n defaultVariants: { orientation: \"vertical\" },\n});\n\nexport interface FieldProps\n extends Omit<FieldPrimitive.Root.Props, \"className\" | \"invalid\" | \"disabled\">,\n VariantProps<typeof fieldVariants> {\n className?: string;\n /**\n * 에러 상태. 안의 컨트롤에 `aria-invalid`가 붙고 에러 테두리가 켜지며, FieldLabel이 위험색으로 바뀌고\n * FieldError가 보인다.\n * @default false\n */\n invalid?: boolean;\n /**\n * 비활성 상태. 라벨·설명을 비활성색으로 바꾸고 안의 컨트롤을 비활성화한다.\n * 컨트롤에 `disabled`를 따로 줘도 되지만, Field가 비활성이면 컨트롤만 다시 켤 수는 없다.\n * @default false\n */\n disabled?: boolean;\n /** 루트 div ref */\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 라벨·설명·에러를 입력 컨트롤과 id/aria로 연결하는 폼 필드 래퍼.\n * Textbox·Textarea·Tagbox·NumberField·SelectBox·Checkbox·RadioGroup·Switch·Slider는 Field 안에 그대로\n * 넣으면 자동으로 연결된다(라벨 클릭 시 포커스, 설명·에러의 aria-describedby, invalid·disabled 전달).\n * 컨트롤의 id를 정하려면 컨트롤에 `id`를 준다. 직접 만든 입력이나 SelectButton은 FieldControl의 `render`로 넣는다.\n * react-hook-form 등 특정 폼 라이브러리에 종속되지 않는다.\n * `orientation=\"vertical\"`(기본)은 라벨 위·컨트롤 아래, `\"horizontal\"`은 Checkbox/Radio/Switch처럼 컨트롤 좌측·라벨 우측.\n *\n * @example\n * ```tsx\n * import { Field, FieldDescription, FieldError, FieldLabel, Textbox } from \"@aivex/ui\";\n *\n * <Field invalid={!!error}>\n * <FieldLabel>이메일</FieldLabel>\n * <Textbox value={email} onValueChange={setEmail} placeholder=\"name@company.com\" />\n * <FieldDescription>회사 이메일을 입력해 주세요.</FieldDescription>\n * <FieldError>{error}</FieldError>\n * </Field>\n * ```\n *\n * @example\n * ```tsx\n * import { Checkbox, Field, FieldContent, FieldDescription, FieldLabel } from \"@aivex/ui\";\n *\n * <Field orientation=\"horizontal\">\n * <Checkbox defaultChecked />\n * <FieldContent>\n * <FieldLabel>마케팅 정보 수신 동의</FieldLabel>\n * <FieldDescription>언제든 해지할 수 있습니다.</FieldDescription>\n * </FieldContent>\n * </Field>\n * ```\n */\nfunction Field({\n className,\n orientation,\n invalid = false,\n disabled = false,\n ref,\n ...props\n}: FieldProps) {\n const state = useMemo(() => ({ invalid, disabled }), [invalid, disabled]);\n\n return (\n <FieldStateContext.Provider value={state}>\n <FieldPrimitive.Root\n ref={ref}\n invalid={invalid}\n disabled={disabled}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n </FieldStateContext.Provider>\n );\n}\n\nexport type FieldLabelProps = Omit<FieldPrimitive.Label.Props, \"className\"> & {\n className?: string;\n /** label 요소 ref */\n ref?: Ref<HTMLLabelElement>;\n};\n\n/** Field 안의 컨트롤에 자동으로 연결되는 라벨. invalid면 위험색, disabled면 비활성색. */\nfunction FieldLabel({ className, ref, ...props }: FieldLabelProps) {\n const { invalid, disabled } = useFieldState();\n\n return (\n <FieldPrimitive.Label\n ref={ref}\n className={cn(\n \"aivex:text-label-md aivex:text-text-secondary aivex:cursor-pointer aivex:select-none\",\n disabled && \"aivex:cursor-not-allowed aivex:text-text-disabled\",\n !disabled && invalid && \"aivex:text-text-danger\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldContentProps extends HTMLAttributes<HTMLDivElement> {\n /** 루트 div ref */\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * 가로 배치(Checkbox 등)에서 라벨과 설명을 세로로 묶는 그룹.\n */\nfunction FieldContent({ className, ref, ...props }: FieldContentProps) {\n return (\n <div\n ref={ref}\n data-slot=\"field-content\"\n className={cn(\n \"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:gap-2xs\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type FieldControlProps = FieldPrimitive.Control.Props & {\n /** 렌더된 컨트롤 요소 ref */\n ref?: Ref<HTMLElement>;\n};\n\n/**\n * 자동으로 연결되지 않는 컨트롤을 Field에 잇는 다리. 기본은 `<input>`을 그리고, 직접 만든 입력이나\n * SelectButton은 `render`로 넘긴다 — id·aria-labelledby·aria-describedby·aria-invalid·disabled가 그 요소에 전달된다.\n * Textbox·SelectBox·Checkbox처럼 자동으로 연결되는 컨트롤은 감싸지 않고 Field 안에 그대로 넣는다.\n *\n * @example\n * ```tsx\n * import { Field, FieldControl, FieldLabel, SelectButton } from \"@aivex/ui\";\n *\n * <Field>\n * <FieldLabel>프리셋</FieldLabel>\n * <FieldControl render={<SelectButton value={preset} onClick={openPresetModal} />} />\n * </Field>\n * ```\n */\nfunction FieldControl({ ref, ...props }: FieldControlProps) {\n return <FieldPrimitive.Control ref={ref} {...props} />;\n}\n\nexport type FieldDescriptionProps = Omit<FieldPrimitive.Description.Props, \"className\"> & {\n className?: string;\n /** p 요소 ref */\n ref?: Ref<HTMLParagraphElement>;\n};\n\n/** 컨트롤의 보조 설명 문구. 컨트롤의 aria-describedby로 자동 연결된다. */\nfunction FieldDescription({ className, ref, ...props }: FieldDescriptionProps) {\n const { disabled } = useFieldState();\n\n return (\n <FieldPrimitive.Description\n ref={ref}\n className={cn(\n \"aivex:text-caption-md aivex:text-text-secondary\",\n disabled && \"aivex:text-text-disabled\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport type FieldErrorProps = Omit<FieldPrimitive.Error.Props, \"className\" | \"match\"> & {\n className?: string;\n /** p 요소 ref */\n ref?: Ref<HTMLParagraphElement>;\n};\n\n/**\n * 에러 메시지(`role=\"alert\"`). Field가 invalid이고 children이 있을 때만 렌더되며, 그때 컨트롤의\n * aria-describedby에 연결된다. 그래서 메시지는 늘 두고 Field의 `invalid`로 보이고 숨긴다.\n */\nfunction FieldError({ className, children, ref, ...props }: FieldErrorProps) {\n const { invalid } = useFieldState();\n // 컨트롤에 aria-invalid가 붙는 조건(Field의 invalid)과 맞춘다.\n if (!invalid || !children) return null;\n\n return (\n <FieldPrimitive.Error\n // 보일지는 위에서 정했으므로 항상 그린다(match). Base UI 자체 검증 결과와는 무관하다.\n match\n ref={ref as Ref<HTMLDivElement>}\n render={<p />}\n role=\"alert\"\n className={cn(\"aivex:text-caption-md aivex:text-text-danger\", className)}\n {...props}\n >\n {children}\n </FieldPrimitive.Error>\n );\n}\n\nexport {\n Field,\n FieldContent,\n FieldControl,\n FieldDescription,\n FieldError,\n FieldLabel,\n fieldVariants,\n};\n"],"mappings":"gRASA,IAAM,GAAA,EAAA,EAAA,KAAoB,0BAA2B,CACnD,SAAU,CACR,YAAa,CAEX,SAAU,8BAKV,WACE,mGACH,CACF,CACD,gBAAiB,CAAE,YAAa,WAAY,CAC7C,CAAC,CAuDF,SAAS,EAAM,CACb,YACA,cACA,UAAU,GACV,WAAW,GACX,MACA,GAAG,GACU,CACb,IAAM,GAAA,EAAA,EAAA,cAAuB,CAAE,UAAS,WAAU,EAAG,CAAC,EAAS,EAAS,CAAC,CAEzE,OACE,EAAA,EAAA,KAAC,EAAA,kBAAkB,SAAnB,CAA4B,MAAO,YACjC,EAAA,EAAA,KAAC,EAAA,MAAe,KAAhB,CACO,MACI,UACC,WACV,UAAW,EAAA,GAAG,EAAc,CAAE,cAAa,CAAC,CAAE,EAAU,CACxD,GAAI,EACJ,CAAA,CACyB,CAAA,CAWjC,SAAS,EAAW,CAAE,YAAW,MAAK,GAAG,GAA0B,CACjE,GAAM,CAAE,UAAS,YAAa,EAAA,eAAe,CAE7C,OACE,EAAA,EAAA,KAAC,EAAA,MAAe,MAAhB,CACO,MACL,UAAW,EAAA,GACT,uFACA,GAAY,oDACZ,CAAC,GAAY,GAAW,yBACxB,EACD,CACD,GAAI,EACJ,CAAA,CAYN,SAAS,EAAa,CAAE,YAAW,MAAK,GAAG,GAA4B,CACrE,OACE,EAAA,EAAA,KAAC,MAAD,CACO,MACL,YAAU,gBACV,UAAW,EAAA,GACT,qEACA,EACD,CACD,GAAI,EACJ,CAAA,CAwBN,SAAS,EAAa,CAAE,MAAK,GAAG,GAA4B,CAC1D,OAAO,EAAA,EAAA,KAAC,EAAA,MAAe,QAAhB,CAA6B,MAAK,GAAI,EAAS,CAAA,CAUxD,SAAS,EAAiB,CAAE,YAAW,MAAK,GAAG,GAAgC,CAC7E,GAAM,CAAE,YAAa,EAAA,eAAe,CAEpC,OACE,EAAA,EAAA,KAAC,EAAA,MAAe,YAAhB,CACO,MACL,UAAW,EAAA,GACT,kDACA,GAAY,2BACZ,EACD,CACD,GAAI,EACJ,CAAA,CAcN,SAAS,EAAW,CAAE,YAAW,WAAU,MAAK,GAAG,GAA0B,CAC3E,GAAM,CAAE,WAAY,EAAA,eAAe,CAInC,MAFI,CAAC,GAAW,CAAC,EAAiB,MAGhC,EAAA,EAAA,KAAC,EAAA,MAAe,MAAhB,CAEE,MAAA,GACK,MACL,QAAQ,EAAA,EAAA,KAAC,IAAD,EAAK,CAAA,CACb,KAAK,QACL,UAAW,EAAA,GAAG,+CAAgD,EAAU,CACxE,GAAI,EAEH,WACoB,CAAA"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { Field as FieldPrimitive } from "@base-ui/react/field";
|
|
1
2
|
import { type VariantProps } from "class-variance-authority";
|
|
2
|
-
import { type HTMLAttributes, type
|
|
3
|
+
import { type HTMLAttributes, type Ref } from "react";
|
|
3
4
|
/** Field 루트의 배치(orientation) 클래스를 만드는 cva 변형. */
|
|
4
5
|
declare const fieldVariants: (props?: ({
|
|
5
6
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
export interface FieldProps extends
|
|
8
|
-
|
|
9
|
-
fieldId?: string;
|
|
8
|
+
export interface FieldProps extends Omit<FieldPrimitive.Root.Props, "className" | "invalid" | "disabled">, VariantProps<typeof fieldVariants> {
|
|
9
|
+
className?: string;
|
|
10
10
|
/**
|
|
11
|
-
* 에러 상태.
|
|
12
|
-
*
|
|
11
|
+
* 에러 상태. 안의 컨트롤에 `aria-invalid`가 붙고 에러 테두리가 켜지며, FieldLabel이 위험색으로 바뀌고
|
|
12
|
+
* FieldError가 보인다.
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
invalid?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
* 비활성 상태. 라벨·설명을 비활성색으로
|
|
18
|
-
* 컨트롤에
|
|
17
|
+
* 비활성 상태. 라벨·설명을 비활성색으로 바꾸고 안의 컨트롤을 비활성화한다.
|
|
18
|
+
* 컨트롤에 `disabled`를 따로 줘도 되지만, Field가 비활성이면 컨트롤만 다시 켤 수는 없다.
|
|
19
19
|
* @default false
|
|
20
20
|
*/
|
|
21
21
|
disabled?: boolean;
|
|
@@ -24,19 +24,19 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* 라벨·설명·에러를 입력 컨트롤과 id/aria로 연결하는 폼 필드 래퍼.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Textbox·Textarea·Tagbox·NumberField·SelectBox·Checkbox·RadioGroup·Switch·Slider는 Field 안에 그대로
|
|
28
|
+
* 넣으면 자동으로 연결된다(라벨 클릭 시 포커스, 설명·에러의 aria-describedby, invalid·disabled 전달).
|
|
29
|
+
* 컨트롤의 id를 정하려면 컨트롤에 `id`를 준다. 직접 만든 입력이나 SelectButton은 FieldControl의 `render`로 넣는다.
|
|
30
|
+
* react-hook-form 등 특정 폼 라이브러리에 종속되지 않는다.
|
|
29
31
|
* `orientation="vertical"`(기본)은 라벨 위·컨트롤 아래, `"horizontal"`은 Checkbox/Radio/Switch처럼 컨트롤 좌측·라벨 우측.
|
|
30
32
|
*
|
|
31
33
|
* @example
|
|
32
34
|
* ```tsx
|
|
33
|
-
* import { Field,
|
|
35
|
+
* import { Field, FieldDescription, FieldError, FieldLabel, Textbox } from "@aivex/ui";
|
|
34
36
|
*
|
|
35
37
|
* <Field invalid={!!error}>
|
|
36
38
|
* <FieldLabel>이메일</FieldLabel>
|
|
37
|
-
* <
|
|
38
|
-
* <Textbox value={email} onValueChange={setEmail} placeholder="name@company.com" />
|
|
39
|
-
* </FieldControl>
|
|
39
|
+
* <Textbox value={email} onValueChange={setEmail} placeholder="name@company.com" />
|
|
40
40
|
* <FieldDescription>회사 이메일을 입력해 주세요.</FieldDescription>
|
|
41
41
|
* <FieldError>{error}</FieldError>
|
|
42
42
|
* </Field>
|
|
@@ -44,12 +44,10 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```tsx
|
|
47
|
-
* import { Checkbox, Field, FieldContent,
|
|
47
|
+
* import { Checkbox, Field, FieldContent, FieldDescription, FieldLabel } from "@aivex/ui";
|
|
48
48
|
*
|
|
49
49
|
* <Field orientation="horizontal">
|
|
50
|
-
* <
|
|
51
|
-
* <Checkbox defaultChecked />
|
|
52
|
-
* </FieldControl>
|
|
50
|
+
* <Checkbox defaultChecked />
|
|
53
51
|
* <FieldContent>
|
|
54
52
|
* <FieldLabel>마케팅 정보 수신 동의</FieldLabel>
|
|
55
53
|
* <FieldDescription>언제든 해지할 수 있습니다.</FieldDescription>
|
|
@@ -57,12 +55,13 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
57
55
|
* </Field>
|
|
58
56
|
* ```
|
|
59
57
|
*/
|
|
60
|
-
declare function Field({ className, orientation,
|
|
61
|
-
export
|
|
58
|
+
declare function Field({ className, orientation, invalid, disabled, ref, ...props }: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export type FieldLabelProps = Omit<FieldPrimitive.Label.Props, "className"> & {
|
|
60
|
+
className?: string;
|
|
62
61
|
/** label 요소 ref */
|
|
63
62
|
ref?: Ref<HTMLLabelElement>;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
63
|
+
};
|
|
64
|
+
/** Field 안의 컨트롤에 자동으로 연결되는 라벨. invalid면 위험색, disabled면 비활성색. */
|
|
66
65
|
declare function FieldLabel({ className, ref, ...props }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
67
66
|
export interface FieldContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
68
67
|
/** 루트 div ref */
|
|
@@ -72,26 +71,38 @@ export interface FieldContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
72
71
|
* 가로 배치(Checkbox 등)에서 라벨과 설명을 세로로 묶는 그룹.
|
|
73
72
|
*/
|
|
74
73
|
declare function FieldContent({ className, ref, ...props }: FieldContentProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
-
export
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
}
|
|
74
|
+
export type FieldControlProps = FieldPrimitive.Control.Props & {
|
|
75
|
+
/** 렌더된 컨트롤 요소 ref */
|
|
76
|
+
ref?: Ref<HTMLElement>;
|
|
77
|
+
};
|
|
79
78
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* 자동으로 연결되지 않는 컨트롤을 Field에 잇는 다리. 기본은 `<input>`을 그리고, 직접 만든 입력이나
|
|
80
|
+
* SelectButton은 `render`로 넘긴다 — id·aria-labelledby·aria-describedby·aria-invalid·disabled가 그 요소에 전달된다.
|
|
81
|
+
* Textbox·SelectBox·Checkbox처럼 자동으로 연결되는 컨트롤은 감싸지 않고 Field 안에 그대로 넣는다.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* import { Field, FieldControl, FieldLabel, SelectButton } from "@aivex/ui";
|
|
86
|
+
*
|
|
87
|
+
* <Field>
|
|
88
|
+
* <FieldLabel>프리셋</FieldLabel>
|
|
89
|
+
* <FieldControl render={<SelectButton value={preset} onClick={openPresetModal} />} />
|
|
90
|
+
* </Field>
|
|
91
|
+
* ```
|
|
83
92
|
*/
|
|
84
|
-
declare function FieldControl({
|
|
85
|
-
export
|
|
93
|
+
declare function FieldControl({ ref, ...props }: FieldControlProps): import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
export type FieldDescriptionProps = Omit<FieldPrimitive.Description.Props, "className"> & {
|
|
95
|
+
className?: string;
|
|
86
96
|
/** p 요소 ref */
|
|
87
97
|
ref?: Ref<HTMLParagraphElement>;
|
|
88
|
-
}
|
|
98
|
+
};
|
|
89
99
|
/** 컨트롤의 보조 설명 문구. 컨트롤의 aria-describedby로 자동 연결된다. */
|
|
90
100
|
declare function FieldDescription({ className, ref, ...props }: FieldDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
91
|
-
export
|
|
101
|
+
export type FieldErrorProps = Omit<FieldPrimitive.Error.Props, "className" | "match"> & {
|
|
102
|
+
className?: string;
|
|
92
103
|
/** p 요소 ref */
|
|
93
104
|
ref?: Ref<HTMLParagraphElement>;
|
|
94
|
-
}
|
|
105
|
+
};
|
|
95
106
|
/**
|
|
96
107
|
* 에러 메시지(`role="alert"`). Field가 invalid이고 children이 있을 때만 렌더되며, 그때 컨트롤의
|
|
97
108
|
* aria-describedby에 연결된다. 그래서 메시지는 늘 두고 Field의 `invalid`로 보이고 숨긴다.
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { Field as FieldPrimitive } from "@base-ui/react/field";
|
|
1
2
|
import { type VariantProps } from "class-variance-authority";
|
|
2
|
-
import { type HTMLAttributes, type
|
|
3
|
+
import { type HTMLAttributes, type Ref } from "react";
|
|
3
4
|
/** Field 루트의 배치(orientation) 클래스를 만드는 cva 변형. */
|
|
4
5
|
declare const fieldVariants: (props?: ({
|
|
5
6
|
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
6
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
export interface FieldProps extends
|
|
8
|
-
|
|
9
|
-
fieldId?: string;
|
|
8
|
+
export interface FieldProps extends Omit<FieldPrimitive.Root.Props, "className" | "invalid" | "disabled">, VariantProps<typeof fieldVariants> {
|
|
9
|
+
className?: string;
|
|
10
10
|
/**
|
|
11
|
-
* 에러 상태.
|
|
12
|
-
*
|
|
11
|
+
* 에러 상태. 안의 컨트롤에 `aria-invalid`가 붙고 에러 테두리가 켜지며, FieldLabel이 위험색으로 바뀌고
|
|
12
|
+
* FieldError가 보인다.
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
invalid?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
* 비활성 상태. 라벨·설명을 비활성색으로
|
|
18
|
-
* 컨트롤에
|
|
17
|
+
* 비활성 상태. 라벨·설명을 비활성색으로 바꾸고 안의 컨트롤을 비활성화한다.
|
|
18
|
+
* 컨트롤에 `disabled`를 따로 줘도 되지만, Field가 비활성이면 컨트롤만 다시 켤 수는 없다.
|
|
19
19
|
* @default false
|
|
20
20
|
*/
|
|
21
21
|
disabled?: boolean;
|
|
@@ -24,19 +24,19 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* 라벨·설명·에러를 입력 컨트롤과 id/aria로 연결하는 폼 필드 래퍼.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Textbox·Textarea·Tagbox·NumberField·SelectBox·Checkbox·RadioGroup·Switch·Slider는 Field 안에 그대로
|
|
28
|
+
* 넣으면 자동으로 연결된다(라벨 클릭 시 포커스, 설명·에러의 aria-describedby, invalid·disabled 전달).
|
|
29
|
+
* 컨트롤의 id를 정하려면 컨트롤에 `id`를 준다. 직접 만든 입력이나 SelectButton은 FieldControl의 `render`로 넣는다.
|
|
30
|
+
* react-hook-form 등 특정 폼 라이브러리에 종속되지 않는다.
|
|
29
31
|
* `orientation="vertical"`(기본)은 라벨 위·컨트롤 아래, `"horizontal"`은 Checkbox/Radio/Switch처럼 컨트롤 좌측·라벨 우측.
|
|
30
32
|
*
|
|
31
33
|
* @example
|
|
32
34
|
* ```tsx
|
|
33
|
-
* import { Field,
|
|
35
|
+
* import { Field, FieldDescription, FieldError, FieldLabel, Textbox } from "@aivex/ui";
|
|
34
36
|
*
|
|
35
37
|
* <Field invalid={!!error}>
|
|
36
38
|
* <FieldLabel>이메일</FieldLabel>
|
|
37
|
-
* <
|
|
38
|
-
* <Textbox value={email} onValueChange={setEmail} placeholder="name@company.com" />
|
|
39
|
-
* </FieldControl>
|
|
39
|
+
* <Textbox value={email} onValueChange={setEmail} placeholder="name@company.com" />
|
|
40
40
|
* <FieldDescription>회사 이메일을 입력해 주세요.</FieldDescription>
|
|
41
41
|
* <FieldError>{error}</FieldError>
|
|
42
42
|
* </Field>
|
|
@@ -44,12 +44,10 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```tsx
|
|
47
|
-
* import { Checkbox, Field, FieldContent,
|
|
47
|
+
* import { Checkbox, Field, FieldContent, FieldDescription, FieldLabel } from "@aivex/ui";
|
|
48
48
|
*
|
|
49
49
|
* <Field orientation="horizontal">
|
|
50
|
-
* <
|
|
51
|
-
* <Checkbox defaultChecked />
|
|
52
|
-
* </FieldControl>
|
|
50
|
+
* <Checkbox defaultChecked />
|
|
53
51
|
* <FieldContent>
|
|
54
52
|
* <FieldLabel>마케팅 정보 수신 동의</FieldLabel>
|
|
55
53
|
* <FieldDescription>언제든 해지할 수 있습니다.</FieldDescription>
|
|
@@ -57,12 +55,13 @@ export interface FieldProps extends HTMLAttributes<HTMLDivElement>, VariantProps
|
|
|
57
55
|
* </Field>
|
|
58
56
|
* ```
|
|
59
57
|
*/
|
|
60
|
-
declare function Field({ className, orientation,
|
|
61
|
-
export
|
|
58
|
+
declare function Field({ className, orientation, invalid, disabled, ref, ...props }: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export type FieldLabelProps = Omit<FieldPrimitive.Label.Props, "className"> & {
|
|
60
|
+
className?: string;
|
|
62
61
|
/** label 요소 ref */
|
|
63
62
|
ref?: Ref<HTMLLabelElement>;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
63
|
+
};
|
|
64
|
+
/** Field 안의 컨트롤에 자동으로 연결되는 라벨. invalid면 위험색, disabled면 비활성색. */
|
|
66
65
|
declare function FieldLabel({ className, ref, ...props }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
67
66
|
export interface FieldContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
68
67
|
/** 루트 div ref */
|
|
@@ -72,26 +71,38 @@ export interface FieldContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
72
71
|
* 가로 배치(Checkbox 등)에서 라벨과 설명을 세로로 묶는 그룹.
|
|
73
72
|
*/
|
|
74
73
|
declare function FieldContent({ className, ref, ...props }: FieldContentProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
-
export
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
}
|
|
74
|
+
export type FieldControlProps = FieldPrimitive.Control.Props & {
|
|
75
|
+
/** 렌더된 컨트롤 요소 ref */
|
|
76
|
+
ref?: Ref<HTMLElement>;
|
|
77
|
+
};
|
|
79
78
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* 자동으로 연결되지 않는 컨트롤을 Field에 잇는 다리. 기본은 `<input>`을 그리고, 직접 만든 입력이나
|
|
80
|
+
* SelectButton은 `render`로 넘긴다 — id·aria-labelledby·aria-describedby·aria-invalid·disabled가 그 요소에 전달된다.
|
|
81
|
+
* Textbox·SelectBox·Checkbox처럼 자동으로 연결되는 컨트롤은 감싸지 않고 Field 안에 그대로 넣는다.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* import { Field, FieldControl, FieldLabel, SelectButton } from "@aivex/ui";
|
|
86
|
+
*
|
|
87
|
+
* <Field>
|
|
88
|
+
* <FieldLabel>프리셋</FieldLabel>
|
|
89
|
+
* <FieldControl render={<SelectButton value={preset} onClick={openPresetModal} />} />
|
|
90
|
+
* </Field>
|
|
91
|
+
* ```
|
|
83
92
|
*/
|
|
84
|
-
declare function FieldControl({
|
|
85
|
-
export
|
|
93
|
+
declare function FieldControl({ ref, ...props }: FieldControlProps): import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
export type FieldDescriptionProps = Omit<FieldPrimitive.Description.Props, "className"> & {
|
|
95
|
+
className?: string;
|
|
86
96
|
/** p 요소 ref */
|
|
87
97
|
ref?: Ref<HTMLParagraphElement>;
|
|
88
|
-
}
|
|
98
|
+
};
|
|
89
99
|
/** 컨트롤의 보조 설명 문구. 컨트롤의 aria-describedby로 자동 연결된다. */
|
|
90
100
|
declare function FieldDescription({ className, ref, ...props }: FieldDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
91
|
-
export
|
|
101
|
+
export type FieldErrorProps = Omit<FieldPrimitive.Error.Props, "className" | "match"> & {
|
|
102
|
+
className?: string;
|
|
92
103
|
/** p 요소 ref */
|
|
93
104
|
ref?: Ref<HTMLParagraphElement>;
|
|
94
|
-
}
|
|
105
|
+
};
|
|
95
106
|
/**
|
|
96
107
|
* 에러 메시지(`role="alert"`). Field가 invalid이고 children이 있을 때만 렌더되며, 그때 컨트롤의
|
|
97
108
|
* aria-describedby에 연결된다. 그래서 메시지는 늘 두고 Field의 `invalid`로 보이고 숨긴다.
|