@expcat/tigercat-core 1.1.0 → 1.2.14

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 (122) hide show
  1. package/README.md +1 -1
  2. package/dist/datepicker-locales/ar-SA.cjs +46 -0
  3. package/dist/datepicker-locales/ar-SA.d.cts +6 -0
  4. package/dist/datepicker-locales/ar-SA.d.ts +6 -0
  5. package/dist/datepicker-locales/ar-SA.js +20 -0
  6. package/dist/datepicker-locales/de-DE.cjs +46 -0
  7. package/dist/datepicker-locales/de-DE.d.cts +6 -0
  8. package/dist/datepicker-locales/de-DE.d.ts +6 -0
  9. package/dist/datepicker-locales/de-DE.js +20 -0
  10. package/dist/datepicker-locales/en-US.cjs +30 -7
  11. package/dist/datepicker-locales/en-US.js +5 -2
  12. package/dist/datepicker-locales/es-ES.cjs +46 -0
  13. package/dist/datepicker-locales/es-ES.d.cts +6 -0
  14. package/dist/datepicker-locales/es-ES.d.ts +6 -0
  15. package/dist/datepicker-locales/es-ES.js +20 -0
  16. package/dist/datepicker-locales/fr-FR.cjs +46 -0
  17. package/dist/datepicker-locales/fr-FR.d.cts +6 -0
  18. package/dist/datepicker-locales/fr-FR.d.ts +6 -0
  19. package/dist/datepicker-locales/fr-FR.js +20 -0
  20. package/dist/datepicker-locales/id-ID.cjs +30 -7
  21. package/dist/datepicker-locales/id-ID.js +5 -2
  22. package/dist/datepicker-locales/ja-JP.cjs +30 -7
  23. package/dist/datepicker-locales/ja-JP.js +5 -2
  24. package/dist/datepicker-locales/ko-KR.cjs +30 -7
  25. package/dist/datepicker-locales/ko-KR.js +5 -2
  26. package/dist/datepicker-locales/pt-BR.cjs +46 -0
  27. package/dist/datepicker-locales/pt-BR.d.cts +6 -0
  28. package/dist/datepicker-locales/pt-BR.d.ts +6 -0
  29. package/dist/datepicker-locales/pt-BR.js +20 -0
  30. package/dist/datepicker-locales/th-TH.cjs +30 -7
  31. package/dist/datepicker-locales/th-TH.js +5 -2
  32. package/dist/datepicker-locales/vi-VN.cjs +30 -7
  33. package/dist/datepicker-locales/vi-VN.js +5 -2
  34. package/dist/datepicker-locales/zh-CN.cjs +30 -7
  35. package/dist/datepicker-locales/zh-CN.js +5 -2
  36. package/dist/datepicker-locales/zh-TW.cjs +30 -7
  37. package/dist/datepicker-locales/zh-TW.js +5 -2
  38. package/dist/icons/common.cjs +43 -11
  39. package/dist/icons/common.js +11 -2
  40. package/dist/icons/picker.cjs +57 -18
  41. package/dist/icons/picker.js +18 -2
  42. package/dist/icons/status.cjs +35 -7
  43. package/dist/icons/status.js +7 -2
  44. package/dist/icons/table.cjs +39 -9
  45. package/dist/icons/table.js +9 -2
  46. package/dist/index.cjs +6703 -1719
  47. package/dist/index.d.cts +1940 -58
  48. package/dist/index.d.ts +1940 -58
  49. package/dist/index.js +4821 -159
  50. package/dist/{locale-CEmE5uq-.d.cts → locale-9-B-d0mp.d.cts} +6 -1
  51. package/dist/{locale-m1sF4KRO.d.ts → locale-Bc3zz2b0.d.ts} +6 -1
  52. package/dist/locales/ar-SA.cjs +155 -0
  53. package/dist/locales/ar-SA.d.cts +10 -0
  54. package/dist/locales/ar-SA.d.ts +10 -0
  55. package/dist/locales/ar-SA.js +128 -0
  56. package/dist/locales/de-DE.cjs +155 -0
  57. package/dist/locales/de-DE.d.cts +10 -0
  58. package/dist/locales/de-DE.d.ts +10 -0
  59. package/dist/locales/de-DE.js +128 -0
  60. package/dist/locales/en-US.cjs +29 -3
  61. package/dist/locales/en-US.d.cts +1 -1
  62. package/dist/locales/en-US.d.ts +1 -1
  63. package/dist/locales/en-US.js +5 -2
  64. package/dist/locales/es-ES.cjs +155 -0
  65. package/dist/locales/es-ES.d.cts +10 -0
  66. package/dist/locales/es-ES.d.ts +10 -0
  67. package/dist/locales/es-ES.js +128 -0
  68. package/dist/locales/fr-FR.cjs +155 -0
  69. package/dist/locales/fr-FR.d.cts +10 -0
  70. package/dist/locales/fr-FR.d.ts +10 -0
  71. package/dist/locales/fr-FR.js +128 -0
  72. package/dist/locales/id-ID.cjs +29 -3
  73. package/dist/locales/id-ID.d.cts +1 -1
  74. package/dist/locales/id-ID.d.ts +1 -1
  75. package/dist/locales/id-ID.js +5 -2
  76. package/dist/locales/ja-JP.cjs +29 -3
  77. package/dist/locales/ja-JP.d.cts +1 -1
  78. package/dist/locales/ja-JP.d.ts +1 -1
  79. package/dist/locales/ja-JP.js +5 -2
  80. package/dist/locales/ko-KR.cjs +29 -3
  81. package/dist/locales/ko-KR.d.cts +1 -1
  82. package/dist/locales/ko-KR.d.ts +1 -1
  83. package/dist/locales/ko-KR.js +5 -2
  84. package/dist/locales/pt-BR.cjs +155 -0
  85. package/dist/locales/pt-BR.d.cts +10 -0
  86. package/dist/locales/pt-BR.d.ts +10 -0
  87. package/dist/locales/pt-BR.js +128 -0
  88. package/dist/locales/th-TH.cjs +29 -3
  89. package/dist/locales/th-TH.d.cts +1 -1
  90. package/dist/locales/th-TH.d.ts +1 -1
  91. package/dist/locales/th-TH.js +5 -2
  92. package/dist/locales/vi-VN.cjs +29 -3
  93. package/dist/locales/vi-VN.d.cts +1 -1
  94. package/dist/locales/vi-VN.d.ts +1 -1
  95. package/dist/locales/vi-VN.js +5 -2
  96. package/dist/locales/zh-CN.cjs +29 -3
  97. package/dist/locales/zh-CN.d.cts +1 -1
  98. package/dist/locales/zh-CN.d.ts +1 -1
  99. package/dist/locales/zh-CN.js +5 -2
  100. package/dist/locales/zh-TW.cjs +29 -3
  101. package/dist/locales/zh-TW.d.cts +1 -1
  102. package/dist/locales/zh-TW.d.ts +1 -1
  103. package/dist/locales/zh-TW.js +5 -2
  104. package/dist/{table-export-Cy9DgTiO.d.cts → table-export-6ISYSoVB.d.cts} +35 -3
  105. package/dist/{table-export-Cy9DgTiO.d.ts → table-export-6ISYSoVB.d.ts} +35 -3
  106. package/dist/tailwind/modern.cjs +81 -18
  107. package/dist/tailwind/modern.js +49 -13
  108. package/dist/{tailwind-entry-2KPvkOin.d.ts → tailwind-entry-D4_sseNi.d.ts} +1 -1
  109. package/dist/{tailwind-entry-CUaMC8Ma.d.cts → tailwind-entry-DUchHtjs.d.cts} +1 -1
  110. package/dist/tailwind.cjs +75 -10
  111. package/dist/tailwind.d.cts +1 -1
  112. package/dist/tailwind.d.ts +1 -1
  113. package/dist/tailwind.js +43 -5
  114. package/dist/utils/table-export.cjs +79 -5
  115. package/dist/utils/table-export.d.cts +1 -1
  116. package/dist/utils/table-export.d.ts +1 -1
  117. package/dist/utils/table-export.js +47 -2
  118. package/package.json +60 -6
  119. package/tokens/figma-variables.json +2553 -0
  120. package/tokens/tailwind-tokens.js +145 -0
  121. package/tokens/tokens.css +640 -0
  122. package/tokens/tokens.json +395 -0
package/dist/tailwind.cjs CHANGED
@@ -1,12 +1,41 @@
1
- 'use strict';
2
-
3
- var plugin = require('tailwindcss/plugin');
4
-
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
6
29
 
7
- var plugin__default = /*#__PURE__*/_interopDefault(plugin);
30
+ // src/tailwind-entry.ts
31
+ var tailwind_entry_exports = {};
32
+ __export(tailwind_entry_exports, {
33
+ default: () => tigercatPlugin
34
+ });
35
+ module.exports = __toCommonJS(tailwind_entry_exports);
8
36
 
9
37
  // src/tailwind-plugin.ts
38
+ var import_plugin = __toESM(require("tailwindcss/plugin"), 1);
10
39
 
11
40
  // src/themes/modern/tokens.ts
12
41
  var MODERN_BASE_TOKENS_LIGHT = {
@@ -54,6 +83,16 @@ var MODERN_BASE_TOKENS_DARK = {
54
83
  "--tiger-shadow-glass": "0 1px 2px 0 rgb(0 0 0 / 0.2)",
55
84
  "--tiger-shadow-glass-strong": "0 4px 6px -1px rgb(0 0 0 / 0.3)"
56
85
  };
86
+ var MODERN_REDUCED_MOTION_TOKENS = {
87
+ "--tiger-motion-duration-instant": "0ms",
88
+ "--tiger-motion-duration-quick": "0ms",
89
+ "--tiger-motion-duration-base": "0ms",
90
+ "--tiger-motion-duration-relaxed": "0ms",
91
+ "--tiger-motion-duration-slow": "0ms",
92
+ "--tiger-transition-base": "all 0ms linear",
93
+ "--tiger-transition-quick": "all 0ms linear",
94
+ "--tiger-transition-emphasized": "transform 0ms linear"
95
+ };
57
96
 
58
97
  // src/tailwind-plugin.ts
59
98
  var tigercatTheme = {
@@ -127,15 +166,41 @@ var tigercatDarkTheme = {
127
166
  "--tiger-chart-5": "#38bdf8",
128
167
  "--tiger-chart-6": "#f87171"
129
168
  };
130
- var tigercatPlugin = plugin__default.default(function({ addBase }) {
169
+ var tigercatDirectionBase = {
170
+ '[dir="rtl"] .tiger-rtl-mirror, [data-tiger-dir="rtl"] .tiger-rtl-mirror': {
171
+ transform: "scaleX(-1)"
172
+ },
173
+ '[dir="rtl"] .tiger-text-start, [data-tiger-dir="rtl"] .tiger-text-start': {
174
+ textAlign: "right"
175
+ },
176
+ '[dir="rtl"] .tiger-text-end, [data-tiger-dir="rtl"] .tiger-text-end': {
177
+ textAlign: "left"
178
+ },
179
+ '[dir="rtl"] .tiger-flex-row, [data-tiger-dir="rtl"] .tiger-flex-row': {
180
+ flexDirection: "row-reverse"
181
+ }
182
+ };
183
+ var tigercatReducedMotionBase = {
184
+ "@media (prefers-reduced-motion: reduce)": {
185
+ ':root, [data-tiger-style="modern"]': MODERN_REDUCED_MOTION_TOKENS,
186
+ ".tiger-motion-aware, .tiger-motion-aware::before, .tiger-motion-aware::after, [data-tiger-motion]": {
187
+ animationDuration: "0ms",
188
+ animationDelay: "0ms",
189
+ transitionDuration: "0ms",
190
+ transitionDelay: "0ms",
191
+ scrollBehavior: "auto"
192
+ }
193
+ }
194
+ };
195
+ var tigercatPlugin = (0, import_plugin.default)(function({ addBase }) {
131
196
  addBase({
132
197
  ":root": { ...tigercatTheme, ...MODERN_BASE_TOKENS_LIGHT },
133
198
  ".dark": { ...tigercatDarkTheme, ...MODERN_BASE_TOKENS_DARK },
134
199
  // Remove browser default focus outline on interactive SVG elements
135
200
  'svg [tabindex], svg [role="button"]': {
136
201
  outline: "none"
137
- }
202
+ },
203
+ ...tigercatDirectionBase,
204
+ ...tigercatReducedMotionBase
138
205
  });
139
206
  });
140
-
141
- module.exports = tigercatPlugin;
@@ -1,3 +1,3 @@
1
- export { k as default } from './tailwind-entry-CUaMC8Ma.cjs';
1
+ export { k as default } from './tailwind-entry-DUchHtjs.cjs';
2
2
  import './types-CJYAW1ql.d-DDBFn6KB.cjs';
3
3
  import './resolve-config-QUZ9b-Gn.mjs';
@@ -1,3 +1,3 @@
1
- export { k as default } from './tailwind-entry-2KPvkOin.js';
1
+ export { k as default } from './tailwind-entry-D4_sseNi.js';
2
2
  import './types-CJYAW1ql.d-DDBFn6KB.js';
3
3
  import './resolve-config-QUZ9b-Gn.mjs';
package/dist/tailwind.js CHANGED
@@ -1,6 +1,5 @@
1
- import plugin from 'tailwindcss/plugin';
2
-
3
1
  // src/tailwind-plugin.ts
2
+ import plugin from "tailwindcss/plugin";
4
3
 
5
4
  // src/themes/modern/tokens.ts
6
5
  var MODERN_BASE_TOKENS_LIGHT = {
@@ -48,6 +47,16 @@ var MODERN_BASE_TOKENS_DARK = {
48
47
  "--tiger-shadow-glass": "0 1px 2px 0 rgb(0 0 0 / 0.2)",
49
48
  "--tiger-shadow-glass-strong": "0 4px 6px -1px rgb(0 0 0 / 0.3)"
50
49
  };
50
+ var MODERN_REDUCED_MOTION_TOKENS = {
51
+ "--tiger-motion-duration-instant": "0ms",
52
+ "--tiger-motion-duration-quick": "0ms",
53
+ "--tiger-motion-duration-base": "0ms",
54
+ "--tiger-motion-duration-relaxed": "0ms",
55
+ "--tiger-motion-duration-slow": "0ms",
56
+ "--tiger-transition-base": "all 0ms linear",
57
+ "--tiger-transition-quick": "all 0ms linear",
58
+ "--tiger-transition-emphasized": "transform 0ms linear"
59
+ };
51
60
 
52
61
  // src/tailwind-plugin.ts
53
62
  var tigercatTheme = {
@@ -121,6 +130,32 @@ var tigercatDarkTheme = {
121
130
  "--tiger-chart-5": "#38bdf8",
122
131
  "--tiger-chart-6": "#f87171"
123
132
  };
133
+ var tigercatDirectionBase = {
134
+ '[dir="rtl"] .tiger-rtl-mirror, [data-tiger-dir="rtl"] .tiger-rtl-mirror': {
135
+ transform: "scaleX(-1)"
136
+ },
137
+ '[dir="rtl"] .tiger-text-start, [data-tiger-dir="rtl"] .tiger-text-start': {
138
+ textAlign: "right"
139
+ },
140
+ '[dir="rtl"] .tiger-text-end, [data-tiger-dir="rtl"] .tiger-text-end': {
141
+ textAlign: "left"
142
+ },
143
+ '[dir="rtl"] .tiger-flex-row, [data-tiger-dir="rtl"] .tiger-flex-row': {
144
+ flexDirection: "row-reverse"
145
+ }
146
+ };
147
+ var tigercatReducedMotionBase = {
148
+ "@media (prefers-reduced-motion: reduce)": {
149
+ ':root, [data-tiger-style="modern"]': MODERN_REDUCED_MOTION_TOKENS,
150
+ ".tiger-motion-aware, .tiger-motion-aware::before, .tiger-motion-aware::after, [data-tiger-motion]": {
151
+ animationDuration: "0ms",
152
+ animationDelay: "0ms",
153
+ transitionDuration: "0ms",
154
+ transitionDelay: "0ms",
155
+ scrollBehavior: "auto"
156
+ }
157
+ }
158
+ };
124
159
  var tigercatPlugin = plugin(function({ addBase }) {
125
160
  addBase({
126
161
  ":root": { ...tigercatTheme, ...MODERN_BASE_TOKENS_LIGHT },
@@ -128,8 +163,11 @@ var tigercatPlugin = plugin(function({ addBase }) {
128
163
  // Remove browser default focus outline on interactive SVG elements
129
164
  'svg [tabindex], svg [role="button"]': {
130
165
  outline: "none"
131
- }
166
+ },
167
+ ...tigercatDirectionBase,
168
+ ...tigercatReducedMotionBase
132
169
  });
133
170
  });
134
-
135
- export { tigercatPlugin as default };
171
+ export {
172
+ tigercatPlugin as default
173
+ };
@@ -1,4 +1,34 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/table-export.ts
21
+ var table_export_exports = {};
22
+ __export(table_export_exports, {
23
+ downloadCsv: () => downloadCsv,
24
+ downloadExcel: () => downloadExcel,
25
+ downloadTableExport: () => downloadTableExport,
26
+ exportTableData: () => exportTableData,
27
+ exportTableToCsv: () => exportTableToCsv,
28
+ exportTableToExcel: () => exportTableToExcel,
29
+ tableExportButtonClasses: () => tableExportButtonClasses
30
+ });
31
+ module.exports = __toCommonJS(table_export_exports);
2
32
 
3
33
  // src/utils/table-export-utils.ts
4
34
  function escapeCsvValue(value) {
@@ -19,6 +49,22 @@ function exportTableToCsv(columns, data, _filename) {
19
49
  );
20
50
  return [headers.join(","), ...rows].join("\n");
21
51
  }
52
+ function escapeHtmlValue(value) {
53
+ const str = value === null || value === void 0 ? "" : String(value);
54
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
55
+ }
56
+ function exportTableToExcel(columns, data) {
57
+ const headerCells = columns.map((column) => `<th>${escapeHtmlValue(column.title)}</th>`).join("");
58
+ const bodyRows = data.map((record) => {
59
+ const cells = columns.map((column) => {
60
+ const key = column.dataKey || column.key;
61
+ const value = record[key];
62
+ return `<td>${escapeHtmlValue(value)}</td>`;
63
+ }).join("");
64
+ return `<tr>${cells}</tr>`;
65
+ }).join("");
66
+ return `<!doctype html><html><head><meta charset="utf-8"></head><body><table><thead><tr>${headerCells}</tr></thead><tbody>${bodyRows}</tbody></table></body></html>`;
67
+ }
22
68
  function downloadCsv(csvContent, filename = "export") {
23
69
  const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
24
70
  const url = URL.createObjectURL(blob);
@@ -31,8 +77,36 @@ function downloadCsv(csvContent, filename = "export") {
31
77
  document.body.removeChild(link);
32
78
  URL.revokeObjectURL(url);
33
79
  }
80
+ function downloadExcel(excelContent, filename = "export") {
81
+ const blob = new Blob([excelContent], { type: "application/vnd.ms-excel;charset=utf-8;" });
82
+ const url = URL.createObjectURL(blob);
83
+ const link = document.createElement("a");
84
+ link.href = url;
85
+ link.download = `${filename}.xls`;
86
+ link.style.display = "none";
87
+ document.body.appendChild(link);
88
+ link.click();
89
+ document.body.removeChild(link);
90
+ URL.revokeObjectURL(url);
91
+ }
92
+ function exportTableData(columns, data, format = "csv") {
93
+ return format === "excel" ? exportTableToExcel(columns, data) : exportTableToCsv(columns, data);
94
+ }
95
+ function downloadTableExport(content, filename = "export", format = "csv") {
96
+ if (format === "excel") {
97
+ downloadExcel(content, filename);
98
+ return;
99
+ }
100
+ downloadCsv(content, filename);
101
+ }
34
102
  var tableExportButtonClasses = "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] text-[var(--tiger-text,#111827)] bg-[var(--tiger-surface,#ffffff)] hover:bg-[var(--tiger-surface-muted,#f9fafb)] transition-colors";
35
-
36
- exports.downloadCsv = downloadCsv;
37
- exports.exportTableToCsv = exportTableToCsv;
38
- exports.tableExportButtonClasses = tableExportButtonClasses;
103
+ // Annotate the CommonJS export names for ESM import in node:
104
+ 0 && (module.exports = {
105
+ downloadCsv,
106
+ downloadExcel,
107
+ downloadTableExport,
108
+ exportTableData,
109
+ exportTableToCsv,
110
+ exportTableToExcel,
111
+ tableExportButtonClasses
112
+ });
@@ -1 +1 @@
1
- export { g as downloadCsv, f as exportTableToCsv, t as tableExportButtonClasses } from '../table-export-Cy9DgTiO.cjs';
1
+ export { i as downloadCsv, j as downloadExcel, l as downloadTableExport, k as exportTableData, g as exportTableToCsv, h as exportTableToExcel, t as tableExportButtonClasses } from '../table-export-6ISYSoVB.cjs';
@@ -1 +1 @@
1
- export { g as downloadCsv, f as exportTableToCsv, t as tableExportButtonClasses } from '../table-export-Cy9DgTiO.js';
1
+ export { i as downloadCsv, j as downloadExcel, l as downloadTableExport, k as exportTableData, g as exportTableToCsv, h as exportTableToExcel, t as tableExportButtonClasses } from '../table-export-6ISYSoVB.js';
@@ -17,6 +17,22 @@ function exportTableToCsv(columns, data, _filename) {
17
17
  );
18
18
  return [headers.join(","), ...rows].join("\n");
19
19
  }
20
+ function escapeHtmlValue(value) {
21
+ const str = value === null || value === void 0 ? "" : String(value);
22
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
23
+ }
24
+ function exportTableToExcel(columns, data) {
25
+ const headerCells = columns.map((column) => `<th>${escapeHtmlValue(column.title)}</th>`).join("");
26
+ const bodyRows = data.map((record) => {
27
+ const cells = columns.map((column) => {
28
+ const key = column.dataKey || column.key;
29
+ const value = record[key];
30
+ return `<td>${escapeHtmlValue(value)}</td>`;
31
+ }).join("");
32
+ return `<tr>${cells}</tr>`;
33
+ }).join("");
34
+ return `<!doctype html><html><head><meta charset="utf-8"></head><body><table><thead><tr>${headerCells}</tr></thead><tbody>${bodyRows}</tbody></table></body></html>`;
35
+ }
20
36
  function downloadCsv(csvContent, filename = "export") {
21
37
  const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
22
38
  const url = URL.createObjectURL(blob);
@@ -29,6 +45,35 @@ function downloadCsv(csvContent, filename = "export") {
29
45
  document.body.removeChild(link);
30
46
  URL.revokeObjectURL(url);
31
47
  }
48
+ function downloadExcel(excelContent, filename = "export") {
49
+ const blob = new Blob([excelContent], { type: "application/vnd.ms-excel;charset=utf-8;" });
50
+ const url = URL.createObjectURL(blob);
51
+ const link = document.createElement("a");
52
+ link.href = url;
53
+ link.download = `${filename}.xls`;
54
+ link.style.display = "none";
55
+ document.body.appendChild(link);
56
+ link.click();
57
+ document.body.removeChild(link);
58
+ URL.revokeObjectURL(url);
59
+ }
60
+ function exportTableData(columns, data, format = "csv") {
61
+ return format === "excel" ? exportTableToExcel(columns, data) : exportTableToCsv(columns, data);
62
+ }
63
+ function downloadTableExport(content, filename = "export", format = "csv") {
64
+ if (format === "excel") {
65
+ downloadExcel(content, filename);
66
+ return;
67
+ }
68
+ downloadCsv(content, filename);
69
+ }
32
70
  var tableExportButtonClasses = "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] text-[var(--tiger-text,#111827)] bg-[var(--tiger-surface,#ffffff)] hover:bg-[var(--tiger-surface-muted,#f9fafb)] transition-colors";
33
-
34
- export { downloadCsv, exportTableToCsv, tableExportButtonClasses };
71
+ export {
72
+ downloadCsv,
73
+ downloadExcel,
74
+ downloadTableExport,
75
+ exportTableData,
76
+ exportTableToCsv,
77
+ exportTableToExcel,
78
+ tableExportButtonClasses
79
+ };
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@expcat/tigercat-core",
3
- "version": "1.1.0",
3
+ "version": "1.2.14",
4
4
  "type": "module",
5
5
  "description": "Core utilities for Tigercat UI library",
6
6
  "license": "MIT",
7
7
  "author": "Yizhe Wang",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/expcats/Tigercat.git",
10
+ "url": "https://github.com/expcat/Tigercat",
11
11
  "directory": "packages/core"
12
12
  },
13
- "homepage": "https://github.com/expcats/Tigercat/tree/main/packages/core#readme",
13
+ "homepage": "https://github.com/expcat/Tigercat/tree/main/packages/core#readme",
14
14
  "bugs": {
15
- "url": "https://github.com/expcats/Tigercat/issues"
15
+ "url": "https://github.com/expcat/Tigercat/issues"
16
16
  },
17
17
  "keywords": [
18
18
  "tigercat",
@@ -47,6 +47,8 @@
47
47
  "import": "./dist/tailwind/modern.js",
48
48
  "require": "./dist/tailwind/modern.cjs"
49
49
  },
50
+ "./tokens.css": "./tokens/tokens.css",
51
+ "./figma-variables.json": "./tokens/figma-variables.json",
50
52
  "./locales/en-US": {
51
53
  "types": "./dist/locales/en-US.d.ts",
52
54
  "import": "./dist/locales/en-US.js",
@@ -87,6 +89,31 @@
87
89
  "import": "./dist/locales/id-ID.js",
88
90
  "require": "./dist/locales/id-ID.cjs"
89
91
  },
92
+ "./locales/es-ES": {
93
+ "types": "./dist/locales/es-ES.d.ts",
94
+ "import": "./dist/locales/es-ES.js",
95
+ "require": "./dist/locales/es-ES.cjs"
96
+ },
97
+ "./locales/fr-FR": {
98
+ "types": "./dist/locales/fr-FR.d.ts",
99
+ "import": "./dist/locales/fr-FR.js",
100
+ "require": "./dist/locales/fr-FR.cjs"
101
+ },
102
+ "./locales/de-DE": {
103
+ "types": "./dist/locales/de-DE.d.ts",
104
+ "import": "./dist/locales/de-DE.js",
105
+ "require": "./dist/locales/de-DE.cjs"
106
+ },
107
+ "./locales/pt-BR": {
108
+ "types": "./dist/locales/pt-BR.d.ts",
109
+ "import": "./dist/locales/pt-BR.js",
110
+ "require": "./dist/locales/pt-BR.cjs"
111
+ },
112
+ "./locales/ar-SA": {
113
+ "types": "./dist/locales/ar-SA.d.ts",
114
+ "import": "./dist/locales/ar-SA.js",
115
+ "require": "./dist/locales/ar-SA.cjs"
116
+ },
90
117
  "./datepicker-locales/en-US": {
91
118
  "types": "./dist/datepicker-locales/en-US.d.ts",
92
119
  "import": "./dist/datepicker-locales/en-US.js",
@@ -127,6 +154,31 @@
127
154
  "import": "./dist/datepicker-locales/id-ID.js",
128
155
  "require": "./dist/datepicker-locales/id-ID.cjs"
129
156
  },
157
+ "./datepicker-locales/es-ES": {
158
+ "types": "./dist/datepicker-locales/es-ES.d.ts",
159
+ "import": "./dist/datepicker-locales/es-ES.js",
160
+ "require": "./dist/datepicker-locales/es-ES.cjs"
161
+ },
162
+ "./datepicker-locales/fr-FR": {
163
+ "types": "./dist/datepicker-locales/fr-FR.d.ts",
164
+ "import": "./dist/datepicker-locales/fr-FR.js",
165
+ "require": "./dist/datepicker-locales/fr-FR.cjs"
166
+ },
167
+ "./datepicker-locales/de-DE": {
168
+ "types": "./dist/datepicker-locales/de-DE.d.ts",
169
+ "import": "./dist/datepicker-locales/de-DE.js",
170
+ "require": "./dist/datepicker-locales/de-DE.cjs"
171
+ },
172
+ "./datepicker-locales/pt-BR": {
173
+ "types": "./dist/datepicker-locales/pt-BR.d.ts",
174
+ "import": "./dist/datepicker-locales/pt-BR.js",
175
+ "require": "./dist/datepicker-locales/pt-BR.cjs"
176
+ },
177
+ "./datepicker-locales/ar-SA": {
178
+ "types": "./dist/datepicker-locales/ar-SA.d.ts",
179
+ "import": "./dist/datepicker-locales/ar-SA.js",
180
+ "require": "./dist/datepicker-locales/ar-SA.cjs"
181
+ },
130
182
  "./icons/common": {
131
183
  "types": "./dist/icons/common.d.ts",
132
184
  "import": "./dist/icons/common.js",
@@ -154,7 +206,8 @@
154
206
  }
155
207
  },
156
208
  "files": [
157
- "dist"
209
+ "dist",
210
+ "tokens"
158
211
  ],
159
212
  "publishConfig": {
160
213
  "access": "public"
@@ -178,6 +231,7 @@
178
231
  "scripts": {
179
232
  "build": "tsup",
180
233
  "dev": "tsup --watch",
181
- "clean": "node ../../scripts/rimraf.mjs dist"
234
+ "clean": "node ../../scripts/rimraf.mjs dist",
235
+ "tokens": "node ./scripts/generate-tokens.mjs"
182
236
  }
183
237
  }