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,253 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tabs-border: var(--gray-lite-3);
|
|
3
|
+
--tabs-radius: var(--radius-button);
|
|
4
|
+
--tabs-font-size: var(--description-size);
|
|
5
|
+
--tabs-font-weight: 500;
|
|
6
|
+
|
|
7
|
+
--tab-padding: var(--space-cozy) var(--space-comfortable);
|
|
8
|
+
--tab-color: var(--gray);
|
|
9
|
+
--tab-color-active: var(--color-primary);
|
|
10
|
+
--tab-color-hover: var(--text-color);
|
|
11
|
+
--tab-bg-hover: var(--gray-lite-5);
|
|
12
|
+
--tab-indicator-height: 2px;
|
|
13
|
+
|
|
14
|
+
--tabs-content-padding: var(--space-comfortable) 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tabs {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
width: 100%;
|
|
21
|
+
|
|
22
|
+
.tab-nav-options {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
align-content: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tabs-nav-wrap {
|
|
30
|
+
flex: 1;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
&.is-navigation-at-left,
|
|
34
|
+
&.is-navigation-at-right {
|
|
35
|
+
.tabs-nav-wrap {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
&:hover {
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.tab-nav-options {
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
&.is-navigation-at-top,
|
|
46
|
+
&.is-navigation-at-bottom {
|
|
47
|
+
.tabs-nav-wrap {
|
|
48
|
+
&:hover {
|
|
49
|
+
overflow-x: auto;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.is-navigation-at-left {
|
|
55
|
+
flex-direction: row;
|
|
56
|
+
|
|
57
|
+
.tabs-nav {
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
border-bottom: none;
|
|
60
|
+
border-right: 1px solid var(--tabs-border);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.tabs-tab {
|
|
64
|
+
border-bottom: none;
|
|
65
|
+
border-right: var(--tab-indicator-height) solid transparent;
|
|
66
|
+
border-radius: var(--tabs-radius) 0 0 var(--tabs-radius);
|
|
67
|
+
margin-bottom: 0;
|
|
68
|
+
margin-right: calc(var(--tab-indicator-height) * -1);
|
|
69
|
+
|
|
70
|
+
&.is-active {
|
|
71
|
+
border-right-color: var(--tab-color-active);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.is-navigation-at-right {
|
|
77
|
+
flex-direction: row-reverse;
|
|
78
|
+
|
|
79
|
+
.tabs-nav {
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
border-bottom: none;
|
|
82
|
+
border-left: 1px solid var(--tabs-border);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tabs-tab {
|
|
86
|
+
border-bottom: none;
|
|
87
|
+
border-left: var(--tab-indicator-height) solid transparent;
|
|
88
|
+
border-radius: 0 var(--tabs-radius) var(--tabs-radius) 0;
|
|
89
|
+
margin-bottom: 0;
|
|
90
|
+
margin-left: calc(var(--tab-indicator-height) * -1);
|
|
91
|
+
|
|
92
|
+
&.is-active {
|
|
93
|
+
border-left-color: var(--tab-color-active);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.is-navigation-at-dock {
|
|
99
|
+
flex-direction: column-reverse;
|
|
100
|
+
|
|
101
|
+
.tabs-nav {
|
|
102
|
+
border-bottom: none;
|
|
103
|
+
border-top: 1px solid var(--tabs-border);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.tabs-tab {
|
|
107
|
+
border-bottom: none;
|
|
108
|
+
border-top: var(--tab-indicator-height) solid transparent;
|
|
109
|
+
border-radius: 0 0 var(--tabs-radius) var(--tabs-radius);
|
|
110
|
+
margin-bottom: 0;
|
|
111
|
+
margin-top: calc(var(--tab-indicator-height) * -1);
|
|
112
|
+
|
|
113
|
+
&.is-active {
|
|
114
|
+
border-top-color: var(--tab-color-active);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&.is-align-leading .tabs-nav-wrap { justify-content: flex-start; }
|
|
120
|
+
&.is-align-trailing .tabs-nav-wrap { justify-content: flex-end; }
|
|
121
|
+
&.is-align-center .tabs-nav-wrap { justify-content: center; }
|
|
122
|
+
&.is-align-justified .tabs-nav-wrap { justify-content: stretch; .tabs-tab { flex: 1; justify-content: center; } }
|
|
123
|
+
|
|
124
|
+
&.is-overflow-scroll .tabs-nav-wrap {
|
|
125
|
+
overflow-x: auto;
|
|
126
|
+
scrollbar-width: none;
|
|
127
|
+
|
|
128
|
+
&::-webkit-scrollbar {
|
|
129
|
+
display: none;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&.is-appearance-pills {
|
|
134
|
+
.tabs-tab {
|
|
135
|
+
border-bottom: none;
|
|
136
|
+
border-radius: var(--radius-pill);
|
|
137
|
+
margin-bottom: 0;
|
|
138
|
+
|
|
139
|
+
&.is-active {
|
|
140
|
+
background: var(--color-primary);
|
|
141
|
+
color: var(--white);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:hover {
|
|
145
|
+
background: var(--tab-bg-hover);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.tabs-nav {
|
|
150
|
+
border-bottom: none;
|
|
151
|
+
gap: var(--space-cozy);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&.is-closable .tabs-tab-closer {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.tabs-tab {
|
|
161
|
+
&.is-dragging {
|
|
162
|
+
display: none;
|
|
163
|
+
pointer-events: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&.is-drag-over {
|
|
167
|
+
border-color: var(--color-primary);
|
|
168
|
+
background: var(--tab-bg-hover);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.tabs-nav {
|
|
173
|
+
display: flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
border-bottom: 1px solid var(--tabs-border);
|
|
176
|
+
position: relative;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.tabs-nav-wrap {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex: 1;
|
|
182
|
+
gap: 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.tab-nav-overflow {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
flex-shrink: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.tabs-tab {
|
|
192
|
+
display: inline-flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
gap: var(--space-cozy);
|
|
195
|
+
padding: var(--tab-padding);
|
|
196
|
+
font-size: var(--tabs-font-size);
|
|
197
|
+
font-weight: var(--tabs-font-weight);
|
|
198
|
+
color: var(--tab-color);
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
border-radius: var(--tabs-radius) var(--tabs-radius) 0 0;
|
|
201
|
+
position: relative;
|
|
202
|
+
white-space: nowrap;
|
|
203
|
+
transition: color 0.15s ease, background 0.15s ease;
|
|
204
|
+
border-bottom: var(--tab-indicator-height) solid transparent;
|
|
205
|
+
margin-bottom: calc(var(--tab-indicator-height) * -1);
|
|
206
|
+
user-select: none;
|
|
207
|
+
|
|
208
|
+
&:hover {
|
|
209
|
+
color: var(--tab-color-hover);
|
|
210
|
+
background: var(--tab-bg-hover);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&.is-active {
|
|
214
|
+
color: var(--tab-color-active);
|
|
215
|
+
border-bottom-color: var(--tab-color-active);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.tabs-tab-icon {
|
|
220
|
+
display: inline-flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
width: 16px;
|
|
223
|
+
height: 16px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.tabs-tab-label {
|
|
227
|
+
flex: 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.tabs-tab-closer {
|
|
231
|
+
display: none;
|
|
232
|
+
align-items: center;
|
|
233
|
+
justify-content: center;
|
|
234
|
+
width: 16px;
|
|
235
|
+
height: 16px;
|
|
236
|
+
border-radius: 50%;
|
|
237
|
+
opacity: 0.5;
|
|
238
|
+
font-size: var(--note-size);
|
|
239
|
+
|
|
240
|
+
&:hover {
|
|
241
|
+
opacity: 1;
|
|
242
|
+
background: var(--gray-lite-4);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.tabs-content {
|
|
247
|
+
padding: var(--tabs-content-padding);
|
|
248
|
+
flex: 1;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.tabs-panel {
|
|
252
|
+
|
|
253
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {Div, Span} from '../../../core/elements';
|
|
2
|
+
import {createPortal} from "../../../../elements";
|
|
3
|
+
import Button from '../../../components/button/Button';
|
|
4
|
+
import './toast.css';
|
|
5
|
+
|
|
6
|
+
const $containers = {};
|
|
7
|
+
|
|
8
|
+
const getContainer = (position) => {
|
|
9
|
+
if($containers[position]) {
|
|
10
|
+
return $containers[position];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const container = Div({class: 'toast-container is-' + position});
|
|
14
|
+
createPortal(container, { name: 'toast-' + position });
|
|
15
|
+
$containers[position] = container;
|
|
16
|
+
|
|
17
|
+
return container;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function ToastRender($desc, instance) {
|
|
21
|
+
const props = instance.getEditableProps();
|
|
22
|
+
const type = $desc.type || 'info';
|
|
23
|
+
const position = $desc.position || 'top-trailing';
|
|
24
|
+
|
|
25
|
+
props.class.add('toast');
|
|
26
|
+
props.class.add('is-' + type);
|
|
27
|
+
|
|
28
|
+
const content = [];
|
|
29
|
+
|
|
30
|
+
if($desc.showIcon && $desc.icon) {
|
|
31
|
+
content.push(Span({class: 'toast-icon'}, $desc.icon));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
content.push(buildContent($desc, instance));
|
|
35
|
+
|
|
36
|
+
if($desc.closable) {
|
|
37
|
+
const closeBtn = Button('×', { class: 'toast-close', type: 'button' })
|
|
38
|
+
.ghost()
|
|
39
|
+
.nd.onClick(() => instance.close());
|
|
40
|
+
content.push(closeBtn);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const element = Div(instance.resolveProps(), content);
|
|
44
|
+
|
|
45
|
+
const container = getContainer(position);
|
|
46
|
+
container.appendChild(element);
|
|
47
|
+
|
|
48
|
+
const close = (visible) => {
|
|
49
|
+
if(!visible) {
|
|
50
|
+
element.remove();
|
|
51
|
+
$desc.visibility.unsubscribe(close);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
$desc.visibility.subscribe(close);
|
|
55
|
+
|
|
56
|
+
if($desc.duration <= 0) {
|
|
57
|
+
return element;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let timer = null;
|
|
61
|
+
const initCloseCountdown = () => {
|
|
62
|
+
timer = setTimeout(() => instance.close(element), $desc.duration);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if($desc.pauseOnHover) {
|
|
66
|
+
element.nd
|
|
67
|
+
.onMouseEnter(() => clearTimeout(timer))
|
|
68
|
+
.onMouseLeave(initCloseCountdown);
|
|
69
|
+
}
|
|
70
|
+
initCloseCountdown();
|
|
71
|
+
return element;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const buildContent = ($desc, instance) => {
|
|
75
|
+
const body = [];
|
|
76
|
+
|
|
77
|
+
if($desc.title) {
|
|
78
|
+
body.push(Div({class: 'toast-title'}, $desc.title));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if($desc.content) {
|
|
82
|
+
body.push(Div({class: 'toast-content'}, $desc.content));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if($desc.actions?.length) {
|
|
86
|
+
const actions = $desc.actions.map((action) => {
|
|
87
|
+
return Button(action.label)
|
|
88
|
+
.ghost()
|
|
89
|
+
.variant(action.variant || $desc.type || null)
|
|
90
|
+
.small()
|
|
91
|
+
.nd.onClick(() => action.handler.call(this, ...arguments, instance));
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
body.push(Div({class: 'toast-footer'}, actions));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return Div({class: 'toast-body'}, body);
|
|
98
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--toast-width: 320px;
|
|
3
|
+
--toast-padding: var(--space-comfortable);
|
|
4
|
+
--toast-gap: var(--space-cozy);
|
|
5
|
+
--toast-radius: var(--radius-card);
|
|
6
|
+
--toast-font-size: var(--note-size);
|
|
7
|
+
--toast-title-size: var(--description-size);
|
|
8
|
+
--toast-title-weight: 600;
|
|
9
|
+
--toast-shadow: var(--shadow-lg);
|
|
10
|
+
--toast-container-gap: var(--space-cozy);
|
|
11
|
+
--toast-container-offset: var(--space-comfortable);
|
|
12
|
+
--toast-duration: 0.25s;
|
|
13
|
+
--close-btn-width: 25px;
|
|
14
|
+
--close-btn-height: 25px;
|
|
15
|
+
--close-btn-color: var(--white);
|
|
16
|
+
--close-btn-hover-color: var(--contrasted-red);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.toast-container {
|
|
20
|
+
position: fixed;
|
|
21
|
+
z-index: 9999;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: var(--toast-container-gap);
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
|
|
27
|
+
&.is-top-trailing {
|
|
28
|
+
top: var(--toast-container-offset);
|
|
29
|
+
right: var(--toast-container-offset);
|
|
30
|
+
align-items: flex-end;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.is-top-leading {
|
|
34
|
+
top: var(--toast-container-offset);
|
|
35
|
+
left: var(--toast-container-offset);
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.is-top-center {
|
|
40
|
+
top: var(--toast-container-offset);
|
|
41
|
+
left: 50%;
|
|
42
|
+
transform: translateX(-50%);
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.is-bottom-trailing {
|
|
47
|
+
bottom: var(--toast-container-offset);
|
|
48
|
+
right: var(--toast-container-offset);
|
|
49
|
+
align-items: flex-end;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.is-bottom-leading {
|
|
53
|
+
bottom: var(--toast-container-offset);
|
|
54
|
+
left: var(--toast-container-offset);
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.is-bottom-center {
|
|
59
|
+
bottom: var(--toast-container-offset);
|
|
60
|
+
left: 50%;
|
|
61
|
+
transform: translateX(-50%);
|
|
62
|
+
align-items: center;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.toast {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: flex-start;
|
|
69
|
+
gap: var(--toast-gap);
|
|
70
|
+
padding: var(--toast-padding);
|
|
71
|
+
border-radius: var(--toast-radius);
|
|
72
|
+
font-size: var(--toast-font-size);
|
|
73
|
+
width: var(--toast-width);
|
|
74
|
+
box-shadow: var(--toast-shadow);
|
|
75
|
+
pointer-events: all;
|
|
76
|
+
background: var(--background);
|
|
77
|
+
border: 1px solid var(--gray-lite-3);
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
animation: toast-in var(--toast-duration) ease forwards;
|
|
80
|
+
|
|
81
|
+
&.is-info {
|
|
82
|
+
border-left: 3px solid var(--color-info);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&.is-success {
|
|
86
|
+
border-left: 3px solid var(--color-success);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.is-warning {
|
|
90
|
+
border-left: 3px solid var(--color-warning);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.is-error,
|
|
94
|
+
&.is-danger {
|
|
95
|
+
border-left: 3px solid var(--color-danger);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&.is-hiding {
|
|
99
|
+
animation: toast-out var(--toast-duration) ease forwards;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.toast-icon {
|
|
104
|
+
flex-shrink: 0;
|
|
105
|
+
margin-top: 1px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.toast-body {
|
|
109
|
+
flex: 1;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
gap: var(--space-tiny);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.toast-title {
|
|
116
|
+
font-size: var(--toast-title-size);
|
|
117
|
+
font-weight: var(--toast-title-weight);
|
|
118
|
+
line-height: 1.3;
|
|
119
|
+
color: var(--text-color);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.toast-content {
|
|
123
|
+
line-height: 1.6;
|
|
124
|
+
color: var(--gray);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.toast-footer {
|
|
128
|
+
display: flex;
|
|
129
|
+
gap: var(--space-cozy);
|
|
130
|
+
margin-top: var(--space-cozy);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.toast-close {
|
|
134
|
+
--btn-color-ghost-text: var(--close-btn-color);
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
opacity: 0.5;
|
|
141
|
+
background: none;
|
|
142
|
+
border: none;
|
|
143
|
+
padding: 0;
|
|
144
|
+
font-size: var(--text-size);
|
|
145
|
+
width: var(--close-btn-width);
|
|
146
|
+
height: var(--close-btn-height);
|
|
147
|
+
border-radius: 50%;
|
|
148
|
+
|
|
149
|
+
&:hover {
|
|
150
|
+
--btn-color-ghost-text: var(--close-btn-hover-color);
|
|
151
|
+
opacity: 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
.toast-progress {
|
|
157
|
+
position: absolute;
|
|
158
|
+
bottom: 0;
|
|
159
|
+
left: 0;
|
|
160
|
+
height: 3px;
|
|
161
|
+
border-radius: 0 0 var(--toast-radius) var(--toast-radius);
|
|
162
|
+
|
|
163
|
+
&.is-info {
|
|
164
|
+
background: var(--color-info);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&.is-success {
|
|
168
|
+
background: var(--color-success);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&.is-warning {
|
|
172
|
+
background: var(--color-warning);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&.is-error,
|
|
176
|
+
&.is-danger {
|
|
177
|
+
background: var(--color-danger);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@keyframes toast-in {
|
|
182
|
+
from {
|
|
183
|
+
opacity: 0;
|
|
184
|
+
transform: translateY(-8px);
|
|
185
|
+
}
|
|
186
|
+
to {
|
|
187
|
+
opacity: 1;
|
|
188
|
+
transform: translateY(0);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@keyframes toast-out {
|
|
193
|
+
from {
|
|
194
|
+
opacity: 1;
|
|
195
|
+
transform: translateY(0);
|
|
196
|
+
}
|
|
197
|
+
to {
|
|
198
|
+
opacity: 0;
|
|
199
|
+
transform: translateY(-8px);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tooltip-bg: #1a1a2e;
|
|
3
|
+
--tooltip-color: var(--white);
|
|
4
|
+
--tooltip-border: transparent;
|
|
5
|
+
--tooltip-radius: var(--radius-button);
|
|
6
|
+
--tooltip-shadow: var(--shadow-lg);
|
|
7
|
+
--tooltip-padding: var(--space-cozy) var(--space-cozy-comfortable);
|
|
8
|
+
--tooltip-min-width: 0;
|
|
9
|
+
--tooltip-max-width: 280px;
|
|
10
|
+
--tooltip-z-index: 100001;
|
|
11
|
+
--tooltip-font-size: var(--note-size);
|
|
12
|
+
--tooltip-arrow-size: 6px;
|
|
13
|
+
--tooltip-animation-duration: 0.12s;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.tooltip {
|
|
17
|
+
position: absolute;
|
|
18
|
+
z-index: var(--tooltip-z-index);
|
|
19
|
+
background: var(--tooltip-bg);
|
|
20
|
+
color: var(--tooltip-color);
|
|
21
|
+
border: 1px solid var(--tooltip-border);
|
|
22
|
+
border-radius: var(--tooltip-radius);
|
|
23
|
+
box-shadow: var(--tooltip-shadow);
|
|
24
|
+
min-width: var(--tooltip-min-width);
|
|
25
|
+
max-width: var(--tooltip-max-width);
|
|
26
|
+
font-size: var(--tooltip-font-size);
|
|
27
|
+
padding: var(--tooltip-padding);
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
margin: 0;
|
|
30
|
+
inset: unset;
|
|
31
|
+
overflow: initial;
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
|
|
35
|
+
&.is-primary {
|
|
36
|
+
--tooltip-bg: var(--color-primary);
|
|
37
|
+
--tooltip-border: var(--color-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.is-success {
|
|
41
|
+
--tooltip-bg: var(--color-success);
|
|
42
|
+
--tooltip-border: var(--color-success);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.is-warning {
|
|
46
|
+
--tooltip-bg: var(--color-warning);
|
|
47
|
+
--tooltip-border: var(--color-warning);
|
|
48
|
+
--tooltip-color: var(--gray-dark);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.is-danger {
|
|
52
|
+
--tooltip-bg: var(--color-danger);
|
|
53
|
+
--tooltip-border: var(--color-danger);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.is-info {
|
|
57
|
+
--tooltip-bg: var(--color-info);
|
|
58
|
+
--tooltip-border: var(--color-info);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:popover-open {
|
|
62
|
+
animation: tooltip-in var(--tooltip-animation-duration) ease forwards;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.tooltip-arrow {
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: var(--tooltip-arrow-size);
|
|
69
|
+
height: var(--tooltip-arrow-size);
|
|
70
|
+
background: var(--tooltip-bg);
|
|
71
|
+
transform: rotate(45deg);
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
z-index: -1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tooltip[data-placement^='top'] {
|
|
77
|
+
.tooltip-arrow {
|
|
78
|
+
border-top: none;
|
|
79
|
+
border-left: none;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.tooltip[data-placement^='bottom'] {
|
|
84
|
+
.tooltip-arrow {
|
|
85
|
+
border-bottom: none;
|
|
86
|
+
border-right: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.tooltip[data-placement^='left'] {
|
|
91
|
+
.tooltip-arrow {
|
|
92
|
+
border-left: none;
|
|
93
|
+
border-bottom: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.tooltip[data-placement^='right'] {
|
|
98
|
+
.tooltip-arrow {
|
|
99
|
+
border-right: none;
|
|
100
|
+
border-top: none;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes tooltip-in {
|
|
105
|
+
from {
|
|
106
|
+
opacity: 0;
|
|
107
|
+
transform: scale(0.95);
|
|
108
|
+
}
|
|
109
|
+
to {
|
|
110
|
+
opacity: 1;
|
|
111
|
+
transform: scale(1);
|
|
112
|
+
}
|
|
113
|
+
}
|