@caseparts-org/caseblocks 0.0.100 → 0.0.102

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.
@@ -1 +1 @@
1
- ._root_1bnow_1{width:100%}._header_1bnow_5{display:flex;align-items:center;justify-content:space-between;width:100%;gap:var(--spacing-spacing-2xs);margin-bottom:var(--spacing-spacing-2xs)}._controls_1bnow_13{display:flex;align-items:center;gap:var(--spacing-spacing-2xs)}._controlBtn_1bnow_18{cursor:pointer;padding:var(--spacing-spacing-3xs);border:none;background-color:transparent;line-height:1;display:flex;align-items:center;justify-content:center}._controlBtn_1bnow_18:hover{color:var(--color-brand-primary-primary-teal-blue)}._controlBtn_1bnow_18:disabled:hover{cursor:default;color:var(--color-neutrals-neutral-3)}._container_1bnow_37{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap;overflow-x:auto;width:100%;-webkit-overflow-scrolling:touch;cursor:grab;-webkit-user-select:none;user-select:none;overscroll-behavior:contain;touch-action:pan-x}._dragging_1bnow_50{cursor:grabbing}._noOverflow_1bnow_53{cursor:default}._scrollVisibility--false_1bnow_58{scrollbar-width:none;-ms-overflow-style:none}._scrollVisibility--false_1bnow_58::-webkit-scrollbar{display:none}._viewport_1bnow_66{position:relative}._indicator_1bnow_69{position:absolute;top:0;bottom:0;width:48px;pointer-events:none;opacity:1;transition:opacity .25s;z-index:1}._left_1bnow_79{left:0;background:linear-gradient(to right,var(--horizontal-scroll-indicator-color, rgba(0,0,0,.15)) 0%,rgba(0,0,0,0) 100%)}._right_1bnow_85{right:0;background:linear-gradient(to left,var(--horizontal-scroll-indicator-color, rgba(0,0,0,.15)) 0%,rgba(0,0,0,0) 100%)}._hidden_1bnow_91{opacity:0}
1
+ ._root_12m2a_1{width:100%}._header_12m2a_5{display:flex;align-items:center;justify-content:space-between;width:100%;gap:var(--spacing-spacing-2xs);margin-bottom:var(--spacing-spacing-2xs)}._controls_12m2a_13{display:flex;align-items:center;gap:var(--spacing-spacing-2xs)}._controlBtn_12m2a_18{cursor:pointer;padding:0;border:none;background-color:transparent;line-height:1;display:flex;align-items:center;justify-content:center}._controlBtn_12m2a_18:hover{color:var(--color-brand-primary-primary-teal-blue)}._controlBtn_12m2a_18:disabled:hover{cursor:default;color:var(--color-neutrals-neutral-3)}._container_12m2a_37{display:flex;flex-direction:row;align-items:center;flex-wrap:nowrap;overflow-x:auto;width:100%;-webkit-overflow-scrolling:touch;cursor:grab;-webkit-user-select:none;user-select:none;overscroll-behavior:contain;touch-action:pan-x}._dragging_12m2a_50{cursor:grabbing}._noOverflow_12m2a_53{cursor:default}._scrollVisibility--false_12m2a_58{scrollbar-width:none;-ms-overflow-style:none}._scrollVisibility--false_12m2a_58::-webkit-scrollbar{display:none}._viewport_12m2a_66{position:relative}._indicator_12m2a_69{position:absolute;top:0;bottom:0;width:48px;pointer-events:none;opacity:1;transition:opacity .25s;z-index:1}._left_12m2a_79{left:0;background:linear-gradient(to right,var(--horizontal-scroll-indicator-color, rgba(0,0,0,.15)) 0%,rgba(0,0,0,0) 100%)}._right_12m2a_85{right:0;background:linear-gradient(to left,var(--horizontal-scroll-indicator-color, rgba(0,0,0,.15)) 0%,rgba(0,0,0,0) 100%)}._hidden_12m2a_91{opacity:0}
@@ -1,6 +1,7 @@
1
1
  import { PropsWithChildren, ReactNode } from 'react';
2
2
  export interface HorizontalScrollProps extends PropsWithChildren {
3
3
  className?: string;
4
+ childrenContainerClassName?: string;
4
5
  childrenSpacing?: number | string;
5
6
  showScrollbar?: boolean;
6
7
  caption?: ReactNode;
@@ -11,4 +12,4 @@ export interface HorizontalScrollProps extends PropsWithChildren {
11
12
  showIndicators?: boolean;
12
13
  hideHeader?: boolean;
13
14
  }
14
- export declare function HorizontalScroll({ className, childrenSpacing, showScrollbar, children, caption, scrollStep, leftButtonContent, rightButtonContent, headerClassName, showIndicators, hideHeader, }: HorizontalScrollProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function HorizontalScroll({ className, childrenContainerClassName, childrenSpacing, showScrollbar, children, caption, scrollStep, leftButtonContent, rightButtonContent, headerClassName, showIndicators, hideHeader, }: HorizontalScrollProps): import("react/jsx-runtime").JSX.Element;
@@ -1,59 +1,60 @@
1
- import { jsxs as i, jsx as l, Fragment as Y } from "react/jsx-runtime";
2
- import { useRef as g, useState as h, useEffect as b } from "react";
1
+ import { jsxs as i, jsx as l, Fragment as j } from "react/jsx-runtime";
2
+ import { useRef as v, useState as h, useEffect as g } from "react";
3
3
  import { Icon as N } from "../Icon/Icon.js";
4
- import { Text as j } from "../Text/Text.js";
5
- import { c as a } from "../../clsx-OuTLNxxd.js";
6
- import '../../assets/HorizontalScroll.css';const F = "_root_1bnow_1", K = "_header_1bnow_5", q = "_controls_1bnow_13", G = "_controlBtn_1bnow_18", I = "_container_1bnow_37", U = "_dragging_1bnow_50", $ = "_noOverflow_1bnow_53", J = "_viewport_1bnow_66", Q = "_indicator_1bnow_69", Z = "_left_1bnow_79", tt = "_right_1bnow_85", et = "_hidden_1bnow_91", e = {
7
- root: F,
8
- header: K,
9
- controls: q,
10
- controlBtn: G,
11
- container: I,
12
- dragging: U,
13
- noOverflow: $,
14
- "scrollVisibility--false": "_scrollVisibility--false_1bnow_58",
15
- viewport: J,
16
- indicator: Q,
17
- left: Z,
18
- right: tt,
19
- hidden: et
4
+ import { Text as F } from "../Text/Text.js";
5
+ import { c as d } from "../../clsx-OuTLNxxd.js";
6
+ import '../../assets/HorizontalScroll.css';const K = "_root_12m2a_1", q = "_header_12m2a_5", G = "_controls_12m2a_13", I = "_controlBtn_12m2a_18", U = "_container_12m2a_37", $ = "_dragging_12m2a_50", J = "_noOverflow_12m2a_53", Q = "_viewport_12m2a_66", Z = "_indicator_12m2a_69", tt = "_left_12m2a_79", et = "_right_12m2a_85", rt = "_hidden_12m2a_91", e = {
7
+ root: K,
8
+ header: q,
9
+ controls: G,
10
+ controlBtn: I,
11
+ container: U,
12
+ dragging: $,
13
+ noOverflow: J,
14
+ "scrollVisibility--false": "_scrollVisibility--false_12m2a_58",
15
+ viewport: Q,
16
+ indicator: Z,
17
+ left: tt,
18
+ right: et,
19
+ hidden: rt
20
20
  };
21
21
  function it({
22
22
  className: S,
23
- childrenSpacing: E,
24
- showScrollbar: C = !1,
25
- children: D,
26
- caption: d,
27
- scrollStep: m = 160,
28
- leftButtonContent: W,
29
- rightButtonContent: z,
30
- headerClassName: O,
31
- showIndicators: B = !0,
32
- hideHeader: M = !1
23
+ childrenContainerClassName: E,
24
+ childrenSpacing: C,
25
+ showScrollbar: D = !1,
26
+ children: W,
27
+ caption: f,
28
+ scrollStep: p = 160,
29
+ leftButtonContent: z,
30
+ rightButtonContent: O,
31
+ headerClassName: B,
32
+ showIndicators: M = !0,
33
+ hideHeader: P = !1
33
34
  // new default
34
35
  }) {
35
- const n = g(null), [p, w] = h(!1), s = g({ x: 0, scroll: 0 }), f = g(!1), P = 5, [_, R] = h(!0), [v, X] = h(!1), [u, k] = h(!1), c = () => {
36
+ const n = v(null), [b, x] = h(!1), s = v({ x: 0, scroll: 0 }), u = v(!1), R = 5, [m, X] = h(!0), [_, k] = h(!1), [c, A] = h(!1), a = () => {
36
37
  const t = n.current;
37
38
  if (!t) return;
38
39
  const r = t.scrollWidth - t.clientWidth;
39
- k(t.scrollWidth > t.clientWidth + 1), R(t.scrollLeft <= 0), X(t.scrollLeft >= r - 1);
40
- }, A = (t) => {
41
- !n.current || !u || (w(!0), s.current.x = t.clientX, s.current.scroll = n.current.scrollLeft, f.current = !1);
40
+ A(t.scrollWidth > t.clientWidth + 1), X(t.scrollLeft <= 0), k(t.scrollLeft >= r - 1);
42
41
  }, H = (t) => {
43
- if (!p || !n.current) return;
44
- const r = t.clientX - s.current.x;
45
- n.current.scrollLeft = s.current.scroll - r, Math.abs(t.clientX - s.current.x) > P && (f.current = !0);
46
- }, x = () => {
47
- n.current && w(!1);
42
+ !n.current || !c || (x(!0), s.current.x = t.clientX, s.current.scroll = n.current.scrollLeft, u.current = !1);
48
43
  }, T = (t) => {
49
- f.current && (t.preventDefault(), t.stopPropagation(), f.current = !1);
50
- }, y = (t) => {
44
+ if (!b || !n.current) return;
45
+ const r = t.clientX - s.current.x;
46
+ n.current.scrollLeft = s.current.scroll - r, Math.abs(t.clientX - s.current.x) > R && (u.current = !0);
47
+ }, y = () => {
48
+ n.current && x(!1);
49
+ }, V = (t) => {
50
+ u.current && (t.preventDefault(), t.stopPropagation(), u.current = !1);
51
+ }, w = (t) => {
51
52
  const r = n.current;
52
53
  if (!r) return;
53
54
  const o = Math.max(0, Math.min(r.scrollLeft + t, r.scrollWidth - r.clientWidth));
54
- r.scrollTo({ left: o, behavior: "smooth" }), requestAnimationFrame(c);
55
+ r.scrollTo({ left: o, behavior: "smooth" }), requestAnimationFrame(a);
55
56
  };
56
- b(() => {
57
+ g(() => {
57
58
  const t = n.current;
58
59
  if (!t) return;
59
60
  const r = (o) => {
@@ -62,31 +63,31 @@ function it({
62
63
  L !== 0 ? (o.preventDefault(), t.scrollLeft += L) : o.preventDefault();
63
64
  };
64
65
  return t.addEventListener("wheel", r, { passive: !1 }), () => t.removeEventListener("wheel", r);
65
- }, []), b(() => {
66
+ }, []), g(() => {
66
67
  const t = n.current;
67
68
  if (t)
68
- return c(), t.addEventListener("scroll", c), () => t.removeEventListener("scroll", c);
69
- }, []), b(() => {
69
+ return a(), t.addEventListener("scroll", a), () => t.removeEventListener("scroll", a);
70
+ }, []), g(() => {
70
71
  const t = n.current;
71
72
  if (!t || typeof ResizeObserver > "u") return;
72
- const r = new ResizeObserver(() => c());
73
+ const r = new ResizeObserver(() => a());
73
74
  return r.observe(t), () => r.disconnect();
74
75
  }, []);
75
- const V = () => d == null ? null : typeof d == "string" ? /* @__PURE__ */ l(j, { variant: "display", size: "2xl", className: e.caption, children: d }) : d;
76
- return /* @__PURE__ */ i("div", { className: a(e.root, S), children: [
77
- !M && /* @__PURE__ */ i("div", { className: a(e.header, O), children: [
78
- V(),
79
- /* @__PURE__ */ i("div", { className: e.controls, children: [
76
+ const Y = () => f == null ? null : typeof f == "string" ? /* @__PURE__ */ l(F, { variant: "display", size: "2xl", className: e.caption, children: f }) : f;
77
+ return /* @__PURE__ */ i("div", { className: d(e.root, S), children: [
78
+ !P && /* @__PURE__ */ i("div", { className: d(e.header, B), children: [
79
+ Y(),
80
+ c && /* @__PURE__ */ i("div", { className: e.controls, children: [
80
81
  /* @__PURE__ */ l(
81
82
  "button",
82
83
  {
83
84
  type: "button",
84
85
  className: e.controlBtn,
85
- onClick: () => y(-m),
86
+ onClick: () => w(-p),
86
87
  "aria-label": "Scroll left",
87
- disabled: _,
88
- "aria-disabled": _,
89
- children: W ?? /* @__PURE__ */ l(N, { iconKey: "fa-regular fa-chevron-left", size: "sm" })
88
+ disabled: m,
89
+ "aria-disabled": m,
90
+ children: z ?? /* @__PURE__ */ l(N, { iconKey: "fa-regular fa-chevron-left", size: "sm" })
90
91
  }
91
92
  ),
92
93
  /* @__PURE__ */ l(
@@ -94,11 +95,11 @@ function it({
94
95
  {
95
96
  type: "button",
96
97
  className: e.controlBtn,
97
- onClick: () => y(m),
98
+ onClick: () => w(p),
98
99
  "aria-label": "Scroll right",
99
- disabled: v,
100
- "aria-disabled": v,
101
- children: z ?? /* @__PURE__ */ l(N, { iconKey: "fa-regular fa-chevron-right", size: "sm" })
100
+ disabled: _,
101
+ "aria-disabled": _,
102
+ children: O ?? /* @__PURE__ */ l(N, { iconKey: "fa-regular fa-chevron-right", size: "sm" })
102
103
  }
103
104
  )
104
105
  ] })
@@ -108,39 +109,40 @@ function it({
108
109
  "div",
109
110
  {
110
111
  ref: n,
111
- style: { gap: E ?? "var(--spacing-spacing-3xs)" },
112
- className: a(
112
+ style: { gap: C ?? "var(--spacing-spacing-3xs)" },
113
+ className: d(
113
114
  e.container,
114
- e[`scrollVisibility--${C}`],
115
- p ? e.dragging : "",
116
- !u && e.noOverflow
115
+ e[`scrollVisibility--${D}`],
116
+ b ? e.dragging : "",
117
+ !c && e.noOverflow,
118
+ E
117
119
  ),
118
- onPointerDown: A,
119
- onPointerMove: H,
120
- onPointerLeave: x,
121
- onPointerUp: x,
122
- onClickCapture: T,
123
- children: D
120
+ onPointerDown: H,
121
+ onPointerMove: T,
122
+ onPointerLeave: y,
123
+ onPointerUp: y,
124
+ onClickCapture: V,
125
+ children: W
124
126
  }
125
127
  ),
126
- B && /* @__PURE__ */ i(Y, { children: [
128
+ M && /* @__PURE__ */ i(j, { children: [
127
129
  /* @__PURE__ */ l(
128
130
  "div",
129
131
  {
130
- className: a(
132
+ className: d(
131
133
  e.indicator,
132
134
  e.left,
133
- (_ || !u) && e.hidden
135
+ (m || !c) && e.hidden
134
136
  )
135
137
  }
136
138
  ),
137
139
  /* @__PURE__ */ l(
138
140
  "div",
139
141
  {
140
- className: a(
142
+ className: d(
141
143
  e.indicator,
142
144
  e.right,
143
- (v || !u) && e.hidden
145
+ (_ || !c) && e.hidden
144
146
  )
145
147
  }
146
148
  )
@@ -4,11 +4,11 @@ interface DemoArgs {
4
4
  itemCount: number;
5
5
  itemWidth: number;
6
6
  itemHeight: number;
7
- gap: number;
8
7
  rounded: boolean;
9
8
  gradient: boolean;
10
9
  showIndicators: boolean;
11
10
  hideHeader: boolean;
11
+ childrenSpacing: number;
12
12
  }
13
13
  type StoryArgs = DemoArgs;
14
14
  declare const meta: Meta<StoryArgs>;
@@ -1,6 +1,6 @@
1
- import { jsxs as t, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
2
  import { HorizontalScroll as r } from "./HorizontalScroll.js";
3
- const b = {
3
+ const u = {
4
4
  title: "Case Parts/Atoms/HorizontalScroll",
5
5
  component: r,
6
6
  tags: ["autodocs"],
@@ -38,10 +38,6 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
38
38
  control: { type: "number", min: 30, max: 240, step: 5 },
39
39
  description: "Height of each item (px)."
40
40
  },
41
- gap: {
42
- control: { type: "number", min: 0, max: 48, step: 2 },
43
- description: "Gap between items (px)."
44
- },
45
41
  rounded: {
46
42
  control: { type: "boolean" },
47
43
  description: "Apply border radius to items."
@@ -57,6 +53,10 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
57
53
  hideHeader: {
58
54
  control: { type: "boolean" },
59
55
  description: "Hide the caption row and arrow controls."
56
+ },
57
+ childrenSpacing: {
58
+ control: { type: "number", min: 0, max: 64, step: 2 },
59
+ description: "Gap between direct children (flex gap)."
60
60
  }
61
61
  },
62
62
  args: {
@@ -64,25 +64,26 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
64
64
  itemCount: 20,
65
65
  itemWidth: 120,
66
66
  itemHeight: 80,
67
- gap: 12,
68
67
  rounded: !0,
69
68
  gradient: !0,
70
69
  showIndicators: !0,
71
70
  // new default
72
- hideHeader: !1
71
+ hideHeader: !1,
72
+ // new default
73
+ childrenSpacing: 12
73
74
  // new default
74
75
  }
75
- }, i = /* @__PURE__ */ o("style", { children: `
76
+ }, n = /* @__PURE__ */ o("style", { children: `
76
77
  .horizontalDemoScroll {
77
78
  touch-action: none; /* ensure pointer events for horizontal drag */
78
79
  }
79
80
  .horizontalDemoScroll a {
80
81
  -webkit-user-drag: none; /* Safari/Chrome: prevent ghost dragging of link */
81
82
  }
82
- ` }), n = (e) => {
83
- const { itemCount: d, itemWidth: s, itemHeight: a, gap: c, rounded: h, gradient: m } = e;
84
- return Array.from({ length: d }, (g, p) => {
85
- const l = p + 1;
83
+ ` }), t = (e) => {
84
+ const { itemCount: d, itemWidth: c, itemHeight: l, rounded: s, gradient: h } = e;
85
+ return Array.from({ length: d }, (p, m) => {
86
+ const a = m + 1;
86
87
  return /* @__PURE__ */ o(
87
88
  "a",
88
89
  {
@@ -90,29 +91,28 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
90
91
  draggable: !1,
91
92
  style: {
92
93
  flex: "0 0 auto",
93
- width: s,
94
- height: a,
95
- marginRight: c,
96
- borderRadius: h ? 8 : 0,
97
- background: m ? "linear-gradient(135deg,#4F46E5,#6366F1)" : "#4F46E5",
94
+ width: c,
95
+ height: l,
96
+ borderRadius: s ? 8 : 0,
97
+ background: h ? "linear-gradient(135deg,#4F46E5,#6366F1)" : "#4F46E5",
98
98
  color: "#fff",
99
99
  display: "flex",
100
100
  alignItems: "center",
101
101
  justifyContent: "center",
102
- fontSize: Math.max(12, Math.min(24, a / 3)),
102
+ fontSize: Math.max(12, Math.min(24, l / 3)),
103
103
  fontWeight: 600,
104
104
  userSelect: "none",
105
105
  boxShadow: "0 2px 6px rgba(0,0,0,0.25)"
106
106
  },
107
- children: l
107
+ children: a
108
108
  },
109
- l
109
+ a
110
110
  );
111
111
  });
112
- }, S = {
112
+ }, w = {
113
113
  name: "Playground",
114
- render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
115
- i,
114
+ render: (e) => /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
115
+ n,
116
116
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "HorizontalScroll Playground" }),
117
117
  /* @__PURE__ */ o("p", { style: { margin: "0 0 16px", fontSize: 14, color: "#555" }, children: "Drag horizontally or use the mouse wheel. Tweak values in Controls." }),
118
118
  /* @__PURE__ */ o(
@@ -122,15 +122,16 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
122
122
  showScrollbar: e.showScrollbar,
123
123
  showIndicators: e.showIndicators,
124
124
  hideHeader: e.hideHeader,
125
+ childrenSpacing: e.childrenSpacing,
125
126
  caption: `Playground (${e.itemCount} items)`,
126
- children: n(e)
127
+ children: t(e)
127
128
  }
128
129
  )
129
130
  ] })
130
- }, y = {
131
+ }, b = {
131
132
  args: { showScrollbar: !0 },
132
- render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
133
- i,
133
+ render: (e) => /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
134
+ n,
134
135
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Scrollbar Visible" }),
135
136
  /* @__PURE__ */ o(
136
137
  r,
@@ -139,21 +140,21 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
139
140
  showScrollbar: !0,
140
141
  showIndicators: e.showIndicators,
141
142
  hideHeader: e.hideHeader,
143
+ childrenSpacing: e.childrenSpacing,
142
144
  caption: "Scrollbar Visible",
143
- children: n(e)
145
+ children: t(e)
144
146
  }
145
147
  )
146
148
  ] })
147
- }, f = {
149
+ }, y = {
148
150
  args: {
149
151
  itemCount: 40,
150
152
  itemWidth: 90,
151
153
  itemHeight: 60,
152
- gap: 8,
153
154
  showScrollbar: !1
154
155
  },
155
- render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
156
- i,
156
+ render: (e) => /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
157
+ n,
157
158
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Dense Small Items" }),
158
159
  /* @__PURE__ */ o(
159
160
  r,
@@ -162,21 +163,21 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
162
163
  showScrollbar: e.showScrollbar,
163
164
  showIndicators: e.showIndicators,
164
165
  hideHeader: e.hideHeader,
166
+ childrenSpacing: e.childrenSpacing,
165
167
  caption: `Dense (${e.itemCount} items)`,
166
- children: n(e)
168
+ children: t(e)
167
169
  }
168
170
  )
169
171
  ] })
170
- }, H = {
172
+ }, f = {
171
173
  args: {
172
174
  itemCount: 12,
173
175
  itemWidth: 260,
174
176
  itemHeight: 160,
175
- gap: 16,
176
177
  gradient: !1
177
178
  },
178
- render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
179
- i,
179
+ render: (e) => /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
180
+ n,
180
181
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Large Cards" }),
181
182
  /* @__PURE__ */ o(
182
183
  r,
@@ -185,22 +186,23 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
185
186
  showScrollbar: e.showScrollbar,
186
187
  showIndicators: e.showIndicators,
187
188
  hideHeader: e.hideHeader,
189
+ childrenSpacing: e.childrenSpacing,
188
190
  caption: "Large Cards",
189
- children: n(e)
191
+ children: t(e)
190
192
  }
191
193
  )
192
194
  ] })
193
- }, x = {
195
+ }, H = {
194
196
  name: "Without Indicators",
195
197
  args: {
196
198
  showIndicators: !1,
197
199
  itemCount: 16,
198
200
  itemWidth: 140,
199
201
  itemHeight: 72,
200
- gap: 12
202
+ childrenSpacing: 12
201
203
  },
202
- render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
203
- i,
204
+ render: (e) => /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
205
+ n,
204
206
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Indicators Disabled" }),
205
207
  /* @__PURE__ */ o(
206
208
  r,
@@ -209,23 +211,23 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
209
211
  showScrollbar: e.showScrollbar,
210
212
  showIndicators: !1,
211
213
  hideHeader: e.hideHeader,
214
+ childrenSpacing: e.childrenSpacing,
212
215
  caption: "No Edge Indicators",
213
- children: n(e)
216
+ children: t(e)
214
217
  }
215
218
  )
216
219
  ] })
217
- }, I = {
220
+ }, x = {
218
221
  name: "Header Hidden",
219
222
  args: {
220
223
  hideHeader: !0,
221
224
  itemCount: 14,
222
225
  itemWidth: 130,
223
226
  itemHeight: 70,
224
- gap: 10,
225
227
  showIndicators: !0
226
228
  },
227
- render: (e) => /* @__PURE__ */ t("div", { style: { padding: 24 }, children: [
228
- i,
229
+ render: (e) => /* @__PURE__ */ i("div", { style: { padding: 24 }, children: [
230
+ n,
229
231
  /* @__PURE__ */ o("h3", { style: { margin: "0 0 12px" }, children: "Header Hidden" }),
230
232
  /* @__PURE__ */ o(
231
233
  r,
@@ -234,18 +236,19 @@ Use for carousels, chip lists, card rails, horizontally overflowing panels.
234
236
  showScrollbar: e.showScrollbar,
235
237
  showIndicators: e.showIndicators,
236
238
  hideHeader: !0,
239
+ childrenSpacing: e.childrenSpacing,
237
240
  caption: "(Will not render since header hidden)",
238
- children: n(e)
241
+ children: t(e)
239
242
  }
240
243
  )
241
244
  ] })
242
245
  };
243
246
  export {
244
- f as DenseSmallItems,
245
- I as HeaderHidden,
246
- H as LargeCards,
247
- S as Playground,
248
- y as WithScrollbar,
249
- x as WithoutIndicators,
250
- b as default
247
+ y as DenseSmallItems,
248
+ x as HeaderHidden,
249
+ f as LargeCards,
250
+ w as Playground,
251
+ b as WithScrollbar,
252
+ H as WithoutIndicators,
253
+ u as default
251
254
  };
@@ -11,6 +11,7 @@ export type TooltipProps = {
11
11
  closeDelay?: number;
12
12
  disabled?: boolean;
13
13
  leaveGraceMs?: number;
14
+ tooltipOffset?: number;
14
15
  };
15
16
  export declare const Tooltip: React.FC<TooltipProps>;
16
17
  export {};
@@ -1,78 +1,79 @@
1
- import { jsxs as N, Fragment as O, jsx as M } from "react/jsx-runtime";
1
+ import { jsxs as W, Fragment as A, jsx as S } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
- import { c as S } from "../../clsx-OuTLNxxd.js";
4
- import { r as W } from "../../index-B4KbmMH3.js";
5
- import '../../assets/Tooltip.css';const A = "_tooltip_17o7a_1", D = "_content_17o7a_11", j = {
6
- tooltip: A,
7
- content: D
3
+ import { c as j } from "../../clsx-OuTLNxxd.js";
4
+ import { r as D } from "../../index-B4KbmMH3.js";
5
+ import '../../assets/Tooltip.css';const I = "_tooltip_17o7a_1", O = "_content_17o7a_11", H = {
6
+ tooltip: I,
7
+ content: O
8
8
  };
9
- function I(l) {
10
- return l ? l.includes(" ") ? l : `${l} center` : "top center";
9
+ function $(u) {
10
+ return u ? u.includes(" ") ? u : `${u} center` : "top center";
11
11
  }
12
- function $(l) {
13
- const v = I(l).toLowerCase(), [s, t] = v.split(" ");
12
+ function q(u) {
13
+ const w = $(u).toLowerCase(), [s, t] = w.split(" ");
14
14
  return { side: ["top", "right", "bottom", "left"].includes(s) ? s : "top", align: t === "left" || t === "top" ? "start" : t === "right" || t === "bottom" ? "end" : "center" };
15
15
  }
16
- function q(l, v, s, t, d = 8) {
17
- const n = l.getBoundingClientRect(), u = v.getBoundingClientRect();
18
- let f = 0, c = 0;
19
- s === "top" ? f = n.top - u.height - d : s === "bottom" ? f = n.bottom + d : s === "left" ? c = n.left - u.width - d : s === "right" && (c = n.right + d), s === "top" || s === "bottom" ? t === "start" ? c = n.left : t === "end" ? c = n.right - u.width : c = n.left + n.width / 2 - u.width / 2 : t === "start" ? f = n.top : t === "end" ? f = n.bottom - u.height : f = n.top + n.height / 2 - u.height / 2;
20
- const E = window.innerWidth, R = window.innerHeight;
21
- return f = Math.max(4, Math.min(R - u.height - 4, f)), c = Math.max(4, Math.min(E - u.width - 4, c)), { top: f, left: c };
16
+ function G(u, w, s, t, d = 0) {
17
+ const n = u.getBoundingClientRect(), f = w.getBoundingClientRect();
18
+ let a = 0, c = 0;
19
+ s === "top" ? a = n.top - f.height - d : s === "bottom" ? a = n.bottom + d : s === "left" ? c = n.left - f.width - d : s === "right" && (c = n.right + d), s === "top" || s === "bottom" ? t === "start" ? c = n.left : t === "end" ? c = n.right - f.width : c = n.left + n.width / 2 - f.width / 2 : t === "start" ? a = n.top : t === "end" ? a = n.bottom - f.height : a = n.top + n.height / 2 - f.height / 2;
20
+ const E = window.innerWidth, v = window.innerHeight;
21
+ return a = Math.max(4, Math.min(v - f.height - 4, a)), c = Math.max(4, Math.min(E - f.width - 4, c)), { top: a, left: c };
22
22
  }
23
- const Q = ({
24
- tooltipClassName: l,
25
- contentClassName: v,
23
+ const U = ({
24
+ tooltipClassName: u,
25
+ contentClassName: w,
26
26
  children: s,
27
27
  trigger: t,
28
28
  position: d,
29
29
  disabled: n,
30
- openDelay: u = 150,
31
- closeDelay: f = 100,
32
- leaveGraceMs: c = 0
30
+ openDelay: f = 150,
31
+ closeDelay: a = 100,
32
+ leaveGraceMs: c = 0,
33
+ tooltipOffset: E = 4
33
34
  }) => {
34
- const { side: E, align: R } = $(d), [o, y] = i.useState(!1), [m, C] = i.useState(null), T = i.useRef(null), g = i.useRef(null), x = i.useRef(null), L = i.useRef(null), P = i.useRef(null), w = i.useRef(!1), a = (e) => {
35
+ const { side: v, align: b } = q(d), [o, R] = i.useState(!1), [m, C] = i.useState(null), T = i.useRef(null), g = i.useRef(null), x = i.useRef(null), y = i.useRef(null), L = i.useRef(null), h = i.useRef(!1), p = (e) => {
35
36
  e.current && (window.clearTimeout(e.current), e.current = null);
36
37
  }, B = () => {
37
- a(x), a(L), a(P);
38
+ p(x), p(y), p(L);
38
39
  };
39
40
  i.useEffect(() => () => B(), []);
40
41
  const k = () => {
41
- n || o || (a(x), x.current = window.setTimeout(() => y(!0), u));
42
+ n || o || (p(x), x.current = window.setTimeout(() => R(!0), f));
42
43
  }, _ = () => {
43
- o && (a(L), L.current = window.setTimeout(() => {
44
- w.current || y(!1);
45
- }, f));
44
+ o && (p(y), y.current = window.setTimeout(() => {
45
+ h.current || R(!1);
46
+ }, a));
46
47
  }, z = () => {
47
48
  if (o) {
48
- if (a(P), c <= 0) {
49
+ if (p(L), c <= 0) {
49
50
  _();
50
51
  return;
51
52
  }
52
- P.current = window.setTimeout(() => {
53
- w.current || _();
53
+ L.current = window.setTimeout(() => {
54
+ h.current || _();
54
55
  }, c);
55
56
  }
56
- }, b = (e, r) => (h) => {
57
- e == null || e(h), r == null || r(h);
58
- }, H = i.cloneElement(t, {
57
+ }, P = (e, r) => (l) => {
58
+ e == null || e(l), r == null || r(l);
59
+ }, N = i.cloneElement(t, {
59
60
  ref: (e) => {
60
61
  const { ref: r } = t;
61
62
  typeof r == "function" ? r(e) : r && (r.current = e), T.current = e;
62
63
  },
63
- onPointerEnter: b(t.props.onPointerEnter, k),
64
- onPointerLeave: b(t.props.onPointerLeave, z),
65
- onFocus: b(t.props.onFocus, k),
66
- onBlur: b(t.props.onBlur, _),
64
+ onPointerEnter: P(t.props.onPointerEnter, k),
65
+ onPointerLeave: P(t.props.onPointerLeave, z),
66
+ onFocus: P(t.props.onFocus, k),
67
+ onBlur: P(t.props.onBlur, _),
67
68
  "aria-describedby": o ? "tooltip-popup" : void 0,
68
69
  style: { ...t.props.style || {}, outline: "none" }
69
70
  });
70
71
  return i.useEffect(() => {
71
- n && o && (B(), y(!1));
72
+ n && o && (B(), R(!1));
72
73
  }, [n]), i.useEffect(() => {
73
74
  if (!o) return;
74
75
  const e = (r) => {
75
- r.key === "Escape" && y(!1);
76
+ r.key === "Escape" && R(!1);
76
77
  };
77
78
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
78
79
  }, [o]), i.useLayoutEffect(() => {
@@ -82,36 +83,36 @@ const Q = ({
82
83
  }
83
84
  const e = T.current, r = g.current;
84
85
  if (!e || !r) return;
85
- const h = 8, p = () => {
86
- C(q(e, r, E, R, h));
86
+ const l = () => {
87
+ C(G(e, r, v, b, E));
87
88
  };
88
- return p(), window.addEventListener("resize", p), window.addEventListener("scroll", p, !0), () => {
89
- window.removeEventListener("resize", p), window.removeEventListener("scroll", p, !0);
89
+ return l(), window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), () => {
90
+ window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0);
90
91
  };
91
- }, [o, E, R, s]), i.useEffect(() => {
92
+ }, [o, v, b, s, E]), i.useEffect(() => {
92
93
  if (!o) return;
93
94
  const e = (r) => {
94
- const h = T.current, p = g.current;
95
- if (!h || !p) return;
96
- const F = r.target;
97
- !h.contains(F) && !p.contains(F) && (w.current = !1, z());
95
+ const l = T.current, F = g.current;
96
+ if (!l || !F) return;
97
+ const M = r.target;
98
+ !l.contains(M) && !F.contains(M) && (h.current = !1, z());
98
99
  };
99
100
  return document.addEventListener("pointermove", e), () => document.removeEventListener("pointermove", e);
100
101
  }, [o]), i.useEffect(() => {
101
- o || (w.current = !1);
102
- }, [o]), /* @__PURE__ */ N(O, { children: [
103
- H,
104
- o && typeof document < "u" && W.createPortal(
105
- /* @__PURE__ */ M(
102
+ o || (h.current = !1);
103
+ }, [o]), /* @__PURE__ */ W(A, { children: [
104
+ N,
105
+ o && typeof document < "u" && D.createPortal(
106
+ /* @__PURE__ */ S(
106
107
  "div",
107
108
  {
108
109
  id: "tooltip-popup",
109
110
  ref: g,
110
111
  role: "tooltip",
111
112
  "aria-hidden": !o,
112
- "data-side": E,
113
- "data-align": R,
114
- className: S(j.tooltip, l),
113
+ "data-side": v,
114
+ "data-align": b,
115
+ className: j(H.tooltip, u),
115
116
  style: {
116
117
  position: "absolute",
117
118
  top: (m == null ? void 0 : m.top) ?? 0,
@@ -120,12 +121,12 @@ const Q = ({
120
121
  zIndex: 10
121
122
  },
122
123
  onPointerEnter: () => {
123
- w.current = !0, a(L), a(P);
124
+ h.current = !0, p(y), p(L);
124
125
  },
125
126
  onPointerLeave: () => {
126
- w.current = !1, z();
127
+ h.current = !1, z();
127
128
  },
128
- children: /* @__PURE__ */ M("div", { className: S(j.content, v), children: s })
129
+ children: /* @__PURE__ */ S("div", { className: j(H.content, w), children: s })
129
130
  }
130
131
  ),
131
132
  document.body
@@ -133,5 +134,5 @@ const Q = ({
133
134
  ] });
134
135
  };
135
136
  export {
136
- Q as Tooltip
137
+ U as Tooltip
137
138
  };
@@ -19,6 +19,7 @@ function z({
19
19
  {
20
20
  openDelay: 180,
21
21
  closeDelay: 0,
22
+ tooltipOffset: 0,
22
23
  trigger: /* @__PURE__ */ e("li", { className: o.category, tabIndex: 0, children: /* @__PURE__ */ t(s, { href: i.route, children: [
23
24
  /* @__PURE__ */ e(n, { size: "sm", weight: "semibold", children: i.label }),
24
25
  i.showChevron && /* @__PURE__ */ e(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.100",
4
+ "version": "0.0.102",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",