@splenddev/kreativ-ui 0.2.7 → 0.2.8

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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, ReactElement, HTMLAttributes, TextareaHTMLAttributes, RefObject, JSX } from 'react';
2
+ import { CSSProperties, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes, HTMLAttributes, TextareaHTMLAttributes, RefObject, JSX } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
5
  type Size = "xs" | "sm" | "md" | "lg" | "xl";
@@ -122,17 +122,42 @@ type ButtonVariant = BaseVariant | "link";
122
122
  type ButtonColor = BaseColor;
123
123
  interface ButtonRenderProps {
124
124
  className?: string;
125
- style?: React.CSSProperties;
125
+ style?: CSSProperties;
126
126
  disabled?: boolean;
127
+ "aria-disabled"?: boolean;
127
128
  "aria-busy"?: boolean;
128
- children?: React.ReactNode;
129
+ children?: ReactNode;
129
130
  }
130
131
  interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps, TypographyProps {
131
132
  size?: ButtonSize;
132
133
  leftIcon?: ReactNode;
133
134
  rightIcon?: ReactNode;
134
135
  iconOnly?: boolean;
135
- render?: (props: ButtonRenderProps) => React.ReactElement;
136
+ /**
137
+ * Custom rendering escape hatch.
138
+ *
139
+ * Receives the resolved Button props and allows the consumer
140
+ * to render the Button using another element or component.
141
+ *
142
+ * @example
143
+ * ```tsx
144
+ * <Button
145
+ * render={(props) => (
146
+ * <a {...props} href="/templates">
147
+ * Templates
148
+ * </a>
149
+ * )}
150
+ * >
151
+ * Templates
152
+ * </Button>
153
+ * ```
154
+ *
155
+ * @remarks
156
+ * The render function must be created inside a Client Component
157
+ * when using Next.js App Router. Functions cannot be passed from
158
+ * Server Components to Client Components.
159
+ */
160
+ render?: (props: ButtonRenderProps) => ReactElement;
136
161
  }
137
162
 
138
163
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { CSSProperties, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, ReactElement, HTMLAttributes, TextareaHTMLAttributes, RefObject, JSX } from 'react';
2
+ import { CSSProperties, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes, HTMLAttributes, TextareaHTMLAttributes, RefObject, JSX } from 'react';
3
3
  import { ClassValue } from 'clsx';
4
4
 
5
5
  type Size = "xs" | "sm" | "md" | "lg" | "xl";
@@ -122,17 +122,42 @@ type ButtonVariant = BaseVariant | "link";
122
122
  type ButtonColor = BaseColor;
123
123
  interface ButtonRenderProps {
124
124
  className?: string;
125
- style?: React.CSSProperties;
125
+ style?: CSSProperties;
126
126
  disabled?: boolean;
127
+ "aria-disabled"?: boolean;
127
128
  "aria-busy"?: boolean;
128
- children?: React.ReactNode;
129
+ children?: ReactNode;
129
130
  }
130
131
  interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd" | "onAnimationIteration" | "color">, BaseProps, ColorProps<ButtonColor>, VariantProps<ButtonVariant>, DisabledProps, LoadingProps, FullWidthProps, TypographyProps {
131
132
  size?: ButtonSize;
132
133
  leftIcon?: ReactNode;
133
134
  rightIcon?: ReactNode;
134
135
  iconOnly?: boolean;
135
- render?: (props: ButtonRenderProps) => React.ReactElement;
136
+ /**
137
+ * Custom rendering escape hatch.
138
+ *
139
+ * Receives the resolved Button props and allows the consumer
140
+ * to render the Button using another element or component.
141
+ *
142
+ * @example
143
+ * ```tsx
144
+ * <Button
145
+ * render={(props) => (
146
+ * <a {...props} href="/templates">
147
+ * Templates
148
+ * </a>
149
+ * )}
150
+ * >
151
+ * Templates
152
+ * </Button>
153
+ * ```
154
+ *
155
+ * @remarks
156
+ * The render function must be created inside a Client Component
157
+ * when using Next.js App Router. Functions cannot be passed from
158
+ * Server Components to Client Components.
159
+ */
160
+ render?: (props: ButtonRenderProps) => ReactElement;
136
161
  }
137
162
 
138
163
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
package/dist/index.js CHANGED
@@ -552,6 +552,7 @@ var Button = forwardRef(
552
552
  className: resolvedClassName,
553
553
  style: resolvedStyle,
554
554
  disabled: disabled || isLoading,
555
+ "aria-disabled": disabled || isLoading,
555
556
  "aria-busy": isLoading || void 0,
556
557
  children: content
557
558
  });