tintora 1.1.0 → 1.2.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 (93) hide show
  1. package/README.md +15 -0
  2. package/dist/Alert/Alert2.cjs +1 -0
  3. package/dist/Alert/Alert2.js +73 -0
  4. package/dist/Avatar/Avatar2.cjs +1 -0
  5. package/dist/Avatar/Avatar2.js +23 -0
  6. package/dist/Avatar/utils.cjs +1 -0
  7. package/dist/Avatar/utils.js +8 -0
  8. package/dist/BottomSheet/BottomSheet2.cjs +1 -0
  9. package/dist/BottomSheet/BottomSheet2.js +51 -0
  10. package/dist/Button/Button2.cjs +1 -0
  11. package/dist/Button/Button2.js +42 -0
  12. package/dist/Card/Card2.cjs +1 -0
  13. package/dist/Card/Card2.js +20 -0
  14. package/dist/Checkbox/Checkbox2.cjs +1 -0
  15. package/dist/Checkbox/Checkbox2.js +52 -0
  16. package/dist/Chip/Chip2.cjs +1 -0
  17. package/dist/Chip/Chip2.js +15 -0
  18. package/dist/Dot/Dot2.cjs +1 -0
  19. package/dist/Dot/Dot2.js +15 -0
  20. package/dist/Drawer/Drawer2.cjs +1 -0
  21. package/dist/Drawer/Drawer2.js +33 -0
  22. package/dist/IconButton/IconButton2.cjs +1 -0
  23. package/dist/IconButton/IconButton2.js +27 -0
  24. package/dist/Modal/Modal2.cjs +1 -0
  25. package/dist/Modal/Modal2.js +71 -0
  26. package/dist/Popover/Popover2.cjs +1 -0
  27. package/dist/Popover/Popover2.js +70 -0
  28. package/dist/ProgressBar/ProgressBar2.cjs +1 -0
  29. package/dist/ProgressBar/ProgressBar2.js +40 -0
  30. package/dist/Radio/Radio2.cjs +1 -0
  31. package/dist/Radio/Radio2.js +27 -0
  32. package/dist/Radio/RadioContext.cjs +1 -0
  33. package/dist/Radio/RadioContext.js +11 -0
  34. package/dist/Radio/RadioGroup.cjs +1 -0
  35. package/dist/Radio/RadioGroup.js +26 -0
  36. package/dist/SearchInput/SearchInput2.cjs +1 -0
  37. package/dist/SearchInput/SearchInput2.js +30 -0
  38. package/dist/Select/Select2.cjs +1 -0
  39. package/dist/Select/Select2.js +128 -0
  40. package/dist/Select/SelectContext.cjs +1 -0
  41. package/dist/Select/SelectContext.js +10 -0
  42. package/dist/Select/SelectOption.cjs +1 -0
  43. package/dist/Select/SelectOption.js +20 -0
  44. package/dist/SettingsRow/SettingsRow2.cjs +1 -0
  45. package/dist/SettingsRow/SettingsRow2.js +22 -0
  46. package/dist/Skeleton/Skeleton2.cjs +1 -0
  47. package/dist/Skeleton/Skeleton2.js +21 -0
  48. package/dist/Spinner/Spinner2.cjs +1 -0
  49. package/dist/Spinner/Spinner2.js +47 -0
  50. package/dist/Switch/Switch2.cjs +1 -0
  51. package/dist/Switch/Switch2.js +29 -0
  52. package/dist/Tabs/Tab.cjs +1 -0
  53. package/dist/Tabs/Tab.js +22 -0
  54. package/dist/Tabs/Tabs2.cjs +1 -0
  55. package/dist/Tabs/Tabs2.js +40 -0
  56. package/dist/Tabs/TabsContext.cjs +1 -0
  57. package/dist/Tabs/TabsContext.js +11 -0
  58. package/dist/Tag/Tag2.cjs +1 -0
  59. package/dist/Tag/Tag2.js +13 -0
  60. package/dist/TextField/TextField2.cjs +1 -0
  61. package/dist/TextField/TextField2.js +34 -0
  62. package/dist/Toast/Toast2.cjs +1 -0
  63. package/dist/Toast/Toast2.js +74 -0
  64. package/dist/Toast/ToastIcons.cjs +1 -0
  65. package/dist/Toast/ToastIcons.js +77 -0
  66. package/dist/Toggle/Toggle2.cjs +1 -0
  67. package/dist/Toggle/Toggle2.js +57 -0
  68. package/dist/Toggle/ToggleContext.cjs +1 -0
  69. package/dist/Toggle/ToggleContext.js +11 -0
  70. package/dist/Toggle/ToggleItem.cjs +1 -0
  71. package/dist/Toggle/ToggleItem.js +21 -0
  72. package/dist/Tooltip/Tooltip2.cjs +1 -0
  73. package/dist/Tooltip/Tooltip2.js +66 -0
  74. package/dist/hooks/useCheckedState.cjs +1 -0
  75. package/dist/hooks/useCheckedState.js +13 -0
  76. package/dist/hooks/useEscapeKey.cjs +1 -0
  77. package/dist/hooks/useEscapeKey.js +15 -0
  78. package/dist/hooks/useLatest.cjs +1 -0
  79. package/dist/hooks/useLatest.js +10 -0
  80. package/dist/hooks/useOutsidePress.cjs +1 -0
  81. package/dist/hooks/useOutsidePress.js +19 -0
  82. package/dist/hooks/useTopLayerPosition.cjs +1 -0
  83. package/dist/hooks/useTopLayerPosition.js +25 -0
  84. package/dist/index.cjs +1 -1
  85. package/dist/index.js +31 -1294
  86. package/dist/utils/clsx.cjs +1 -0
  87. package/dist/utils/clsx.d.ts +9 -0
  88. package/dist/utils/clsx.js +6 -0
  89. package/dist/utils/outside.cjs +1 -0
  90. package/dist/utils/outside.js +8 -0
  91. package/dist/utils/placement.cjs +1 -0
  92. package/dist/utils/placement.js +53 -0
  93. package/package.json +5 -4
@@ -0,0 +1 @@
1
+ function e(...e){return e.flatMap(e=>typeof e==`string`&&e?[e]:e&&typeof e==`object`?Object.keys(e).filter(t=>e[t]):[]).join(` `)}exports.clsx=e;
@@ -0,0 +1,9 @@
1
+ type ClassValue = string | number | bigint | boolean | null | undefined | Record<string, unknown>;
2
+ /**
3
+ * Joins class names, skipping falsy values; an object keeps the keys whose
4
+ * value is truthy. Numbers and booleans are skipped, so `cond && 'a'` is safe
5
+ * when `cond` is `0` or `true`. The subset of the `clsx` package this library uses, so it
6
+ * ships with no dependencies.
7
+ */
8
+ export declare function clsx(...values: ClassValue[]): string;
9
+ export {};
@@ -0,0 +1,6 @@
1
+ //#region src/utils/clsx.ts
2
+ function e(...e) {
3
+ return e.flatMap((e) => typeof e == "string" && e ? [e] : e && typeof e == "object" ? Object.keys(e).filter((t) => e[t]) : []).join(" ");
4
+ }
5
+ //#endregion
6
+ export { e as clsx };
@@ -0,0 +1 @@
1
+ function e(e,t){if(e.target!==e.currentTarget)return;let{left:n,right:r,top:i,bottom:a}=e.currentTarget.getBoundingClientRect();(e.clientX<n||e.clientX>r||e.clientY<i||e.clientY>a)&&t()}exports.isOutsideElementClicked=e;
@@ -0,0 +1,8 @@
1
+ //#region src/utils/outside.ts
2
+ function e(e, t) {
3
+ if (e.target !== e.currentTarget) return;
4
+ let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
5
+ (e.clientX < n || e.clientX > r || e.clientY < i || e.clientY > a) && t();
6
+ }
7
+ //#endregion
8
+ export { e as isOutsideElementClicked };
@@ -0,0 +1 @@
1
+ var e={gap:10,margin:8,arrowInset:12},t={top:`bottom`,bottom:`top`,left:`right`,right:`left`},n=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));function r(e,n,r,i,{gap:a,margin:o}){let s=t=>{switch(t){case`top`:return e.top;case`bottom`:return i.height-e.bottom;case`left`:return e.left;case`right`:return i.width-e.right}},c=(r===`top`||r===`bottom`?n.height:n.width)+a+o,l=s(r);return l>=c||s(t[r])<=l?r:t[r]}function i(t,i,a,o={width:window.innerWidth,height:window.innerHeight},s={}){let c={...e,...s},{gap:l,margin:u,arrowInset:d}=c,f=r(t,i,a,o,c),p=f===`top`||f===`bottom`,m,h;switch(f){case`top`:m=t.y-i.height-l,h=t.x+t.width/2-i.width/2;break;case`bottom`:m=t.y+t.height+l,h=t.x+t.width/2-i.width/2;break;case`left`:m=t.y+t.height/2-i.height/2,h=t.x-i.width-l;break;case`right`:m=t.y+t.height/2-i.height/2,h=t.x+t.width+l}p?h=n(h,u,o.width-i.width-u):m=n(m,u,o.height-i.height-u);let g=p?t.x+t.width/2-h:t.y+t.height/2-m,_=p?i.width:i.height;return{top:m,left:h,placement:f,arrowOffset:n(g,d,_-d)}}exports.getPosition=i;
@@ -0,0 +1,53 @@
1
+ //#region src/utils/placement.ts
2
+ var e = {
3
+ gap: 10,
4
+ margin: 8,
5
+ arrowInset: 12
6
+ }, t = {
7
+ top: "bottom",
8
+ bottom: "top",
9
+ left: "right",
10
+ right: "left"
11
+ }, n = (e, t, n) => Math.min(Math.max(e, t), Math.max(t, n));
12
+ function r(e, n, r, i, { gap: a, margin: o }) {
13
+ let s = (t) => {
14
+ switch (t) {
15
+ case "top": return e.top;
16
+ case "bottom": return i.height - e.bottom;
17
+ case "left": return e.left;
18
+ case "right": return i.width - e.right;
19
+ }
20
+ }, c = (r === "top" || r === "bottom" ? n.height : n.width) + a + o, l = s(r);
21
+ return l >= c || s(t[r]) <= l ? r : t[r];
22
+ }
23
+ function i(t, i, a, o = {
24
+ width: window.innerWidth,
25
+ height: window.innerHeight
26
+ }, s = {}) {
27
+ let c = {
28
+ ...e,
29
+ ...s
30
+ }, { gap: l, margin: u, arrowInset: d } = c, f = r(t, i, a, o, c), p = f === "top" || f === "bottom", m, h;
31
+ switch (f) {
32
+ case "top":
33
+ m = t.y - i.height - l, h = t.x + t.width / 2 - i.width / 2;
34
+ break;
35
+ case "bottom":
36
+ m = t.y + t.height + l, h = t.x + t.width / 2 - i.width / 2;
37
+ break;
38
+ case "left":
39
+ m = t.y + t.height / 2 - i.height / 2, h = t.x - i.width - l;
40
+ break;
41
+ case "right": m = t.y + t.height / 2 - i.height / 2, h = t.x + t.width + l;
42
+ }
43
+ p ? h = n(h, u, o.width - i.width - u) : m = n(m, u, o.height - i.height - u);
44
+ let g = p ? t.x + t.width / 2 - h : t.y + t.height / 2 - m, _ = p ? i.width : i.height;
45
+ return {
46
+ top: m,
47
+ left: h,
48
+ placement: f,
49
+ arrowOffset: n(g, d, _ - d)
50
+ };
51
+ }
52
+ //#endregion
53
+ export { i as getPosition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tintora",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,7 +17,9 @@
17
17
  "tintora"
18
18
  ],
19
19
  "sideEffects": [
20
- "**/*.css"
20
+ "**/*.css",
21
+ "./dist/index.js",
22
+ "./dist/index.cjs"
21
23
  ],
22
24
  "files": [
23
25
  "dist"
@@ -41,7 +43,7 @@
41
43
  "typecheck": "tsc --noEmit",
42
44
  "test": "vitest run",
43
45
  "test:watch": "vitest",
44
- "lint": "eslint . && node scripts/check-tokens.mjs",
46
+ "lint": "eslint . && node scripts/check-tokens.mjs && node scripts/check-use-client.mjs",
45
47
  "format": "prettier --write .",
46
48
  "format:check": "prettier --check .",
47
49
  "prepublishOnly": "pnpm lint && pnpm typecheck && pnpm build",
@@ -65,7 +67,6 @@
65
67
  "@types/react-dom": "^19.3.0",
66
68
  "@vitejs/plugin-react": "^6.1.2",
67
69
  "axe-core": "^4.14.0",
68
- "clsx": "^2.1.1",
69
70
  "eslint": "^9.39.5",
70
71
  "eslint-config-prettier": "^10.1.8",
71
72
  "eslint-plugin-jsx-a11y": "^6.10.2",