@snowui-design-system/components 0.3.0-alpha.6 → 0.3.0-alpha.8
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/AGENTS.md +10 -0
- package/LICENSE +31 -14
- package/README.md +21 -3
- package/THIRD_PARTY_NOTICES.md +27 -0
- package/component-catalog.json +26 -0
- package/dist/client/blocks/Sidebar.js +108 -95
- package/dist/client/blocks/SidebarItem.js +26 -12
- package/dist/client/blocks/SidebarSection.js +3 -1
- package/dist/client/blocks/index.js +1 -1
- package/dist/client/compat.js +1 -1
- package/dist/client/components/BarChart.js +9 -2
- package/dist/client/components/Breadcrumb.js +10 -6
- package/dist/client/components/ChartGroup.js +23 -10
- package/dist/client/components/CircularChart.js +8 -1
- package/dist/client/components/DataTable.d.ts +8 -2
- package/dist/client/components/DataTable.js +9 -3
- package/dist/client/components/GaugeChart.js +8 -1
- package/dist/client/components/Image.d.ts +2 -0
- package/dist/client/components/Image.js +14 -2
- package/dist/client/components/Input.js +2 -2
- package/dist/client/components/LineChart.js +9 -2
- package/dist/client/components/Listbox.js +43 -15
- package/dist/client/components/MenuItem.js +7 -1
- package/dist/client/components/OTPInput.d.ts +32 -0
- package/dist/client/components/OTPInput.js +556 -0
- package/dist/client/components/OverflowActions.d.ts +5 -1
- package/dist/client/components/OverflowActions.js +36 -11
- package/dist/client/components/Pagination.js +9 -8
- package/dist/client/components/ScrollArea.js +11 -5
- package/dist/client/components/SearchBox.js +12 -3
- package/dist/client/components/Select.js +3 -1
- package/dist/client/components/SidePanel.js +4 -3
- package/dist/client/components/Slider.js +7 -3
- package/dist/client/components/Spinner.js +9 -2
- package/dist/client/components/Table.js +14 -7
- package/dist/client/components/TableCell.js +33 -11
- package/dist/client/components/Tag.js +8 -1
- package/dist/client/context.js +1 -1
- package/dist/client/dev.js +1 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +55 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +3 -1
- package/dist/client/internal/code-block/prettier-svelte.d.ts +1 -1
- package/dist/client/internal/component-icon/index.js +1 -1
- package/dist/client/internal/snow-ui-logo/emoji-metrics.js +1 -1
- package/dist/client/keys.d.ts +1 -0
- package/dist/client/keys.js +2 -1
- package/dist/client/lib/adaptive-contrast-renderer.js +1 -1
- package/dist/client/lib/chart/appearance-timeline.js +1 -1
- package/dist/client/lib/chart/arc-path.js +1 -1
- package/dist/client/lib/chart/colors.js +1 -1
- package/dist/client/lib/chart/size.js +1 -1
- package/dist/client/lib/clipboard.js +1 -1
- package/dist/client/lib/color.js +1 -1
- package/dist/client/lib/date-format.js +1 -1
- package/dist/client/lib/edge-fade.js +1 -1
- package/dist/client/lib/media-loading.d.ts +7 -0
- package/dist/client/lib/media-loading.js +12 -0
- package/dist/client/lib/number-format.js +1 -1
- package/dist/client/lib/overflow-actions-motion.js +1 -1
- package/dist/client/lib/overlay-trigger-timing.js +1 -1
- package/dist/client/lib/responsive-exit.js +1 -1
- package/dist/client/lib/search-filter.js +1 -1
- package/dist/client/lib/side-panel.js +1 -1
- package/dist/client/lib/split-pane.js +1 -1
- package/dist/client/lib/table-column-motion.js +1 -1
- package/dist/client/lib/table-context.d.ts +5 -0
- package/dist/client/lib/table-context.js +4 -1
- package/dist/client/lib/table-responsive.d.ts +1 -1
- package/dist/client/lib/table-responsive.js +40 -8
- package/dist/client/lib/table-selection-fade.js +1 -1
- package/dist/client/lib/table-truncation.js +1 -1
- package/dist/client/lib/text-motion/animation.js +1 -1
- package/dist/client/lib/text-motion/character.js +1 -1
- package/dist/client/lib/text-motion/color.js +1 -1
- package/dist/client/lib/text-motion/layout.js +1 -1
- package/dist/client/lib/text-motion/preference.js +1 -1
- package/dist/client/lib/text-motion/sequence.js +1 -1
- package/dist/client/lib/text-motion/typography.js +1 -1
- package/dist/client/lib/tooltip-delay.js +1 -1
- package/dist/client/lib/tooltip-motion-dismiss.js +1 -1
- package/dist/client/lib/tooltip-pointer-speed.js +1 -1
- package/dist/client/lib/truncate.js +1 -1
- package/dist/client/logic/frame-field-control.js +1 -1
- package/dist/client/logic/frame-motion-defaults.js +1 -1
- package/dist/client/logic/frame-prop-filter.js +1 -1
- package/dist/client/logic/geometry-cache.js +1 -1
- package/dist/client/logic/layout-flip.js +1 -1
- package/dist/client/logic/morph.js +1 -1
- package/dist/client/logic/motion-engine.js +1 -1
- package/dist/client/logic/motion-orchestration.js +1 -1
- package/dist/client/logic/motion-types.js +1 -1
- package/dist/client/logic/overflow-actions.d.ts +8 -0
- package/dist/client/logic/overflow-actions.js +5 -0
- package/dist/client/logic/wc-adapter.js +1 -1
- package/dist/client/motion/bridge.js +1 -1
- package/dist/client/motion/content-crossfade.js +1 -1
- package/dist/client/motion/expand.js +1 -1
- package/dist/client/motion/fade-in.js +1 -1
- package/dist/client/motion/fade-out.js +1 -1
- package/dist/client/motion/morph.js +1 -1
- package/dist/client/motion/move.js +1 -1
- package/dist/client/motion/number.js +1 -1
- package/dist/client/motion/replace.js +1 -1
- package/dist/client/motion/rotate.css +1 -1
- package/dist/client/motion/rotate.js +1 -1
- package/dist/client/motion/scale-in.js +1 -1
- package/dist/client/motion/tokens.js +1 -1
- package/dist/client/motion/while-2xl.js +1 -1
- package/dist/client/motion/while-active.js +1 -1
- package/dist/client/motion/while-appear.js +1 -1
- package/dist/client/motion/while-click.js +1 -1
- package/dist/client/motion/while-collapsed.js +1 -1
- package/dist/client/motion/while-disabled.js +1 -1
- package/dist/client/motion/while-disappear.js +1 -1
- package/dist/client/motion/while-drag.js +1 -1
- package/dist/client/motion/while-editing.js +1 -1
- package/dist/client/motion/while-expanded.js +1 -1
- package/dist/client/motion/while-focus.js +1 -1
- package/dist/client/motion/while-hover.js +1 -1
- package/dist/client/motion/while-idle.js +1 -1
- package/dist/client/motion/while-key.js +1 -1
- package/dist/client/motion/while-lg.js +1 -1
- package/dist/client/motion/while-load.js +1 -1
- package/dist/client/motion/while-md.js +1 -1
- package/dist/client/motion/while-reload.js +1 -1
- package/dist/client/motion/while-scroll.js +1 -1
- package/dist/client/motion/while-sm.js +1 -1
- package/dist/client/motion/while-uploading.js +1 -1
- package/dist/client/motion/while-validating.js +1 -1
- package/dist/client/motion/while-xl.js +1 -1
- package/dist/client/motion/while-xs.js +1 -1
- package/dist/client/styles/auto-layout.css +1 -1
- package/dist/client/styles/backdrop.css +1 -1
- package/dist/client/styles/components.css +7 -1
- package/dist/client/styles/index.css +1 -1
- package/dist/client/styles/layout.css +13 -3
- package/dist/client/styles/scale.css +1 -1
- package/dist/client/styles/scrollbar.css +1 -1
- package/dist/client/styles/tokens.css +1 -1
- package/dist/client/vite-env.d.ts +1 -1
- package/dist/server/blocks/Sidebar.js +5 -5
- package/dist/server/blocks/SidebarItem.js +4 -2
- package/dist/server/blocks/SidebarSection.js +3 -1
- package/dist/server/blocks/index.js +1 -1
- package/dist/server/compat.js +1 -1
- package/dist/server/components/BarChart.js +5 -2
- package/dist/server/components/Breadcrumb.js +5 -2
- package/dist/server/components/ChartGroup.js +6 -3
- package/dist/server/components/CircularChart.js +4 -1
- package/dist/server/components/DataTable.d.ts +8 -2
- package/dist/server/components/DataTable.js +9 -3
- package/dist/server/components/GaugeChart.js +4 -1
- package/dist/server/components/Image.d.ts +2 -0
- package/dist/server/components/Image.js +11 -4
- package/dist/server/components/Input.js +2 -2
- package/dist/server/components/LineChart.js +5 -2
- package/dist/server/components/Listbox.js +32 -14
- package/dist/server/components/MenuItem.js +4 -1
- package/dist/server/components/OTPInput.d.ts +32 -0
- package/dist/server/components/OTPInput.js +401 -0
- package/dist/server/components/OverflowActions.d.ts +5 -1
- package/dist/server/components/OverflowActions.js +41 -18
- package/dist/server/components/Pagination.js +2 -2
- package/dist/server/components/ScrollArea.js +5 -2
- package/dist/server/components/SearchBox.js +9 -3
- package/dist/server/components/Select.js +3 -1
- package/dist/server/components/SidePanel.js +4 -3
- package/dist/server/components/Slider.js +7 -3
- package/dist/server/components/Spinner.js +4 -2
- package/dist/server/components/Table.js +8 -3
- package/dist/server/components/TableCell.js +31 -11
- package/dist/server/components/Tag.js +4 -1
- package/dist/server/context.js +1 -1
- package/dist/server/dev.js +1 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +55 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -1
- package/dist/server/internal/code-block/prettier-svelte.d.ts +1 -1
- package/dist/server/internal/component-icon/index.js +1 -1
- package/dist/server/internal/snow-ui-logo/emoji-metrics.js +1 -1
- package/dist/server/keys.d.ts +1 -0
- package/dist/server/keys.js +2 -1
- package/dist/server/lib/adaptive-contrast-renderer.js +1 -1
- package/dist/server/lib/chart/appearance-timeline.js +1 -1
- package/dist/server/lib/chart/arc-path.js +1 -1
- package/dist/server/lib/chart/colors.js +1 -1
- package/dist/server/lib/chart/size.js +1 -1
- package/dist/server/lib/clipboard.js +1 -1
- package/dist/server/lib/color.js +1 -1
- package/dist/server/lib/date-format.js +1 -1
- package/dist/server/lib/edge-fade.js +1 -1
- package/dist/server/lib/media-loading.d.ts +7 -0
- package/dist/server/lib/media-loading.js +12 -0
- package/dist/server/lib/number-format.js +1 -1
- package/dist/server/lib/overflow-actions-motion.js +1 -1
- package/dist/server/lib/overlay-trigger-timing.js +1 -1
- package/dist/server/lib/responsive-exit.js +1 -1
- package/dist/server/lib/search-filter.js +1 -1
- package/dist/server/lib/side-panel.js +1 -1
- package/dist/server/lib/split-pane.js +1 -1
- package/dist/server/lib/table-column-motion.js +1 -1
- package/dist/server/lib/table-context.d.ts +5 -0
- package/dist/server/lib/table-context.js +4 -1
- package/dist/server/lib/table-responsive.d.ts +1 -1
- package/dist/server/lib/table-responsive.js +40 -8
- package/dist/server/lib/table-selection-fade.js +1 -1
- package/dist/server/lib/table-truncation.js +1 -1
- package/dist/server/lib/text-motion/animation.js +1 -1
- package/dist/server/lib/text-motion/character.js +1 -1
- package/dist/server/lib/text-motion/color.js +1 -1
- package/dist/server/lib/text-motion/layout.js +1 -1
- package/dist/server/lib/text-motion/preference.js +1 -1
- package/dist/server/lib/text-motion/sequence.js +1 -1
- package/dist/server/lib/text-motion/typography.js +1 -1
- package/dist/server/lib/tooltip-delay.js +1 -1
- package/dist/server/lib/tooltip-motion-dismiss.js +1 -1
- package/dist/server/lib/tooltip-pointer-speed.js +1 -1
- package/dist/server/lib/truncate.js +1 -1
- package/dist/server/logic/frame-field-control.js +1 -1
- package/dist/server/logic/frame-motion-defaults.js +1 -1
- package/dist/server/logic/frame-prop-filter.js +1 -1
- package/dist/server/logic/geometry-cache.js +1 -1
- package/dist/server/logic/layout-flip.js +1 -1
- package/dist/server/logic/morph.js +1 -1
- package/dist/server/logic/motion-engine.js +1 -1
- package/dist/server/logic/motion-orchestration.js +1 -1
- package/dist/server/logic/motion-types.js +1 -1
- package/dist/server/logic/overflow-actions.d.ts +8 -0
- package/dist/server/logic/overflow-actions.js +5 -0
- package/dist/server/logic/wc-adapter.js +1 -1
- package/dist/server/motion/bridge.js +1 -1
- package/dist/server/motion/content-crossfade.js +1 -1
- package/dist/server/motion/expand.js +1 -1
- package/dist/server/motion/fade-in.js +1 -1
- package/dist/server/motion/fade-out.js +1 -1
- package/dist/server/motion/morph.js +1 -1
- package/dist/server/motion/move.js +1 -1
- package/dist/server/motion/number.js +1 -1
- package/dist/server/motion/replace.js +1 -1
- package/dist/server/motion/rotate.css +1 -1
- package/dist/server/motion/rotate.js +1 -1
- package/dist/server/motion/scale-in.js +1 -1
- package/dist/server/motion/tokens.js +1 -1
- package/dist/server/motion/while-2xl.js +1 -1
- package/dist/server/motion/while-active.js +1 -1
- package/dist/server/motion/while-appear.js +1 -1
- package/dist/server/motion/while-click.js +1 -1
- package/dist/server/motion/while-collapsed.js +1 -1
- package/dist/server/motion/while-disabled.js +1 -1
- package/dist/server/motion/while-disappear.js +1 -1
- package/dist/server/motion/while-drag.js +1 -1
- package/dist/server/motion/while-editing.js +1 -1
- package/dist/server/motion/while-expanded.js +1 -1
- package/dist/server/motion/while-focus.js +1 -1
- package/dist/server/motion/while-hover.js +1 -1
- package/dist/server/motion/while-idle.js +1 -1
- package/dist/server/motion/while-key.js +1 -1
- package/dist/server/motion/while-lg.js +1 -1
- package/dist/server/motion/while-load.js +1 -1
- package/dist/server/motion/while-md.js +1 -1
- package/dist/server/motion/while-reload.js +1 -1
- package/dist/server/motion/while-scroll.js +1 -1
- package/dist/server/motion/while-sm.js +1 -1
- package/dist/server/motion/while-uploading.js +1 -1
- package/dist/server/motion/while-validating.js +1 -1
- package/dist/server/motion/while-xl.js +1 -1
- package/dist/server/motion/while-xs.js +1 -1
- package/dist/server/styles/auto-layout.css +1 -1
- package/dist/server/styles/backdrop.css +1 -1
- package/dist/server/styles/components.css +7 -1
- package/dist/server/styles/index.css +1 -1
- package/dist/server/styles/layout.css +13 -3
- package/dist/server/styles/scale.css +1 -1
- package/dist/server/styles/scrollbar.css +1 -1
- package/dist/server/styles/tokens.css +1 -1
- package/dist/server/vite-env.d.ts +1 -1
- package/llms.txt +3 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'svelte/internal/disclose-version';
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
4
|
import { AdaptiveContrastMask } from "../lib/adaptive-contrast-renderer.js";
|
|
4
5
|
import { getAdaptiveContrastColor, isAdaptiveContrastMonochrome } from "../lib/adaptive-contrast.js";
|
|
5
6
|
import { getContext, onDestroy, onMount, tick } from "svelte";
|
|
@@ -147,7 +148,7 @@ var root_13 = $.from_svg(`<g class="snowui-line-chart-guides"></g>`);
|
|
|
147
148
|
var root_14 = $.from_svg(`<path class="snowui-line-chart-series-contrast" fill="none" stroke-linecap="round" stroke-linejoin="round"></path>`);
|
|
148
149
|
var root_15 = $.from_svg(`<path class="snowui-line-chart-series" fill="none" stroke-linecap="round" stroke-linejoin="round"></path><!>`, 1);
|
|
149
150
|
var root_16 = $.from_svg(`<rect class="snowui-line-chart-cell-hit-area" fill="transparent" tabindex="0" role="button"></rect>`);
|
|
150
|
-
var root_17 = $.from_svg(`<g class="snowui-line-chart-cell-hit-layer" role="group"
|
|
151
|
+
var root_17 = $.from_svg(`<g class="snowui-line-chart-cell-hit-layer" role="group"></g>`);
|
|
151
152
|
var root_18 = $.from_svg(`<g class="snowui-line-chart-marker-visual"><circle class="snowui-line-chart-marker-lower"></circle><circle class="snowui-line-chart-marker-upper"></circle></g>`);
|
|
152
153
|
var root_19 = $.from_svg(`<!><!>`, 1);
|
|
153
154
|
var root_20 = $.from_svg(`<foreignObject pointer-events="none" overflow="visible"><!></foreignObject>`);
|
|
@@ -165,6 +166,8 @@ export default function LineChart($$anchor, $$props) {
|
|
|
165
166
|
$.push($$props, true);
|
|
166
167
|
$.append_styles($$anchor, $$css);
|
|
167
168
|
|
|
169
|
+
const localeContext = useLocale();
|
|
170
|
+
|
|
168
171
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
169
172
|
const DEFAULT_BOUNDS = {
|
|
170
173
|
top: 0,
|
|
@@ -1497,6 +1500,7 @@ export default function LineChart($$anchor, $$props) {
|
|
|
1497
1500
|
|
|
1498
1501
|
{
|
|
1499
1502
|
let $0 = $.derived(() => ["snowui-line-chart", userClass()].filter(Boolean).join(" "));
|
|
1503
|
+
let $1 = $.derived(() => localeContext.t("lineChart.name"));
|
|
1500
1504
|
|
|
1501
1505
|
Frame($$anchor, $.spread_props(
|
|
1502
1506
|
{
|
|
@@ -1508,7 +1512,9 @@ export default function LineChart($$anchor, $$props) {
|
|
|
1508
1512
|
return $.get(rootStyle);
|
|
1509
1513
|
},
|
|
1510
1514
|
role: 'group',
|
|
1511
|
-
'aria-label'
|
|
1515
|
+
get 'aria-label'() {
|
|
1516
|
+
return $.get($1);
|
|
1517
|
+
}
|
|
1512
1518
|
},
|
|
1513
1519
|
() => rest,
|
|
1514
1520
|
{
|
|
@@ -2012,6 +2018,7 @@ export default function LineChart($$anchor, $$props) {
|
|
|
2012
2018
|
});
|
|
2013
2019
|
|
|
2014
2020
|
$.reset(g_7);
|
|
2021
|
+
$.template_effect(($0) => $.set_attribute(g_7, 'aria-label', $0), [() => localeContext.t("lineChart.cells")]);
|
|
2015
2022
|
$.event('pointerleave', g_7, () => hideCellHover($.get(effectiveActiveCellIndex) ?? -1));
|
|
2016
2023
|
$.append($$anchor, g_7);
|
|
2017
2024
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'svelte/internal/disclose-version';
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
4
|
import { tick, setContext } from "svelte";
|
|
4
5
|
import Frame from "./Frame.js";
|
|
5
6
|
import Input from "./Input.js";
|
|
@@ -51,8 +52,9 @@ export default function Listbox($$anchor, $$props) {
|
|
|
51
52
|
/** 浮层相对锚点的水平对齐方式。 */
|
|
52
53
|
/** 是否为选中项预留并显示勾选图标。 */
|
|
53
54
|
/** 选项间是否使用容器级连续 hover 背景。 */
|
|
54
|
-
const
|
|
55
|
+
const localeContext = useLocale();
|
|
55
56
|
|
|
57
|
+
const inheritedListboxPart = useComponentPart("Listbox");
|
|
56
58
|
let explicitProps = $.rest_props($$props, rest_excludes);
|
|
57
59
|
|
|
58
60
|
let $$d = $.derived(() => mergeComponentPartProps(inheritedListboxPart.current, explicitProps)),
|
|
@@ -99,7 +101,7 @@ export default function Listbox($$anchor, $$props) {
|
|
|
99
101
|
|
|
100
102
|
const resolvedParts = $.derived(() => ({
|
|
101
103
|
...$.get(parts),
|
|
102
|
-
Input: {
|
|
104
|
+
Input: { ...$.get(parts)?.Input },
|
|
103
105
|
MenuItem: { showCheck: $.get(showCheck), ...$.get(parts)?.MenuItem }
|
|
104
106
|
}));
|
|
105
107
|
|
|
@@ -459,9 +461,30 @@ export default function Listbox($$anchor, $$props) {
|
|
|
459
461
|
return () => document.removeEventListener("pointerdown", handler, true);
|
|
460
462
|
});
|
|
461
463
|
|
|
464
|
+
// 搜索头与列表共享关闭键;搜索头的其他按键继续交给原生输入框。
|
|
465
|
+
function handleDismissKeydown(e) {
|
|
466
|
+
if (!owner || e.defaultPrevented) return false;
|
|
467
|
+
|
|
468
|
+
if (e.key === "Escape") {
|
|
469
|
+
e.preventDefault();
|
|
470
|
+
owner.setOpen(false);
|
|
471
|
+
owner.triggerEl?.focus();
|
|
472
|
+
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
if (e.key === "Tab") {
|
|
477
|
+
owner.setOpen(false);
|
|
478
|
+
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
|
|
462
485
|
// 键盘导航
|
|
463
486
|
function handleKeydown(e) {
|
|
464
|
-
if (!owner) return;
|
|
487
|
+
if (handleDismissKeydown(e) || !owner) return;
|
|
465
488
|
|
|
466
489
|
const opts = [...owner.options, ...owner.customOptions];
|
|
467
490
|
const len = opts.length;
|
|
@@ -497,16 +520,6 @@ export default function Listbox($$anchor, $$props) {
|
|
|
497
520
|
owner.selectOption(opts[owner.activeIndex].value);
|
|
498
521
|
}
|
|
499
522
|
break;
|
|
500
|
-
|
|
501
|
-
case "Escape":
|
|
502
|
-
e.preventDefault();
|
|
503
|
-
owner.setOpen(false);
|
|
504
|
-
owner.triggerEl?.focus();
|
|
505
|
-
break;
|
|
506
|
-
|
|
507
|
-
case "Tab":
|
|
508
|
-
owner.setOpen(false);
|
|
509
|
-
break;
|
|
510
523
|
}
|
|
511
524
|
}
|
|
512
525
|
|
|
@@ -574,7 +587,19 @@ export default function Listbox($$anchor, $$props) {
|
|
|
574
587
|
|
|
575
588
|
{
|
|
576
589
|
var consequent = ($$anchor) => {
|
|
577
|
-
|
|
590
|
+
{
|
|
591
|
+
let $0 = $.derived(() => localeContext.t("listbox.search"));
|
|
592
|
+
|
|
593
|
+
Input($$anchor, $.spread_props(
|
|
594
|
+
{
|
|
595
|
+
get placeholder() {
|
|
596
|
+
return $.get($0);
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
() => $.get(resolvedParts).Input,
|
|
600
|
+
{ as: 'search' }
|
|
601
|
+
));
|
|
602
|
+
}
|
|
578
603
|
};
|
|
579
604
|
|
|
580
605
|
$.if(node_3, ($$render) => {
|
|
@@ -763,6 +788,7 @@ export default function Listbox($$anchor, $$props) {
|
|
|
763
788
|
}
|
|
764
789
|
|
|
765
790
|
$.reset(div_2);
|
|
791
|
+
$.delegated('keydown', div_1, handleDismissKeydown);
|
|
766
792
|
$.append($$anchor, fragment_1);
|
|
767
793
|
},
|
|
768
794
|
$$slots: { default: true }
|
|
@@ -852,4 +878,6 @@ export default function Listbox($$anchor, $$props) {
|
|
|
852
878
|
|
|
853
879
|
$.append($$anchor, fragment);
|
|
854
880
|
$.pop();
|
|
855
|
-
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
$.delegate(['keydown']);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'svelte/internal/disclose-version';
|
|
2
2
|
import * as $ from 'svelte/internal/client';
|
|
3
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
4
|
import Button from "./Button.js";
|
|
4
5
|
import { onMount } from "svelte";
|
|
5
6
|
import { ComponentIcon } from "../internal/component-icon/index.js";
|
|
@@ -22,6 +23,8 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
22
23
|
$.append_styles($$anchor, $$css);
|
|
23
24
|
|
|
24
25
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
26
|
+
const localeContext = useLocale();
|
|
27
|
+
|
|
25
28
|
/** 内置图标按钮配置;事件与角色由所属组件控制。 */
|
|
26
29
|
/** 选项值(在 Listbox 内使用时必填,同一 Listbox 内必须唯一) */
|
|
27
30
|
/** 是否选中(独立使用时有效;Listbox 内由 context 覆盖) */
|
|
@@ -303,6 +306,7 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
303
306
|
var consequent_2 = ($$anchor) => {
|
|
304
307
|
{
|
|
305
308
|
let $0 = $.derived(() => `snowui-clear-icon-btn snowui-menu-item-delete snowui-menu-item-check${$.get(parts)?.Button?.class ? ` ${$.get(parts).Button.class}` : ""}`);
|
|
309
|
+
let $1 = $.derived(() => localeContext.t("menuItem.deleteCustom"));
|
|
306
310
|
|
|
307
311
|
Button($$anchor, $.spread_props({ bare: true, emphasis: 'muted', size: 'sm' }, () => $.get(parts)?.Button, {
|
|
308
312
|
type: 'button',
|
|
@@ -310,7 +314,9 @@ export default function MenuItem($$anchor, $$props) {
|
|
|
310
314
|
return $.get($0);
|
|
311
315
|
},
|
|
312
316
|
as: 'trailing',
|
|
313
|
-
'aria-label'
|
|
317
|
+
get 'aria-label'() {
|
|
318
|
+
return $.get($1);
|
|
319
|
+
},
|
|
314
320
|
onclick: handleDelete,
|
|
315
321
|
onmousedown: handleMousedown,
|
|
316
322
|
tabindex: -1,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Snippet } from "svelte";
|
|
2
|
+
import { type FrameProps } from "./Frame.js";
|
|
3
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
export type OTPLength = 4 | 5 | 6 | 7 | 8;
|
|
5
|
+
interface Props extends Omit<FrameProps, "tag" | "children" | "enableScaleObserver" | "oninput" | "onchange" | "onfocus" | "onblur" | "onkeydown" | "onpaste"> {
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
length?: OTPLength;
|
|
9
|
+
name?: string;
|
|
10
|
+
form?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
autocomplete?: HTMLInputAttributes["autocomplete"];
|
|
15
|
+
autofocus?: boolean;
|
|
16
|
+
tabindex?: number;
|
|
17
|
+
id?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
invalid?: boolean;
|
|
20
|
+
error?: string | Snippet;
|
|
21
|
+
oncomplete?: (value: string) => void;
|
|
22
|
+
oninput?: (event: Event) => void;
|
|
23
|
+
onchange?: (event: Event) => void;
|
|
24
|
+
onfocus?: (event: FocusEvent) => void;
|
|
25
|
+
onblur?: (event: FocusEvent) => void;
|
|
26
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
27
|
+
onpaste?: (event: ClipboardEvent) => void;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
declare const OTPInput: import("svelte").Component<Props, {}, "value">;
|
|
31
|
+
type OTPInput = ReturnType<typeof OTPInput>;
|
|
32
|
+
export default OTPInput;
|