@dust-tt/sparkle 0.2.286 → 0.2.287-rc-1

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.
Files changed (33) hide show
  1. package/dist/cjs/index.js +31 -16
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/esm/components/Input.d.ts +6 -2
  4. package/dist/esm/components/Input.d.ts.map +1 -1
  5. package/dist/esm/components/Input.js +22 -4
  6. package/dist/esm/components/Input.js.map +1 -1
  7. package/dist/esm/components/LinkWrapper.d.ts +4 -3
  8. package/dist/esm/components/LinkWrapper.d.ts.map +1 -1
  9. package/dist/esm/components/LinkWrapper.js +3 -3
  10. package/dist/esm/components/LinkWrapper.js.map +1 -1
  11. package/dist/esm/components/NavigationList.d.ts.map +1 -1
  12. package/dist/esm/components/NavigationList.js +1 -1
  13. package/dist/esm/components/NavigationList.js.map +1 -1
  14. package/dist/esm/components/NewDropdown.d.ts.map +1 -1
  15. package/dist/esm/components/NewDropdown.js +3 -3
  16. package/dist/esm/components/NewDropdown.js.map +1 -1
  17. package/dist/esm/components/Tabs.d.ts.map +1 -1
  18. package/dist/esm/components/Tabs.js +1 -1
  19. package/dist/esm/components/Tabs.js.map +1 -1
  20. package/dist/esm/stories/Input.stories.d.ts.map +1 -1
  21. package/dist/esm/stories/Input.stories.js +11 -11
  22. package/dist/esm/stories/Input.stories.js.map +1 -1
  23. package/dist/esm/stories/NewDropdown.stories.js +1 -1
  24. package/dist/esm/stories/NewDropdown.stories.js.map +1 -1
  25. package/dist/sparkle.css +0 -5
  26. package/package.json +1 -1
  27. package/src/components/Input.tsx +41 -9
  28. package/src/components/LinkWrapper.tsx +8 -5
  29. package/src/components/NavigationList.tsx +1 -0
  30. package/src/components/NewDropdown.tsx +20 -16
  31. package/src/components/Tabs.tsx +1 -0
  32. package/src/stories/Input.stories.tsx +23 -21
  33. package/src/stories/NewDropdown.stories.tsx +0 -1
package/dist/cjs/index.js CHANGED
@@ -460,9 +460,9 @@ var SvgImage$1 = function (props) { return (React__namespace.createElement("svg"
460
460
  React__namespace.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M2 21V3h20v18H2Zm18-6V5H4v14L14 9l6 6Z", clipRule: "evenodd" }))); };
461
461
  var SvgImage$2 = SvgImage$1;
462
462
 
463
- var SvgInformationCircle$2 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
463
+ var SvgInformationCircle$1 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
464
464
  React__namespace.createElement("path", { fill: "currentColor", d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10Zm-1-11v6h2v-6h-2Zm0-4v2h2V7h-2Z" }))); };
465
- var InformationCircleIcon = SvgInformationCircle$2;
465
+ var InformationCircleIcon = SvgInformationCircle$1;
466
466
 
467
467
  var SvgKey$2 = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
468
468
  React__namespace.createElement("path", { fill: "currentColor", d: "m10.313 11.566 7.94-7.94 2.121 2.12-1.414 1.415 2.121 2.121-3.535 3.536-2.121-2.121-2.99 2.99a5.002 5.002 0 0 1-7.97 5.848 5 5 0 0 1 5.848-7.97Zm-.899 5.848a2 2 0 1 0-2.828-2.828 2 2 0 0 0 2.828 2.828Z" }))); };
@@ -43484,7 +43484,7 @@ var ImageStrokeIcon = SvgImage;
43484
43484
 
43485
43485
  var SvgInformationCircle = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
43486
43486
  React__namespace.createElement("path", { fill: "currentColor", d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10Zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM11 7h2v2h-2V7Zm0 4h2v6h-2v-6Z" }))); };
43487
- var SvgInformationCircle$1 = SvgInformationCircle;
43487
+ var InformationCircleStrokeIcon = SvgInformationCircle;
43488
43488
 
43489
43489
  var SvgKey = function (props) { return (React__namespace.createElement("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24" }, props),
43490
43490
  React__namespace.createElement("path", { fill: "currentColor", d: "m10.758 11.828 7.849-7.849 1.414 1.414-1.414 1.414 2.474 2.475-1.414 1.415-2.475-2.475-1.414 1.414 2.121 2.121-1.414 1.414-2.121-2.12-2.192 2.191a5.002 5.002 0 0 1-7.708 6.293 5 5 0 0 1 6.294-7.707Zm-.637 6.293A3 3 0 1 0 5.88 13.88a3 3 0 0 0 4.242 4.242Z" }))); };
@@ -85122,11 +85122,24 @@ function IconToggleButton(_a) {
85122
85122
  return tooltip ? (React.createElement(Tooltip, { trigger: IconButtonToggleContent, label: tooltip, side: tooltipPosition })) : (IconButtonToggleContent);
85123
85123
  }
85124
85124
 
85125
+ var messageVariantStyles = {
85126
+ info: "s-text-muted-foreground",
85127
+ default: "s-text-muted-foreground",
85128
+ error: "s-text-foreground-warning",
85129
+ };
85125
85130
  var stateVariantStyles = {
85126
85131
  default: "focus-visible:s-ring-ring",
85127
85132
  disabled: "disabled:s-cursor-not-allowed disabled:s-opacity-50 disabled:s-text-muted-foreground",
85128
85133
  error: "s-border-border-warning focus:s-ring-ring-warning",
85129
85134
  };
85135
+ var messageVariant = cva("", {
85136
+ variants: {
85137
+ status: messageVariantStyles,
85138
+ },
85139
+ defaultVariants: {
85140
+ status: "info",
85141
+ },
85142
+ });
85130
85143
  var inputStyleClasses = cva(cn("s-text-sm s-bg-background s-rounded-xl s-border s-border-border-dark s-flex s-h-9 s-w-full s-px-3 s-py-1.5 ", "file:s-border-0 file:s-bg-transparent file:s-text-sm file:s-font-medium file:s-text-foreground", "placeholder:s-text-muted-foreground", "focus-visible:s-outline-none focus-visible:s-ring-2 focus-visible:s-ring-offset-2 focus-visible:s-border-border-dark"), {
85131
85144
  variants: {
85132
85145
  state: stateVariantStyles,
@@ -85136,22 +85149,24 @@ var inputStyleClasses = cva(cn("s-text-sm s-bg-background s-rounded-xl s-border
85136
85149
  },
85137
85150
  });
85138
85151
  var Input = React.forwardRef(function (_a, ref) {
85139
- var className = _a.className, error = _a.error, value = _a.value, label = _a.label, disabled = _a.disabled, _b = _a.showErrorLabel, showErrorLabel = _b === void 0 ? false : _b, props = __rest(_a, ["className", "error", "value", "label", "disabled", "showErrorLabel"]);
85140
- var state = error ? "error" : disabled ? "disabled" : "default";
85141
- return (React.createElement("div", { className: "s-flex s-flex-col s-gap-1 s-px-1" },
85152
+ var className = _a.className, message = _a.message, messageStatus = _a.messageStatus, value = _a.value, label = _a.label, isError = _a.isError, disabled = _a.disabled, props = __rest(_a, ["className", "message", "messageStatus", "value", "label", "isError", "disabled"]);
85153
+ var state = isError ? "error" : disabled ? "disabled" : "default";
85154
+ return (React.createElement("div", { className: "s-flex s-flex-col s-gap-1" },
85142
85155
  label && React.createElement(Label$1, { htmlFor: props.name }, label),
85143
85156
  React.createElement("input", __assign({ ref: ref, className: cn(inputStyleClasses({ state: state }), className), "data-1p-ignore": props.type !== "password", value: value !== null && value !== void 0 ? value : undefined, disabled: disabled }, props)),
85144
- showErrorLabel && error && (React.createElement("div", { className: "s-ml-3.5 s-text-xs s-text-foreground-warning" }, error))));
85157
+ message && (React.createElement("div", { className: cn("s-ml-3.5 s-flex s-items-center s-gap-1 s-text-xs", messageVariant({ status: messageStatus })) },
85158
+ messageStatus === "info" && (React.createElement(Icon, { visual: InformationCircleStrokeIcon, size: "xs" })),
85159
+ message))));
85145
85160
  });
85146
85161
  Input.displayName = "Input";
85147
85162
 
85148
85163
  function LinkWrapper(_a) {
85149
- var children = _a.children, href = _a.href, rel = _a.rel, replace = _a.replace, shallow = _a.shallow, target = _a.target;
85164
+ var href = _a.href, target = _a.target, rel = _a.rel, replace = _a.replace, shallow = _a.shallow, className = _a.className, children = _a.children;
85150
85165
  var components = React.useContext(SparkleContext).components;
85151
85166
  if (href) {
85152
- return (React.createElement(components.link, { href: href, target: target, rel: rel, replace: replace, shallow: shallow }, children));
85167
+ return (React.createElement(components.link, { href: href, target: target, rel: rel, replace: replace, shallow: shallow, className: className }, children));
85153
85168
  }
85154
- return children;
85169
+ return React.createElement(React.Fragment, null, children);
85155
85170
  }
85156
85171
 
85157
85172
  function ok$2() {}
@@ -106734,7 +106749,7 @@ var NavigationListItem = React__namespace.forwardRef(function (_a, ref) {
106734
106749
  icon && React__namespace.createElement(Icon, { visual: icon, size: "sm" }),
106735
106750
  label && (React__namespace.createElement("span", { className: "s-grow s-overflow-hidden s-text-ellipsis s-whitespace-nowrap" }, label)),
106736
106751
  selected && moreMenu && (React__namespace.createElement("div", { className: "-s-mr-2 s-flex s-h-4 s-items-center" }, moreMenu)))));
106737
- return (React__namespace.createElement(LinkWrapper, { href: href, target: target, rel: rel, replace: replace, shallow: shallow }, content));
106752
+ return (React__namespace.createElement(LinkWrapper, { href: href, target: target, rel: rel, replace: replace, shallow: shallow, className: className }, content));
106738
106753
  });
106739
106754
  NavigationListItem.displayName = "NavigationListItem";
106740
106755
  var variantStyles = cva("", {
@@ -109791,9 +109806,9 @@ var NewDropdownMenuContent = React__namespace.forwardRef(function (_a, ref) {
109791
109806
  NewDropdownMenuContent.displayName = Content2.displayName;
109792
109807
  var NewDropdownMenuItem = React__namespace.forwardRef(function (_a, ref) {
109793
109808
  var children = _a.children, variant = _a.variant, description = _a.description, className = _a.className, inset = _a.inset, icon = _a.icon, label = _a.label, href = _a.href, target = _a.target, rel = _a.rel, asChild = _a.asChild, replace = _a.replace, shallow = _a.shallow, props = __rest(_a, ["children", "variant", "description", "className", "inset", "icon", "label", "href", "target", "rel", "asChild", "replace", "shallow"]);
109794
- return (React__namespace.createElement(Item2$1, __assign({ ref: ref, className: cn(menuStyleClasses.item({ variant: variant }), inset ? menuStyleClasses.inset : "", className) }, props, { asChild: asChild }),
109795
- React__namespace.createElement(LinkWrapper, { href: href, target: target, rel: rel, replace: replace, shallow: shallow },
109796
- React__namespace.createElement(ItemWithLabelIconAndDescription, { label: label, icon: icon, description: description }, children))));
109809
+ var content = (React__namespace.createElement(Item2$1, __assign({ ref: ref, className: cn(menuStyleClasses.item({ variant: variant }), inset ? menuStyleClasses.inset : "", className) }, props, { asChild: !!href || asChild }),
109810
+ React__namespace.createElement(ItemWithLabelIconAndDescription, { label: label, icon: icon, description: description }, children)));
109811
+ return (React__namespace.createElement(LinkWrapper, { href: href, target: target, rel: rel, replace: replace, shallow: shallow }, content));
109797
109812
  });
109798
109813
  NewDropdownMenuItem.displayName = Item2$1.displayName;
109799
109814
  var NewDropdownMenuCheckboxItem = React__namespace.forwardRef(function (_a, ref) {
@@ -112794,7 +112809,7 @@ var TabsTrigger = React__namespace.forwardRef(function (_a, ref) {
112794
112809
  var content = (React__namespace.createElement(Trigger, __assign({ ref: ref, className: cn("s-border-0 s-border-b-2 s-border-primary-800/0 s-pb-1 disabled:s-pointer-events-none data-[state=active]:s-border-primary-800", className), asChild: true }, props),
112795
112810
  React__namespace.createElement("div", null,
112796
112811
  React__namespace.createElement(Button, { variant: "ghost", size: "sm", label: label, icon: icon }))));
112797
- return (React__namespace.createElement(LinkWrapper, { href: href, target: target, rel: rel, replace: replace, shallow: shallow }, content));
112812
+ return (React__namespace.createElement(LinkWrapper, { href: href, target: target, rel: rel, replace: replace, shallow: shallow, className: className }, content));
112798
112813
  });
112799
112814
  var TabsContent = React__namespace.forwardRef(function (_a, ref) {
112800
112815
  var className = _a.className, props = __rest(_a, ["className"]);
@@ -113317,7 +113332,7 @@ exports.IconToggleButton = IconToggleButton;
113317
113332
  exports.ImageIcon = SvgImage$2;
113318
113333
  exports.ImageStrokeIcon = ImageStrokeIcon;
113319
113334
  exports.InformationCircleIcon = InformationCircleIcon;
113320
- exports.InformationCircleStrokeIcon = SvgInformationCircle$1;
113335
+ exports.InformationCircleStrokeIcon = InformationCircleStrokeIcon;
113321
113336
  exports.Input = Input;
113322
113337
  exports.IntercomLogo = IntercomLogo;
113323
113338
  exports.Item = Item$3;