native-document 1.0.138 → 1.0.140
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/components.js +1 -1
- package/devtools/ComponentRegistry.js +3 -2
- package/dist/native-document.components.min.css +1 -0
- package/dist/native-document.components.min.js +11506 -8566
- package/dist/native-document.dev.js +2645 -2166
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/index.js +1 -0
- package/package.json +5 -2
- package/rollup.config.js +5 -2
- package/src/components/$traits/has-draggable/HasDraggable.js +69 -0
- package/src/components/$traits/has-draggable/has-draggable.css +8 -0
- package/src/components/$traits/{HasItems.js → has-items/HasItems.js} +2 -11
- package/src/components/$traits/has-position/HasFullPosition.js +51 -0
- package/src/components/$traits/has-position/HasPosition.js +23 -0
- package/src/components/$traits/has-resizable/HasResizable.js +113 -0
- package/src/components/$traits/has-resizable/has-resizable.css +121 -0
- package/src/components/$traits/has-validation/HasValidation.js +86 -0
- package/src/components/BaseComponent.js +109 -4
- package/src/components/accordion/Accordion.js +37 -31
- package/src/components/accordion/AccordionItem.js +14 -21
- package/src/components/alert/Alert.js +48 -40
- package/src/components/avatar/Avatar.js +4 -3
- package/src/components/avatar/AvatarGroup.js +8 -2
- package/src/components/badge/Badge.js +7 -7
- package/src/components/base-component.css +0 -0
- package/src/components/breadcrumb/BreadCrumb.js +30 -21
- package/src/components/button/Button.js +3 -14
- package/src/components/context-menu/ContextMenu.js +49 -26
- package/src/components/dropdown/Dropdown.js +172 -34
- package/src/components/dropdown/DropdownDivider.js +4 -3
- package/src/components/dropdown/DropdownGroup.js +19 -19
- package/src/components/dropdown/DropdownItem.js +24 -18
- package/src/components/dropdown/helpers.js +52 -0
- package/src/components/form/FormControl.js +207 -108
- package/src/components/form/field/Field.js +106 -174
- package/src/components/form/field/FieldCollection.js +110 -203
- package/src/components/form/field/types/AutocompleteField.js +26 -5
- package/src/components/form/field/types/CheckboxField.js +4 -4
- package/src/components/form/field/types/CheckboxGroupField.js +11 -5
- package/src/components/form/field/types/ColorField.js +4 -4
- package/src/components/form/field/types/DateField.js +110 -18
- package/src/components/form/field/types/EmailField.js +2 -2
- package/src/components/form/field/types/FileField.js +87 -21
- package/src/components/form/field/types/HiddenField.js +4 -4
- package/src/components/form/field/types/ImageField.js +4 -4
- package/src/components/form/field/types/NumberField.js +5 -5
- package/src/components/form/field/types/PasswordField.js +28 -6
- package/src/components/form/field/types/RadioField.js +12 -8
- package/src/components/form/field/types/RangeField.js +29 -5
- package/src/components/form/field/types/SearchField.js +4 -4
- package/src/components/form/field/types/SelectField.js +75 -8
- package/src/components/form/field/types/StringField.js +4 -4
- package/src/components/form/field/types/TelField.js +4 -4
- package/src/components/form/field/types/TextAreaField.js +7 -5
- package/src/components/form/field/types/TimeField.js +52 -6
- package/src/components/form/field/types/UrlField.js +4 -5
- package/src/components/form/field/types/file-field-mode/FileAvatarMode.js +104 -0
- package/src/components/form/field/types/file-field-mode/FileDropzoneMode.js +59 -0
- package/src/components/form/field/types/file-field-mode/FileItemPreview.js +74 -0
- package/src/components/form/field/types/file-field-mode/FileNativeMode.js +21 -0
- package/src/components/form/field/types/file-field-mode/FileUploadButtonMode.js +59 -0
- package/src/components/form/field/types/file-field-mode/FileWallMode.js +53 -0
- package/src/components/form/index.js +14 -2
- package/src/components/form/validation/Validation.js +9 -0
- package/src/components/list/List.js +1 -1
- package/src/components/list/ListGroup.js +1 -1
- package/src/components/menu/HasMenuItem.js +133 -0
- package/src/components/menu/Menu.js +47 -56
- package/src/components/menu/MenuGroup.js +36 -8
- package/src/components/menu/MenuItem.js +24 -10
- package/src/components/menu/MenuLink.js +2 -0
- package/src/components/modal/Modal.js +153 -23
- package/src/components/pagination/Pagination.js +55 -21
- package/src/components/popover/Popover.js +127 -40
- package/src/components/progress/Progress.js +14 -24
- package/src/components/skeleton/Skeleton.js +36 -13
- package/src/components/slider/Slider.js +96 -70
- package/src/components/spinner/Spinner.js +4 -2
- package/src/components/splitter/Splitter.js +15 -8
- package/src/components/splitter/SplitterGutter.js +28 -7
- package/src/components/splitter/SplitterPanel.js +9 -15
- package/src/components/splitter/index.js +3 -1
- package/src/components/stacks/AbsoluteStack.js +33 -0
- package/src/components/stacks/FixedStack.js +33 -0
- package/src/components/stacks/PositionStack.js +146 -0
- package/src/components/stacks/RelativeStack.js +33 -0
- package/src/components/{layouts → stacks}/Stack.js +22 -3
- package/src/components/{layouts → stacks}/index.js +6 -4
- package/src/components/stepper/Stepper.js +159 -67
- package/src/components/stepper/StepperStep.js +49 -12
- package/src/components/switch/Switch.js +59 -29
- package/src/components/switch/index.js +6 -0
- package/src/components/table/Column.js +22 -26
- package/src/components/table/ColumnGroup.js +4 -13
- package/src/components/table/DataTable.js +388 -103
- package/src/components/table/SimpleTable.js +28 -143
- package/src/components/tabs/Tabs.js +142 -44
- package/src/components/toast/Toast.js +40 -35
- package/src/components/tooltip/Tooltip.js +152 -35
- package/src/core/data/ObservableArray.js +94 -30
- package/src/core/data/ObservableChecker.js +20 -75
- package/src/core/data/ObservableItem.js +35 -3
- package/src/core/data/observable-helpers/computed.js +2 -1
- package/src/core/data/observable-helpers/object.js +13 -8
- package/src/core/data/observable-helpers/observable.is-to.js +196 -0
- package/src/core/elements/anchor/anchor.js +3 -2
- package/src/core/elements/control/for-each-array.js +44 -30
- package/src/core/elements/control/for-each.js +6 -3
- package/src/core/elements/control/show-if.js +11 -6
- package/src/core/elements/control/switch.js +2 -1
- package/src/core/elements/index.js +1 -1
- package/src/core/elements/svg.js +61 -0
- package/src/core/utils/HasEventEmitter.js +6 -0
- package/src/core/utils/debug-manager.js +2 -5
- package/src/core/utils/filters/standard.js +2 -1
- package/src/core/utils/property-accumulator.js +35 -6
- package/src/core/utils/shortcut-manager.js +242 -0
- package/src/core/utils/validator.js +1 -1
- package/src/core/wrappers/AttributesWrapper.js +41 -4
- package/src/core/wrappers/DocumentObserver.js +0 -1
- package/src/core/wrappers/HtmlElementWrapper.js +1 -1
- package/src/core/wrappers/NDElement.js +15 -2
- package/src/core/wrappers/SvgElementWrapper.js +15 -0
- package/src/core/wrappers/prototypes/attributes-extensions.js +4 -1
- package/src/core/wrappers/prototypes/nd-element-extensions.js +8 -1
- package/src/router/Router.js +0 -1
- package/src/ui/components/accordion/AccordionItemRender.js +63 -0
- package/src/ui/components/accordion/AccordionRender.js +34 -0
- package/src/ui/components/accordion/accordion.css +121 -0
- package/src/ui/components/alert/AlertRender.js +80 -0
- package/src/ui/components/alert/alert.css +163 -0
- package/src/ui/components/avatar/avata-group/AvatarGroupRender.js +49 -0
- package/src/ui/components/avatar/avata-group/avatar-group.css +38 -0
- package/src/ui/components/avatar/avatar/AvatarRender.js +87 -0
- package/src/ui/components/avatar/avatar/avatar.css +189 -0
- package/src/ui/components/badge/BadgeRender.js +24 -0
- package/src/ui/components/badge/badge.css +168 -0
- package/src/ui/components/breadcrumb/BreadcrumbRender.js +43 -0
- package/src/ui/components/breadcrumb/breadcrumb.css +55 -0
- package/src/ui/components/button/ButtonRender.js +65 -0
- package/src/ui/components/button/button.css +288 -354
- package/src/ui/components/contextmenu/ContextmenuRender.js +70 -0
- package/src/ui/components/contextmenu/contextmenu.css +36 -0
- package/src/ui/components/divider/DividerRender.js +70 -0
- package/src/ui/components/divider/divider.css +70 -0
- package/src/ui/components/dropdown/DropdownRender.js +92 -0
- package/src/ui/components/dropdown/divider/DropdownDividerRender.js +9 -0
- package/src/ui/components/dropdown/divider/dropdown-divider.css +0 -0
- package/src/ui/components/dropdown/dropdown.css +179 -0
- package/src/ui/components/dropdown/group/DropdownGroupRender.js +23 -0
- package/src/ui/components/dropdown/group/dropdown-group.css +0 -0
- package/src/ui/components/dropdown/item/DropdownItemRender.js +29 -0
- package/src/ui/components/dropdown/item/dropdown-item.css +0 -0
- package/src/ui/components/form/FieldCollectionRender.js +110 -0
- package/src/ui/components/form/FormControlRender.js +84 -0
- package/src/ui/components/form/field-collection.css +55 -0
- package/src/ui/components/form/fields/AutocompleteFieldRender.js +143 -0
- package/src/ui/components/form/fields/CheckboxFieldRender.js +59 -0
- package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +92 -0
- package/src/ui/components/form/fields/ColorFieldRender.js +30 -0
- package/src/ui/components/form/fields/DateFieldRender.js +154 -0
- package/src/ui/components/form/fields/EmailFieldRender.js +5 -0
- package/src/ui/components/form/fields/FieldRender.js +117 -0
- package/src/ui/components/form/fields/FileFieldRender.js +41 -0
- package/src/ui/components/form/fields/HiddenFieldRender.js +14 -0
- package/src/ui/components/form/fields/ImageFieldRender.js +0 -0
- package/src/ui/components/form/fields/NumberFieldRender.js +52 -0
- package/src/ui/components/form/fields/PasswordFieldRender.js +65 -0
- package/src/ui/components/form/fields/RadioFieldRender.js +77 -0
- package/src/ui/components/form/fields/RangeFieldRender.js +121 -0
- package/src/ui/components/form/fields/SelectFieldRender.js +248 -0
- package/src/ui/components/form/fields/SliderFieldRender.js +359 -0
- package/src/ui/components/form/fields/StringFieldRender.js +6 -0
- package/src/ui/components/form/fields/TelFieldRender.js +6 -0
- package/src/ui/components/form/fields/TextAreaFieldRender.js +96 -0
- package/src/ui/components/form/fields/TimeFieldRender.js +141 -0
- package/src/ui/components/form/fields/UrlFieldRender.js +6 -0
- package/src/ui/components/form/fields/date-field.css +32 -0
- package/src/ui/components/form/fields/field.css +402 -0
- package/src/ui/components/form/fields/file-field.css +79 -0
- package/src/ui/components/form/fields/password-field.css +50 -0
- package/src/ui/components/form/fields/range-field.css +120 -0
- package/src/ui/components/form/fields/slider.css +195 -0
- package/src/ui/components/form/file-upload-mode/FileAvatarModeRender.js +143 -0
- package/src/ui/components/form/file-upload-mode/FileDropzoneModeRender.js +108 -0
- package/src/ui/components/form/file-upload-mode/FileNativeModeRender.js +22 -0
- package/src/ui/components/form/file-upload-mode/FileUploadButtonModeRender.js +89 -0
- package/src/ui/components/form/file-upload-mode/FileWallModeRender.js +91 -0
- package/src/ui/components/form/file-upload-mode/file-avatar-mode.css +139 -0
- package/src/ui/components/form/file-upload-mode/file-dropzone-mode.css +88 -0
- package/src/ui/components/form/file-upload-mode/file-upload-button-mode.css +44 -0
- package/src/ui/components/form/file-upload-mode/file-wall-mode.css +88 -0
- package/src/ui/components/form/form-control.css +40 -0
- package/src/ui/components/form/helpers.js +112 -0
- package/src/ui/components/form/index.js +61 -0
- package/src/ui/components/menu/MenuDividerRender.js +12 -0
- package/src/ui/components/menu/MenuGroupRender.js +60 -0
- package/src/ui/components/menu/MenuItemRender.js +57 -0
- package/src/ui/components/menu/MenuLinkRender.js +55 -0
- package/src/ui/components/menu/MenuRender.js +21 -0
- package/src/ui/components/menu/helpers.js +121 -0
- package/src/ui/components/menu/menu.css +308 -0
- package/src/ui/components/modal/ModalRender.js +119 -0
- package/src/ui/components/modal/modal.css +156 -0
- package/src/ui/components/pagination/PaginationRender.js +112 -0
- package/src/ui/components/pagination/pagination.css +63 -0
- package/src/ui/components/popover/PopoverRender.js +234 -0
- package/src/ui/components/popover/popover.css +139 -0
- package/src/ui/components/progress/ProgressRender.js +168 -0
- package/src/ui/components/progress/progress.css +197 -0
- package/src/ui/components/skeleton/SkeletonRender.js +79 -0
- package/src/ui/components/skeleton/skeleton.css +154 -0
- package/src/ui/components/spinner/SpinnerRender.js +46 -0
- package/src/ui/components/spinner/spinner.css +152 -0
- package/src/ui/components/splitter/SplitterGutterRender.js +94 -0
- package/src/ui/components/splitter/SplitterPanelRender.js +38 -0
- package/src/ui/components/splitter/SplitterRender.js +74 -0
- package/src/ui/components/splitter/splitter.css +128 -0
- package/src/ui/components/stacks/PositionStackRender.js +38 -0
- package/src/ui/components/stacks/StackRender.js +42 -0
- package/src/ui/components/stacks/absolute-stack/AbsoluteStackRender.js +5 -0
- package/src/ui/components/stacks/fixed-stack/FixedStackRender.js +5 -0
- package/src/ui/components/stacks/h-stack/HStackRender.js +7 -0
- package/src/ui/components/stacks/h-stack/h-stack.css +4 -0
- package/src/ui/components/stacks/index.js +15 -0
- package/src/ui/components/stacks/position-stack.css +62 -0
- package/src/ui/components/stacks/relative-stack/RelativeStackRender.js +7 -0
- package/src/ui/components/stacks/relative-stack/relative-stack.css +3 -0
- package/src/ui/components/stacks/stack.css +78 -0
- package/src/ui/components/stacks/v-stack/VStackRender.js +5 -0
- package/src/ui/components/stacks/v-stack/v-stack.css +4 -0
- package/src/ui/components/stepper/StepperRender.js +70 -0
- package/src/ui/components/stepper/StepperStepRender.js +67 -0
- package/src/ui/components/stepper/stepper.css +359 -0
- package/src/ui/components/switch/SwitchRender.js +82 -0
- package/src/ui/components/switch/switch.css +143 -0
- package/src/ui/components/table/data-table/DataTableRender.js +49 -0
- package/src/ui/components/table/data-table/bulk-actions.js +35 -0
- package/src/ui/components/table/data-table/data-table.css +246 -0
- package/src/ui/components/table/data-table/pagination.js +56 -0
- package/src/ui/components/table/data-table/tables.js +363 -0
- package/src/ui/components/table/data-table/toolbar.js +67 -0
- package/src/ui/components/table/simple-table/SimpleTableRender.js +188 -0
- package/src/ui/components/table/simple-table/simple-table.css +50 -0
- package/src/ui/components/tabs/TabsRender.js +226 -0
- package/src/ui/components/tabs/tabs.css +253 -0
- package/src/ui/components/toast/ToastRender.js +98 -0
- package/src/ui/components/toast/toast.css +201 -0
- package/src/ui/components/tooltip/TooltipRender.js +8 -0
- package/src/ui/components/tooltip/tooltip.css +113 -0
- package/src/ui/index.js +82 -0
- package/src/ui/tokens/colors-dark.scss +2 -1
- package/src/ui/tokens/reset.scss +3 -0
- package/types/control-flow.d.ts +2 -2
- package/src/components/layouts/ZStack.js +0 -41
- package/src/ui/components/button/button.render.js +0 -63
- /package/src/components/{layouts → stacks}/HStack.js +0 -0
- /package/src/components/{layouts → stacks}/VStack.js +0 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--stepper-connector-color: var(--gray-lite-3);
|
|
3
|
+
--stepper-connector-color-active: var(--color-primary);
|
|
4
|
+
--stepper-connector-color-completed: var(--color-success);
|
|
5
|
+
--stepper-connector-thickness: 2px;
|
|
6
|
+
|
|
7
|
+
--step-indicator-size: 32px;
|
|
8
|
+
--step-indicator-bg: var(--gray-lite-4);
|
|
9
|
+
--step-indicator-bg-active: var(--color-primary);
|
|
10
|
+
--step-indicator-bg-completed: var(--color-success);
|
|
11
|
+
--step-indicator-bg-error: var(--color-danger);
|
|
12
|
+
--step-indicator-color: var(--gray);
|
|
13
|
+
--step-indicator-color-active: var(--white);
|
|
14
|
+
--step-indicator-font-size: var(--hint-size);
|
|
15
|
+
--step-indicator-font-weight: 600;
|
|
16
|
+
--step-state-indicator-width: 20px;
|
|
17
|
+
--step-state-indicator-height: 20px;
|
|
18
|
+
|
|
19
|
+
--step-label-size: var(--hint-size);
|
|
20
|
+
--step-label-color: var(--gray);
|
|
21
|
+
--step-label-color-active: var(--text-color);
|
|
22
|
+
--step-label-weight: 500;
|
|
23
|
+
|
|
24
|
+
--step-description-size: var(--note-size);
|
|
25
|
+
--step-description-color: var(--gray);
|
|
26
|
+
|
|
27
|
+
--stepper-content-padding: var(--space-comfortable) 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.stepper {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
width: 100%;
|
|
34
|
+
|
|
35
|
+
&.is-horizontal {
|
|
36
|
+
.stepper-nav {
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.stepper-step-wrapper {
|
|
42
|
+
flex: 1;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
&:last-child {
|
|
46
|
+
flex: none;
|
|
47
|
+
.stepper-connector {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.stepper-step {
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: center;
|
|
56
|
+
text-align: center;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.stepper-connector {
|
|
60
|
+
flex: 1;
|
|
61
|
+
height: var(--stepper-connector-thickness);
|
|
62
|
+
margin-top: calc(var(--step-indicator-size) / 2);
|
|
63
|
+
margin-left: 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.is-vertical {
|
|
68
|
+
.stepper-nav {
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.stepper-step-wrapper {
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.stepper-step {
|
|
77
|
+
flex-direction: row;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: var(--space-comfortable);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.stepper-connector {
|
|
83
|
+
width: var(--stepper-connector-thickness);
|
|
84
|
+
height: 32px;
|
|
85
|
+
margin-left: calc(var(--step-indicator-size) / 2 - var(--stepper-connector-thickness) / 2);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.is-alternative-label {
|
|
90
|
+
.stepper-step {
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
align-items: center;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.step-label-wrapper {
|
|
96
|
+
align-items: center;
|
|
97
|
+
text-align: center;
|
|
98
|
+
margin-top: var(--space-cozy);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.stepper-nav {
|
|
104
|
+
display: flex;
|
|
105
|
+
width: 100%;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.stepper-step-wrapper {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: flex-start;
|
|
111
|
+
flex: 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.stepper-step {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: var(--space-cozy);
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
flex-shrink: 0;
|
|
120
|
+
transition: opacity 0.2s ease;
|
|
121
|
+
|
|
122
|
+
&:hover {
|
|
123
|
+
opacity: 0.8;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.stepper-connector {
|
|
128
|
+
background: var(--stepper-connector-color);
|
|
129
|
+
border-radius: 2px;
|
|
130
|
+
transition: background 0.3s ease;
|
|
131
|
+
|
|
132
|
+
&.is-completed {
|
|
133
|
+
background: var(--step-indicator-bg-completed);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.step-indicator {
|
|
138
|
+
position: relative;
|
|
139
|
+
display: inline-flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
width: var(--step-indicator-size);
|
|
143
|
+
height: var(--step-indicator-size);
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
background: var(--step-indicator-bg);
|
|
146
|
+
color: var(--step-indicator-color);
|
|
147
|
+
font-size: var(--step-indicator-font-size);
|
|
148
|
+
font-weight: var(--step-indicator-font-weight);
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
|
|
151
|
+
|
|
152
|
+
&.is-active {
|
|
153
|
+
background: var(--step-indicator-bg-active);
|
|
154
|
+
color: var(--step-indicator-color-active);
|
|
155
|
+
transform: scale(1.1);
|
|
156
|
+
box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 15%, transparent);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&.is-completed {
|
|
160
|
+
background: var(--step-indicator-bg-completed);
|
|
161
|
+
color: var(--step-indicator-color-active);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&.is-error {
|
|
165
|
+
background: var(--step-indicator-bg-error);
|
|
166
|
+
color: var(--step-indicator-color-active);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.step-state-indicator {
|
|
171
|
+
position: absolute;
|
|
172
|
+
font-size: var(--step-indicator-font-size);
|
|
173
|
+
font-weight: 600;
|
|
174
|
+
top: -2px;
|
|
175
|
+
right: -6px;
|
|
176
|
+
width: var(--step-state-indicator-width);
|
|
177
|
+
height: var(--step-state-indicator-height);
|
|
178
|
+
border-radius: 50%;
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
color: white;
|
|
183
|
+
border: 2px solid var(--white);
|
|
184
|
+
transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
185
|
+
padding: 2px;
|
|
186
|
+
|
|
187
|
+
.is-pending & {
|
|
188
|
+
display: none;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.is-completed & {
|
|
192
|
+
background: var(--step-indicator-bg-completed);
|
|
193
|
+
content: '✓';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.is-error & {
|
|
197
|
+
background: var(--step-indicator-bg-error);
|
|
198
|
+
content: '✕';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.step-label-wrapper {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
gap: 2px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.step-label {
|
|
209
|
+
font-size: var(--step-label-size);
|
|
210
|
+
font-weight: var(--step-label-weight);
|
|
211
|
+
color: var(--step-label-color);
|
|
212
|
+
transition: color 0.2s ease;
|
|
213
|
+
-webkit-line-clamp: 2;
|
|
214
|
+
-webkit-box-orient: vertical;
|
|
215
|
+
|
|
216
|
+
&.is-active {
|
|
217
|
+
color: var(--step-label-color-active);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.step-description {
|
|
222
|
+
font-size: var(--step-description-size);
|
|
223
|
+
color: var(--step-description-color);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.step-optional {
|
|
227
|
+
font-size: var(--step-description-size);
|
|
228
|
+
color: var(--step-description-color);
|
|
229
|
+
font-style: italic;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.stepper-content {
|
|
233
|
+
padding: var(--stepper-content-padding);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.stepper-panel {
|
|
237
|
+
&.is-hidden {
|
|
238
|
+
display: none;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.stepper.is-horizontal {
|
|
243
|
+
@media (max-width: 768px) {
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
|
|
246
|
+
.stepper-nav {
|
|
247
|
+
flex-direction: column;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.stepper-step-wrapper {
|
|
251
|
+
flex-direction: column;
|
|
252
|
+
width: 100%;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.stepper-step {
|
|
256
|
+
flex-direction: row;
|
|
257
|
+
align-items: center;
|
|
258
|
+
width: 100%;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.stepper-connector {
|
|
262
|
+
width: var(--stepper-connector-thickness);
|
|
263
|
+
height: 24px;
|
|
264
|
+
margin-left: calc(var(--step-indicator-size) / 2 - var(--stepper-connector-thickness) / 2);
|
|
265
|
+
margin-top: 0;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@media (max-width: 480px) {
|
|
271
|
+
.step-label-wrapper {
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.stepper-step.is-active .step-label-wrapper {
|
|
276
|
+
display: flex;
|
|
277
|
+
position: absolute;
|
|
278
|
+
top: 100%;
|
|
279
|
+
left: 50%;
|
|
280
|
+
transform: translateX(-50%);
|
|
281
|
+
width: 120px;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
.stepper.has-navigation-at-top,
|
|
287
|
+
.stepper.has-navigation-at-bottom {
|
|
288
|
+
flex-direction: column;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.stepper.has-navigation-at-bottom .stepper-nav {
|
|
292
|
+
margin-top: auto;
|
|
293
|
+
order: 2;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.stepper.has-navigation-at-trailing,
|
|
297
|
+
.stepper.has-navigation-at-leading {
|
|
298
|
+
.stepper-step-wrapper:last-child {
|
|
299
|
+
.stepper-connector {
|
|
300
|
+
display: none;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
.stepper.has-navigation-at-leading {
|
|
305
|
+
flex-direction: row;
|
|
306
|
+
|
|
307
|
+
.stepper-nav {
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
align-items: flex-start;
|
|
310
|
+
width: auto;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.stepper-step {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
gap: 12px;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.stepper-connector {
|
|
320
|
+
margin-left: 15px;
|
|
321
|
+
width: 2px;
|
|
322
|
+
min-height: 20px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.stepper-content {
|
|
326
|
+
flex: 1;
|
|
327
|
+
padding-left: var(--space-comfortable);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.stepper.has-navigation-at-trailing {
|
|
332
|
+
flex-direction: row;
|
|
333
|
+
.stepper-nav {
|
|
334
|
+
flex-direction: column;
|
|
335
|
+
align-items: flex-end;
|
|
336
|
+
width: auto;
|
|
337
|
+
}
|
|
338
|
+
.stepper-step-wrapper {
|
|
339
|
+
align-items: flex-end;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.stepper-step {
|
|
343
|
+
display: flex;
|
|
344
|
+
flex-direction: row-reverse;
|
|
345
|
+
align-items: center;
|
|
346
|
+
gap: 12px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.stepper-connector {
|
|
350
|
+
margin-right: 15px;
|
|
351
|
+
width: 2px;
|
|
352
|
+
min-height: 20px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.stepper-content {
|
|
356
|
+
flex: 1;
|
|
357
|
+
padding-right: var(--space-comfortable);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {Div, Span, Label, Input, Match} from '../../../../elements';
|
|
2
|
+
import './switch.css';
|
|
3
|
+
|
|
4
|
+
export default function SwitchRender($desc, instance) {
|
|
5
|
+
const props = instance.getEditableProps();
|
|
6
|
+
|
|
7
|
+
props.class.add('switch');
|
|
8
|
+
props.class.add({
|
|
9
|
+
'is-disabled': $desc.disabled,
|
|
10
|
+
'is-readonly': $desc.readonly,
|
|
11
|
+
'is-loading': $desc.loading,
|
|
12
|
+
'_': $desc.variant.transform((value) => `is-${value}`),
|
|
13
|
+
'is-outline': $desc.outline,
|
|
14
|
+
'is-checked': $desc.value,
|
|
15
|
+
'___': $desc.value.transform(value => `is-state-${value ? 'on' : 'off'}`)
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if($desc.labelPosition) {
|
|
19
|
+
props.class.add('is-label-' + $desc.labelPosition);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const input = Input({
|
|
23
|
+
class: 'switch-input',
|
|
24
|
+
type: 'checkbox',
|
|
25
|
+
checked: $desc.value,
|
|
26
|
+
disabled: $desc.disabled,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
$desc.value.subscribe(() => {
|
|
30
|
+
const val = $desc.value.val();
|
|
31
|
+
instance.emit('change', val);
|
|
32
|
+
instance.emit(val ? 'on' : 'off', val);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const thumb = buildThumb($desc);
|
|
36
|
+
const innerLabel = buildInnerLabel($desc);
|
|
37
|
+
const track = Div({class: 'switch-track'}, [innerLabel, thumb].filter(Boolean));
|
|
38
|
+
|
|
39
|
+
const content = [];
|
|
40
|
+
|
|
41
|
+
const label = $desc.label
|
|
42
|
+
? Span({class: 'switch-label'}, $desc.label)
|
|
43
|
+
: null;
|
|
44
|
+
|
|
45
|
+
if(label && ($desc.labelPosition === 'left' || $desc.labelPosition === 'top')) {
|
|
46
|
+
content.push(label);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
content.push(input, track);
|
|
50
|
+
|
|
51
|
+
if(label && (!$desc.labelPosition || $desc.labelPosition === 'right' || $desc.labelPosition === 'bottom')) {
|
|
52
|
+
content.push(label);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return Label(instance.resolveProps(), content);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const buildThumb = ($desc) => {
|
|
59
|
+
if($desc.onIcon || $desc.offIcon) {
|
|
60
|
+
return Div({class: 'switch-thumb'},
|
|
61
|
+
Span({class: 'switch-icon'},
|
|
62
|
+
Match($desc.value, {
|
|
63
|
+
true: $desc.onIcon,
|
|
64
|
+
false: $desc.offIcon,
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return Div({class: 'switch-thumb'});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const buildInnerLabel = ($desc) => {
|
|
74
|
+
if(!$desc.innerOnLabel && !$desc.innerOffLabel) return null;
|
|
75
|
+
|
|
76
|
+
return Span({class: 'switch-inner-label'},
|
|
77
|
+
Match($desc.value, {
|
|
78
|
+
true: $desc.innerOnLabel || '',
|
|
79
|
+
false: $desc.innerOffLabel || '',
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--switch-width: 44px;
|
|
3
|
+
--switch-height: 24px;
|
|
4
|
+
--switch-thumb-size: 18px;
|
|
5
|
+
--switch-thumb-offset: 3px;
|
|
6
|
+
--switch-border-width: 0px;
|
|
7
|
+
--switch-track-bg: var(--gray-lite-3);
|
|
8
|
+
--switch-track-bg-active: var(--color-primary);
|
|
9
|
+
--switch-thumb-bg: var(--background);
|
|
10
|
+
--switch-thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
11
|
+
--switch-transition: 0.2s ease;
|
|
12
|
+
--switch-label-gap: var(--space-cozy);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.switch {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: var(--switch-label-gap);
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
user-select: none;
|
|
21
|
+
|
|
22
|
+
&.is-label-top,
|
|
23
|
+
&.is-label-bottom {
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.is-disabled {
|
|
29
|
+
opacity: 0.5;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.is-readonly {
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Variants */
|
|
38
|
+
&.is-primary { --switch-track-bg-active: var(--color-primary); }
|
|
39
|
+
&.is-success { --switch-track-bg-active: var(--color-success); }
|
|
40
|
+
&.is-danger { --switch-track-bg-active: var(--color-danger); }
|
|
41
|
+
&.is-warning { --switch-track-bg-active: var(--color-warning); }
|
|
42
|
+
&.is-secondary { --switch-track-bg-active: var(--gray); }
|
|
43
|
+
&.is-ghost {
|
|
44
|
+
--switch-track-bg-active: transparent;
|
|
45
|
+
--switch-thumb-bg: var(--color-primary);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Outline */
|
|
49
|
+
&.is-outline {
|
|
50
|
+
--switch-border-width: 2px;
|
|
51
|
+
|
|
52
|
+
.switch-track {
|
|
53
|
+
background: transparent;
|
|
54
|
+
border: var(--switch-border-width) solid var(--switch-track-bg);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.is-state-on .switch-track {
|
|
58
|
+
border-color: var(--switch-track-bg-active);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.switch-input {
|
|
64
|
+
position: absolute;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
width: 0;
|
|
67
|
+
height: 0;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.switch-track {
|
|
72
|
+
position: relative;
|
|
73
|
+
width: var(--switch-width);
|
|
74
|
+
height: var(--switch-height);
|
|
75
|
+
border-radius: calc(var(--switch-height) / 2);
|
|
76
|
+
background: var(--switch-track-bg);
|
|
77
|
+
transition: background var(--switch-transition);
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
|
|
80
|
+
.is-state-on & {
|
|
81
|
+
background: var(--switch-track-bg-active);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.switch-thumb {
|
|
86
|
+
position: absolute;
|
|
87
|
+
top: calc(var(--switch-thumb-offset) - var(--switch-border-width));
|
|
88
|
+
left: calc(var(--switch-thumb-offset) - var(--switch-border-width));
|
|
89
|
+
width: var(--switch-thumb-size);
|
|
90
|
+
height: var(--switch-thumb-size);
|
|
91
|
+
border-radius: 50%;
|
|
92
|
+
background: var(--switch-thumb-bg);
|
|
93
|
+
box-shadow: var(--switch-thumb-shadow);
|
|
94
|
+
transition: transform var(--switch-transition);
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
|
|
99
|
+
.is-state-on & {
|
|
100
|
+
transform: translateX(calc(
|
|
101
|
+
var(--switch-width) - var(--switch-thumb-size) -
|
|
102
|
+
var(--switch-thumb-offset) * 2 -
|
|
103
|
+
var(--switch-border-width) * 2
|
|
104
|
+
));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.is-state-off & {
|
|
108
|
+
transform: translateX(0);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.switch-inner-label {
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: 50%;
|
|
115
|
+
transform: translateY(-50%);
|
|
116
|
+
font-size: 10px;
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
color: var(--switch-thumb-bg);
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
transition: left var(--switch-transition), right var(--switch-transition);
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
|
|
123
|
+
.is-state-on & {
|
|
124
|
+
left: calc(var(--switch-thumb-offset) + 2px);
|
|
125
|
+
right: auto;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.is-state-off & {
|
|
129
|
+
right: calc(var(--switch-thumb-offset) + 2px);
|
|
130
|
+
left: auto;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.switch-icon {
|
|
135
|
+
font-size: 11px;
|
|
136
|
+
line-height: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.switch-label {
|
|
140
|
+
font-size: var(--description-size);
|
|
141
|
+
color: var(--color-text-primary);
|
|
142
|
+
line-height: 1.4;
|
|
143
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {Div, Span, Table, THead, TBody, TRow, THeadCell, TBodyCell, Input, Select, Option, Button} from '../../../../../elements';
|
|
2
|
+
import './data-table.css';
|
|
3
|
+
import {buildColumnsBtn, buildExportBtn, buildFiltersBtn, buildSearch, buildToolbar} from "./toolbar";
|
|
4
|
+
import {buildBulkActions, buildBulkButtons, buildBulkCount} from "./bulk-actions";
|
|
5
|
+
import {buildTable} from "./tables";
|
|
6
|
+
import {buildPageInfo, buildPageNav, buildPageSize, buildPagination} from "./pagination";
|
|
7
|
+
|
|
8
|
+
export default function DataTableRender($desc, instance) {
|
|
9
|
+
const props = instance.getEditableProps();
|
|
10
|
+
props.class.add('data-table');
|
|
11
|
+
|
|
12
|
+
const visibleColumns = $desc.columns.filter(col =>
|
|
13
|
+
col.$description.visible !== false
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// Build Slots
|
|
18
|
+
const search = buildSearch($desc, instance);
|
|
19
|
+
const filters = buildFiltersBtn($desc, instance);
|
|
20
|
+
const exportBtn = buildExportBtn($desc, instance);
|
|
21
|
+
const columnsBtn = buildColumnsBtn($desc, instance);
|
|
22
|
+
const toolbar = buildToolbar({ search, filters, exportBtn, columnsBtn });
|
|
23
|
+
|
|
24
|
+
const bulkCount = buildBulkCount($desc, instance);
|
|
25
|
+
const bulkButtons = buildBulkButtons($desc, instance);
|
|
26
|
+
const bulkActions = buildBulkActions({bulkCount, bulkButtons}, $desc, instance);
|
|
27
|
+
|
|
28
|
+
const table = buildTable($desc, instance, visibleColumns);
|
|
29
|
+
|
|
30
|
+
const pageInfo = buildPageInfo($desc, instance);
|
|
31
|
+
const pageSize = buildPageSize($desc, instance);
|
|
32
|
+
const pageNav = buildPageNav($desc, instance);
|
|
33
|
+
const pagination = buildPagination({pageInfo, pageSize, pageNav});
|
|
34
|
+
|
|
35
|
+
const slots = {visibleColumns, toolbar, search, filters, exportBtn, columnsBtn, bulkActions, bulkCount, bulkButtons, table, pagination, pageInfo, pageSize, pageNav};
|
|
36
|
+
|
|
37
|
+
const layoutFn = $desc.layout || buildDefaultLayout;
|
|
38
|
+
|
|
39
|
+
return layoutFn(slots, instance);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const buildDefaultLayout = ({toolbar, bulkActions, table, pagination}) => {
|
|
43
|
+
return Div({class: 'data-table-layout'}, [
|
|
44
|
+
toolbar,
|
|
45
|
+
bulkActions,
|
|
46
|
+
table,
|
|
47
|
+
pagination,
|
|
48
|
+
]);
|
|
49
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {Div, Span} from "../../../../../elements";
|
|
2
|
+
import {Button} from "../../../../components/button";
|
|
3
|
+
import {ShowIf} from "../../../../core/elements";
|
|
4
|
+
|
|
5
|
+
export const buildBulkActions = ({bulkCount, bulkButtons}, $desc, instance) => {
|
|
6
|
+
if(!$desc.bulkActions?.length) return null;
|
|
7
|
+
|
|
8
|
+
return ShowIf($desc.$selectedRows.is(items => items.length > 0), () => {
|
|
9
|
+
return Div({class: 'data-table-bulk'}, [bulkCount, bulkButtons]);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const buildBulkCount = ($desc, instance) => {
|
|
14
|
+
return Span({ class: 'data-table-bulk-count' },
|
|
15
|
+
$desc.$selectedRows.transform(rows => $desc.labels.selected(rows.length))
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const buildBulkButtons = ($desc, instance) => {
|
|
20
|
+
if(!$desc.bulkActions?.length) return null;
|
|
21
|
+
|
|
22
|
+
return Div({class: 'data-table-bulk-buttons'},
|
|
23
|
+
$desc.bulkActions.map(action => {
|
|
24
|
+
let btn = action.btn;
|
|
25
|
+
if(!btn) {
|
|
26
|
+
btn = Button(action.label).small();
|
|
27
|
+
if(action.danger) {
|
|
28
|
+
btn.danger();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
btn.nd.onClick(() => action.onClick($desc.$selectedRows.val()));
|
|
32
|
+
return btn;
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
};
|