@pismo/marola 1.1.22 → 1.2.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.
@@ -0,0 +1,28 @@
1
+ import * as _ from "react";
2
+ import './assets/Tabs.css';const a = /* @__PURE__ */ _.createContext(null);
3
+ process.env.NODE_ENV !== "production" && (a.displayName = "TabsContext");
4
+ function e() {
5
+ const t = _.useContext(a);
6
+ if (t == null)
7
+ throw new Error("No TabsContext provided");
8
+ return t;
9
+ }
10
+ const s = "_tabs_1ve9u_1", b = "_tabs__tab_1ve9u_5", i = {
11
+ tabs: s,
12
+ tabs__tab: b,
13
+ "tabs__tab--disabled": "_tabs__tab--disabled_1ve9u_23",
14
+ "tabs__tab--selected": "_tabs__tab--selected_1ve9u_32",
15
+ "tabs__tab--chip": "_tabs__tab--chip_1ve9u_36",
16
+ "tabs__tab--chip--disabled": "_tabs__tab--chip--disabled_1ve9u_64",
17
+ "tabs__tab-panel": "_tabs__tab-panel_1ve9u_74",
18
+ "tabs__tab-icon": "_tabs__tab-icon_1ve9u_78",
19
+ "tabs__tab-indicative": "_tabs__tab-indicative_1ve9u_83",
20
+ "tabs__tab-indicative--empty": "_tabs__tab-indicative--empty_1ve9u_86",
21
+ "tabs__tab-indicative--success": "_tabs__tab-indicative--success_1ve9u_101",
22
+ "tabs__tab-content": "_tabs__tab-content_1ve9u_115"
23
+ };
24
+ export {
25
+ a as T,
26
+ i as s,
27
+ e as u
28
+ };
@@ -1 +1 @@
1
- ._tabs_1ldid_1{gap:8px;width:100%}._tabs__tab_1ldid_5{min-width:94px;height:48px;padding:0 4px;color:var(--gray-75);cursor:pointer;background-color:transparent;border:none;border-bottom:2px solid transparent}._tabs__tab_1ldid_5:hover{color:var(--hover);border-bottom:2px solid var(--hover)}._tabs__tab_1ldid_5:active{color:var(--active);border-bottom:2px solid var(--active)}._tabs__tab--disabled_1ldid_23{color:#00000040;cursor:default;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--disabled_1ldid_23:focus,._tabs__tab--disabled_1ldid_23:active,._tabs__tab--disabled_1ldid_23:hover{color:#00000040;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--selected_1ldid_32{color:var(--accent);border-bottom:2px solid var(--accent)}._tabs__tab--selected_1ldid_32._tabs__tab--chip_1ldid_36{color:var(--accent);border-color:var(--accent)}._tabs__tab--chip_1ldid_36{display:flex;align-items:center;justify-content:center;min-width:auto;height:32px;padding:0 15px;font-size:.875rem;font-weight:var(--base-bold);line-height:22px;color:var(--gray-95);background-color:transparent;border:1px solid var(--border);border-radius:var(--border-radius)}._tabs__tab--chip_1ldid_36:hover{color:var(--hover);border-color:var(--hover);border-bottom:1px solid var(--hover)}._tabs__tab--chip_1ldid_36:active{color:var(--active);border-color:var(--active)}._tabs__tab--chip--disabled_1ldid_64{color:#00000040;cursor:default;border:1px solid rgba(0,0,0,.25)}._tabs__tab--chip--disabled_1ldid_64:focus,._tabs__tab--chip--disabled_1ldid_64:active,._tabs__tab--chip--disabled_1ldid_64:hover{color:#00000040;background-color:transparent;border:1px solid rgba(0,0,0,.25)}._tabs__tab-panel_1ldid_74{width:100%;margin-top:16px}._tabs__tab-icon_1ldid_78{width:16px;height:16px;margin-right:4px}._tabs__tab-content_1ldid_83{display:flex;align-items:center;justify-content:center;width:100%}
1
+ ._tabs_1ve9u_1{gap:8px;width:100%}._tabs__tab_1ve9u_5{min-width:94px;height:48px;padding:0 4px;color:var(--gray-75);cursor:pointer;background-color:transparent;border:none;border-bottom:2px solid transparent}._tabs__tab_1ve9u_5:hover{color:var(--hover);border-bottom:2px solid var(--hover)}._tabs__tab_1ve9u_5:active{color:var(--active);border-bottom:2px solid var(--active)}._tabs__tab--disabled_1ve9u_23{color:#00000040;cursor:default;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--disabled_1ve9u_23:focus,._tabs__tab--disabled_1ve9u_23:active,._tabs__tab--disabled_1ve9u_23:hover{color:#00000040;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--selected_1ve9u_32{color:var(--accent);border-bottom:2px solid var(--accent)}._tabs__tab--selected_1ve9u_32._tabs__tab--chip_1ve9u_36{color:var(--accent);border-color:var(--accent)}._tabs__tab--chip_1ve9u_36{display:flex;align-items:center;justify-content:center;min-width:auto;height:32px;padding:0 15px;font-size:.875rem;font-weight:var(--base-bold);line-height:22px;color:var(--gray-95);background-color:transparent;border:1px solid var(--border);border-radius:var(--border-radius)}._tabs__tab--chip_1ve9u_36:hover{color:var(--hover);border-color:var(--hover);border-bottom:1px solid var(--hover)}._tabs__tab--chip_1ve9u_36:active{color:var(--active);border-color:var(--active)}._tabs__tab--chip--disabled_1ve9u_64{color:#00000040;cursor:default;border:1px solid rgba(0,0,0,.25)}._tabs__tab--chip--disabled_1ve9u_64:focus,._tabs__tab--chip--disabled_1ve9u_64:active,._tabs__tab--chip--disabled_1ve9u_64:hover{color:#00000040;background-color:transparent;border:1px solid rgba(0,0,0,.25)}._tabs__tab-panel_1ve9u_74{width:100%;margin-top:16px}._tabs__tab-icon_1ve9u_78{width:16px;height:16px;margin-right:4px}._tabs__tab-indicative_1ve9u_83{margin-right:.5rem}._tabs__tab-indicative--empty_1ve9u_86{width:.5rem;height:.5rem;display:inline-flex;position:relative;margin-right:.6rem}._tabs__tab-indicative--empty_1ve9u_86>*{transform:scale(1.2);position:absolute;left:0;top:0;width:100%;height:100%}._tabs__tab-indicative--success_1ve9u_101{display:inline-flex;align-items:center;width:.5rem;height:.5rem}._tabs__tab-indicative--success_1ve9u_101:before{content:" ";display:inline-flex;background-color:var(--green-6);border-radius:100%;width:.5rem;height:.5rem}._tabs__tab-content_1ve9u_115{display:flex;align-items:center;justify-content:center;width:100%}
@@ -1,6 +1,7 @@
1
1
  import { IconName } from '../Icon/types.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ export type IndicativeType = 'empty' | 'success';
4
5
  export interface TabProps {
5
6
  /** The value to be showing in the tab */
6
7
  children: ReactNode;
@@ -15,6 +16,8 @@ export interface TabProps {
15
16
  'data-testid'?: string;
16
17
  /** Icon to be displayed in the tab */
17
18
  icon?: IconName | ReactNode;
19
+ /** Ref to be passed to the container element */
20
+ indicative?: IndicativeType;
18
21
  /** Is the tab a chip */
19
22
  chip?: boolean;
20
23
  /** Show a loading skeleton */
@@ -1,126 +1,126 @@
1
- import { jsx as m, jsxs as j } from "react/jsx-runtime";
2
- import * as R from "react";
3
- import { forwardRef as k, useContext as H, useMemo as U } from "react";
4
- import { c as B } from "../../clsx-DB4S2d7J.js";
5
- import { Icon as D } from "../Icon/Icon.js";
6
- import { Skeleton as L } from "../Skeleton/Skeleton.js";
7
- import { u as W, T as $, s as c } from "../../Tabs.module-ia-imLti.js";
8
- import { g as q, a as z, u as I, f as A, b as h, _ as G, c as J, P as e, d as K, e as Q } from "../../useSlotProps-C_I1kEHr.js";
1
+ import { jsx as u, jsxs as H } from "react/jsx-runtime";
2
+ import * as P from "react";
3
+ import { forwardRef as U, useContext as z, useMemo as B } from "react";
4
+ import { c as x } from "../../clsx-DB4S2d7J.js";
5
+ import { Icon as O } from "../Icon/Icon.js";
6
+ import { Skeleton as D } from "../Skeleton/Skeleton.js";
7
+ import { u as L, T as W, s as o } from "../../Tabs.module-CF9eCJzU.js";
8
+ import { g as $, a as q, u as E, f as A, b as h, _ as G, c as J, P as e, d as K, e as Q } from "../../useSlotProps-C_I1kEHr.js";
9
9
  import { u as X, c as Y } from "../../combineHooksSlotProps-C-zYvfnF.js";
10
10
  import { u as Z } from "../../useId-BW-oWmul.js";
11
11
  import { u as ee } from "../../useButton-DcihopJG.js";
12
12
  import { u as te } from "../../useCompoundItem-B7Eo_qZk.js";
13
- const O = "Tab";
14
- function se(o) {
15
- return q(O, o);
13
+ const F = "Tab";
14
+ function se(a) {
15
+ return $(F, a);
16
16
  }
17
- z(O, ["root", "selected", "disabled"]);
18
- function oe(o) {
19
- return o.size;
17
+ q(F, ["root", "selected", "disabled"]);
18
+ function oe(a) {
19
+ return a.size;
20
20
  }
21
- function ae(o) {
21
+ function ae(a) {
22
22
  const {
23
23
  value: t,
24
24
  rootRef: s,
25
- disabled: r = !1,
26
- id: d
27
- } = o, a = R.useRef(null), n = Z(d), {
28
- value: u,
29
- selectionFollowsFocus: b,
30
- getTabPanelId: l
31
- } = W(), f = R.useMemo(() => ({
32
- disabled: r,
33
- ref: a,
34
- id: n
35
- }), [r, a, n]), {
36
- id: i,
25
+ disabled: l = !1,
26
+ id: b
27
+ } = a, n = P.useRef(null), r = Z(b), {
28
+ value: p,
29
+ selectionFollowsFocus: c,
30
+ getTabPanelId: f
31
+ } = L(), i = P.useMemo(() => ({
32
+ disabled: l,
33
+ ref: n,
34
+ id: r
35
+ }), [l, n, r]), {
36
+ id: d,
37
37
  index: g,
38
- totalItemCount: T
39
- } = te(t ?? oe, f), {
40
- getRootProps: _,
41
- highlighted: C,
42
- selected: p
38
+ totalItemCount: R
39
+ } = te(t ?? oe, i), {
40
+ getRootProps: T,
41
+ highlighted: y,
42
+ selected: m
43
43
  } = X({
44
- item: i
44
+ item: d
45
45
  }), {
46
- getRootProps: v,
47
- rootRef: P,
48
- active: y,
49
- focusVisible: F,
50
- setFocusVisible: S
46
+ getRootProps: C,
47
+ rootRef: _,
48
+ active: v,
49
+ focusVisible: V,
50
+ setFocusVisible: w
51
51
  } = ee({
52
- disabled: r,
53
- focusableWhenDisabled: !b,
52
+ disabled: l,
53
+ focusableWhenDisabled: !c,
54
54
  type: "button"
55
- }), x = I(a, s, P), V = i !== void 0 ? l(i) : void 0;
55
+ }), N = E(n, s, _), M = d !== void 0 ? f(d) : void 0;
56
56
  return {
57
- getRootProps: (N = {}) => {
58
- const w = A(N), M = Y(_, v);
59
- return h({}, N, M(w), {
57
+ getRootProps: (I = {}) => {
58
+ const j = A(I), k = Y(T, C);
59
+ return h({}, I, k(j), {
60
60
  role: "tab",
61
- "aria-controls": V,
62
- "aria-selected": p,
63
- id: n,
64
- ref: x
61
+ "aria-controls": M,
62
+ "aria-selected": m,
63
+ id: r,
64
+ ref: N
65
65
  });
66
66
  },
67
- active: y,
68
- focusVisible: F,
69
- highlighted: C,
67
+ active: v,
68
+ focusVisible: V,
69
+ highlighted: y,
70
70
  index: g,
71
- rootRef: x,
71
+ rootRef: N,
72
72
  // the `selected` state isn't set on the server (it relies on effects to be calculated),
73
73
  // so we fall back to checking the `value` prop with the selectedValue from the TabsContext
74
- selected: p || i === u,
75
- setFocusVisible: S,
76
- totalTabsCount: T
74
+ selected: m || d === p,
75
+ setFocusVisible: w,
76
+ totalTabsCount: R
77
77
  };
78
78
  }
79
- const ne = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], re = (o) => {
79
+ const ne = ["action", "children", "disabled", "onChange", "onClick", "onFocus", "slotProps", "slots", "value"], re = (a) => {
80
80
  const {
81
81
  selected: t,
82
82
  disabled: s
83
- } = o;
83
+ } = a;
84
84
  return K({
85
85
  root: ["root", t && "selected", s && "disabled"]
86
86
  }, Q(se));
87
- }, E = /* @__PURE__ */ R.forwardRef(function(t, s) {
88
- var r;
87
+ }, S = /* @__PURE__ */ P.forwardRef(function(t, s) {
88
+ var l;
89
89
  const {
90
- children: d,
91
- disabled: a = !1,
92
- slotProps: n = {},
93
- slots: u = {},
94
- value: b
95
- } = t, l = G(t, ne), f = R.useRef(), i = I(f, s), {
90
+ children: b,
91
+ disabled: n = !1,
92
+ slotProps: r = {},
93
+ slots: p = {},
94
+ value: c
95
+ } = t, f = G(t, ne), i = P.useRef(), d = E(i, s), {
96
96
  active: g,
97
- highlighted: T,
98
- selected: _,
99
- getRootProps: C
97
+ highlighted: R,
98
+ selected: T,
99
+ getRootProps: y
100
100
  } = ae(h({}, t, {
101
- rootRef: i,
102
- value: b
103
- })), p = h({}, t, {
101
+ rootRef: d,
102
+ value: c
103
+ })), m = h({}, t, {
104
104
  active: g,
105
- disabled: a,
106
- highlighted: T,
107
- selected: _
108
- }), v = re(p), P = (r = u.root) != null ? r : "button", y = J({
109
- elementType: P,
110
- getSlotProps: C,
111
- externalSlotProps: n.root,
112
- externalForwardedProps: l,
105
+ disabled: n,
106
+ highlighted: R,
107
+ selected: T
108
+ }), C = re(m), _ = (l = p.root) != null ? l : "button", v = J({
109
+ elementType: _,
110
+ getSlotProps: y,
111
+ externalSlotProps: r.root,
112
+ externalForwardedProps: f,
113
113
  additionalProps: {
114
114
  ref: s
115
115
  },
116
- ownerState: p,
117
- className: v.root
116
+ ownerState: m,
117
+ className: C.root
118
118
  });
119
- return /* @__PURE__ */ m(P, h({}, y, {
120
- children: d
119
+ return /* @__PURE__ */ u(_, h({}, v, {
120
+ children: b
121
121
  }));
122
122
  });
123
- process.env.NODE_ENV !== "production" && (E.propTypes = {
123
+ process.env.NODE_ENV !== "production" && (S.propTypes = {
124
124
  // ┌────────────────────────────── Warning ──────────────────────────────┐
125
125
  // │ These PropTypes are generated from the TypeScript type definitions. │
126
126
  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
@@ -166,22 +166,24 @@ process.env.NODE_ENV !== "production" && (E.propTypes = {
166
166
  */
167
167
  value: e.oneOfType([e.number, e.string])
168
168
  });
169
- const ge = k(
170
- ({ children: o, value: t, disabled: s, className: r, "data-testid": d, icon: a, chip: n, isLoading: u }, b) => {
171
- const l = H($), f = U(
172
- () => B(
173
- c.tabs__tab,
174
- t === (l == null ? void 0 : l.value) && c["tabs__tab--selected"],
175
- s && !n && c["tabs__tab--disabled"],
176
- n && c["tabs__tab--chip"],
177
- n && s && c["tabs__tab--chip--disabled"],
178
- r
169
+ const ge = U(
170
+ ({ children: a, value: t, disabled: s, className: l, "data-testid": b, icon: n, chip: r, isLoading: p, indicative: c }, f) => {
171
+ const i = z(W), d = B(
172
+ () => x(
173
+ o.tabs__tab,
174
+ t === (i == null ? void 0 : i.value) && o["tabs__tab--selected"],
175
+ s && !r && o["tabs__tab--disabled"],
176
+ r && o["tabs__tab--chip"],
177
+ r && s && o["tabs__tab--chip--disabled"],
178
+ l
179
179
  ),
180
- [t, l, s, n]
180
+ [t, i, s, r]
181
181
  );
182
- return /* @__PURE__ */ m(E, { className: f, disabled: s, value: t, "data-testid": d, ref: b, children: u ? /* @__PURE__ */ m(L, { style: { width: "50px", margin: "auto" } }) : /* @__PURE__ */ j("div", { className: c["tabs__tab-content"], children: [
183
- a && /* @__PURE__ */ m("span", { className: c["tabs__tab-icon"], children: typeof a == "string" ? /* @__PURE__ */ m(D, { icon: a }) : a }),
184
- o
182
+ return /* @__PURE__ */ u(S, { className: d, disabled: s, value: t, "data-testid": b, ref: f, children: p ? /* @__PURE__ */ u(D, { style: { width: "50px", margin: "auto" } }) : /* @__PURE__ */ H("div", { className: o["tabs__tab-content"], children: [
183
+ c && c === "empty" && /* @__PURE__ */ u("span", { className: x(o["tabs__tab-indicative"], o["tabs__tab-indicative--empty"]), children: /* @__PURE__ */ u(O, { icon: "empty-set", size: 10, color: "var(--orange-6)" }) }),
184
+ c && c === "success" && /* @__PURE__ */ u("span", { className: x(o["tabs__tab-indicative"], o["tabs__tab-indicative--success"]) }),
185
+ n && /* @__PURE__ */ u("span", { className: o["tabs__tab-icon"], children: typeof n == "string" ? /* @__PURE__ */ u(O, { icon: n }) : n }),
186
+ a
185
187
  ] }) });
186
188
  }
187
189
  );
@@ -18,3 +18,5 @@ export declare const IconChip: Story;
18
18
  export declare const Loading: Story;
19
19
  export declare const Disabled: Story;
20
20
  export declare const DisabledChip: Story;
21
+ export declare const IndicativeSuccess: Story;
22
+ export declare const IndicativeEmpty: Story;
@@ -2,7 +2,7 @@ import { jsx as T } from "react/jsx-runtime";
2
2
  import * as P from "react";
3
3
  import { forwardRef as v } from "react";
4
4
  import { c as y } from "../../clsx-DB4S2d7J.js";
5
- import { u as x, s as C } from "../../Tabs.module-ia-imLti.js";
5
+ import { u as x, s as C } from "../../Tabs.module-CF9eCJzU.js";
6
6
  import { g as N, a as _, u as w, b, _ as O, c as E, P as o, d as I, e as S } from "../../useSlotProps-C_I1kEHr.js";
7
7
  import { u as U } from "../../useId-BW-oWmul.js";
8
8
  import { u as j } from "../../useCompoundItem-B7Eo_qZk.js";
@@ -2,7 +2,7 @@ import { jsx as T } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
3
  import { forwardRef as q } from "react";
4
4
  import { c as B } from "../../clsx-DB4S2d7J.js";
5
- import { T as G, u as J, s as Q } from "../../Tabs.module-ia-imLti.js";
5
+ import { T as G, u as J, s as Q } from "../../Tabs.module-CF9eCJzU.js";
6
6
  import { Tab as Ie } from "./Tab.js";
7
7
  import { TabPanel as Fe } from "./TabPanel.js";
8
8
  import { g as I, a as _, b as C, _ as F, c as $, P as t, d as N, e as w } from "../../useSlotProps-C_I1kEHr.js";
@@ -12,3 +12,4 @@ declare const meta: {
12
12
  export default meta;
13
13
  type Story = StoryObj<typeof meta>;
14
14
  export declare const Simple: Story;
15
+ export declare const Indicatives: Story;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pismo/marola",
3
3
  "description": "CDX tribe component library",
4
- "version": "1.1.22",
4
+ "version": "1.2.0",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1,25 +0,0 @@
1
- import * as _ from "react";
2
- import './assets/Tabs.css';const a = /* @__PURE__ */ _.createContext(null);
3
- process.env.NODE_ENV !== "production" && (a.displayName = "TabsContext");
4
- function e() {
5
- const t = _.useContext(a);
6
- if (t == null)
7
- throw new Error("No TabsContext provided");
8
- return t;
9
- }
10
- const s = "_tabs_1ldid_1", b = "_tabs__tab_1ldid_5", d = {
11
- tabs: s,
12
- tabs__tab: b,
13
- "tabs__tab--disabled": "_tabs__tab--disabled_1ldid_23",
14
- "tabs__tab--selected": "_tabs__tab--selected_1ldid_32",
15
- "tabs__tab--chip": "_tabs__tab--chip_1ldid_36",
16
- "tabs__tab--chip--disabled": "_tabs__tab--chip--disabled_1ldid_64",
17
- "tabs__tab-panel": "_tabs__tab-panel_1ldid_74",
18
- "tabs__tab-icon": "_tabs__tab-icon_1ldid_78",
19
- "tabs__tab-content": "_tabs__tab-content_1ldid_83"
20
- };
21
- export {
22
- a as T,
23
- d as s,
24
- e as u
25
- };