@svgrid/grid 2.2.16 → 2.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/GridFooter.svelte +12 -11
- package/dist/SvAnchor.svelte +65 -0
- package/dist/SvAnchor.svelte.d.ts +24 -0
- package/dist/SvAspectRatio.svelte +38 -0
- package/dist/SvAspectRatio.svelte.d.ts +16 -0
- package/dist/SvAutoComplete.svelte +52 -7
- package/dist/SvAutoComplete.svelte.d.ts +4 -1
- package/dist/SvBlockquote.svelte +43 -0
- package/dist/SvBlockquote.svelte.d.ts +16 -0
- package/dist/SvCalendar.svelte +33 -2
- package/dist/SvCalendar.svelte.d.ts +8 -1
- package/dist/SvCheckBox.svelte +6 -2
- package/dist/SvCode.svelte +52 -0
- package/dist/SvCode.svelte.d.ts +19 -0
- package/dist/SvCollapsible.svelte +75 -0
- package/dist/SvCollapsible.svelte.d.ts +27 -0
- package/dist/SvColorInput.svelte +11 -17
- package/dist/SvColorInput.svelte.d.ts +2 -0
- package/dist/SvComboBox.svelte +85 -8
- package/dist/SvComboBox.svelte.d.ts +14 -0
- package/dist/SvCountryInput.svelte +2 -2
- package/dist/SvCountryInput.svelte.d.ts +1 -1
- package/dist/SvDropDownList.svelte +154 -51
- package/dist/SvDropDownList.svelte.d.ts +17 -3
- package/dist/SvDurationInput.svelte +59 -41
- package/dist/SvDurationInput.svelte.d.ts +18 -0
- package/dist/SvField.svelte +203 -12
- package/dist/SvField.svelte.d.ts +45 -8
- package/dist/SvForm.svelte +195 -21
- package/dist/SvForm.svelte.d.ts +23 -0
- package/dist/SvGrid.controller.svelte.d.ts +12 -1
- package/dist/SvGrid.controller.svelte.js +87 -7
- package/dist/SvGrid.svelte +383 -181
- package/dist/SvGrid.types.d.ts +123 -2
- package/dist/SvGridChartView.svelte +70 -0
- package/dist/SvGridChartView.svelte.d.ts +11 -0
- package/dist/SvGridDropdown.svelte +9 -2
- package/dist/SvGridSelect.svelte +5 -2
- package/dist/SvGridSelect.svelte.d.ts +1 -1
- package/dist/SvGroup.svelte +41 -0
- package/dist/SvGroup.svelte.d.ts +27 -0
- package/dist/SvHoverCard.svelte +70 -0
- package/dist/SvHoverCard.svelte.d.ts +41 -0
- package/dist/SvKbd.svelte +51 -0
- package/dist/SvKbd.svelte.d.ts +18 -0
- package/dist/SvList.svelte +55 -0
- package/dist/SvList.svelte.d.ts +23 -0
- package/dist/SvListBox.svelte +166 -77
- package/dist/SvListBox.svelte.d.ts +17 -4
- package/dist/SvLoadingOverlay.svelte +53 -0
- package/dist/SvLoadingOverlay.svelte.d.ts +28 -0
- package/dist/SvMark.svelte +36 -0
- package/dist/SvMark.svelte.d.ts +14 -0
- package/dist/SvMaskedInput.svelte +50 -35
- package/dist/SvMaskedInput.svelte.d.ts +17 -2
- package/dist/SvMenuList.svelte +32 -3
- package/dist/SvMenubar.svelte +200 -0
- package/dist/SvMenubar.svelte.d.ts +18 -0
- package/dist/SvMultiSelect.svelte +7 -4
- package/dist/SvMultiSelect.svelte.d.ts +1 -1
- package/dist/SvNumberInput.svelte +79 -42
- package/dist/SvNumberInput.svelte.d.ts +25 -0
- package/dist/SvOtpInput.svelte +2 -2
- package/dist/SvPasswordInput.svelte +51 -31
- package/dist/SvPasswordInput.svelte.d.ts +17 -0
- package/dist/SvPhoneInput.svelte +39 -28
- package/dist/SvPhoneInput.svelte.d.ts +4 -0
- package/dist/SvPopconfirm.svelte +79 -0
- package/dist/SvPopconfirm.svelte.d.ts +42 -0
- package/dist/SvPopover.svelte +87 -29
- package/dist/SvPopover.svelte.d.ts +18 -4
- package/dist/SvRadioGroup.svelte +5 -1
- package/dist/SvResult.svelte +73 -0
- package/dist/SvResult.svelte.d.ts +28 -0
- package/dist/SvSegmented.svelte +114 -0
- package/dist/SvSegmented.svelte.d.ts +29 -0
- package/dist/SvSimpleGrid.svelte +41 -0
- package/dist/SvSimpleGrid.svelte.d.ts +25 -0
- package/dist/SvSlider.svelte +23 -10
- package/dist/SvSpinner.svelte +43 -0
- package/dist/SvSpinner.svelte.d.ts +20 -0
- package/dist/SvStack.svelte +37 -0
- package/dist/SvStack.svelte.d.ts +24 -0
- package/dist/SvSwitchButton.svelte +6 -1
- package/dist/SvTagsInput.svelte +9 -5
- package/dist/SvText.svelte +76 -0
- package/dist/SvText.svelte.d.ts +31 -0
- package/dist/SvTextInput.svelte +75 -43
- package/dist/SvTextInput.svelte.d.ts +28 -1
- package/dist/SvTimePicker.svelte +32 -2
- package/dist/SvTimePicker.svelte.d.ts +8 -9
- package/dist/SvTitle.svelte +57 -0
- package/dist/SvTitle.svelte.d.ts +24 -0
- package/dist/SvToaster.svelte +41 -6
- package/dist/SvToggleButton.svelte +4 -1
- package/dist/SvTooltip.svelte +68 -34
- package/dist/SvTooltip.svelte.d.ts +14 -2
- package/dist/SvTree.svelte +81 -21
- package/dist/SvTree.svelte.d.ts +3 -2
- package/dist/SvTreeSelect.svelte +5 -2
- package/dist/SvTreeSelect.svelte.d.ts +1 -1
- package/dist/SvVisuallyHidden.svelte +49 -0
- package/dist/SvVisuallyHidden.svelte.d.ts +19 -0
- package/dist/ai.d.ts +289 -0
- package/dist/ai.js +1013 -0
- package/dist/board-view.svelte.d.ts +22 -0
- package/dist/board-view.svelte.js +13 -0
- package/dist/build-api.js +36 -6
- package/dist/cdn/GridMenus-0AK9O7qG.js +420 -0
- package/dist/cdn/GridMenus-BjUoCXoD.js +416 -0
- package/dist/cdn/SvDateTimePicker-CYC7gRER.js +2176 -0
- package/dist/cdn/SvDateTimePicker-DtQKd4Ns.js +2198 -0
- package/dist/cdn/SvGridChart-BcLCYvw9.js +1195 -0
- package/dist/cdn/SvGridChart-BhnFdLd0.js +1203 -0
- package/dist/cdn/SvGridChartPanel-Cmx9DHAS.js +561 -0
- package/dist/cdn/SvGridChartPanel-DvjwxLvK.js +577 -0
- package/dist/cdn/SvGridChartView-B40DTJSX.js +54 -0
- package/dist/cdn/SvGridChartView-PwqI4s02.js +53 -0
- package/dist/cdn/SvGridDropdown-DjALc_4f.js +255 -0
- package/dist/cdn/SvGridDropdown-hpnHvOGt.js +254 -0
- package/dist/cdn/chart-T1usDN0o.js +1212 -0
- package/dist/cdn/disclose-version-DoD9AFD_.js +2958 -0
- package/dist/cdn/export-format-JT5pWVT8.js +561 -0
- package/dist/cdn/popover-P-9P2YYn.js +69 -0
- package/dist/cdn/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/cdn/src-BLhdLmoN.js +25707 -0
- package/dist/cdn/src-BwnUVj3T.js +25623 -0
- package/dist/cdn/svgrid.js +9 -32897
- package/dist/cdn/svgrid.svelte-external.js +9 -30052
- package/dist/cell-formatting.d.ts +2 -2
- package/dist/cell-render.js +4 -4
- package/dist/chart-view.svelte.d.ts +25 -0
- package/dist/chart-view.svelte.js +14 -0
- package/dist/createCombobox.svelte.d.ts +5 -0
- package/dist/createCombobox.svelte.js +21 -5
- package/dist/createDropdownList.svelte.d.ts +3 -0
- package/dist/createDropdownList.svelte.js +8 -2
- package/dist/createForm.svelte.d.ts +18 -0
- package/dist/createForm.svelte.js +51 -6
- package/dist/createMenu.svelte.js +27 -0
- package/dist/createPopoverSelect.svelte.d.ts +3 -0
- package/dist/createPopoverSelect.svelte.js +9 -1
- package/dist/createSlider.svelte.d.ts +8 -21
- package/dist/createSlider.svelte.js +34 -0
- package/dist/createTooltip.svelte.d.ts +12 -0
- package/dist/createTooltip.svelte.js +72 -9
- package/dist/editor-contract.d.ts +15 -0
- package/dist/export-provider.d.ts +27 -0
- package/dist/export-provider.js +9 -0
- package/dist/filter-operators.d.ts +6 -0
- package/dist/filter-operators.js +33 -0
- package/dist/form-field.d.ts +45 -2
- package/dist/grid-messages.d.ts +61 -0
- package/dist/grid-messages.js +72 -0
- package/dist/group-display.d.ts +62 -0
- package/dist/group-display.js +78 -0
- package/dist/index.d.ts +36 -4
- package/dist/index.js +43 -2
- package/dist/js-scroller.svelte.d.ts +35 -0
- package/dist/js-scroller.svelte.js +154 -0
- package/dist/list-option.d.ts +46 -0
- package/dist/list-option.js +53 -0
- package/dist/menus.js +25 -11
- package/dist/pivot-view.svelte.d.ts +72 -0
- package/dist/pivot-view.svelte.js +13 -0
- package/dist/positioning.d.ts +111 -0
- package/dist/positioning.js +191 -0
- package/dist/scheduler-model.d.ts +3 -0
- package/dist/scheduler-model.js +22 -5
- package/dist/svgrid-wrapper.types.d.ts +18 -0
- package/dist/toast-store.svelte.d.ts +54 -0
- package/dist/toast-store.svelte.js +65 -15
- package/package.json +9 -1
- package/src/GridFooter.svelte +12 -11
- package/src/SvAnchor.svelte +65 -0
- package/src/SvAspectRatio.svelte +38 -0
- package/src/SvAutoComplete.svelte +52 -7
- package/src/SvBlockquote.svelte +43 -0
- package/src/SvCalendar.svelte +33 -2
- package/src/SvCalendar.test.ts +15 -0
- package/src/SvCheckBox.svelte +6 -2
- package/src/SvCode.svelte +52 -0
- package/src/SvCollapsible.svelte +75 -0
- package/src/SvColorInput.svelte +11 -17
- package/src/SvComboBox.svelte +85 -8
- package/src/SvCountryInput.svelte +2 -2
- package/src/SvDropDownList.svelte +154 -51
- package/src/SvDurationInput.svelte +59 -41
- package/src/SvField.svelte +203 -12
- package/src/SvForm.svelte +195 -21
- package/src/SvForm.test.ts +112 -0
- package/src/SvGrid.controller.svelte.ts +88 -7
- package/src/SvGrid.svelte +383 -181
- package/src/SvGrid.types.ts +125 -1
- package/src/SvGridChartView.svelte +70 -0
- package/src/SvGridDropdown.svelte +9 -2
- package/src/SvGridSelect.svelte +5 -2
- package/src/SvGroup.svelte +41 -0
- package/src/SvHoverCard.svelte +70 -0
- package/src/SvKbd.svelte +51 -0
- package/src/SvList.svelte +55 -0
- package/src/SvListBox.svelte +166 -77
- package/src/SvLoadingOverlay.svelte +53 -0
- package/src/SvMark.svelte +36 -0
- package/src/SvMaskedInput.svelte +50 -35
- package/src/SvMenuList.svelte +32 -3
- package/src/SvMenubar.svelte +200 -0
- package/src/SvMultiSelect.svelte +7 -4
- package/src/SvNumberInput.svelte +79 -42
- package/src/SvOtpInput.svelte +2 -2
- package/src/SvPasswordInput.svelte +51 -31
- package/src/SvPhoneInput.svelte +39 -28
- package/src/SvPopconfirm.svelte +79 -0
- package/src/SvPopover.svelte +87 -29
- package/src/SvRadioGroup.svelte +5 -1
- package/src/SvResult.svelte +73 -0
- package/src/SvSegmented.svelte +114 -0
- package/src/SvSimpleGrid.svelte +41 -0
- package/src/SvSlider.svelte +23 -10
- package/src/SvSpinner.svelte +43 -0
- package/src/SvStack.svelte +37 -0
- package/src/SvSwitchButton.svelte +6 -1
- package/src/SvTagsInput.svelte +9 -5
- package/src/SvText.svelte +76 -0
- package/src/SvTextInput.svelte +75 -43
- package/src/SvTimePicker.svelte +32 -2
- package/src/SvTitle.svelte +57 -0
- package/src/SvToaster.svelte +41 -6
- package/src/SvToaster.test.ts +32 -0
- package/src/SvToggleButton.svelte +4 -1
- package/src/SvTooltip.svelte +68 -34
- package/src/SvTree.svelte +81 -21
- package/src/SvTreeSelect.svelte +5 -2
- package/src/SvVisuallyHidden.svelte +49 -0
- package/src/ai.test.ts +502 -0
- package/src/ai.ts +1391 -0
- package/src/board-view.svelte.ts +33 -0
- package/src/build-api.coverage.test.ts +101 -0
- package/src/build-api.ts +43 -18
- package/src/builtin-editors.grid.test.ts +1 -1
- package/src/cell-formatting.ts +5 -5
- package/src/cell-render.ts +4 -4
- package/src/chart-view.svelte.ts +36 -0
- package/src/createCombobox.svelte.ts +17 -5
- package/src/createDropdownList.svelte.ts +8 -2
- package/src/createForm.svelte.ts +59 -6
- package/src/createMenu.svelte.ts +23 -0
- package/src/createPopoverSelect.svelte.ts +8 -1
- package/src/createSlider.svelte.ts +20 -0
- package/src/createTooltip.svelte.ts +67 -9
- package/src/editor-contract.ts +16 -0
- package/src/export-provider.ts +40 -0
- package/src/filter-operators.ts +37 -0
- package/src/form-field.ts +42 -2
- package/src/grid-messages.test.ts +24 -0
- package/src/grid-messages.ts +137 -0
- package/src/group-display.test.ts +77 -0
- package/src/group-display.ts +117 -0
- package/src/i18n.grid.test.ts +73 -0
- package/src/index.ts +91 -2
- package/src/js-scroller.svelte.ts +173 -0
- package/src/list-option.test.ts +56 -0
- package/src/list-option.ts +81 -0
- package/src/menus.test.ts +32 -0
- package/src/menus.ts +25 -12
- package/src/pivot-view.svelte.ts +90 -0
- package/src/pivot-view.test.ts +38 -0
- package/src/pivot.grid.test.ts +102 -0
- package/src/positioning.test.ts +141 -0
- package/src/positioning.ts +266 -0
- package/src/scheduler-model.test.ts +16 -0
- package/src/scheduler-model.ts +24 -5
- package/src/svgrid-wrapper.types.ts +23 -0
- package/src/svgrid.charting.test.ts +8 -1
- package/src/svgrid.comments-autocomplete.test.ts +7 -2
- package/src/svgrid.context-menu.test.ts +8 -3
- package/src/toast-store.svelte.ts +98 -0
- package/src/toast-store.test.ts +62 -1
- package/src/ui-breadth.test.ts +138 -0
- package/src/ui-buttons.test.ts +39 -0
- package/src/ui-inputs.test.ts +2 -2
- package/src/ui-range.test.ts +9 -0
- package/src/ui-selection.test.ts +36 -0
- package/src/ui-tier1.test.ts +1 -1
- package/src/virtual.test.ts +20 -6
- package/dist/SvGridBoard.svelte +0 -2339
- package/dist/SvGridBoard.svelte.d.ts +0 -31
- package/src/SvGridBoard.svelte +0 -2339
- package/src/board.test.ts +0 -927
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { F as e, G as t, L as n, a as r, at as i, et as a, it as o, k as s, lt as c, pt as l, st as u, ut as d, x as f } from "./disclose-version-DoD9AFD_.js";
|
|
2
|
+
import { f as p } from "./chart-T1usDN0o.js";
|
|
3
|
+
import { t as m } from "./SvGridChart-BcLCYvw9.js";
|
|
4
|
+
//#region src/SvGridChartView.svelte
|
|
5
|
+
var h = n("<div class=\"sv-grid-chart-view svelte-10run6t\"><!></div>"), g = {
|
|
6
|
+
hash: "svelte-10run6t",
|
|
7
|
+
code: ".sv-grid-chart-view.svelte-10run6t {width:100%;height:100%;min-height:0;box-sizing:border-box;}"
|
|
8
|
+
};
|
|
9
|
+
function _(n, _) {
|
|
10
|
+
d(_, !0), f(n, g);
|
|
11
|
+
let v = i(0), y = i(0), b = u(() => {
|
|
12
|
+
let e = p(_.data ?? [], {
|
|
13
|
+
type: _.chart.type ?? "bar",
|
|
14
|
+
category: _.chart.category,
|
|
15
|
+
value: _.chart.value,
|
|
16
|
+
series: _.chart.series,
|
|
17
|
+
reduce: _.chart.reduce,
|
|
18
|
+
stacked: _.chart.stacked,
|
|
19
|
+
stacked100: _.chart.stacked100,
|
|
20
|
+
sort: _.chart.sort,
|
|
21
|
+
topN: _.chart.topN,
|
|
22
|
+
palette: _.chart.palette
|
|
23
|
+
});
|
|
24
|
+
return _.chart.valueFormat && (e.valueFormat = _.chart.valueFormat), e;
|
|
25
|
+
});
|
|
26
|
+
var x = h(), S = a(x), C = (e) => {
|
|
27
|
+
{
|
|
28
|
+
let n = u(() => _.chart.legend ?? !0), r = u(() => _.chart.dataLabels ?? !1);
|
|
29
|
+
m(e, {
|
|
30
|
+
get spec() {
|
|
31
|
+
return t(b);
|
|
32
|
+
},
|
|
33
|
+
get width() {
|
|
34
|
+
return t(v);
|
|
35
|
+
},
|
|
36
|
+
get height() {
|
|
37
|
+
return t(y);
|
|
38
|
+
},
|
|
39
|
+
get legend() {
|
|
40
|
+
return t(n);
|
|
41
|
+
},
|
|
42
|
+
get dataLabels() {
|
|
43
|
+
return t(r);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
s(S, (e) => {
|
|
49
|
+
t(v) > 0 && t(y) > 0 && e(C);
|
|
50
|
+
}), l(x), r(x, "clientWidth", (e) => o(v, e)), r(x, "clientHeight", (e) => o(y, e)), e(n, x), c();
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { _ as default };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { i as t, n, r } from "./popover-P-9P2YYn.js";
|
|
3
|
+
import * as i from "svelte/internal/client";
|
|
4
|
+
import "svelte/internal/disclose-version";
|
|
5
|
+
//#region src/SvGridDropdown.svelte
|
|
6
|
+
var a = /* @__PURE__ */ e({ default: () => b }), o = i.from_html("<span class=\"sv-grid-chip sv-grid-chip-removable svelte-ei8hp3\"> <span class=\"sv-grid-chip-remove svelte-ei8hp3\" role=\"button\">×</span></span>"), s = i.from_html("<span class=\"sv-grid-dropdown-chips svelte-ei8hp3\"></span>"), c = i.from_html("<span class=\"sv-grid-chip svelte-ei8hp3\"> </span>"), l = i.from_html("<span class=\"sv-grid-dropdown-label svelte-ei8hp3\"> </span>"), u = i.from_html("<input type=\"search\" class=\"sv-grid-dropdown-search\" placeholder=\"Search…\"/>"), d = i.from_html("<div class=\"sv-grid-dropdown-empty\"> </div>"), f = i.from_html("<span class=\"sv-grid-dropdown-check\" aria-hidden=\"true\"> </span>"), p = i.from_html("<span class=\"sv-grid-dropdown-option-chip\"> </span>"), m = i.from_html("<span class=\"sv-grid-dropdown-option-label\"> </span>"), h = i.from_html("<div role=\"option\"><!> <!></div>"), g = i.from_html("<div class=\"sv-grid-dropdown-footer\"><button type=\"button\" class=\"sv-grid-dropdown-done\">Done</button></div>"), _ = i.from_html("<div role=\"listbox\"><!> <!> <!></div>"), v = i.from_html("<div><button type=\"button\" aria-haspopup=\"listbox\"><!> <span class=\"sv-grid-dropdown-caret svelte-ei8hp3\" aria-hidden=\"true\">▾</span></button> <!></div>"), y = {
|
|
7
|
+
hash: "svelte-ei8hp3",
|
|
8
|
+
code: "\n /* All colors derive from the grid's host CSS vars so light/dark themes\n \"just work\". Hard fallbacks are kept so the component is still\n usable in an unthemed page. */.sv-grid-dropdown.svelte-ei8hp3 {position:absolute;top:0;left:0;right:0;height:100%;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-trigger.svelte-ei8hp3 {display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:28px;padding:0 8px;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);border:0;outline:none;font:inherit;text-align:start;cursor:pointer;box-sizing:border-box;}.sv-grid-dropdown-trigger.svelte-ei8hp3:focus {outline:2px solid var(--sg-accent, #2563eb);outline-offset:-2px;}.sv-grid-dropdown-trigger-chips.svelte-ei8hp3 {align-items:center;padding:4px 8px;flex-wrap:wrap;}.sv-grid-dropdown-chips.svelte-ei8hp3 {display:inline-flex;flex-wrap:wrap;gap:4px;flex:1 1 auto;min-width:0;align-items:center;}.sv-grid-dropdown-label.svelte-ei8hp3 {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-caret.svelte-ei8hp3 {flex:0 0 auto;font-size:10px;opacity:0.7;line-height:1;}\n\n /* Popover sits absolutely below the trigger. The parent\n `.sv-grid-cell-editing` has `overflow: visible`, so this can hang\n past the row. Pulls its surface color from the grid's header bg\n so it reads as a slightly elevated layer on either theme. */\n /* Panel is `position: fixed` AND portal'd into document.body via\n `use:portalToBody`, so it escapes every ancestor overflow / clip /\n transform / stacking context. Coords come from updatePanelPosition(). */.sv-grid-dropdown-panel {overflow-y:auto;background:var(--sg-header-bg, var(--sg-bg, #ffffff));color:var(--sg-fg, #0f172a);border:1px solid var(--sg-accent, #2563eb);border-radius:6px;box-shadow:0 12px 28px rgba(0, 0, 0, 0.45);padding:4px 0;font-family:inherit;}\n /* When the option list fits in one panel we want NO scrollbar at all -\n * not even a sub-pixel ghost track. `overflow: visible` rules out the\n * scrollbar gutter that some browsers still reserve under\n * `overflow: auto` when content equals max-height. */.sv-grid-dropdown-panel.sv-grid-dropdown-panel-fits {overflow:visible;}.sv-grid-dropdown-option {display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer;user-select:none;color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.1));}.sv-grid-dropdown-option-selected {font-weight:600;background:var(--sg-selection-bg, rgba(37, 99, 235, 0.15));}.sv-grid-dropdown-option-selected.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.18));}.sv-grid-dropdown-option-label {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-check {flex:0 0 16px;display:inline-flex;align-items:center;justify-content:center;color:var(--sg-accent, #2563eb);font-weight:700;}.sv-grid-dropdown-swatch {flex:0 0 12px;width:12px;height:12px;border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-fg, #0f172a) 25%, transparent);}\n /* Colored option chip. Declared `:global` because the option panel is\n portal'd to <body>, where Svelte's scoped classes don't reach. The\n per-chip background / border / text color come from an inline style\n (see colorfulChipStyleInline) so each option matches its cell chip. */.sv-grid-dropdown-option-chip {display:inline-flex;align-items:center;max-width:100%;padding:2px 11px;border:1px solid transparent;border-radius:999px;font-size:0.9em;font-weight:600;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-empty {padding:8px 10px;color:var(--sg-muted, rgba(15, 23, 42, 0.55));font-style:italic;font-size:0.9em;}.sv-grid-dropdown-footer {display:flex;justify-content:flex-end;padding:4px 6px;border-top:1px solid var(--sg-border, rgba(15, 23, 42, 0.08));margin-top:2px;}.sv-grid-dropdown-done {font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#fff;background:var(--sg-accent, #2563eb);border:0;border-radius:4px;padding:4px 10px;cursor:pointer;}.sv-grid-dropdown-done:hover {filter:brightness(1.12);}\n\n /* Note: option / footer / swatch styles are declared `:global(...)`\n above because the panel is portal'd to <body> and Svelte's scoped\n class won't survive on children of an element living outside the\n component subtree. */\n\n /* Theme-aware chip badges. Inside the trigger they sit on the cell\n background, so we need a tone that contrasts on BOTH themes - a\n translucent accent works well in dark mode and reads as a soft\n blue pill in light mode. */.sv-grid-chip.svelte-ei8hp3 {display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:0.85em;line-height:1.4;background:color-mix(in srgb, var(--sg-accent, #2563eb) 18%, transparent);color:var(--sg-fg, #0f172a);border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-accent, #2563eb) 35%, transparent);white-space:nowrap;}.sv-grid-chip-removable.svelte-ei8hp3 {padding-inline-end:2px;}.sv-grid-chip-remove.svelte-ei8hp3 {display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:999px;background:color-mix(in srgb, var(--sg-fg, #0f172a) 18%, transparent);color:inherit;font-size:12px;line-height:1;cursor:pointer;padding:0;}.sv-grid-chip-remove.svelte-ei8hp3:hover {background:rgba(220, 38, 38, 0.7);color:#fff;}"
|
|
9
|
+
};
|
|
10
|
+
function b(e, a) {
|
|
11
|
+
let b = i.props_id();
|
|
12
|
+
i.push(a, !0), i.append_styles(e, y);
|
|
13
|
+
let x = i.prop(a, "multiple", 3, !1), S = i.prop(a, "placeholder", 3, "Select…"), C = i.prop(a, "renderChipsInTrigger", 3, !1), w = i.prop(a, "searchable", 3, !1), T = i.prop(a, "autoOpen", 3, !0);
|
|
14
|
+
function E(e) {
|
|
15
|
+
return e >= 0 && e < i.get(k).length ? `${b}-opt-${e}` : void 0;
|
|
16
|
+
}
|
|
17
|
+
let D = i.derived(() => a.options.some((e) => e.color) ? 40 : 32), O = i.state(""), k = i.derived(() => !w() || !i.get(O).trim() ? a.options : (() => {
|
|
18
|
+
let e = i.get(O).trim().toLowerCase();
|
|
19
|
+
return a.options.filter((t) => t.label.toLowerCase().includes(e));
|
|
20
|
+
})()), A = i.state(!1), j = i.state(-1), M = i.state(null), N = i.state(null), P = i.state(null), F = i.state(i.proxy({
|
|
21
|
+
top: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
width: 0,
|
|
24
|
+
openUpward: !1,
|
|
25
|
+
maxHeight: 0,
|
|
26
|
+
availHeight: 0
|
|
27
|
+
})), I = i.derived(() => Array.isArray(a.value) ? a.value : a.value == null || a.value === "" ? [] : [a.value]), L = i.derived(() => {
|
|
28
|
+
if (i.get(I).length === 0) return S();
|
|
29
|
+
if (!x()) {
|
|
30
|
+
let e = i.get(I)[0], t = a.options.find((t) => String(t.value) === String(e));
|
|
31
|
+
return t ? t.label : String(e);
|
|
32
|
+
}
|
|
33
|
+
return `${i.get(I).length} selected`;
|
|
34
|
+
}), R = i.derived(() => {
|
|
35
|
+
if (x() || i.get(I).length !== 1) return;
|
|
36
|
+
let e = i.get(I)[0];
|
|
37
|
+
return a.options.find((t) => String(t.value) === String(e))?.color;
|
|
38
|
+
});
|
|
39
|
+
function z(e) {
|
|
40
|
+
return i.get(I).some((t) => String(t) === String(e.value));
|
|
41
|
+
}
|
|
42
|
+
function B(e) {
|
|
43
|
+
if (x()) {
|
|
44
|
+
let t = z(e) ? i.get(I).filter((t) => String(t) !== String(e.value)) : [...i.get(I), e.value];
|
|
45
|
+
a.onChange?.(t);
|
|
46
|
+
} else a.onChange?.(e.value), i.set(A, !1), a.onCommit?.();
|
|
47
|
+
}
|
|
48
|
+
function V() {
|
|
49
|
+
if (!i.get(A)) {
|
|
50
|
+
if (i.set(A, !0), i.get(j) < 0) {
|
|
51
|
+
let e = a.options.findIndex((e) => z(e));
|
|
52
|
+
i.set(j, e >= 0 ? e : 0, !0);
|
|
53
|
+
}
|
|
54
|
+
H();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function H() {
|
|
58
|
+
if (!i.get(N)) return;
|
|
59
|
+
let e = Math.min(a.options.length, 10) * i.get(D) + (x() ? 40 : 0) + 8;
|
|
60
|
+
i.set(F, n(i.get(N).getBoundingClientRect(), {
|
|
61
|
+
estimatedHeight: e,
|
|
62
|
+
clampHorizontal: !1
|
|
63
|
+
}), !0);
|
|
64
|
+
}
|
|
65
|
+
i.user_effect(() => {
|
|
66
|
+
if (!i.get(A)) return;
|
|
67
|
+
let e = () => H();
|
|
68
|
+
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
69
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
function U() {
|
|
73
|
+
i.set(A, !1), i.set(j, -1);
|
|
74
|
+
}
|
|
75
|
+
function W(e) {
|
|
76
|
+
if (e.stopPropagation(), e.key === "Escape") {
|
|
77
|
+
e.preventDefault(), U(), a.onCancel?.();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (e.key === "ArrowDown") {
|
|
81
|
+
if (e.preventDefault(), !i.get(A)) {
|
|
82
|
+
V();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
i.set(j, Math.min(i.get(j) + 1, a.options.length - 1), !0), G();
|
|
86
|
+
} else if (e.key === "ArrowUp") {
|
|
87
|
+
if (e.preventDefault(), !i.get(A)) {
|
|
88
|
+
V();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
i.set(j, Math.max(i.get(j) - 1, 0), !0), G();
|
|
92
|
+
} else if (e.key === "Home") {
|
|
93
|
+
if (!i.get(A)) return;
|
|
94
|
+
e.preventDefault(), i.set(j, 0), G();
|
|
95
|
+
} else if (e.key === "End") {
|
|
96
|
+
if (!i.get(A)) return;
|
|
97
|
+
e.preventDefault(), i.set(j, a.options.length - 1), G();
|
|
98
|
+
} else if (e.key === "Enter") {
|
|
99
|
+
if (e.preventDefault(), !i.get(A)) {
|
|
100
|
+
V();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
let t = a.options[i.get(j)];
|
|
104
|
+
t ? B(t) : x() && (U(), a.onCommit?.());
|
|
105
|
+
} else if (e.key === " " && i.get(A)) {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
let t = a.options[i.get(j)];
|
|
108
|
+
t && B(t);
|
|
109
|
+
} else e.key === "Tab" && (i.get(A) && U(), a.onCommit?.());
|
|
110
|
+
}
|
|
111
|
+
function G() {
|
|
112
|
+
queueMicrotask(() => {
|
|
113
|
+
i.get(P) && i.get(P).querySelector(`[data-opt-idx="${i.get(j)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function K(e) {
|
|
117
|
+
let t = e.relatedTarget;
|
|
118
|
+
t && i.get(M)?.contains(t) || (i.get(A) && U(), a.onCommit?.());
|
|
119
|
+
}
|
|
120
|
+
function q(e, t) {
|
|
121
|
+
t.preventDefault(), t.stopPropagation();
|
|
122
|
+
let n = i.get(I).filter((t) => String(t) !== String(e));
|
|
123
|
+
a.onChange?.(x() ? n : n[0] ?? null);
|
|
124
|
+
}
|
|
125
|
+
function J(e) {
|
|
126
|
+
T() && (e.focus(), V());
|
|
127
|
+
}
|
|
128
|
+
i.user_effect(() => {
|
|
129
|
+
if (!i.get(A)) return;
|
|
130
|
+
let e = (e) => {
|
|
131
|
+
let t = e.target;
|
|
132
|
+
t && (i.get(M)?.contains(t) || i.get(P)?.contains(t) || (U(), a.onCommit?.()));
|
|
133
|
+
};
|
|
134
|
+
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
135
|
+
});
|
|
136
|
+
function Y(e) {
|
|
137
|
+
return `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));`;
|
|
138
|
+
}
|
|
139
|
+
var X = v();
|
|
140
|
+
let Z;
|
|
141
|
+
var Q = i.child(X);
|
|
142
|
+
let $;
|
|
143
|
+
var ee = i.child(Q), te = (e) => {
|
|
144
|
+
var t = s();
|
|
145
|
+
i.each(t, 21, () => i.get(I), (e) => String(e), (e, t) => {
|
|
146
|
+
let n = i.derived(() => a.options.find((e) => String(e.value) === String(i.get(t))));
|
|
147
|
+
var r = o(), s = i.child(r), c = i.sibling(s);
|
|
148
|
+
i.set_attribute(c, "tabindex", -1), i.reset(r), i.template_effect((e, t, n) => {
|
|
149
|
+
i.set_style(r, e), i.set_text(s, `${t ?? ""} `), i.set_attribute(c, "aria-label", `Remove ${n ?? ""}`);
|
|
150
|
+
}, [
|
|
151
|
+
() => i.get(n)?.color ? Y(i.get(n).color) : "",
|
|
152
|
+
() => i.get(n) ? i.get(n).label : String(i.get(t)),
|
|
153
|
+
() => i.get(n) ? i.get(n).label : String(i.get(t))
|
|
154
|
+
]), i.delegated("mousedown", c, (e) => e.preventDefault()), i.delegated("click", c, (e) => q(i.get(t), e)), i.append(e, r);
|
|
155
|
+
}), i.reset(t), i.append(e, t);
|
|
156
|
+
}, ne = (e) => {
|
|
157
|
+
var t = c(), n = i.child(t, !0);
|
|
158
|
+
i.reset(t), i.template_effect((e) => {
|
|
159
|
+
i.set_style(t, e), i.set_text(n, i.get(L));
|
|
160
|
+
}, [() => Y(i.get(R))]), i.append(e, t);
|
|
161
|
+
}, re = (e) => {
|
|
162
|
+
var t = l(), n = i.child(t, !0);
|
|
163
|
+
i.reset(t), i.template_effect(() => i.set_text(n, i.get(L))), i.append(e, t);
|
|
164
|
+
};
|
|
165
|
+
i.if(ee, (e) => {
|
|
166
|
+
C() && i.get(I).length > 0 ? e(te) : !x() && i.get(I).length === 1 && i.get(R) ? e(ne, 1) : e(re, -1);
|
|
167
|
+
}), i.next(2), i.reset(Q), i.bind_this(Q, (e) => i.set(N, e), () => i.get(N)), i.action(Q, (e) => J?.(e));
|
|
168
|
+
var ie = i.sibling(Q, 2), ae = (e) => {
|
|
169
|
+
let n = i.derived(() => a.options.length > 10), o = i.derived(() => Math.min(i.get(n) ? 10 * i.get(D) + (x() ? 40 : 0) + 8 : Infinity, i.get(F).maxHeight));
|
|
170
|
+
var s = _();
|
|
171
|
+
let c, l;
|
|
172
|
+
var v = i.child(s), y = (e) => {
|
|
173
|
+
var t = u();
|
|
174
|
+
i.remove_input_defaults(t), i.delegated("mousedown", t, (e) => e.stopPropagation()), i.delegated("click", t, (e) => e.stopPropagation()), i.delegated("keydown", t, (e) => {
|
|
175
|
+
e.key === "Escape" && (e.preventDefault(), i.set(A, !1), a.onCancel?.());
|
|
176
|
+
}), i.bind_value(t, () => i.get(O), (e) => i.set(O, e)), i.append(e, t);
|
|
177
|
+
};
|
|
178
|
+
i.if(v, (e) => {
|
|
179
|
+
w() && e(y);
|
|
180
|
+
});
|
|
181
|
+
var b = i.sibling(v, 2), S = (e) => {
|
|
182
|
+
var t = d(), n = i.child(t, !0);
|
|
183
|
+
i.reset(t), i.template_effect(() => i.set_text(n, w() && i.get(O) ? `No matches for "${i.get(O)}"` : "No options")), i.append(e, t);
|
|
184
|
+
}, C = (e) => {
|
|
185
|
+
var t = i.comment(), n = i.first_child(t);
|
|
186
|
+
i.each(n, 19, () => i.get(k), (e) => String(e.value), (e, t, n) => {
|
|
187
|
+
let r = i.derived(() => z(i.get(t)));
|
|
188
|
+
var a = h();
|
|
189
|
+
let o;
|
|
190
|
+
var s = i.child(a), c = (e) => {
|
|
191
|
+
var t = f(), n = i.child(t, !0);
|
|
192
|
+
i.reset(t), i.template_effect(() => i.set_text(n, i.get(r) ? "✓" : "")), i.append(e, t);
|
|
193
|
+
};
|
|
194
|
+
i.if(s, (e) => {
|
|
195
|
+
x() && e(c);
|
|
196
|
+
});
|
|
197
|
+
var l = i.sibling(s, 2), u = (e) => {
|
|
198
|
+
var n = p(), r = i.child(n, !0);
|
|
199
|
+
i.reset(n), i.template_effect((e) => {
|
|
200
|
+
i.set_style(n, e), i.set_text(r, i.get(t).label);
|
|
201
|
+
}, [() => Y(i.get(t).color)]), i.append(e, n);
|
|
202
|
+
}, d = (e) => {
|
|
203
|
+
var n = m(), r = i.child(n, !0);
|
|
204
|
+
i.reset(n), i.template_effect(() => i.set_text(r, i.get(t).label)), i.append(e, n);
|
|
205
|
+
};
|
|
206
|
+
i.if(l, (e) => {
|
|
207
|
+
i.get(t).color ? e(u) : e(d, -1);
|
|
208
|
+
}), i.reset(a), i.template_effect((e) => {
|
|
209
|
+
o = i.set_class(a, 1, "sv-grid-dropdown-option", null, o, {
|
|
210
|
+
"sv-grid-dropdown-option-selected": i.get(r),
|
|
211
|
+
"sv-grid-dropdown-option-highlighted": i.get(n) === i.get(j)
|
|
212
|
+
}), i.set_attribute(a, "id", e), i.set_attribute(a, "aria-selected", i.get(r)), i.set_attribute(a, "data-opt-idx", i.get(n));
|
|
213
|
+
}, [() => E(i.get(n))]), i.delegated("mousedown", a, (e) => {
|
|
214
|
+
e.preventDefault(), B(i.get(t));
|
|
215
|
+
}), i.event("mouseenter", a, () => i.set(j, i.get(n), !0)), i.append(e, a);
|
|
216
|
+
}), i.append(e, t);
|
|
217
|
+
};
|
|
218
|
+
i.if(b, (e) => {
|
|
219
|
+
i.get(k).length === 0 ? e(S) : e(C, -1);
|
|
220
|
+
});
|
|
221
|
+
var T = i.sibling(b, 2), M = (e) => {
|
|
222
|
+
var t = g(), n = i.child(t);
|
|
223
|
+
i.reset(t), i.delegated("mousedown", n, (e) => e.preventDefault()), i.delegated("click", n, () => {
|
|
224
|
+
U(), a.onCommit?.();
|
|
225
|
+
}), i.append(e, t);
|
|
226
|
+
};
|
|
227
|
+
i.if(T, (e) => {
|
|
228
|
+
x() && e(M);
|
|
229
|
+
}), i.reset(s), i.bind_this(s, (e) => i.set(P, e), () => i.get(P)), i.action(s, (e) => t?.(e)), i.action(s, (e, t) => r?.(e, t), () => ({ up: i.get(F).openUpward })), i.template_effect(() => {
|
|
230
|
+
c = i.set_class(s, 1, "sv-grid-dropdown-panel", null, c, { "sv-grid-dropdown-panel-fits": !i.get(n) }), i.set_attribute(s, "aria-multiselectable", x()), l = i.set_style(s, "", l, {
|
|
231
|
+
position: "fixed",
|
|
232
|
+
top: `${i.get(F).top}px`,
|
|
233
|
+
left: `${i.get(F).left}px`,
|
|
234
|
+
width: `${i.get(F).width}px`,
|
|
235
|
+
"max-height": i.get(o) === null ? null : `${i.get(o)}px`,
|
|
236
|
+
"z-index": "2147483647"
|
|
237
|
+
});
|
|
238
|
+
}), i.delegated("pointerdown", s, (e) => e.stopPropagation()), i.delegated("mousedown", s, (e) => e.stopPropagation()), i.delegated("click", s, (e) => e.stopPropagation()), i.append(e, s);
|
|
239
|
+
};
|
|
240
|
+
i.if(ie, (e) => {
|
|
241
|
+
i.get(A) && e(ae);
|
|
242
|
+
}), i.reset(X), i.bind_this(X, (e) => i.set(M, e), () => i.get(M)), i.template_effect((e) => {
|
|
243
|
+
Z = i.set_class(X, 1, "sv-grid-dropdown svelte-ei8hp3", null, Z, { "sv-grid-dropdown-open": i.get(A) }), $ = i.set_class(Q, 1, "sv-grid-dropdown-trigger svelte-ei8hp3", null, $, { "sv-grid-dropdown-trigger-chips": C() && i.get(I).length > 0 }), i.set_attribute(Q, "aria-expanded", i.get(A)), i.set_attribute(Q, "aria-activedescendant", e);
|
|
244
|
+
}, [() => i.get(A) ? E(i.get(j)) : void 0]), i.delegated("focusout", X, K), i.delegated("click", X, (e) => e.stopPropagation()), i.delegated("dblclick", X, (e) => e.stopPropagation()), i.delegated("pointerdown", X, (e) => e.stopPropagation()), i.delegated("mousedown", X, (e) => e.stopPropagation()), i.delegated("click", Q, () => i.get(A) ? U() : V()), i.delegated("keydown", Q, W), i.append(e, X), i.pop();
|
|
245
|
+
}
|
|
246
|
+
i.delegate([
|
|
247
|
+
"focusout",
|
|
248
|
+
"click",
|
|
249
|
+
"dblclick",
|
|
250
|
+
"pointerdown",
|
|
251
|
+
"mousedown",
|
|
252
|
+
"keydown"
|
|
253
|
+
]);
|
|
254
|
+
//#endregion
|
|
255
|
+
export { a as n, b as t };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
import { E as t, F as n, G as r, H as i, I as a, L as o, N as s, U as c, V as l, X as u, Y as d, _ as f, at as p, b as m, d as h, et as g, ft as _, i as v, it as y, k as b, lt as x, nt as S, o as ee, pt as C, rt as w, st as T, t as E, tt as te, u as ne, ut as D, v as O, x as re, z as ie } from "./disclose-version-DoD9AFD_.js";
|
|
3
|
+
import { i as ae, n as k, r as oe } from "./popover-P-9P2YYn.js";
|
|
4
|
+
//#region src/SvGridDropdown.svelte
|
|
5
|
+
var A = /* @__PURE__ */ e({ default: () => M }), j = o("<span class=\"sv-grid-chip sv-grid-chip-removable svelte-ei8hp3\"> <span class=\"sv-grid-chip-remove svelte-ei8hp3\" role=\"button\">×</span></span>"), se = o("<span class=\"sv-grid-dropdown-chips svelte-ei8hp3\"></span>"), ce = o("<span class=\"sv-grid-chip svelte-ei8hp3\"> </span>"), le = o("<span class=\"sv-grid-dropdown-label svelte-ei8hp3\"> </span>"), ue = o("<input type=\"search\" class=\"sv-grid-dropdown-search\" placeholder=\"Search…\"/>"), de = o("<div class=\"sv-grid-dropdown-empty\"> </div>"), fe = o("<span class=\"sv-grid-dropdown-check\" aria-hidden=\"true\"> </span>"), pe = o("<span class=\"sv-grid-dropdown-option-chip\"> </span>"), me = o("<span class=\"sv-grid-dropdown-option-label\"> </span>"), he = o("<div role=\"option\"><!> <!></div>"), ge = o("<div class=\"sv-grid-dropdown-footer\"><button type=\"button\" class=\"sv-grid-dropdown-done\">Done</button></div>"), _e = o("<div role=\"listbox\"><!> <!> <!></div>"), ve = o("<div><button type=\"button\" aria-haspopup=\"listbox\"><!> <span class=\"sv-grid-dropdown-caret svelte-ei8hp3\" aria-hidden=\"true\">▾</span></button> <!></div>"), ye = {
|
|
6
|
+
hash: "svelte-ei8hp3",
|
|
7
|
+
code: "\n /* All colors derive from the grid's host CSS vars so light/dark themes\n \"just work\". Hard fallbacks are kept so the component is still\n usable in an unthemed page. */.sv-grid-dropdown.svelte-ei8hp3 {position:absolute;top:0;left:0;right:0;height:100%;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-trigger.svelte-ei8hp3 {display:flex;align-items:center;gap:6px;width:100%;height:100%;min-height:28px;padding:0 8px;background:var(--sg-bg, #ffffff);color:var(--sg-fg, #0f172a);border:0;outline:none;font:inherit;text-align:start;cursor:pointer;box-sizing:border-box;}.sv-grid-dropdown-trigger.svelte-ei8hp3:focus {outline:2px solid var(--sg-accent, #2563eb);outline-offset:-2px;}.sv-grid-dropdown-trigger-chips.svelte-ei8hp3 {align-items:center;padding:4px 8px;flex-wrap:wrap;}.sv-grid-dropdown-chips.svelte-ei8hp3 {display:inline-flex;flex-wrap:wrap;gap:4px;flex:1 1 auto;min-width:0;align-items:center;}.sv-grid-dropdown-label.svelte-ei8hp3 {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-caret.svelte-ei8hp3 {flex:0 0 auto;font-size:10px;opacity:0.7;line-height:1;}\n\n /* Popover sits absolutely below the trigger. The parent\n `.sv-grid-cell-editing` has `overflow: visible`, so this can hang\n past the row. Pulls its surface color from the grid's header bg\n so it reads as a slightly elevated layer on either theme. */\n /* Panel is `position: fixed` AND portal'd into document.body via\n `use:portalToBody`, so it escapes every ancestor overflow / clip /\n transform / stacking context. Coords come from updatePanelPosition(). */.sv-grid-dropdown-panel {overflow-y:auto;background:var(--sg-header-bg, var(--sg-bg, #ffffff));color:var(--sg-fg, #0f172a);border:1px solid var(--sg-accent, #2563eb);border-radius:6px;box-shadow:0 12px 28px rgba(0, 0, 0, 0.45);padding:4px 0;font-family:inherit;}\n /* When the option list fits in one panel we want NO scrollbar at all -\n * not even a sub-pixel ghost track. `overflow: visible` rules out the\n * scrollbar gutter that some browsers still reserve under\n * `overflow: auto` when content equals max-height. */.sv-grid-dropdown-panel.sv-grid-dropdown-panel-fits {overflow:visible;}.sv-grid-dropdown-option {display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:pointer;user-select:none;color:var(--sg-fg, #0f172a);}.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.1));}.sv-grid-dropdown-option-selected {font-weight:600;background:var(--sg-selection-bg, rgba(37, 99, 235, 0.15));}.sv-grid-dropdown-option-selected.sv-grid-dropdown-option-highlighted {background:var(--sg-row-hover-bg, rgba(37, 99, 235, 0.18));}.sv-grid-dropdown-option-label {flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-check {flex:0 0 16px;display:inline-flex;align-items:center;justify-content:center;color:var(--sg-accent, #2563eb);font-weight:700;}.sv-grid-dropdown-swatch {flex:0 0 12px;width:12px;height:12px;border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-fg, #0f172a) 25%, transparent);}\n /* Colored option chip. Declared `:global` because the option panel is\n portal'd to <body>, where Svelte's scoped classes don't reach. The\n per-chip background / border / text color come from an inline style\n (see colorfulChipStyleInline) so each option matches its cell chip. */.sv-grid-dropdown-option-chip {display:inline-flex;align-items:center;max-width:100%;padding:2px 11px;border:1px solid transparent;border-radius:999px;font-size:0.9em;font-weight:600;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sv-grid-dropdown-empty {padding:8px 10px;color:var(--sg-muted, rgba(15, 23, 42, 0.55));font-style:italic;font-size:0.9em;}.sv-grid-dropdown-footer {display:flex;justify-content:flex-end;padding:4px 6px;border-top:1px solid var(--sg-border, rgba(15, 23, 42, 0.08));margin-top:2px;}.sv-grid-dropdown-done {font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:#fff;background:var(--sg-accent, #2563eb);border:0;border-radius:4px;padding:4px 10px;cursor:pointer;}.sv-grid-dropdown-done:hover {filter:brightness(1.12);}\n\n /* Note: option / footer / swatch styles are declared `:global(...)`\n above because the panel is portal'd to <body> and Svelte's scoped\n class won't survive on children of an element living outside the\n component subtree. */\n\n /* Theme-aware chip badges. Inside the trigger they sit on the cell\n background, so we need a tone that contrasts on BOTH themes - a\n translucent accent works well in dark mode and reads as a soft\n blue pill in light mode. */.sv-grid-chip.svelte-ei8hp3 {display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:0.85em;line-height:1.4;background:color-mix(in srgb, var(--sg-accent, #2563eb) 18%, transparent);color:var(--sg-fg, #0f172a);border-radius:999px;border:1px solid color-mix(in srgb, var(--sg-accent, #2563eb) 35%, transparent);white-space:nowrap;}.sv-grid-chip-removable.svelte-ei8hp3 {padding-inline-end:2px;}.sv-grid-chip-remove.svelte-ei8hp3 {display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:999px;background:color-mix(in srgb, var(--sg-fg, #0f172a) 18%, transparent);color:inherit;font-size:12px;line-height:1;cursor:pointer;padding:0;}.sv-grid-chip-remove.svelte-ei8hp3:hover {background:rgba(220, 38, 38, 0.7);color:#fff;}"
|
|
8
|
+
};
|
|
9
|
+
function M(e, o) {
|
|
10
|
+
let l = ie();
|
|
11
|
+
D(o, !0), re(e, ye);
|
|
12
|
+
let A = E(o, "multiple", 3, !1), M = E(o, "placeholder", 3, "Select…"), N = E(o, "renderChipsInTrigger", 3, !1), P = E(o, "searchable", 3, !1), be = E(o, "autoOpen", 3, !0);
|
|
13
|
+
function xe(e) {
|
|
14
|
+
return e >= 0 && e < r(I).length ? `${l}-opt-${e}` : void 0;
|
|
15
|
+
}
|
|
16
|
+
let Se = T(() => o.options.some((e) => e.color) ? 40 : 32), F = p(""), I = T(() => !P() || !r(F).trim() ? o.options : (() => {
|
|
17
|
+
let e = r(F).trim().toLowerCase();
|
|
18
|
+
return o.options.filter((t) => t.label.toLowerCase().includes(e));
|
|
19
|
+
})()), L = p(!1), R = p(-1), z = p(null), B = p(null), V = p(null), H = p(w({
|
|
20
|
+
top: 0,
|
|
21
|
+
left: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
openUpward: !1,
|
|
24
|
+
maxHeight: 0,
|
|
25
|
+
availHeight: 0
|
|
26
|
+
})), U = T(() => Array.isArray(o.value) ? o.value : o.value == null || o.value === "" ? [] : [o.value]), W = T(() => {
|
|
27
|
+
if (r(U).length === 0) return M();
|
|
28
|
+
if (!A()) {
|
|
29
|
+
let e = r(U)[0], t = o.options.find((t) => String(t.value) === String(e));
|
|
30
|
+
return t ? t.label : String(e);
|
|
31
|
+
}
|
|
32
|
+
return `${r(U).length} selected`;
|
|
33
|
+
}), G = T(() => {
|
|
34
|
+
if (A() || r(U).length !== 1) return;
|
|
35
|
+
let e = r(U)[0];
|
|
36
|
+
return o.options.find((t) => String(t.value) === String(e))?.color;
|
|
37
|
+
});
|
|
38
|
+
function K(e) {
|
|
39
|
+
return r(U).some((t) => String(t) === String(e.value));
|
|
40
|
+
}
|
|
41
|
+
function q(e) {
|
|
42
|
+
if (A()) {
|
|
43
|
+
let t = K(e) ? r(U).filter((t) => String(t) !== String(e.value)) : [...r(U), e.value];
|
|
44
|
+
o.onChange?.(t);
|
|
45
|
+
} else o.onChange?.(e.value), y(L, !1), o.onCommit?.();
|
|
46
|
+
}
|
|
47
|
+
function J() {
|
|
48
|
+
if (!r(L)) {
|
|
49
|
+
if (y(L, !0), r(R) < 0) {
|
|
50
|
+
let e = o.options.findIndex((e) => K(e));
|
|
51
|
+
y(R, e >= 0 ? e : 0, !0);
|
|
52
|
+
}
|
|
53
|
+
Ce();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function Ce() {
|
|
57
|
+
if (!r(B)) return;
|
|
58
|
+
let e = Math.min(o.options.length, 10) * r(Se) + (A() ? 40 : 0) + 8;
|
|
59
|
+
y(H, k(r(B).getBoundingClientRect(), {
|
|
60
|
+
estimatedHeight: e,
|
|
61
|
+
clampHorizontal: !1
|
|
62
|
+
}), !0);
|
|
63
|
+
}
|
|
64
|
+
u(() => {
|
|
65
|
+
if (!r(L)) return;
|
|
66
|
+
let e = () => Ce();
|
|
67
|
+
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
|
|
68
|
+
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
function Y() {
|
|
72
|
+
y(L, !1), y(R, -1);
|
|
73
|
+
}
|
|
74
|
+
function we(e) {
|
|
75
|
+
if (e.stopPropagation(), e.key === "Escape") {
|
|
76
|
+
e.preventDefault(), Y(), o.onCancel?.();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (e.key === "ArrowDown") {
|
|
80
|
+
if (e.preventDefault(), !r(L)) {
|
|
81
|
+
J();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
y(R, Math.min(r(R) + 1, o.options.length - 1), !0), X();
|
|
85
|
+
} else if (e.key === "ArrowUp") {
|
|
86
|
+
if (e.preventDefault(), !r(L)) {
|
|
87
|
+
J();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
y(R, Math.max(r(R) - 1, 0), !0), X();
|
|
91
|
+
} else if (e.key === "Home") {
|
|
92
|
+
if (!r(L)) return;
|
|
93
|
+
e.preventDefault(), y(R, 0), X();
|
|
94
|
+
} else if (e.key === "End") {
|
|
95
|
+
if (!r(L)) return;
|
|
96
|
+
e.preventDefault(), y(R, o.options.length - 1), X();
|
|
97
|
+
} else if (e.key === "Enter") {
|
|
98
|
+
if (e.preventDefault(), !r(L)) {
|
|
99
|
+
J();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let t = o.options[r(R)];
|
|
103
|
+
t ? q(t) : A() && (Y(), o.onCommit?.());
|
|
104
|
+
} else if (e.key === " " && r(L)) {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
let t = o.options[r(R)];
|
|
107
|
+
t && q(t);
|
|
108
|
+
} else e.key === "Tab" && (r(L) && Y(), o.onCommit?.());
|
|
109
|
+
}
|
|
110
|
+
function X() {
|
|
111
|
+
queueMicrotask(() => {
|
|
112
|
+
r(V) && r(V).querySelector(`[data-opt-idx="${r(R)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function Te(e) {
|
|
116
|
+
let t = e.relatedTarget;
|
|
117
|
+
t && r(z)?.contains(t) || (r(L) && Y(), o.onCommit?.());
|
|
118
|
+
}
|
|
119
|
+
function Ee(e, t) {
|
|
120
|
+
t.preventDefault(), t.stopPropagation();
|
|
121
|
+
let n = r(U).filter((t) => String(t) !== String(e));
|
|
122
|
+
o.onChange?.(A() ? n : n[0] ?? null);
|
|
123
|
+
}
|
|
124
|
+
function De(e) {
|
|
125
|
+
be() && (e.focus(), J());
|
|
126
|
+
}
|
|
127
|
+
u(() => {
|
|
128
|
+
if (!r(L)) return;
|
|
129
|
+
let e = (e) => {
|
|
130
|
+
let t = e.target;
|
|
131
|
+
t && (r(z)?.contains(t) || r(V)?.contains(t) || (Y(), o.onCommit?.()));
|
|
132
|
+
};
|
|
133
|
+
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
134
|
+
});
|
|
135
|
+
function Z(e) {
|
|
136
|
+
return `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));`;
|
|
137
|
+
}
|
|
138
|
+
var Q = ve();
|
|
139
|
+
let Oe;
|
|
140
|
+
var $ = g(Q);
|
|
141
|
+
let ke;
|
|
142
|
+
var Ae = g($), je = (e) => {
|
|
143
|
+
var a = se();
|
|
144
|
+
t(a, 21, () => r(U), (e) => String(e), (e, t) => {
|
|
145
|
+
let a = T(() => o.options.find((e) => String(e.value) === String(r(t))));
|
|
146
|
+
var c = j(), l = g(c), u = S(l);
|
|
147
|
+
h(u, "tabindex", -1), C(c), d((e, t, n) => {
|
|
148
|
+
f(c, e), s(l, `${t ?? ""} `), h(u, "aria-label", `Remove ${n ?? ""}`);
|
|
149
|
+
}, [
|
|
150
|
+
() => r(a)?.color ? Z(r(a).color) : "",
|
|
151
|
+
() => r(a) ? r(a).label : String(r(t)),
|
|
152
|
+
() => r(a) ? r(a).label : String(r(t))
|
|
153
|
+
]), i("mousedown", u, (e) => e.preventDefault()), i("click", u, (e) => Ee(r(t), e)), n(e, c);
|
|
154
|
+
}), C(a), n(e, a);
|
|
155
|
+
}, Me = (e) => {
|
|
156
|
+
var t = ce(), i = g(t, !0);
|
|
157
|
+
C(t), d((e) => {
|
|
158
|
+
f(t, e), s(i, r(W));
|
|
159
|
+
}, [() => Z(r(G))]), n(e, t);
|
|
160
|
+
}, Ne = (e) => {
|
|
161
|
+
var t = le(), i = g(t, !0);
|
|
162
|
+
C(t), d(() => s(i, r(W))), n(e, t);
|
|
163
|
+
};
|
|
164
|
+
b(Ae, (e) => {
|
|
165
|
+
N() && r(U).length > 0 ? e(je) : !A() && r(U).length === 1 && r(G) ? e(Me, 1) : e(Ne, -1);
|
|
166
|
+
}), _(2), C($), v($, (e) => y(B, e), () => r(B)), m($, (e) => De?.(e));
|
|
167
|
+
var Pe = S($, 2), Fe = (e) => {
|
|
168
|
+
let l = T(() => o.options.length > 10), u = T(() => Math.min(r(l) ? 10 * r(Se) + (A() ? 40 : 0) + 8 : Infinity, r(H).maxHeight));
|
|
169
|
+
var p = _e();
|
|
170
|
+
let _, x;
|
|
171
|
+
var w = g(p), E = (e) => {
|
|
172
|
+
var t = ue();
|
|
173
|
+
ne(t), i("mousedown", t, (e) => e.stopPropagation()), i("click", t, (e) => e.stopPropagation()), i("keydown", t, (e) => {
|
|
174
|
+
e.key === "Escape" && (e.preventDefault(), y(L, !1), o.onCancel?.());
|
|
175
|
+
}), ee(t, () => r(F), (e) => y(F, e)), n(e, t);
|
|
176
|
+
};
|
|
177
|
+
b(w, (e) => {
|
|
178
|
+
P() && e(E);
|
|
179
|
+
});
|
|
180
|
+
var D = S(w, 2), re = (e) => {
|
|
181
|
+
var t = de(), i = g(t, !0);
|
|
182
|
+
C(t), d(() => s(i, P() && r(F) ? `No matches for "${r(F)}"` : "No options")), n(e, t);
|
|
183
|
+
}, ie = (e) => {
|
|
184
|
+
var o = a();
|
|
185
|
+
t(te(o), 19, () => r(I), (e) => String(e.value), (e, t, a) => {
|
|
186
|
+
let o = T(() => K(r(t)));
|
|
187
|
+
var l = he();
|
|
188
|
+
let u;
|
|
189
|
+
var p = g(l), m = (e) => {
|
|
190
|
+
var t = fe(), i = g(t, !0);
|
|
191
|
+
C(t), d(() => s(i, r(o) ? "✓" : "")), n(e, t);
|
|
192
|
+
};
|
|
193
|
+
b(p, (e) => {
|
|
194
|
+
A() && e(m);
|
|
195
|
+
});
|
|
196
|
+
var _ = S(p, 2), v = (e) => {
|
|
197
|
+
var i = pe(), a = g(i, !0);
|
|
198
|
+
C(i), d((e) => {
|
|
199
|
+
f(i, e), s(a, r(t).label);
|
|
200
|
+
}, [() => Z(r(t).color)]), n(e, i);
|
|
201
|
+
}, x = (e) => {
|
|
202
|
+
var i = me(), a = g(i, !0);
|
|
203
|
+
C(i), d(() => s(a, r(t).label)), n(e, i);
|
|
204
|
+
};
|
|
205
|
+
b(_, (e) => {
|
|
206
|
+
r(t).color ? e(v) : e(x, -1);
|
|
207
|
+
}), C(l), d((e) => {
|
|
208
|
+
u = O(l, 1, "sv-grid-dropdown-option", null, u, {
|
|
209
|
+
"sv-grid-dropdown-option-selected": r(o),
|
|
210
|
+
"sv-grid-dropdown-option-highlighted": r(a) === r(R)
|
|
211
|
+
}), h(l, "id", e), h(l, "aria-selected", r(o)), h(l, "data-opt-idx", r(a));
|
|
212
|
+
}, [() => xe(r(a))]), i("mousedown", l, (e) => {
|
|
213
|
+
e.preventDefault(), q(r(t));
|
|
214
|
+
}), c("mouseenter", l, () => y(R, r(a), !0)), n(e, l);
|
|
215
|
+
}), n(e, o);
|
|
216
|
+
};
|
|
217
|
+
b(D, (e) => {
|
|
218
|
+
r(I).length === 0 ? e(re) : e(ie, -1);
|
|
219
|
+
});
|
|
220
|
+
var k = S(D, 2), j = (e) => {
|
|
221
|
+
var t = ge(), r = g(t);
|
|
222
|
+
C(t), i("mousedown", r, (e) => e.preventDefault()), i("click", r, () => {
|
|
223
|
+
Y(), o.onCommit?.();
|
|
224
|
+
}), n(e, t);
|
|
225
|
+
};
|
|
226
|
+
b(k, (e) => {
|
|
227
|
+
A() && e(j);
|
|
228
|
+
}), C(p), v(p, (e) => y(V, e), () => r(V)), m(p, (e) => ae?.(e)), m(p, (e, t) => oe?.(e, t), () => ({ up: r(H).openUpward })), d(() => {
|
|
229
|
+
_ = O(p, 1, "sv-grid-dropdown-panel", null, _, { "sv-grid-dropdown-panel-fits": !r(l) }), h(p, "aria-multiselectable", A()), x = f(p, "", x, {
|
|
230
|
+
position: "fixed",
|
|
231
|
+
top: `${r(H).top}px`,
|
|
232
|
+
left: `${r(H).left}px`,
|
|
233
|
+
width: `${r(H).width}px`,
|
|
234
|
+
"max-height": r(u) === null ? null : `${r(u)}px`,
|
|
235
|
+
"z-index": "2147483647"
|
|
236
|
+
});
|
|
237
|
+
}), i("pointerdown", p, (e) => e.stopPropagation()), i("mousedown", p, (e) => e.stopPropagation()), i("click", p, (e) => e.stopPropagation()), n(e, p);
|
|
238
|
+
};
|
|
239
|
+
b(Pe, (e) => {
|
|
240
|
+
r(L) && e(Fe);
|
|
241
|
+
}), C(Q), v(Q, (e) => y(z, e), () => r(z)), d((e) => {
|
|
242
|
+
Oe = O(Q, 1, "sv-grid-dropdown svelte-ei8hp3", null, Oe, { "sv-grid-dropdown-open": r(L) }), ke = O($, 1, "sv-grid-dropdown-trigger svelte-ei8hp3", null, ke, { "sv-grid-dropdown-trigger-chips": N() && r(U).length > 0 }), h($, "aria-expanded", r(L)), h($, "aria-activedescendant", e);
|
|
243
|
+
}, [() => r(L) ? xe(r(R)) : void 0]), i("focusout", Q, Te), i("click", Q, (e) => e.stopPropagation()), i("dblclick", Q, (e) => e.stopPropagation()), i("pointerdown", Q, (e) => e.stopPropagation()), i("mousedown", Q, (e) => e.stopPropagation()), i("click", $, () => r(L) ? Y() : J()), i("keydown", $, we), n(e, Q), x();
|
|
244
|
+
}
|
|
245
|
+
l([
|
|
246
|
+
"focusout",
|
|
247
|
+
"click",
|
|
248
|
+
"dblclick",
|
|
249
|
+
"pointerdown",
|
|
250
|
+
"mousedown",
|
|
251
|
+
"keydown"
|
|
252
|
+
]);
|
|
253
|
+
//#endregion
|
|
254
|
+
export { A as n, M as t };
|