@ledgerhq/lumen-ui-react 0.1.6 → 0.1.7

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.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { Banner as x } from "./lib/Components/Banner/Banner.js";
7
7
  import { BaseInput as S } from "./lib/Components/BaseInput/BaseInput.js";
8
8
  import { Button as d } from "./lib/Components/Button/Button.js";
9
9
  import { BaseButton as c } from "./lib/Components/Button/BaseButton.js";
10
- import { ContentBanner as I, ContentBannerContent as C, ContentBannerDescription as s, ContentBannerTitle as L } from "./lib/Components/ContentBanner/ContentBanner.js";
10
+ import { ContentBanner as C, ContentBannerContent as I, ContentBannerDescription as s, ContentBannerTitle as L } from "./lib/Components/ContentBanner/ContentBanner.js";
11
11
  import { CardButton as M } from "./lib/Components/CardButton/CardButton.js";
12
12
  import { Checkbox as v } from "./lib/Components/Checkbox/Checkbox.js";
13
13
  import { DataTable as A, DataTableGlobalSearchInput as w, DataTableRoot as H } from "./lib/Components/DataTable/DataTable.js";
@@ -20,26 +20,27 @@ import { IconButton as U } from "./lib/Components/IconButton/IconButton.js";
20
20
  import { InteractiveIcon as W } from "./lib/Components/InteractiveIcon/InteractiveIcon.js";
21
21
  import { Link as Y } from "./lib/Components/Link/Link.js";
22
22
  import { ListItem as $, ListItemContent as ee, ListItemDescription as oe, ListItemIcon as te, ListItemLeading as re, ListItemSpot as ae, ListItemTitle as ne, ListItemTrailing as ie, ListItemTruncate as le } from "./lib/Components/ListItem/ListItem.js";
23
- import { Menu as me, MenuCheckboxItem as Te, MenuContent as ue, MenuGroup as xe, MenuItem as fe, MenuLabel as Se, MenuPortal as be, MenuRadioGroup as de, MenuRadioItem as ge, MenuSeparator as ce, MenuSub as Be, MenuSubContent as Ie, MenuSubTrigger as Ce, MenuTrigger as se } from "./lib/Components/Menu/Menu.js";
23
+ import { Menu as me, MenuCheckboxItem as Te, MenuContent as ue, MenuGroup as xe, MenuItem as fe, MenuLabel as Se, MenuPortal as be, MenuRadioGroup as de, MenuRadioItem as ge, MenuSeparator as ce, MenuSub as Be, MenuSubContent as Ce, MenuSubTrigger as Ie, MenuTrigger as se } from "./lib/Components/Menu/Menu.js";
24
24
  import { NavBar as De, NavBarBackButton as Me, NavBarCoinCapsule as he, NavBarTitle as ve, NavBarTrailing as Re } from "./lib/Components/NavBar/NavBar.js";
25
25
  import { PageIndicator as we } from "./lib/Components/PageIndicator/PageIndicator.js";
26
26
  import { SearchInput as ke } from "./lib/Components/SearchInput/SearchInput.js";
27
- import { Select as Ne, SelectContent as ye, SelectGroup as Pe, SelectItem as Ee, SelectItemText as Oe, SelectLabel as Fe, SelectSeparator as _e, SelectTrigger as je } from "./lib/Components/Select/Select.js";
28
- import { SideBar as ze, SideBarCollapseToggle as Je, SideBarItem as Ke, SideBarLeading as Qe, SideBarTrailing as Ue } from "./lib/Components/SideBar/SideBar.js";
29
- import { Skeleton as We } from "./lib/Components/Skeleton/Skeleton.js";
30
- import { Spinner as Ye } from "./lib/Components/Spinner/Spinner.js";
31
- import { Spot as $e } from "./lib/Components/Spot/Spot.js";
32
- import { Stepper as oo } from "./lib/Components/Stepper/Stepper.js";
33
- import { Subheader as ro, SubheaderAction as ao, SubheaderCount as no, SubheaderDescription as io, SubheaderInfo as lo, SubheaderRow as po, SubheaderShowMore as mo, SubheaderTitle as To } from "./lib/Components/Subheader/Subheader.js";
34
- import { Switch as xo } from "./lib/Components/Switch/Switch.js";
35
- import { Table as So, TableActionBar as bo, TableActionBarLeading as go, TableActionBarTrailing as co, TableBody as Bo, TableCell as Io, TableCellContent as Co, TableGroupHeaderRow as so, TableHeader as Lo, TableHeaderCell as Do, TableHeaderRow as Mo, TableInfoIcon as ho, TableLoadingRow as vo, TableRoot as Ro, TableRow as Ao, TableSortButton as wo } from "./lib/Components/Table/Table.js";
36
- import { Tag as ko } from "./lib/Components/Tag/Tag.js";
37
- import { TextInput as No } from "./lib/Components/TextInput/TextInput.js";
38
- import { Tile as Po, TileContent as Eo, TileDescription as Oo, TileSecondaryAction as Fo, TileSpot as _o, TileTitle as jo, TileTrailingContent as qo } from "./lib/Components/Tile/Tile.js";
39
- import { TileButton as Jo } from "./lib/Components/TileButton/TileButton.js";
40
- import { Tooltip as Qo, TooltipContent as Uo, TooltipProvider as Vo, TooltipTrigger as Wo } from "./lib/Components/Tooltip/Tooltip.js";
41
- import { ThemeProvider as Yo } from "./lib/Components/ThemeProvider/ThemeProvider.js";
42
- import { COLOR_SCHEMES as $o } from "./lib/Components/ThemeProvider/ThemeProvider.types.js";
27
+ import { SegmentedControl as Ne, SegmentedControlButton as ye } from "./lib/Components/SegmentedControl/SegmentedControl.js";
28
+ import { Select as Ee, SelectContent as Oe, SelectGroup as Fe, SelectItem as _e, SelectItemText as je, SelectLabel as qe, SelectSeparator as ze, SelectTrigger as Je } from "./lib/Components/Select/Select.js";
29
+ import { SideBar as Qe, SideBarCollapseToggle as Ue, SideBarItem as Ve, SideBarLeading as We, SideBarTrailing as Xe } from "./lib/Components/SideBar/SideBar.js";
30
+ import { Skeleton as Ze } from "./lib/Components/Skeleton/Skeleton.js";
31
+ import { Spinner as eo } from "./lib/Components/Spinner/Spinner.js";
32
+ import { Spot as to } from "./lib/Components/Spot/Spot.js";
33
+ import { Stepper as ao } from "./lib/Components/Stepper/Stepper.js";
34
+ import { Subheader as io, SubheaderAction as lo, SubheaderCount as po, SubheaderDescription as mo, SubheaderInfo as To, SubheaderRow as uo, SubheaderShowMore as xo, SubheaderTitle as fo } from "./lib/Components/Subheader/Subheader.js";
35
+ import { Switch as bo } from "./lib/Components/Switch/Switch.js";
36
+ import { Table as co, TableActionBar as Bo, TableActionBarLeading as Co, TableActionBarTrailing as Io, TableBody as so, TableCell as Lo, TableCellContent as Do, TableGroupHeaderRow as Mo, TableHeader as ho, TableHeaderCell as vo, TableHeaderRow as Ro, TableInfoIcon as Ao, TableLoadingRow as wo, TableRoot as Ho, TableRow as ko, TableSortButton as Go } from "./lib/Components/Table/Table.js";
37
+ import { Tag as yo } from "./lib/Components/Tag/Tag.js";
38
+ import { TextInput as Eo } from "./lib/Components/TextInput/TextInput.js";
39
+ import { Tile as Fo, TileContent as _o, TileDescription as jo, TileSecondaryAction as qo, TileSpot as zo, TileTitle as Jo, TileTrailingContent as Ko } from "./lib/Components/Tile/Tile.js";
40
+ import { TileButton as Uo } from "./lib/Components/TileButton/TileButton.js";
41
+ import { Tooltip as Wo, TooltipContent as Xo, TooltipProvider as Yo, TooltipTrigger as Zo } from "./lib/Components/Tooltip/Tooltip.js";
42
+ import { ThemeProvider as et } from "./lib/Components/ThemeProvider/ThemeProvider.js";
43
+ import { COLOR_SCHEMES as tt } from "./lib/Components/ThemeProvider/ThemeProvider.types.js";
43
44
  export {
44
45
  a as AddressInput,
45
46
  p as AmountDisplay,
@@ -49,11 +50,11 @@ export {
49
50
  c as BaseButton,
50
51
  S as BaseInput,
51
52
  d as Button,
52
- $o as COLOR_SCHEMES,
53
+ tt as COLOR_SCHEMES,
53
54
  M as CardButton,
54
55
  v as Checkbox,
55
- I as ContentBanner,
56
- C as ContentBannerContent,
56
+ C as ContentBanner,
57
+ I as ContentBannerContent,
57
58
  s as ContentBannerDescription,
58
59
  L as ContentBannerTitle,
59
60
  A as DataTable,
@@ -91,8 +92,8 @@ export {
91
92
  ge as MenuRadioItem,
92
93
  ce as MenuSeparator,
93
94
  Be as MenuSub,
94
- Ie as MenuSubContent,
95
- Ce as MenuSubTrigger,
95
+ Ce as MenuSubContent,
96
+ Ie as MenuSubTrigger,
96
97
  se as MenuTrigger,
97
98
  De as NavBar,
98
99
  Me as NavBarBackButton,
@@ -101,62 +102,64 @@ export {
101
102
  Re as NavBarTrailing,
102
103
  we as PageIndicator,
103
104
  ke as SearchInput,
104
- Ne as Select,
105
- ye as SelectContent,
106
- Pe as SelectGroup,
107
- Ee as SelectItem,
108
- Oe as SelectItemText,
109
- Fe as SelectLabel,
110
- _e as SelectSeparator,
111
- je as SelectTrigger,
112
- ze as SideBar,
113
- Je as SideBarCollapseToggle,
114
- Ke as SideBarItem,
115
- Qe as SideBarLeading,
116
- Ue as SideBarTrailing,
117
- We as Skeleton,
118
- Ye as Spinner,
119
- $e as Spot,
120
- oo as Stepper,
121
- ro as Subheader,
122
- ao as SubheaderAction,
123
- no as SubheaderCount,
124
- io as SubheaderDescription,
125
- lo as SubheaderInfo,
126
- po as SubheaderRow,
127
- mo as SubheaderShowMore,
128
- To as SubheaderTitle,
129
- xo as Switch,
130
- So as Table,
131
- bo as TableActionBar,
132
- go as TableActionBarLeading,
133
- co as TableActionBarTrailing,
134
- Bo as TableBody,
135
- Io as TableCell,
136
- Co as TableCellContent,
137
- so as TableGroupHeaderRow,
138
- Lo as TableHeader,
139
- Do as TableHeaderCell,
140
- Mo as TableHeaderRow,
141
- ho as TableInfoIcon,
142
- vo as TableLoadingRow,
143
- Ro as TableRoot,
144
- Ao as TableRow,
145
- wo as TableSortButton,
146
- ko as Tag,
147
- No as TextInput,
148
- Yo as ThemeProvider,
149
- Po as Tile,
150
- Jo as TileButton,
151
- Eo as TileContent,
152
- Oo as TileDescription,
153
- Fo as TileSecondaryAction,
154
- _o as TileSpot,
155
- jo as TileTitle,
156
- qo as TileTrailingContent,
157
- Qo as Tooltip,
158
- Uo as TooltipContent,
159
- Vo as TooltipProvider,
160
- Wo as TooltipTrigger,
105
+ Ne as SegmentedControl,
106
+ ye as SegmentedControlButton,
107
+ Ee as Select,
108
+ Oe as SelectContent,
109
+ Fe as SelectGroup,
110
+ _e as SelectItem,
111
+ je as SelectItemText,
112
+ qe as SelectLabel,
113
+ ze as SelectSeparator,
114
+ Je as SelectTrigger,
115
+ Qe as SideBar,
116
+ Ue as SideBarCollapseToggle,
117
+ Ve as SideBarItem,
118
+ We as SideBarLeading,
119
+ Xe as SideBarTrailing,
120
+ Ze as Skeleton,
121
+ eo as Spinner,
122
+ to as Spot,
123
+ ao as Stepper,
124
+ io as Subheader,
125
+ lo as SubheaderAction,
126
+ po as SubheaderCount,
127
+ mo as SubheaderDescription,
128
+ To as SubheaderInfo,
129
+ uo as SubheaderRow,
130
+ xo as SubheaderShowMore,
131
+ fo as SubheaderTitle,
132
+ bo as Switch,
133
+ co as Table,
134
+ Bo as TableActionBar,
135
+ Co as TableActionBarLeading,
136
+ Io as TableActionBarTrailing,
137
+ so as TableBody,
138
+ Lo as TableCell,
139
+ Do as TableCellContent,
140
+ Mo as TableGroupHeaderRow,
141
+ ho as TableHeader,
142
+ vo as TableHeaderCell,
143
+ Ro as TableHeaderRow,
144
+ Ao as TableInfoIcon,
145
+ wo as TableLoadingRow,
146
+ Ho as TableRoot,
147
+ ko as TableRow,
148
+ Go as TableSortButton,
149
+ yo as Tag,
150
+ Eo as TextInput,
151
+ et as ThemeProvider,
152
+ Fo as Tile,
153
+ Uo as TileButton,
154
+ _o as TileContent,
155
+ jo as TileDescription,
156
+ qo as TileSecondaryAction,
157
+ zo as TileSpot,
158
+ Jo as TileTitle,
159
+ Ko as TileTrailingContent,
160
+ Wo as Tooltip,
161
+ Xo as TooltipContent,
162
+ Yo as TooltipProvider,
163
+ Zo as TooltipTrigger,
161
164
  G as useLumenDataTable
162
165
  };
@@ -25,13 +25,13 @@ const N = {
25
25
  7: 14.7,
26
26
  8: 16.5,
27
27
  9: 16.5
28
- }, T = d(({ value: a, animate: l, type: r }) => {
29
- const i = (r === "integer" ? N : I)[a];
28
+ }, T = d(({ value: a, animate: l, type: i }) => {
29
+ const r = (i === "integer" ? N : I)[a];
30
30
  return /* @__PURE__ */ o(
31
31
  "div",
32
32
  {
33
- className: "relative overflow-hidden transition-[width] duration-600",
34
- style: { width: i + "px" },
33
+ className: "relative overflow-hidden mask-fade-y transition-[width] duration-600",
34
+ style: { width: r + "px" },
35
35
  children: [
36
36
  /* @__PURE__ */ e("span", { className: "invisible", children: "0" }),
37
37
  /* @__PURE__ */ e(
@@ -50,13 +50,13 @@ const N = {
50
50
  ]
51
51
  }
52
52
  );
53
- }), m = d(({ items: a, type: l, animate: r }) => a.map((i, s) => {
53
+ }), m = d(({ items: a, type: l, animate: i }) => a.map((r, s) => {
54
54
  const n = a.length - s;
55
- return i.type === "separator" ? /* @__PURE__ */ e("span", { children: i.value }, n) : /* @__PURE__ */ e(
55
+ return r.type === "separator" ? /* @__PURE__ */ e("span", { children: r.value }, n) : /* @__PURE__ */ e(
56
56
  T,
57
57
  {
58
- value: Number(i.value),
59
- animate: r,
58
+ value: Number(r.value),
59
+ animate: i,
60
60
  type: l
61
61
  },
62
62
  n
@@ -64,37 +64,37 @@ const N = {
64
64
  })), g = ({
65
65
  value: a,
66
66
  formatter: l,
67
- hidden: r = !1,
68
- loading: i = !1,
67
+ hidden: i = !1,
68
+ loading: r = !1,
69
69
  animate: s = !0,
70
70
  className: n,
71
71
  ...u
72
72
  }) => {
73
73
  const t = l(a), c = y(t), { t: f } = D(), h = x(
74
74
  t,
75
- r,
75
+ i,
76
76
  f("components.amountDisplay.amountHiddenAriaLabel")
77
77
  );
78
78
  return /* @__PURE__ */ o(
79
79
  "div",
80
80
  {
81
81
  className: p(
82
- i && "animate-pulse",
83
- "relative inline-flex items-end",
82
+ r && "animate-pulse",
83
+ "relative inline-flex items-baseline",
84
84
  n
85
85
  ),
86
86
  "aria-label": h,
87
- "aria-busy": i,
87
+ "aria-busy": r,
88
88
  ...u,
89
89
  children: [
90
90
  /* @__PURE__ */ o(
91
91
  "span",
92
92
  {
93
- className: "inline-flex flex-row mask-fade-y heading-1-semi-bold text-base",
93
+ className: "inline-flex heading-1-semi-bold text-base",
94
94
  "aria-hidden": "true",
95
95
  children: [
96
96
  t.currencyPosition === "start" && /* @__PURE__ */ e("span", { className: "me-4", children: t.currencyText }),
97
- r ? /* @__PURE__ */ e("span", { children: "••••" }) : /* @__PURE__ */ e(
97
+ i ? /* @__PURE__ */ e("span", { children: "••••" }) : /* @__PURE__ */ e(
98
98
  m,
99
99
  {
100
100
  items: c.integerPart,
@@ -108,11 +108,11 @@ const N = {
108
108
  /* @__PURE__ */ o(
109
109
  "span",
110
110
  {
111
- className: "inline-flex flex-row mask-fade-y pb-2 heading-2-semi-bold text-muted",
111
+ className: "inline-flex heading-2-semi-bold text-muted",
112
112
  "aria-hidden": "true",
113
113
  children: [
114
- !r && t.decimalPart && /* @__PURE__ */ e("span", { children: t.decimalSeparator }),
115
- t.decimalPart && !r && /* @__PURE__ */ e(
114
+ !i && t.decimalPart && /* @__PURE__ */ e("span", { children: t.decimalSeparator }),
115
+ t.decimalPart && !i && /* @__PURE__ */ e(
116
116
  m,
117
117
  {
118
118
  items: c.decimalPart,
@@ -0,0 +1,10 @@
1
+ import { SegmentedControlButtonProps, SegmentedControlProps } from './types';
2
+ export declare function SegmentedControlButton({ value, children, icon: Icon, onClick, className, ...props }: SegmentedControlButtonProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare namespace SegmentedControlButton {
4
+ var displayName: string;
5
+ }
6
+ export declare function SegmentedControl({ selectedValue, onSelectedChange, children, className, disabled, appearance, ...props }: SegmentedControlProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare namespace SegmentedControl {
8
+ var displayName: string;
9
+ }
10
+ //# sourceMappingURL=SegmentedControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAMjB,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,IAAI,EAAE,IAAI,EACV,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACT,EAAE,2BAA2B,2CAiC7B;yBAxCe,sBAAsB;;;AA4CtC,wBAAgB,gBAAgB,CAAC,EAC/B,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAyB,EACzB,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA2CvB;yBAnDe,gBAAgB"}
@@ -0,0 +1,100 @@
1
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
2
+ import { cn as m } from "../../../libs/utils-shared/dist/index.js";
3
+ import { useRef as p } from "react";
4
+ import { useSegmentedControlContext as b, SegmentedControlContextProvider as x } from "./SegmentedControlContext.js";
5
+ import { useSegmentedControlSelectedIndex as g, usePillElementLayoutEffect as h } from "./usePillElementLayoutEffect.js";
6
+ function v({
7
+ value: o,
8
+ children: l,
9
+ icon: e,
10
+ onClick: d,
11
+ className: n,
12
+ ...a
13
+ }) {
14
+ const { selectedValue: u, onSelectedChange: i, disabled: r } = b(), t = u === o;
15
+ return /* @__PURE__ */ s(
16
+ "button",
17
+ {
18
+ type: "button",
19
+ role: "radio",
20
+ "aria-checked": t,
21
+ "aria-disabled": r,
22
+ disabled: r,
23
+ onClick: (f) => {
24
+ r || (i(o), d?.(f));
25
+ },
26
+ className: m(
27
+ "z-10 flex min-w-0 flex-1 cursor-pointer flex-row items-center justify-center rounded-sm px-16 py-8 select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:cursor-not-allowed",
28
+ t ? "body-2-semi-bold text-base" : "body-2 text-muted hover:body-2-semi-bold hover:text-muted-hover",
29
+ n
30
+ ),
31
+ ...a,
32
+ children: /* @__PURE__ */ c("span", { className: "inline-flex shrink-0 items-center justify-center gap-8", children: [
33
+ e && /* @__PURE__ */ s(e, { size: 16 }),
34
+ /* @__PURE__ */ s("span", { children: l })
35
+ ] })
36
+ }
37
+ );
38
+ }
39
+ v.displayName = "SegmentedControlButton";
40
+ function y({
41
+ selectedValue: o,
42
+ onSelectedChange: l,
43
+ children: e,
44
+ className: d,
45
+ disabled: n,
46
+ appearance: a = "background",
47
+ ...u
48
+ }) {
49
+ const i = p(null), r = g(
50
+ o,
51
+ e
52
+ ), { pill: t } = h({
53
+ ref: i,
54
+ selectedIndex: r,
55
+ children: e
56
+ });
57
+ return /* @__PURE__ */ s(
58
+ x,
59
+ {
60
+ value: { selectedValue: o, onSelectedChange: l, disabled: n },
61
+ children: /* @__PURE__ */ c(
62
+ "div",
63
+ {
64
+ ...u,
65
+ ref: i,
66
+ role: "radiogroup",
67
+ "aria-disabled": n,
68
+ className: m(
69
+ "relative flex w-full flex-row items-center rounded-sm",
70
+ a === "background" && "bg-surface",
71
+ d
72
+ ),
73
+ children: [
74
+ e,
75
+ /* @__PURE__ */ s(
76
+ "div",
77
+ {
78
+ "aria-hidden": !0,
79
+ className: m(
80
+ "pointer-events-none absolute top-0 left-0 z-0 rounded-sm transition-transform duration-250 ease-in-out",
81
+ n ? "bg-base-transparent-pressed" : "bg-muted-transparent"
82
+ ),
83
+ style: {
84
+ width: t.width,
85
+ height: t.height,
86
+ transform: `translateX(${t.x}px)`
87
+ }
88
+ }
89
+ )
90
+ ]
91
+ }
92
+ )
93
+ }
94
+ );
95
+ }
96
+ y.displayName = "SegmentedControl";
97
+ export {
98
+ y as SegmentedControl,
99
+ v as SegmentedControlButton
100
+ };
@@ -0,0 +1,12 @@
1
+ export type SegmentedControlContextValue = {
2
+ selectedValue: string;
3
+ onSelectedChange: (value: string) => void;
4
+ disabled?: boolean;
5
+ };
6
+ declare const SegmentedControlContextProvider: import('react').FC<{
7
+ children: import('react').ReactNode;
8
+ value: SegmentedControlContextValue;
9
+ }>;
10
+ export declare const useSegmentedControlContext: () => SegmentedControlContextValue;
11
+ export { SegmentedControlContextProvider };
12
+ //# sourceMappingURL=SegmentedControlContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControlContext.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SegmentedControl/SegmentedControlContext.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,4BAA4B,GAAG;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAO,+BAA+B;;;EAC+B,CAAC;AAEtE,eAAO,MAAM,0BAA0B,oCAInC,CAAC;AAEL,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { createSafeContext as e } from "../../../libs/utils-shared/dist/index.js";
2
+ const [n, t] = e("SegmentedControl"), r = () => t({
3
+ consumerName: "SegmentedControlButton",
4
+ contextRequired: !0
5
+ });
6
+ export {
7
+ n as SegmentedControlContextProvider,
8
+ r as useSegmentedControlContext
9
+ };
@@ -0,0 +1,3 @@
1
+ export * from './SegmentedControl';
2
+ export type * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SegmentedControl/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,mBAAmB,SAAS,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { ComponentType, ReactNode, ComponentPropsWithoutRef } from 'react';
2
+ import { IconSize } from '../Icon/types';
3
+ export type SegmentedControlProps = {
4
+ /**
5
+ * The value of the currently selected segment (drives the sliding pill).
6
+ */
7
+ selectedValue: string;
8
+ /**
9
+ * Callback when the selected segment value changes.
10
+ */
11
+ onSelectedChange: (value: string) => void;
12
+ /**
13
+ * When true, the entire control is disabled (no interaction, selected uses muted styling).
14
+ */
15
+ disabled?: boolean;
16
+ /**
17
+ * Visual style of the control container: "background" shows the surface bg, "no-background" is transparent.
18
+ * @default 'background'
19
+ */
20
+ appearance?: 'background' | 'no-background';
21
+ /**
22
+ * Segment buttons (SegmentedControlButton).
23
+ */
24
+ children: ReactNode;
25
+ } & Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
26
+ type IconComponent = ComponentType<{
27
+ size?: IconSize;
28
+ className?: string;
29
+ }>;
30
+ export type SegmentedControlButtonProps = {
31
+ /**
32
+ * Value for this segment (must be unique among siblings).
33
+ */
34
+ value: string;
35
+ /**
36
+ * Button label.
37
+ */
38
+ children: ReactNode;
39
+ /**
40
+ * Optional icon shown to the left of the label (from Symbols).
41
+ */
42
+ icon?: IconComponent;
43
+ } & Omit<ComponentPropsWithoutRef<'button'>, 'children'>;
44
+ export {};
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SegmentedControl/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,YAAY,GAAG,eAAe,CAAC;IAC5C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAEtD,KAAK,aAAa,GAAG,aAAa,CAAC;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB,GAAG,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export type PillLayout = {
3
+ width: number;
4
+ height: number;
5
+ x: number;
6
+ };
7
+ type UsePillElementLayoutEffectParams = {
8
+ ref: React.RefObject<HTMLDivElement | null>;
9
+ selectedIndex: number;
10
+ children: React.ReactNode;
11
+ };
12
+ export declare function usePillElementLayoutEffect({ ref, selectedIndex, children, }: UsePillElementLayoutEffectParams): {
13
+ pill: PillLayout;
14
+ };
15
+ export declare function useSegmentedControlSelectedIndex(selectedValue: string, children: React.ReactNode): number;
16
+ export {};
17
+ //# sourceMappingURL=usePillElementLayoutEffect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePillElementLayoutEffect.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/SegmentedControl/usePillElementLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,gCAAgC,GAAG;IACtC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,EACzC,GAAG,EACH,aAAa,EACb,QAAQ,GACT,EAAE,gCAAgC,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CA0BzD;AAED,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,GACxB,MAAM,CAUR"}
@@ -0,0 +1,35 @@
1
+ import r, { useMemo as a, useState as m, useLayoutEffect as p } from "react";
2
+ function y({
3
+ ref: e,
4
+ selectedIndex: t,
5
+ children: n
6
+ }) {
7
+ const [f, l] = m({ width: 0, height: 0, x: 0 });
8
+ return p(() => {
9
+ const o = e.current;
10
+ if (!o) return;
11
+ const i = () => {
12
+ const { width: d, height: h } = o.getBoundingClientRect(), u = r.Children.count(n), c = u > 0 ? d / u : 0;
13
+ l({
14
+ width: c,
15
+ height: h,
16
+ x: t >= 0 ? t * c : 0
17
+ });
18
+ };
19
+ if (i(), typeof ResizeObserver > "u") return;
20
+ const s = new ResizeObserver(i);
21
+ return s.observe(o), () => s.disconnect();
22
+ }, [n, t, e]), { pill: f };
23
+ }
24
+ function v(e, t) {
25
+ return a(
26
+ () => r.Children.toArray(t).findIndex(
27
+ (n) => r.isValidElement(n) && n.props.value === e
28
+ ),
29
+ [e, t]
30
+ );
31
+ }
32
+ export {
33
+ y as usePillElementLayoutEffect,
34
+ v as useSegmentedControlSelectedIndex
35
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"TileButton.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/TileButton/TileButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAqC1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,UAAU;sHAWpB,eAAe;;CAiCjB,CAAC"}
1
+ {"version":3,"file":"TileButton.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/TileButton/TileButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAsC1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,UAAU;sHAWpB,eAAe;;CAiCjB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsxs as b, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as d, jsx as s } from "react/jsx-runtime";
2
2
  import { cn as p } from "../../../libs/utils-shared/dist/index.js";
3
3
  import { Slot as v, Slottable as x } from "@radix-ui/react-slot";
4
4
  import { cva as i } from "class-variance-authority";
@@ -6,14 +6,14 @@ import { useCallback as g } from "react";
6
6
  const N = i(
7
7
  [
8
8
  "flex flex-col items-center gap-8 rounded-md p-12",
9
- "bg-muted body-2-semi-bold text-base transition-colors",
9
+ "bg-surface body-2-semi-bold text-base transition-colors",
10
10
  "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"
11
11
  ],
12
12
  {
13
13
  variants: {
14
14
  disabled: {
15
15
  true: "bg-disabled text-disabled cursor-not-allowed",
16
- false: "hover:bg-muted-hover active:bg-muted-pressed cursor-pointer"
16
+ false: "hover:bg-surface-hover active:bg-surface-pressed cursor-pointer"
17
17
  },
18
18
  isFull: {
19
19
  true: "w-full"
@@ -44,9 +44,9 @@ const N = i(
44
44
  className: c,
45
45
  asChild: t = !1,
46
46
  "aria-label": f,
47
- ...m
47
+ ...b
48
48
  }) => {
49
- const d = g(
49
+ const m = g(
50
50
  (o) => {
51
51
  if (e) {
52
52
  o.preventDefault();
@@ -56,17 +56,17 @@ const N = i(
56
56
  },
57
57
  [e, l]
58
58
  );
59
- return /* @__PURE__ */ b(
59
+ return /* @__PURE__ */ d(
60
60
  t ? v : "button",
61
61
  {
62
62
  ref: r,
63
63
  type: t ? void 0 : "button",
64
64
  className: p(N({ disabled: e, isFull: u }), c),
65
- onClick: d,
65
+ onClick: m,
66
66
  disabled: e,
67
67
  "data-disabled": e || void 0,
68
68
  "aria-label": f,
69
- ...m,
69
+ ...b,
70
70
  children: [
71
71
  /* @__PURE__ */ s(n, { size: 20, className: V({ disabled: e }) }),
72
72
  t ? /* @__PURE__ */ s(x, { children: a }) : /* @__PURE__ */ s("span", { className: "line-clamp-2 text-center", children: a })
@@ -19,6 +19,7 @@ export * from './Menu';
19
19
  export * from './NavBar';
20
20
  export * from './PageIndicator';
21
21
  export * from './SearchInput';
22
+ export * from './SegmentedControl';
22
23
  export * from './Select';
23
24
  export * from './SideBar';
24
25
  export * from './Skeleton';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [