trepur_components 2.3.29 → 2.3.30

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.
@@ -3,7 +3,7 @@ import { Button } from './';
3
3
 
4
4
  declare const meta: {
5
5
  title: string;
6
- component: import('react').ForwardRefExoticComponent<((import('react').HTMLAttributes<HTMLButtonElement> | import('react').HTMLAttributes<HTMLAnchorElement>) & import('./').ButtonProps) & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
6
+ component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLButtonElement> & import('./').ButtonProps & import('react').RefAttributes<HTMLButtonElement>> & {
7
7
  Icon: import('react').ForwardRefExoticComponent<{
8
8
  icon: any;
9
9
  } & import('react').RefAttributes<SVGSVGElement>>;
@@ -23,7 +23,7 @@ export declare const Bordered: Story;
23
23
  export declare const Ghost: Story;
24
24
  export declare const Basic: Story;
25
25
  export declare const Loading: Story;
26
- export declare const Link: Story;
27
26
  export declare const Small: Story;
28
27
  export declare const Medium: Story;
29
28
  export declare const Large: Story;
29
+ export declare const Disabled: Story;
@@ -4,12 +4,12 @@ export interface ButtonProps {
4
4
  variant?: 'primary' | 'secondary' | 'ghost' | 'bordered' | 'basic';
5
5
  disabled?: boolean;
6
6
  loading?: boolean;
7
- type?: 'button' | 'link' | 'submit';
7
+ type?: 'button' | 'submit';
8
8
  href?: string;
9
9
  target?: string;
10
10
  size?: 'sm' | 'md' | 'lg';
11
11
  }
12
- declare const Button: import('react').ForwardRefExoticComponent<((HTMLAttributes<HTMLButtonElement> | HTMLAttributes<HTMLAnchorElement>) & ButtonProps) & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
12
+ declare const Button: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & ButtonProps & import('react').RefAttributes<HTMLButtonElement>> & {
13
13
  Icon: import('react').ForwardRefExoticComponent<{
14
14
  icon: any;
15
15
  } & import('react').RefAttributes<SVGSVGElement>>;
@@ -1,50 +1,51 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { forwardRef as n } from "react";
3
- import { Icon as g } from "../Icon/index.js";
4
- import s from "clsx";
5
- const l = n(({ children: o, ...e }) => /* @__PURE__ */ r("button", { type: "button", ...e, children: o })), x = n(({ children: o, ...e }) => /* @__PURE__ */ r("div", { className: "inline-block", children: /* @__PURE__ */ r("a", { type: "button", className: "inline-grid", ...e, children: o }) })), c = n(
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as s } from "react";
3
+ import { Icon as p } from "../Icon/index.js";
4
+ import c from "clsx";
5
+ const u = s(
6
6
  ({
7
7
  className: o,
8
8
  children: e,
9
9
  loading: t = !1,
10
- variant: b = "primary",
11
- type: i = "button",
12
- href: m,
13
- target: p,
14
- size: a = "md"
15
- }) => /* @__PURE__ */ r(
16
- i === "button" ? l : x,
10
+ variant: r = "primary",
11
+ type: g = "button",
12
+ disabled: b,
13
+ size: n = "md",
14
+ ...i
15
+ }) => /* @__PURE__ */ a(
16
+ "button",
17
17
  {
18
- href: m,
19
- target: p,
20
- disabled: t,
21
- className: s(
18
+ "aria-disabled": b,
19
+ disabled: t || b,
20
+ type: g,
21
+ className: c(
22
22
  "flex items-center gap-3 rounded border text-center",
23
23
  {
24
24
  "duration-200": !t,
25
- "border-button-primary-border bg-button-primary-bg text-button-primary-text hover:bg-button-primary-hover active:bg-button-primary-active": b === "primary" && !t,
26
- "border-button-secondary-border bg-button-secondary-bg text-button-secondary-text hover:bg-button-secondary-hover active:bg-button-secondary-active": b === "secondary" && !t,
27
- "border-button-ghost-border bg-button-ghost-bg text-button-ghost-text hover:bg-button-ghost-hover active:bg-button-ghost-active": b === "ghost" && !t,
28
- "border-button-bordered-border text-button-ghost-text hover:bg-button-ghost-hover active:bg-button-ghost-active": b === "bordered" && !t,
29
- "border-button-basic-border bg-button-basic-bg text-button-basic-text hover:bg-button-basic-hover active:bg-button-basic-active": b === "basic" && !t,
25
+ "border-button-primary-border bg-button-primary-bg text-button-primary-text hover:bg-button-primary-hover active:bg-button-primary-active": r === "primary" && !t && !b,
26
+ "border-button-secondary-border bg-button-secondary-bg text-button-secondary-text hover:bg-button-secondary-hover active:bg-button-secondary-active": r === "secondary" && !t,
27
+ "border-button-ghost-border bg-button-ghost-bg text-button-ghost-text hover:bg-button-ghost-hover active:bg-button-ghost-active": r === "ghost" && !t,
28
+ "border-button-bordered-border text-button-ghost-text hover:bg-button-ghost-hover active:bg-button-ghost-active": r === "bordered" && !t,
29
+ "border-button-basic-border bg-button-basic-bg text-button-basic-text hover:bg-button-basic-hover active:bg-button-basic-active": r === "basic" && !t,
30
30
  "w-40 animate-pulse border-loading bg-loading": t,
31
- "px-12 py-3 text-base font-normal leading-4": a === "sm",
32
- "px-12 py-3 text-lg font-normal leading-8": a === "md",
33
- "px-12 py-4 text-xl font-normal leading-8": a === "lg"
31
+ "px-12 py-3 text-base font-normal leading-4": n === "sm",
32
+ "px-12 py-3 text-lg font-normal leading-8": n === "md",
33
+ "px-12 py-4 text-xl font-normal leading-8": n === "lg"
34
34
  },
35
35
  o
36
36
  ),
37
+ ...i,
37
38
  children: !t && e
38
39
  }
39
40
  )
40
- ), u = n(({ className: o, ...e }, t) => /* @__PURE__ */ r("p", { className: s("text-md", o), ref: t, ...e })), d = n(({ icon: o }, e) => /* @__PURE__ */ r(g, { size: "md", ref: e, icon: o }));
41
- c.displayName = "Button";
42
- d.displayName = "Button.Icon";
43
- u.displayName = "Button.Label";
44
- const N = Object.assign(c, {
45
- Icon: d,
46
- Label: u
41
+ ), d = s(({ className: o, ...e }, t) => /* @__PURE__ */ a("p", { className: c("text-md", o), ref: t, ...e })), m = s(({ icon: o }, e) => /* @__PURE__ */ a(p, { size: "md", ref: e, icon: o }));
42
+ u.displayName = "Button";
43
+ m.displayName = "Button.Icon";
44
+ d.displayName = "Button.Label";
45
+ const v = Object.assign(u, {
46
+ Icon: m,
47
+ Label: d
47
48
  });
48
49
  export {
49
- N as Button
50
+ v as Button
50
51
  };
@@ -0,0 +1,30 @@
1
+ import { Link } from '.';
2
+ import { StoryObj } from '@storybook/react';
3
+
4
+ declare const meta: {
5
+ title: string;
6
+ component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLAnchorElement> & import('.').LinkProps & import('react').RefAttributes<HTMLAnchorElement>> & {
7
+ Icon: import('react').ForwardRefExoticComponent<{
8
+ icon: any;
9
+ } & import('react').RefAttributes<SVGSVGElement>>;
10
+ Label: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
11
+ };
12
+ args: {
13
+ variant: "primary";
14
+ href: string;
15
+ target: string;
16
+ children: import("react/jsx-runtime").JSX.Element[];
17
+ onClick: import('@storybook/addon-actions').HandlerFunction;
18
+ };
19
+ };
20
+ export default meta;
21
+ type Story = StoryObj<typeof Link>;
22
+ export declare const Default: Story;
23
+ export declare const Secondary: Story;
24
+ export declare const Bordered: Story;
25
+ export declare const Ghost: Story;
26
+ export declare const Basic: Story;
27
+ export declare const Loading: Story;
28
+ export declare const Small: Story;
29
+ export declare const Medium: Story;
30
+ export declare const Large: Story;
@@ -0,0 +1,16 @@
1
+ import { HTMLAttributes } from 'react';
2
+
3
+ export interface LinkProps {
4
+ variant?: 'primary' | 'secondary' | 'ghost' | 'bordered' | 'basic';
5
+ loading?: boolean;
6
+ href?: string;
7
+ target?: string;
8
+ size?: 'sm' | 'md' | 'lg';
9
+ }
10
+ declare const Link: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLAnchorElement> & LinkProps & import('react').RefAttributes<HTMLAnchorElement>> & {
11
+ Icon: import('react').ForwardRefExoticComponent<{
12
+ icon: any;
13
+ } & import('react').RefAttributes<SVGSVGElement>>;
14
+ Label: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
15
+ };
16
+ export { Link };
@@ -4,13 +4,18 @@ import { StoryObj } from '@storybook/react';
4
4
  declare const meta: {
5
5
  title: string;
6
6
  component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('.').TubestopsContextProps & import('react').RefAttributes<HTMLDivElement>> & {
7
+ Header: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
7
8
  Stop: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
8
9
  stopId: number;
9
10
  } & import('react').RefAttributes<HTMLDivElement>>;
10
11
  Text: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
12
+ Controls: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
13
+ Body: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
14
+ Content: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
15
+ stopId: number;
16
+ } & import('react').RefAttributes<HTMLDivElement>>;
11
17
  };
12
18
  args: {
13
- activeStop: number;
14
19
  children: import("react/jsx-runtime").JSX.Element[];
15
20
  };
16
21
  };
@@ -1,15 +1,22 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
 
3
3
  export interface TubestopsContextProps {
4
- stops?: number;
4
+ totalStops?: number;
5
+ setTotalStops?: (stop: number) => void;
5
6
  activeStop?: number;
6
7
  currentStop?: number;
7
8
  setCurrentStop?: (stop: number) => void;
8
9
  }
9
10
  declare const Tubestops: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & TubestopsContextProps & import('react').RefAttributes<HTMLDivElement>> & {
11
+ Header: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
10
12
  Stop: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
11
13
  stopId: number;
12
14
  } & import('react').RefAttributes<HTMLDivElement>>;
13
15
  Text: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
16
+ Controls: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
17
+ Body: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
18
+ Content: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
19
+ stopId: number;
20
+ } & import('react').RefAttributes<HTMLDivElement>>;
14
21
  };
15
22
  export { Tubestops };
@@ -1,63 +1,105 @@
1
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
2
- import { createContext as b, forwardRef as m, useState as x, Children as C, useMemo as f, useContext as c } from "react";
3
- import l from "clsx";
4
- const i = b(null), v = b(
1
+ import { jsx as l, jsxs as x } from "react/jsx-runtime";
2
+ import { createContext as T, forwardRef as r, useState as d, useMemo as f, useContext as c, Children as z } from "react";
3
+ import a from "clsx";
4
+ import { Button as b } from "../Button/index.js";
5
+ const p = T(null), N = T(
5
6
  null
6
- ), T = m(({ className: n, children: t, activeStop: r = 0 }, s) => {
7
- const [e, o] = x(r), a = C.count(t), p = f(
7
+ ), v = r(({ className: n, children: t, activeStop: s = 1 }, e) => {
8
+ const [o, u] = d(s), [i, m] = d(0), j = f(
8
9
  () => ({
9
- stops: a ?? 0,
10
- currentStop: e,
11
- setCurrentStop: o
10
+ totalStops: i ?? 0,
11
+ setTotalStops: m,
12
+ currentStop: o,
13
+ setCurrentStop: u
12
14
  }),
13
- [e, o]
15
+ [o, u, i, m]
14
16
  );
15
- return /* @__PURE__ */ u(i.Provider, { value: p, children: /* @__PURE__ */ u("div", { ref: s, className: l("flex py-4", n), children: t }) });
16
- }), N = m(({ className: n, stopId: t = 0, children: r }, s) => {
17
- const { currentStop: e = 0, stops: o = 0 } = c(i) || {}, [a] = x(t), p = f(
17
+ return /* @__PURE__ */ l(p.Provider, { value: j, children: /* @__PURE__ */ l("div", { ref: e, className: n, children: t }) });
18
+ }), S = r(({ className: n, children: t }, s) => {
19
+ const { setTotalStops: e } = c(p) || {}, o = z.count(t);
20
+ return e == null || e(o), /* @__PURE__ */ l("div", { ref: s, className: a("flex py-4", n), children: t });
21
+ }), h = r(({ className: n, children: t }, s) => /* @__PURE__ */ l("div", { ref: s, className: a("", n), children: t })), y = r(({ className: n, stopId: t, children: s }, e) => {
22
+ const { currentStop: o = 0 } = c(p) || {};
23
+ return /* @__PURE__ */ l(
24
+ "div",
25
+ {
26
+ ref: e,
27
+ className: a("", n, {
28
+ block: o === t,
29
+ hidden: o !== t
30
+ }),
31
+ children: s
32
+ }
33
+ );
34
+ }), C = r(({ className: n }, t) => {
35
+ const {
36
+ setCurrentStop: s,
37
+ currentStop: e = 0,
38
+ totalStops: o = 0
39
+ } = c(p) || {};
40
+ return /* @__PURE__ */ x("div", { ref: t, className: a("flex justify-between", n), children: [
41
+ /* @__PURE__ */ l(
42
+ b,
43
+ {
44
+ disabled: e === 1,
45
+ onClick: () => e > 1 && (s == null ? void 0 : s(e - 1)),
46
+ children: /* @__PURE__ */ l(b.Label, { children: "Previous" })
47
+ }
48
+ ),
49
+ /* @__PURE__ */ l(
50
+ b,
51
+ {
52
+ disabled: e === o,
53
+ onClick: () => e < o && (s == null ? void 0 : s(e + 1)),
54
+ children: /* @__PURE__ */ l(b.Label, { children: "Next" })
55
+ }
56
+ )
57
+ ] });
58
+ }), w = r(({ className: n, stopId: t = 0, children: s }, e) => {
59
+ const { currentStop: o = 0, totalStops: u = 0 } = c(p) || {}, [i] = d(t), m = f(
18
60
  () => ({
19
- stopNumber: a
61
+ stopNumber: i
20
62
  }),
21
- [a]
63
+ [i]
22
64
  );
23
- return /* @__PURE__ */ u(v.Provider, { value: p, children: /* @__PURE__ */ d("div", { ref: s, className: l(n, "w-full min-w-[120px]"), children: [
24
- /* @__PURE__ */ u(
65
+ return /* @__PURE__ */ l(N.Provider, { value: m, children: /* @__PURE__ */ x("div", { ref: e, className: a(n, "w-full min-w-[120px]"), children: [
66
+ /* @__PURE__ */ l(
25
67
  "div",
26
68
  {
27
- className: l({
28
- "mt-4 h-1 w-full translate-x-1/2 bg-tubestop-line-future": t >= e && t < o,
29
- "mt-4 h-1 w-full translate-x-1/2 bg-tubestop-line-complete": t < e && t < o
69
+ className: a({
70
+ "mt-4 h-1 w-full translate-x-1/2 bg-tubestop-line-future": t >= o && t < u,
71
+ "mt-4 h-1 w-full translate-x-1/2 bg-tubestop-line-complete": t < o && t < u
30
72
  })
31
73
  }
32
74
  ),
33
- /* @__PURE__ */ u(
75
+ /* @__PURE__ */ l(
34
76
  "p",
35
77
  {
36
- className: l(
78
+ className: a(
37
79
  {
38
- "relative z-20 -mt-4 bg-tubestop-station-complete": t < e,
39
- "relative z-20 -mt-4 bg-tubestop-station-active": e === t,
40
- "relative z-20 -mt-4 bg-tubestop-station-future": t > e,
41
- "mt-1": t === o
80
+ "relative z-20 -mt-4 bg-tubestop-station-complete": t < o,
81
+ "relative z-20 -mt-4 bg-tubestop-station-active": o === t,
82
+ "relative z-20 -mt-4 bg-tubestop-station-future": t > o,
83
+ "mt-1": t === u
42
84
  },
43
85
  "z-10 mx-auto h-6 w-6 rounded-full"
44
86
  )
45
87
  }
46
88
  ),
47
- r
89
+ s
48
90
  ] }) });
49
- }), S = m(({ className: n, children: t }, r) => {
50
- const { currentStop: s = 0 } = c(i) || {}, { stopNumber: e = 0 } = c(v) || {};
51
- return /* @__PURE__ */ u(
91
+ }), g = r(({ className: n, children: t }, s) => {
92
+ const { currentStop: e = 0 } = c(p) || {}, { stopNumber: o = 0 } = c(N) || {};
93
+ return /* @__PURE__ */ l(
52
94
  "p",
53
95
  {
54
- ref: r,
55
- className: l(
96
+ ref: s,
97
+ className: a(
56
98
  "mt-2 text-center",
57
99
  {
58
- "font-medium text-tubestop-text-complete": e < s,
59
- "font-bold text-tubestop-text-active": s === e,
60
- "font-medium text-tubestop-text-future": e > s
100
+ "font-medium text-tubestop-text-complete": o < e,
101
+ "font-bold text-tubestop-text-active": e === o,
102
+ "font-medium text-tubestop-text-future": o > e
61
103
  },
62
104
  n
63
105
  ),
@@ -65,13 +107,21 @@ const i = b(null), v = b(
65
107
  }
66
108
  );
67
109
  });
68
- T.displayName = "Tubestop";
69
- N.displayName = "Tubestops.Stop";
70
- S.displayName = "Tubestops.Text";
71
- const y = Object.assign(T, {
72
- Stop: N,
73
- Text: S
110
+ v.displayName = "Tubestop";
111
+ S.displayName = "Tubestops.Header";
112
+ w.displayName = "Tubestops.Stop";
113
+ g.displayName = "Tubestops.Text";
114
+ C.displayName = "Tubestops.Controls";
115
+ h.displayName = "Tubestops.Body";
116
+ y.displayName = "Tubestops.Content";
117
+ const L = Object.assign(v, {
118
+ Header: S,
119
+ Stop: w,
120
+ Text: g,
121
+ Controls: C,
122
+ Body: h,
123
+ Content: y
74
124
  });
75
125
  export {
76
- y as Tubestops
126
+ L as Tubestops
77
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trepur_components",
3
- "version": "2.3.29",
3
+ "version": "2.3.30",
4
4
  "description": "component lib",
5
5
  "author": "trepur_ttenneb",
6
6
  "private": false,