@soxa-ui/react 0.0.0-stage → 0.3.0-beta.1
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/LICENSE +21 -0
- package/README.md +253 -2
- package/dist/adapter/common/aria.d.ts +6 -0
- package/dist/adapter/common/aria.js +22 -0
- package/dist/adapter/common/icon.d.ts +9 -0
- package/dist/adapter/common/icon.js +22 -0
- package/dist/adapter/common/index.d.ts +6 -0
- package/dist/adapter/common/naming.d.ts +6 -0
- package/dist/adapter/common/naming.js +8 -0
- package/dist/adapter/common/profile.d.ts +3 -0
- package/dist/adapter/common/profile.js +8 -0
- package/dist/adapter/common/root.d.ts +67 -0
- package/dist/adapter/common/root.js +83 -0
- package/dist/adapter/common/slots.d.ts +15 -0
- package/dist/adapter/common/slots.js +23 -0
- package/dist/adapter/elevator/Elevate.d.ts +16 -0
- package/dist/adapter/elevator/Elevate.js +22 -0
- package/dist/adapter/elevator/elevator.class.d.ts +14 -0
- package/dist/adapter/elevator/elevator.class.js +23 -0
- package/dist/adapter/elevator/index.d.ts +3 -0
- package/dist/adapter/elevator/layer.d.ts +6 -0
- package/dist/adapter/elevator/layer.js +5 -0
- package/dist/adapter/elevator/scope.class.d.ts +19 -0
- package/dist/adapter/elevator/scope.class.js +31 -0
- package/dist/adapter/index.d.ts +5 -0
- package/dist/adapter/locale/LocaleProvider.d.ts +19 -0
- package/dist/adapter/locale/LocaleProvider.js +29 -0
- package/dist/adapter/locale/context.d.ts +3 -0
- package/dist/adapter/locale/context.js +7 -0
- package/dist/adapter/locale/index.d.ts +2 -0
- package/dist/adapter/runtime/NativeInput.d.ts +24 -0
- package/dist/adapter/runtime/NativeInput.js +40 -0
- package/dist/adapter/runtime/NativeTextarea.d.ts +10 -0
- package/dist/adapter/runtime/NativeTextarea.js +24 -0
- package/dist/adapter/runtime/Teleport.d.ts +14 -0
- package/dist/adapter/runtime/Teleport.js +82 -0
- package/dist/adapter/runtime/accepting.d.ts +10 -0
- package/dist/adapter/runtime/accepting.js +18 -0
- package/dist/adapter/runtime/click-action.class.d.ts +14 -0
- package/dist/adapter/runtime/click-action.class.js +26 -0
- package/dist/adapter/runtime/drafts.class.d.ts +24 -0
- package/dist/adapter/runtime/drafts.class.js +41 -0
- package/dist/adapter/runtime/event-callbacks.class.d.ts +29 -0
- package/dist/adapter/runtime/event-callbacks.class.js +44 -0
- package/dist/adapter/runtime/index.d.ts +16 -0
- package/dist/adapter/runtime/root-ref.class.d.ts +39 -0
- package/dist/adapter/runtime/root-ref.class.js +86 -0
- package/dist/adapter/runtime/stable-snapshot.class.d.ts +20 -0
- package/dist/adapter/runtime/stable-snapshot.class.js +43 -0
- package/dist/adapter/runtime/useAdapter.d.ts +39 -0
- package/dist/adapter/runtime/useAdapter.js +78 -0
- package/dist/adapter/runtime/useAdapterContext.d.ts +22 -0
- package/dist/adapter/runtime/useAdapterContext.js +128 -0
- package/dist/adapter/runtime/useClickAction.d.ts +6 -0
- package/dist/adapter/runtime/useClickAction.js +16 -0
- package/dist/adapter/runtime/useComponent.d.ts +15 -0
- package/dist/adapter/runtime/useComponent.js +13 -0
- package/dist/adapter/runtime/useRootElement.d.ts +6 -0
- package/dist/adapter/runtime/useRootElement.js +13 -0
- package/dist/adapter/runtime/withRenderBoundary.d.ts +7 -0
- package/dist/adapter/runtime/withRenderBoundary.js +13 -0
- package/dist/adapter/toasts/index.d.ts +3 -0
- package/dist/adapter/toasts/render.d.ts +6 -0
- package/dist/adapter/toasts/render.js +17 -0
- package/dist/adapter/toasts/types.d.ts +6 -0
- package/dist/adapter/toasts/useToasts.d.ts +8 -0
- package/dist/adapter/toasts/useToasts.js +19 -0
- package/dist/components/accordion/Accordion.d.ts +14 -0
- package/dist/components/accordion/Accordion.js +40 -0
- package/dist/components/accordion/base.component.d.ts +6 -0
- package/dist/components/accordion/index.d.ts +6 -0
- package/dist/components/accordion/index.js +7 -0
- package/dist/components/accordion/item/Item.d.ts +6 -0
- package/dist/components/accordion/item/Item.js +68 -0
- package/dist/components/accordion/item/base.component.d.ts +9 -0
- package/dist/components/accordion/item/index.d.ts +2 -0
- package/dist/components/accordion/item/setup.component.d.ts +17 -0
- package/dist/components/accordion/item/setup.component.js +23 -0
- package/dist/components/accordion/setup.component.d.ts +15 -0
- package/dist/components/accordion/setup.component.js +26 -0
- package/dist/components/button/Button.d.ts +15 -0
- package/dist/components/button/Button.js +38 -0
- package/dist/components/button/base.component.d.ts +7 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/setup.component.d.ts +22 -0
- package/dist/components/button/setup.component.js +12 -0
- package/dist/components/calendar/Calendar.d.ts +7 -0
- package/dist/components/calendar/Calendar.js +190 -0
- package/dist/components/calendar/base.component.d.ts +7 -0
- package/dist/components/calendar/index.d.ts +7 -0
- package/dist/components/calendar/index.js +8 -0
- package/dist/components/calendar/item/Item.d.ts +3 -0
- package/dist/components/calendar/item/Item.js +26 -0
- package/dist/components/calendar/item/base.component.d.ts +7 -0
- package/dist/components/calendar/item/index.d.ts +2 -0
- package/dist/components/calendar/item/setup.component.d.ts +13 -0
- package/dist/components/calendar/item/setup.component.js +20 -0
- package/dist/components/calendar/setup.component.d.ts +15 -0
- package/dist/components/calendar/setup.component.js +26 -0
- package/dist/components/check-box/CheckBox.d.ts +4 -0
- package/dist/components/check-box/CheckBox.js +49 -0
- package/dist/components/check-box/base.component.d.ts +7 -0
- package/dist/components/check-box/index.d.ts +2 -0
- package/dist/components/check-box/setup.component.d.ts +27 -0
- package/dist/components/check-box/setup.component.js +13 -0
- package/dist/components/component/base.component.d.ts +5 -0
- package/dist/components/component/index.d.ts +1 -0
- package/dist/components/component-view/ComponentView.d.ts +4 -0
- package/dist/components/component-view/ComponentView.js +22 -0
- package/dist/components/component-view/base.component.d.ts +5 -0
- package/dist/components/component-view/index.d.ts +2 -0
- package/dist/components/component-view/setup.component.d.ts +9 -0
- package/dist/components/component-view/setup.component.js +12 -0
- package/dist/components/control/base.component.d.ts +5 -0
- package/dist/components/control/index.d.ts +1 -0
- package/dist/components/control/setup.component.d.ts +22 -0
- package/dist/components/date-input/DateInput.d.ts +4 -0
- package/dist/components/date-input/DateInput.js +88 -0
- package/dist/components/date-input/base.component.d.ts +6 -0
- package/dist/components/date-input/index.d.ts +2 -0
- package/dist/components/date-input/setup.component.d.ts +27 -0
- package/dist/components/date-input/setup.component.js +13 -0
- package/dist/components/date-picker/DatePicker.d.ts +9 -0
- package/dist/components/date-picker/DatePicker.js +148 -0
- package/dist/components/date-picker/base.component.d.ts +6 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/setup.component.d.ts +60 -0
- package/dist/components/date-picker/setup.component.js +26 -0
- package/dist/components/dialog/Dialog.d.ts +7 -0
- package/dist/components/dialog/Dialog.js +88 -0
- package/dist/components/dialog/base.component.d.ts +6 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/setup.component.d.ts +29 -0
- package/dist/components/dialog/setup.component.js +12 -0
- package/dist/components/drag-and-drop/DragAndDrop.d.ts +4 -0
- package/dist/components/drag-and-drop/DragAndDrop.js +16 -0
- package/dist/components/drag-and-drop/base.component.d.ts +6 -0
- package/dist/components/drag-and-drop/index.d.ts +2 -0
- package/dist/components/drag-and-drop/setup.component.d.ts +6 -0
- package/dist/components/drag-and-drop/setup.component.js +12 -0
- package/dist/components/drawer/Drawer.d.ts +7 -0
- package/dist/components/drawer/Drawer.js +75 -0
- package/dist/components/drawer/base.component.d.ts +6 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/setup.component.d.ts +29 -0
- package/dist/components/drawer/setup.component.js +12 -0
- package/dist/components/field/Field.d.ts +4 -0
- package/dist/components/field/Field.js +58 -0
- package/dist/components/field/base.component.d.ts +5 -0
- package/dist/components/field/index.d.ts +2 -0
- package/dist/components/field/setup.component.d.ts +10 -0
- package/dist/components/field/setup.component.js +13 -0
- package/dist/components/frame/Frame.d.ts +7 -0
- package/dist/components/frame/Frame.js +30 -0
- package/dist/components/frame/base.component.d.ts +5 -0
- package/dist/components/frame/index.d.ts +2 -0
- package/dist/components/frame/setup.component.d.ts +33 -0
- package/dist/components/frame/setup.component.js +12 -0
- package/dist/components/icon/Icon.d.ts +7 -0
- package/dist/components/icon/Icon.js +17 -0
- package/dist/components/icon/base.component.d.ts +5 -0
- package/dist/components/icon/index.d.ts +2 -0
- package/dist/components/icon/setup.component.d.ts +19 -0
- package/dist/components/icon/setup.component.js +12 -0
- package/dist/components/index.d.ts +43 -0
- package/dist/components/input/Input.d.ts +4 -0
- package/dist/components/input/Input.js +65 -0
- package/dist/components/input/base.component.d.ts +7 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/setup.component.d.ts +27 -0
- package/dist/components/input/setup.component.js +13 -0
- package/dist/components/input-control/base.component.d.ts +6 -0
- package/dist/components/input-control/index.d.ts +1 -0
- package/dist/components/input-control/setup.component.d.ts +26 -0
- package/dist/components/interactive/base.component.d.ts +5 -0
- package/dist/components/interactive/index.d.ts +1 -0
- package/dist/components/interactive/setup.component.d.ts +9 -0
- package/dist/components/item-row/ItemRow.d.ts +13 -0
- package/dist/components/item-row/ItemRow.js +19 -0
- package/dist/components/item-row/index.d.ts +2 -0
- package/dist/components/item-row/setup.component.d.ts +22 -0
- package/dist/components/item-row/setup.component.js +12 -0
- package/dist/components/label/Label.d.ts +7 -0
- package/dist/components/label/Label.js +31 -0
- package/dist/components/label/base.component.d.ts +5 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/setup.component.d.ts +9 -0
- package/dist/components/label/setup.component.js +12 -0
- package/dist/components/list-box/ListBox.d.ts +8 -0
- package/dist/components/list-box/ListBox.js +67 -0
- package/dist/components/list-box/base.component.d.ts +9 -0
- package/dist/components/list-box/group/Group.d.ts +7 -0
- package/dist/components/list-box/group/Group.js +34 -0
- package/dist/components/list-box/group/base.component.d.ts +6 -0
- package/dist/components/list-box/group/index.d.ts +2 -0
- package/dist/components/list-box/group/setup.component.d.ts +9 -0
- package/dist/components/list-box/group/setup.component.js +12 -0
- package/dist/components/list-box/index.d.ts +9 -0
- package/dist/components/list-box/index.js +11 -0
- package/dist/components/list-box/item/Item.d.ts +6 -0
- package/dist/components/list-box/item/Item.js +57 -0
- package/dist/components/list-box/item/base.component.d.ts +8 -0
- package/dist/components/list-box/item/index.d.ts +2 -0
- package/dist/components/list-box/item/setup.component.d.ts +19 -0
- package/dist/components/list-box/item/setup.component.js +23 -0
- package/dist/components/list-box/setup.component.d.ts +15 -0
- package/dist/components/list-box/setup.component.js +26 -0
- package/dist/components/menu/Menu.d.ts +7 -0
- package/dist/components/menu/Menu.js +47 -0
- package/dist/components/menu/base.component.d.ts +6 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.d.ts +6 -0
- package/dist/components/menu/checkbox-item/CheckboxItem.js +61 -0
- package/dist/components/menu/checkbox-item/base.component.d.ts +8 -0
- package/dist/components/menu/checkbox-item/index.d.ts +2 -0
- package/dist/components/menu/checkbox-item/setup.component.d.ts +17 -0
- package/dist/components/menu/checkbox-item/setup.component.js +23 -0
- package/dist/components/menu/group/Group.d.ts +4 -0
- package/dist/components/menu/group/Group.js +31 -0
- package/dist/components/menu/group/base.component.d.ts +6 -0
- package/dist/components/menu/group/index.d.ts +2 -0
- package/dist/components/menu/group/setup.component.d.ts +9 -0
- package/dist/components/menu/group/setup.component.js +12 -0
- package/dist/components/menu/index.d.ts +23 -0
- package/dist/components/menu/index.js +23 -0
- package/dist/components/menu/item/Item.d.ts +3 -0
- package/dist/components/menu/item/Item.js +42 -0
- package/dist/components/menu/item/base.component.d.ts +8 -0
- package/dist/components/menu/item/index.d.ts +2 -0
- package/dist/components/menu/item/setup.component.d.ts +17 -0
- package/dist/components/menu/item/setup.component.js +23 -0
- package/dist/components/menu/popover-item/PopoverItem.d.ts +6 -0
- package/dist/components/menu/popover-item/PopoverItem.js +72 -0
- package/dist/components/menu/popover-item/base.component.d.ts +8 -0
- package/dist/components/menu/popover-item/index.d.ts +2 -0
- package/dist/components/menu/popover-item/setup.component.d.ts +24 -0
- package/dist/components/menu/popover-item/setup.component.js +26 -0
- package/dist/components/menu/radio-group/RadioGroup.d.ts +4 -0
- package/dist/components/menu/radio-group/RadioGroup.js +31 -0
- package/dist/components/menu/radio-group/base.component.d.ts +5 -0
- package/dist/components/menu/radio-group/index.d.ts +2 -0
- package/dist/components/menu/radio-group/setup.component.d.ts +9 -0
- package/dist/components/menu/radio-group/setup.component.js +12 -0
- package/dist/components/menu/radio-item/RadioItem.d.ts +3 -0
- package/dist/components/menu/radio-item/RadioItem.js +50 -0
- package/dist/components/menu/radio-item/base.component.d.ts +9 -0
- package/dist/components/menu/radio-item/index.d.ts +2 -0
- package/dist/components/menu/radio-item/setup.component.d.ts +17 -0
- package/dist/components/menu/radio-item/setup.component.js +23 -0
- package/dist/components/menu/separator/Separator.d.ts +4 -0
- package/dist/components/menu/separator/Separator.js +18 -0
- package/dist/components/menu/separator/base.component.d.ts +5 -0
- package/dist/components/menu/separator/index.d.ts +2 -0
- package/dist/components/menu/separator/setup.component.d.ts +9 -0
- package/dist/components/menu/separator/setup.component.js +12 -0
- package/dist/components/menu/setup.component.d.ts +16 -0
- package/dist/components/menu/setup.component.js +29 -0
- package/dist/components/menu/submenu/Submenu.d.ts +22 -0
- package/dist/components/menu/submenu/Submenu.js +117 -0
- package/dist/components/menu/submenu/base.component.d.ts +9 -0
- package/dist/components/menu/submenu/index.d.ts +2 -0
- package/dist/components/menu/submenu/setup.component.d.ts +25 -0
- package/dist/components/menu/submenu/setup.component.js +37 -0
- package/dist/components/number-input/NumberInput.d.ts +4 -0
- package/dist/components/number-input/NumberInput.js +108 -0
- package/dist/components/number-input/base.component.d.ts +7 -0
- package/dist/components/number-input/index.d.ts +2 -0
- package/dist/components/number-input/setup.component.d.ts +27 -0
- package/dist/components/number-input/setup.component.js +13 -0
- package/dist/components/pagination/Pagination.d.ts +7 -0
- package/dist/components/pagination/Pagination.js +80 -0
- package/dist/components/pagination/base.component.d.ts +6 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/item/Item.d.ts +3 -0
- package/dist/components/pagination/item/Item.js +34 -0
- package/dist/components/pagination/item/base.component.d.ts +5 -0
- package/dist/components/pagination/item/index.d.ts +2 -0
- package/dist/components/pagination/item/setup.component.d.ts +11 -0
- package/dist/components/pagination/item/setup.component.js +23 -0
- package/dist/components/pagination/setup.component.d.ts +15 -0
- package/dist/components/pagination/setup.component.js +26 -0
- package/dist/components/popover/Popover.d.ts +7 -0
- package/dist/components/popover/Popover.js +68 -0
- package/dist/components/popover/base.component.d.ts +6 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/setup.component.d.ts +34 -0
- package/dist/components/popover/setup.component.js +17 -0
- package/dist/components/progress-linear/ProgressLinear.d.ts +7 -0
- package/dist/components/progress-linear/ProgressLinear.js +24 -0
- package/dist/components/progress-linear/base.component.d.ts +5 -0
- package/dist/components/progress-linear/index.d.ts +2 -0
- package/dist/components/progress-linear/setup.component.d.ts +17 -0
- package/dist/components/progress-linear/setup.component.js +12 -0
- package/dist/components/progress-spinner/ProgressSpinner.d.ts +7 -0
- package/dist/components/progress-spinner/ProgressSpinner.js +50 -0
- package/dist/components/progress-spinner/base.component.d.ts +5 -0
- package/dist/components/progress-spinner/index.d.ts +2 -0
- package/dist/components/progress-spinner/setup.component.d.ts +17 -0
- package/dist/components/progress-spinner/setup.component.js +12 -0
- package/dist/components/radio-group/RadioGroup.d.ts +4 -0
- package/dist/components/radio-group/RadioGroup.js +30 -0
- package/dist/components/radio-group/base.component.d.ts +7 -0
- package/dist/components/radio-group/index.d.ts +7 -0
- package/dist/components/radio-group/index.js +8 -0
- package/dist/components/radio-group/item/Item.d.ts +3 -0
- package/dist/components/radio-group/item/Item.js +46 -0
- package/dist/components/radio-group/item/base.component.d.ts +9 -0
- package/dist/components/radio-group/item/index.d.ts +2 -0
- package/dist/components/radio-group/item/setup.component.d.ts +42 -0
- package/dist/components/radio-group/item/setup.component.js +30 -0
- package/dist/components/radio-group/setup.component.d.ts +16 -0
- package/dist/components/radio-group/setup.component.js +27 -0
- package/dist/components/rating/Rating.d.ts +4 -0
- package/dist/components/rating/Rating.js +55 -0
- package/dist/components/rating/base.component.d.ts +6 -0
- package/dist/components/rating/index.d.ts +2 -0
- package/dist/components/rating/setup.component.d.ts +27 -0
- package/dist/components/rating/setup.component.js +13 -0
- package/dist/components/scroller/Scroller.d.ts +7 -0
- package/dist/components/scroller/Scroller.js +64 -0
- package/dist/components/scroller/base.component.d.ts +6 -0
- package/dist/components/scroller/index.d.ts +2 -0
- package/dist/components/scroller/setup.component.d.ts +22 -0
- package/dist/components/scroller/setup.component.js +12 -0
- package/dist/components/select/Select.d.ts +7 -0
- package/dist/components/select/Select.js +116 -0
- package/dist/components/select/base.component.d.ts +8 -0
- package/dist/components/select/group/Group.d.ts +7 -0
- package/dist/components/select/group/Group.js +34 -0
- package/dist/components/select/group/base.component.d.ts +6 -0
- package/dist/components/select/group/index.d.ts +2 -0
- package/dist/components/select/group/setup.component.d.ts +9 -0
- package/dist/components/select/group/setup.component.js +12 -0
- package/dist/components/select/index.d.ts +9 -0
- package/dist/components/select/index.js +11 -0
- package/dist/components/select/item/Item.d.ts +6 -0
- package/dist/components/select/item/Item.js +58 -0
- package/dist/components/select/item/base.component.d.ts +8 -0
- package/dist/components/select/item/index.d.ts +2 -0
- package/dist/components/select/item/setup.component.d.ts +19 -0
- package/dist/components/select/item/setup.component.js +23 -0
- package/dist/components/select/setup.component.d.ts +27 -0
- package/dist/components/select/setup.component.js +30 -0
- package/dist/components/skeleton/Skeleton.d.ts +4 -0
- package/dist/components/skeleton/Skeleton.js +23 -0
- package/dist/components/skeleton/base.component.d.ts +5 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/setup.component.d.ts +11 -0
- package/dist/components/skeleton/setup.component.js +12 -0
- package/dist/components/slider/Slider.d.ts +4 -0
- package/dist/components/slider/Slider.js +72 -0
- package/dist/components/slider/base.component.d.ts +6 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/setup.component.d.ts +23 -0
- package/dist/components/slider/setup.component.js +13 -0
- package/dist/components/stylable/base.component.d.ts +5 -0
- package/dist/components/stylable/index.d.ts +1 -0
- package/dist/components/stylable/setup.component.d.ts +9 -0
- package/dist/components/switch/Switch.d.ts +4 -0
- package/dist/components/switch/Switch.js +42 -0
- package/dist/components/switch/base.component.d.ts +7 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/setup.component.d.ts +27 -0
- package/dist/components/switch/setup.component.js +13 -0
- package/dist/components/table/Table.d.ts +9 -0
- package/dist/components/table/Table.js +83 -0
- package/dist/components/table/base.component.d.ts +7 -0
- package/dist/components/table/column/Column.d.ts +7 -0
- package/dist/components/table/column/Column.js +66 -0
- package/dist/components/table/column/base.component.d.ts +6 -0
- package/dist/components/table/column/index.d.ts +2 -0
- package/dist/components/table/column/setup.component.d.ts +19 -0
- package/dist/components/table/column/setup.component.js +16 -0
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/table/index.js +11 -0
- package/dist/components/table/row/Cells.d.ts +14 -0
- package/dist/components/table/row/Cells.js +29 -0
- package/dist/components/table/row/Row.d.ts +6 -0
- package/dist/components/table/row/Row.js +43 -0
- package/dist/components/table/row/base.component.d.ts +7 -0
- package/dist/components/table/row/index.d.ts +2 -0
- package/dist/components/table/row/setup.component.d.ts +11 -0
- package/dist/components/table/row/setup.component.js +23 -0
- package/dist/components/table/setup.component.d.ts +18 -0
- package/dist/components/table/setup.component.js +27 -0
- package/dist/components/tabs/Tabs.d.ts +9 -0
- package/dist/components/tabs/Tabs.js +53 -0
- package/dist/components/tabs/base.component.d.ts +9 -0
- package/dist/components/tabs/content/Content.d.ts +4 -0
- package/dist/components/tabs/content/Content.js +18 -0
- package/dist/components/tabs/content/base.component.d.ts +7 -0
- package/dist/components/tabs/content/index.d.ts +2 -0
- package/dist/components/tabs/content/setup.component.d.ts +17 -0
- package/dist/components/tabs/content/setup.component.js +20 -0
- package/dist/components/tabs/index.d.ts +9 -0
- package/dist/components/tabs/index.js +11 -0
- package/dist/components/tabs/item/Item.d.ts +6 -0
- package/dist/components/tabs/item/Item.js +64 -0
- package/dist/components/tabs/item/base.component.d.ts +9 -0
- package/dist/components/tabs/item/index.d.ts +2 -0
- package/dist/components/tabs/item/setup.component.d.ts +17 -0
- package/dist/components/tabs/item/setup.component.js +23 -0
- package/dist/components/tabs/setup.component.d.ts +15 -0
- package/dist/components/tabs/setup.component.js +26 -0
- package/dist/components/tags/Tags.d.ts +7 -0
- package/dist/components/tags/Tags.js +36 -0
- package/dist/components/tags/base.component.d.ts +6 -0
- package/dist/components/tags/index.d.ts +6 -0
- package/dist/components/tags/index.js +7 -0
- package/dist/components/tags/item/Item.d.ts +6 -0
- package/dist/components/tags/item/Item.js +63 -0
- package/dist/components/tags/item/base.component.d.ts +8 -0
- package/dist/components/tags/item/index.d.ts +2 -0
- package/dist/components/tags/item/setup.component.d.ts +15 -0
- package/dist/components/tags/item/setup.component.js +23 -0
- package/dist/components/tags/setup.component.d.ts +15 -0
- package/dist/components/tags/setup.component.js +26 -0
- package/dist/components/textable/base.component.d.ts +5 -0
- package/dist/components/textable/index.d.ts +1 -0
- package/dist/components/textable/setup.component.d.ts +22 -0
- package/dist/components/textarea/Textarea.d.ts +4 -0
- package/dist/components/textarea/Textarea.js +35 -0
- package/dist/components/textarea/base.component.d.ts +7 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/setup.component.d.ts +29 -0
- package/dist/components/textarea/setup.component.js +13 -0
- package/dist/components/toasts/Toasts.d.ts +7 -0
- package/dist/components/toasts/Toasts.js +43 -0
- package/dist/components/toasts/base.component.d.ts +7 -0
- package/dist/components/toasts/index.d.ts +2 -0
- package/dist/components/toasts/item/Item.d.ts +3 -0
- package/dist/components/toasts/item/Item.js +88 -0
- package/dist/components/toasts/item/base.component.d.ts +6 -0
- package/dist/components/toasts/item/index.d.ts +2 -0
- package/dist/components/toasts/item/setup.component.d.ts +13 -0
- package/dist/components/toasts/item/setup.component.js +20 -0
- package/dist/components/toasts/setup.component.d.ts +13 -0
- package/dist/components/toasts/setup.component.js +26 -0
- package/dist/components/tooltip/Tooltip.d.ts +4 -0
- package/dist/components/tooltip/Tooltip.js +34 -0
- package/dist/components/tooltip/base.component.d.ts +6 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/setup.component.d.ts +26 -0
- package/dist/components/tooltip/setup.component.js +17 -0
- package/dist/components/value-control/base.component.d.ts +6 -0
- package/dist/components/value-control/index.d.ts +1 -0
- package/dist/components/value-control/setup.component.d.ts +22 -0
- package/dist/components/virtual/Virtual.d.ts +4 -0
- package/dist/components/virtual/Virtual.js +16 -0
- package/dist/components/virtual/base.component.d.ts +6 -0
- package/dist/components/virtual/index.d.ts +2 -0
- package/dist/components/virtual/setup.component.d.ts +6 -0
- package/dist/components/virtual/setup.component.js +12 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +60 -0
- package/dist/types.d.ts +25 -0
- package/package.json +60 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yuri Soldatov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,254 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @soxa-ui/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The React adapter: Soxa UI components rendered on the headless models of the core.**
|
|
4
|
+
|
|
5
|
+
Part of [Soxa UI](https://github.com/youra-h/soxa-ui) — UI components with the logic written once: a
|
|
6
|
+
framework-agnostic core and thin adapters that render it in Vue, React, Angular, Svelte, Solid and
|
|
7
|
+
Web Components.
|
|
8
|
+
|
|
9
|
+
The adapter is wiring, not behavior: it connects a core model to React's render cycle and renders
|
|
10
|
+
the markup — BEM classes `so-*` and `data-*` state attributes. Props, events and slots come from the
|
|
11
|
+
component descriptor, so they match the other five adapters; only the spelling is React's: events
|
|
12
|
+
arrive as callback props (`element:ready` → `onElementReady`), and the default slot is `children`.
|
|
13
|
+
|
|
14
|
+
> **Status:** the React adapter is in progress — Button, Icon, Label, Frame, Skeleton,
|
|
15
|
+
> ProgressSpinner, ProgressLinear, Input, NumberInput (a number in the locale's format with − and +
|
|
16
|
+
> step buttons; the form gets the number), Textarea (multi-line, growing with its text, with a
|
|
17
|
+
> character counter), CheckBox, Switch, Slider, Rating, the form field `Field` (label, helper and
|
|
18
|
+
> error linked to the control inside it), the dates — DateInput (a date, or a date and time with
|
|
19
|
+
> `kind="datetime"`, typed in parts in the locale's format; the form gets the date as a string),
|
|
20
|
+
> Calendar (month grids of `Calendar.Item` days; a month heading opens the month and year picker)
|
|
21
|
+
> and DatePicker (a date field and a calendar in a panel: a single date or a range, with Cancel
|
|
22
|
+
> and OK buttons under `confirmable`; the panel is teleported, so the server renders the field
|
|
23
|
+
> and the calendar button, and the calendar appears on the client; every attribute of yours goes
|
|
24
|
+
> to the root of a date component — a date field has no `<input>`, only its parts), the
|
|
25
|
+
> collections ListBox, Tabs, Accordion and RadioGroup
|
|
26
|
+
> (`<ListBox.Item>`, `<Tabs.Item>` with `<Tabs.Content>`, `<Accordion.Item>`, `<RadioGroup.Item>`
|
|
27
|
+
> or `items`), the tag set Tags (`<Tags.Item>` or `items`, with close buttons and optional
|
|
28
|
+
> selection), Select (a select field with a list in a panel: single selection, multiple selection
|
|
29
|
+
> with tags in the field, typing with search or filtering, groups — `<Select.Item>`,
|
|
30
|
+
> `<Select.Group>` or `items`; the options stand in the panel, so the server renders the field, and
|
|
31
|
+
> options written as markup join the select on the client), Pagination, the `Scroller` strip, the
|
|
32
|
+
> overlays Popover and Tooltip (the trigger in the `trigger` slot,
|
|
33
|
+
> `trigger={({ triggerAria }) => <Button {...triggerAria} />}`), Menu (an
|
|
34
|
+
> action menu at a button or a context menu on right click — `openOn="contextmenu"` — with
|
|
35
|
+
> `<Menu.Item>`, `<Menu.CheckboxItem>`, `<Menu.RadioGroup>` with `<Menu.RadioItem>`,
|
|
36
|
+
> `<Menu.Submenu>`, `<Menu.PopoverItem>`, `<Menu.Group>` and `<Menu.Separator>` or `items`, where
|
|
37
|
+
> an item with nested `items` is a submenu; the items stand in its panel, so the server renders the
|
|
38
|
+
> root with the trigger, and the items join the menu on the client), Dialog and
|
|
39
|
+
> Drawer (open state in `visible`, user closing reported by `onChangeVisible`), Toasts
|
|
40
|
+
> (notifications shown from code with `useToasts()`; the region is teleported into `target`, and
|
|
41
|
+
> `ref` is the region), Table (columns and rows as data — `columns`, `items` — with sorting, row
|
|
42
|
+
> selection, column resizing and reordering), the `Virtual` window for long lists
|
|
43
|
+
> (`<Virtual><ListBox items={…} /></Virtual>`, the same with `Select` and `Table`) and the
|
|
44
|
+
> `DragAndDrop` wrapper that lets users reorder the items of Tabs, ListBox and Accordion by dragging
|
|
45
|
+
> (`<DragAndDrop onMove={…}><ListBox items={…} /></DragAndDrop>`, `onMoveBefore` can cancel) are
|
|
46
|
+
> ported, the rest of the set is on its way. Icon renders the `tag` it is given; `roleIcon(role)`
|
|
47
|
+
> makes that tag from the registered icon pack. See
|
|
48
|
+
> [the adapter table](https://github.com/youra-h/soxa-ui#components).
|
|
49
|
+
|
|
50
|
+
## Install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @soxa-ui/react @soxa-ui/setup @soxa-ui/theme-oren @soxa-ui/icons-material
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Install `@soxa-ui/setup` as a direct dependency for the `useIcons` and `useTheme` imports below.
|
|
57
|
+
Keep it on the same version as `@soxa-ui/react`.
|
|
58
|
+
|
|
59
|
+
React and React DOM `^19.3` are peer dependencies. A theme and an icon pack are separate packages —
|
|
60
|
+
pick the ones you want.
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { Button } from '@soxa-ui/react'
|
|
66
|
+
|
|
67
|
+
export function Toolbar() {
|
|
68
|
+
return <Button text="Save" onActionPress={() => console.log('pressed')} />
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The same component can be driven from code — pass a core instance as `ctrl`, and both sides see the
|
|
73
|
+
same state and events:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { TButton } from '@soxa-ui/core'
|
|
77
|
+
import { Button } from '@soxa-ui/react'
|
|
78
|
+
|
|
79
|
+
const btn = new TButton({ text: 'Save' })
|
|
80
|
+
|
|
81
|
+
export function Toolbar() {
|
|
82
|
+
return <Button ctrl={btn} onActionPress={() => (btn.disabled = true)} />
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
A menu takes its trigger in the `trigger` slot, like Popover: the link to the panel comes in the
|
|
87
|
+
slot scope — `triggerAria` and `triggerDataset`. Choosing an action closes the menu and calls
|
|
88
|
+
`onChoose`; a checkbox item and a radio item are checked in place, and the menu stays open:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { Button, Menu } from '@soxa-ui/react'
|
|
92
|
+
|
|
93
|
+
export function Actions() {
|
|
94
|
+
return (
|
|
95
|
+
<Menu
|
|
96
|
+
trigger={({ triggerAria, triggerDataset }) => (
|
|
97
|
+
<Button text="Actions" {...triggerAria} {...triggerDataset} />
|
|
98
|
+
)}
|
|
99
|
+
onChoose={(item) => console.log(item.value)}
|
|
100
|
+
>
|
|
101
|
+
<Menu.Item value="edit" text="Edit" />
|
|
102
|
+
<Menu.Submenu value="share" text="Share">
|
|
103
|
+
<Menu.Item value="link" text="Copy link" />
|
|
104
|
+
<Menu.Item value="mail" text="Email" />
|
|
105
|
+
</Menu.Submenu>
|
|
106
|
+
<Menu.Separator />
|
|
107
|
+
<Menu.Item value="remove" text="Delete" />
|
|
108
|
+
</Menu>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Toasts are shown from code. The manager wraps the application, and any component under it takes
|
|
114
|
+
the API with the `useToasts()` hook — a component in a dialog under the manager too; your own
|
|
115
|
+
content of a toast is a React component with a `toast` prop (`memo` and `forwardRef` components as
|
|
116
|
+
well):
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { Button, Toasts, useToasts, type TToastRender } from '@soxa-ui/react'
|
|
120
|
+
|
|
121
|
+
const Undo: TToastRender = ({ toast }) => <Button text="Undo" onClick={() => toast.close()} />
|
|
122
|
+
|
|
123
|
+
function Page() {
|
|
124
|
+
const { show } = useToasts()
|
|
125
|
+
|
|
126
|
+
return <Button text="Delete" onClick={() => show({ text: 'Deleted', render: Undo })} />
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function App() {
|
|
130
|
+
return (
|
|
131
|
+
<Toasts>
|
|
132
|
+
<Page />
|
|
133
|
+
</Toasts>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The API belongs to the manager's assembly: a manager that React sets up again (StrictMode,
|
|
139
|
+
`<Activity>`) without an `engine` of yours gives a new one, so an effect that shows a toast keeps
|
|
140
|
+
`show` in its dependencies — `useEffect(() => { show('Saved') }, [show])`.
|
|
141
|
+
|
|
142
|
+
The application plugs in a theme and an icon pack once, in its entry point:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import { useIcons, useTheme } from '@soxa-ui/setup'
|
|
146
|
+
import * as material from '@soxa-ui/icons-material'
|
|
147
|
+
import oren from '@soxa-ui/theme-oren/setup'
|
|
148
|
+
|
|
149
|
+
import '@soxa-ui/theme-oren'
|
|
150
|
+
|
|
151
|
+
useIcons(material)
|
|
152
|
+
useTheme(oren)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`@soxa-ui/theme-oren` is the stylesheet of every component. To take only the components your
|
|
156
|
+
pages use, import their stylesheets instead — `@soxa-ui/theme-oren/button.css`,
|
|
157
|
+
`@soxa-ui/theme-oren/select.css`, one per component, each with the shared part of the theme
|
|
158
|
+
(the theme's README, [Only the components you use](https://github.com/youra-h/soxa-ui/tree/main/packages/themes/oren#only-the-components-you-use)).
|
|
159
|
+
|
|
160
|
+
## Server Components
|
|
161
|
+
|
|
162
|
+
The components are Client Components: every module of the package that needs React opens with
|
|
163
|
+
`'use client'`, so a Server Component — a page of the Next.js App Router — imports them as they
|
|
164
|
+
are, without wrappers. The entry of the package is not a client module, so the types and the
|
|
165
|
+
helpers without React import into a Server Component too.
|
|
166
|
+
|
|
167
|
+
The parts hang on their owner in a Server Component as well, so it writes `Tabs.Item` the way a
|
|
168
|
+
Client Component does — the flat names (`TabsItem`) work in both:
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
// app/page.tsx — a Server Component
|
|
172
|
+
import { Tabs } from '@soxa-ui/react'
|
|
173
|
+
|
|
174
|
+
export default function Page() {
|
|
175
|
+
return (
|
|
176
|
+
<Tabs
|
|
177
|
+
aria_label="Settings"
|
|
178
|
+
content={
|
|
179
|
+
<>
|
|
180
|
+
<Tabs.Content value="general">General settings</Tabs.Content>
|
|
181
|
+
<Tabs.Content value="privacy">Privacy settings</Tabs.Content>
|
|
182
|
+
</>
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
<Tabs.Item value="general" text="General" active />
|
|
186
|
+
<Tabs.Item value="privacy" text="Privacy" />
|
|
187
|
+
</Tabs>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
In the App Router, call `useIcons` and `useTheme` in a client module — a file with `'use client'`
|
|
193
|
+
that the root layout imports — and not in the layout itself. A Server Component runs with its own
|
|
194
|
+
copy of `@soxa-ui/setup`, and what it registers never reaches the Client Components; a client
|
|
195
|
+
module runs where they do — on the server for the HTML, and in the browser:
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
// app/providers.tsx
|
|
199
|
+
'use client'
|
|
200
|
+
|
|
201
|
+
import type { ReactNode } from 'react'
|
|
202
|
+
import { useIcons, useTheme } from '@soxa-ui/setup'
|
|
203
|
+
import * as material from '@soxa-ui/icons-material'
|
|
204
|
+
import oren from '@soxa-ui/theme-oren/setup'
|
|
205
|
+
|
|
206
|
+
useIcons(material)
|
|
207
|
+
useTheme(oren)
|
|
208
|
+
|
|
209
|
+
export function Providers({ children }: { children: ReactNode }) {
|
|
210
|
+
return children
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
// app/layout.tsx — a Server Component
|
|
216
|
+
import type { ReactNode } from 'react'
|
|
217
|
+
import { Providers } from './providers'
|
|
218
|
+
|
|
219
|
+
import '@soxa-ui/theme-oren'
|
|
220
|
+
|
|
221
|
+
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
222
|
+
return (
|
|
223
|
+
<html lang="en">
|
|
224
|
+
<body>
|
|
225
|
+
<Providers>{children}</Providers>
|
|
226
|
+
</body>
|
|
227
|
+
</html>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Documentation
|
|
233
|
+
|
|
234
|
+
- [Soxa UI README](https://github.com/youra-h/soxa-ui#readme) — the component set and what each
|
|
235
|
+
adapter implements so far.
|
|
236
|
+
- [Architecture overview](https://github.com/youra-h/soxa-ui/blob/main/docs/architecture.md) —
|
|
237
|
+
layers, descriptors, plugins, collections, adapters.
|
|
238
|
+
|
|
239
|
+
## Public API
|
|
240
|
+
|
|
241
|
+
The package entry exports application components, their consumer types, the locale provider,
|
|
242
|
+
and the supported icon and toast helpers. Component props, slots, events, refs and core models
|
|
243
|
+
passed through `ctrl` remain the supported ways to customize the UI. Models come from
|
|
244
|
+
`@soxa-ui/core`; theme, icon and external-plugin registration comes from `@soxa-ui/setup`.
|
|
245
|
+
|
|
246
|
+
Assembly functions, adapter profiles, bindings, generated metadata and rendering templates
|
|
247
|
+
are private implementation details. They are no longer exported from the package entry, and
|
|
248
|
+
there is no public `/internal` entry. Code that imported them must use the component contract
|
|
249
|
+
instead. Building a new adapter component from Soxa's assembly helpers is not a supported
|
|
250
|
+
public SDK.
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
[MIT](https://github.com/youra-h/soxa-ui/blob/main/LICENSE)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Набор атрибутов ядра — в пропсы элемента: HTML-имена, которые у React
|
|
3
|
+
* другие (`tabindex` → `tabIndex`), переводятся, `null` — атрибута нет.
|
|
4
|
+
*/
|
|
5
|
+
import type { TAriaAttributes } from '@soxa-ui/core';
|
|
6
|
+
export declare function toAriaProps(aria: TAriaAttributes | undefined): Record<string, unknown>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/adapter/common/aria.ts
|
|
2
|
+
/** HTML-атрибут → имя пропа: только те, где имена расходятся. */
|
|
3
|
+
var ATTRIBUTE_TO_PROP = {
|
|
4
|
+
tabindex: "tabIndex",
|
|
5
|
+
readonly: "readOnly",
|
|
6
|
+
for: "htmlFor",
|
|
7
|
+
inputmode: "inputMode",
|
|
8
|
+
contenteditable: "contentEditable",
|
|
9
|
+
spellcheck: "spellCheck",
|
|
10
|
+
autocorrect: "autoCorrect"
|
|
11
|
+
};
|
|
12
|
+
function toAriaProps(aria) {
|
|
13
|
+
if (!aria) return {};
|
|
14
|
+
const result = {};
|
|
15
|
+
for (const [name, value] of Object.entries(aria)) {
|
|
16
|
+
if (value === null) continue;
|
|
17
|
+
result[ATTRIBUTE_TO_PROP[name] ?? name] = value;
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { toAriaProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Иконка по роли из реестра — тег для `Icon` (аналог `roleIcon` у Vue): всё,
|
|
3
|
+
* что `Icon` кладёт на корень, ложится на `<svg>`. Компонент на роль один на
|
|
4
|
+
* модуль — новый тип на каждом рендере пересоздавал бы узел; роль резолвится
|
|
5
|
+
* на отрисовке — `useIcons()` может прийти позже.
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentType, SVGProps } from 'react';
|
|
8
|
+
export type TRoleIconProps = SVGProps<SVGSVGElement>;
|
|
9
|
+
export declare function roleIcon(role: string): ComponentType<TRoleIconProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getIcon } from "@soxa-ui/setup";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/adapter/common/icon.tsx
|
|
5
|
+
var icons = /* @__PURE__ */ new Map();
|
|
6
|
+
function roleIcon(role) {
|
|
7
|
+
const known = icons.get(role);
|
|
8
|
+
if (known) return known;
|
|
9
|
+
function RoleIcon(props) {
|
|
10
|
+
const icon = getIcon(role);
|
|
11
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
12
|
+
...props,
|
|
13
|
+
viewBox: icon.viewBox,
|
|
14
|
+
dangerouslySetInnerHTML: { __html: icon.body }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
RoleIcon.displayName = `Icon_${role}`;
|
|
18
|
+
icons.set(role, RoleIcon);
|
|
19
|
+
return RoleIcon;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { roleIcon };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ReactProfile } from './profile';
|
|
2
|
+
export { toAriaProps } from './aria';
|
|
3
|
+
export { toRootLayout, toRootProps, toRootForward, toWrappedRootProps, toControlAttrs, toPartClass, toReactStyle, type TRootState, type TRootStyle, type TRootForward, type TRootLayout, type TRootProps, type TWrappedRootProps, } from './root';
|
|
4
|
+
export { renderSlot, hasSlot, relaySlot, type TSlotContent } from './slots';
|
|
5
|
+
export { roleIcon, type TRoleIconProps } from './icon';
|
|
6
|
+
export { ReactNaming } from './naming';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Раскладка корня: класс, стиль и атрибуты, которые сходятся на корне, — то,
|
|
3
|
+
* что у Vue делают привязки шаблона и слияние атрибутов. Порядок слоёв и
|
|
4
|
+
* дележ атрибутов потребителя — AGENTS.md (React), «Корень и `ref`
|
|
5
|
+
* потребителя».
|
|
6
|
+
*/
|
|
7
|
+
import type { CSSProperties } from 'react';
|
|
8
|
+
import type { TAttributesMap } from '@soxa-ui/core';
|
|
9
|
+
/** Стиль, как его отдают плагины и ядро: имена — как в CSS (`z-index`, `--*`). */
|
|
10
|
+
export type TRootStyle = Readonly<Record<string, string | number>>;
|
|
11
|
+
/** Что корню нужно из состояния компонента. */
|
|
12
|
+
export type TRootState = {
|
|
13
|
+
readonly classes?: readonly string[];
|
|
14
|
+
/** Выход плагина раскладки. */
|
|
15
|
+
readonly layout_styles?: TRootStyle;
|
|
16
|
+
/** Место элемента коллекции во флекс-ряду; нет — своего места нет. */
|
|
17
|
+
readonly order?: number;
|
|
18
|
+
/** `false` прячет корень; нет — корень виден всегда. */
|
|
19
|
+
readonly visible?: boolean;
|
|
20
|
+
};
|
|
21
|
+
/** Класс и стиль потребителя. */
|
|
22
|
+
export type TRootForward = {
|
|
23
|
+
readonly className?: string;
|
|
24
|
+
readonly style?: CSSProperties;
|
|
25
|
+
};
|
|
26
|
+
export type TRootLayout = {
|
|
27
|
+
className: string;
|
|
28
|
+
style: CSSProperties;
|
|
29
|
+
};
|
|
30
|
+
/** Корень целиком: атрибуты, раскладка и `ref` адаптера. */
|
|
31
|
+
export type TRootProps = Record<string, unknown> & TRootLayout & {
|
|
32
|
+
ref: (element: Element | null) => void;
|
|
33
|
+
};
|
|
34
|
+
/** Обёртка корня и сам корень внутри неё — см. `toWrappedRootProps`. */
|
|
35
|
+
export type TWrappedRootProps = {
|
|
36
|
+
readonly wrapper: Record<string, unknown> & TRootLayout;
|
|
37
|
+
readonly root: TRootProps;
|
|
38
|
+
};
|
|
39
|
+
/** Стиль плагинов и ядра — в объект стиля React. */
|
|
40
|
+
export declare function toReactStyle(styles: TRootStyle | undefined): Record<string, string | number>;
|
|
41
|
+
/** Класс и стиль корня; `style` — стиль-выход самого компонента (`fractionStyle`). */
|
|
42
|
+
export declare function toRootLayout(state: TRootState, forward: TRootForward, style?: TRootStyle): TRootLayout;
|
|
43
|
+
/**
|
|
44
|
+
* Пропсы корня: наборы ядра `sets`, поверх — атрибуты потребителя `forward`,
|
|
45
|
+
* раскладка, `ref` адаптера последним.
|
|
46
|
+
*/
|
|
47
|
+
export declare function toRootProps(ref: (element: Element | null) => void, state: TRootState, sets: readonly (TAttributesMap | undefined)[], forward: TRootForward, style?: TRootStyle): TRootProps;
|
|
48
|
+
/**
|
|
49
|
+
* Атрибуты вложенного контрола: то, что компонент не съел, без класса, стиля
|
|
50
|
+
* и `ref` (аналог `useSplitAttrs` у Vue). Параметр типа — атрибуты компонента
|
|
51
|
+
* (`TDomAttributes`): входов дескриптора в `forwardProps` уже нет.
|
|
52
|
+
*/
|
|
53
|
+
export declare function toControlAttrs<TAttributes extends TRootForward & {
|
|
54
|
+
readonly ref?: unknown;
|
|
55
|
+
}>(forward: Partial<TAttributes>): Omit<Partial<TAttributes>, keyof TRootForward | 'ref'>;
|
|
56
|
+
/** Класс и стиль потребителя — то, что из его атрибутов остаётся корню. */
|
|
57
|
+
export declare function toRootForward(forward: TRootForward): TRootForward;
|
|
58
|
+
/** Классы части без своего экземпляра — строкой для `className` (панель Menu на Frame). */
|
|
59
|
+
export declare function toPartClass(classes: readonly string[] | undefined): string;
|
|
60
|
+
/**
|
|
61
|
+
* Корень внутри обёртки (окно таблицы вокруг `table`): обёртке — её класс,
|
|
62
|
+
* класс, стиль и `ref` потребителя, скрытие; корню — `toRootProps` с
|
|
63
|
+
* остальными атрибутами, ref корня — `bindRef`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function toWrappedRootProps(ref: (element: Element | null) => void, state: TRootState, sets: readonly (TAttributesMap | undefined)[], forward: TRootForward & {
|
|
66
|
+
readonly ref?: unknown;
|
|
67
|
+
}, className: string): TWrappedRootProps;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { toAriaProps } from "./aria.js";
|
|
2
|
+
//#region src/adapter/common/root.ts
|
|
3
|
+
var HIDDEN = { display: "none" };
|
|
4
|
+
/** `z-index` → `zIndex`; пользовательское свойство (`--*`) — как есть. */
|
|
5
|
+
function toStyleName(name) {
|
|
6
|
+
if (name.startsWith("--")) return name;
|
|
7
|
+
return name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
8
|
+
}
|
|
9
|
+
/** Стиль плагинов и ядра — в объект стиля React. */
|
|
10
|
+
function toReactStyle(styles) {
|
|
11
|
+
const result = {};
|
|
12
|
+
for (const [name, value] of Object.entries(styles ?? {})) result[toStyleName(name)] = value;
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
/** Класс и стиль корня; `style` — стиль-выход самого компонента (`fractionStyle`). */
|
|
16
|
+
function toRootLayout(state, forward, style) {
|
|
17
|
+
return {
|
|
18
|
+
className: [state.classes?.join(" "), forward.className].filter(Boolean).join(" "),
|
|
19
|
+
style: {
|
|
20
|
+
...toReactStyle(state.layout_styles),
|
|
21
|
+
...toReactStyle(style),
|
|
22
|
+
...state.order !== void 0 ? { order: state.order } : void 0,
|
|
23
|
+
...forward.style,
|
|
24
|
+
...state.visible === false ? HIDDEN : void 0
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Пропсы корня: наборы ядра `sets`, поверх — атрибуты потребителя `forward`,
|
|
30
|
+
* раскладка, `ref` адаптера последним.
|
|
31
|
+
*/
|
|
32
|
+
function toRootProps(ref, state, sets, forward, style) {
|
|
33
|
+
const attributes = {};
|
|
34
|
+
for (const set of sets) Object.assign(attributes, toAriaProps(set));
|
|
35
|
+
return {
|
|
36
|
+
...attributes,
|
|
37
|
+
...forward,
|
|
38
|
+
...toRootLayout(state, forward, style),
|
|
39
|
+
ref
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Атрибуты вложенного контрола: то, что компонент не съел, без класса, стиля
|
|
44
|
+
* и `ref` (аналог `useSplitAttrs` у Vue). Параметр типа — атрибуты компонента
|
|
45
|
+
* (`TDomAttributes`): входов дескриптора в `forwardProps` уже нет.
|
|
46
|
+
*/
|
|
47
|
+
function toControlAttrs(forward) {
|
|
48
|
+
const { className: _className, style: _style, ref: _ref, ...control } = forward;
|
|
49
|
+
return control;
|
|
50
|
+
}
|
|
51
|
+
/** Класс и стиль потребителя — то, что из его атрибутов остаётся корню. */
|
|
52
|
+
function toRootForward(forward) {
|
|
53
|
+
return {
|
|
54
|
+
className: forward.className,
|
|
55
|
+
style: forward.style
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Классы части без своего экземпляра — строкой для `className` (панель Menu на Frame). */
|
|
59
|
+
function toPartClass(classes) {
|
|
60
|
+
return classes?.join(" ") ?? "";
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Корень внутри обёртки (окно таблицы вокруг `table`): обёртке — её класс,
|
|
64
|
+
* класс, стиль и `ref` потребителя, скрытие; корню — `toRootProps` с
|
|
65
|
+
* остальными атрибутами, ref корня — `bindRef`.
|
|
66
|
+
*/
|
|
67
|
+
function toWrappedRootProps(ref, state, sets, forward, className) {
|
|
68
|
+
const { visible, ...root } = state;
|
|
69
|
+
const own = toRootForward(forward);
|
|
70
|
+
return {
|
|
71
|
+
wrapper: {
|
|
72
|
+
ref: forward.ref,
|
|
73
|
+
className: [className, own.className].filter(Boolean).join(" "),
|
|
74
|
+
style: {
|
|
75
|
+
...own.style,
|
|
76
|
+
...visible === false ? HIDDEN : void 0
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
root: toRootProps(ref, root, sets, toControlAttrs(forward))
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { toControlAttrs, toPartClass, toReactStyle, toRootForward, toRootLayout, toRootProps, toWrappedRootProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Содержимое слота: функция — вызвать со scope, остальное — как есть; пустое
|
|
3
|
+
* — `undefined`, и встаёт запасное. AGENTS.md (React), «Слоты».
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
export type TSlotContent<TScope extends object = object> = ReactNode | ((scope: TScope) => ReactNode);
|
|
7
|
+
export declare function renderSlot<TScope extends object = object>(content: TSlotContent<TScope> | undefined, scope?: TScope): ReactNode;
|
|
8
|
+
/** Передан ли слот — аналог `$slots.x` у Vue; функция передана всегда. */
|
|
9
|
+
export declare function hasSlot<TScope extends object>(content: TSlotContent<TScope> | undefined): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Проброс слота владельца в слот элемента: к scope элемента добавляется
|
|
12
|
+
* `extra` — сам элемент. Слота нет — проброса нет. Scope элемента выводится
|
|
13
|
+
* из типа слота элемента (`NoInfer`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function relaySlot<TScope extends object, TExtra extends object>(content: TSlotContent<NoInfer<TScope & TExtra>> | undefined, extra: TExtra): ((scope: TScope) => ReactNode) | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/adapter/common/slots.ts
|
|
2
|
+
function renderSlot(content, scope) {
|
|
3
|
+
const node = typeof content === "function" ? content(scope ?? {}) : content;
|
|
4
|
+
return hasSlot(node) ? node : void 0;
|
|
5
|
+
}
|
|
6
|
+
/** Передан ли слот — аналог `$slots.x` у Vue; функция передана всегда. */
|
|
7
|
+
function hasSlot(content) {
|
|
8
|
+
return content !== void 0 && content !== null && typeof content !== "boolean";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Проброс слота владельца в слот элемента: к scope элемента добавляется
|
|
12
|
+
* `extra` — сам элемент. Слота нет — проброса нет. Scope элемента выводится
|
|
13
|
+
* из типа слота элемента (`NoInfer`).
|
|
14
|
+
*/
|
|
15
|
+
function relaySlot(content, extra) {
|
|
16
|
+
if (!hasSlot(content)) return void 0;
|
|
17
|
+
return (scope) => renderSlot(content, {
|
|
18
|
+
...scope,
|
|
19
|
+
...extra
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { hasSlot, relaySlot, renderSlot };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elevate — отдаёт детям слой лифта компонента (`layer` сборки): аналог
|
|
3
|
+
* `provide` у Vue. AGENTS.md (React), «Срок жизни контекста».
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
import { type TElevatorLayer } from './layer';
|
|
7
|
+
export type TElevateProps = {
|
|
8
|
+
layer: TElevatorLayer;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function Elevate({ layer, children }: TElevateProps): ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Содержимое слота под слоем лифта; пустой слот — как есть, чтобы встало
|
|
14
|
+
* запасное. Так контрол поля отдаёт слой только слотам, без лишних узлов.
|
|
15
|
+
*/
|
|
16
|
+
export declare function elevated(layer: TElevatorLayer, content: ReactNode): ReactNode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ElevatorContext } from "./layer.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/adapter/elevator/Elevate.tsx
|
|
5
|
+
function Elevate({ layer, children }) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ElevatorContext, {
|
|
7
|
+
value: layer,
|
|
8
|
+
children
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Содержимое слота под слоем лифта; пустой слот — как есть, чтобы встало
|
|
13
|
+
* запасное. Так контрол поля отдаёт слой только слотам, без лишних узлов.
|
|
14
|
+
*/
|
|
15
|
+
function elevated(layer, content) {
|
|
16
|
+
return content === void 0 ? void 0 : /* @__PURE__ */ jsx(Elevate, {
|
|
17
|
+
layer,
|
|
18
|
+
children: content
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Elevate, elevated };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TReactElevator — лифт одного ключа поверх слоя сборки: `up()` читает
|
|
3
|
+
* родительский слой, `down()` пишет в слой компонента. `useContext` лифт не
|
|
4
|
+
* зовёт: сборка идёт и вне рендера. AGENTS.md (React), «Срок жизни
|
|
5
|
+
* контекста».
|
|
6
|
+
*/
|
|
7
|
+
import { TElevator } from '@soxa-ui/setup';
|
|
8
|
+
import type { TReactElevatorScope } from './scope.class';
|
|
9
|
+
export declare class TReactElevator<T = unknown> extends TElevator<T> {
|
|
10
|
+
private readonly _scope;
|
|
11
|
+
constructor(key: string | symbol, _scope: TReactElevatorScope);
|
|
12
|
+
down(value: T): void;
|
|
13
|
+
up(): T | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TElevator } from "@soxa-ui/setup";
|
|
2
|
+
//#region src/adapter/elevator/elevator.class.ts
|
|
3
|
+
/**
|
|
4
|
+
* TReactElevator — лифт одного ключа поверх слоя сборки: `up()` читает
|
|
5
|
+
* родительский слой, `down()` пишет в слой компонента. `useContext` лифт не
|
|
6
|
+
* зовёт: сборка идёт и вне рендера. AGENTS.md (React), «Срок жизни
|
|
7
|
+
* контекста».
|
|
8
|
+
*/
|
|
9
|
+
var TReactElevator = class extends TElevator {
|
|
10
|
+
_scope;
|
|
11
|
+
constructor(key, _scope) {
|
|
12
|
+
super(key);
|
|
13
|
+
this._scope = _scope;
|
|
14
|
+
}
|
|
15
|
+
down(value) {
|
|
16
|
+
this._scope.write(this._key, value);
|
|
17
|
+
}
|
|
18
|
+
up() {
|
|
19
|
+
return this._scope.read(this._key);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { TReactElevator };
|