@telegraph/data-list 0.0.4 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @telegraph/data-list
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#626](https://github.com/knocklabs/telegraph/pull/626) [`5634e8d`](https://github.com/knocklabs/telegraph/commit/5634e8dbedea588c793ea460ead27a0a39746ffa) Thanks [@connorlindsey](https://github.com/connorlindsey)! - feat: add description as tooltip
8
+
3
9
  ## 0.0.4
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@telegraph/icon"),c=require("@telegraph/layout"),y=require("@telegraph/typography"),b=({direction:t="column",gap:r="4",...s})=>e.jsx(c.Stack,{direction:t,gap:r,...s}),l=({direction:t="row",gap:r="1",align:s="baseline",...n})=>e.jsx(c.Stack,{direction:t,gap:r,align:s,...n}),u=({maxW:t="36",maxH:r="6",w:s="full",icon:n,children:o,textProps:i,...a})=>{const{color:j="gray",weight:g="medium",size:d="1",...S}=i||{};return e.jsxs(c.Stack,{direction:"row",align:"baseline",gap:"2",maxW:t,w:s,maxH:r,...a,children:[n&&e.jsx(c.Stack,{alignSelf:"center",children:e.jsx(m.Icon,{size:"1",color:"gray",...n})}),e.jsx(y.Text,{as:"label",...S,color:j,weight:g,size:d,children:o})]})},x=({...t})=>e.jsx(c.Stack,{...t}),h=({label:t,direction:r,icon:s,children:n,labelProps:o,valueProps:i,...a})=>e.jsxs(l,{direction:r,...a,children:[e.jsx(u,{icon:s,...o,children:t}),e.jsx(x,{...i,children:n})]}),k={List:b,ListItem:l,Label:u,Value:x,Item:h};exports.DataList=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("@telegraph/icon"),l=require("@telegraph/layout"),y=require("@telegraph/tooltip"),k=require("@telegraph/typography"),p=({direction:t="column",gap:r="4",...s})=>e.jsx(l.Stack,{direction:t,gap:r,...s}),u=({direction:t="row",gap:r="1",align:s="baseline",...o})=>e.jsx(l.Stack,{direction:t,gap:r,align:s,...o}),x=({maxW:t="36",maxH:r="6",w:s="full",icon:o,children:c,textProps:a,description:n,tooltipProps:i,...j})=>{const{color:b="gray",weight:g="medium",size:S="1",...h}=a||{};return e.jsxs(l.Stack,{direction:"row",align:"baseline",gap:"2",maxW:t,w:s,maxH:r,...j,children:[o&&e.jsx(l.Stack,{alignSelf:"center",children:e.jsx(m.Icon,{size:"1",color:"gray",...o})}),e.jsx(y.Tooltip,{label:n,enabled:!!n,...i,children:e.jsx(k.Text,{as:"label",...h,color:b,weight:g,size:S,borderBottom:n?"px":void 0,borderStyle:n?"dashed":void 0,children:c})})]})},d=({...t})=>e.jsx(l.Stack,{...t}),q=({label:t,direction:r,icon:s,children:o,description:c,labelProps:a,valueProps:n,...i})=>e.jsxs(u,{direction:r,...i,children:[e.jsx(x,{icon:s,description:c,...a,children:t}),e.jsx(d,{...n,children:o})]}),L={List:p,ListItem:u,Label:x,Value:d,Item:q};exports.DataList=L;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/DataList/DataList.tsx"],"sourcesContent":["import { TgphComponentProps } from \"@telegraph/helpers\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\ntype ListProps = TgphComponentProps<typeof Stack>;\n\nconst List = ({ direction = \"column\", gap = \"4\", ...props }: ListProps) => {\n return <Stack direction={direction} gap={gap} {...props} />;\n};\n\ntype ListItemProps = TgphComponentProps<typeof Stack>;\n\nconst ListItem = ({\n direction = \"row\",\n gap = \"1\",\n align = \"baseline\",\n ...props\n}: ListItemProps) => {\n return <Stack direction={direction} gap={gap} align={align} {...props} />;\n};\n\ntype LabelProps = {\n textProps?: TgphComponentProps<typeof Text>;\n icon?: TgphComponentProps<typeof Icon>;\n} & TgphComponentProps<typeof Stack>;\n\nconst Label = ({\n maxW = \"36\",\n maxH = \"6\",\n w = \"full\",\n icon,\n children,\n textProps,\n ...props\n}: LabelProps) => {\n const {\n color = \"gray\",\n weight = \"medium\",\n size = \"1\",\n ...restTextProps\n } = textProps || {};\n return (\n <Stack\n direction=\"row\"\n align=\"baseline\"\n gap=\"2\"\n maxW={maxW}\n w={w}\n maxH={maxH}\n {...props}\n >\n {icon && (\n <Stack alignSelf=\"center\">\n <Icon size=\"1\" color=\"gray\" {...icon} />\n </Stack>\n )}\n <Text\n as=\"label\"\n {...restTextProps}\n color={color}\n weight={weight}\n size={size}\n >\n {children}\n </Text>\n </Stack>\n );\n};\n\ntype ValueProps = TgphComponentProps<typeof Stack>;\n\nconst Value = ({ ...props }: ValueProps) => {\n return <Stack {...props} />;\n};\n\ntype ItemProps = ListItemProps & {\n label: React.ReactNode | string;\n icon?: TgphComponentProps<typeof Icon>;\n labelProps?: TgphComponentProps<typeof Label>;\n valueProps?: TgphComponentProps<typeof Value>;\n};\n\nconst Item = ({\n label,\n direction,\n icon,\n children,\n labelProps,\n valueProps,\n ...props\n}: ItemProps) => {\n return (\n <ListItem direction={direction} {...props}>\n <Label icon={icon} {...labelProps}>\n {label}\n </Label>\n <Value {...valueProps}>{children}</Value>\n </ListItem>\n );\n};\n\nconst DataList = {\n List,\n ListItem,\n Label,\n Value,\n Item,\n};\n\nexport { DataList };\n"],"names":["List","direction","gap","props","jsx","Stack","ListItem","align","Label","maxW","maxH","w","icon","children","textProps","color","weight","size","restTextProps","jsxs","Icon","Text","Value","Item","label","labelProps","valueProps","DataList"],"mappings":"oNAQMA,EAAO,CAAC,CAAE,UAAAC,EAAY,SAAU,IAAAC,EAAM,IAAK,GAAGC,KAC3CC,EAAAA,IAACC,EAAAA,MAA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,EACApB,EAAAA,IAACkB,EAAA,CAAO,GAAGI,EAAa,SAAAb,CAAA,CAAS,CAAA,EACnC,EAIEc,EAAW,CACf,KAAA3B,EACA,SAAAM,EACA,MAAAE,EACA,MAAAc,EACA,KAAAC,CACF"}
1
+ {"version":3,"file":"index.js","sources":["../../src/DataList/DataList.tsx"],"sourcesContent":["import { TgphComponentProps } from \"@telegraph/helpers\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\ntype ListProps = TgphComponentProps<typeof Stack>;\n\nconst List = ({ direction = \"column\", gap = \"4\", ...props }: ListProps) => {\n return <Stack direction={direction} gap={gap} {...props} />;\n};\n\ntype ListItemProps = TgphComponentProps<typeof Stack>;\n\nconst ListItem = ({\n direction = \"row\",\n gap = \"1\",\n align = \"baseline\",\n ...props\n}: ListItemProps) => {\n return <Stack direction={direction} gap={gap} align={align} {...props} />;\n};\n\ntype LabelProps = {\n textProps?: TgphComponentProps<typeof Text>;\n icon?: TgphComponentProps<typeof Icon>;\n description?: React.ReactNode;\n tooltipProps?: Omit<\n Partial<TgphComponentProps<typeof Tooltip>>,\n \"enabled\" | \"label\"\n >;\n} & TgphComponentProps<typeof Stack>;\n\nconst Label = ({\n maxW = \"36\",\n maxH = \"6\",\n w = \"full\",\n icon,\n children,\n textProps,\n description,\n tooltipProps,\n ...props\n}: LabelProps) => {\n const {\n color = \"gray\",\n weight = \"medium\",\n size = \"1\",\n ...restTextProps\n } = textProps || {};\n\n return (\n <Stack\n direction=\"row\"\n align=\"baseline\"\n gap=\"2\"\n maxW={maxW}\n w={w}\n maxH={maxH}\n {...props}\n >\n {icon && (\n <Stack alignSelf=\"center\">\n <Icon size=\"1\" color=\"gray\" {...icon} />\n </Stack>\n )}\n <Tooltip label={description} enabled={!!description} {...tooltipProps}>\n <Text\n as=\"label\"\n {...restTextProps}\n color={color}\n weight={weight}\n size={size}\n borderBottom={description ? \"px\" : undefined}\n borderStyle={description ? \"dashed\" : undefined}\n >\n {children}\n </Text>\n </Tooltip>\n </Stack>\n );\n};\n\ntype ValueProps = TgphComponentProps<typeof Stack>;\n\nconst Value = ({ ...props }: ValueProps) => {\n return <Stack {...props} />;\n};\n\ntype ItemProps = ListItemProps & {\n label: React.ReactNode | string;\n icon?: TgphComponentProps<typeof Icon>;\n description?: React.ReactNode;\n labelProps?: TgphComponentProps<typeof Label>;\n valueProps?: TgphComponentProps<typeof Value>;\n};\n\nconst Item = ({\n label,\n direction,\n icon,\n children,\n description,\n labelProps,\n valueProps,\n ...props\n}: ItemProps) => {\n return (\n <ListItem direction={direction} {...props}>\n <Label icon={icon} description={description} {...labelProps}>\n {label}\n </Label>\n <Value {...valueProps}>{children}</Value>\n </ListItem>\n );\n};\n\nconst DataList = {\n List,\n ListItem,\n Label,\n Value,\n Item,\n};\n\nexport { DataList };\n"],"names":["List","direction","gap","props","jsx","Stack","ListItem","align","Label","maxW","maxH","w","icon","children","textProps","description","tooltipProps","color","weight","size","restTextProps","jsxs","Icon","Tooltip","Text","Value","Item","label","labelProps","valueProps","DataList"],"mappings":"oPASMA,EAAO,CAAC,CAAE,UAAAC,EAAY,SAAU,IAAAC,EAAM,IAAK,GAAGC,KAC3CC,EAAAA,IAACC,EAAAA,MAAA,CAAM,UAAAJ,EAAsB,IAAAC,EAAW,GAAGC,EAAO,EAKrDG,EAAW,CAAC,CAChB,UAAAL,EAAY,MACZ,IAAAC,EAAM,IACN,MAAAK,EAAQ,WACR,GAAGJ,CACL,UACUE,EAAAA,MAAA,CAAM,UAAAJ,EAAsB,IAAAC,EAAU,MAAAK,EAAe,GAAGJ,EAAO,EAanEK,EAAQ,CAAC,CACb,KAAAC,EAAO,KACP,KAAAC,EAAO,IACP,EAAAC,EAAI,OAAA,KACJC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,aAAAC,EACA,GAAGb,CACL,IAAkB,CAChB,KA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as a } from "react/jsx-runtime";
2
- import { Icon as x } from "@telegraph/icon";
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
+ import { Icon as L } from "@telegraph/icon";
3
3
  import { Stack as i } from "@telegraph/layout";
4
- import { Text as b } from "@telegraph/typography";
5
- const L = ({ direction: r = "column", gap: t = "4", ...o }) => /* @__PURE__ */ e(i, { direction: r, gap: t, ...o }), m = ({
4
+ import { Tooltip as w } from "@telegraph/tooltip";
5
+ import { Text as y } from "@telegraph/typography";
6
+ const I = ({ direction: r = "column", gap: o = "4", ...t }) => /* @__PURE__ */ e(i, { direction: r, gap: o, ...t }), d = ({
6
7
  direction: r = "row",
7
- gap: t = "1",
8
- align: o = "baseline",
9
- ...n
10
- }) => /* @__PURE__ */ e(i, { direction: r, gap: t, align: o, ...n }), u = ({
8
+ gap: o = "1",
9
+ align: t = "baseline",
10
+ ...l
11
+ }) => /* @__PURE__ */ e(i, { direction: r, gap: o, align: t, ...l }), u = ({
11
12
  maxW: r = "36",
12
- maxH: t = "6",
13
- w: o = "full",
14
- icon: n,
13
+ maxH: o = "6",
14
+ w: t = "full",
15
+ icon: l,
15
16
  children: s,
16
- textProps: l,
17
- ...c
17
+ textProps: a,
18
+ description: n,
19
+ tooltipProps: m,
20
+ ...f
18
21
  }) => {
19
22
  const {
20
- color: d = "gray",
21
- weight: f = "medium",
23
+ color: h = "gray",
24
+ weight: p = "medium",
22
25
  size: g = "1",
23
- ...h
24
- } = l || {};
25
- return /* @__PURE__ */ a(
26
+ ...x
27
+ } = a || {};
28
+ return /* @__PURE__ */ c(
26
29
  i,
27
30
  {
28
31
  direction: "row",
29
32
  align: "baseline",
30
33
  gap: "2",
31
34
  maxW: r,
32
- w: o,
33
- maxH: t,
34
- ...c,
35
+ w: t,
36
+ maxH: o,
37
+ ...f,
35
38
  children: [
36
- n && /* @__PURE__ */ e(i, { alignSelf: "center", children: /* @__PURE__ */ e(x, { size: "1", color: "gray", ...n }) }),
37
- /* @__PURE__ */ e(
38
- b,
39
+ l && /* @__PURE__ */ e(i, { alignSelf: "center", children: /* @__PURE__ */ e(L, { size: "1", color: "gray", ...l }) }),
40
+ /* @__PURE__ */ e(w, { label: n, enabled: !!n, ...m, children: /* @__PURE__ */ e(
41
+ y,
39
42
  {
40
43
  as: "label",
41
- ...h,
42
- color: d,
43
- weight: f,
44
+ ...x,
45
+ color: h,
46
+ weight: p,
44
47
  size: g,
48
+ borderBottom: n ? "px" : void 0,
49
+ borderStyle: n ? "dashed" : void 0,
45
50
  children: s
46
51
  }
47
- )
52
+ ) })
48
53
  ]
49
54
  }
50
55
  );
51
- }, p = ({ ...r }) => /* @__PURE__ */ e(i, { ...r }), w = ({
56
+ }, b = ({ ...r }) => /* @__PURE__ */ e(i, { ...r }), S = ({
52
57
  label: r,
53
- direction: t,
54
- icon: o,
55
- children: n,
56
- labelProps: s,
57
- valueProps: l,
58
- ...c
59
- }) => /* @__PURE__ */ a(m, { direction: t, ...c, children: [
60
- /* @__PURE__ */ e(u, { icon: o, ...s, children: r }),
61
- /* @__PURE__ */ e(p, { ...l, children: n })
62
- ] }), S = {
63
- List: L,
64
- ListItem: m,
58
+ direction: o,
59
+ icon: t,
60
+ children: l,
61
+ description: s,
62
+ labelProps: a,
63
+ valueProps: n,
64
+ ...m
65
+ }) => /* @__PURE__ */ c(d, { direction: o, ...m, children: [
66
+ /* @__PURE__ */ e(u, { icon: t, description: s, ...a, children: r }),
67
+ /* @__PURE__ */ e(b, { ...n, children: l })
68
+ ] }), B = {
69
+ List: I,
70
+ ListItem: d,
65
71
  Label: u,
66
- Value: p,
67
- Item: w
72
+ Value: b,
73
+ Item: S
68
74
  };
69
75
  export {
70
- S as DataList
76
+ B as DataList
71
77
  };
72
78
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/DataList/DataList.tsx"],"sourcesContent":["import { TgphComponentProps } from \"@telegraph/helpers\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\ntype ListProps = TgphComponentProps<typeof Stack>;\n\nconst List = ({ direction = \"column\", gap = \"4\", ...props }: ListProps) => {\n return <Stack direction={direction} gap={gap} {...props} />;\n};\n\ntype ListItemProps = TgphComponentProps<typeof Stack>;\n\nconst ListItem = ({\n direction = \"row\",\n gap = \"1\",\n align = \"baseline\",\n ...props\n}: ListItemProps) => {\n return <Stack direction={direction} gap={gap} align={align} {...props} />;\n};\n\ntype LabelProps = {\n textProps?: TgphComponentProps<typeof Text>;\n icon?: TgphComponentProps<typeof Icon>;\n} & TgphComponentProps<typeof Stack>;\n\nconst Label = ({\n maxW = \"36\",\n maxH = \"6\",\n w = \"full\",\n icon,\n children,\n textProps,\n ...props\n}: LabelProps) => {\n const {\n color = \"gray\",\n weight = \"medium\",\n size = \"1\",\n ...restTextProps\n } = textProps || {};\n return (\n <Stack\n direction=\"row\"\n align=\"baseline\"\n gap=\"2\"\n maxW={maxW}\n w={w}\n maxH={maxH}\n {...props}\n >\n {icon && (\n <Stack alignSelf=\"center\">\n <Icon size=\"1\" color=\"gray\" {...icon} />\n </Stack>\n )}\n <Text\n as=\"label\"\n {...restTextProps}\n color={color}\n weight={weight}\n size={size}\n >\n {children}\n </Text>\n </Stack>\n );\n};\n\ntype ValueProps = TgphComponentProps<typeof Stack>;\n\nconst Value = ({ ...props }: ValueProps) => {\n return <Stack {...props} />;\n};\n\ntype ItemProps = ListItemProps & {\n label: React.ReactNode | string;\n icon?: TgphComponentProps<typeof Icon>;\n labelProps?: TgphComponentProps<typeof Label>;\n valueProps?: TgphComponentProps<typeof Value>;\n};\n\nconst Item = ({\n label,\n direction,\n icon,\n children,\n labelProps,\n valueProps,\n ...props\n}: ItemProps) => {\n return (\n <ListItem direction={direction} {...props}>\n <Label icon={icon} {...labelProps}>\n {label}\n </Label>\n <Value {...valueProps}>{children}</Value>\n </ListItem>\n );\n};\n\nconst DataList = {\n List,\n ListItem,\n Label,\n Value,\n Item,\n};\n\nexport { DataList };\n"],"names":["List","direction","gap","props","jsx","Stack","ListItem","align","Label","maxW","maxH","w","icon","children","textProps","color","weight","size","restTextProps","jsxs","Icon","Text","Value","Item","label","labelProps","valueProps","DataList"],"mappings":";;;;AAQA,MAAMA,IAAO,CAAC,EAAE,WAAAC,IAAY,UAAU,KAAAC,IAAM,KAAK,GAAGC,QAC3C,gBAAAC,EAACC,GAAA,EAAM,WAAAJ,GAAsB,KAAAC,GAAW,GAAGC,GAAO,GAKrDG,IAAW,CAAC;AAAA,EAChB,WAAAL,IAAY;AAAA,EACZ,KAAAC,IAAM;AAAA,EACN,OAAAK,IAAQ;AAAA,EACR,GAAGJ;AACL,wBACUE,GAAA,EAAM,WAAAJ,GAAsB,KAAAC,GAAU,OAAAK,GAAe,GAAGJ,GAAO,GAQnEK,IAAQ,CAAC;AAAA,EACb,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAO;AAAA,EACP,GAAAC,IAAI;AAAA,EACJ,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGX;AACL,MAAkB;AAChB,QAAM;AAAA,IACJ,OAAAY,IAAQ;AAAA,IACR,QAAAC,IAAS;AAAA,IACT,MAAAC,IAAO;AAAA,IACP,GAAGC;AAAA,EAAA,IACDJ,KAAa,CAAA;AACjB,SACE,gBAAAK;AAAA,IAACd;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAM;AAAA,MACN,KAAI;AAAA,MACJ,MAAAI;AAAA,MACA,GAAAE;AAAA,MACA,MAAAD;AAAA,MACC,GAAGP;AAAA,MAEH,UAAA;AAAA,QAAAS,KACC,gBAAAR,EAACC,GAAA,EAAM,WAAU,UACf,UAAA,gBAAAD,EAACgB,GAAA,EAAK,MAAK,KAAI,OAAM,QAAQ,GAAGR,EAAA,CAAM,GACxC;AAAA,QAEF,gBAAAR;AAAA,UAACiB;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACF,GAAGH;AAAA,YACJ,OAAAH;AAAA,YACA,QAAAC;AAAA,YACA,MAAAC;AAAA,YAEC,UAAAJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN,GAIMS,IAAQ,CAAC,EAAE,GAAGnB,QACX,gBAAAC,EAACC,GAAA,EAAO,GAAGF,EAAA,CAAO,GAUrBoB,IAAO,CAAC;AAAA,EACZ,OAAAC;AAAA,EACA,WAAAvB;AAAA,EACA,MAAAW;AAAA,EACA,UAAAC;AAAA,EACA,YAAAY;AAAA,EACA,YAAAC;AAAA,EACA,GAAGvB;AACL,MAEI,gBAAAgB,EAACb,GAAA,EAAS,WAAAL,GAAuB,GAAGE,GAClC,UAAA;AAAA,EAAA,gBAAAC,EAACI,GAAA,EAAM,MAAAI,GAAa,GAAGa,GACpB,UAAAD,GACH;AAAA,EACA,gBAAApB,EAACkB,GAAA,EAAO,GAAGI,GAAa,UAAAb,EAAA,CAAS;AAAA,GACnC,GAIEc,IAAW;AAAA,EACf,MAAA3B;AAAA,EACA,UAAAM;AAAA,EACA,OAAAE;AAAA,EACA,OAAAc;AAAA,EACA,MAAAC;AACF;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/DataList/DataList.tsx"],"sourcesContent":["import { TgphComponentProps } from \"@telegraph/helpers\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport React from \"react\";\n\ntype ListProps = TgphComponentProps<typeof Stack>;\n\nconst List = ({ direction = \"column\", gap = \"4\", ...props }: ListProps) => {\n return <Stack direction={direction} gap={gap} {...props} />;\n};\n\ntype ListItemProps = TgphComponentProps<typeof Stack>;\n\nconst ListItem = ({\n direction = \"row\",\n gap = \"1\",\n align = \"baseline\",\n ...props\n}: ListItemProps) => {\n return <Stack direction={direction} gap={gap} align={align} {...props} />;\n};\n\ntype LabelProps = {\n textProps?: TgphComponentProps<typeof Text>;\n icon?: TgphComponentProps<typeof Icon>;\n description?: React.ReactNode;\n tooltipProps?: Omit<\n Partial<TgphComponentProps<typeof Tooltip>>,\n \"enabled\" | \"label\"\n >;\n} & TgphComponentProps<typeof Stack>;\n\nconst Label = ({\n maxW = \"36\",\n maxH = \"6\",\n w = \"full\",\n icon,\n children,\n textProps,\n description,\n tooltipProps,\n ...props\n}: LabelProps) => {\n const {\n color = \"gray\",\n weight = \"medium\",\n size = \"1\",\n ...restTextProps\n } = textProps || {};\n\n return (\n <Stack\n direction=\"row\"\n align=\"baseline\"\n gap=\"2\"\n maxW={maxW}\n w={w}\n maxH={maxH}\n {...props}\n >\n {icon && (\n <Stack alignSelf=\"center\">\n <Icon size=\"1\" color=\"gray\" {...icon} />\n </Stack>\n )}\n <Tooltip label={description} enabled={!!description} {...tooltipProps}>\n <Text\n as=\"label\"\n {...restTextProps}\n color={color}\n weight={weight}\n size={size}\n borderBottom={description ? \"px\" : undefined}\n borderStyle={description ? \"dashed\" : undefined}\n >\n {children}\n </Text>\n </Tooltip>\n </Stack>\n );\n};\n\ntype ValueProps = TgphComponentProps<typeof Stack>;\n\nconst Value = ({ ...props }: ValueProps) => {\n return <Stack {...props} />;\n};\n\ntype ItemProps = ListItemProps & {\n label: React.ReactNode | string;\n icon?: TgphComponentProps<typeof Icon>;\n description?: React.ReactNode;\n labelProps?: TgphComponentProps<typeof Label>;\n valueProps?: TgphComponentProps<typeof Value>;\n};\n\nconst Item = ({\n label,\n direction,\n icon,\n children,\n description,\n labelProps,\n valueProps,\n ...props\n}: ItemProps) => {\n return (\n <ListItem direction={direction} {...props}>\n <Label icon={icon} description={description} {...labelProps}>\n {label}\n </Label>\n <Value {...valueProps}>{children}</Value>\n </ListItem>\n );\n};\n\nconst DataList = {\n List,\n ListItem,\n Label,\n Value,\n Item,\n};\n\nexport { DataList };\n"],"names":["List","direction","gap","props","jsx","Stack","ListItem","align","Label","maxW","maxH","w","icon","children","textProps","description","tooltipProps","color","weight","size","restTextProps","jsxs","Icon","Tooltip","Text","Value","Item","label","labelProps","valueProps","DataList"],"mappings":";;;;;AASA,MAAMA,IAAO,CAAC,EAAE,WAAAC,IAAY,UAAU,KAAAC,IAAM,KAAK,GAAGC,QAC3C,gBAAAC,EAACC,GAAA,EAAM,WAAAJ,GAAsB,KAAAC,GAAW,GAAGC,GAAO,GAKrDG,IAAW,CAAC;AAAA,EAChB,WAAAL,IAAY;AAAA,EACZ,KAAAC,IAAM;AAAA,EACN,OAAAK,IAAQ;AAAA,EACR,GAAGJ;AACL,wBACUE,GAAA,EAAM,WAAAJ,GAAsB,KAAAC,GAAU,OAAAK,GAAe,GAAGJ,GAAO,GAanEK,IAAQ,CAAC;AAAA,EACb,MAAAC,IAAO;AAAA,EACP,MAAAC,IAAO;AAAA,EACP,GAAAC,IAAI;AAAA,EACJ,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,GAAGb;AACL,MAAkB;AAChB,QAAM;AAAA,IACJ,OAAAc,IAAQ;AAAA,IACR,QAAAC,IAAS;AAAA,IACT,MAAAC,IAAO;AAAA,IACP,GAAGC;AAAA,EAAA,IACDN,KAAa,CAAA;AAEjB,SACE,gBAAAO;AAAA,IAAChB;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAM;AAAA,MACN,KAAI;AAAA,MACJ,MAAAI;AAAA,MACA,GAAAE;AAAA,MACA,MAAAD;AAAA,MACC,GAAGP;AAAA,MAEH,UAAA;AAAA,QAAAS,KACC,gBAAAR,EAACC,GAAA,EAAM,WAAU,UACf,UAAA,gBAAAD,EAACkB,GAAA,EAAK,MAAK,KAAI,OAAM,QAAQ,GAAGV,EAAA,CAAM,GACxC;AAAA,QAEF,gBAAAR,EAACmB,KAAQ,OAAOR,GAAa,SAAS,CAAC,CAACA,GAAc,GAAGC,GACvD,UAAA,gBAAAZ;AAAA,UAACoB;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACF,GAAGJ;AAAA,YACJ,OAAAH;AAAA,YACA,QAAAC;AAAA,YACA,MAAAC;AAAA,YACA,cAAcJ,IAAc,OAAO;AAAA,YACnC,aAAaA,IAAc,WAAW;AAAA,YAErC,UAAAF;AAAA,UAAA;AAAA,QAAA,EACH,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,GAIMY,IAAQ,CAAC,EAAE,GAAGtB,QACX,gBAAAC,EAACC,GAAA,EAAO,GAAGF,EAAA,CAAO,GAWrBuB,IAAO,CAAC;AAAA,EACZ,OAAAC;AAAA,EACA,WAAA1B;AAAA,EACA,MAAAW;AAAA,EACA,UAAAC;AAAA,EACA,aAAAE;AAAA,EACA,YAAAa;AAAA,EACA,YAAAC;AAAA,EACA,GAAG1B;AACL,MAEI,gBAAAkB,EAACf,GAAA,EAAS,WAAAL,GAAuB,GAAGE,GAClC,UAAA;AAAA,EAAA,gBAAAC,EAACI,GAAA,EAAM,MAAAI,GAAY,aAAAG,GAA2B,GAAGa,GAC9C,UAAAD,GACH;AAAA,EACA,gBAAAvB,EAACqB,GAAA,EAAO,GAAGI,GAAa,UAAAhB,EAAA,CAAS;AAAA,GACnC,GAIEiB,IAAW;AAAA,EACf,MAAA9B;AAAA,EACA,UAAAM;AAAA,EACA,OAAAE;AAAA,EACA,OAAAiB;AAAA,EACA,MAAAC;AACF;"}
@@ -1,6 +1,7 @@
1
1
  import { TgphComponentProps } from '@telegraph/helpers';
2
2
  import { Icon } from '@telegraph/icon';
3
3
  import { Stack } from '@telegraph/layout';
4
+ import { Tooltip } from '@telegraph/tooltip';
4
5
  import { Text } from '@telegraph/typography';
5
6
  import { default as React } from 'react';
6
7
  type ListProps = TgphComponentProps<typeof Stack>;
@@ -8,22 +9,25 @@ type ListItemProps = TgphComponentProps<typeof Stack>;
8
9
  type LabelProps = {
9
10
  textProps?: TgphComponentProps<typeof Text>;
10
11
  icon?: TgphComponentProps<typeof Icon>;
12
+ description?: React.ReactNode;
13
+ tooltipProps?: Omit<Partial<TgphComponentProps<typeof Tooltip>>, "enabled" | "label">;
11
14
  } & TgphComponentProps<typeof Stack>;
12
- declare const Label: ({ maxW, maxH, w, icon, children, textProps, ...props }: LabelProps) => import("react/jsx-runtime").JSX.Element;
15
+ declare const Label: ({ maxW, maxH, w, icon, children, textProps, description, tooltipProps, ...props }: LabelProps) => import("react/jsx-runtime").JSX.Element;
13
16
  type ValueProps = TgphComponentProps<typeof Stack>;
14
17
  declare const Value: ({ ...props }: ValueProps) => import("react/jsx-runtime").JSX.Element;
15
18
  type ItemProps = ListItemProps & {
16
19
  label: React.ReactNode | string;
17
20
  icon?: TgphComponentProps<typeof Icon>;
21
+ description?: React.ReactNode;
18
22
  labelProps?: TgphComponentProps<typeof Label>;
19
23
  valueProps?: TgphComponentProps<typeof Value>;
20
24
  };
21
25
  declare const DataList: {
22
26
  List: ({ direction, gap, ...props }: ListProps) => import("react/jsx-runtime").JSX.Element;
23
27
  ListItem: ({ direction, gap, align, ...props }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
24
- Label: ({ maxW, maxH, w, icon, children, textProps, ...props }: LabelProps) => import("react/jsx-runtime").JSX.Element;
28
+ Label: ({ maxW, maxH, w, icon, children, textProps, description, tooltipProps, ...props }: LabelProps) => import("react/jsx-runtime").JSX.Element;
25
29
  Value: ({ ...props }: ValueProps) => import("react/jsx-runtime").JSX.Element;
26
- Item: ({ label, direction, icon, children, labelProps, valueProps, ...props }: ItemProps) => import("react/jsx-runtime").JSX.Element;
30
+ Item: ({ label, direction, icon, children, description, labelProps, valueProps, ...props }: ItemProps) => import("react/jsx-runtime").JSX.Element;
27
31
  };
28
32
  export { DataList };
29
33
  //# sourceMappingURL=DataList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataList.d.ts","sourceRoot":"","sources":["../../../src/DataList/DataList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD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;IAC9C,UAAU,CAAC,EAAE,kBAAkB,CAAC,OAAO,KAAK,CAAC,CAAC;CAC/C,CAAC;AAsBF,QAAA,MAAM,QAAQ;yCA7G+C,SAAS;oDAWnE,aAAa;+FAwBb,UAAU;0BA0CgB,UAAU;gGAqBpC,SAAS;CAiBX,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegraph/data-list",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Flexible data list component for displaying label-value pairs in a structured, composable format.",
5
5
  "repository": "https://github.com/knocklabs/telegraph/tree/main/packages/data-list",
6
6
  "author": "@knocklabs",
@@ -33,6 +33,7 @@
33
33
  "@telegraph/helpers": "^0.0.13",
34
34
  "@telegraph/icon": "^0.3.1",
35
35
  "@telegraph/layout": "^0.3.0",
36
+ "@telegraph/tooltip": "^0.0.59",
36
37
  "@telegraph/typography": "^0.1.26"
37
38
  },
38
39
  "devDependencies": {