flowbite-svelte 1.8.4 → 1.8.5

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.
@@ -6,10 +6,41 @@
6
6
  import { Button, ToolbarButton, type DatepickerProps, cn } from "..";
7
7
  import { datepicker } from "./theme";
8
8
 
9
- let { value = $bindable(), defaultDate = null, range = false, rangeFrom = $bindable(), rangeTo = $bindable(), availableFrom = null, availableTo = null, locale = "default", firstDayOfWeek = 0, dateFormat, placeholder = "Select date", disabled = false, required = false, inputClass = "", color = "primary", inline = false, autohide = true, showActionButtons = false, title = "", onselect, onclear, onapply, btnClass, inputmode = "none", classes, monthColor = "alternative", monthBtnSelected = "bg-primary-500 text-white", monthBtn = "text-gray-700 dark:text-gray-300", class: className }: DatepickerProps = $props();
9
+ let {
10
+ value = $bindable(),
11
+ defaultDate = null,
12
+ range = false,
13
+ rangeFrom = $bindable(),
14
+ rangeTo = $bindable(),
15
+ availableFrom = null,
16
+ availableTo = null,
17
+ locale = "default",
18
+ translationLocale = locale, // NEW: Separate locale for translations, defaults to locale for backward compatibility
19
+ firstDayOfWeek = 0,
20
+ dateFormat,
21
+ placeholder = "Select date",
22
+ disabled = false,
23
+ required = false,
24
+ inputClass = "",
25
+ color = "primary",
26
+ inline = false,
27
+ autohide = true,
28
+ showActionButtons = false,
29
+ title = "",
30
+ onselect,
31
+ onclear,
32
+ onapply,
33
+ btnClass,
34
+ inputmode = "none",
35
+ classes,
36
+ monthColor = "alternative",
37
+ monthBtnSelected = "bg-primary-500 text-white",
38
+ monthBtn = "text-gray-700 dark:text-gray-300",
39
+ class: className
40
+ }: DatepickerProps & { translationLocale?: string } = $props();
10
41
 
11
42
  const dateFormatDefault = { year: "numeric", month: "long", day: "numeric" };
12
- // const dateFormatOptions = $derived(dateFormat ?? dateFormatDefault);
43
+
13
44
  // Internal state
14
45
  let isOpen: boolean = $state(inline);
15
46
  let showMonthSelector: boolean = $state(false);
@@ -60,17 +91,18 @@
60
91
  return daysArray;
61
92
  }
62
93
 
94
+ // MODIFIED: Use translationLocale for weekday names
63
95
  const getWeekdayNames = (): string[] => {
64
- return Array.from({ length: 7 }, (_, i) => new Date(1970, 0, 5 + i + firstDayOfWeek).toLocaleDateString(locale, { weekday: "short" }));
96
+ return Array.from({ length: 7 }, (_, i) => new Date(1970, 0, 5 + i + firstDayOfWeek).toLocaleDateString(translationLocale, { weekday: "short" }));
65
97
  };
66
- let weekdays = getWeekdayNames();
98
+ let weekdays = $derived(getWeekdayNames());
67
99
 
100
+ // MODIFIED: Use translationLocale for month names
68
101
  const getMonthNames = (): string[] => {
69
- return Array.from({ length: 12 }, (_, i) => new Date(2000, i, 1).toLocaleDateString(locale, { month: "short" }));
102
+ return Array.from({ length: 12 }, (_, i) => new Date(2000, i, 1).toLocaleDateString(translationLocale, { month: "short" }));
70
103
  };
71
- let monthNames = getMonthNames();
104
+ let monthNames = $derived(getMonthNames());
72
105
 
73
- // const addMonth = (date: Date, increment: number): Date => new Date(date.getFullYear(), date.getMonth() + increment, 1);
74
106
  const addDay = (date: Date, increment: number): Date => new Date(date.getFullYear(), date.getMonth(), date.getDate() + increment);
75
107
 
76
108
  function changeMonth(increment: number) {
@@ -92,7 +124,6 @@
92
124
  showMonthSelector = !showMonthSelector;
93
125
  }
94
126
 
95
- // Helper function to check if a date is available for selection
96
127
  function isDateAvailable(date: Date): boolean {
97
128
  const dateOnly = new Date(date.getFullYear(), date.getMonth(), date.getDate());
98
129
 
@@ -110,7 +141,6 @@
110
141
  }
111
142
 
112
143
  function handleDaySelect(day: Date) {
113
- // Don't allow selection of unavailable dates
114
144
  if (!isDateAvailable(day)) return;
115
145
 
116
146
  if (range) {
@@ -145,6 +175,7 @@
145
175
  }
146
176
  }
147
177
 
178
+ // MODIFIED: Use locale for formatting (not translationLocale)
148
179
  const formatDate = (date?: Date): string => date?.toLocaleDateString(locale, dateFormat) ?? "";
149
180
  const isSameDate = (date1?: Date, date2?: Date): boolean => date1?.toDateString() === date2?.toDateString();
150
181
  const isToday = (day: Date): boolean => isSameDate(day, new Date());
@@ -189,9 +220,9 @@
189
220
  currentMonth = new Date(focusedDate.getFullYear(), focusedDate.getMonth(), 1);
190
221
  }
191
222
 
192
- // Focus the button for the focused date
223
+ // MODIFIED: Use translationLocale for aria-label
193
224
  setTimeout(() => {
194
- const focusedButton = calendarRef?.querySelector(`button[aria-label="${focusedDate!.toLocaleDateString(locale, { weekday: "long", year: "numeric", month: "long", day: "numeric" })}"]`) as HTMLButtonElement | null;
225
+ const focusedButton = calendarRef?.querySelector(`button[aria-label="${focusedDate!.toLocaleDateString(translationLocale, { weekday: "long", year: "numeric", month: "long", day: "numeric" })}"]`) as HTMLButtonElement | null;
195
226
  focusedButton?.focus();
196
227
  }, 0);
197
228
  }
@@ -271,8 +302,9 @@
271
302
  <!-- Regular Calendar View -->
272
303
  <div class={nav({ class: clsx(classes?.nav) })}>
273
304
  {@render navButton(false)}
305
+ <!-- MODIFIED: Use translationLocale for month/year display -->
274
306
  <Button type="button" class={cn(polite({ class: clsx(classes?.polite) }), "cursor-pointer rounded px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-700")} aria-live="polite" onclick={(event: MouseEvent) => toggleMonthSelector(event)}>
275
- {currentMonth.toLocaleString(locale, { month: "long", year: "numeric" })}
307
+ {currentMonth.toLocaleString(translationLocale, { month: "long", year: "numeric" })}
276
308
  </Button>
277
309
  {@render navButton(true)}
278
310
  </div>
@@ -295,7 +327,7 @@
295
327
  })}
296
328
  onclick={() => handleDaySelect(day)}
297
329
  onkeydown={handleCalendarKeydown}
298
- aria-label={day.toLocaleDateString(locale, { weekday: "long", year: "numeric", month: "long", day: "numeric" })}
330
+ aria-label={day.toLocaleDateString(translationLocale, { weekday: "long", year: "numeric", month: "long", day: "numeric" })}
299
331
  aria-selected={isSelected(day)}
300
332
  aria-disabled={!available}
301
333
  disabled={!available}
@@ -317,40 +349,3 @@
317
349
  </div>
318
350
  {/if}
319
351
  </div>
320
-
321
- <!--
322
- @component
323
- [Go to docs](https://flowbite-svelte.com/)
324
- ## Type
325
- [DatepickerProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L487)
326
- ## Props
327
- @prop value = $bindable()
328
- @prop defaultDate = null
329
- @prop range = false
330
- @prop rangeFrom = $bindable()
331
- @prop rangeTo = $bindable()
332
- @prop availableFrom = null
333
- @prop availableTo = null
334
- @prop locale = "default"
335
- @prop firstDayOfWeek = 0
336
- @prop dateFormat
337
- @prop placeholder = "Select date"
338
- @prop disabled = false
339
- @prop required = false
340
- @prop inputClass = ""
341
- @prop color = "primary"
342
- @prop inline = false
343
- @prop autohide = true
344
- @prop showActionButtons = false
345
- @prop title = ""
346
- @prop onselect
347
- @prop onclear
348
- @prop onapply
349
- @prop btnClass
350
- @prop inputmode = "none"
351
- @prop classes
352
- @prop monthColor = "alternative"
353
- @prop monthBtnSelected = "bg-primary-500 text-white"
354
- @prop monthBtn = "text-gray-700 dark:text-gray-300"
355
- @prop class: className
356
- -->
@@ -1,39 +1,7 @@
1
1
  import { type DatepickerProps } from "..";
2
- /**
3
- * [Go to docs](https://flowbite-svelte.com/)
4
- * ## Type
5
- * [DatepickerProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L487)
6
- * ## Props
7
- * @prop value = $bindable()
8
- * @prop defaultDate = null
9
- * @prop range = false
10
- * @prop rangeFrom = $bindable()
11
- * @prop rangeTo = $bindable()
12
- * @prop availableFrom = null
13
- * @prop availableTo = null
14
- * @prop locale = "default"
15
- * @prop firstDayOfWeek = 0
16
- * @prop dateFormat
17
- * @prop placeholder = "Select date"
18
- * @prop disabled = false
19
- * @prop required = false
20
- * @prop inputClass = ""
21
- * @prop color = "primary"
22
- * @prop inline = false
23
- * @prop autohide = true
24
- * @prop showActionButtons = false
25
- * @prop title = ""
26
- * @prop onselect
27
- * @prop onclear
28
- * @prop onapply
29
- * @prop btnClass
30
- * @prop inputmode = "none"
31
- * @prop classes
32
- * @prop monthColor = "alternative"
33
- * @prop monthBtnSelected = "bg-primary-500 text-white"
34
- * @prop monthBtn = "text-gray-700 dark:text-gray-300"
35
- * @prop class: className
36
- */
37
- declare const Datepicker: import("svelte").Component<DatepickerProps, {}, "value" | "rangeFrom" | "rangeTo">;
2
+ type $$ComponentProps = DatepickerProps & {
3
+ translationLocale?: string;
4
+ };
5
+ declare const Datepicker: import("svelte").Component<$$ComponentProps, {}, "value" | "rangeFrom" | "rangeTo">;
38
6
  type Datepicker = ReturnType<typeof Datepicker>;
39
7
  export default Datepicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbite-svelte",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "Flowbite components for Svelte",
5
5
  "main": "dist/index.js",
6
6
  "author": {
@@ -12,26 +12,26 @@
12
12
  "homepage": "https://flowbite-svelte.com/",
13
13
  "license": "MIT",
14
14
  "devDependencies": {
15
- "@changesets/cli": "2.29.2",
15
+ "@changesets/cli": "2.29.5",
16
16
  "@docsearch/css": "^3.9.0",
17
17
  "@docsearch/js": "^3.9.0",
18
18
  "@eslint/compat": "^1.3.1",
19
19
  "@eslint/js": "^9.30.1",
20
20
  "@flowbite-svelte-plugins/chart": "^0.2.4",
21
21
  "@flowbite-svelte-plugins/datatable": "^0.4.0",
22
- "@flowbite-svelte-plugins/texteditor": "^0.23.1",
22
+ "@flowbite-svelte-plugins/texteditor": "^0.24.0",
23
23
  "@playwright/test": "^1.53.2",
24
24
  "@sveltejs/adapter-auto": "^6.0.1",
25
25
  "@sveltejs/adapter-vercel": "^5.7.2",
26
26
  "@sveltejs/kit": "^2.22.2",
27
- "@sveltejs/package": "2.3.11",
27
+ "@sveltejs/package": "2.3.12",
28
28
  "@sveltejs/vite-plugin-svelte": "^5.1.0",
29
29
  "@svitejs/changesets-changelog-github-compact": "^1.2.0",
30
30
  "@tailwindcss/vite": "^4.1.11",
31
31
  "@testing-library/jest-dom": "^6.6.3",
32
32
  "@testing-library/svelte": "^5.2.8",
33
33
  "@testing-library/user-event": "^14.6.1",
34
- "@tiptap/core": "^2.24.2",
34
+ "@tiptap/core": "3.0.0-beta.24",
35
35
  "dayjs": "^1.11.13",
36
36
  "deepmerge": "^4.3.1",
37
37
  "eslint": "^9.30.1",
@@ -51,7 +51,7 @@
51
51
  "prism-themes": "^1.9.0",
52
52
  "publint": "^0.3.12",
53
53
  "simple-datatables": "^10.0.0",
54
- "svelte": "^5.35.2",
54
+ "svelte": "^5.35.4",
55
55
  "svelte-check": "^4.2.2",
56
56
  "svelte-doc-llm": "^0.2.2",
57
57
  "svelte-lib-helpers": "^0.4.30",
@@ -60,7 +60,7 @@
60
60
  "tailwindcss": "^4.1.11",
61
61
  "tsx": "^4.20.3",
62
62
  "typescript": "^5.8.3",
63
- "typescript-eslint": "8.31.1",
63
+ "typescript-eslint": "8.36.0",
64
64
  "vite": "^6.3.5",
65
65
  "vite-plugin-devtools-json": "^0.2.1",
66
66
  "vitest": "^3.2.4"