@dust-tt/sparkle 0.5.10 → 0.5.11

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.
@@ -41,12 +41,12 @@ declare const animation: {
41
41
  to: number[];
42
42
  ti: number[];
43
43
  } | {
44
- t: number;
45
- s: number[];
46
44
  i?: undefined;
47
45
  o?: undefined;
48
46
  to?: undefined;
49
47
  ti?: undefined;
48
+ t: number;
49
+ s: number[];
50
50
  })[];
51
51
  ix: number;
52
52
  l: number;
@@ -68,6 +68,19 @@ declare const animation: {
68
68
  shapes: {
69
69
  ty: string;
70
70
  it: ({
71
+ o?: undefined;
72
+ c?: undefined;
73
+ bm?: undefined;
74
+ p?: undefined;
75
+ a?: undefined;
76
+ s?: undefined;
77
+ sk?: undefined;
78
+ sa?: undefined;
79
+ r?: undefined;
80
+ w?: undefined;
81
+ lc?: undefined;
82
+ lj?: undefined;
83
+ ml?: undefined;
71
84
  ind: number;
72
85
  ty: string;
73
86
  ix: number;
@@ -90,6 +103,8 @@ declare const animation: {
90
103
  c: boolean;
91
104
  }[];
92
105
  } | {
106
+ i?: undefined;
107
+ o?: undefined;
93
108
  t: number;
94
109
  s: {
95
110
  i: number[][];
@@ -97,28 +112,22 @@ declare const animation: {
97
112
  v: number[][];
98
113
  c: boolean;
99
114
  }[];
100
- i?: undefined;
101
- o?: undefined;
102
115
  })[];
103
116
  ix: number;
104
117
  };
105
118
  nm: string;
106
119
  mn: string;
107
120
  hd: boolean;
108
- o?: undefined;
109
- c?: undefined;
110
- bm?: undefined;
121
+ } | {
111
122
  p?: undefined;
112
123
  a?: undefined;
113
124
  s?: undefined;
114
- r?: undefined;
115
125
  sk?: undefined;
116
126
  sa?: undefined;
117
- w?: undefined;
118
- lc?: undefined;
119
- lj?: undefined;
120
- ml?: undefined;
121
- } | {
127
+ ix?: undefined;
128
+ r?: undefined;
129
+ ind?: undefined;
130
+ ks?: undefined;
122
131
  ty: string;
123
132
  c: {
124
133
  a: number;
@@ -142,16 +151,19 @@ declare const animation: {
142
151
  nm: string;
143
152
  mn: string;
144
153
  hd: boolean;
145
- ind?: undefined;
146
- ix?: undefined;
147
- ks?: undefined;
154
+ } | {
148
155
  p?: undefined;
149
156
  a?: undefined;
150
157
  s?: undefined;
151
- r?: undefined;
152
158
  sk?: undefined;
153
159
  sa?: undefined;
154
- } | {
160
+ ix?: undefined;
161
+ ind?: undefined;
162
+ ks?: undefined;
163
+ w?: undefined;
164
+ lc?: undefined;
165
+ lj?: undefined;
166
+ ml?: undefined;
155
167
  ty: string;
156
168
  c: {
157
169
  a: number;
@@ -172,10 +184,10 @@ declare const animation: {
172
184
  t: number;
173
185
  s: number[];
174
186
  } | {
175
- t: number;
176
- s: number[];
177
187
  i?: undefined;
178
188
  o?: undefined;
189
+ t: number;
190
+ s: number[];
179
191
  })[];
180
192
  ix: number;
181
193
  };
@@ -184,19 +196,18 @@ declare const animation: {
184
196
  nm: string;
185
197
  mn: string;
186
198
  hd: boolean;
187
- ind?: undefined;
199
+ } | {
200
+ c?: undefined;
201
+ bm?: undefined;
202
+ mn?: undefined;
203
+ hd?: undefined;
188
204
  ix?: undefined;
205
+ ind?: undefined;
189
206
  ks?: undefined;
190
- p?: undefined;
191
- a?: undefined;
192
- s?: undefined;
193
- sk?: undefined;
194
- sa?: undefined;
195
207
  w?: undefined;
196
208
  lc?: undefined;
197
209
  lj?: undefined;
198
210
  ml?: undefined;
199
- } | {
200
211
  ty: string;
201
212
  p: {
202
213
  a: number;
@@ -234,17 +245,6 @@ declare const animation: {
234
245
  ix: number;
235
246
  };
236
247
  nm: string;
237
- ind?: undefined;
238
- ix?: undefined;
239
- ks?: undefined;
240
- c?: undefined;
241
- bm?: undefined;
242
- mn?: undefined;
243
- hd?: undefined;
244
- w?: undefined;
245
- lc?: undefined;
246
- lj?: undefined;
247
- ml?: undefined;
248
248
  })[];
249
249
  nm: string;
250
250
  np: number;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentChip.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/AttachmentChip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD,QAAA,MAAM,IAAI;;;;;;;CAO6B,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAWnC,eAAO,MAAM,QAAQ,EAAE,KAYtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAYnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAYvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAY5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAcnC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAa3B,CAAC"}
1
+ {"version":3,"file":"AttachmentChip.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/AttachmentChip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD,QAAA,MAAM,IAAI;;;;;;;CAO6B,CAAC;AAExC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAWnC,eAAO,MAAM,QAAQ,EAAE,KAYtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAYnB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAYvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAY5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAkBnC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAa3B,CAAC"}
@@ -60,7 +60,7 @@ export const LongLabel = {
60
60
  export const WithDoubleIcon = {
61
61
  args: {
62
62
  label: "My Drive Folder",
63
- icon: { mainIcon: FolderIcon, secondaryIcon: DriveLogo, size: "sm" },
63
+ doubleIcon: { mainIcon: FolderIcon, secondaryIcon: DriveLogo, size: "sm" },
64
64
  },
65
65
  decorators: [
66
66
  (Story) => (React.createElement(ParagraphWrapper, null,
@@ -70,7 +70,11 @@ export const WithDoubleIcon = {
70
70
  export const WithDoubleIconAndLink = {
71
71
  args: {
72
72
  label: "Notion Document",
73
- icon: { mainIcon: DocumentIcon, secondaryIcon: NotionLogo, size: "sm" },
73
+ doubleIcon: {
74
+ mainIcon: DocumentIcon,
75
+ secondaryIcon: NotionLogo,
76
+ size: "sm",
77
+ },
74
78
  href: "https://notion.so",
75
79
  target: "_blank",
76
80
  },
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentChip.stories.js","sourceRoot":"","sources":["../../../src/stories/AttachmentChip.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;CACmB,CAAC;AAExC,eAAe,IAAI,CAAC;AAGpB,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE,CAAC,CACxE,6BAAK,SAAS,EAAC,gDAAgD;IAC7D,2BAAG,SAAS,EAAC,6CAA6C;QACxD,8BAAM,SAAS,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,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;KACrE;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAU;IAC1C,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;QACvE,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,QAAQ;KACjB;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;QAC9B,KAAK,EAAE,SAAS;KACjB;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"AttachmentChip.stories.js","sourceRoot":"","sources":["../../../src/stories/AttachmentChip.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE;QACV,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,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;KAC3E;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAU;IAC1C,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE;YACV,QAAQ,EAAE,YAAY;YACtB,aAAa,EAAE,UAAU;YACzB,IAAI,EAAE,IAAI;SACX;QACD,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,QAAQ;KACjB;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,IAAI,EAAE;QACJ,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;QAC9B,KAAK,EAAE,SAAS;KACjB;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,oBAAC,gBAAgB;YACf,oBAAC,KAAK,OAAG,CACQ,CACpB;KACF;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
6
6
  "tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
@@ -12,38 +12,43 @@ const attachmentChipOverrides = cn(
12
12
  "dark:s-bg-background-night dark:s-text-foreground-night"
13
13
  );
14
14
 
15
- type AttachmentChipIconProps = IconProps | DoubleIconProps;
15
+ export type AttachmentChipIconProps = IconProps;
16
+ export type AttachmentChipDoubleIconProps = DoubleIconProps;
16
17
 
17
- function isDoubleIconProps(
18
- props: AttachmentChipIconProps
19
- ): props is DoubleIconProps {
20
- return "mainIcon" in props;
21
- }
18
+ type AttachmentChipIconOptions =
19
+ | { icon?: AttachmentChipIconProps; doubleIcon?: never }
20
+ | { icon?: never; doubleIcon?: AttachmentChipDoubleIconProps };
22
21
 
23
- interface AttachmentChipBaseProps {
22
+ export type AttachmentChipBaseProps = AttachmentChipIconOptions & {
24
23
  label: string;
25
- icon?: AttachmentChipIconProps;
26
24
  size?: (typeof CHIP_SIZES)[number];
27
25
  color?: (typeof CHIP_COLORS)[number];
28
26
  className?: string;
29
27
  isBusy?: boolean;
30
28
  onRemove?: () => void;
31
- onClick?: () => void;
32
- }
29
+ children?: never;
30
+ };
33
31
 
34
- type AttachmentChipButtonProps = AttachmentChipBaseProps & {
32
+ export type AttachmentChipButtonProps = AttachmentChipBaseProps & {
35
33
  href?: never;
34
+ onClick?: () => void;
36
35
  } & {
37
36
  [K in keyof Omit<LinkWrapperProps, "children">]?: never;
38
37
  };
39
38
 
40
- type AttachmentChipLinkProps = AttachmentChipBaseProps &
41
- Omit<LinkWrapperProps, "children">;
39
+ export type AttachmentChipLinkProps = AttachmentChipBaseProps &
40
+ Omit<LinkWrapperProps, "children" | "href"> & {
41
+ href: string;
42
+ onClick?: never;
43
+ };
42
44
 
43
- type AttachmentChipProps = AttachmentChipButtonProps | AttachmentChipLinkProps;
45
+ export type AttachmentChipProps =
46
+ | AttachmentChipButtonProps
47
+ | AttachmentChipLinkProps;
44
48
 
45
49
  export function AttachmentChip({
46
50
  icon,
51
+ doubleIcon,
47
52
  className,
48
53
  label,
49
54
  size,
@@ -53,14 +58,13 @@ export function AttachmentChip({
53
58
  onClick,
54
59
  ...linkProps
55
60
  }: AttachmentChipProps) {
56
- const iconElement = icon && (
61
+ const chipClassName = cn(attachmentChipOverrides, className);
62
+ const iconElement = (icon || doubleIcon) && (
57
63
  <div className="s-shrink-0">
58
- {isDoubleIconProps(icon) ? <DoubleIcon {...icon} /> : <Icon {...icon} />}
64
+ {doubleIcon ? <DoubleIcon {...doubleIcon} /> : <Icon {...icon} />}
59
65
  </div>
60
66
  );
61
67
 
62
- const chipClassName = cn(attachmentChipOverrides, className);
63
-
64
68
  if ("href" in linkProps && linkProps.href) {
65
69
  return (
66
70
  <Chip
@@ -85,7 +85,7 @@ export const LongLabel: Story = {
85
85
  export const WithDoubleIcon: Story = {
86
86
  args: {
87
87
  label: "My Drive Folder",
88
- icon: { mainIcon: FolderIcon, secondaryIcon: DriveLogo, size: "sm" },
88
+ doubleIcon: { mainIcon: FolderIcon, secondaryIcon: DriveLogo, size: "sm" },
89
89
  },
90
90
  decorators: [
91
91
  (Story) => (
@@ -99,7 +99,11 @@ export const WithDoubleIcon: Story = {
99
99
  export const WithDoubleIconAndLink: Story = {
100
100
  args: {
101
101
  label: "Notion Document",
102
- icon: { mainIcon: DocumentIcon, secondaryIcon: NotionLogo, size: "sm" },
102
+ doubleIcon: {
103
+ mainIcon: DocumentIcon,
104
+ secondaryIcon: NotionLogo,
105
+ size: "sm",
106
+ },
103
107
  href: "https://notion.so",
104
108
  target: "_blank",
105
109
  },