@dust-tt/sparkle 0.2.199 → 0.2.201

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.199",
3
+ "version": "0.2.201",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && rollup -c",
6
6
  "build:with-tw-base": "rollup -c --environment INCLUDE_TW_BASE:true",
@@ -22,6 +22,7 @@ interface DataTableProps<TData, TValue> {
22
22
  className?: string;
23
23
  filter?: string;
24
24
  filterColumn?: string;
25
+ initialColumnOrder?: SortingState;
25
26
  }
26
27
 
27
28
  export function DataTable<TData, TValue>({
@@ -30,8 +31,11 @@ export function DataTable<TData, TValue>({
30
31
  className,
31
32
  filter,
32
33
  filterColumn,
34
+ initialColumnOrder,
33
35
  }: DataTableProps<TData, TValue>) {
34
- const [sorting, setSorting] = useState<SortingState>([]);
36
+ const [sorting, setSorting] = useState<SortingState>(
37
+ initialColumnOrder ?? []
38
+ );
35
39
  const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
36
40
 
37
41
  const table = useReactTable({
@@ -79,8 +83,9 @@ export function DataTable<TData, TValue>({
79
83
  ? ArrowDownIcon
80
84
  : ArrowDownIcon
81
85
  }
86
+ size="xs"
82
87
  className={classNames(
83
- "s-ml-1 s-w-2.5 s-font-extralight",
88
+ "s-ml-1",
84
89
  header.column.getIsSorted()
85
90
  ? "s-opacity-100"
86
91
  : "s-opacity-0"
@@ -197,7 +202,7 @@ DataTable.Row = function Row({
197
202
  <tr
198
203
  className={classNames(
199
204
  "s-border-b s-border-structure-200 s-text-sm",
200
- onClick ? "s-cursor-pointer" : "",
205
+ onClick ? "s-cursor-pointer hover:s-bg-gray-50" : "",
201
206
  className || ""
202
207
  )}
203
208
  onClick={onClick ? onClick : undefined}
@@ -12,13 +12,14 @@ import { Icon } from "./Icon";
12
12
  import { Tooltip } from "./Tooltip";
13
13
 
14
14
  type TabType<E> = {
15
- label: string;
16
- id?: E;
17
- hideLabel?: boolean;
18
15
  current: boolean;
19
- sizing?: "hug" | "expand";
20
- icon?: ComponentType<{ className?: string }>;
16
+ disabled?: boolean;
21
17
  hasSeparator?: boolean;
18
+ hideLabel?: boolean;
19
+ icon?: ComponentType<{ className?: string }>;
20
+ id?: E;
21
+ label: string;
22
+ sizing?: "hug" | "expand";
22
23
  } & (
23
24
  | { onClick?: (event: MouseEvent<HTMLAnchorElement>) => void; href?: never }
24
25
  | { onClick?: never; href: string }
@@ -137,7 +138,8 @@ export function Tab<E>({
137
138
  tabStateClasses.hover,
138
139
  tabStateClasses.dark.base,
139
140
  tabStateClasses.dark.hover,
140
- tabClassName
141
+ tabClassName,
142
+ tab.disabled ? "s-opacity-50 s-pointer-events-none" : ""
141
143
  );
142
144
 
143
145
  const finalIconClasses = classNames(
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
1
+ import type { Meta } from "@storybook/react";
2
2
  import { ColumnDef } from "@tanstack/react-table";
3
3
  import React from "react";
4
4
 
@@ -10,7 +10,6 @@ const meta = {
10
10
  } satisfies Meta<typeof DataTable>;
11
11
 
12
12
  export default meta;
13
- type Story = StoryObj<typeof meta>;
14
13
 
15
14
  type Data = {
16
15
  name: string;
@@ -27,7 +26,7 @@ type Data = {
27
26
  onMoreClick?: () => void;
28
27
  };
29
28
 
30
- const DataTableExample = () => {
29
+ export const DataTableExample = () => {
31
30
  const data: Data[] = [
32
31
  {
33
32
  name: "Marketing",
@@ -116,11 +115,11 @@ const DataTableExample = () => {
116
115
 
117
116
  return (
118
117
  <div className="s-w-full s-max-w-4xl s-overflow-x-auto">
119
- <DataTable data={data} columns={columns} />
118
+ <DataTable
119
+ data={data}
120
+ columns={columns}
121
+ initialColumnOrder={[{ id: "name", desc: false }]}
122
+ />
120
123
  </div>
121
124
  );
122
125
  };
123
-
124
- export const Default: Story = {
125
- render: () => <DataTableExample />,
126
- };
@@ -41,7 +41,15 @@ export const TabExample = () => {
41
41
  current: currentTab === "build",
42
42
  icon: RobotIcon,
43
43
  sizing: "expand",
44
+ },
45
+ {
46
+ label: "Admin",
47
+ id: "admin",
48
+ current: currentTab === "admin",
49
+ icon: RobotIcon,
50
+ sizing: "expand",
44
51
  hasSeparator: true,
52
+ disabled: true,
45
53
  },
46
54
  {
47
55
  label: "Settings",