@snowui-design-system/components 0.3.0-alpha.2 → 0.3.0-alpha.3
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/dist/client/blocks/Sidebar.js +56 -41
- package/dist/client/blocks/SidebarSection.js +3 -1
- package/dist/client/components/BarChart.js +1 -1
- package/dist/client/components/Breadcrumb.js +17 -11
- package/dist/client/components/CircularChart.js +2 -2
- package/dist/client/components/CodeBlock.js +278 -225
- package/dist/client/components/CopyButton.js +5 -2
- package/dist/client/components/ExpandButton.js +10 -3
- package/dist/client/components/Frame.js +15 -9
- package/dist/client/components/GaugeChart.js +2 -2
- package/dist/client/components/ImageViewer.js +51 -27
- package/dist/client/components/Indicator.js +5 -3
- package/dist/client/components/Input.js +27 -17
- package/dist/client/components/LineChart.js +1 -1
- package/dist/client/components/Link.d.ts +1 -1
- package/dist/client/components/Link.js +43 -22
- package/dist/client/components/Listbox.js +26 -15
- package/dist/client/components/OverflowAction.d.ts +2 -0
- package/dist/client/components/OverflowAction.js +146 -65
- package/dist/client/components/OverflowActions.d.ts +2 -0
- package/dist/client/components/OverflowActions.js +67 -16
- package/dist/client/components/Pagination.js +71 -48
- package/dist/client/components/Select.js +29 -18
- package/dist/client/components/SidePanel.js +76 -50
- package/dist/client/components/Tab.js +30 -31
- package/dist/client/components/TableBody.js +10 -4
- package/dist/client/components/TableCell.js +57 -32
- package/dist/client/components/TableHead.js +69 -38
- package/dist/client/components/TableToolbar.js +112 -79
- package/dist/client/components/Text.js +99 -59
- package/dist/client/components/Textarea.js +7 -1
- package/dist/client/components/Toast.js +8 -1
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +114 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/lib/number-format.js +6 -0
- package/dist/client/lib/progressive-blur.d.ts +13 -0
- package/dist/client/lib/progressive-blur.js +54 -0
- package/dist/client/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/client/logic/ComponentPartsBoundary.js +15 -0
- package/dist/client/logic/overflow-actions.d.ts +3 -2
- package/dist/client/styles/layout.css +12 -2
- package/dist/server/blocks/Sidebar.js +19 -5
- package/dist/server/blocks/SidebarSection.js +3 -1
- package/dist/server/components/BarChart.js +1 -1
- package/dist/server/components/Breadcrumb.js +9 -2
- package/dist/server/components/CircularChart.js +2 -2
- package/dist/server/components/CodeBlock.js +25 -13
- package/dist/server/components/CopyButton.js +6 -2
- package/dist/server/components/ExpandButton.js +7 -3
- package/dist/server/components/Frame.js +10 -3
- package/dist/server/components/GaugeChart.js +2 -2
- package/dist/server/components/ImageViewer.js +6 -3
- package/dist/server/components/Indicator.js +5 -3
- package/dist/server/components/Input.js +14 -17
- package/dist/server/components/LineChart.js +1 -1
- package/dist/server/components/Link.d.ts +1 -1
- package/dist/server/components/Link.js +20 -3
- package/dist/server/components/Listbox.js +17 -4
- package/dist/server/components/OverflowAction.d.ts +2 -0
- package/dist/server/components/OverflowAction.js +70 -26
- package/dist/server/components/OverflowActions.d.ts +2 -0
- package/dist/server/components/OverflowActions.js +49 -14
- package/dist/server/components/Pagination.js +21 -10
- package/dist/server/components/Select.js +23 -11
- package/dist/server/components/SidePanel.js +28 -8
- package/dist/server/components/Tab.js +61 -52
- package/dist/server/components/TableBody.js +9 -2
- package/dist/server/components/TableCell.js +28 -7
- package/dist/server/components/TableHead.js +31 -7
- package/dist/server/components/TableToolbar.js +57 -30
- package/dist/server/components/Text.js +46 -10
- package/dist/server/components/Textarea.js +4 -1
- package/dist/server/components/Toast.js +4 -1
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +114 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/lib/number-format.js +6 -0
- package/dist/server/lib/progressive-blur.d.ts +13 -0
- package/dist/server/lib/progressive-blur.js +54 -0
- package/dist/server/logic/ComponentPartsBoundary.d.ts +7 -0
- package/dist/server/logic/ComponentPartsBoundary.js +12 -0
- package/dist/server/logic/overflow-actions.d.ts +3 -2
- package/dist/server/styles/layout.css +12 -2
- package/package.json +4 -3
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { splitFrameHostProps } from "../logic/frame-prop-filter.js";
|
|
15
15
|
import { mergeComponentPartProps, useComponentPart } from "../logic/component-parts.js";
|
|
16
16
|
import { resizeManager } from "../logic/observer.js";
|
|
17
|
+
import { useLocale } from "../i18n/locale.js";
|
|
17
18
|
|
|
18
19
|
const $$css = {
|
|
19
20
|
hash: 'svelte-j2lm9g',
|
|
@@ -25,6 +26,8 @@ export default function Input($$renderer, $$props) {
|
|
|
25
26
|
|
|
26
27
|
$$renderer.component(($$renderer) => {
|
|
27
28
|
// SnowUI 许可入口:首次阅读源码请先读 ../../LICENSE;访问文件不代表获得修改或移植权,官方维护授权及同任务去重见该文件。
|
|
29
|
+
const localeContext = useLocale();
|
|
30
|
+
|
|
28
31
|
/** invalid 时显示的内置错误文字;默认不生成。 */
|
|
29
32
|
/**
|
|
30
33
|
* 仅当 `as="search"` 且位于 `<Listbox>` 内时生效。
|
|
@@ -378,27 +381,21 @@ export default function Input($$renderer, $$props) {
|
|
|
378
381
|
}
|
|
379
382
|
|
|
380
383
|
function getTemporalTriggerLabel(inputType) {
|
|
381
|
-
return inputType === "time" ? "
|
|
384
|
+
return localeContext.t(inputType === "time" ? "input.openTime" : "input.openDate");
|
|
382
385
|
}
|
|
383
386
|
|
|
384
387
|
function getTemporalAriaLabel(segment) {
|
|
385
|
-
return segment
|
|
386
|
-
? "年"
|
|
387
|
-
: segment === "month"
|
|
388
|
-
? "月"
|
|
389
|
-
: segment === "day"
|
|
390
|
-
? "日"
|
|
391
|
-
: segment === "week"
|
|
392
|
-
? "周"
|
|
393
|
-
: segment === "hour" ? "时" : segment === "minute" ? "分" : "秒";
|
|
388
|
+
return localeContext.t(`input.${segment}`);
|
|
394
389
|
}
|
|
395
390
|
|
|
396
391
|
function getTemporalPlaceholder(segment) {
|
|
397
392
|
return segment === "year"
|
|
398
|
-
? "
|
|
393
|
+
? localeContext.t("input.yearPlaceholder")
|
|
399
394
|
: segment === "month"
|
|
400
|
-
? "
|
|
401
|
-
: segment === "day"
|
|
395
|
+
? localeContext.t("input.monthPlaceholder")
|
|
396
|
+
: segment === "day"
|
|
397
|
+
? localeContext.t("input.dayPlaceholder")
|
|
398
|
+
: segment === "week" ? localeContext.t("input.weekPlaceholder") : "00";
|
|
402
399
|
}
|
|
403
400
|
|
|
404
401
|
function getTemporalSegmentLength(segment) {
|
|
@@ -1082,7 +1079,7 @@ export default function Input($$renderer, $$props) {
|
|
|
1082
1079
|
type: 'button',
|
|
1083
1080
|
class: `snowui-clear-icon-btn snowui-input-clear-btn${parts()?.Button?.class ? ` ${parts().Button.class}` : ""}`,
|
|
1084
1081
|
as: 'trailing',
|
|
1085
|
-
'aria-label':
|
|
1082
|
+
'aria-label': localeContext.t("input.clear"),
|
|
1086
1083
|
onclick: handleClear,
|
|
1087
1084
|
onmousedown: (e) => e.preventDefault(),
|
|
1088
1085
|
tabindex: -1,
|
|
@@ -1310,7 +1307,7 @@ export default function Input($$renderer, $$props) {
|
|
|
1310
1307
|
type: 'button',
|
|
1311
1308
|
class: `snowui-input-stepper-btn${parts()?.Button?.class ? ` ${parts().Button.class}` : ""}`,
|
|
1312
1309
|
as: 'up',
|
|
1313
|
-
'aria-label':
|
|
1310
|
+
'aria-label': localeContext.t("input.increment"),
|
|
1314
1311
|
disabled: stepUpDisabled(),
|
|
1315
1312
|
onclick: handleStepUp,
|
|
1316
1313
|
onmousedown: (e) => e.preventDefault(),
|
|
@@ -1336,7 +1333,7 @@ export default function Input($$renderer, $$props) {
|
|
|
1336
1333
|
type: 'button',
|
|
1337
1334
|
class: `snowui-input-stepper-btn${parts()?.Button?.class ? ` ${parts().Button.class}` : ""}`,
|
|
1338
1335
|
as: 'down',
|
|
1339
|
-
'aria-label':
|
|
1336
|
+
'aria-label': localeContext.t("input.decrement"),
|
|
1340
1337
|
disabled: stepDownDisabled(),
|
|
1341
1338
|
onclick: handleStepDown,
|
|
1342
1339
|
onmousedown: (e) => e.preventDefault(),
|
|
@@ -1385,7 +1382,7 @@ export default function Input($$renderer, $$props) {
|
|
|
1385
1382
|
type: 'button',
|
|
1386
1383
|
class: `snowui-clear-icon-btn snowui-input-clear-btn${parts()?.Button?.class ? ` ${parts().Button.class}` : ""}`,
|
|
1387
1384
|
as: 'trailing',
|
|
1388
|
-
'aria-label':
|
|
1385
|
+
'aria-label': localeContext.t("input.clear"),
|
|
1389
1386
|
onclick: handleClear,
|
|
1390
1387
|
onmousedown: (e) => e.preventDefault(),
|
|
1391
1388
|
tabindex: -1,
|
|
@@ -4,7 +4,7 @@ import Tooltip from "./Tooltip.js";
|
|
|
4
4
|
import { type SnowUIColor } from "../lib/color";
|
|
5
5
|
import type { ComponentPartsOf } from "../logic/component-parts.js";
|
|
6
6
|
type LinkVariant = "default" | "arrow" | "external";
|
|
7
|
-
type LinkUnderline = "none" | "always" | "hover";
|
|
7
|
+
type LinkUnderline = "none" | "always" | "hover" | "until-hover";
|
|
8
8
|
type TooltipProp = boolean | string | Snippet | Record<string, any>;
|
|
9
9
|
interface Props extends Omit<FrameProps, "children" | "tag"> {
|
|
10
10
|
variant?: LinkVariant;
|
|
@@ -5,10 +5,11 @@ import Tooltip from "./Tooltip.js";
|
|
|
5
5
|
import { resolveSnowUIColor } from "../lib/color.js";
|
|
6
6
|
import { fitTextToElement, measureTextForElement } from "../lib/truncate.js";
|
|
7
7
|
import { TruncationController } from "../logic/frame-truncation.js";
|
|
8
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
8
9
|
|
|
9
10
|
const $$css = {
|
|
10
11
|
hash: 'svelte-96nnl8',
|
|
11
|
-
code: ':where(.snowui-link) {--snowui-link-font-size: var(--text-14);--snowui-link-line-height: var(--leading-14);--snowui-link-gap: calc(var(--gap-1) / 2);--snowui-link-icon-size: var(--size-3);--snowui-link-color: var(--black-40, #00000066);--snowui-link-hover-color: var(--black-100, #000000ff);--snowui-link-decoration-opacity: var(--snowui-state-opacity, 0.4);--snowui-link-decoration-hover-opacity: var(--snowui-state-opacity, 1);color:var(--snowui-link-color-override, var(--snowui-link-color));text-decoration:none;width:fit-content;max-width:100%;gap:var(--snowui-link-gap-override, var(--snowui-link-gap));font-size:var(\n --snowui-link-font-size-override,\n var(--snowui-link-font-size)\n );line-height:var(\n --snowui-link-line-height-override,\n var(--snowui-link-line-height)\n );cursor:var(--snowui-state-cursor, pointer);--snowui-frame-component-transition:\n color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link)[data-auto-layout] {gap:var(--snowui-link-gap-override, var(--snowui-link-gap));}:where(.snowui-link):hover:not(.snowui-disabled),\n :where(.snowui-link):active:not(.snowui-disabled) {color:var(--snowui-link-hover-color);}:where(.snowui-link):focus-visible {outline:var(--border-1) solid currentColor;outline-offset:var(--border-2);}:where(.snowui-link-content) {min-width:0;max-width:100%;}:where(.snowui-link)[data-lines="1"] > .snowui-link-content {width:var(--snowui-link-truncated-content-width, auto);overflow:hidden;}:where(.snowui-link)[data-lines="1"] {width:fit-content;}:where(.snowui-link-label) {min-width:0;max-width:100%;}:where(.snowui-link-label)[data-lines="1"] {display:grid;grid-template-columns:minmax(0, 1fr);}:where(.snowui-link-label-text) {display:block;min-width:0;max-width:100%;text-decoration-line:none;text-decoration-color:currentColor;}:where(.snowui-link-label)[data-lines="1"] > .snowui-link-label-text {grid-column:1;grid-row:1;overflow:hidden;text-overflow:clip;white-space:nowrap;}:where(.snowui-link-label-measure) {visibility:hidden;}:where(.snowui-link-label-visible) {grid-column:1;grid-row:1;min-width:0;overflow:hidden;white-space:nowrap;}:where(.snowui-link-ellipsis) {text-decoration:none;}:where(.snowui-link)[data-underline="always"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="always"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible,\n :where(.snowui-link)[data-underline="hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible {text-decoration-line:underline;}:where(.snowui-link > [data-as="leading"]),\n :where(.snowui-link > [data-as="trailing"]) {display:inline-flex;align-items:inherit;text-decoration:none;}:where(.snowui-link > [data-as="trailing"]:not(.snowui-link-default-trailing)) {color:currentColor;opacity:var(\n --snowui-link-decoration-opacity-override,\n var(--snowui-link-decoration-opacity)\n );text-decoration:none;transition:opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link-default-trailing) {display:inline-flex;flex-shrink:0;color:currentColor;opacity:var(\n --snowui-link-decoration-opacity-override,\n var(--snowui-link-decoration-opacity)\n );text-decoration:none;transition:opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link):hover:not(.snowui-disabled) > .snowui-link-default-trailing,\n :where(.snowui-link):active:not(.snowui-disabled) > .snowui-link-default-trailing,\n :where(.snowui-link):hover:not(.snowui-disabled) > [data-as="trailing"]:not(.snowui-link-default-trailing),\n :where(.snowui-link):active:not(.snowui-disabled) > [data-as="trailing"]:not(.snowui-link-default-trailing) {opacity:var(\n --snowui-link-decoration-hover-opacity-override,\n var(--snowui-link-decoration-hover-opacity)\n );}:where(.snowui-link-default-icon) {--snowui-icon-size-override: var(\n --snowui-link-icon-size-override,\n var(--snowui-link-icon-size)\n );}'
|
|
12
|
+
code: ':where(.snowui-link) {--snowui-link-font-size: var(--text-14);--snowui-link-line-height: var(--leading-14);--snowui-link-gap: calc(var(--gap-1) / 2);--snowui-link-icon-size: var(--size-3);--snowui-link-color: var(--black-40, #00000066);--snowui-link-hover-color: var(--black-100, #000000ff);--snowui-link-decoration-opacity: var(--snowui-state-opacity, 0.4);--snowui-link-decoration-hover-opacity: var(--snowui-state-opacity, 1);color:var(--snowui-link-color-override, var(--snowui-link-color));text-decoration:none;width:fit-content;max-width:100%;gap:var(--snowui-link-gap-override, var(--snowui-link-gap));font-size:var(\n --snowui-link-font-size-override,\n var(--snowui-link-font-size)\n );line-height:var(\n --snowui-link-line-height-override,\n var(--snowui-link-line-height)\n );cursor:var(--snowui-state-cursor, pointer);--snowui-frame-component-transition:\n color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link)[data-auto-layout] {gap:var(--snowui-link-gap-override, var(--snowui-link-gap));}:where(.snowui-link):hover:not(.snowui-disabled),\n :where(.snowui-link):active:not(.snowui-disabled) {color:var(--snowui-link-hover-color);}:where(.snowui-link):focus-visible {outline:var(--border-1) solid currentColor;outline-offset:var(--border-2);}:where(.snowui-link-content) {min-width:0;max-width:100%;}:where(.snowui-link)[data-lines="1"] > .snowui-link-content {width:var(--snowui-link-truncated-content-width, auto);overflow:hidden;}:where(.snowui-link)[data-lines="1"] {width:fit-content;}:where(.snowui-link-label) {min-width:0;max-width:100%;}:where(.snowui-link-label)[data-lines="1"] {display:grid;grid-template-columns:minmax(0, 1fr);}:where(.snowui-link-label-text) {display:block;min-width:0;max-width:100%;text-decoration-line:none;text-decoration-color:currentColor;}:where(.snowui-link-label)[data-lines="1"] > .snowui-link-label-text {grid-column:1;grid-row:1;overflow:hidden;text-overflow:clip;white-space:nowrap;}:where(.snowui-link-label-measure) {visibility:hidden;}:where(.snowui-link-label-visible) {grid-column:1;grid-row:1;min-width:0;overflow:hidden;white-space:nowrap;}:where(.snowui-link-ellipsis) {text-decoration:none;}:where(.snowui-link)[data-underline="always"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="always"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible,\n :where(.snowui-link)[data-underline="until-hover"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="until-hover"] > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible,\n :where(.snowui-link)[data-underline="hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible {text-decoration-line:underline;}:where(.snowui-link)[data-underline="until-hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-text,\n :where(.snowui-link)[data-underline="until-hover"]:hover:not(.snowui-disabled) > .snowui-link-content > .snowui-link-label > .snowui-link-label-visible {text-decoration-line:none;}:where(.snowui-link > [data-as="leading"]),\n :where(.snowui-link > [data-as="trailing"]) {display:inline-flex;align-items:inherit;text-decoration:none;}:where(.snowui-link > [data-as="trailing"]:not(.snowui-link-default-trailing)) {color:currentColor;opacity:var(\n --snowui-link-decoration-opacity-override,\n var(--snowui-link-decoration-opacity)\n );text-decoration:none;transition:opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link-default-trailing) {display:inline-flex;flex-shrink:0;color:currentColor;opacity:var(\n --snowui-link-decoration-opacity-override,\n var(--snowui-link-decoration-opacity)\n );text-decoration:none;transition:opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-link):hover:not(.snowui-disabled) > .snowui-link-default-trailing,\n :where(.snowui-link):active:not(.snowui-disabled) > .snowui-link-default-trailing,\n :where(.snowui-link):hover:not(.snowui-disabled) > [data-as="trailing"]:not(.snowui-link-default-trailing),\n :where(.snowui-link):active:not(.snowui-disabled) > [data-as="trailing"]:not(.snowui-link-default-trailing) {opacity:var(\n --snowui-link-decoration-hover-opacity-override,\n var(--snowui-link-decoration-hover-opacity)\n );}:where(.snowui-link-default-icon) {--snowui-icon-size-override: var(\n --snowui-link-icon-size-override,\n var(--snowui-link-icon-size)\n );}'
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export default function Link($$renderer, $$props) {
|
|
@@ -181,7 +182,15 @@ export default function Link($$renderer, $$props) {
|
|
|
181
182
|
if (resolvedLines() === 1) {
|
|
182
183
|
$$renderer.push('<!--[0-->');
|
|
183
184
|
$$renderer.push(`<span class="snowui-link-label-text snowui-link-label-measure" aria-hidden="true">`);
|
|
184
|
-
|
|
185
|
+
|
|
186
|
+
ComponentPartsBoundary($$renderer, {
|
|
187
|
+
children: ($$renderer) => {
|
|
188
|
+
children?.($$renderer);
|
|
189
|
+
$$renderer.push(`<!---->`);
|
|
190
|
+
},
|
|
191
|
+
$$slots: { default: true }
|
|
192
|
+
});
|
|
193
|
+
|
|
185
194
|
$$renderer.push(`<!----></span> <span class="snowui-link-label-visible">${$.escape(visibleText())}`);
|
|
186
195
|
|
|
187
196
|
if (truncation.isTruncated) {
|
|
@@ -195,7 +204,15 @@ export default function Link($$renderer, $$props) {
|
|
|
195
204
|
} else {
|
|
196
205
|
$$renderer.push('<!--[-1-->');
|
|
197
206
|
$$renderer.push(`<span class="snowui-link-label-text">`);
|
|
198
|
-
|
|
207
|
+
|
|
208
|
+
ComponentPartsBoundary($$renderer, {
|
|
209
|
+
children: ($$renderer) => {
|
|
210
|
+
children?.($$renderer);
|
|
211
|
+
$$renderer.push(`<!---->`);
|
|
212
|
+
},
|
|
213
|
+
$$slots: { default: true }
|
|
214
|
+
});
|
|
215
|
+
|
|
199
216
|
$$renderer.push(`<!----></span>`);
|
|
200
217
|
}
|
|
201
218
|
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
|
|
18
18
|
import { getMotionTotalDurationMs } from "../motion/presets/utils.js";
|
|
19
19
|
import { mergeComponentPartProps, useComponentPart } from "../logic/component-parts.js";
|
|
20
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
20
21
|
import { ContinuousHoverController } from "../logic/continuous-hover.js";
|
|
21
22
|
import { CONTINUOUS_HOVER_MOTION_STYLE } from "../motion/presets/continuous-hover.js";
|
|
22
23
|
|
|
@@ -455,8 +456,14 @@ export default function Listbox($$renderer, $$props) {
|
|
|
455
456
|
children: ($$renderer) => {
|
|
456
457
|
if (children()) {
|
|
457
458
|
$$renderer.push('<!--[0-->');
|
|
458
|
-
|
|
459
|
-
$$renderer
|
|
459
|
+
|
|
460
|
+
ComponentPartsBoundary($$renderer, {
|
|
461
|
+
children: ($$renderer) => {
|
|
462
|
+
children()($$renderer);
|
|
463
|
+
$$renderer.push(`<!---->`);
|
|
464
|
+
},
|
|
465
|
+
$$slots: { default: true }
|
|
466
|
+
});
|
|
460
467
|
} else {
|
|
461
468
|
$$renderer.push('<!--[-1-->');
|
|
462
469
|
$$renderer.push(`<!--[-->`);
|
|
@@ -525,8 +532,14 @@ export default function Listbox($$renderer, $$props) {
|
|
|
525
532
|
|
|
526
533
|
if (children()) {
|
|
527
534
|
$$renderer.push('<!--[0-->');
|
|
528
|
-
|
|
529
|
-
$$renderer
|
|
535
|
+
|
|
536
|
+
ComponentPartsBoundary($$renderer, {
|
|
537
|
+
children: ($$renderer) => {
|
|
538
|
+
children()($$renderer);
|
|
539
|
+
$$renderer.push(`<!---->`);
|
|
540
|
+
},
|
|
541
|
+
$$slots: { default: true }
|
|
542
|
+
});
|
|
530
543
|
} else {
|
|
531
544
|
$$renderer.push('<!--[-1-->');
|
|
532
545
|
$$renderer.push(`<!--[-->`);
|
|
@@ -10,8 +10,10 @@ interface Props extends Omit<ButtonProps, ControlledButtonKeys> {
|
|
|
10
10
|
icon?: OverflowActionIcon;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
href?: string;
|
|
13
|
+
iconOnly?: boolean;
|
|
13
14
|
onclick?: (event?: MouseEvent) => void;
|
|
14
15
|
children?: Snippet;
|
|
16
|
+
control?: Snippet<[(event?: MouseEvent) => void, boolean]>;
|
|
15
17
|
parts?: ComponentPartsOf<{
|
|
16
18
|
Button: typeof Button;
|
|
17
19
|
}>;
|
|
@@ -8,7 +8,7 @@ import { getOverflowActionsContext } from "../logic/overflow-actions.js";
|
|
|
8
8
|
|
|
9
9
|
const $$css = {
|
|
10
10
|
hash: 'svelte-tc9pz8',
|
|
11
|
-
code: ':where(.snowui-overflow-action-visual) {display:inline-flex;opacity:var(--snowui-responsive-exit-opacity, 1);}\n @media (prefers-reduced-motion: reduce) {:where(.snowui-overflow-action-visual) {opacity:1;}\n }:where(.snowui-overflow-action) {position:relative;display:inline-flex;flex:0 0 auto;min-width:0;font-size:inherit;line-height:inherit;}:where(.snowui-overflow-action
|
|
11
|
+
code: ':where(.snowui-overflow-action-visual) {display:inline-flex;opacity:var(--snowui-responsive-exit-opacity, 1);}\n @media (prefers-reduced-motion: reduce) {:where(.snowui-overflow-action-visual) {opacity:1;}\n }:where(.snowui-overflow-action) {position:relative;display:inline-flex;flex:0 0 auto;min-width:0;font-size:inherit;line-height:inherit;}:where(.snowui-overflow-action-measure) {position:absolute;inset:0 auto auto 0;display:inline-flex;visibility:hidden;pointer-events:none;contain:layout style;white-space:nowrap;}:where(.snowui-overflow-action[data-overflow-mode="hidden"]) {display:none;}'
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export default function OverflowAction($$renderer, $$props) {
|
|
@@ -22,8 +22,10 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
22
22
|
icon = undefined,
|
|
23
23
|
disabled = false,
|
|
24
24
|
href = undefined,
|
|
25
|
+
iconOnly = false,
|
|
25
26
|
onclick = undefined,
|
|
26
27
|
children = undefined,
|
|
28
|
+
control = undefined,
|
|
27
29
|
parts = undefined,
|
|
28
30
|
as = undefined,
|
|
29
31
|
$$slots,
|
|
@@ -34,6 +36,7 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
34
36
|
const owner = getOverflowActionsContext();
|
|
35
37
|
const resolvedButtonProps = $.derived(() => mergeComponentPartProps(mergeComponentPartProps(owner?.buttonProps, parts?.Button ?? {}), rest));
|
|
36
38
|
let rootElement = undefined;
|
|
39
|
+
let visualElement = undefined;
|
|
37
40
|
let fullMeasureElement = undefined;
|
|
38
41
|
let compactMeasureElement = undefined;
|
|
39
42
|
const mode = $.derived(() => owner?.getMode(id) ?? "full");
|
|
@@ -78,12 +81,33 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
78
81
|
return href;
|
|
79
82
|
},
|
|
80
83
|
|
|
84
|
+
get target() {
|
|
85
|
+
return rest.target;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
get rel() {
|
|
89
|
+
return rest.rel;
|
|
90
|
+
},
|
|
91
|
+
|
|
81
92
|
execute(event) {
|
|
82
93
|
onclick?.(event);
|
|
83
94
|
},
|
|
84
95
|
getElement: () => rootElement,
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
getWidth(mode) {
|
|
97
|
+
const hidden = rootElement?.dataset.overflowMode === "hidden";
|
|
98
|
+
|
|
99
|
+
if (hidden && rootElement) rootElement.style.display = "inline-flex";
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const element = control
|
|
103
|
+
? visualElement
|
|
104
|
+
: mode === "compact" ? compactMeasureElement : fullMeasureElement;
|
|
105
|
+
|
|
106
|
+
return element?.getBoundingClientRect().width ?? 0;
|
|
107
|
+
} finally {
|
|
108
|
+
if (hidden && rootElement) rootElement.style.removeProperty("display");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
87
111
|
});
|
|
88
112
|
});
|
|
89
113
|
|
|
@@ -107,6 +131,9 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
107
131
|
$$renderer.push('<!--[0-->');
|
|
108
132
|
children($$renderer);
|
|
109
133
|
$$renderer.push(`<!---->`);
|
|
134
|
+
} else if (iconOnly) {
|
|
135
|
+
$$renderer.push('<!--[1-->');
|
|
136
|
+
renderIcon($$renderer);
|
|
110
137
|
} else {
|
|
111
138
|
$$renderer.push('<!--[-1-->');
|
|
112
139
|
renderIcon($$renderer);
|
|
@@ -145,10 +172,14 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
145
172
|
},
|
|
146
173
|
|
|
147
174
|
children: ($$renderer) => {
|
|
148
|
-
$$renderer.push(`<span class="snowui-overflow-action-visual">`);
|
|
175
|
+
$$renderer.push(`<span class="snowui-overflow-action-visual"${$.attr_style('', { visibility: mode() === "hidden" ? "hidden" : undefined })}>`);
|
|
149
176
|
|
|
150
|
-
if (
|
|
177
|
+
if (control) {
|
|
151
178
|
$$renderer.push('<!--[0-->');
|
|
179
|
+
control($$renderer, execute, resolvedDisabled());
|
|
180
|
+
$$renderer.push(`<!---->`);
|
|
181
|
+
} else if (mode() === "compact") {
|
|
182
|
+
$$renderer.push('<!--[1-->');
|
|
152
183
|
|
|
153
184
|
Button($$renderer, $.spread_props([
|
|
154
185
|
resolvedButtonProps(),
|
|
@@ -171,6 +202,8 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
171
202
|
Button($$renderer, $.spread_props([
|
|
172
203
|
resolvedButtonProps(),
|
|
173
204
|
{
|
|
205
|
+
iconOnly,
|
|
206
|
+
'aria-label': iconOnly ? label : undefined,
|
|
174
207
|
disabled: resolvedDisabled(),
|
|
175
208
|
href,
|
|
176
209
|
onclick: execute,
|
|
@@ -182,44 +215,55 @@ export default function OverflowAction($$renderer, $$props) {
|
|
|
182
215
|
]));
|
|
183
216
|
}
|
|
184
217
|
|
|
185
|
-
$$renderer.push(`<!--]--></span>
|
|
218
|
+
$$renderer.push(`<!--]--></span> `);
|
|
186
219
|
|
|
187
|
-
|
|
188
|
-
resolvedButtonProps(),
|
|
189
|
-
{
|
|
190
|
-
tabindex: -1,
|
|
191
|
-
children: ($$renderer) => {
|
|
192
|
-
renderFull($$renderer);
|
|
193
|
-
},
|
|
194
|
-
$$slots: { default: true }
|
|
195
|
-
}
|
|
196
|
-
]));
|
|
197
|
-
|
|
198
|
-
$$renderer.push(`<!----></span> `);
|
|
199
|
-
|
|
200
|
-
if (icon) {
|
|
220
|
+
if (!control) {
|
|
201
221
|
$$renderer.push('<!--[0-->');
|
|
202
|
-
$$renderer.push(`<span>`);
|
|
222
|
+
$$renderer.push(`<span class="snowui-overflow-action-measure" aria-hidden="true" inert=""><span>`);
|
|
203
223
|
|
|
204
224
|
Button($$renderer, $.spread_props([
|
|
205
225
|
resolvedButtonProps(),
|
|
206
226
|
{
|
|
207
|
-
iconOnly
|
|
227
|
+
iconOnly,
|
|
228
|
+
'aria-label': iconOnly ? label : undefined,
|
|
208
229
|
tabindex: -1,
|
|
209
|
-
'aria-label': label,
|
|
210
230
|
children: ($$renderer) => {
|
|
211
|
-
|
|
231
|
+
renderFull($$renderer);
|
|
212
232
|
},
|
|
213
233
|
$$slots: { default: true }
|
|
214
234
|
}
|
|
215
235
|
]));
|
|
216
236
|
|
|
217
|
-
$$renderer.push(`<!----></span
|
|
237
|
+
$$renderer.push(`<!----></span> `);
|
|
238
|
+
|
|
239
|
+
if (icon) {
|
|
240
|
+
$$renderer.push('<!--[0-->');
|
|
241
|
+
$$renderer.push(`<span>`);
|
|
242
|
+
|
|
243
|
+
Button($$renderer, $.spread_props([
|
|
244
|
+
resolvedButtonProps(),
|
|
245
|
+
{
|
|
246
|
+
iconOnly: true,
|
|
247
|
+
tabindex: -1,
|
|
248
|
+
'aria-label': label,
|
|
249
|
+
children: ($$renderer) => {
|
|
250
|
+
renderIcon($$renderer);
|
|
251
|
+
},
|
|
252
|
+
$$slots: { default: true }
|
|
253
|
+
}
|
|
254
|
+
]));
|
|
255
|
+
|
|
256
|
+
$$renderer.push(`<!----></span>`);
|
|
257
|
+
} else {
|
|
258
|
+
$$renderer.push('<!--[-1-->');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
$$renderer.push(`<!--]--></span>`);
|
|
218
262
|
} else {
|
|
219
263
|
$$renderer.push('<!--[-1-->');
|
|
220
264
|
}
|
|
221
265
|
|
|
222
|
-
$$renderer.push(`<!--]
|
|
266
|
+
$$renderer.push(`<!--]-->`);
|
|
223
267
|
},
|
|
224
268
|
$$slots: { default: true }
|
|
225
269
|
}
|
|
@@ -13,6 +13,7 @@ import { createResponsiveExit } from "../lib/responsive-exit.js";
|
|
|
13
13
|
import { resizeManager } from "../logic/observer.js";
|
|
14
14
|
import { OVERFLOW_ACTIONS_CONTEXT_KEY } from "../logic/overflow-actions.js";
|
|
15
15
|
import { mergeComponentPartProps } from "../logic/component-parts.js";
|
|
16
|
+
import { useLocale } from "../i18n/locale.js";
|
|
16
17
|
|
|
17
18
|
function renderMenuIcon($$renderer, icon) {
|
|
18
19
|
if (typeof icon === "string") {
|
|
@@ -45,7 +46,7 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
45
46
|
overflow = "all",
|
|
46
47
|
overflowFrom = "end",
|
|
47
48
|
availableWidth = undefined,
|
|
48
|
-
moreLabel =
|
|
49
|
+
moreLabel = undefined,
|
|
49
50
|
align = "end",
|
|
50
51
|
disabled = false,
|
|
51
52
|
buttonProps = undefined,
|
|
@@ -58,10 +59,13 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
58
59
|
...rest
|
|
59
60
|
} = $$props;
|
|
60
61
|
|
|
62
|
+
const locale = useLocale();
|
|
63
|
+
const resolvedMoreLabel = $.derived(() => moreLabel ?? locale.t("overflowActions.more"));
|
|
61
64
|
let rootElement = undefined;
|
|
62
65
|
let moreMeasureElement = undefined;
|
|
63
66
|
let fadeMeasureElement;
|
|
64
67
|
const separatorWidths = new Map();
|
|
68
|
+
const actionWidths = new Map();
|
|
65
69
|
let modes = {};
|
|
66
70
|
let menuEntries = [];
|
|
67
71
|
let hasOverflow = false;
|
|
@@ -128,11 +132,23 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
128
132
|
onAction?.({ id, item, source, originalEvent });
|
|
129
133
|
|
|
130
134
|
if (source === "menu" && action.href && typeof window !== "undefined") {
|
|
131
|
-
|
|
135
|
+
if (action.target && action.target !== "_self") {
|
|
136
|
+
window.open(action.href, action.target, action.rel?.includes("noreferrer") ? "noopener,noreferrer" : "noopener");
|
|
137
|
+
} else {
|
|
138
|
+
window.location.assign(action.href);
|
|
139
|
+
}
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
|
|
135
143
|
function requestLayout() {
|
|
144
|
+
// 内容或 Props 改变时才重新测量;连续拖动只复用固有宽度。
|
|
145
|
+
actionWidths.clear();
|
|
146
|
+
|
|
147
|
+
separatorWidths.clear();
|
|
148
|
+
scheduleLayout();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function scheduleLayout() {
|
|
136
152
|
if (!isMounted || layoutFrame) return;
|
|
137
153
|
|
|
138
154
|
layoutFrame = requestAnimationFrame(() => {
|
|
@@ -209,11 +225,7 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
209
225
|
return separatorWidths.get(entry.element) ?? 0;
|
|
210
226
|
}
|
|
211
227
|
|
|
212
|
-
|
|
213
|
-
? entry.action.getCompactMeasureElement()
|
|
214
|
-
: entry.action.getFullMeasureElement();
|
|
215
|
-
|
|
216
|
-
return element?.getBoundingClientRect().width ?? 0;
|
|
228
|
+
return actionWidths.get(entry.action.id)?.[mode] ?? 0;
|
|
217
229
|
}
|
|
218
230
|
|
|
219
231
|
function totalWidth(entries, mode, includeMore, gap) {
|
|
@@ -234,16 +246,26 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
234
246
|
const actions = entries.filter((entry) => entry.type === "action").map((entry) => entry.action);
|
|
235
247
|
const allIds = new Set(actions.map((action) => action.id));
|
|
236
248
|
const normalizedAll = normalizeEntries(entries, allIds);
|
|
237
|
-
const width = Math.max(0, availableWidth ?? rootElement.getBoundingClientRect().width);
|
|
238
249
|
const computed = getComputedStyle(rootElement);
|
|
250
|
+
|
|
251
|
+
// 与 Table 一样读取小数布局宽度;clientWidth 的整数取整会在临界点往返跳变。
|
|
252
|
+
const width = Math.max(0, availableWidth ?? (Number.parseFloat(computed.width) || rootElement.clientWidth));
|
|
253
|
+
|
|
239
254
|
const gap = Number.parseFloat(computed.columnGap || computed.gap) || 0;
|
|
240
255
|
const canCompact = compact === "auto" && actions.length > 0 && actions.every((action) => !!action.icon);
|
|
241
256
|
|
|
242
|
-
//
|
|
243
|
-
|
|
257
|
+
// 隐藏项只在内容变化后测量一次,避免拖动时反复切换 display 触发布局反馈。
|
|
258
|
+
for (const action of actions) {
|
|
259
|
+
if (!actionWidths.has(action.id)) {
|
|
260
|
+
actionWidths.set(action.id, {
|
|
261
|
+
full: action.getWidth("full"),
|
|
262
|
+
compact: action.getWidth("compact")
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
244
266
|
|
|
245
267
|
for (const entry of entries) {
|
|
246
|
-
if (entry.type !== "separator") continue;
|
|
268
|
+
if (entry.type !== "separator" || separatorWidths.has(entry.element)) continue;
|
|
247
269
|
|
|
248
270
|
const hidden = entry.element.hidden;
|
|
249
271
|
|
|
@@ -361,16 +383,27 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
361
383
|
requestLayout();
|
|
362
384
|
}
|
|
363
385
|
|
|
386
|
+
function handleViewportResize() {
|
|
387
|
+
// 窗口缩放时在下一次绘制前同步求解,观察器随后交付同一宽度也不会重新测量。
|
|
388
|
+
updateLayout();
|
|
389
|
+
}
|
|
390
|
+
|
|
364
391
|
onMount(() => {
|
|
365
392
|
isMounted = true;
|
|
366
393
|
|
|
367
394
|
if (rootElement) movement = createOverflowActionsMotion(rootElement);
|
|
368
395
|
|
|
396
|
+
window.addEventListener('resize', handleViewportResize);
|
|
397
|
+
document.fonts?.addEventListener('loadingdone', requestLayout);
|
|
369
398
|
requestLayout();
|
|
370
399
|
});
|
|
371
400
|
|
|
372
401
|
onDestroy(() => {
|
|
373
402
|
isMounted = false;
|
|
403
|
+
|
|
404
|
+
if (typeof window !== 'undefined') window.removeEventListener('resize', handleViewportResize);
|
|
405
|
+
if (typeof document !== 'undefined') document.fonts?.removeEventListener('loadingdone', requestLayout);
|
|
406
|
+
|
|
374
407
|
movement?.destroy();
|
|
375
408
|
exit.destroy();
|
|
376
409
|
|
|
@@ -433,6 +466,8 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
433
466
|
icon: item.icon,
|
|
434
467
|
disabled: item.disabled,
|
|
435
468
|
href: item.href,
|
|
469
|
+
target: item.target,
|
|
470
|
+
rel: item.rel,
|
|
436
471
|
onclick: item.onAction
|
|
437
472
|
});
|
|
438
473
|
}
|
|
@@ -460,8 +495,8 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
460
495
|
iconOnly: true,
|
|
461
496
|
showIndicator: false,
|
|
462
497
|
selectionMode: 'action',
|
|
463
|
-
ariaLabel:
|
|
464
|
-
title:
|
|
498
|
+
ariaLabel: resolvedMoreLabel(),
|
|
499
|
+
title: resolvedMoreLabel(),
|
|
465
500
|
disabled,
|
|
466
501
|
onAction: handleMenuAction,
|
|
467
502
|
parts: { Listbox: parts?.Listbox, MenuItem: parts?.MenuItem },
|
|
@@ -528,7 +563,7 @@ export default function OverflowActions($$renderer, $$props) {
|
|
|
528
563
|
iconOnly: true,
|
|
529
564
|
showIndicator: false,
|
|
530
565
|
selectionMode: 'action',
|
|
531
|
-
ariaLabel:
|
|
566
|
+
ariaLabel: resolvedMoreLabel(),
|
|
532
567
|
tabindex: -1,
|
|
533
568
|
parts: { Listbox: parts?.Listbox, MenuItem: parts?.MenuItem },
|
|
534
569
|
label,
|
|
@@ -7,6 +7,8 @@ import Listbox from "./Listbox.js";
|
|
|
7
7
|
import MenuItem from "./MenuItem.js";
|
|
8
8
|
import { BUTTON_COLLECTION_CONTEXT_KEY, LISTBOX_OWNER_CONTEXT_KEY } from "../keys.js";
|
|
9
9
|
import { resizeManager } from "../logic/observer.js";
|
|
10
|
+
import ComponentPartsBoundary from "../logic/ComponentPartsBoundary.js";
|
|
11
|
+
import { useLocale } from "../i18n/locale.js";
|
|
10
12
|
|
|
11
13
|
const $$css = {
|
|
12
14
|
hash: 'svelte-n74t6s',
|
|
@@ -33,7 +35,7 @@ export default function Pagination($$renderer, $$props) {
|
|
|
33
35
|
pageSize = 20,
|
|
34
36
|
pageSizeOptions = [],
|
|
35
37
|
pageSizeGap = 16,
|
|
36
|
-
pageSizeAriaLabel =
|
|
38
|
+
pageSizeAriaLabel = undefined,
|
|
37
39
|
onPageChange = undefined,
|
|
38
40
|
onPageSizeChange = undefined,
|
|
39
41
|
children,
|
|
@@ -49,6 +51,9 @@ export default function Pagination($$renderer, $$props) {
|
|
|
49
51
|
...rest
|
|
50
52
|
} = $$props;
|
|
51
53
|
|
|
54
|
+
const localeContext = useLocale();
|
|
55
|
+
const resolvedPageSizeAriaLabel = $.derived(() => pageSizeAriaLabel ?? localeContext.t("pagination.pageSize"));
|
|
56
|
+
|
|
52
57
|
setContext(BUTTON_COLLECTION_CONTEXT_KEY, { scaleOnHover: false });
|
|
53
58
|
|
|
54
59
|
let templatesEl = undefined;
|
|
@@ -294,7 +299,7 @@ export default function Pagination($$renderer, $$props) {
|
|
|
294
299
|
].join(" ");
|
|
295
300
|
|
|
296
301
|
if (role === "prev" || role === "next") {
|
|
297
|
-
button.setAttribute("aria-label", role === "prev" ? "
|
|
302
|
+
button.setAttribute("aria-label", localeContext.t(role === "prev" ? "pagination.previous" : "pagination.next"));
|
|
298
303
|
|
|
299
304
|
const iconTemplate = role === "prev"
|
|
300
305
|
? previousIconTemplateEl?.firstElementChild
|
|
@@ -338,7 +343,7 @@ export default function Pagination($$renderer, $$props) {
|
|
|
338
343
|
if (disabled) markUnavailable(button);
|
|
339
344
|
} else {
|
|
340
345
|
button.classList.add("snowui-pagination-page");
|
|
341
|
-
button.setAttribute("aria-label",
|
|
346
|
+
button.setAttribute("aria-label", localeContext.t("pagination.page", { page: token }));
|
|
342
347
|
|
|
343
348
|
if (disabled || disabledPageSet().has(token)) markUnavailable(button); else bindClick(button, token);
|
|
344
349
|
}
|
|
@@ -360,12 +365,12 @@ export default function Pagination($$renderer, $$props) {
|
|
|
360
365
|
function createControl(role) {
|
|
361
366
|
const target = findAvailableControlTarget(role);
|
|
362
367
|
const isUnavailable = disabled || target === undefined;
|
|
363
|
-
const control = cloneTemplate(role) ?? createDefaultButton(role, role === "prev" ? "
|
|
368
|
+
const control = cloneTemplate(role) ?? createDefaultButton(role, localeContext.t(role === "prev" ? "pagination.previous" : "pagination.next"));
|
|
364
369
|
|
|
365
370
|
control.dataset.as = role;
|
|
366
371
|
control.classList.add("snowui-pagination-item", "snowui-rounded-rectangle");
|
|
367
372
|
control.classList.add(`snowui-pagination-${role}`);
|
|
368
|
-
control.setAttribute("aria-label", role === "prev" ? "
|
|
373
|
+
control.setAttribute("aria-label", localeContext.t(role === "prev" ? "pagination.previous" : "pagination.next"));
|
|
369
374
|
appendDefaultControlIcon(control, role);
|
|
370
375
|
|
|
371
376
|
if (isUnavailable) {
|
|
@@ -416,7 +421,7 @@ export default function Pagination($$renderer, $$props) {
|
|
|
416
421
|
template.classList.add("snowui-pagination-page-size-template");
|
|
417
422
|
template.id = pageSizeTriggerId;
|
|
418
423
|
template.setAttribute("role", "combobox");
|
|
419
|
-
template.setAttribute("aria-label",
|
|
424
|
+
template.setAttribute("aria-label", resolvedPageSizeAriaLabel());
|
|
420
425
|
template.setAttribute("aria-haspopup", "listbox");
|
|
421
426
|
template.setAttribute("aria-expanded", String(pageSizeOpen));
|
|
422
427
|
template.setAttribute("aria-controls", pageSizeListboxId);
|
|
@@ -949,8 +954,14 @@ export default function Pagination($$renderer, $$props) {
|
|
|
949
954
|
|
|
950
955
|
if (children) {
|
|
951
956
|
$$renderer.push('<!--[0-->');
|
|
952
|
-
|
|
953
|
-
$$renderer
|
|
957
|
+
|
|
958
|
+
ComponentPartsBoundary($$renderer, {
|
|
959
|
+
children: ($$renderer) => {
|
|
960
|
+
children($$renderer);
|
|
961
|
+
$$renderer.push(`<!---->`);
|
|
962
|
+
},
|
|
963
|
+
$$slots: { default: true }
|
|
964
|
+
});
|
|
954
965
|
} else {
|
|
955
966
|
$$renderer.push('<!--[-1-->');
|
|
956
967
|
Button($$renderer, { as: 'pageSize', variant: 'borderless' });
|
|
@@ -978,7 +989,7 @@ export default function Pagination($$renderer, $$props) {
|
|
|
978
989
|
as: 'prev',
|
|
979
990
|
variant,
|
|
980
991
|
iconOnly: true,
|
|
981
|
-
'aria-label':
|
|
992
|
+
'aria-label': localeContext.t("pagination.previous"),
|
|
982
993
|
'data-pagination-variant-fallback': 'true',
|
|
983
994
|
children: ($$renderer) => {
|
|
984
995
|
ComponentIcon($$renderer, {
|
|
@@ -996,7 +1007,7 @@ export default function Pagination($$renderer, $$props) {
|
|
|
996
1007
|
as: 'next',
|
|
997
1008
|
variant,
|
|
998
1009
|
iconOnly: true,
|
|
999
|
-
'aria-label':
|
|
1010
|
+
'aria-label': localeContext.t("pagination.next"),
|
|
1000
1011
|
'data-pagination-variant-fallback': 'true',
|
|
1001
1012
|
children: ($$renderer) => {
|
|
1002
1013
|
ComponentIcon($$renderer, {
|