@widgetic/design-system 0.5.14 → 0.5.16

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 (155) hide show
  1. package/README.md +167 -0
  2. package/dist/components/CopyableHeader.svelte +25 -11
  3. package/dist/components/CopyableHeader.svelte.d.ts +4 -0
  4. package/dist/components/EmptyState.svelte +1 -1
  5. package/dist/components/PasswordInput.svelte +2 -2
  6. package/dist/components/WScrollArea.svelte +2 -2
  7. package/dist/components/ic/browser/BrowserInputController.svelte +2 -2
  8. package/dist/components/index.d.ts +1 -0
  9. package/dist/components/modals/ActionModal.svelte +7 -2
  10. package/dist/components/modals/ActionModal.svelte.d.ts +2 -0
  11. package/dist/components/modals/BaseModal.svelte +4 -2
  12. package/dist/components/modals/BaseModal.svelte.d.ts +1 -0
  13. package/dist/components/modals/NewItemDialog.svelte +48 -30
  14. package/dist/components/modals/NewItemDialog.svelte.d.ts +3 -0
  15. package/dist/components/modals/Portal.svelte +9 -1
  16. package/dist/components/modals/README.md +34 -1
  17. package/dist/components/modals/RenameDialog.svelte +29 -9
  18. package/dist/components/modals/RenameDialog.svelte.d.ts +3 -0
  19. package/dist/components/modals/messages.d.ts +39 -0
  20. package/dist/components/modals/messages.js +10 -0
  21. package/dist/components/navigation/Breadcrumbs.svelte +55 -50
  22. package/dist/components/navigation/Breadcrumbs.svelte.d.ts +4 -0
  23. package/dist/components/navigation/types.d.ts +8 -0
  24. package/dist/components/pdf/PDFViewer.svelte +17 -8
  25. package/dist/components/pdf/PDFViewer.svelte.d.ts +5 -0
  26. package/dist/components/search-input/SearchInput.svelte +3 -3
  27. package/dist/components/shad-editor/colorpicker.svelte +4 -1
  28. package/dist/components/shad-editor/custom/Extentions/ImageExtention.d.ts +20 -1
  29. package/dist/components/shad-editor/custom/Extentions/ImageExtention.js +4 -1
  30. package/dist/components/shad-editor/custom/code-extended.svelte +4 -2
  31. package/dist/components/shad-editor/custom/image-extended-component.svelte +54 -32
  32. package/dist/components/shad-editor/editor.css +5 -5
  33. package/dist/components/shad-editor/i18n/context.d.ts +6 -0
  34. package/dist/components/shad-editor/i18n/context.js +11 -0
  35. package/dist/components/shad-editor/i18n/index.d.ts +8 -0
  36. package/dist/components/shad-editor/i18n/index.js +11 -0
  37. package/dist/components/shad-editor/i18n/messages.d.ts +109 -0
  38. package/dist/components/shad-editor/i18n/messages.js +116 -0
  39. package/dist/components/shad-editor/icons/block-quote.svelte +3 -1
  40. package/dist/components/shad-editor/icons/bold.svelte +3 -1
  41. package/dist/components/shad-editor/icons/buttle-list.svelte +3 -1
  42. package/dist/components/shad-editor/icons/code.svelte +3 -1
  43. package/dist/components/shad-editor/icons/highlighter.svelte +5 -3
  44. package/dist/components/shad-editor/icons/image.svelte +7 -5
  45. package/dist/components/shad-editor/icons/italic.svelte +3 -1
  46. package/dist/components/shad-editor/icons/link.svelte +8 -6
  47. package/dist/components/shad-editor/icons/ordered-list.svelte +3 -1
  48. package/dist/components/shad-editor/icons/quickcolor.svelte +24 -22
  49. package/dist/components/shad-editor/icons/redo.svelte +3 -1
  50. package/dist/components/shad-editor/icons/search-replace.svelte +16 -14
  51. package/dist/components/shad-editor/icons/strikethrough.svelte +3 -1
  52. package/dist/components/shad-editor/icons/subscript.svelte +3 -1
  53. package/dist/components/shad-editor/icons/superscript.svelte +3 -1
  54. package/dist/components/shad-editor/icons/table.svelte +21 -19
  55. package/dist/components/shad-editor/icons/task-list.svelte +3 -1
  56. package/dist/components/shad-editor/icons/text.svelte +13 -11
  57. package/dist/components/shad-editor/icons/textalign.svelte +11 -9
  58. package/dist/components/shad-editor/icons/textcolor.svelte +5 -3
  59. package/dist/components/shad-editor/icons/underline.svelte +3 -1
  60. package/dist/components/shad-editor/icons/undo.svelte +3 -1
  61. package/dist/components/shad-editor/index.d.ts +1 -0
  62. package/dist/components/shad-editor/index.js +2 -0
  63. package/dist/components/shad-editor/shad-editor.svelte +32 -3
  64. package/dist/components/shad-editor/shad-editor.svelte.d.ts +12 -0
  65. package/dist/components/textDirection.d.ts +91 -0
  66. package/dist/components/textDirection.js +99 -0
  67. package/dist/components/toast/ToasterModal.svelte +49 -14
  68. package/dist/components/toast/ToasterModal.svelte.d.ts +9 -2
  69. package/dist/components/toast/toasterRoots.d.ts +23 -0
  70. package/dist/components/toast/toasterRoots.js +36 -0
  71. package/dist/components/ui/alert/index.d.ts +2 -2
  72. package/dist/components/ui/alert/index.js +1 -1
  73. package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +1 -1
  74. package/dist/components/ui/calendar/calendar-next-button.svelte +21 -4
  75. package/dist/components/ui/calendar/calendar-next-button.svelte.d.ts +9 -2
  76. package/dist/components/ui/calendar/calendar-prev-button.svelte +21 -4
  77. package/dist/components/ui/calendar/calendar-prev-button.svelte.d.ts +9 -2
  78. package/dist/components/ui/calendar/calendar.svelte +18 -6
  79. package/dist/components/ui/calendar/calendar.svelte.d.ts +6 -1
  80. package/dist/components/ui/command/command-input.svelte +1 -1
  81. package/dist/components/ui/command/command-shortcut.svelte +1 -1
  82. package/dist/components/ui/dialog/dialog-content.svelte +5 -2
  83. package/dist/components/ui/dialog/dialog-content.svelte.d.ts +1 -0
  84. package/dist/components/ui/dialog/dialog-header.svelte +1 -1
  85. package/dist/components/ui/drawer/drawer-header.svelte +1 -1
  86. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +2 -2
  87. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +6 -0
  88. package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +1 -1
  89. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
  90. package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +1 -1
  91. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +2 -2
  92. package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +1 -1
  93. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +7 -1
  94. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +2 -2
  95. package/dist/components/ui/hover-card/hover-card-content.svelte +6 -0
  96. package/dist/components/ui/input-otp/input-otp-slot.svelte +1 -1
  97. package/dist/components/ui/popover/popover-content.svelte +6 -0
  98. package/dist/components/ui/progress/progress.svelte +2 -2
  99. package/dist/components/ui/range-calendar/range-calendar-cell.svelte +1 -1
  100. package/dist/components/ui/range-calendar/range-calendar-next-button.svelte +21 -4
  101. package/dist/components/ui/range-calendar/range-calendar-next-button.svelte.d.ts +9 -2
  102. package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte +21 -4
  103. package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +9 -2
  104. package/dist/components/ui/range-calendar/range-calendar.svelte +18 -6
  105. package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +7 -2
  106. package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +1 -1
  107. package/dist/components/ui/scroll-area/scroll-area.svelte +6 -1
  108. package/dist/components/ui/select/select-content.svelte +6 -0
  109. package/dist/components/ui/select/select-group-heading.svelte +1 -1
  110. package/dist/components/ui/select/select-item.svelte +2 -2
  111. package/dist/components/ui/slider/slider.svelte +6 -0
  112. package/dist/components/ui/switch/switch.svelte +1 -1
  113. package/dist/components/ui/table/table-cell.svelte +1 -1
  114. package/dist/components/ui/table/table-head.svelte +1 -1
  115. package/dist/components/ui/tooltip/tooltip-content.svelte +6 -0
  116. package/dist/i18n/audit/catalogUsage.d.ts +36 -0
  117. package/dist/i18n/audit/catalogUsage.js +58 -0
  118. package/dist/i18n/audit/designSystemWords.d.ts +47 -0
  119. package/dist/i18n/audit/designSystemWords.js +137 -0
  120. package/dist/i18n/audit/hardCodedText.d.ts +40 -0
  121. package/dist/i18n/audit/hardCodedText.js +27 -0
  122. package/dist/i18n/audit/index.d.ts +19 -0
  123. package/dist/i18n/audit/index.js +19 -0
  124. package/dist/i18n/audit/messageCalls.d.ts +34 -0
  125. package/dist/i18n/audit/messageCalls.js +89 -0
  126. package/dist/i18n/audit/syntaxTree.d.ts +33 -0
  127. package/dist/i18n/audit/syntaxTree.js +90 -0
  128. package/dist/i18n/audit/visibleText.d.ts +57 -0
  129. package/dist/i18n/audit/visibleText.js +252 -0
  130. package/dist/i18n/createI18n.d.ts +63 -0
  131. package/dist/i18n/createI18n.js +72 -0
  132. package/dist/i18n/direction.d.ts +27 -0
  133. package/dist/i18n/direction.js +89 -0
  134. package/dist/i18n/index.d.ts +17 -0
  135. package/dist/i18n/index.js +16 -0
  136. package/dist/i18n/localeDate.d.ts +34 -0
  137. package/dist/i18n/localeDate.js +104 -0
  138. package/dist/i18n/splitMessages.d.ts +21 -0
  139. package/dist/i18n/splitMessages.js +33 -0
  140. package/dist/i18n/translator.d.ts +61 -0
  141. package/dist/i18n/translator.js +337 -0
  142. package/dist/rtl/audit/auditPhysicalPlacement.d.ts +36 -0
  143. package/dist/rtl/audit/auditPhysicalPlacement.js +58 -0
  144. package/dist/rtl/audit/index.d.ts +14 -0
  145. package/dist/rtl/audit/index.js +14 -0
  146. package/dist/rtl/audit/physicalPlacement.d.ts +64 -0
  147. package/dist/rtl/audit/physicalPlacement.js +444 -0
  148. package/dist/shad-editor/index.d.ts +1 -1
  149. package/dist/shad-editor/index.js +1 -1
  150. package/dist/styles/global.css +4 -4
  151. package/dist/utils/fillMessage.d.ts +8 -0
  152. package/dist/utils/fillMessage.js +10 -0
  153. package/dist/utils/itemName.d.ts +17 -0
  154. package/dist/utils/itemName.js +41 -0
  155. package/package.json +19 -2
@@ -7,7 +7,7 @@ export declare const alertVariants: import("tailwind-variants").TVReturnType<{
7
7
  default: string;
8
8
  destructive: string;
9
9
  };
10
- }, undefined, "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4", import("tailwind-variants/dist/config.js").TVConfig<{
10
+ }, undefined, "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:ps-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4", import("tailwind-variants/dist/config.js").TVConfig<{
11
11
  variant: {
12
12
  default: string;
13
13
  destructive: string;
@@ -27,7 +27,7 @@ export declare const alertVariants: import("tailwind-variants").TVReturnType<{
27
27
  default: string;
28
28
  destructive: string;
29
29
  };
30
- }, undefined, "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4", import("tailwind-variants/dist/config.js").TVConfig<{
30
+ }, undefined, "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:ps-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4", import("tailwind-variants/dist/config.js").TVConfig<{
31
31
  variant: {
32
32
  default: string;
33
33
  destructive: string;
@@ -3,7 +3,7 @@ import Root from "./alert.svelte";
3
3
  import Description from "./alert-description.svelte";
4
4
  import Title from "./alert-title.svelte";
5
5
  export const alertVariants = tv({
6
- base: "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4",
6
+ base: "[&>svg]:text-foreground relative w-full rounded-lg border p-4 [&:has(svg)]:ps-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4",
7
7
  variants: {
8
8
  variant: {
9
9
  default: "bg-background text-foreground",
@@ -27,6 +27,6 @@
27
27
  {#if children}
28
28
  {@render children?.()}
29
29
  {:else}
30
- <ChevronRight />
30
+ <ChevronRight class="rtl:-scale-x-100" />
31
31
  {/if}
32
32
  </li>
@@ -1,6 +1,13 @@
1
1
  <script lang="ts" module>
2
2
  import { Calendar as CalendarPrimitive } from "bits-ui";
3
- export type CalendarNextButtonProps = CalendarPrimitive.PrevButtonProps;
3
+ export type CalendarNextButtonProps = CalendarPrimitive.PrevButtonProps & {
4
+ /**
5
+ * The name a screen reader gives the button, in the page's language. The library names the button "Next" and
6
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
7
+ * ("Next") when it is not given.
8
+ */
9
+ label?: string;
10
+ };
4
11
  </script>
5
12
 
6
13
  <script lang="ts">
@@ -12,12 +19,13 @@
12
19
  ref = $bindable(null),
13
20
  class: className,
14
21
  children,
22
+ label,
15
23
  ...restProps
16
24
  }: CalendarNextButtonProps = $props();
17
25
  </script>
18
26
 
19
27
  {#snippet Fallback()}
20
- <ChevronRight class="size-4" />
28
+ <ChevronRight class="size-4 rtl:-scale-x-100" />
21
29
  {/snippet}
22
30
 
23
31
  <CalendarPrimitive.NextButton
@@ -27,6 +35,15 @@
27
35
  "size-7 bg-transparent p-0 opacity-50 hover:opacity-100",
28
36
  className
29
37
  )}
30
- children={children || Fallback}
31
38
  {...restProps}
32
- />
39
+ >
40
+ {#snippet child({ props })}
41
+ <button {...props} aria-label={label ?? (props["aria-label"] as string | undefined)}>
42
+ {#if children}
43
+ {@render children()}
44
+ {:else}
45
+ {@render Fallback()}
46
+ {/if}
47
+ </button>
48
+ {/snippet}
49
+ </CalendarPrimitive.NextButton>
@@ -1,5 +1,12 @@
1
1
  import { Calendar as CalendarPrimitive } from "bits-ui";
2
- export type CalendarNextButtonProps = CalendarPrimitive.PrevButtonProps;
3
- declare const CalendarNextButton: import("svelte").Component<CalendarPrimitive.PrevButtonProps, {}, "ref">;
2
+ export type CalendarNextButtonProps = CalendarPrimitive.PrevButtonProps & {
3
+ /**
4
+ * The name a screen reader gives the button, in the page's language. The library names the button "Next" and
5
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
6
+ * ("Next") when it is not given.
7
+ */
8
+ label?: string;
9
+ };
10
+ declare const CalendarNextButton: import("svelte").Component<CalendarNextButtonProps, {}, "ref">;
4
11
  type CalendarNextButton = ReturnType<typeof CalendarNextButton>;
5
12
  export default CalendarNextButton;
@@ -1,6 +1,13 @@
1
1
  <script lang="ts" module>
2
2
  import { Calendar as CalendarPrimitive } from "bits-ui";
3
- export type CalendarPrevButtonProps = CalendarPrimitive.PrevButtonProps;
3
+ export type CalendarPrevButtonProps = CalendarPrimitive.PrevButtonProps & {
4
+ /**
5
+ * The name a screen reader gives the button, in the page's language. The library names the button "Previous" and
6
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
7
+ * ("Previous") when it is not given.
8
+ */
9
+ label?: string;
10
+ };
4
11
  </script>
5
12
 
6
13
  <script lang="ts">
@@ -12,12 +19,13 @@
12
19
  ref = $bindable(null),
13
20
  class: className,
14
21
  children,
22
+ label,
15
23
  ...restProps
16
24
  }: CalendarPrevButtonProps = $props();
17
25
  </script>
18
26
 
19
27
  {#snippet Fallback()}
20
- <ChevronLeft class="size-4" />
28
+ <ChevronLeft class="size-4 rtl:-scale-x-100" />
21
29
  {/snippet}
22
30
 
23
31
  <CalendarPrimitive.PrevButton
@@ -27,6 +35,15 @@
27
35
  "size-7 bg-transparent p-0 opacity-50 hover:opacity-100",
28
36
  className
29
37
  )}
30
- children={children || Fallback}
31
38
  {...restProps}
32
- />
39
+ >
40
+ {#snippet child({ props })}
41
+ <button {...props} aria-label={label ?? (props["aria-label"] as string | undefined)}>
42
+ {#if children}
43
+ {@render children()}
44
+ {:else}
45
+ {@render Fallback()}
46
+ {/if}
47
+ </button>
48
+ {/snippet}
49
+ </CalendarPrimitive.PrevButton>
@@ -1,5 +1,12 @@
1
1
  import { Calendar as CalendarPrimitive } from "bits-ui";
2
- export type CalendarPrevButtonProps = CalendarPrimitive.PrevButtonProps;
3
- declare const CalendarPrevButton: import("svelte").Component<CalendarPrimitive.PrevButtonProps, {}, "ref">;
2
+ export type CalendarPrevButtonProps = CalendarPrimitive.PrevButtonProps & {
3
+ /**
4
+ * The name a screen reader gives the button, in the page's language. The library names the button "Previous" and
5
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
6
+ * ("Previous") when it is not given.
7
+ */
8
+ label?: string;
9
+ };
10
+ declare const CalendarPrevButton: import("svelte").Component<CalendarPrevButtonProps, {}, "ref">;
4
11
  type CalendarPrevButton = ReturnType<typeof CalendarPrevButton>;
5
12
  export default CalendarPrevButton;
@@ -1,11 +1,17 @@
1
1
  <script lang="ts" module>
2
2
  import { Calendar as CalendarPrimitive, type WithoutChildrenOrChild } from "bits-ui";
3
- export type CalendarProps = WithoutChildrenOrChild<CalendarPrimitive.RootProps>;
3
+ export type CalendarProps = WithoutChildrenOrChild<CalendarPrimitive.RootProps> & {
4
+ /** The name a screen reader gives the button to the previous month, in the page's language. English when not given. */
5
+ previousLabel?: string;
6
+ /** The name a screen reader gives the button to the next month, in the page's language. English when not given. */
7
+ nextLabel?: string;
8
+ };
4
9
  </script>
5
10
 
6
11
  <script lang="ts">
7
12
  import * as Calendar from "./index.js";
8
13
  import { cn } from "../../../utils.js";
14
+ import { describeCalendarWeekdayHeading } from "../../../i18n/localeDate.js";
9
15
 
10
16
  let {
11
17
  ref = $bindable(null),
@@ -13,6 +19,9 @@
13
19
  placeholder = $bindable(),
14
20
  class: className,
15
21
  weekdayFormat = "short",
22
+ previousLabel,
23
+ nextLabel,
24
+ locale: calendarLocale = 'en',
16
25
  ...restProps
17
26
  }: CalendarProps = $props();
18
27
  </script>
@@ -26,23 +35,26 @@ get along, so we shut typescript up by casting `value` to `never`.
26
35
  bind:ref
27
36
  bind:placeholder
28
37
  {weekdayFormat}
38
+ locale={calendarLocale}
29
39
  class={cn("p-3", className)}
30
40
  {...restProps}
31
41
  >
32
42
  {#snippet children({ months, weekdays })}
33
43
  <Calendar.Header>
34
- <Calendar.PrevButton />
44
+ <Calendar.PrevButton label={previousLabel} />
35
45
  <Calendar.Heading />
36
- <Calendar.NextButton />
46
+ <Calendar.NextButton label={nextLabel} />
37
47
  </Calendar.Header>
38
48
  <Calendar.Months>
39
49
  {#each months as month}
40
50
  <Calendar.Grid>
41
51
  <Calendar.GridHead>
42
52
  <Calendar.GridRow class="flex">
43
- {#each weekdays as weekday}
44
- <Calendar.HeadCell>
45
- {weekday.slice(0, 2)}
53
+ {#each weekdays as weekday, weekdayIndex}
54
+ {@const weekdayHeading = describeCalendarWeekdayHeading(String(calendarLocale), weekdayIndex)}
55
+ <!-- A one-letter name (a language written right to left) carries the whole name for a screen reader. -->
56
+ <Calendar.HeadCell aria-label={weekdayHeading.fullName}>
57
+ {weekdayHeading.label || weekday}
46
58
  </Calendar.HeadCell>
47
59
  {/each}
48
60
  </Calendar.GridRow>
@@ -1,5 +1,10 @@
1
1
  import { Calendar as CalendarPrimitive, type WithoutChildrenOrChild } from "bits-ui";
2
- export type CalendarProps = WithoutChildrenOrChild<CalendarPrimitive.RootProps>;
2
+ export type CalendarProps = WithoutChildrenOrChild<CalendarPrimitive.RootProps> & {
3
+ /** The name a screen reader gives the button to the previous month, in the page's language. English when not given. */
4
+ previousLabel?: string;
5
+ /** The name a screen reader gives the button to the next month, in the page's language. English when not given. */
6
+ nextLabel?: string;
7
+ };
3
8
  import * as Calendar from "./index.js";
4
9
  declare const Calendar: import("svelte").Component<CalendarProps, {}, "placeholder" | "ref" | "value">;
5
10
  type Calendar = ReturnType<typeof Calendar>;
@@ -16,7 +16,7 @@
16
16
  </script>
17
17
 
18
18
  <div class="flex items-center border-b px-2" data-command-input-wrapper="">
19
- <Search class="mr-2 size-4 shrink-0 opacity-50" />
19
+ <Search class="me-2 size-4 shrink-0 opacity-50" />
20
20
  <CommandPrimitive.Input
21
21
  class={cn(
22
22
  "placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
@@ -18,7 +18,7 @@
18
18
 
19
19
  <span
20
20
  bind:this={ref}
21
- class={cn("text-muted-foreground ml-auto text-xs tracking-widest", className)}
21
+ class={cn("text-muted-foreground ms-auto text-xs tracking-widest", className)}
22
22
  {...restProps}
23
23
  >
24
24
  {@render children?.()}
@@ -9,10 +9,13 @@
9
9
  ref = $bindable(null),
10
10
  class: className,
11
11
  portalProps,
12
+ // The name the close button has for a screen reader (it is drawn as an X): a page in another language gives its own.
13
+ closeLabel = "Close",
12
14
  children,
13
15
  ...restProps
14
16
  }: WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
15
17
  portalProps?: DialogPrimitive.PortalProps;
18
+ closeLabel?: string;
16
19
  children: Snippet;
17
20
  } = $props();
18
21
  </script>
@@ -29,10 +32,10 @@
29
32
  >
30
33
  {@render children?.()}
31
34
  <DialogPrimitive.Close
32
- class="ring-offset-background focus:ring-ring absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none"
35
+ class="ring-offset-background focus:ring-ring absolute end-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none"
33
36
  >
34
37
  <X class="size-4" />
35
- <span class="sr-only">Close</span>
38
+ <span class="sr-only">{closeLabel}</span>
36
39
  </DialogPrimitive.Close>
37
40
  </DialogPrimitive.Content>
38
41
  </Dialog.Portal>
@@ -2,6 +2,7 @@ import { Dialog as DialogPrimitive, type WithoutChildrenOrChild } from "bits-ui"
2
2
  import type { Snippet } from "svelte";
3
3
  type $$ComponentProps = WithoutChildrenOrChild<DialogPrimitive.ContentProps> & {
4
4
  portalProps?: DialogPrimitive.PortalProps;
5
+ closeLabel?: string;
5
6
  children: Snippet;
6
7
  };
7
8
  declare const DialogContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
@@ -18,7 +18,7 @@
18
18
 
19
19
  <div
20
20
  bind:this={ref}
21
- class={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)}
21
+ class={cn("flex flex-col space-y-1.5 text-center sm:text-start", className)}
22
22
  {...restProps}
23
23
  >
24
24
  {@render children?.()}
@@ -18,7 +18,7 @@
18
18
 
19
19
  <div
20
20
  bind:this={ref}
21
- class={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
21
+ class={cn("grid gap-1.5 p-4 text-center sm:text-start", className)}
22
22
  {...restProps}
23
23
  >
24
24
  {@render children?.()}
@@ -22,13 +22,13 @@
22
22
  bind:checked
23
23
  bind:indeterminate
24
24
  class={cn(
25
- "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",
25
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",
26
26
  className
27
27
  )}
28
28
  {...restProps}
29
29
  >
30
30
  {#snippet children({ checked, indeterminate })}
31
- <span class="absolute left-2 flex size-3.5 items-center justify-center">
31
+ <span class="absolute start-2 flex size-3.5 items-center justify-center">
32
32
  {#if indeterminate}
33
33
  <Minus class="size-4" />
34
34
  {:else}
@@ -1,6 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { cn } from "../../../utils.js";
3
3
  import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
4
+ import { useTextDirection } from "../../textDirection.js";
5
+
6
+ // The library writes dir="ltr" on the floating element unless it is told the direction: left to right text and
7
+ // alignment inside a menu of a right to left screen.
8
+ const textDirection = useTextDirection();
4
9
 
5
10
  let {
6
11
  ref = $bindable(null),
@@ -17,6 +22,7 @@
17
22
  <DropdownMenuPrimitive.Content
18
23
  bind:ref
19
24
  {sideOffset}
25
+ dir={$textDirection}
20
26
  class={cn(
21
27
  "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md outline-hidden",
22
28
  className
@@ -14,6 +14,6 @@
14
14
 
15
15
  <DropdownMenuPrimitive.GroupHeading
16
16
  bind:ref
17
- class={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
17
+ class={cn("px-2 py-1.5 text-sm font-semibold", inset && "ps-8", className)}
18
18
  {...restProps}
19
19
  />
@@ -16,7 +16,7 @@
16
16
  bind:ref
17
17
  class={cn(
18
18
  "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
19
- inset && "pl-8",
19
+ inset && "ps-8",
20
20
  className
21
21
  )}
22
22
  {...restProps}
@@ -16,7 +16,7 @@
16
16
 
17
17
  <div
18
18
  bind:this={ref}
19
- class={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
19
+ class={cn("px-2 py-1.5 text-sm font-semibold", inset && "ps-8", className)}
20
20
  {...restProps}
21
21
  >
22
22
  {@render children?.()}
@@ -18,13 +18,13 @@
18
18
  <DropdownMenuPrimitive.RadioItem
19
19
  bind:ref
20
20
  class={cn(
21
- "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",
21
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 ps-8 pe-2 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",
22
22
  className
23
23
  )}
24
24
  {...restProps}
25
25
  >
26
26
  {#snippet children({ checked })}
27
- <span class="absolute left-2 flex size-3.5 items-center justify-center">
27
+ <span class="absolute start-2 flex size-3.5 items-center justify-center">
28
28
  {#if checked}
29
29
  <Circle class="size-2 fill-current" />
30
30
  {/if}
@@ -18,7 +18,7 @@
18
18
 
19
19
  <span
20
20
  bind:this={ref}
21
- class={cn("ml-auto text-xs tracking-widest opacity-60", className)}
21
+ class={cn("ms-auto text-xs tracking-widest opacity-60", className)}
22
22
  {...restProps}
23
23
  >
24
24
  {@render children?.()}
@@ -4,7 +4,12 @@
4
4
  </script>
5
5
 
6
6
  <script lang="ts">
7
- import { cn } from "../../../utils.js";
7
+ import { cn } from "../../../utils.js";
8
+ import { useTextDirection } from "../../textDirection.js";
9
+
10
+ // The library writes dir="ltr" on the floating element unless it is told the direction: left to right text and
11
+ // alignment inside a menu of a right to left screen.
12
+ const textDirection = useTextDirection();
8
13
 
9
14
  let {
10
15
  ref = $bindable(null),
@@ -15,6 +20,7 @@
15
20
 
16
21
  <DropdownMenuPrimitive.SubContent
17
22
  bind:ref
23
+ dir={$textDirection}
18
24
  class={cn(
19
25
  "bg-popover text-popover-foreground z-50 min-w-[8rem] rounded-md border p-1 shadow-lg focus:outline-hidden",
20
26
  className
@@ -18,11 +18,11 @@
18
18
  bind:ref
19
19
  class={cn(
20
20
  "data-highlighted:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
21
- inset && "pl-8",
21
+ inset && "ps-8",
22
22
  className
23
23
  )}
24
24
  {...restProps}
25
25
  >
26
26
  {@render children?.()}
27
- <ChevronRight class="ml-auto" />
27
+ <ChevronRight class="ms-auto rtl:-scale-x-100" />
28
28
  </DropdownMenuPrimitive.SubTrigger>
@@ -1,6 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { LinkPreview as HoverCardPrimitive } from "bits-ui";
3
3
  import { cn } from "../../../utils.js";
4
+ import { useTextDirection } from "../../textDirection.js";
5
+
6
+ // The library writes dir="ltr" on the floating element unless it is told the direction: left to right text and
7
+ // alignment inside a menu of a right to left screen.
8
+ const textDirection = useTextDirection();
4
9
 
5
10
  let {
6
11
  ref = $bindable(null),
@@ -19,6 +24,7 @@
19
24
  bind:ref
20
25
  {align}
21
26
  {sideOffset}
27
+ dir={$textDirection}
22
28
  class={cn(
23
29
  "bg-popover text-popover-foreground z-50 mt-3 w-64 rounded-md border p-4 shadow-md outline-hidden",
24
30
  className
@@ -19,7 +19,7 @@
19
19
  {cell}
20
20
  bind:ref
21
21
  class={cn(
22
- "border-input relative flex h-10 w-10 items-center justify-center border-y border-r text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
22
+ "border-input relative flex h-10 w-10 items-center justify-center border-y border-e text-sm transition-all first:rounded-s-md first:border-s last:rounded-e-md",
23
23
  cell.isActive && "ring-ring ring-offset-background z-10 ring-2",
24
24
  className
25
25
  )}
@@ -1,6 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { cn } from "../../../utils.js";
3
3
  import { Popover as PopoverPrimitive } from "bits-ui";
4
+ import { useTextDirection } from "../../textDirection.js";
5
+
6
+ // The library writes dir="ltr" on the floating element unless it is told the direction: left to right text and
7
+ // alignment inside a menu of a right to left screen.
8
+ const textDirection = useTextDirection();
4
9
 
5
10
  let {
6
11
  ref = $bindable(null),
@@ -19,6 +24,7 @@
19
24
  bind:ref
20
25
  {sideOffset}
21
26
  {align}
27
+ dir={$textDirection}
22
28
  class={cn(
23
29
  "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-hidden",
24
30
  className
@@ -23,7 +23,7 @@
23
23
  {...restProps}
24
24
  >
25
25
  <div
26
- class="bg-primary h-full w-full flex-1 transition-all"
27
- style={`transform: translateX(-${100 - (100 * (value ?? 0)) / (max ?? 1)}%)`}
26
+ class="bg-primary h-full w-full flex-1 -translate-x-(--progress-remaining) transition-all rtl:translate-x-(--progress-remaining)"
27
+ style={`--progress-remaining: ${100 - (100 * (value ?? 0)) / (max ?? 1)}%`}
28
28
  ></div>
29
29
  </ProgressPrimitive.Root>
@@ -16,7 +16,7 @@
16
16
  <RangeCalendarPrimitive.Cell
17
17
  bind:ref
18
18
  class={cn(
19
- "[&:has([data-selected])]:bg-accent [&:has([data-selected][data-outside-month])]:bg-accent/50 relative size-9 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:[&:has([data-selected])]:rounded-l-md last:[&:has([data-selected])]:rounded-r-md [&:has([data-selected][data-selection-end])]:rounded-r-md [&:has([data-selected][data-selection-start])]:rounded-l-md",
19
+ "[&:has([data-selected])]:bg-accent [&:has([data-selected][data-outside-month])]:bg-accent/50 relative size-9 p-0 text-center text-sm focus-within:relative focus-within:z-20 first:[&:has([data-selected])]:rounded-s-md last:[&:has([data-selected])]:rounded-e-md [&:has([data-selected][data-selection-end])]:rounded-e-md [&:has([data-selected][data-selection-start])]:rounded-s-md",
20
20
  className
21
21
  )}
22
22
  {...restProps}
@@ -1,6 +1,13 @@
1
1
  <script lang="ts" module>
2
2
  import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
3
- export type RangeCalendarNextButtonProps = RangeCalendarPrimitive.NextButtonProps;
3
+ export type RangeCalendarNextButtonProps = RangeCalendarPrimitive.NextButtonProps & {
4
+ /**
5
+ * The name a screen reader gives the button, in the page's language. The library names the button "Next" and
6
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
7
+ * ("Next") when it is not given.
8
+ */
9
+ label?: string;
10
+ };
4
11
  </script>
5
12
 
6
13
  <script lang="ts">
@@ -12,12 +19,13 @@
12
19
  ref = $bindable(null),
13
20
  class: className,
14
21
  children,
22
+ label,
15
23
  ...restProps
16
24
  }: RangeCalendarNextButtonProps = $props();
17
25
  </script>
18
26
 
19
27
  {#snippet Fallback()}
20
- <ChevronRight class="size-4" />
28
+ <ChevronRight class="size-4 rtl:-scale-x-100" />
21
29
  {/snippet}
22
30
 
23
31
  <RangeCalendarPrimitive.NextButton
@@ -27,6 +35,15 @@
27
35
  "size-7 bg-transparent p-0 opacity-50 hover:opacity-100",
28
36
  className
29
37
  )}
30
- children={children || Fallback}
31
38
  {...restProps}
32
- />
39
+ >
40
+ {#snippet child({ props })}
41
+ <button {...props} aria-label={label ?? (props["aria-label"] as string | undefined)}>
42
+ {#if children}
43
+ {@render children()}
44
+ {:else}
45
+ {@render Fallback()}
46
+ {/if}
47
+ </button>
48
+ {/snippet}
49
+ </RangeCalendarPrimitive.NextButton>
@@ -1,5 +1,12 @@
1
1
  import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
2
- export type RangeCalendarNextButtonProps = RangeCalendarPrimitive.NextButtonProps;
3
- declare const RangeCalendarNextButton: import("svelte").Component<RangeCalendarPrimitive.NextButtonProps, {}, "ref">;
2
+ export type RangeCalendarNextButtonProps = RangeCalendarPrimitive.NextButtonProps & {
3
+ /**
4
+ * The name a screen reader gives the button, in the page's language. The library names the button "Next" and
5
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
6
+ * ("Next") when it is not given.
7
+ */
8
+ label?: string;
9
+ };
10
+ declare const RangeCalendarNextButton: import("svelte").Component<RangeCalendarNextButtonProps, {}, "ref">;
4
11
  type RangeCalendarNextButton = ReturnType<typeof RangeCalendarNextButton>;
5
12
  export default RangeCalendarNextButton;
@@ -1,6 +1,13 @@
1
1
  <script lang="ts" module>
2
2
  import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
3
- export type RangeCalendarPrevButtonProps = RangeCalendarPrimitive.PrevButtonProps;
3
+ export type RangeCalendarPrevButtonProps = RangeCalendarPrimitive.PrevButtonProps & {
4
+ /**
5
+ * The name a screen reader gives the button, in the page's language. The library names the button "Previous" and
6
+ * keeps that name whatever props it is given, so this one is put on the button after the library's own. English
7
+ * ("Previous") when it is not given.
8
+ */
9
+ label?: string;
10
+ };
4
11
  </script>
5
12
 
6
13
  <script lang="ts">
@@ -12,12 +19,13 @@
12
19
  ref = $bindable(null),
13
20
  class: className,
14
21
  children,
22
+ label,
15
23
  ...restProps
16
24
  }: RangeCalendarPrevButtonProps = $props();
17
25
  </script>
18
26
 
19
27
  {#snippet Fallback()}
20
- <ChevronLeft class="size-4" />
28
+ <ChevronLeft class="size-4 rtl:-scale-x-100" />
21
29
  {/snippet}
22
30
 
23
31
  <RangeCalendarPrimitive.PrevButton
@@ -27,6 +35,15 @@
27
35
  "size-7 bg-transparent p-0 opacity-50 hover:opacity-100",
28
36
  className
29
37
  )}
30
- children={children || Fallback}
31
38
  {...restProps}
32
- />
39
+ >
40
+ {#snippet child({ props })}
41
+ <button {...props} aria-label={label ?? (props["aria-label"] as string | undefined)}>
42
+ {#if children}
43
+ {@render children()}
44
+ {:else}
45
+ {@render Fallback()}
46
+ {/if}
47
+ </button>
48
+ {/snippet}
49
+ </RangeCalendarPrimitive.PrevButton>