@svadmin/ui 0.133.0 → 0.135.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/app.css +265 -15
  2. package/dist/app.theme.css +265 -15
  3. package/dist/components/AboutSettings.svelte +1 -1
  4. package/dist/components/Affix.svelte +16 -5
  5. package/dist/components/Affix.svelte.d.ts +3 -0
  6. package/dist/components/Anchor.svelte +7 -3
  7. package/dist/components/Anchor.svelte.d.ts +2 -0
  8. package/dist/components/Breadcrumbs.svelte +24 -4
  9. package/dist/components/Breadcrumbs.svelte.d.ts +6 -0
  10. package/dist/components/EmptyState.svelte +2 -2
  11. package/dist/components/OtpInput.svelte +5 -0
  12. package/dist/components/OtpInput.svelte.d.ts +1 -0
  13. package/dist/components/RadioGroup.svelte +9 -1
  14. package/dist/components/RangeSlider.svelte +12 -7
  15. package/dist/components/Slider.svelte +12 -4
  16. package/dist/components/Statistic.svelte +2 -1
  17. package/dist/components/Steps.svelte +75 -2
  18. package/dist/components/Steps.svelte.d.ts +2 -0
  19. package/dist/components/Tag.svelte +50 -12
  20. package/dist/components/Tag.svelte.d.ts +7 -3
  21. package/dist/components/TagsInput.svelte +35 -18
  22. package/dist/components/Timeline.svelte +63 -5
  23. package/dist/components/Timeline.svelte.d.ts +2 -1
  24. package/dist/components/Toast.svelte +1 -1
  25. package/dist/components/content/DescriptionList.svelte +90 -64
  26. package/dist/components/content/DescriptionList.svelte.d.ts +5 -1
  27. package/dist/components/ui/avatar/avatar-variants.d.ts +3 -1
  28. package/dist/components/ui/avatar/avatar-variants.js +7 -1
  29. package/dist/components/ui/avatar/avatar.svelte +7 -4
  30. package/dist/components/ui/avatar/avatar.svelte.d.ts +3 -2
  31. package/dist/components/ui/avatar/index.d.ts +2 -2
  32. package/dist/components/ui/avatar/index.js +2 -2
  33. package/dist/components/ui/dialog/dialog-content.svelte +1 -1
  34. package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -1
  35. package/dist/components/ui/input/input.svelte +6 -11
  36. package/dist/components/ui/textarea/textarea.svelte +21 -25
  37. package/dist/components.css +4 -1
  38. package/dist/icon-registry.d.ts +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/intent-preload.d.ts +1 -1
  41. package/dist/intent-preload.js +1 -1
  42. package/dist/notifications.svelte.d.ts +1 -0
  43. package/dist/notifications.svelte.js +2 -0
  44. package/package.json +4 -4
@@ -7321,6 +7321,9 @@
7321
7321
  .gap-x-6 {
7322
7322
  column-gap: calc(var(--spacing) * 6);
7323
7323
  }
7324
+ .gap-x-8 {
7325
+ column-gap: calc(var(--spacing) * 8);
7326
+ }
7324
7327
  :where(.-space-x-1\.5 > :not(:last-child)) {
7325
7328
  --tw-space-x-reverse: 0;
7326
7329
  margin-inline-start: calc(calc(var(--spacing) * -1.5) * var(--tw-space-x-reverse));
@@ -7334,12 +7337,18 @@
7334
7337
  .gap-y-1 {
7335
7338
  row-gap: var(--spacing);
7336
7339
  }
7340
+ .gap-y-3 {
7341
+ row-gap: calc(var(--spacing) * 3);
7342
+ }
7337
7343
  .gap-y-3\.5 {
7338
7344
  row-gap: calc(var(--spacing) * 3.5);
7339
7345
  }
7340
7346
  .gap-y-5 {
7341
7347
  row-gap: calc(var(--spacing) * 5);
7342
7348
  }
7349
+ .gap-y-6 {
7350
+ row-gap: calc(var(--spacing) * 6);
7351
+ }
7343
7352
  :where(.divide-x > :not(:last-child)) {
7344
7353
  --tw-divide-x-reverse: 0;
7345
7354
  border-inline-style: var(--tw-border-style);
@@ -9069,9 +9078,6 @@
9069
9078
  .text-info-foreground {
9070
9079
  color: var(--info-foreground);
9071
9080
  }
9072
- .text-inherit {
9073
- color: inherit;
9074
- }
9075
9081
  .text-muted {
9076
9082
  color: var(--muted);
9077
9083
  }
@@ -9879,9 +9885,6 @@
9879
9885
  .empty\:hidden:empty {
9880
9886
  display: none;
9881
9887
  }
9882
- .focus-within\:border-ring:focus-within {
9883
- border-color: var(--ring);
9884
- }
9885
9888
  .focus-within\:bg-background:focus-within {
9886
9889
  background-color: var(--background);
9887
9890
  }
@@ -9902,9 +9905,6 @@
9902
9905
  --tw-ring-color: color-mix(in oklab, var(--primary) 40%, transparent);
9903
9906
  }
9904
9907
  }
9905
- .focus-within\:ring-ring:focus-within {
9906
- --tw-ring-color: var(--ring);
9907
- }
9908
9908
  @media (hover: hover) {
9909
9909
  .hover\:z-20:hover {
9910
9910
  z-index: 20;
@@ -10437,10 +10437,6 @@
10437
10437
  .focus-visible\:opacity-100:focus-visible {
10438
10438
  opacity: 100%;
10439
10439
  }
10440
- .focus-visible\:ring-0:focus-visible {
10441
- --tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
10442
- box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
10443
- }
10444
10440
  .focus-visible\:ring-1:focus-visible {
10445
10441
  --tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
10446
10442
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -10862,6 +10858,10 @@
10862
10858
  font-size: var(--text-3xl);
10863
10859
  line-height: var(--tw-leading, var(--text-3xl--line-height));
10864
10860
  }
10861
+ .sm\:text-base {
10862
+ font-size: var(--text-base);
10863
+ line-height: var(--tw-leading, var(--text-base--line-height));
10864
+ }
10865
10865
  .sm\:text-lg {
10866
10866
  font-size: var(--text-lg);
10867
10867
  line-height: var(--tw-leading, var(--text-lg--line-height));
@@ -12996,6 +12996,28 @@ h6,
12996
12996
  outline-offset: var(--svadmin-focus-offset);
12997
12997
  }
12998
12998
 
12999
+ /* 前后缀输入和带计数的文本域把焦点画在外框上,避免内层再套一圈 outline。 */
13000
+ .svadmin-input-wrapper:focus-within,
13001
+ .svadmin-textarea-wrapper:focus-within {
13002
+ border-color: var(--ring);
13003
+ outline: var(--svadmin-focus-width) solid var(--ring);
13004
+ outline: var(--svadmin-focus-width) solid color-mix(in oklch, var(--ring) 48%, transparent);
13005
+ outline-offset: var(--svadmin-focus-offset);
13006
+ }
13007
+
13008
+ .svadmin-input-wrapper:focus-within:has(.svadmin-input[aria-invalid="true"]),
13009
+ .svadmin-textarea-wrapper:focus-within:has(.svadmin-textarea[aria-invalid="true"]) {
13010
+ border-color: var(--destructive);
13011
+ background: var(--card);
13012
+ outline-color: var(--destructive);
13013
+ }
13014
+
13015
+ .svadmin-input-wrapper [data-slot="input"]:focus-visible,
13016
+ .svadmin-textarea-wrapper [data-slot="textarea"]:focus-visible {
13017
+ outline: none;
13018
+ border-color: transparent;
13019
+ }
13020
+
12999
13021
  /* Keep primitive defaults below consumer utility overrides. */
13000
13022
  @layer components {
13001
13023
  /* Button primitives use stable state attributes so consumers do not need Tailwind. */
@@ -13369,6 +13391,7 @@ h6,
13369
13391
  .svadmin-avatar:is([data-size="sm"], .svadmin-avatar-size--sm) { width: 2rem; height: 2rem; }
13370
13392
  .svadmin-avatar:is([data-size="lg"], .svadmin-avatar-size--lg) { width: 3rem; height: 3rem; }
13371
13393
  .svadmin-avatar:is([data-size="xl"], .svadmin-avatar-size--xl) { width: 4rem; height: 4rem; }
13394
+ .svadmin-avatar:is([data-shape="square"], .svadmin-avatar-shape--square) { border-radius: var(--radius-md); }
13372
13395
 
13373
13396
  [data-slot="avatar"] {
13374
13397
  width: 100%;
@@ -13887,6 +13910,233 @@ main {
13887
13910
  color: var(--muted-foreground);
13888
13911
  }
13889
13912
 
13913
+ /* 前后缀 / 清除按钮与裸输入共用同一套尺寸、描边和禁用态。 */
13914
+ .svadmin-input-wrapper {
13915
+ display: inline-flex;
13916
+ align-items: center;
13917
+ width: 100%;
13918
+ min-width: 0;
13919
+ height: var(--svadmin-control-h);
13920
+ padding: 0 12px;
13921
+ border: 1px solid var(--border);
13922
+ border-radius: var(--radius-sm);
13923
+ background: var(--card);
13924
+ color: var(--foreground);
13925
+ font-size: 14px;
13926
+ outline: none;
13927
+ transition: border-color var(--svadmin-motion-fast) var(--svadmin-motion-easing), box-shadow var(--svadmin-motion-fast) var(--svadmin-motion-easing), background-color var(--svadmin-motion-fast) var(--svadmin-motion-easing);
13928
+ }
13929
+
13930
+ .svadmin-input-wrapper[data-size="mini"] {
13931
+ height: var(--svadmin-control-h-mini);
13932
+ padding: 0 8px;
13933
+ font-size: 12px;
13934
+ }
13935
+
13936
+ .svadmin-input-wrapper[data-size="compact"],
13937
+ .svadmin-input-wrapper[data-size="sm"] {
13938
+ height: var(--svadmin-control-h-sm);
13939
+ padding: 0 12px;
13940
+ font-size: 14px;
13941
+ }
13942
+
13943
+ .svadmin-input-wrapper[data-size="lg"] {
13944
+ height: var(--svadmin-control-h-lg);
13945
+ padding: 0 16px;
13946
+ font-size: 14px;
13947
+ }
13948
+
13949
+ .svadmin-input-wrapper .svadmin-input:not([data-input-type="file"]) {
13950
+ height: 100%;
13951
+ padding: 0;
13952
+ border: 0;
13953
+ background: transparent;
13954
+ box-shadow: none;
13955
+ }
13956
+
13957
+ .svadmin-input-prefix {
13958
+ display: inline-flex;
13959
+ align-items: center;
13960
+ flex-shrink: 0;
13961
+ margin-inline-end: 12px;
13962
+ color: var(--color-text-2, var(--muted-foreground));
13963
+ user-select: none;
13964
+ white-space: nowrap;
13965
+ }
13966
+
13967
+ .svadmin-input-suffix {
13968
+ display: inline-flex;
13969
+ align-items: center;
13970
+ flex-shrink: 0;
13971
+ margin-inline-start: 12px;
13972
+ color: var(--color-text-2, var(--muted-foreground));
13973
+ user-select: none;
13974
+ white-space: nowrap;
13975
+ }
13976
+
13977
+ .svadmin-input-clear,
13978
+ .svadmin-textarea-clear {
13979
+ display: inline-flex;
13980
+ align-items: center;
13981
+ justify-content: center;
13982
+ flex-shrink: 0;
13983
+ margin-inline-start: 4px;
13984
+ padding: 0;
13985
+ border: 0;
13986
+ background: transparent;
13987
+ color: var(--color-text-2, var(--muted-foreground));
13988
+ font-size: 12px;
13989
+ line-height: 1;
13990
+ cursor: pointer;
13991
+ visibility: hidden;
13992
+ }
13993
+
13994
+ .svadmin-input-wrapper:hover .svadmin-input-clear,
13995
+ .svadmin-input-wrapper:focus-within .svadmin-input-clear,
13996
+ .svadmin-textarea-wrapper:hover .svadmin-textarea-clear,
13997
+ .svadmin-textarea-wrapper:focus-within .svadmin-textarea-clear {
13998
+ visibility: visible;
13999
+ }
14000
+
14001
+ .svadmin-input-clear:hover,
14002
+ .svadmin-textarea-clear:hover {
14003
+ color: var(--foreground);
14004
+ }
14005
+
14006
+ .svadmin-input-wrapper:has(.svadmin-input:disabled),
14007
+ .svadmin-input-wrapper[data-input-state="disabled"] {
14008
+ cursor: not-allowed;
14009
+ opacity: 1;
14010
+ color: var(--svadmin-text-4);
14011
+ background: var(--muted);
14012
+ }
14013
+
14014
+ .svadmin-input-wrapper:has(.svadmin-input[aria-invalid="true"]),
14015
+ .svadmin-input-wrapper[data-input-state="error"] {
14016
+ border-color: transparent;
14017
+ background: var(--danger-light-1, #FFECE8);
14018
+ box-shadow: none;
14019
+ }
14020
+
14021
+ .svadmin-input-wrapper:has(.svadmin-input[aria-invalid="true"]):hover,
14022
+ .svadmin-input-wrapper[data-input-state="error"]:hover {
14023
+ border-color: transparent;
14024
+ background: var(--danger-light-2, #FDCDC5);
14025
+ }
14026
+
14027
+ .svadmin-input-wrapper .svadmin-input[aria-invalid="true"],
14028
+ .svadmin-input-wrapper .svadmin-input[data-input-state="error"] {
14029
+ border-color: transparent;
14030
+ background: transparent;
14031
+ box-shadow: none;
14032
+ }
14033
+
14034
+ .svadmin-input-wrapper[data-input-state="success"] {
14035
+ border-color: var(--success, var(--primary));
14036
+ }
14037
+
14038
+ .svadmin-textarea-wrapper {
14039
+ position: relative;
14040
+ display: block;
14041
+ width: 100%;
14042
+ border: 1px solid var(--border);
14043
+ border-radius: var(--radius-sm);
14044
+ background: transparent;
14045
+ color: var(--foreground);
14046
+ }
14047
+
14048
+ .svadmin-textarea-wrapper .svadmin-textarea {
14049
+ border: 0;
14050
+ background: transparent;
14051
+ box-shadow: none;
14052
+ }
14053
+
14054
+ .svadmin-textarea-wrapper:has(.svadmin-textarea-clear) .svadmin-textarea {
14055
+ padding-right: 20px;
14056
+ }
14057
+
14058
+ .svadmin-textarea-wrapper:has(.svadmin-textarea-word-limit) .svadmin-textarea {
14059
+ padding-bottom: 22px;
14060
+ }
14061
+
14062
+ .svadmin-textarea-clear {
14063
+ position: absolute;
14064
+ inset-block-start: 10px;
14065
+ inset-inline-end: 10px;
14066
+ margin-inline-start: 0;
14067
+ }
14068
+
14069
+ .svadmin-textarea-word-limit {
14070
+ position: absolute;
14071
+ inset-block-end: 6px;
14072
+ inset-inline-end: 10px;
14073
+ color: var(--muted-foreground);
14074
+ font-family: inherit;
14075
+ font-size: 12px;
14076
+ line-height: 1.5715;
14077
+ user-select: none;
14078
+ }
14079
+
14080
+ .svadmin-textarea-word-limit[data-limit-state="error"] {
14081
+ color: var(--destructive);
14082
+ }
14083
+
14084
+ .svadmin-textarea-wrapper:has(.svadmin-textarea:disabled),
14085
+ .svadmin-textarea-wrapper[data-input-state="disabled"] {
14086
+ cursor: not-allowed;
14087
+ opacity: 1;
14088
+ color: var(--svadmin-text-4);
14089
+ background: var(--muted);
14090
+ }
14091
+
14092
+ .svadmin-textarea-wrapper:has(.svadmin-textarea[aria-invalid="true"]),
14093
+ .svadmin-textarea-wrapper[data-input-state="error"] {
14094
+ border-color: transparent;
14095
+ background: var(--danger-light-1, #FFECE8);
14096
+ box-shadow: none;
14097
+ }
14098
+
14099
+ .svadmin-textarea-wrapper:has(.svadmin-textarea[aria-invalid="true"]):hover,
14100
+ .svadmin-textarea-wrapper[data-input-state="error"]:hover {
14101
+ border-color: transparent;
14102
+ background: var(--danger-light-2, #FDCDC5);
14103
+ }
14104
+
14105
+ .svadmin-textarea-wrapper .svadmin-textarea[aria-invalid="true"],
14106
+ .svadmin-textarea-wrapper .svadmin-textarea[data-input-state="error"] {
14107
+ border-color: transparent;
14108
+ background: transparent;
14109
+ box-shadow: none;
14110
+ }
14111
+
14112
+ .svadmin-textarea-wrapper[data-input-state="success"] {
14113
+ border-color: var(--success, var(--primary));
14114
+ }
14115
+
14116
+ /* 官方刻度文字 14px / line-height 1。颜色保持可读的次要文字色。 */
14117
+ [data-slot="slider-marks"] {
14118
+ position: relative;
14119
+ inline-size: 100%;
14120
+ block-size: 14px;
14121
+ user-select: none;
14122
+ }
14123
+
14124
+ .svadmin-slider__mark {
14125
+ position: absolute;
14126
+ border: 0;
14127
+ background: transparent;
14128
+ padding: 0;
14129
+ color: var(--muted-foreground);
14130
+ font: inherit;
14131
+ font-size: 14px;
14132
+ line-height: 1;
14133
+ transform: translateX(-50%);
14134
+ }
14135
+
14136
+ button.svadmin-slider__mark { cursor: pointer; }
14137
+ button.svadmin-slider__mark:hover:not(:disabled) { color: var(--foreground); }
14138
+ button.svadmin-slider__mark:disabled { cursor: not-allowed; color: var(--svadmin-text-4); }
14139
+
13890
14140
  .svadmin-field {
13891
14141
  display: flex;
13892
14142
  flex-direction: column;
@@ -14811,7 +15061,7 @@ main {
14811
15061
 
14812
15062
  .svadmin-select[data-size="small"],
14813
15063
  .svadmin-select[data-size="compact"] {
14814
- /* Official .arco-select-size-small.arco-select-single .arco-select-view is 28px / 14px. */
15064
+ /* Official compact select view: 28px height with 14px type. */
14815
15065
  height: var(--svadmin-control-h-sm);
14816
15066
  padding: 0.25rem 1.75rem 0.25rem 0.5rem;
14817
15067
  font-size: var(--svadmin-text-body);
@@ -15757,7 +16007,7 @@ main {
15757
16007
  height: var(--svadmin-space-4);
15758
16008
  }
15759
16009
 
15760
- /* Official .arco-pagination-item: 32px, borderless, 14px type. Active is primary-light-1. */
16010
+ /* Official pagination item: 32px, borderless, 14px type. Active is primary-light-1. */
15761
16011
  :is([data-slot="pagination-link"], [data-slot="pagination-previous"], [data-slot="pagination-next"]).svadmin-pagination-item {
15762
16012
  box-sizing: border-box;
15763
16013
  display: inline-flex;
@@ -11,7 +11,7 @@
11
11
  const resources = $derived(adminContext.resources.filter((resource) => resource.meta?.['aboutVisible'] !== false));
12
12
  const providerNames = $derived(adminContext.getDataProviderNames());
13
13
  let { version: suppliedVersion, headingLevel = 'h1' }: { version?: string; headingLevel?: 'h1' | 'h2' } = $props();
14
- const buildVersion = "0.133.0";
14
+ const buildVersion = "0.135.0";
15
15
  const version = $derived(suppliedVersion ?? (
16
16
  buildVersion.startsWith('__')
17
17
  ? (i18n.locale === 'zh-CN' ? '开发构建(未提供版本)' : 'Development build (version unavailable)')
@@ -5,13 +5,18 @@
5
5
 
6
6
  interface Props {
7
7
  top?: number;
8
+ offsetTop?: number;
8
9
  bottom?: number;
10
+ offsetBottom?: number;
9
11
  target?: string;
10
12
  children: Snippet;
11
13
  class?: string;
14
+ onchange?: (stuck: boolean) => void;
12
15
  }
13
16
 
14
- let { top = 16, bottom, target = 'window', children, class: className = '' }: Props = $props();
17
+ let { top = 16, offsetTop, bottom, offsetBottom, target = 'window', children, class: className = '', onchange }: Props = $props();
18
+ const effectiveTop = $derived(offsetTop ?? top);
19
+ const effectiveBottom = $derived(offsetBottom ?? bottom);
15
20
  let stuck = $state(false);
16
21
  let sentinel: HTMLDivElement | undefined;
17
22
  let observer: IntersectionObserver | undefined;
@@ -19,8 +24,14 @@
19
24
  onMount(() => {
20
25
  if (!sentinel) return;
21
26
  observer = new IntersectionObserver(([entry]) => {
22
- if (entry) stuck = !entry.isIntersecting;
23
- }, { root: target === 'window' ? null : document.querySelector(target), rootMargin: `-${top}px 0px 0px 0px`, threshold: [0] });
27
+ if (entry) {
28
+ const nextStuck = !entry.isIntersecting;
29
+ if (stuck !== nextStuck) {
30
+ stuck = nextStuck;
31
+ onchange?.(nextStuck);
32
+ }
33
+ }
34
+ }, { root: target === 'window' ? null : document.querySelector(target), rootMargin: `-${effectiveTop}px 0px 0px 0px`, threshold: [0] });
24
35
  observer.observe(sentinel);
25
36
  return () => observer?.disconnect();
26
37
  });
@@ -30,8 +41,8 @@
30
41
  <div
31
42
  class={cn('svadmin-affix', className)}
32
43
  class:is-stuck={stuck}
33
- style:top={`${top}px`}
34
- style:bottom={bottom === undefined ? undefined : `${bottom}px`}
44
+ style:top={`${effectiveTop}px`}
45
+ style:bottom={effectiveBottom === undefined ? undefined : `${effectiveBottom}px`}
35
46
  >
36
47
  {@render children()}
37
48
  </div>
@@ -1,10 +1,13 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  interface Props {
3
3
  top?: number;
4
+ offsetTop?: number;
4
5
  bottom?: number;
6
+ offsetBottom?: number;
5
7
  target?: string;
6
8
  children: Snippet;
7
9
  class?: string;
10
+ onchange?: (stuck: boolean) => void;
8
11
  }
9
12
  declare const Affix: import("svelte").Component<Props, {}, "">;
10
13
  type Affix = ReturnType<typeof Affix>;
@@ -11,11 +11,14 @@
11
11
  interface Props {
12
12
  items: AnchorItem[];
13
13
  offset?: number;
14
+ targetOffset?: number;
14
15
  label?: string;
15
16
  class?: string;
17
+ onselect?: (id: string) => void;
16
18
  }
17
19
 
18
- let { items, offset = 96, label = 'On this page', class: className = '' }: Props = $props();
20
+ let { items, offset = 96, targetOffset, label = 'On this page', class: className = '', onselect }: Props = $props();
21
+ const effectiveOffset = $derived(targetOffset ?? offset);
19
22
  let active = $state(untrack(() => items[0]?.id ?? ''));
20
23
  let observer: IntersectionObserver | undefined;
21
24
 
@@ -25,7 +28,7 @@
25
28
  observer = new IntersectionObserver((entries) => {
26
29
  const visible = entries.filter((entry) => entry.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top);
27
30
  if (visible[0]?.target.id) active = visible[0].target.id;
28
- }, { rootMargin: `-${offset}px 0px -65% 0px`, threshold: [0, 1] });
31
+ }, { rootMargin: `-${effectiveOffset}px 0px -65% 0px`, threshold: [0, 1] });
29
32
  for (const element of elements) observer.observe(element);
30
33
  return () => observer?.disconnect();
31
34
  });
@@ -33,9 +36,10 @@
33
36
  function jump(id: string): void {
34
37
  const target = document.getElementById(id);
35
38
  if (!target) return;
36
- const top = target.getBoundingClientRect().top + window.scrollY - offset;
39
+ const top = target.getBoundingClientRect().top + window.scrollY - effectiveOffset;
37
40
  window.scrollTo({ top, behavior: 'smooth' });
38
41
  active = id;
42
+ onselect?.(id);
39
43
  }
40
44
  </script>
41
45
 
@@ -6,8 +6,10 @@ export interface AnchorItem {
6
6
  interface Props {
7
7
  items: AnchorItem[];
8
8
  offset?: number;
9
+ targetOffset?: number;
9
10
  label?: string;
10
11
  class?: string;
12
+ onselect?: (id: string) => void;
11
13
  }
12
14
  declare const Anchor: import("svelte").Component<Props, {}, "">;
13
15
  type Anchor = ReturnType<typeof Anchor>;
@@ -9,16 +9,29 @@
9
9
  import * as Breadcrumb from './ui/breadcrumb/index.js';
10
10
  import * as DropdownMenu from './ui/dropdown-menu/index.js';
11
11
 
12
+ export interface BreadcrumbItem {
13
+ label: string;
14
+ href?: string;
15
+ }
16
+
12
17
  const i18n = useTranslation();
13
18
 
14
19
  const adminContext = captureAdminContext();
15
20
  const resources = $derived((() => { try { return getResources(); } catch { return []; } })());
16
21
 
17
22
  let {
23
+ items: explicitItems,
18
24
  menu,
25
+ separator = 'slash',
19
26
  maxItems = 0,
20
27
  class: className = 'svadmin-breadcrumbs--spaced',
21
- }: { menu?: MenuItem[] | undefined; maxItems?: number; class?: string } = $props();
28
+ }: {
29
+ items?: BreadcrumbItem[] | undefined;
30
+ menu?: MenuItem[] | undefined;
31
+ separator?: 'slash' | 'arrow';
32
+ maxItems?: number;
33
+ class?: string;
34
+ } = $props();
22
35
 
23
36
  interface Crumb { label: string; href?: string; hidden?: boolean; children?: Crumb[]; }
24
37
 
@@ -44,7 +57,14 @@
44
57
  }
45
58
  }
46
59
 
47
- const crumbs = $derived.by(() => {
60
+ const crumbs = $derived.by<Crumb[]>(() => {
61
+ if (explicitItems && explicitItems.length > 0) {
62
+ // exactOptionalPropertyTypes: 不把 undefined 塞进可选 href。
63
+ return explicitItems.map((item) => (item.href === undefined
64
+ ? { label: item.label }
65
+ : { label: item.label, href: item.href }));
66
+ }
67
+
48
68
  const result: Crumb[] = [{ label: i18n.t('common.home') ?? 'Home', href: adminContext.formatLink('/') }];
49
69
  const currentPathname = normalizePath(getPath());
50
70
  if (currentPathname === '/') return result;
@@ -113,12 +133,12 @@
113
133
  });
114
134
  </script>
115
135
 
116
- {#if crumbs.length > 1}
136
+ {#if explicitItems ? crumbs.length > 0 : crumbs.length > 1}
117
137
  <Breadcrumb.Root class={cn('svadmin-breadcrumbs', className)}>
118
138
  <Breadcrumb.List>
119
139
  {#each displayCrumbs as crumb, i (`${crumb.label}-${i}`)}
120
140
  {#if i > 0}
121
- <Breadcrumb.Separator />
141
+ <Breadcrumb.Separator {separator} />
122
142
  {/if}
123
143
  <Breadcrumb.Item>
124
144
  <span class="svadmin-breadcrumbs__item svadmin-page-enter" style="animation-duration: 0.2s;">
@@ -1,6 +1,12 @@
1
1
  import { type MenuItem } from '@svadmin/core';
2
+ export interface BreadcrumbItem {
3
+ label: string;
4
+ href?: string;
5
+ }
2
6
  type $$ComponentProps = {
7
+ items?: BreadcrumbItem[] | undefined;
3
8
  menu?: MenuItem[] | undefined;
9
+ separator?: 'slash' | 'arrow';
4
10
  maxItems?: number;
5
11
  class?: string;
6
12
  };
@@ -71,7 +71,7 @@
71
71
  <style>
72
72
  .empty-state { color: var(--foreground); }
73
73
  .empty-state--horizontal { display: flex; align-items: flex-start; gap: 12px; padding: 16px; text-align: left; }
74
- .empty-state--horizontal .empty-state__icon { display: flex; align-items: center; justify-content: center; flex: 0 0 32px; height: 32px; border-radius: 6px; background: var(--muted); color: var(--muted-foreground); overflow: hidden; }
74
+ .empty-state--horizontal .empty-state__icon { display: flex; align-items: center; justify-content: center; flex: 0 0 32px; height: 32px; border-radius: var(--radius); background: var(--muted); color: var(--muted-foreground); overflow: hidden; }
75
75
  .empty-state--horizontal .empty-state__body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
76
76
  .empty-state--horizontal h3 { margin: 0; font-size: var(--svadmin-text-body); line-height: 1.5715; font-weight: 500; letter-spacing: 0; }
77
77
  .empty-state--horizontal p { margin: 4px 0 0; font-size: var(--svadmin-text-body); line-height: 1.5715; color: var(--muted-foreground); }
@@ -81,7 +81,7 @@
81
81
  .empty-state--vertical .empty-state__icon { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--muted); color: var(--muted-foreground); overflow: hidden; margin-bottom: 12px; }
82
82
  .empty-state--vertical .empty-state__body { display: flex; flex-direction: column; align-items: center; max-width: 24rem; }
83
83
  .empty-state--vertical h3 { margin: 0; font-size: var(--svadmin-text-section); font-weight: 600; color: var(--foreground); }
84
- .empty-state--vertical p { margin: 6px 0 0; font-size: var(--svadmin-text-label); color: var(--muted-foreground); line-height: 1.5; }
84
+ .empty-state--vertical p { margin: 4px 0 0; font-size: var(--svadmin-text-body); color: var(--muted-foreground); line-height: 1.5715; }
85
85
  .empty-state--vertical .empty-state__action { margin-top: 16px; }
86
86
 
87
87
  .empty-state__image { width: 100%; height: 100%; object-fit: contain; }
@@ -11,6 +11,7 @@
11
11
  error?: boolean;
12
12
  autoFocus?: boolean;
13
13
  size?: 'sm' | 'md' | 'lg';
14
+ separator?: string;
14
15
  class?: string;
15
16
  'aria-label'?: string;
16
17
  onchange?: (value: string) => void;
@@ -26,6 +27,7 @@
26
27
  error = false,
27
28
  autoFocus = false,
28
29
  size = 'md',
30
+ separator,
29
31
  class: className = '',
30
32
  'aria-label': groupAriaLabel = 'OTP verification code input',
31
33
  onchange,
@@ -181,6 +183,9 @@
181
183
  aria-label={groupAriaLabel}
182
184
  >
183
185
  {#each digits as digit, index (index)}
186
+ {#if separator && index > 0 && index % 3 === 0}
187
+ <span class="svadmin-otp-separator text-muted-foreground font-mono select-none" aria-hidden="true">{separator}</span>
188
+ {/if}
184
189
  <input
185
190
  use:registerInput={index}
186
191
  type={mask ? 'password' : 'text'}
@@ -7,6 +7,7 @@ export interface OtpInputProps {
7
7
  error?: boolean;
8
8
  autoFocus?: boolean;
9
9
  size?: 'sm' | 'md' | 'lg';
10
+ separator?: string;
10
11
  class?: string;
11
12
  'aria-label'?: string;
12
13
  onchange?: (value: string) => void;
@@ -252,7 +252,7 @@
252
252
  aria-label={legend ? undefined : ariaLabel}
253
253
  >
254
254
  {#if legend}<legend>{legend}</legend>{/if}
255
- <div class={cn('svadmin-radio-group__options', direction === 'horizontal' ? 'svadmin-radio-group__options--horizontal flex flex-wrap items-center gap-4' : 'grid gap-2')} data-direction={direction}>
255
+ <div class={cn('svadmin-radio-group__options', direction === 'horizontal' && 'svadmin-radio-group__options--horizontal')} data-direction={direction}>
256
256
  {#each options as option, index (option.value)}
257
257
  {@const inputId = `${instanceId}-radio-${index}`}
258
258
  <label class="svadmin-radio-group__option" class:svadmin-radio-group__option--disabled={disabled || option.disabled} for={inputId}>
@@ -298,6 +298,14 @@
298
298
  gap: 8px;
299
299
  }
300
300
 
301
+ /* 官方横向单选的相邻间距是 20px。组件样式必须盖过纵向 grid,否则 flex 类不会生效。 */
302
+ .svadmin-radio-group__options--horizontal {
303
+ display: flex;
304
+ flex-wrap: wrap;
305
+ align-items: center;
306
+ gap: 20px;
307
+ }
308
+
301
309
  .svadmin-radio-group__option {
302
310
  display: flex;
303
311
  align-items: flex-start;
@@ -59,8 +59,8 @@
59
59
  }
60
60
  </script>
61
61
 
62
- <div class={cn('svadmin-range-slider flex flex-col w-full gap-1', className)} data-invalid={invalid ? 'true' : undefined}>
63
- <div class="flex items-center gap-2 w-full">
62
+ <div class={cn('svadmin-range-slider', className)} data-invalid={invalid ? 'true' : undefined}>
63
+ <div class="svadmin-range-slider__control">
64
64
  {#if minName}<input type="hidden" name={minName} value={lower} />{/if}
65
65
  {#if maxName}<input type="hidden" name={maxName} value={upper} />{/if}
66
66
  <div class="svadmin-range-slider__tracks">
@@ -92,14 +92,11 @@
92
92
  {#if showValue}<output>{lower} - {upper}</output>{/if}
93
93
  </div>
94
94
  {#if marks && Object.keys(marks).length > 0}
95
- <div class="relative w-full h-5 text-[11px] text-muted-foreground select-none" data-slot="slider-marks">
95
+ <div data-slot="slider-marks">
96
96
  {#each Object.entries(marks) as [markVal, label] (markVal)}
97
97
  {@const valNum = Number(markVal)}
98
98
  {@const pct = boundsValid ? Math.min(100, Math.max(0, ((valNum - min) / (max - min)) * 100)) : 0}
99
- <span
100
- class="absolute -translate-x-1/2 hover:text-foreground transition-colors"
101
- style={`left: ${pct}%;`}
102
- >
99
+ <span class="svadmin-slider__mark" style={`left: ${pct}%;`}>
103
100
  {label}
104
101
  </span>
105
102
  {/each}
@@ -109,6 +106,14 @@
109
106
 
110
107
  <style>
111
108
  .svadmin-range-slider {
109
+ display: flex;
110
+ flex-direction: column;
111
+ align-items: stretch;
112
+ gap: 4px;
113
+ inline-size: 100%;
114
+ }
115
+
116
+ .svadmin-range-slider__control {
112
117
  display: flex;
113
118
  align-items: center;
114
119
  gap: 8px;