@caseparts-org/caseblocks 0.0.84 → 0.0.86

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.
@@ -0,0 +1 @@
1
+ ._container_aum2v_1{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_aum2v_14{cursor:grabbing}._scrollVisibility--false_aum2v_19{scrollbar-width:none;-ms-overflow-style:none}._scrollVisibility--false_aum2v_19::-webkit-scrollbar{display:none}
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface HorizontalScrollProps extends PropsWithChildren {
3
+ className?: string;
4
+ showScrollbar?: boolean;
5
+ }
6
+ export declare function HorizontalScroll({ className, showScrollbar, children }: HorizontalScrollProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useRef as a, useState as v } from "react";
3
+ import { c as x } from "../../clsx-OuTLNxxd.js";
4
+ import '../../assets/HorizontalScroll.css';const h = "_container_aum2v_1", b = "_dragging_aum2v_14", l = {
5
+ container: h,
6
+ dragging: b,
7
+ "scrollVisibility--false": "_scrollVisibility--false_aum2v_19"
8
+ };
9
+ function S({
10
+ className: u,
11
+ showScrollbar: f = !1,
12
+ children: g
13
+ }) {
14
+ const r = a(null), [o, c] = v(!1), e = a({ x: 0, scroll: 0 }), d = (t) => {
15
+ r.current && (c(!0), e.current.x = t.clientX, e.current.scroll = r.current.scrollLeft);
16
+ }, m = (t) => {
17
+ if (!o || !r.current) return;
18
+ const n = t.clientX - e.current.x;
19
+ r.current.scrollLeft = e.current.scroll - n;
20
+ }, s = () => {
21
+ r.current && c(!1);
22
+ }, _ = (t) => {
23
+ const n = r.current;
24
+ if (!n || !(n.scrollWidth > n.clientWidth)) return;
25
+ const i = Math.abs(t.deltaY) >= Math.abs(t.deltaX) && t.deltaY !== 0 ? t.deltaY : t.deltaX;
26
+ i !== 0 ? (t.preventDefault(), n.scrollLeft += i) : t.preventDefault();
27
+ };
28
+ return /* @__PURE__ */ p(
29
+ "div",
30
+ {
31
+ ref: r,
32
+ className: x(
33
+ u,
34
+ l.container,
35
+ l[`scrollVisibility--${f}`],
36
+ o ? l.dragging : ""
37
+ ),
38
+ onPointerDown: d,
39
+ onPointerMove: m,
40
+ onPointerLeave: s,
41
+ onPointerUp: s,
42
+ onWheel: _,
43
+ children: g
44
+ }
45
+ );
46
+ }
47
+ export {
48
+ S as HorizontalScroll
49
+ };
@@ -0,0 +1,18 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ interface DemoArgs {
3
+ showScrollbar: boolean;
4
+ itemCount: number;
5
+ itemWidth: number;
6
+ itemHeight: number;
7
+ gap: number;
8
+ rounded: boolean;
9
+ gradient: boolean;
10
+ }
11
+ type StoryArgs = DemoArgs;
12
+ declare const meta: Meta<StoryArgs>;
13
+ export default meta;
14
+ type Story = StoryObj<StoryArgs>;
15
+ export declare const Playground: Story;
16
+ export declare const WithScrollbar: Story;
17
+ export declare const DenseSmallItems: Story;
18
+ export declare const LargeCards: Story;
@@ -0,0 +1,135 @@
1
+ import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
+ import { HorizontalScroll as t } from "./HorizontalScroll.js";
3
+ const b = {
4
+ title: "Case Parts/Atoms/HorizontalScroll",
5
+ component: t,
6
+ tags: ["autodocs"],
7
+ parameters: {
8
+ layout: "fullscreen",
9
+ docs: {
10
+ description: {
11
+ component: `
12
+ A drag + wheel enabled horizontal scrolling container.
13
+
14
+ Features:
15
+ - Pointer drag (mouse / touch) horizontal scrolling.
16
+ - Converts vertical mouse wheel motion to horizontal scrolling.
17
+ - Optional native scrollbar visibility via showScrollbar.
18
+
19
+ Use for carousels, chip lists, card rails, horizontally overflowing panels.
20
+ `.trim()
21
+ }
22
+ }
23
+ },
24
+ argTypes: {
25
+ showScrollbar: {
26
+ control: { type: "boolean" },
27
+ description: "Show native scrollbar when overflow exists."
28
+ },
29
+ itemCount: {
30
+ control: { type: "range", min: 3, max: 60, step: 1 },
31
+ description: "Number of demo items rendered."
32
+ },
33
+ itemWidth: {
34
+ control: { type: "number", min: 40, max: 320, step: 10 },
35
+ description: "Width of each item (px)."
36
+ },
37
+ itemHeight: {
38
+ control: { type: "number", min: 30, max: 240, step: 5 },
39
+ description: "Height of each item (px)."
40
+ },
41
+ gap: {
42
+ control: { type: "number", min: 0, max: 48, step: 2 },
43
+ description: "Gap between items (px)."
44
+ },
45
+ rounded: {
46
+ control: { type: "boolean" },
47
+ description: "Apply border radius to items."
48
+ },
49
+ gradient: {
50
+ control: { type: "boolean" },
51
+ description: "Use gradient background instead of solid."
52
+ }
53
+ },
54
+ args: {
55
+ showScrollbar: !1,
56
+ itemCount: 20,
57
+ itemWidth: 120,
58
+ itemHeight: 80,
59
+ gap: 12,
60
+ rounded: !0,
61
+ gradient: !0
62
+ }
63
+ }, i = (e) => {
64
+ const { itemCount: a, itemWidth: s, itemHeight: n, gap: d, rounded: c, gradient: h } = e;
65
+ return Array.from({ length: a }, (p, m) => {
66
+ const l = m + 1;
67
+ return /* @__PURE__ */ r(
68
+ "div",
69
+ {
70
+ style: {
71
+ flex: "0 0 auto",
72
+ width: s,
73
+ height: n,
74
+ marginRight: d,
75
+ borderRadius: c ? 8 : 0,
76
+ background: h ? "linear-gradient(135deg,#4F46E5,#6366F1)" : "#4F46E5",
77
+ color: "#fff",
78
+ display: "flex",
79
+ alignItems: "center",
80
+ justifyContent: "center",
81
+ fontSize: Math.max(12, Math.min(24, n / 3)),
82
+ fontWeight: 600,
83
+ userSelect: "none",
84
+ boxShadow: "0 2px 6px rgba(0,0,0,0.25)"
85
+ },
86
+ children: l
87
+ },
88
+ l
89
+ );
90
+ });
91
+ }, y = {
92
+ name: "Playground",
93
+ render: (e) => /* @__PURE__ */ o("div", { style: { padding: 24 }, children: [
94
+ /* @__PURE__ */ r("h3", { style: { margin: "0 0 12px" }, children: "HorizontalScroll Playground" }),
95
+ /* @__PURE__ */ r("p", { style: { margin: "0 0 16px", fontSize: 14, color: "#555" }, children: "Drag horizontally or use the mouse wheel. Tweak values in Controls." }),
96
+ /* @__PURE__ */ r(t, { showScrollbar: e.showScrollbar, children: i(e) })
97
+ ] })
98
+ }, f = {
99
+ args: { showScrollbar: !0 },
100
+ render: (e) => /* @__PURE__ */ o("div", { style: { padding: 24 }, children: [
101
+ /* @__PURE__ */ r("h3", { style: { margin: "0 0 12px" }, children: "Scrollbar Visible" }),
102
+ /* @__PURE__ */ r(t, { showScrollbar: !0, children: i(e) })
103
+ ] })
104
+ }, S = {
105
+ args: {
106
+ itemCount: 40,
107
+ itemWidth: 90,
108
+ itemHeight: 60,
109
+ gap: 8,
110
+ showScrollbar: !1
111
+ },
112
+ render: (e) => /* @__PURE__ */ o("div", { style: { padding: 24 }, children: [
113
+ /* @__PURE__ */ r("h3", { style: { margin: "0 0 12px" }, children: "Dense Small Items" }),
114
+ /* @__PURE__ */ r(t, { showScrollbar: e.showScrollbar, children: i(e) })
115
+ ] })
116
+ }, w = {
117
+ args: {
118
+ itemCount: 12,
119
+ itemWidth: 260,
120
+ itemHeight: 160,
121
+ gap: 16,
122
+ gradient: !1
123
+ },
124
+ render: (e) => /* @__PURE__ */ o("div", { style: { padding: 24 }, children: [
125
+ /* @__PURE__ */ r("h3", { style: { margin: "0 0 12px" }, children: "Large Cards" }),
126
+ /* @__PURE__ */ r(t, { showScrollbar: e.showScrollbar, children: i(e) })
127
+ ] })
128
+ };
129
+ export {
130
+ S as DenseSmallItems,
131
+ w as LargeCards,
132
+ y as Playground,
133
+ f as WithScrollbar,
134
+ b as default
135
+ };
@@ -1,4 +1,6 @@
1
1
  export * from './main-server';
2
+ export { HorizontalScroll } from './atoms/HorizontalScroll/HorizontalScroll';
3
+ export type { HorizontalScrollProps } from './atoms/HorizontalScroll/HorizontalScroll';
2
4
  export { Tooltip } from './molecules/Tooltip/Tooltip';
3
5
  export { Account } from './molecules/Account/Account';
4
6
  export type { AccountProps } from './molecules/Account/Account';
@@ -7,66 +7,68 @@ import { Root as c } from "./atoms/Root/Root.js";
7
7
  import { Separator as C } from "./atoms/Separator/Separator.js";
8
8
  import { Text as k } from "./atoms/Text/Text.js";
9
9
  import { Input as B } from "./atoms/Input/Input.js";
10
- import { Link as v } from "./atoms/Link/Link.js";
11
- import { linkClassName as L } from "./atoms/Link/linkClassName.js";
10
+ import { Link as h } from "./atoms/Link/Link.js";
11
+ import { linkClassName as I } from "./atoms/Link/linkClassName.js";
12
12
  import { configureLink as T, routerOverride as s } from "./atoms/Link/configureLink.js";
13
13
  import { LinkButton as N } from "./atoms/LinkButton/LinkButton.js";
14
- import { configureImage as M } from "./atoms/Image/configureImage.js";
15
- import { Logo as b } from "./molecules/Logo/Logo.js";
16
- import { SearchBox as G } from "./molecules/SearchBox/SearchBox.js";
17
- import { QuantityInput as O } from "./molecules/QuantityInput/QuantityInput.js";
18
- import { Pricing as R } from "./molecules/Pricing/Pricing.js";
19
- import { Availability as j } from "./molecules/Availability/Availability.js";
20
- import { Avatar as z } from "./molecules/Avatar/Avatar.js";
14
+ import { configureImage as H } from "./atoms/Image/configureImage.js";
15
+ import { Logo as P } from "./molecules/Logo/Logo.js";
16
+ import { SearchBox as w } from "./molecules/SearchBox/SearchBox.js";
17
+ import { QuantityInput as G } from "./molecules/QuantityInput/QuantityInput.js";
18
+ import { Pricing as Q } from "./molecules/Pricing/Pricing.js";
19
+ import { Availability as V } from "./molecules/Availability/Availability.js";
20
+ import { Avatar as q } from "./molecules/Avatar/Avatar.js";
21
21
  import { BannerCard as E } from "./molecules/BannerCard/BannerCard.js";
22
22
  import { NotFound as K } from "./organisms/NotFound/NotFound.js";
23
- import { Tooltip as W } from "./molecules/Tooltip/Tooltip.js";
24
- import { Account as Y } from "./molecules/Account/Account.js";
25
- import { Chip as _ } from "./molecules/Chip/Chip.js";
26
- import { ToggleView as oo } from "./molecules/ToggleView/ToggleView.js";
27
- import { StatefulButton as to } from "./molecules/StatefulButton/StatefulButton.js";
28
- import { AnimatedCheckMark as po } from "./molecules/StatefulButton/AnimatedCheckmark.js";
29
- import { AddToCart as fo } from "./molecules/AddToCart/AddToCart.js";
30
- import { MainNav as ao } from "./organisms/MainNav/MainNav.js";
31
- import { ChipSelector as io } from "./organisms/ChipSelector/ChipSelector.js";
32
- import { Product as lo } from "./organisms/Product/Product.js";
33
- import { Carousel as Co } from "./organisms/Carousel/Carousel.js";
34
- import { Footer as ko } from "./organisms/Footer/Footer.js";
23
+ import { HorizontalScroll as W } from "./atoms/HorizontalScroll/HorizontalScroll.js";
24
+ import { Tooltip as Y } from "./molecules/Tooltip/Tooltip.js";
25
+ import { Account as _ } from "./molecules/Account/Account.js";
26
+ import { Chip as oo } from "./molecules/Chip/Chip.js";
27
+ import { ToggleView as to } from "./molecules/ToggleView/ToggleView.js";
28
+ import { StatefulButton as po } from "./molecules/StatefulButton/StatefulButton.js";
29
+ import { AnimatedCheckMark as fo } from "./molecules/StatefulButton/AnimatedCheckmark.js";
30
+ import { AddToCart as ao } from "./molecules/AddToCart/AddToCart.js";
31
+ import { MainNav as io } from "./organisms/MainNav/MainNav.js";
32
+ import { ChipSelector as lo } from "./organisms/ChipSelector/ChipSelector.js";
33
+ import { Product as Co } from "./organisms/Product/Product.js";
34
+ import { Carousel as ko } from "./organisms/Carousel/Carousel.js";
35
+ import { Footer as Bo } from "./organisms/Footer/Footer.js";
35
36
  export {
36
- Y as Account,
37
- fo as AddToCart,
38
- po as AnimatedCheckMark,
39
- j as Availability,
40
- z as Avatar,
37
+ _ as Account,
38
+ ao as AddToCart,
39
+ fo as AnimatedCheckMark,
40
+ V as Availability,
41
+ q as Avatar,
41
42
  E as BannerCard,
42
43
  t as Button,
43
- Co as Carousel,
44
- _ as Chip,
45
- io as ChipSelector,
44
+ ko as Carousel,
45
+ oo as Chip,
46
+ lo as ChipSelector,
46
47
  f as Column,
47
48
  p as Flex,
48
- ko as Footer,
49
+ Bo as Footer,
49
50
  x as Grid,
50
51
  n as Head,
52
+ W as HorizontalScroll,
51
53
  u as Icon,
52
54
  B as Input,
53
- v as Link,
55
+ h as Link,
54
56
  N as LinkButton,
55
- b as Logo,
56
- ao as MainNav,
57
+ P as Logo,
58
+ io as MainNav,
57
59
  K as NotFound,
58
- R as Pricing,
59
- lo as Product,
60
- O as QuantityInput,
60
+ Q as Pricing,
61
+ Co as Product,
62
+ G as QuantityInput,
61
63
  c as Root,
62
- G as SearchBox,
64
+ w as SearchBox,
63
65
  C as Separator,
64
- to as StatefulButton,
66
+ po as StatefulButton,
65
67
  k as Text,
66
- oo as ToggleView,
67
- W as Tooltip,
68
- M as configureImage,
68
+ to as ToggleView,
69
+ Y as Tooltip,
70
+ H as configureImage,
69
71
  T as configureLink,
70
- L as linkClassName,
72
+ I as linkClassName,
71
73
  s as routerOverride
72
74
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.84",
4
+ "version": "0.0.86",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",