@bridge-ui/vue 0.6.0 → 0.7.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 (76) hide show
  1. package/dist/Adapters/I18n/useI18nAdapter.d.ts +1 -1
  2. package/dist/Adapters/I18n/useI18nAdapter.js +4 -1
  3. package/dist/Components/Accordion/Accordion.vue_vue_type_script_setup_true_lang.js +1 -1
  4. package/dist/Components/Accordion/accordion.types.d.ts +2 -2
  5. package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +1 -1
  6. package/dist/Components/BaseField/BaseField.vue_vue_type_script_setup_true_lang.js +33 -28
  7. package/dist/Components/BaseField/BaseFieldCorner.js +5 -0
  8. package/dist/Components/BaseField/BaseFieldCorner.vue.d.ts +17 -0
  9. package/dist/Components/BaseField/BaseFieldCorner.vue_vue_type_script_setup_true_lang.js +17 -0
  10. package/dist/Components/BaseField/baseField.types.d.ts +4 -2
  11. package/dist/Components/BaseField/composables/useBaseField.d.ts +1 -1
  12. package/dist/Components/BaseField/composables/useBaseField.js +11 -8
  13. package/dist/Components/ColorField/composables/useColorField.d.ts +1 -1
  14. package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +154 -131
  15. package/dist/Components/DataTable/DataTablePagination.js +5 -0
  16. package/dist/Components/DataTable/DataTablePagination.vue.d.ts +24 -0
  17. package/dist/Components/DataTable/DataTablePagination.vue_vue_type_script_setup_true_lang.js +40 -0
  18. package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -3
  19. package/dist/Components/DataTable/composables/useDataTable.js +299 -280
  20. package/dist/Components/DataTable/composables/useDataTablePagination.d.ts +69 -0
  21. package/dist/Components/DataTable/composables/useDataTablePagination.js +130 -0
  22. package/dist/Components/DataTable/dataTable.types.d.ts +27 -12
  23. package/dist/Components/DataTable/dataTablePagination.types.d.ts +169 -0
  24. package/dist/Components/DataTable/index.d.ts +2 -1
  25. package/dist/Components/DateField/composables/useDateField.d.ts +1 -1
  26. package/dist/Components/DateRangeField/composables/useDateRangeField.d.ts +1 -1
  27. package/dist/Components/DateTimeField/composables/useDateTimeField.d.ts +1 -1
  28. package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.d.ts +1 -1
  29. package/dist/Components/FormField/FilledFormField.vue.d.ts +7 -7
  30. package/dist/Components/FormField/FilledFormField.vue_vue_type_script_setup_true_lang.js +32 -27
  31. package/dist/Components/FormField/FormFieldCorner.js +5 -0
  32. package/dist/Components/FormField/FormFieldCorner.vue.d.ts +17 -0
  33. package/dist/Components/FormField/FormFieldCorner.vue_vue_type_script_setup_true_lang.js +17 -0
  34. package/dist/Components/FormField/NotchedFormField.vue.d.ts +7 -7
  35. package/dist/Components/FormField/NotchedFormField.vue_vue_type_script_setup_true_lang.js +31 -26
  36. package/dist/Components/FormField/OutlinedFormField.vue.d.ts +7 -7
  37. package/dist/Components/FormField/OutlinedFormField.vue_vue_type_script_setup_true_lang.js +32 -27
  38. package/dist/Components/FormField/StackedFormField.vue.d.ts +6 -6
  39. package/dist/Components/FormField/StackedFormField.vue_vue_type_script_setup_true_lang.js +34 -29
  40. package/dist/Components/FormField/UnderlinedFormField.vue.d.ts +7 -7
  41. package/dist/Components/FormField/UnderlinedFormField.vue_vue_type_script_setup_true_lang.js +32 -27
  42. package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
  43. package/dist/Components/FormField/composables/useFormField.js +15 -9
  44. package/dist/Components/FormField/formField.types.d.ts +4 -2
  45. package/dist/Components/NumberField/composables/useNumberField.d.ts +1 -1
  46. package/dist/Components/OtpField/composables/useOtpField.d.ts +1 -1
  47. package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +6 -6
  48. package/dist/Components/Pagination/composables/usePagination.d.ts +4 -2
  49. package/dist/Components/Pagination/composables/usePagination.js +125 -127
  50. package/dist/Components/Pagination/pagination.types.d.ts +5 -5
  51. package/dist/Components/PasswordField/composables/usePasswordField.d.ts +1 -1
  52. package/dist/Components/Select/composables/useSelect.d.ts +1 -1
  53. package/dist/Components/Slider/composables/useSlider.d.ts +1 -1
  54. package/dist/Components/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +2 -2
  55. package/dist/Components/Tabs/composables/useTabs.js +16 -10
  56. package/dist/Components/Tabs/tabs.types.d.ts +3 -3
  57. package/dist/Components/TextField/composables/useTextField.d.ts +1 -1
  58. package/dist/Components/Textarea/composables/useTextarea.d.ts +1 -1
  59. package/dist/Components/TimeField/composables/useTimeField.d.ts +1 -1
  60. package/dist/Components/TimeRangeField/composables/useTimeRangeField.d.ts +1 -1
  61. package/dist/index.d.ts +1 -1
  62. package/dist/index.js +4 -4
  63. package/docs/components/Accordion.md +1 -1
  64. package/docs/components/DataTable.md +5 -11
  65. package/docs/components/I18n.md +65 -24
  66. package/docs/components/Pagination.md +5 -3
  67. package/docs/components/Table.md +2 -2
  68. package/docs/components/Tabs.md +24 -6
  69. package/docs/examples/i18n-dictionary.ts +28 -10
  70. package/docs/examples/i18n-vue-i18n.ts +7 -6
  71. package/docs/examples/icon-fontawesome.ts +4 -0
  72. package/docs/examples/icon-heroicons.ts +5 -1
  73. package/docs/examples/icon-lucide.ts +4 -0
  74. package/docs/examples/icon-phosphor.ts +4 -0
  75. package/docs/examples/icon-tabler.ts +4 -0
  76. package/package.json +2 -2
@@ -5,15 +5,19 @@
5
5
  *
6
6
  * Source English strings are the lookup keys (same strings Bridge passes to
7
7
  * `resolveMessage`). Messages are keyed by locale; optional `setLocale` updates
8
- * the active locale used by `t`. For replace / pluralization, wrap vue-i18n (or
9
- * similar) instead.
8
+ * the active locale used by `t`. `t` replaces `{{name}}` from `params` and
9
+ * picks `|` plural forms when `count` is set (`one | other`).
10
10
  */
11
11
 
12
12
  // ** External Imports
13
- import { get } from "es-toolkit/compat";
13
+ import { get, isNil } from "es-toolkit/compat";
14
14
 
15
15
  // ** Core Imports
16
- import type { I18nAdapter } from "@bridge-ui/core/Adapters";
16
+ import {
17
+ interpolateMessage,
18
+ selectPluralMessage,
19
+ type I18nAdapter,
20
+ } from "@bridge-ui/core/Adapters";
17
21
 
18
22
  // prettier-ignore
19
23
  const MESSAGES: Record<string, Record<string, string>> = {
@@ -21,25 +25,34 @@ const MESSAGES: Record<string, Record<string, string>> = {
21
25
  "pt-BR": {
22
26
  "OK": "OK",
23
27
  "Close": "Fechar",
24
- "Reset": "Redefinir",
28
+ "Next": "Próxima",
25
29
  "Columns": "Colunas",
30
+ "Reset": "Redefinir",
26
31
  "Search": "Pesquisar",
27
32
  "No data": "Sem dados",
28
- "Per page:": "Por página:",
33
+ "Previous": "Anterior",
34
+ "Loading": "Carregando",
35
+ "Pagination": "Paginação",
36
+ "Last page": "Última página",
29
37
  "Loading...": "Carregando...",
30
38
  "No options": "Nenhuma opção",
31
- "Select row": "Selecionar linha",
39
+ "Expand row": "Expandir linha",
40
+ "First page": "Primeira página",
32
41
  "Hide password": "Ocultar senha",
42
+ "Select row": "Selecionar linha",
33
43
  "Show password": "Mostrar senha",
34
44
  "Filter column": "Filtrar coluna",
35
45
  "Clear selection": "Limpar seleção",
36
46
  "Decrement value": "Diminuir valor",
37
47
  "Increment value": "Aumentar valor",
48
+ "Rows per page": "Linhas por página",
38
49
  "Sort ascending": "Ordenar crescente",
39
50
  "Cancel sorting": "Cancelar ordenação",
40
51
  "Sort descending": "Ordenar decrescente",
41
- "Select all rows": "Selecionar todas as linhas",
42
52
  "Select all items": "Selecionar todos os itens",
53
+ "Select all rows": "Selecionar todas as linhas",
54
+ "Page {{page}} of {{count}}": "Página {{page}} de {{count}}",
55
+ "{{selected}} of {{total}} row(s) selected.": "{{selected}} de {{total}} linha selecionada. | {{selected}} de {{total}} linhas selecionadas.",
43
56
  },
44
57
  };
45
58
 
@@ -54,8 +67,13 @@ export function createDictionaryI18nAdapter(): I18nAdapter {
54
67
  setLocale(next) {
55
68
  locale = next;
56
69
  },
57
- t(message) {
58
- return get(MESSAGES, [locale, message], message);
70
+ t(message, count, params) {
71
+ const translated = get(MESSAGES, [locale, message], message);
72
+ const template = isNil(count)
73
+ ? translated
74
+ : selectPluralMessage(translated, count);
75
+
76
+ return interpolateMessage(template, params);
59
77
  },
60
78
  };
61
79
  }
@@ -3,12 +3,13 @@
3
3
  * Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.i18n`.
4
4
  * Not published as an npm package.
5
5
  *
6
- * Passes Bridge source strings and `params` straight to `i18n.t`
7
- * (interpolation, pluralization, etc. stay in vue-i18n).
6
+ * Passes Bridge source strings, `count`, and `params` to `i18n.t`
7
+ * (interpolation and `|` pluralization stay in vue-i18n).
8
8
  * `setLocale` on the adapter is invoked by Bridge `setLocale`.
9
9
  */
10
10
 
11
11
  // ** External Imports
12
+ import { isNil } from "es-toolkit/compat";
12
13
  import type { Composer } from "vue-i18n";
13
14
 
14
15
  // ** Core Imports
@@ -23,12 +24,12 @@ export function createVueI18nAdapter(i18n: Composer): I18nAdapter {
23
24
  setLocale(locale) {
24
25
  i18n.locale.value = locale;
25
26
  },
26
- t(message, params) {
27
- if (params) {
28
- return i18n.t(message, params);
27
+ t(message, count, params) {
28
+ if (isNil(count)) {
29
+ return params ? i18n.t(message, params) : i18n.t(message);
29
30
  }
30
31
 
31
- return i18n.t(message);
32
+ return params ? i18n.t(message, count, params) : i18n.t(message, count);
32
33
  },
33
34
  };
34
35
  }
@@ -10,6 +10,8 @@
10
10
  // ** External Imports
11
11
  import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";
12
12
  import {
13
+ faAnglesLeft,
14
+ faAnglesRight,
13
15
  faBell,
14
16
  faCalendarDays,
15
17
  faCheck,
@@ -117,7 +119,9 @@ const icons = {
117
119
  alert: faCircleExclamation,
118
120
  chevronDown: faChevronDown,
119
121
  chevronLeft: faChevronLeft,
122
+ chevronsLeft: faAnglesLeft,
120
123
  chevronRight: faChevronRight,
124
+ chevronsRight: faAnglesRight,
121
125
  warning: faTriangleExclamation,
122
126
  } satisfies Record<SemanticIconName, unknown>;
123
127
 
@@ -13,6 +13,8 @@ import {
13
13
  CalendarDaysIcon,
14
14
  CheckCircleIcon,
15
15
  CheckIcon,
16
+ ChevronDoubleLeftIcon,
17
+ ChevronDoubleRightIcon,
16
18
  ChevronDownIcon,
17
19
  ChevronLeftIcon,
18
20
  ChevronRightIcon,
@@ -67,8 +69,10 @@ const icons = {
67
69
  chevronDown: ChevronDownIcon,
68
70
  chevronLeft: ChevronLeftIcon,
69
71
  chevronRight: ChevronRightIcon,
70
- warning: ExclamationTriangleIcon,
71
72
  chevronUpDown: ChevronUpDownIcon,
73
+ warning: ExclamationTriangleIcon,
74
+ chevronsLeft: ChevronDoubleLeftIcon,
75
+ chevronsRight: ChevronDoubleRightIcon,
72
76
  } satisfies Record<SemanticIconName, unknown>;
73
77
 
74
78
  /**
@@ -12,6 +12,8 @@ import {
12
12
  ChevronDown,
13
13
  ChevronLeft,
14
14
  ChevronRight,
15
+ ChevronsLeft,
16
+ ChevronsRight,
15
17
  ChevronsUpDown,
16
18
  ChevronUp,
17
19
  CircleAlert,
@@ -68,6 +70,8 @@ const icons = {
68
70
  chevronDown: ChevronDown,
69
71
  chevronLeft: ChevronLeft,
70
72
  chevronRight: ChevronRight,
73
+ chevronsLeft: ChevronsLeft,
74
+ chevronsRight: ChevronsRight,
71
75
  chevronUpDown: ChevronsUpDown,
72
76
  } satisfies Record<SemanticIconName, unknown>;
73
77
 
@@ -8,6 +8,8 @@
8
8
  import {
9
9
  PhBell,
10
10
  PhCalendarDots,
11
+ PhCaretDoubleLeft,
12
+ PhCaretDoubleRight,
11
13
  PhCaretDown,
12
14
  PhCaretLeft,
13
15
  PhCaretRight,
@@ -69,6 +71,8 @@ const icons = {
69
71
  download: PhDownloadSimple,
70
72
  chevronRight: PhCaretRight,
71
73
  chevronUpDown: PhCaretUpDown,
74
+ chevronsLeft: PhCaretDoubleLeft,
75
+ chevronsRight: PhCaretDoubleRight,
72
76
  } satisfies Record<SemanticIconName, unknown>;
73
77
 
74
78
  /**
@@ -14,6 +14,8 @@ import {
14
14
  IconChevronDown,
15
15
  IconChevronLeft,
16
16
  IconChevronRight,
17
+ IconChevronsLeft,
18
+ IconChevronsRight,
17
19
  IconChevronUp,
18
20
  IconCircleCheck,
19
21
  IconCircleX,
@@ -69,6 +71,8 @@ const icons = {
69
71
  chevronDown: IconChevronDown,
70
72
  chevronLeft: IconChevronLeft,
71
73
  chevronRight: IconChevronRight,
74
+ chevronsLeft: IconChevronsLeft,
75
+ chevronsRight: IconChevronsRight,
72
76
  } satisfies Record<SemanticIconName, unknown>;
73
77
 
74
78
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "license": "MIT",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "author": "BridgeUI",
6
6
  "sideEffects": false,
7
7
  "name": "@bridge-ui/vue",
@@ -89,7 +89,7 @@
89
89
  }
90
90
  },
91
91
  "dependencies": {
92
- "@bridge-ui/core": "^0.6.0",
92
+ "@bridge-ui/core": "^0.7.0",
93
93
  "clsx": "^2.1.1",
94
94
  "es-toolkit": "^1.50.0",
95
95
  "tailwind-merge": "^3.6.0"