@hyddenlabs/hydn-ui 0.3.0-alpha.210 → 0.3.0-alpha.211

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/dist/index.cjs CHANGED
@@ -4947,7 +4947,8 @@ function Checkbox({
4947
4947
  ariaLabel,
4948
4948
  id,
4949
4949
  name,
4950
- validationState = "neutral"
4950
+ validationState = "neutral",
4951
+ "aria-describedby": ariaDescribedby
4951
4952
  }) {
4952
4953
  const validationClasses = {
4953
4954
  neutral: "border-input focus:ring-ring",
@@ -4964,6 +4965,7 @@ function Checkbox({
4964
4965
  disabled,
4965
4966
  "aria-label": ariaLabel,
4966
4967
  "aria-invalid": validationState === "error",
4968
+ "aria-describedby": ariaDescribedby,
4967
4969
  id,
4968
4970
  name,
4969
4971
  className: `h-5 w-5 sm:h-4 sm:w-4 rounded border-2 bg-background text-primary-foreground transition-all duration-200 ease-in-out focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted/50 checked:bg-primary checked:border-primary checked:hover:bg-primary/90 hover:border-primary/50 hover:shadow-sm cursor-pointer accent-primary ${validationClasses[validationState]} ${className}`
@@ -5224,8 +5226,15 @@ function DataTable({
5224
5226
  const badgeConfig = column.badgeMap[stringValue] || column.badgeMap["*"] || { variant: "neutral" };
5225
5227
  return /* @__PURE__ */ jsxRuntime.jsx(badge_default, { variant: badgeConfig.variant || "neutral", size: column.componentSize || "md", children: badgeConfig.label || stringValue });
5226
5228
  }
5227
- if (column.renderAsChips && Array.isArray(value)) {
5228
- return /* @__PURE__ */ jsxRuntime.jsx(stack_default, { direction: "horizontal", spacing: "xs", wrap: true, children: value.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(chip_default, { variant: column.chipVariant || "neutral", size: column.componentSize || "md", children: String(item) }, idx)) });
5229
+ if (column.renderAsBadges) {
5230
+ if (Array.isArray(value)) {
5231
+ if (value.length === 0 && column.fallback !== void 0) {
5232
+ return column.fallback;
5233
+ }
5234
+ return /* @__PURE__ */ jsxRuntime.jsx(stack_default, { direction: "horizontal", spacing: "xs", wrap: true, children: value.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(badge_default, { variant: column.badgeVariant || "neutral", size: column.componentSize || "md", children: String(item) }, idx)) });
5235
+ } else {
5236
+ return /* @__PURE__ */ jsxRuntime.jsx(badge_default, { variant: column.badgeVariant || "neutral", size: column.componentSize || "md", children: String(value) });
5237
+ }
5229
5238
  }
5230
5239
  if (column.format) {
5231
5240
  return formatValue(value, column);
@@ -5823,6 +5832,48 @@ function ProgressBar({ value, max = 100, showLabel, variant = "neutral", classNa
5823
5832
  }
5824
5833
  ProgressBar.displayName = "ProgressBar";
5825
5834
  var progress_bar_default = ProgressBar;
5835
+ function Spinner({ size = "xl", variant = "primary", className = "", speed, ...props }) {
5836
+ const sizeConfig = spinnerSizes[size];
5837
+ const variantTopBorder = {
5838
+ primary: "border-t-primary",
5839
+ accent: "border-t-accent",
5840
+ neutral: "border-t-neutral"
5841
+ }[variant];
5842
+ const duration = speed ? `[animation-duration:${speed}]` : "";
5843
+ return /* @__PURE__ */ jsxRuntime.jsx(
5844
+ "div",
5845
+ {
5846
+ role: "status",
5847
+ "aria-label": "Loading",
5848
+ "data-variant": variant,
5849
+ className: `inline-block border-muted ${variantTopBorder} rounded-full animate-spin box-border ${duration} ${sizeConfig.classes} ${sizeConfig.border} ${className}`,
5850
+ ...props,
5851
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
5852
+ }
5853
+ );
5854
+ }
5855
+ Spinner.displayName = "Spinner";
5856
+ var spinner_default = Spinner;
5857
+ function LoadingContainer({
5858
+ minHeight = "50vh",
5859
+ containerProps,
5860
+ stackProps,
5861
+ spinnerProps
5862
+ }) {
5863
+ const { style: stackStyle, ...restStackProps } = stackProps ?? {};
5864
+ return /* @__PURE__ */ jsxRuntime.jsx(container_default, { marginX: "md", paddingY: "sm", ...containerProps, children: /* @__PURE__ */ jsxRuntime.jsx(
5865
+ stack_default,
5866
+ {
5867
+ direction: "vertical",
5868
+ align: "center",
5869
+ justify: "center",
5870
+ spacing: "md",
5871
+ style: { minHeight, ...stackStyle },
5872
+ ...restStackProps,
5873
+ children: /* @__PURE__ */ jsxRuntime.jsx(spinner_default, { ...spinnerProps })
5874
+ }
5875
+ ) });
5876
+ }
5826
5877
  function Skeleton({ variant = "text", width, height, className = "", ...props }) {
5827
5878
  const variantClasses = {
5828
5879
  text: "rounded h-4",
@@ -5931,28 +5982,6 @@ var smooth_transition_default = SmoothTransition;
5931
5982
  function useStaggeredTransition(count, baseDelay = 50) {
5932
5983
  return Array.from({ length: count }, (_, i) => i * baseDelay);
5933
5984
  }
5934
- function Spinner({ size = "xl", variant = "primary", className = "", speed, ...props }) {
5935
- const sizeConfig = spinnerSizes[size];
5936
- const variantTopBorder = {
5937
- primary: "border-t-primary",
5938
- accent: "border-t-accent",
5939
- neutral: "border-t-neutral"
5940
- }[variant];
5941
- const duration = speed ? `[animation-duration:${speed}]` : "";
5942
- return /* @__PURE__ */ jsxRuntime.jsx(
5943
- "div",
5944
- {
5945
- role: "status",
5946
- "aria-label": "Loading",
5947
- "data-variant": variant,
5948
- className: `inline-block border-muted ${variantTopBorder} rounded-full animate-spin box-border ${duration} ${sizeConfig.classes} ${sizeConfig.border} ${className}`,
5949
- ...props,
5950
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })
5951
- }
5952
- );
5953
- }
5954
- Spinner.displayName = "Spinner";
5955
- var spinner_default = Spinner;
5956
5985
  function Toast({ message, children, type = "info", onClose, className = "", duration = 5e3 }) {
5957
5986
  const [isClosing, setIsClosing] = React.useState(false);
5958
5987
  const typeClasses = {
@@ -6666,6 +6695,57 @@ function Form({
6666
6695
  }
6667
6696
  Form.displayName = "Form";
6668
6697
  var form_default = Form;
6698
+ function FormCheckbox({
6699
+ label,
6700
+ helperText,
6701
+ error,
6702
+ required = false,
6703
+ spacing = "xs",
6704
+ id: providedId,
6705
+ disabled,
6706
+ validationState,
6707
+ className,
6708
+ "aria-describedby": userAriaDescribedby,
6709
+ ...checkboxProps
6710
+ }) {
6711
+ const autoId = React.useId();
6712
+ const inputId = providedId ?? autoId;
6713
+ const messageId = `${inputId}-message`;
6714
+ const resolvedValidationState = error ? "error" : validationState;
6715
+ const hasMessage = !!(error || helperText);
6716
+ const ariaDescribedby = [hasMessage ? messageId : void 0, userAriaDescribedby].filter(Boolean).join(" ") || void 0;
6717
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex flex-col ${formSpacing[spacing]}`, children: [
6718
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: inputId, className: "inline-flex items-center gap-2 text-sm text-foreground w-fit", children: [
6719
+ /* @__PURE__ */ jsxRuntime.jsx(
6720
+ checkbox_default,
6721
+ {
6722
+ ...checkboxProps,
6723
+ id: inputId,
6724
+ disabled,
6725
+ validationState: resolvedValidationState,
6726
+ className,
6727
+ ariaLabel: label,
6728
+ "aria-describedby": ariaDescribedby
6729
+ }
6730
+ ),
6731
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: disabled ? "text-muted-foreground" : "text-foreground", children: [
6732
+ label,
6733
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-error ml-1", children: "*" })
6734
+ ] })
6735
+ ] }),
6736
+ hasMessage && /* @__PURE__ */ jsxRuntime.jsx(
6737
+ "p",
6738
+ {
6739
+ id: messageId,
6740
+ className: `text-sm ${error ? validationTextClasses.error : validationTextClasses.neutral}`,
6741
+ "aria-live": "polite",
6742
+ children: error || helperText
6743
+ }
6744
+ )
6745
+ ] });
6746
+ }
6747
+ FormCheckbox.displayName = "FormCheckbox";
6748
+ var form_checkbox_default = FormCheckbox;
6669
6749
  function FormField({
6670
6750
  children,
6671
6751
  label,
@@ -6714,6 +6794,73 @@ function FormField({
6714
6794
  }
6715
6795
  FormField.displayName = "FormField";
6716
6796
  var form_field_default = FormField;
6797
+ function CheckboxGroupField({
6798
+ children,
6799
+ itemSpacing,
6800
+ orientation,
6801
+ validationState,
6802
+ disabled,
6803
+ id,
6804
+ "aria-describedby": ariaDescribedBy
6805
+ }) {
6806
+ const orientationClasses = orientation === "horizontal" ? "flex flex-row flex-wrap" : "flex flex-col";
6807
+ return /* @__PURE__ */ jsxRuntime.jsx(
6808
+ fieldset_default,
6809
+ {
6810
+ id,
6811
+ disabled,
6812
+ "aria-describedby": ariaDescribedBy,
6813
+ "aria-invalid": validationState === "error" ? "true" : void 0,
6814
+ bordered: false,
6815
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${orientationClasses} ${formSpacing[itemSpacing]}`, children })
6816
+ }
6817
+ );
6818
+ }
6819
+ function FormCheckboxGroup({
6820
+ children,
6821
+ label,
6822
+ helperText,
6823
+ error,
6824
+ required = false,
6825
+ disabled = false,
6826
+ id,
6827
+ spacing = "sm",
6828
+ itemSpacing = "sm",
6829
+ orientation = "vertical",
6830
+ width = "full",
6831
+ align = "center",
6832
+ reserveMessageSpace = false
6833
+ }) {
6834
+ return /* @__PURE__ */ jsxRuntime.jsx(
6835
+ form_field_default,
6836
+ {
6837
+ label,
6838
+ helperText,
6839
+ spacing,
6840
+ error,
6841
+ required,
6842
+ disabled,
6843
+ id,
6844
+ width,
6845
+ align,
6846
+ reserveMessageSpace,
6847
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6848
+ CheckboxGroupField,
6849
+ {
6850
+ itemSpacing,
6851
+ orientation,
6852
+ validationState: error ? "error" : void 0,
6853
+ disabled,
6854
+ id,
6855
+ "aria-describedby": id && (helperText || error) ? `${id}-helper-text` : void 0,
6856
+ children
6857
+ }
6858
+ )
6859
+ }
6860
+ );
6861
+ }
6862
+ FormCheckboxGroup.displayName = "FormCheckboxGroup";
6863
+ var form_checkbox_group_default = FormCheckboxGroup;
6717
6864
  function FormInput({
6718
6865
  // FormField props
6719
6866
  label,
@@ -7540,6 +7687,8 @@ exports.FeatureSection = feature_section_default;
7540
7687
  exports.Fieldset = fieldset_default;
7541
7688
  exports.Footer = footer_default;
7542
7689
  exports.Form = form_default;
7690
+ exports.FormCheckbox = form_checkbox_default;
7691
+ exports.FormCheckboxGroup = form_checkbox_group_default;
7543
7692
  exports.FormInput = form_input_default;
7544
7693
  exports.FormSelect = form_select_default;
7545
7694
  exports.FormTextarea = form_textarea_default;
@@ -7559,6 +7708,7 @@ exports.LeftNavSection = left_nav_section_default;
7559
7708
  exports.Link = link_default;
7560
7709
  exports.List = list_default;
7561
7710
  exports.ListItem = ListItem;
7711
+ exports.LoadingContainer = LoadingContainer;
7562
7712
  exports.MicrosoftLogo = MicrosoftLogo;
7563
7713
  exports.Modal = modal_default;
7564
7714
  exports.MultiSelect = multi_select_default;