@syscore/ui-library 2.0.0-beta-publish-workflow-beta.1 → 2.0.0-beta-publish-workflow-beta.3

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.
@@ -2,20 +2,20 @@ import * as React from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
3
  import { Pencil } from "lucide-react";
4
4
  import {
5
- TableV01,
6
- TableV01Action,
7
- TableV01Body,
8
- TableV01Cell,
9
- TableV01Header,
10
- TableV01HeaderCell,
11
- TableV01Row,
12
- type TableV01Align,
13
- type TableV01Density,
14
- } from "../../components/ui/table-v01";
5
+ Table,
6
+ TableAction,
7
+ TableBody,
8
+ TableCell,
9
+ TableHeader,
10
+ TableHeaderCell,
11
+ TableRow,
12
+ type TableAlign,
13
+ type TableDensity,
14
+ } from "../../components/ui/table";
15
15
 
16
16
  const meta = {
17
17
  title: "Components/Table",
18
- component: TableV01,
18
+ component: Table,
19
19
  tags: ["autodocs"],
20
20
  parameters: {
21
21
  layout: "padded",
@@ -26,36 +26,36 @@ const meta = {
26
26
  "",
27
27
  "```tsx",
28
28
  `import {`,
29
- ` TableV01, TableV01Header, TableV01Body, TableV01Footer, TableV01Row,`,
30
- ` TableV01HeaderCell, TableV01Cell, TableV01Tag, TableV01Action,`,
29
+ ` Table, TableHeader, TableBody, TableFooter, TableRow,`,
30
+ ` TableHeaderCell, TableCell, TableTag, TableAction,`,
31
31
  `} from "@syscore/ui-library"`,
32
32
  "",
33
- '<TableV01 density="compact">',
34
- " <TableV01Header>",
35
- " <TableV01Row>",
36
- ' <TableV01HeaderCell label="Concept" />',
37
- ' <TableV01HeaderCell label="Actions" align="right" />',
38
- " </TableV01Row>",
39
- " </TableV01Header>",
40
- " <TableV01Body>",
41
- " <TableV01Row>",
42
- ' <TableV01Cell text="Thermal comfort" tag="T4.1" />',
43
- ' <TableV01Cell align="right" action={<TableV01Action>…</TableV01Action>} />',
44
- " </TableV01Row>",
45
- " </TableV01Body>",
46
- "</TableV01>",
33
+ '<Table density="compact">',
34
+ " <TableHeader>",
35
+ " <TableRow>",
36
+ ' <TableHeaderCell label="Concept" />',
37
+ ' <TableHeaderCell label="Actions" align="right" />',
38
+ " </TableRow>",
39
+ " </TableHeader>",
40
+ " <TableBody>",
41
+ " <TableRow>",
42
+ ' <TableCell text="Thermal comfort" tag="T4.1" />',
43
+ ' <TableCell align="right" action={<TableAction>…</TableAction>} />',
44
+ " </TableRow>",
45
+ " </TableBody>",
46
+ "</Table>",
47
47
  "```",
48
48
  "",
49
49
  "### Props",
50
50
  "",
51
51
  "| Component | Prop | Values | Default |",
52
52
  "|-----------|------|--------|---------|",
53
- "| `TableV01` | `density` | `compact` \\| `balanced` \\| `spacious` | `compact` |",
54
- "| `TableV01HeaderCell` | `label` | column label | — |",
53
+ "| `Table` | `density` | `compact` \\| `balanced` \\| `spacious` | `compact` |",
54
+ "| `TableHeaderCell` | `label` | column label | — |",
55
55
  "| | `align` | `left` \\| `center` \\| `right` | `left` |",
56
- "| `TableV01Cell` | `text` | cell text | — |",
56
+ "| `TableCell` | `text` | cell text | — |",
57
57
  "| | `tag` | wrapped in the code tag automatically | — |",
58
- "| | `action` | one or more `TableV01Action` | — |",
58
+ "| | `action` | one or more `TableAction` | — |",
59
59
  "| | `align` | `left` \\| `center` \\| `right` | `left` |",
60
60
  "",
61
61
  "Mix `text`, `tag` and `action` freely — they render in that order. `children`",
@@ -77,14 +77,14 @@ const meta = {
77
77
  },
78
78
  },
79
79
  },
80
- } satisfies Meta<typeof TableV01>;
80
+ } satisfies Meta<typeof Table>;
81
81
 
82
82
  export default meta;
83
83
 
84
84
  /** Density and alignment as controls; the three columns show one layout each. */
85
85
  type StoryArgs = {
86
- density: TableV01Density;
87
- align: TableV01Align;
86
+ density: TableDensity;
87
+ align: TableAlign;
88
88
  };
89
89
 
90
90
  type Story = StoryObj<StoryArgs>;
@@ -110,9 +110,9 @@ const ROWS = [
110
110
 
111
111
  /** A cell holds a single icon action; pass a fragment for more. */
112
112
  const action = (label: string) => (
113
- <TableV01Action aria-label={`Edit ${label}`}>
113
+ <TableAction aria-label={`Edit ${label}`}>
114
114
  <Pencil strokeWidth={1.5} />
115
- </TableV01Action>
115
+ </TableAction>
116
116
  );
117
117
 
118
118
  /**
@@ -121,7 +121,7 @@ const action = (label: string) => (
121
121
  */
122
122
  function contentStory(
123
123
  headers: [string, string, string],
124
- cell: (row: (typeof ROWS)[number], align: TableV01Align) => React.ReactNode,
124
+ cell: (row: (typeof ROWS)[number], align: TableAlign) => React.ReactNode,
125
125
  story: string,
126
126
  ): Story {
127
127
  return {
@@ -129,24 +129,24 @@ function contentStory(
129
129
  args: { density: "compact", align: "left" },
130
130
  parameters: { docs: { description: { story } } },
131
131
  render: ({ density, align }) => (
132
- <TableV01 density={density} containerClassName="sb-table-triple">
133
- <TableV01Header>
134
- <TableV01Row>
132
+ <Table density={density} containerClassName="sb-table-triple">
133
+ <TableHeader>
134
+ <TableRow>
135
135
  {headers.map((label) => (
136
- <TableV01HeaderCell key={label} label={label} align={align} />
136
+ <TableHeaderCell key={label} label={label} align={align} />
137
137
  ))}
138
- </TableV01Row>
139
- </TableV01Header>
140
- <TableV01Body>
138
+ </TableRow>
139
+ </TableHeader>
140
+ <TableBody>
141
141
  {ROWS.map((row) => (
142
- <TableV01Row key={row.tag}>
142
+ <TableRow key={row.tag}>
143
143
  {headers.map((label) => (
144
144
  <React.Fragment key={label}>{cell(row, align)}</React.Fragment>
145
145
  ))}
146
- </TableV01Row>
146
+ </TableRow>
147
147
  ))}
148
- </TableV01Body>
149
- </TableV01>
148
+ </TableBody>
149
+ </Table>
150
150
  ),
151
151
  };
152
152
  }
@@ -154,7 +154,7 @@ function contentStory(
154
154
  export const WithText: Story = {
155
155
  ...contentStory(
156
156
  ["Concept", "Strategy", "Status"],
157
- (row, align) => <TableV01Cell text={row.text} align={align} />,
157
+ (row, align) => <TableCell text={row.text} align={align} />,
158
158
  "Text cells — pass the `text` prop.",
159
159
  ),
160
160
  name: "With text",
@@ -163,7 +163,7 @@ export const WithText: Story = {
163
163
  export const WithTag: Story = {
164
164
  ...contentStory(
165
165
  ["Code", "Strategy", "Reference"],
166
- (row, align) => <TableV01Cell tag={row.tag} align={align} />,
166
+ (row, align) => <TableCell tag={row.tag} align={align} />,
167
167
  "Tag cells — pass `tag` and it is wrapped in the code tag automatically.",
168
168
  ),
169
169
  name: "With tag",
@@ -172,8 +172,8 @@ export const WithTag: Story = {
172
172
  export const WithAction: Story = {
173
173
  ...contentStory(
174
174
  ["Actions", "Review", "Archive"],
175
- (row, align) => <TableV01Cell action={action(row.text)} align={align} />,
176
- "Action cells — pass one or more `TableV01Action` to `action`.",
175
+ (row, align) => <TableCell action={action(row.text)} align={align} />,
176
+ "Action cells — pass one or more `TableAction` to `action`.",
177
177
  ),
178
178
  name: "With action",
179
179
  };
@@ -181,9 +181,7 @@ export const WithAction: Story = {
181
181
  export const TextAndTag: Story = {
182
182
  ...contentStory(
183
183
  ["Concept", "Strategy", "Feature"],
184
- (row, align) => (
185
- <TableV01Cell text={row.text} tag={row.tag} align={align} />
186
- ),
184
+ (row, align) => <TableCell text={row.text} tag={row.tag} align={align} />,
187
185
  "Text and tag on the same cell.",
188
186
  ),
189
187
  name: "Text + tag",
@@ -193,7 +191,7 @@ export const TextAndAction: Story = {
193
191
  ...contentStory(
194
192
  ["Concept", "Strategy", "Actions"],
195
193
  (row, align) => (
196
- <TableV01Cell text={row.text} action={action(row.text)} align={align} />
194
+ <TableCell text={row.text} action={action(row.text)} align={align} />
197
195
  ),
198
196
  "Text and an action on the same cell.",
199
197
  ),
@@ -218,37 +216,37 @@ export const AllVariants: Story = {
218
216
  <span className="sb-table-density-label font-mazzardSoft">
219
217
  {density}
220
218
  </span>
221
- <TableV01 density={density}>
222
- <TableV01Header>
223
- <TableV01Row>
224
- <TableV01HeaderCell label="Align" />
225
- <TableV01HeaderCell label="Text only" />
226
- <TableV01HeaderCell label="Tag only" />
227
- <TableV01HeaderCell label="Text + tag" />
228
- <TableV01HeaderCell label="Text + action" />
229
- <TableV01HeaderCell label="Action only" />
230
- </TableV01Row>
231
- </TableV01Header>
232
- <TableV01Body>
219
+ <Table density={density}>
220
+ <TableHeader>
221
+ <TableRow>
222
+ <TableHeaderCell label="Align" />
223
+ <TableHeaderCell label="Text only" />
224
+ <TableHeaderCell label="Tag only" />
225
+ <TableHeaderCell label="Text + tag" />
226
+ <TableHeaderCell label="Text + action" />
227
+ <TableHeaderCell label="Action only" />
228
+ </TableRow>
229
+ </TableHeader>
230
+ <TableBody>
233
231
  {(["left", "center", "right"] as const).map((align, index) => {
234
232
  const row = ROWS[index];
235
233
  return (
236
- <TableV01Row key={align}>
237
- <TableV01Cell text={align} />
238
- <TableV01Cell text={row.text} align={align} />
239
- <TableV01Cell tag={row.tag} align={align} />
240
- <TableV01Cell text={row.text} tag={row.tag} align={align} />
241
- <TableV01Cell
234
+ <TableRow key={align}>
235
+ <TableCell text={align} />
236
+ <TableCell text={row.text} align={align} />
237
+ <TableCell tag={row.tag} align={align} />
238
+ <TableCell text={row.text} tag={row.tag} align={align} />
239
+ <TableCell
242
240
  text={row.text}
243
241
  action={action(row.text)}
244
242
  align={align}
245
243
  />
246
- <TableV01Cell action={action(row.text)} align={align} />
247
- </TableV01Row>
244
+ <TableCell action={action(row.text)} align={align} />
245
+ </TableRow>
248
246
  );
249
247
  })}
250
- </TableV01Body>
251
- </TableV01>
248
+ </TableBody>
249
+ </Table>
252
250
  </div>
253
251
  ))}
254
252
  </div>