@skalfa/skalfa-component 1.0.0 → 1.0.3

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 (188) hide show
  1. package/dist/accordion/Accordion.component.d.ts +1 -1
  2. package/dist/breadcrumb/Breadcrumb.component.d.ts +1 -1
  3. package/dist/button/Button.component.d.ts +1 -1
  4. package/dist/card/AlertCard.component.d.ts +1 -1
  5. package/dist/card/Card.component.d.ts +1 -1
  6. package/dist/card/DashboardCard.component.d.ts +1 -1
  7. package/dist/card/GalleryCard.component.d.ts +1 -1
  8. package/dist/card/ProductCard.component.d.ts +1 -1
  9. package/dist/card/ProfileCard.component.d.ts +1 -1
  10. package/dist/carousel/Carousel.component.d.ts +1 -1
  11. package/dist/chip/Chip.component.d.ts +1 -1
  12. package/dist/index.js +175 -56
  13. package/dist/input/Checkbox.component.d.ts +1 -1
  14. package/dist/input/Input.component.d.ts +1 -1
  15. package/dist/input/InputCheckbox.component.d.ts +1 -1
  16. package/dist/input/InputCheckbox.component.js +2 -2
  17. package/dist/input/InputCurrency.component.d.ts +1 -1
  18. package/dist/input/InputDate.component.d.ts +1 -1
  19. package/dist/input/InputDate.component.js +9 -7
  20. package/dist/input/InputDatetime.component.d.ts +1 -1
  21. package/dist/input/InputDatetime.component.js +13 -8
  22. package/dist/input/InputDocument.component.d.ts +1 -1
  23. package/dist/input/InputDocument.component.js +6 -4
  24. package/dist/input/InputImage.component.js +5 -3
  25. package/dist/input/InputMap.component.d.ts +1 -1
  26. package/dist/input/InputMap.component.js +5 -3
  27. package/dist/input/InputNumber.component.d.ts +1 -1
  28. package/dist/input/InputPassword.component.d.ts +1 -1
  29. package/dist/input/InputRadio.component.d.ts +1 -1
  30. package/dist/input/InputRadio.component.js +2 -2
  31. package/dist/input/InputTime.component.d.ts +1 -1
  32. package/dist/input/InputTime.component.js +5 -3
  33. package/dist/input/InputValues.component.d.ts +1 -1
  34. package/dist/input/Radio.component.d.ts +1 -1
  35. package/dist/input/Select.component.d.ts +1 -1
  36. package/dist/modal/FloatingPage.component.d.ts +1 -1
  37. package/dist/modal/FloatingPage.component.js +2 -2
  38. package/dist/modal/Modal.component.d.ts +1 -1
  39. package/dist/modal/Modal.component.js +2 -2
  40. package/dist/modal/ModalConfirm.component.d.ts +2 -2
  41. package/dist/modal/ModalConfirm.component.js +5 -3
  42. package/dist/modal/Toast.component.d.ts +1 -1
  43. package/dist/modal/Toast.component.js +2 -2
  44. package/dist/nav/Bottombar.component.d.ts +1 -1
  45. package/dist/nav/Footer.component.d.ts +1 -1
  46. package/dist/nav/Headbar.component.d.ts +4 -11
  47. package/dist/nav/Headbar.component.js +3 -22
  48. package/dist/nav/Navbar.component.d.ts +1 -1
  49. package/dist/nav/Navbar.component.js +2 -2
  50. package/dist/nav/Sidebar.component.d.ts +2 -2
  51. package/dist/nav/Tabbar.component.d.ts +1 -1
  52. package/dist/nav/Wizard.component.d.ts +1 -1
  53. package/dist/supervision/FormSupervision.component.d.ts +14 -2
  54. package/dist/supervision/FormSupervision.component.js +32 -17
  55. package/dist/supervision/TableSupervision.component.d.ts +7 -2
  56. package/dist/supervision/TableSupervision.component.js +25 -19
  57. package/dist/table/ControlBar.component.d.ts +2 -2
  58. package/dist/table/ControlBar.component.js +20 -14
  59. package/dist/table/FilterComponent.d.ts +2 -2
  60. package/dist/table/FilterComponent.js +24 -17
  61. package/dist/table/Pagination.component.d.ts +1 -1
  62. package/dist/table/Pagination.component.js +4 -3
  63. package/dist/table/Table.component.d.ts +4 -2
  64. package/dist/table/Table.component.js +11 -7
  65. package/dist/typography/TypographyArticle.component.d.ts +1 -1
  66. package/dist/typography/TypographyColumn.component.d.ts +1 -1
  67. package/dist/typography/TypographyContent.component.d.ts +1 -1
  68. package/dist/typography/TypographyTips.component.d.ts +1 -1
  69. package/dist/wrap/Image.component.d.ts +1 -1
  70. package/dist/wrap/ScrollContainer.component.d.ts +1 -1
  71. package/dist/wrap/ShortcutProvider.d.ts +1 -1
  72. package/dist/wrap/ShortcutProvider.js +2 -2
  73. package/dist/wrap/Swipe.component.d.ts +1 -1
  74. package/package.json +4 -3
  75. package/dist/src/accordion/Accordion.component.d.ts +0 -13
  76. package/dist/src/accordion/Accordion.component.js +0 -25
  77. package/dist/src/breadcrumb/Breadcrumb.component.d.ts +0 -14
  78. package/dist/src/breadcrumb/Breadcrumb.component.js +0 -21
  79. package/dist/src/button/Button.component.d.ts +0 -21
  80. package/dist/src/button/Button.component.js +0 -19
  81. package/dist/src/card/AlertCard.component.d.ts +0 -11
  82. package/dist/src/card/AlertCard.component.js +0 -9
  83. package/dist/src/card/Card.component.d.ts +0 -5
  84. package/dist/src/card/Card.component.js +0 -9
  85. package/dist/src/card/DashboardCard.component.d.ts +0 -9
  86. package/dist/src/card/DashboardCard.component.js +0 -13
  87. package/dist/src/card/GalleryCard.component.d.ts +0 -7
  88. package/dist/src/card/GalleryCard.component.js +0 -13
  89. package/dist/src/card/ProductCard.component.d.ts +0 -9
  90. package/dist/src/card/ProductCard.component.js +0 -13
  91. package/dist/src/card/ProfileCard.component.d.ts +0 -10
  92. package/dist/src/card/ProfileCard.component.js +0 -13
  93. package/dist/src/carousel/Carousel.component.d.ts +0 -13
  94. package/dist/src/carousel/Carousel.component.js +0 -37
  95. package/dist/src/chip/Chip.component.d.ts +0 -6
  96. package/dist/src/chip/Chip.component.js +0 -12
  97. package/dist/src/index.d.ts +0 -13
  98. package/dist/src/index.js +0 -29
  99. package/dist/src/input/Checkbox.component.d.ts +0 -13
  100. package/dist/src/input/Checkbox.component.js +0 -23
  101. package/dist/src/input/Input.component.d.ts +0 -23
  102. package/dist/src/input/Input.component.js +0 -134
  103. package/dist/src/input/InputCheckbox.component.d.ts +0 -27
  104. package/dist/src/input/InputCheckbox.component.js +0 -53
  105. package/dist/src/input/InputCurrency.component.d.ts +0 -21
  106. package/dist/src/input/InputCurrency.component.js +0 -30
  107. package/dist/src/input/InputDate.component.d.ts +0 -24
  108. package/dist/src/input/InputDate.component.js +0 -107
  109. package/dist/src/input/InputDatetime.component.d.ts +0 -17
  110. package/dist/src/input/InputDatetime.component.js +0 -75
  111. package/dist/src/input/InputDocument.component.d.ts +0 -22
  112. package/dist/src/input/InputDocument.component.js +0 -88
  113. package/dist/src/input/InputImage.component.d.ts +0 -23
  114. package/dist/src/input/InputImage.component.js +0 -260
  115. package/dist/src/input/InputMap.component.d.ts +0 -25
  116. package/dist/src/input/InputMap.component.js +0 -101
  117. package/dist/src/input/InputNumber.component.d.ts +0 -19
  118. package/dist/src/input/InputNumber.component.js +0 -40
  119. package/dist/src/input/InputOtp.component.d.ts +0 -14
  120. package/dist/src/input/InputOtp.component.js +0 -65
  121. package/dist/src/input/InputPassword.component.d.ts +0 -17
  122. package/dist/src/input/InputPassword.component.js +0 -59
  123. package/dist/src/input/InputRadio.component.d.ts +0 -27
  124. package/dist/src/input/InputRadio.component.js +0 -56
  125. package/dist/src/input/InputTime.component.d.ts +0 -23
  126. package/dist/src/input/InputTime.component.js +0 -73
  127. package/dist/src/input/InputValues.component.d.ts +0 -9
  128. package/dist/src/input/InputValues.component.js +0 -19
  129. package/dist/src/input/Radio.component.d.ts +0 -12
  130. package/dist/src/input/Radio.component.js +0 -22
  131. package/dist/src/input/Select.component.d.ts +0 -47
  132. package/dist/src/input/Select.component.js +0 -275
  133. package/dist/src/modal/BottomSheet.component.d.ts +0 -12
  134. package/dist/src/modal/BottomSheet.component.js +0 -161
  135. package/dist/src/modal/FloatingPage.component.d.ts +0 -12
  136. package/dist/src/modal/FloatingPage.component.js +0 -27
  137. package/dist/src/modal/Modal.component.d.ts +0 -12
  138. package/dist/src/modal/Modal.component.js +0 -27
  139. package/dist/src/modal/ModalConfirm.component.d.ts +0 -26
  140. package/dist/src/modal/ModalConfirm.component.js +0 -68
  141. package/dist/src/modal/Toast.component.d.ts +0 -11
  142. package/dist/src/modal/Toast.component.js +0 -58
  143. package/dist/src/nav/Bottombar.component.d.ts +0 -12
  144. package/dist/src/nav/Bottombar.component.js +0 -32
  145. package/dist/src/nav/Footer.component.d.ts +0 -37
  146. package/dist/src/nav/Footer.component.js +0 -49
  147. package/dist/src/nav/Headbar.component.d.ts +0 -14
  148. package/dist/src/nav/Headbar.component.js +0 -32
  149. package/dist/src/nav/Navbar.component.d.ts +0 -22
  150. package/dist/src/nav/Navbar.component.js +0 -26
  151. package/dist/src/nav/Sidebar.component.d.ts +0 -33
  152. package/dist/src/nav/Sidebar.component.js +0 -87
  153. package/dist/src/nav/Tabbar.component.d.ts +0 -13
  154. package/dist/src/nav/Tabbar.component.js +0 -17
  155. package/dist/src/nav/Wizard.component.d.ts +0 -9
  156. package/dist/src/nav/Wizard.component.js +0 -24
  157. package/dist/src/supervision/FormSupervision.component.d.ts +0 -93
  158. package/dist/src/supervision/FormSupervision.component.js +0 -168
  159. package/dist/src/supervision/TableSupervision.component.d.ts +0 -78
  160. package/dist/src/supervision/TableSupervision.component.js +0 -273
  161. package/dist/src/table/ControlBar.component.d.ts +0 -34
  162. package/dist/src/table/ControlBar.component.js +0 -205
  163. package/dist/src/table/FilterComponent.d.ts +0 -45
  164. package/dist/src/table/FilterComponent.js +0 -132
  165. package/dist/src/table/Pagination.component.d.ts +0 -8
  166. package/dist/src/table/Pagination.component.js +0 -32
  167. package/dist/src/table/Table.component.d.ts +0 -61
  168. package/dist/src/table/Table.component.js +0 -101
  169. package/dist/src/typography/TypographyArticle.component.d.ts +0 -8
  170. package/dist/src/typography/TypographyArticle.component.js +0 -7
  171. package/dist/src/typography/TypographyColumn.component.d.ts +0 -6
  172. package/dist/src/typography/TypographyColumn.component.js +0 -7
  173. package/dist/src/typography/TypographyContent.component.d.ts +0 -6
  174. package/dist/src/typography/TypographyContent.component.js +0 -7
  175. package/dist/src/typography/TypographyTips.component.d.ts +0 -6
  176. package/dist/src/typography/TypographyTips.component.js +0 -7
  177. package/dist/src/wrap/Draggable.component.d.ts +0 -34
  178. package/dist/src/wrap/Draggable.component.js +0 -214
  179. package/dist/src/wrap/Image.component.d.ts +0 -2
  180. package/dist/src/wrap/Image.component.js +0 -13
  181. package/dist/src/wrap/OutsideClick.component.d.ts +0 -6
  182. package/dist/src/wrap/OutsideClick.component.js +0 -34
  183. package/dist/src/wrap/ScrollContainer.component.d.ts +0 -10
  184. package/dist/src/wrap/ScrollContainer.component.js +0 -54
  185. package/dist/src/wrap/ShortcutProvider.d.ts +0 -1
  186. package/dist/src/wrap/ShortcutProvider.js +0 -42
  187. package/dist/src/wrap/Swipe.component.d.ts +0 -14
  188. package/dist/src/wrap/Swipe.component.js +0 -61
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface TypographyArticleProps {
3
- title: string | ReactNode;
4
- content: string | ReactNode;
5
- header?: string | ReactNode;
6
- footer?: string | ReactNode;
7
- }
8
- export declare function TypographyArticleComponent({ title, content, header, footer, }: TypographyArticleProps): import("react").JSX.Element;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypographyArticleComponent = TypographyArticleComponent;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- function TypographyArticleComponent({ title, content, header, footer, }) {
6
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h4", { className: "typography-article-header", children: header }), (0, jsx_runtime_1.jsx)("h1", { className: "typography-article-title", children: title }), (0, jsx_runtime_1.jsx)("div", { className: "typography-article-content", children: content }), (0, jsx_runtime_1.jsx)("div", { className: "typography-article-footer", children: footer })] }));
7
- }
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface TypographyColumnProps {
3
- title: string | ReactNode;
4
- content: string | ReactNode;
5
- }
6
- export declare function TypographyColumnComponent({ title, content, }: TypographyColumnProps): import("react").JSX.Element;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypographyColumnComponent = TypographyColumnComponent;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- function TypographyColumnComponent({ title, content, }) {
6
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "typography-column-title", children: title }), (0, jsx_runtime_1.jsx)("div", { children: content })] }) }));
7
- }
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface TypographyContentProps {
3
- title: string | ReactNode;
4
- content: string | ReactNode;
5
- }
6
- export declare function TypographyContentComponent({ title, content, }: TypographyContentProps): import("react").JSX.Element;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypographyContentComponent = TypographyContentComponent;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- function TypographyContentComponent({ title, content, }) {
6
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "typography-content-title", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "typography-content-body", children: content })] }) }));
7
- }
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export interface TypographyTipsProps {
3
- title: string | ReactNode;
4
- content: string | ReactNode;
5
- }
6
- export declare function TypographyTipsComponent({ title, content, }: TypographyTipsProps): import("react").JSX.Element;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypographyTipsComponent = TypographyTipsComponent;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- function TypographyTipsComponent({ title, content, }) {
6
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "typography-tips", children: [(0, jsx_runtime_1.jsx)("p", { className: "typography-tips-title", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "typography-tips-body", children: content })] }) }));
7
- }
@@ -1,34 +0,0 @@
1
- import { ReactNode, CSSProperties } from 'react';
2
- type SpringConfig = {
3
- stiffness?: number;
4
- damping?: number;
5
- mass?: number;
6
- stopThreshold?: number;
7
- };
8
- type Bounds = {
9
- left?: number;
10
- top?: number;
11
- right?: number;
12
- bottom?: number;
13
- };
14
- type DraggableProps = {
15
- children?: ReactNode;
16
- className?: string;
17
- style?: CSSProperties;
18
- initial?: {
19
- x?: number;
20
- y?: number;
21
- };
22
- bounds?: Bounds;
23
- spring?: SpringConfig;
24
- onDrag?: (state: {
25
- x: number;
26
- y: number;
27
- vx: number;
28
- vy: number;
29
- dragging: boolean;
30
- }) => void;
31
- useTranslate3d?: boolean;
32
- };
33
- export declare const DraggableComponent: import("react").ForwardRefExoticComponent<DraggableProps & import("react").RefAttributes<unknown>>;
34
- export {};
@@ -1,214 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DraggableComponent = void 0;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- // -----------------------------------------------------
8
- // DraggableComponent
9
- // -----------------------------------------------------
10
- exports.DraggableComponent = (0, react_1.forwardRef)(function DraggableComponent({ children, className, style, initial = { x: 0, y: 0 }, bounds, spring, onDrag, useTranslate3d = true, }, ref) {
11
- const elRef = (0, react_1.useRef)(null);
12
- const frameRef = (0, react_1.useRef)(null);
13
- const draggingRef = (0, react_1.useRef)(false);
14
- const pointerIdRef = (0, react_1.useRef)(null);
15
- const stateRef = (0, react_1.useRef)({ x: initial.x || 0, y: initial.y || 0, vx: 0, vy: 0 });
16
- const targetRef = (0, react_1.useRef)({ x: initial.x || 0, y: initial.y || 0 });
17
- const historyRef = (0, react_1.useRef)([]);
18
- const cfg = {
19
- stiffness: spring?.stiffness ?? 180,
20
- damping: spring?.damping ?? 24,
21
- mass: spring?.mass ?? 1,
22
- stopThreshold: spring?.stopThreshold ?? 0.02,
23
- };
24
- const [, setTick] = (0, react_1.useState)(0);
25
- const now = () => performance.now();
26
- function applyStyle(x, y) {
27
- const el = elRef.current;
28
- if (!el)
29
- return;
30
- const transform = useTranslate3d ? `translate3d(${x}px, ${y}px, 0)` : `translate(${x}px, ${y}px)`;
31
- el.style.transform = transform;
32
- }
33
- function clampToBounds(x, y) {
34
- if (!bounds)
35
- return { x, y };
36
- return {
37
- x: Math.max(bounds.left ?? -Infinity, Math.min(x, bounds.right ?? Infinity)),
38
- y: Math.max(bounds.top ?? -Infinity, Math.min(y, bounds.bottom ?? Infinity)),
39
- };
40
- }
41
- function estimateVelocity() {
42
- const h = historyRef.current;
43
- if (h.length < 2)
44
- return { vx: 0, vy: 0 };
45
- const last = h[h.length - 1];
46
- const threshold = 50;
47
- let idx = h.length - 2;
48
- while (idx > 0 && last.t - h[idx].t < threshold)
49
- idx--;
50
- const prev = h[idx];
51
- const dt = Math.max(1, last.t - prev.t);
52
- return {
53
- vx: (last.x - prev.x) / (dt / 1000),
54
- vy: (last.y - prev.y) / (dt / 1000),
55
- };
56
- }
57
- function cancelFrame() {
58
- if (frameRef.current != null) {
59
- cancelAnimationFrame(frameRef.current);
60
- frameRef.current = null;
61
- }
62
- }
63
- function startSpringAnimation(initVX = 0, initVY = 0) {
64
- cancelFrame();
65
- const mass = cfg.mass;
66
- const k = cfg.stiffness;
67
- const c = cfg.damping;
68
- stateRef.current.vx = initVX;
69
- stateRef.current.vy = initVY;
70
- let lastTime = now();
71
- function step() {
72
- const t = now();
73
- const dt = Math.min(32, t - lastTime) / 1000;
74
- lastTime = t;
75
- const sx = stateRef.current.x;
76
- const sy = stateRef.current.y;
77
- const vx = stateRef.current.vx;
78
- const vy = stateRef.current.vy;
79
- const tx = targetRef.current.x;
80
- const ty = targetRef.current.y;
81
- const ax = (-c * vx - k * (sx - tx)) / mass;
82
- const ay = (-c * vy - k * (sy - ty)) / mass;
83
- const nvx = vx + ax * dt;
84
- const nvy = vy + ay * dt;
85
- const nx = sx + nvx * dt;
86
- const ny = sy + nvy * dt;
87
- stateRef.current.x = nx;
88
- stateRef.current.y = ny;
89
- stateRef.current.vx = nvx;
90
- stateRef.current.vy = nvy;
91
- applyStyle(nx, ny);
92
- onDrag?.({ x: nx, y: ny, vx: nvx, vy: nvy, dragging: false });
93
- const disp = Math.hypot(nx - tx, ny - ty);
94
- const vel = Math.hypot(nvx, nvy);
95
- if (disp < cfg.stopThreshold && vel < cfg.stopThreshold) {
96
- stateRef.current.x = tx;
97
- stateRef.current.y = ty;
98
- stateRef.current.vx = 0;
99
- stateRef.current.vy = 0;
100
- applyStyle(tx, ty);
101
- onDrag?.({ x: tx, y: ty, vx: 0, vy: 0, dragging: false });
102
- frameRef.current = null;
103
- return;
104
- }
105
- frameRef.current = requestAnimationFrame(step);
106
- }
107
- frameRef.current = requestAnimationFrame(step);
108
- }
109
- // -------------------------------------------------------------------
110
- // Expose API ke parent: setTarget & setPositionImmediate
111
- // -------------------------------------------------------------------
112
- (0, react_1.useImperativeHandle)(ref, () => ({
113
- setTarget(pos) {
114
- targetRef.current.x = pos.x;
115
- targetRef.current.y = pos.y;
116
- startSpringAnimation(0, 0);
117
- },
118
- setPosition(pos) {
119
- stateRef.current.x = pos.x;
120
- stateRef.current.y = pos.y;
121
- targetRef.current.x = pos.x;
122
- targetRef.current.y = pos.y;
123
- applyStyle(pos.x, pos.y);
124
- },
125
- }));
126
- (0, react_1.useEffect)(() => {
127
- const el = elRef.current;
128
- if (!el)
129
- return;
130
- function onDown(e) {
131
- if (e.pointerType === 'mouse' && e.button !== 0)
132
- return;
133
- e.target.setPointerCapture?.(e.pointerId);
134
- pointerIdRef.current = e.pointerId;
135
- draggingRef.current = true;
136
- cancelFrame();
137
- historyRef.current = [{ t: now(), x: stateRef.current.x, y: stateRef.current.y }];
138
- el.__dragBase = {
139
- px: e.clientX,
140
- py: e.clientY,
141
- startX: stateRef.current.x,
142
- startY: stateRef.current.y,
143
- };
144
- onDrag?.({
145
- x: stateRef.current.x,
146
- y: stateRef.current.y,
147
- vx: 0,
148
- vy: 0,
149
- dragging: true,
150
- });
151
- }
152
- function onMove(e) {
153
- if (!draggingRef.current)
154
- return;
155
- if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current)
156
- return;
157
- const base = el.__dragBase;
158
- if (!base)
159
- return;
160
- let nx = base.startX + (e.clientX - base.px);
161
- let ny = base.startY + (e.clientY - base.py);
162
- ({ x: nx, y: ny } = clampToBounds(nx, ny));
163
- historyRef.current.push({ t: now(), x: nx, y: ny });
164
- if (historyRef.current.length > 8)
165
- historyRef.current.shift();
166
- stateRef.current.x = nx;
167
- stateRef.current.y = ny;
168
- stateRef.current.vx = 0;
169
- stateRef.current.vy = 0;
170
- applyStyle(nx, ny);
171
- onDrag?.({ x: nx, y: ny, vx: 0, vy: 0, dragging: true });
172
- setTick(t => t + 1);
173
- }
174
- function onUp(e) {
175
- if (!draggingRef.current)
176
- return;
177
- if (pointerIdRef.current !== null && e.pointerId !== pointerIdRef.current)
178
- return;
179
- e.target.releasePointerCapture?.(e.pointerId);
180
- draggingRef.current = false;
181
- pointerIdRef.current = null;
182
- const { vx, vy } = estimateVelocity();
183
- let tx = stateRef.current.x;
184
- let ty = stateRef.current.y;
185
- ({ x: tx, y: ty } = clampToBounds(tx, ty));
186
- targetRef.current.x = tx;
187
- targetRef.current.y = ty;
188
- startSpringAnimation(vx, vy);
189
- }
190
- el.addEventListener('pointerdown', onDown);
191
- window.addEventListener('pointermove', onMove);
192
- window.addEventListener('pointerup', onUp);
193
- window.addEventListener('pointercancel', onUp);
194
- return () => {
195
- el.removeEventListener('pointerdown', onDown);
196
- window.removeEventListener('pointermove', onMove);
197
- window.removeEventListener('pointerup', onUp);
198
- window.removeEventListener('pointercancel', onUp);
199
- cancelFrame();
200
- };
201
- }, [bounds]);
202
- // initial pos
203
- (0, react_1.useEffect)(() => {
204
- stateRef.current.x = initial.x || 0;
205
- stateRef.current.y = initial.y || 0;
206
- applyStyle(initial.x || 0, initial.y || 0);
207
- }, []);
208
- return ((0, jsx_runtime_1.jsx)("div", { ref: elRef, className: className, style: {
209
- touchAction: 'none',
210
- cursor: 'grab',
211
- display: 'inline-block',
212
- ...style,
213
- }, onMouseDown: (e) => e.preventDefault(), children: children }));
214
- });
@@ -1,2 +0,0 @@
1
- import { ImageProps } from "next/image";
2
- export declare function ImageComponent(props: ImageProps): import("react").JSX.Element;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ImageComponent = ImageComponent;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- /* eslint-disable jsx-a11y/alt-text */
9
- const image_1 = __importDefault(require("next/image"));
10
- function ImageComponent(props) {
11
- const isProd = process.env.NODE_ENV === "production";
12
- return (0, jsx_runtime_1.jsx)(image_1.default, { ...props, unoptimized: !isProd });
13
- }
@@ -1,6 +0,0 @@
1
- import { FC, ReactNode } from "react";
2
- export interface OutsideClickHandlerProps {
3
- children: ReactNode;
4
- onOutsideClick?: () => void;
5
- }
6
- export declare const OutsideClickComponent: FC<OutsideClickHandlerProps>;
@@ -1,34 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.OutsideClickComponent = void 0;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const OutsideClickComponent = ({ children, onOutsideClick, }) => {
8
- const ref = (0, react_1.useRef)(null);
9
- const handlerRef = (0, react_1.useRef)(onOutsideClick);
10
- (0, react_1.useEffect)(() => {
11
- handlerRef.current = onOutsideClick;
12
- }, [onOutsideClick]);
13
- (0, react_1.useEffect)(() => {
14
- const handlePointerDown = (event) => {
15
- const el = ref.current;
16
- if (!el || !(event.target instanceof Node))
17
- return;
18
- const isOutside = !el.contains(event.target);
19
- if (isOutside) {
20
- queueMicrotask(() => {
21
- if (ref.current && !ref.current.contains(event.target)) {
22
- handlerRef.current?.();
23
- }
24
- });
25
- }
26
- };
27
- document.addEventListener("pointerdown", handlePointerDown, true);
28
- return () => {
29
- document.removeEventListener("pointerdown", handlePointerDown, true);
30
- };
31
- }, []);
32
- return (0, jsx_runtime_1.jsx)("div", { ref: ref, children: children });
33
- };
34
- exports.OutsideClickComponent = OutsideClickComponent;
@@ -1,10 +0,0 @@
1
- import { ReactNode } from "react";
2
- export interface ScrollContainerProps {
3
- children: ReactNode;
4
- footer?: ReactNode;
5
- scrollFloating?: boolean;
6
- onScroll?: (e: any) => void;
7
- /** Use custom class with: "container::", "floating-scroll::"". */
8
- className?: string;
9
- }
10
- export declare function ScrollContainerComponent({ children, footer, className, scrollFloating, onScroll, }: ScrollContainerProps): import("react").JSX.Element;
@@ -1,54 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ScrollContainerComponent = ScrollContainerComponent;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const _utils_1 = require("@utils");
7
- const react_1 = require("react");
8
- function ScrollContainerComponent({ children, footer, className = "", scrollFloating = false, onScroll, }) {
9
- const containerRef = (0, react_1.useRef)(null);
10
- const floatingScrollbarRef = (0, react_1.useRef)(null);
11
- const floatingScrollbarContainerRef = (0, react_1.useRef)(null);
12
- const [containerWidth, setContainerWidth] = (0, react_1.useState)(0);
13
- (0, react_1.useEffect)(() => {
14
- const handleScroll = () => {
15
- if (!containerRef.current)
16
- return;
17
- onScroll?.(containerRef.current);
18
- };
19
- const container = containerRef.current;
20
- if (container) {
21
- handleScroll();
22
- container.addEventListener("scroll", handleScroll);
23
- }
24
- return () => container?.removeEventListener("scroll", handleScroll);
25
- }, []);
26
- (0, react_1.useEffect)(() => {
27
- const scrollContainer = containerRef.current;
28
- const floatingScrollbar = floatingScrollbarRef.current;
29
- if (!scrollContainer || !floatingScrollbar)
30
- return;
31
- const syncScroll = () => floatingScrollbar.scrollLeft = scrollContainer.scrollLeft;
32
- const syncScrollReverse = () => scrollContainer.scrollLeft = floatingScrollbar.scrollLeft;
33
- scrollContainer.addEventListener("scroll", syncScroll);
34
- floatingScrollbar.addEventListener("scroll", syncScrollReverse);
35
- return () => {
36
- scrollContainer.removeEventListener("scroll", syncScroll);
37
- floatingScrollbar.removeEventListener("scroll", syncScrollReverse);
38
- };
39
- }, []);
40
- const handleResize = () => {
41
- if (containerRef.current)
42
- setContainerWidth(containerRef.current.offsetWidth);
43
- };
44
- (0, react_1.useEffect)(() => {
45
- handleResize();
46
- window.addEventListener("resize", handleResize);
47
- return () => window.removeEventListener("resize", handleResize);
48
- }, []);
49
- (0, react_1.useEffect)(() => {
50
- if (floatingScrollbarContainerRef.current)
51
- floatingScrollbarContainerRef.current.style.width = `${containerWidth}px`;
52
- }, [containerWidth]);
53
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, _utils_1.cn)("relative", (0, _utils_1.pcn)(className, "base")), children: [(0, jsx_runtime_1.jsx)("div", { ref: containerRef, className: (0, _utils_1.cn)("scroll-container-main scroll", scrollFloating && "scroll-none", (0, _utils_1.pcn)(className, "container")), children: children }), (0, jsx_runtime_1.jsxs)("div", { className: "scroll-container-floating-bar", ref: floatingScrollbarContainerRef, children: [(0, jsx_runtime_1.jsx)("div", { ref: floatingScrollbarRef, className: (0, _utils_1.cn)(scrollFloating && "scroll-container-floating-wrapper scroll"), children: (0, jsx_runtime_1.jsx)("div", { className: "scroll-container-phantom-element", children: children }) }), footer] })] }));
54
- }
@@ -1 +0,0 @@
1
- export declare function ShortcutProvider(): import("react").JSX.Element;
@@ -1,42 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ShortcutProvider = ShortcutProvider;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const _utils_1 = require("@utils");
8
- const _contexts_1 = require("@contexts");
9
- const _components_1 = require("@components");
10
- function ShortcutProvider() {
11
- const { setToggle, toggle } = (0, _contexts_1.useToggleContext)();
12
- const shortcuts = _utils_1.shortcut.list();
13
- (0, react_1.useEffect)(() => {
14
- _utils_1.shortcut.init();
15
- }, []);
16
- (0, react_1.useEffect)(() => {
17
- _utils_1.shortcut.register("ctrl+/", () => {
18
- setToggle("MODAL_SHORTCUT_HELP");
19
- }, "List Shortcut");
20
- }, []);
21
- function formatShortcutKey(key) {
22
- return key
23
- .split("+")
24
- .map(k => {
25
- if (k === "ctrl")
26
- return "Ctrl";
27
- if (k === "shift")
28
- return "Shift";
29
- if (k === "alt")
30
- return "Alt";
31
- if (k === "arrowup")
32
- return "↑";
33
- if (k === "arrowdown")
34
- return "↓";
35
- if (k === " ")
36
- return "SPACE";
37
- return k.toUpperCase();
38
- })
39
- .join(" + ");
40
- }
41
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(_components_1.ModalComponent, { show: !!toggle["MODAL_SHORTCUT_HELP"], onClose: () => setToggle("MODAL_SHORTCUT_HELP"), title: "Shortcut", children: (0, jsx_runtime_1.jsx)("div", { className: "shortcut-help-grid", children: shortcuts.map(({ key, description }) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("kbd", { className: "shortcut-key-badge", children: formatShortcutKey(key) }), (0, jsx_runtime_1.jsxs)("span", { children: [": ", description] })] }, key))) }) }) }));
42
- }
@@ -1,14 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export type SwipeActionType = {
3
- label?: string;
4
- icon?: any;
5
- onAction?: () => void;
6
- className?: string;
7
- };
8
- export type SwipeProps = {
9
- leftActionControl?: SwipeActionType;
10
- rightActionControl?: SwipeActionType;
11
- children?: ReactNode;
12
- className?: string;
13
- };
14
- export declare function SwipeComponent({ leftActionControl, rightActionControl, children, className, }: SwipeProps): import("react").JSX.Element;
@@ -1,61 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SwipeComponent = SwipeComponent;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("react");
7
- const utils_1 = require("@/utils");
8
- const react_fontawesome_1 = require("@fortawesome/react-fontawesome");
9
- function SwipeComponent({ leftActionControl, rightActionControl, children, className, }) {
10
- const startX = (0, react_1.useRef)(0);
11
- const [offset, setOffset] = (0, react_1.useState)(0);
12
- const [dragging, setDragging] = (0, react_1.useState)(false);
13
- function onTouchStart(e) {
14
- setDragging(true);
15
- startX.current = e.touches[0].clientX - offset;
16
- }
17
- function onTouchMove(e) {
18
- if (!dragging)
19
- return;
20
- const currentX = e.touches[0].clientX;
21
- const delta = currentX - startX.current;
22
- let allowed = delta;
23
- // Jika tidak ada aksi kiri → larang geser ke kanan
24
- if (!leftActionControl && delta > 0)
25
- allowed = 0;
26
- // Jika tidak ada aksi kanan → larang geser ke kiri
27
- if (!rightActionControl && delta < 0)
28
- allowed = 0;
29
- // Batasi maksimal ±100px
30
- allowed = Math.max(Math.min(allowed, 100), -100);
31
- setOffset(allowed);
32
- }
33
- function onTouchEnd() {
34
- if (!dragging)
35
- return;
36
- setDragging(false);
37
- if (offset > 40 && leftActionControl) {
38
- setOffset(80);
39
- }
40
- else if (offset < -40 && rightActionControl) {
41
- setOffset(-80);
42
- }
43
- else {
44
- setOffset(0);
45
- }
46
- }
47
- function handleAction(side) {
48
- const control = side === 'left' ? leftActionControl : rightActionControl;
49
- control?.onAction?.();
50
- setOffset(0);
51
- }
52
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("swipe-container", className), children: [(0, jsx_runtime_1.jsxs)("div", { onClick: () => handleAction('left'), className: (0, utils_1.cn)("swipe-left-action", leftActionControl?.className, offset > 0 ? "opacity-100" : "opacity-0"), children: [leftActionControl?.icon && (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: leftActionControl?.icon }), " ", leftActionControl?.label] }), (0, jsx_runtime_1.jsxs)("div", { onClick: () => handleAction('right'), className: (0, utils_1.cn)("swipe-right-action", rightActionControl?.className, offset < 0 ? "opacity-100" : "opacity-0"), children: [rightActionControl?.icon && (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: rightActionControl?.icon }), " ", rightActionControl?.label] }), (0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("swipe-content", className), style: {
53
- transform: `translateX(${offset}px)`,
54
- transition: dragging ? "none" : "transform 0.2s ease",
55
- }, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onTouchEnd, onClickCapture: (e) => {
56
- if (offset !== 0) {
57
- setOffset(0);
58
- e.stopPropagation();
59
- }
60
- }, children: children })] }));
61
- }