@pichetch08/trip-ui 0.1.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 (145) hide show
  1. package/README.md +46 -0
  2. package/dist/accordion.d.ts +18 -0
  3. package/dist/accordion.js +76 -0
  4. package/dist/agreement-modal.d.ts +16 -0
  5. package/dist/agreement-modal.js +67 -0
  6. package/dist/alert.d.ts +13 -0
  7. package/dist/alert.js +47 -0
  8. package/dist/auth-hero.d.ts +7 -0
  9. package/dist/auth-hero.js +63 -0
  10. package/dist/avatar.d.ts +21 -0
  11. package/dist/avatar.js +114 -0
  12. package/dist/badge.d.ts +13 -0
  13. package/dist/badge.js +36 -0
  14. package/dist/banner.d.ts +14 -0
  15. package/dist/banner.js +57 -0
  16. package/dist/breadcrumb.d.ts +15 -0
  17. package/dist/breadcrumb.js +37 -0
  18. package/dist/button.d.ts +15 -0
  19. package/dist/button.js +81 -0
  20. package/dist/card.d.ts +30 -0
  21. package/dist/card.js +66 -0
  22. package/dist/change-summary-modal.d.ts +35 -0
  23. package/dist/change-summary-modal.js +128 -0
  24. package/dist/channel-badge.d.ts +8 -0
  25. package/dist/channel-badge.js +17 -0
  26. package/dist/checkbox.d.ts +28 -0
  27. package/dist/checkbox.js +108 -0
  28. package/dist/chunk-ORMEWXMH.js +37 -0
  29. package/dist/color-picker.d.ts +15 -0
  30. package/dist/color-picker.js +159 -0
  31. package/dist/confirm-dialog.d.ts +23 -0
  32. package/dist/confirm-dialog.js +108 -0
  33. package/dist/copy-button.d.ts +13 -0
  34. package/dist/copy-button.js +69 -0
  35. package/dist/dashed-add-button.d.ts +8 -0
  36. package/dist/dashed-add-button.js +24 -0
  37. package/dist/data-table.d.ts +27 -0
  38. package/dist/data-table.js +152 -0
  39. package/dist/date-picker.d.ts +19 -0
  40. package/dist/date-picker.js +234 -0
  41. package/dist/date-range-picker.d.ts +25 -0
  42. package/dist/date-range-picker.js +456 -0
  43. package/dist/dev-auto-fill.d.ts +12 -0
  44. package/dist/dev-auto-fill.js +22 -0
  45. package/dist/divider.d.ts +10 -0
  46. package/dist/divider.js +44 -0
  47. package/dist/drawer.d.ts +16 -0
  48. package/dist/drawer.js +111 -0
  49. package/dist/dropdown-menu.d.ts +20 -0
  50. package/dist/dropdown-menu.js +94 -0
  51. package/dist/empty-state.d.ts +13 -0
  52. package/dist/empty-state.js +24 -0
  53. package/dist/file-upload.d.ts +32 -0
  54. package/dist/file-upload.js +212 -0
  55. package/dist/filter-tabs.d.ts +16 -0
  56. package/dist/filter-tabs.js +30 -0
  57. package/dist/footer-action-bar.d.ts +21 -0
  58. package/dist/footer-action-bar.js +95 -0
  59. package/dist/form-input.d.ts +16 -0
  60. package/dist/form-input.js +58 -0
  61. package/dist/form-textarea.d.ts +13 -0
  62. package/dist/form-textarea.js +41 -0
  63. package/dist/icon-button.d.ts +12 -0
  64. package/dist/icon-button.js +54 -0
  65. package/dist/icon-picker.d.ts +15 -0
  66. package/dist/icon-picker.js +311 -0
  67. package/dist/icon-wrapper.d.ts +15 -0
  68. package/dist/icon-wrapper.js +52 -0
  69. package/dist/image-upload.d.ts +24 -0
  70. package/dist/image-upload.js +122 -0
  71. package/dist/index.d.ts +71 -0
  72. package/dist/index.js +155 -0
  73. package/dist/kbd.d.ts +15 -0
  74. package/dist/kbd.js +27 -0
  75. package/dist/mobile-preview.d.ts +36 -0
  76. package/dist/mobile-preview.js +167 -0
  77. package/dist/modal.d.ts +19 -0
  78. package/dist/modal.js +110 -0
  79. package/dist/multi-select.d.ts +30 -0
  80. package/dist/multi-select.js +261 -0
  81. package/dist/number-input.d.ts +21 -0
  82. package/dist/number-input.js +129 -0
  83. package/dist/otp-input.d.ts +13 -0
  84. package/dist/otp-input.js +114 -0
  85. package/dist/page-header.d.ts +15 -0
  86. package/dist/page-header.js +43 -0
  87. package/dist/page-state.d.ts +14 -0
  88. package/dist/page-state.js +29 -0
  89. package/dist/pagination.d.ts +20 -0
  90. package/dist/pagination.js +87 -0
  91. package/dist/popover.d.ts +11 -0
  92. package/dist/popover.js +70 -0
  93. package/dist/preview-drawer.d.ts +33 -0
  94. package/dist/preview-drawer.js +74 -0
  95. package/dist/progress-bar.d.ts +15 -0
  96. package/dist/progress-bar.js +56 -0
  97. package/dist/qr-code-display.d.ts +10 -0
  98. package/dist/qr-code-display.js +43 -0
  99. package/dist/radio-group.d.ts +19 -0
  100. package/dist/radio-group.js +78 -0
  101. package/dist/rating.d.ts +12 -0
  102. package/dist/rating.js +123 -0
  103. package/dist/rich-editor.d.ts +13 -0
  104. package/dist/rich-editor.js +97 -0
  105. package/dist/search-bar.d.ts +14 -0
  106. package/dist/search-bar.js +64 -0
  107. package/dist/section-header.d.ts +12 -0
  108. package/dist/section-header.js +41 -0
  109. package/dist/segmented-control.d.ts +24 -0
  110. package/dist/segmented-control.js +38 -0
  111. package/dist/select-picker.d.ts +24 -0
  112. package/dist/select-picker.js +157 -0
  113. package/dist/skeleton.d.ts +14 -0
  114. package/dist/skeleton.js +53 -0
  115. package/dist/slider.d.ts +17 -0
  116. package/dist/slider.js +151 -0
  117. package/dist/spinner.d.ts +13 -0
  118. package/dist/spinner.js +38 -0
  119. package/dist/stat-card.d.ts +20 -0
  120. package/dist/stat-card.js +87 -0
  121. package/dist/stats-summary.d.ts +13 -0
  122. package/dist/stats-summary.js +28 -0
  123. package/dist/status-badge.d.ts +19 -0
  124. package/dist/status-badge.js +41 -0
  125. package/dist/stepper.d.ts +12 -0
  126. package/dist/stepper.js +89 -0
  127. package/dist/tabs.d.ts +18 -0
  128. package/dist/tabs.js +70 -0
  129. package/dist/tag.d.ts +23 -0
  130. package/dist/tag.js +158 -0
  131. package/dist/time-picker.d.ts +19 -0
  132. package/dist/time-picker.js +222 -0
  133. package/dist/timeline.d.ts +15 -0
  134. package/dist/timeline.js +49 -0
  135. package/dist/toast.d.ts +18 -0
  136. package/dist/toast.js +108 -0
  137. package/dist/toggle-switch.d.ts +12 -0
  138. package/dist/toggle-switch.js +34 -0
  139. package/dist/tooltip.d.ts +9 -0
  140. package/dist/tooltip.js +69 -0
  141. package/dist/trip-day-map-lazy.d.ts +15 -0
  142. package/dist/trip-day-map-lazy.js +16 -0
  143. package/dist/trip-day-map.d.ts +15 -0
  144. package/dist/trip-day-map.js +62 -0
  145. package/package.json +73 -0
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import "./chunk-ORMEWXMH.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useRef, useState } from "react";
5
+ function Tooltip({
6
+ content,
7
+ children,
8
+ placement = "top",
9
+ delay = 300
10
+ }) {
11
+ const [visible, setVisible] = useState(false);
12
+ const timerRef = useRef(null);
13
+ const show = () => {
14
+ timerRef.current = setTimeout(() => setVisible(true), delay);
15
+ };
16
+ const hide = () => {
17
+ if (timerRef.current) {
18
+ clearTimeout(timerRef.current);
19
+ timerRef.current = null;
20
+ }
21
+ setVisible(false);
22
+ };
23
+ const positionClasses = {
24
+ top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
25
+ bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
26
+ left: "right-full top-1/2 -translate-y-1/2 mr-2",
27
+ right: "left-full top-1/2 -translate-y-1/2 ml-2"
28
+ };
29
+ const arrowClasses = {
30
+ top: "top-full left-1/2 -translate-x-1/2 border-t-on-surface border-x-transparent border-b-transparent",
31
+ bottom: "bottom-full left-1/2 -translate-x-1/2 border-b-on-surface border-x-transparent border-t-transparent",
32
+ left: "left-full top-1/2 -translate-y-1/2 border-l-on-surface border-y-transparent border-r-transparent",
33
+ right: "right-full top-1/2 -translate-y-1/2 border-r-on-surface border-y-transparent border-l-transparent"
34
+ };
35
+ return /* @__PURE__ */ jsxs(
36
+ "span",
37
+ {
38
+ className: "relative inline-block",
39
+ onMouseEnter: show,
40
+ onMouseLeave: hide,
41
+ onFocus: show,
42
+ onBlur: hide,
43
+ children: [
44
+ children,
45
+ /* @__PURE__ */ jsxs(
46
+ "span",
47
+ {
48
+ role: "tooltip",
49
+ className: `absolute z-50 px-3 py-1.5 text-xs font-medium bg-on-surface text-surface rounded-lg whitespace-nowrap shadow-lg pointer-events-none transition-opacity duration-150 ${positionClasses[placement]} ${visible ? "opacity-100" : "opacity-0"}`,
50
+ children: [
51
+ content,
52
+ /* @__PURE__ */ jsx(
53
+ "span",
54
+ {
55
+ "aria-hidden": "true",
56
+ className: `absolute border-4 ${arrowClasses[placement]}`,
57
+ style: { borderStyle: "solid" }
58
+ }
59
+ )
60
+ ]
61
+ }
62
+ )
63
+ ]
64
+ }
65
+ );
66
+ }
67
+ export {
68
+ Tooltip
69
+ };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface MapActivity {
4
+ name: string;
5
+ lat: number;
6
+ lng: number;
7
+ time?: string | null;
8
+ }
9
+ interface TripDayMapLazyProps {
10
+ activities: MapActivity[];
11
+ height?: string;
12
+ }
13
+ declare function TripDayMapLazy(props: TripDayMapLazyProps): react_jsx_runtime.JSX.Element;
14
+
15
+ export { type MapActivity, TripDayMapLazy };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ __spreadValues
4
+ } from "./chunk-ORMEWXMH.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import dynamic from "next/dynamic";
7
+ const TripDayMapInner = dynamic(
8
+ () => import("./trip-day-map").then((m) => ({ default: m.TripDayMap })),
9
+ { ssr: false, loading: () => /* @__PURE__ */ jsx("div", { className: "w-full h-[280px] rounded-2xl bg-surface-variant animate-pulse" }) }
10
+ );
11
+ function TripDayMapLazy(props) {
12
+ return /* @__PURE__ */ jsx(TripDayMapInner, __spreadValues({}, props));
13
+ }
14
+ export {
15
+ TripDayMapLazy
16
+ };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface MapActivity {
4
+ name: string;
5
+ lat: number;
6
+ lng: number;
7
+ time?: string | null;
8
+ }
9
+ interface TripDayMapProps {
10
+ activities: MapActivity[];
11
+ height?: string;
12
+ }
13
+ declare function TripDayMap({ activities, height }: TripDayMapProps): react_jsx_runtime.JSX.Element | null;
14
+
15
+ export { type MapActivity, TripDayMap };
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import "./chunk-ORMEWXMH.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useEffect } from "react";
5
+ import { MapContainer, TileLayer, Marker, Popup, Polyline, useMap } from "react-leaflet";
6
+ import "leaflet/dist/leaflet.css";
7
+ function BoundsFitter({ positions }) {
8
+ const map = useMap();
9
+ useEffect(() => {
10
+ if (positions.length === 0) return;
11
+ if (positions.length === 1) {
12
+ map.setView(positions[0], 14);
13
+ } else {
14
+ map.fitBounds(positions, { padding: [32, 32] });
15
+ }
16
+ }, [map, positions]);
17
+ return null;
18
+ }
19
+ function TripDayMap({ activities, height = "280px" }) {
20
+ var _a;
21
+ const positions = activities.map((a) => [a.lat, a.lng]);
22
+ const center = (_a = positions[0]) != null ? _a : [13.75, 100.52];
23
+ useEffect(() => {
24
+ import("leaflet").then((L) => {
25
+ delete L.Icon.Default.prototype._getIconUrl;
26
+ L.Icon.Default.mergeOptions({
27
+ iconRetinaUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",
28
+ iconUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",
29
+ shadowUrl: "https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"
30
+ });
31
+ });
32
+ }, []);
33
+ if (activities.length === 0) return null;
34
+ return /* @__PURE__ */ jsx("div", { style: { height }, className: "w-full rounded-2xl overflow-hidden border border-outline-variant/30", children: /* @__PURE__ */ jsxs(
35
+ MapContainer,
36
+ {
37
+ center,
38
+ zoom: 13,
39
+ style: { height: "100%", width: "100%" },
40
+ scrollWheelZoom: false,
41
+ attributionControl: false,
42
+ children: [
43
+ /* @__PURE__ */ jsx(TileLayer, { url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }),
44
+ /* @__PURE__ */ jsx(BoundsFitter, { positions }),
45
+ activities.length > 1 && /* @__PURE__ */ jsx(
46
+ Polyline,
47
+ {
48
+ positions,
49
+ pathOptions: { color: "var(--primary)", weight: 2.5, opacity: 0.7, dashArray: "6 4" }
50
+ }
51
+ ),
52
+ activities.map((act, i) => /* @__PURE__ */ jsx(Marker, { position: [act.lat, act.lng], children: /* @__PURE__ */ jsxs(Popup, { children: [
53
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold", children: act.name }),
54
+ act.time && /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 mt-0.5", children: act.time })
55
+ ] }) }, i))
56
+ ]
57
+ }
58
+ ) });
59
+ }
60
+ export {
61
+ TripDayMap
62
+ };
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@pichetch08/trip-ui",
3
+ "version": "0.1.0",
4
+ "description": "Trip UI — shared React component library built with Tailwind v4 and Material Design 3 tokens",
5
+ "author": "pichetch08",
6
+ "license": "MIT",
7
+ "keywords": ["react", "tailwind", "material-design", "ui", "components", "trip"],
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "package.json",
21
+ "README.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "storybook": "storybook dev -p 6006",
26
+ "build-storybook": "storybook build"
27
+ },
28
+ "peerDependencies": {
29
+ "clsx": ">=2",
30
+ "next": ">=15",
31
+ "react": ">=19",
32
+ "react-dom": ">=19",
33
+ "tailwind-merge": ">=3"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "next": { "optional": true }
37
+ },
38
+ "dependencies": {
39
+ "leaflet": "^1.9.4",
40
+ "qrcode": "^1.5.4",
41
+ "react-leaflet": "^5.0.0",
42
+ "@tiptap/extension-link": "^3.22.5",
43
+ "@tiptap/pm": "^3.22.5",
44
+ "@tiptap/react": "^3.22.5",
45
+ "@tiptap/starter-kit": "^3.22.5"
46
+ },
47
+ "devDependencies": {
48
+ "@chromatic-com/storybook": "^5.1.2",
49
+ "@storybook/addon-a11y": "^10.3.6",
50
+ "@storybook/addon-docs": "^10.3.6",
51
+ "@storybook/addon-onboarding": "^10.3.6",
52
+ "@storybook/addon-vitest": "^10.3.6",
53
+ "@storybook/react-vite": "^10.3.6",
54
+ "@tailwindcss/postcss": "^4.2.4",
55
+ "@types/leaflet": "^1.9.21",
56
+ "@types/qrcode": "^1.5.6",
57
+ "@types/react": "^19",
58
+ "@types/react-dom": "^19",
59
+ "@vitest/browser-playwright": "^4.1.5",
60
+ "@vitest/coverage-v8": "^4.1.5",
61
+ "clsx": "^2.1.1",
62
+ "next": "^16.2.1",
63
+ "playwright": "^1.59.1",
64
+ "react": "^19.2.4",
65
+ "react-dom": "^19.2.4",
66
+ "storybook": "^10.3.6",
67
+ "tailwind-merge": "^3.5.0",
68
+ "tailwindcss": "^4",
69
+ "tsup": "^8.0.0",
70
+ "typescript": "^5.9.3",
71
+ "vitest": "^4.1.5"
72
+ }
73
+ }