@zeyos/zx 2.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +138 -0
- package/DESIGN-SYSTEM.md +96 -0
- package/README.md +29 -39
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +243 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/card/card.d.ts +128 -0
- package/dist/types/components/chart/chart.d.ts +322 -0
- package/dist/types/components/date-picker/month-picker.d.ts +6 -0
- package/dist/types/components/dialog/dialog.d.ts +9 -0
- package/dist/types/components/dock/dock.d.ts +495 -0
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +14 -0
- package/dist/types/components/field-upload/field-upload.d.ts +37 -4
- package/dist/types/components/form/form.d.ts +25 -3
- package/dist/types/components/grid/grid.d.ts +172 -0
- package/dist/types/components/launcher/launcher.d.ts +359 -0
- package/dist/types/components/layout/layout.d.ts +4 -4
- package/dist/types/components/menu-button/menu-button.d.ts +10 -2
- package/dist/types/components/modal/modal.d.ts +25 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +7 -1
- package/dist/types/components/questionnaire/items.d.ts +327 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
- package/dist/types/components/select/select.d.ts +51 -0
- package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
- package/dist/types/components/sheet/sheet.d.ts +294 -0
- package/dist/types/components/split-view/split-view.d.ts +2 -21
- package/dist/types/components/table/table.d.ts +223 -15
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/value-list/value-list.d.ts +24 -3
- package/dist/types/core/dom.d.ts +122 -0
- package/dist/types/core/drag-axis.d.ts +111 -0
- package/dist/types/core/position.d.ts +4 -2
- package/dist/types/index.d.ts +13 -2
- package/dist/types/internal/app-rail.d.ts +265 -0
- package/dist/types/zeyos/icons.d.ts +5 -0
- package/dist/types/zeyos/index.d.ts +2 -1
- package/dist/types/zeyos/launcher.d.ts +147 -0
- package/dist/types/zeyos/select.d.ts +39 -0
- package/dist/zx-zeyos.esm.js +1870 -133
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2006 -267
- package/dist/zx.esm.js +8987 -2757
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8987 -2757
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +4396 -2344
- package/docs/llms.md +463 -86
- package/docs/llms.txt +32 -19
- package/package.json +10 -17
- package/src/components/account-menu/account-menu.css +70 -0
- package/src/components/account-menu/account-menu.js +208 -0
- package/src/components/app-rail/app-rail.css +107 -0
- package/src/components/app-sidebar/app-sidebar.css +80 -0
- package/src/components/app-sidebar/app-sidebar.js +588 -0
- package/src/components/avatar/avatar.css +61 -0
- package/src/components/avatar/avatar.js +222 -0
- package/src/components/button/button.css +0 -1
- package/src/components/card/card.css +149 -0
- package/src/components/card/card.js +285 -0
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +523 -0
- package/src/components/date-picker/month-picker.js +9 -0
- package/src/components/dialog/dialog.js +11 -4
- package/src/components/dock/dock.css +228 -0
- package/src/components/dock/dock.js +977 -0
- package/src/components/dropdown/dropdown.js +1 -1
- package/src/components/field/field.js +2 -0
- package/src/components/field-upload/field-upload.js +9 -4
- package/src/components/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +220 -0
- package/src/components/launcher/launcher.css +210 -0
- package/src/components/launcher/launcher.js +765 -0
- package/src/components/layout/layout.js +2 -2
- package/src/components/menu-button/menu-button.js +27 -2
- package/src/components/modal/modal.css +5 -1
- package/src/components/modal/modal.js +37 -2
- package/src/components/multi-value-editor/multi-value-editor.js +2 -1
- package/src/components/questionnaire/items.js +370 -0
- package/src/components/questionnaire/questionnaire.css +387 -0
- package/src/components/questionnaire/questionnaire.js +1033 -0
- package/src/components/select/field-adapter.js +9 -4
- package/src/components/select/select.css +144 -11
- package/src/components/select/select.js +259 -27
- package/src/components/sheet/sheet-stack.js +304 -0
- package/src/components/sheet/sheet.css +351 -0
- package/src/components/sheet/sheet.js +551 -0
- package/src/components/split-view/split-view.js +76 -161
- package/src/components/table/table.css +43 -0
- package/src/components/table/table.js +531 -52
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +322 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +20 -2
- package/src/internal/app-rail.js +718 -0
- package/src/zeyos/icons.js +8 -3
- package/src/zeyos/index.js +7 -1
- package/src/zeyos/launcher.js +338 -0
- package/src/zeyos/modules.js +1 -0
- package/src/zeyos/select.js +115 -1
- package/styles/tokens/dark.css +2 -3
- package/styles/tokens/global.css +6 -6
- package/styles/tokens/modules.css +1 -0
- package/styles/tokens/semantic.css +5 -3
- package/styles/tokens/themes.css +1 -1
- package/styles/zx.css +11 -1
- package/MIGRATION.md +0 -598
- package/dist/types/compat/base.d.ts +0 -156
- package/dist/types/compat/globals.d.ts +0 -20
- package/dist/types/compat/index.d.ts +0 -128
- package/dist/types/compat/map/basic.d.ts +0 -175
- package/dist/types/compat/map/data.d.ts +0 -102
- package/dist/types/compat/map/date-time.d.ts +0 -80
- package/dist/types/compat/map/factory.d.ts +0 -9
- package/dist/types/compat/map/form.d.ts +0 -98
- package/dist/types/compat/map/helpers.d.ts +0 -12
- package/dist/types/compat/map/http.d.ts +0 -36
- package/dist/types/compat/map/layout.d.ts +0 -106
- package/dist/types/compat/map/options.d.ts +0 -80
- package/dist/types/compat/map/select.d.ts +0 -95
- package/dist/types/compat/map/stubs.d.ts +0 -32
- package/dist/types/compat/map/utilities.d.ts +0 -37
- package/dist/types/compat-entry.d.ts +0 -5
- package/dist/types/components/permission/permission.d.ts +0 -96
- package/dist/zx-compat.esm.js +0 -17484
- package/dist/zx-compat.esm.min.js +0 -1
- package/dist/zx-compat.global.js +0 -23635
- package/dist/zx-compat.global.min.js +0 -3
- package/src/compat/base.js +0 -291
- package/src/compat/globals.js +0 -165
- package/src/compat/index.js +0 -84
- package/src/compat/map/basic.js +0 -464
- package/src/compat/map/data.js +0 -232
- package/src/compat/map/date-time.js +0 -177
- package/src/compat/map/factory.js +0 -45
- package/src/compat/map/form.js +0 -330
- package/src/compat/map/helpers.js +0 -46
- package/src/compat/map/http.js +0 -117
- package/src/compat/map/layout.js +0 -256
- package/src/compat/map/options.js +0 -267
- package/src/compat/map/select.js +0 -198
- package/src/compat/map/stubs.js +0 -26
- package/src/compat/map/utilities.js +0 -113
- package/src/compat-entry.js +0 -11
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -201
package/src/core/position.js
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
import { clamp, uid } from './util.js';
|
|
3
3
|
|
|
4
4
|
const PLACEMENTS = new Set([
|
|
5
|
-
'bottom-start', 'bottom-end', 'top-start', 'top-end', 'bottom', 'top'
|
|
5
|
+
'bottom-start', 'bottom-end', 'top-start', 'top-end', 'bottom', 'top',
|
|
6
|
+
'right-start', 'right-end', 'left-start', 'left-end', 'right', 'left'
|
|
6
7
|
]);
|
|
7
8
|
|
|
9
|
+
/** @typedef {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'|'right-start'|'right-end'|'left-start'|'left-end'|'right'|'left'} Placement */
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* @typedef {Object} PositionOptions
|
|
10
|
-
* @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'} [placement='bottom-start']
|
|
13
|
+
* @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'|'right-start'|'right-end'|'left-start'|'left-end'|'right'|'left'} [placement='bottom-start']
|
|
11
14
|
* @property {number} [offset=4] Gap between anchor and floating element.
|
|
12
15
|
* @property {boolean} [flip=true] Flip vertically when the preferred side overflows.
|
|
13
16
|
* @property {boolean} [matchWidth=false] Set the floating element's minimum width to the anchor width.
|
|
@@ -50,13 +53,17 @@ export function position(anchor, floating, options = {}) {
|
|
|
50
53
|
floating.style.inset = 'auto';
|
|
51
54
|
floating.style.margin = '0';
|
|
52
55
|
floating.style.setProperty('position-anchor', anchorName);
|
|
53
|
-
|
|
54
|
-
floating.style.setProperty('
|
|
56
|
+
const area = positionArea(placement, getComputedStyle(anchor).direction === 'rtl');
|
|
57
|
+
floating.style.setProperty('position-area', area);
|
|
58
|
+
floating.style.setProperty('inset-area', area);
|
|
55
59
|
floating.style.setProperty(
|
|
56
60
|
'position-try-fallbacks',
|
|
57
61
|
flip ? 'flip-block, flip-inline, flip-block flip-inline' : 'none'
|
|
58
62
|
);
|
|
59
|
-
|
|
63
|
+
const margin = placement.startsWith('top') ? 'margin-bottom'
|
|
64
|
+
: placement.startsWith('bottom') ? 'margin-top'
|
|
65
|
+
: placement.startsWith('left') ? 'margin-right' : 'margin-left';
|
|
66
|
+
floating.style.setProperty(margin, `${offset}px`);
|
|
60
67
|
update = () => {
|
|
61
68
|
if (matchWidth) floating.style.minWidth = `${anchor.getBoundingClientRect().width}px`;
|
|
62
69
|
};
|
|
@@ -104,15 +111,21 @@ export function position(anchor, floating, options = {}) {
|
|
|
104
111
|
};
|
|
105
112
|
}
|
|
106
113
|
|
|
107
|
-
/** @param {string} placement @returns {string} */
|
|
108
|
-
function positionArea(placement) {
|
|
114
|
+
/** @param {string} placement @param {boolean} rtl @returns {string} */
|
|
115
|
+
function positionArea(placement, rtl) {
|
|
109
116
|
return {
|
|
110
|
-
'bottom-start': '
|
|
111
|
-
'bottom-end': '
|
|
112
|
-
'top-start': '
|
|
113
|
-
'top-end': '
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
'bottom-start': rtl ? 'bottom span-left' : 'bottom span-right',
|
|
118
|
+
'bottom-end': rtl ? 'bottom span-right' : 'bottom span-left',
|
|
119
|
+
'top-start': rtl ? 'top span-left' : 'top span-right',
|
|
120
|
+
'top-end': rtl ? 'top span-right' : 'top span-left',
|
|
121
|
+
'right-start': 'right span-bottom',
|
|
122
|
+
'right-end': 'right span-top',
|
|
123
|
+
'left-start': 'left span-bottom',
|
|
124
|
+
'left-end': 'left span-top',
|
|
125
|
+
bottom: 'bottom',
|
|
126
|
+
top: 'top',
|
|
127
|
+
right: 'right',
|
|
128
|
+
left: 'left'
|
|
116
129
|
}[placement];
|
|
117
130
|
}
|
|
118
131
|
|
|
@@ -129,27 +142,60 @@ function updateFallback(anchor, floating, { placement, offset, flip, matchWidth
|
|
|
129
142
|
const viewportWidth = document.documentElement.clientWidth || window.innerWidth;
|
|
130
143
|
const viewportHeight = document.documentElement.clientHeight || window.innerHeight;
|
|
131
144
|
let actualPlacement = placement;
|
|
132
|
-
const
|
|
145
|
+
const side = placementSide(placement);
|
|
133
146
|
const bottomY = anchorRect.bottom + offset;
|
|
134
147
|
const topY = anchorRect.top - offset - floatingRect.height;
|
|
148
|
+
const rightX = anchorRect.right + offset;
|
|
149
|
+
const leftX = anchorRect.left - offset - floatingRect.width;
|
|
135
150
|
|
|
136
151
|
if (flip) {
|
|
137
|
-
if (
|
|
138
|
-
actualPlacement =
|
|
139
|
-
} else if (
|
|
140
|
-
actualPlacement =
|
|
152
|
+
if (side === 'bottom' && bottomY + floatingRect.height > viewportHeight && topY >= 0) {
|
|
153
|
+
actualPlacement = flipPlacement(placement, 'bottom', 'top');
|
|
154
|
+
} else if (side === 'top' && topY < 0 && bottomY + floatingRect.height <= viewportHeight) {
|
|
155
|
+
actualPlacement = flipPlacement(placement, 'top', 'bottom');
|
|
156
|
+
} else if (side === 'right' && rightX + floatingRect.width > viewportWidth && leftX >= 0) {
|
|
157
|
+
actualPlacement = flipPlacement(placement, 'right', 'left');
|
|
158
|
+
} else if (side === 'left' && leftX < 0 && rightX + floatingRect.width <= viewportWidth) {
|
|
159
|
+
actualPlacement = flipPlacement(placement, 'left', 'right');
|
|
141
160
|
}
|
|
142
161
|
}
|
|
143
162
|
|
|
163
|
+
const actualSide = placementSide(actualPlacement);
|
|
144
164
|
let left;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
165
|
+
let top;
|
|
166
|
+
if (actualSide === 'bottom' || actualSide === 'top') {
|
|
167
|
+
const rtl = getComputedStyle(anchor).direction === 'rtl';
|
|
168
|
+
if (actualPlacement.endsWith('-end')) {
|
|
169
|
+
left = rtl ? anchorRect.left : anchorRect.right - floatingRect.width;
|
|
170
|
+
} else if (actualPlacement.endsWith('-start')) {
|
|
171
|
+
left = rtl ? anchorRect.right - floatingRect.width : anchorRect.left;
|
|
172
|
+
} else left = anchorRect.left + (anchorRect.width - floatingRect.width) / 2;
|
|
173
|
+
top = actualSide === 'bottom' ? bottomY : topY;
|
|
174
|
+
} else {
|
|
175
|
+
left = actualSide === 'right' ? rightX : leftX;
|
|
176
|
+
if (actualPlacement.endsWith('-end')) top = anchorRect.bottom - floatingRect.height;
|
|
177
|
+
else if (actualPlacement.endsWith('-start')) top = anchorRect.top;
|
|
178
|
+
else top = anchorRect.top + (anchorRect.height - floatingRect.height) / 2;
|
|
179
|
+
}
|
|
149
180
|
floating.style.left = `${Math.round(clamp(left, 0, Math.max(0, viewportWidth - floatingRect.width)))}px`;
|
|
150
181
|
floating.style.top = `${Math.round(clamp(top, 0, Math.max(0, viewportHeight - floatingRect.height)))}px`;
|
|
151
182
|
}
|
|
152
183
|
|
|
184
|
+
/** @param {string} placement @returns {'top'|'bottom'|'left'|'right'} */
|
|
185
|
+
function placementSide(placement) {
|
|
186
|
+
return /** @type {'top'|'bottom'|'left'|'right'} */ (placement.split('-')[0]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @param {string} placement
|
|
191
|
+
* @param {'top'|'bottom'|'left'|'right'} from
|
|
192
|
+
* @param {'top'|'bottom'|'left'|'right'} to
|
|
193
|
+
* @returns {Placement}
|
|
194
|
+
*/
|
|
195
|
+
function flipPlacement(placement, from, to) {
|
|
196
|
+
return /** @type {Placement} */ (placement.replace(from, to));
|
|
197
|
+
}
|
|
198
|
+
|
|
153
199
|
/** @param {HTMLElement} element @returns {void} */
|
|
154
200
|
function showPopover(element) {
|
|
155
201
|
if (typeof element.showPopover !== 'function') return;
|
package/src/index.js
CHANGED
|
@@ -42,7 +42,12 @@ export function registerFieldAdapters() {
|
|
|
42
42
|
registerFieldAdapters();
|
|
43
43
|
|
|
44
44
|
export { Component } from './core/component.js';
|
|
45
|
-
export {
|
|
45
|
+
export {
|
|
46
|
+
h, htmlEscape, resolveElement, highlightMatch,
|
|
47
|
+
__, compactElement, fragment, parseCompactTag, applyCompactProperties,
|
|
48
|
+
appendContent, appendCompact, appendCompactChild,
|
|
49
|
+
onCompactEvent, offCompactEvent, fireCompactEvent
|
|
50
|
+
} from './core/dom.js';
|
|
46
51
|
export { position } from './core/position.js';
|
|
47
52
|
export { breakpoints, breakpointOf, matchBreakpoint, onBreakpoint } from './core/breakpoint.js';
|
|
48
53
|
export { Http, zeyosService, parseResult } from './core/http.js';
|
|
@@ -83,20 +88,29 @@ export { CopyInput } from './components/copy/copy-input.js';
|
|
|
83
88
|
export { Toolbar } from './components/toolbar/toolbar.js';
|
|
84
89
|
export { Toggle } from './components/toggle/toggle.js';
|
|
85
90
|
export { Groupbox } from './components/groupbox/groupbox.js';
|
|
91
|
+
export { Card } from './components/card/card.js';
|
|
86
92
|
export { Panel } from './components/panel/panel.js';
|
|
87
93
|
export { MasterPanel } from './components/master-panel/master-panel.js';
|
|
88
94
|
export {
|
|
89
95
|
SplitView, clampSize, resolveSize, snapSize
|
|
90
96
|
} from './components/split-view/split-view.js';
|
|
97
|
+
export { Dock } from './components/dock/dock.js';
|
|
91
98
|
export { Tabbox } from './components/tabbox/tabbox.js';
|
|
92
99
|
export { NavigationBar } from './components/navigation-bar/navigation-bar.js';
|
|
93
100
|
export { Stepper } from './components/stepper/stepper.js';
|
|
94
101
|
export { Breadcrumb } from './components/breadcrumb/breadcrumb.js';
|
|
95
102
|
export { Pagination, paginationRange } from './components/pagination/pagination.js';
|
|
96
103
|
export { Search } from './components/search/search.js';
|
|
104
|
+
export { Launcher, rankLauncherItems } from './components/launcher/launcher.js';
|
|
105
|
+
export { Avatar, avatarInitials } from './components/avatar/avatar.js';
|
|
106
|
+
export { AccountMenu } from './components/account-menu/account-menu.js';
|
|
107
|
+
export { normalizeAppItems } from './internal/app-rail.js';
|
|
108
|
+
export { AppSidebar } from './components/app-sidebar/app-sidebar.js';
|
|
97
109
|
export { Message } from './components/message/message.js';
|
|
98
110
|
export { Modal } from './components/modal/modal.js';
|
|
99
111
|
export { Dialog } from './components/dialog/dialog.js';
|
|
112
|
+
export { Sheet } from './components/sheet/sheet.js';
|
|
113
|
+
export { SheetStack } from './components/sheet/sheet-stack.js';
|
|
100
114
|
export { Dropdown } from './components/dropdown/dropdown.js';
|
|
101
115
|
export { Tooltip, tooltip, describe } from './components/tooltip/tooltip.js';
|
|
102
116
|
export { MenuButton } from './components/menu-button/menu-button.js';
|
|
@@ -107,7 +121,6 @@ export { TagPicker } from './components/tag-picker/tag-picker.js';
|
|
|
107
121
|
export { NumberField, parseNumber, snapNumber } from './components/number-field/number-field.js';
|
|
108
122
|
export { Rating } from './components/rating/rating.js';
|
|
109
123
|
export { Slider, stepPrecision } from './components/slider/slider.js';
|
|
110
|
-
export { Permission } from './components/permission/permission.js';
|
|
111
124
|
export { DatePicker } from './components/date-picker/date-picker.js';
|
|
112
125
|
export { MonthPicker } from './components/date-picker/month-picker.js';
|
|
113
126
|
export { TimePicker } from './components/date-picker/time-picker.js';
|
|
@@ -120,12 +133,17 @@ export {
|
|
|
120
133
|
} from './components/datebox/date-range-box.js';
|
|
121
134
|
export { Timebox, splitTime, joinTime } from './components/timebox/timebox.js';
|
|
122
135
|
export { Table } from './components/table/table.js';
|
|
136
|
+
export { Grid, billingColumns, isBillingLine } from './components/grid/grid.js';
|
|
137
|
+
export {
|
|
138
|
+
Chart, ChartJsAdapter, chartSummaryTable, cloneChartValue, isEmptyChartData
|
|
139
|
+
} from './components/chart/chart.js';
|
|
123
140
|
export { TreeView } from './components/tree/tree.js';
|
|
124
141
|
export { Finder } from './components/finder/finder.js';
|
|
125
142
|
export { DataFilter } from './components/data-filter/data-filter.js';
|
|
126
143
|
export { Field } from './components/field/field.js';
|
|
127
144
|
export { Fieldset } from './components/fieldset/fieldset.js';
|
|
128
145
|
export { Form } from './components/form/form.js';
|
|
146
|
+
export { Questionnaire } from './components/questionnaire/questionnaire.js';
|
|
129
147
|
export { ValueList } from './components/value-list/value-list.js';
|
|
130
148
|
export { MultiValueEditor } from './components/multi-value-editor/multi-value-editor.js';
|
|
131
149
|
export { FieldUpload } from './components/field-upload/field-upload.js';
|