@dimasbaguspm/versaur 0.0.53 → 0.0.55

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.
@@ -1,9 +1,9 @@
1
- import { TextInputProps } from '../text-input/types';
1
+ import { TextInputAsButtonProps } from '../text-input-as-button/types';
2
2
  /**
3
3
  * Props for DateSinglePickerInput
4
- * Extends TextInputProps, but restricts type to 'date' and value to string
4
+ * Extends TextInputAsButtonProps for button-styled input behavior
5
5
  */
6
- export interface DateSinglePickerInputProps extends Omit<TextInputProps, 'type' | 'value' | 'onChange'> {
6
+ export interface DateSinglePickerInputProps extends Omit<TextInputAsButtonProps, 'value' | 'onClick' | 'onChange'> {
7
7
  /**
8
8
  * The value of the input (ISO date string: YYYY-MM-DD)
9
9
  */
@@ -12,5 +12,6 @@ export * from './selectable-single-input';
12
12
  export * from './selectable-multiple-input';
13
13
  export * from './switch-input';
14
14
  export * from './text-input';
15
+ export * from './text-input-as-button';
15
16
  export * from './textarea-input';
16
17
  export * from './time-picker-input';
@@ -0,0 +1,2 @@
1
+ export { TextInputAsButton } from './text-input-as-button';
2
+ export type { TextInputAsButtonProps } from './types';
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { TextInputAsButtonProps } from './types';
3
+ /**
4
+ * TextInputAsButton component for Versaur UI
5
+ *
6
+ * A button that mimics the style of TextInput, useful for triggering modals, pickers, or custom inputs
7
+ * Renders as a button with the same visual style as TextInput, with a hidden input for form submission
8
+ * Follows browser standards and accessibility best practices with proper ARIA attributes
9
+ */
10
+ export declare const TextInputAsButton: React.ForwardRefExoticComponent<TextInputAsButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,53 @@
1
+ import { ButtonHTMLAttributes, ReactNode } from 'react';
2
+ /**
3
+ * Props for the TextInputAsButton component
4
+ */
5
+ export interface TextInputAsButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'> {
6
+ /**
7
+ * Label text to display above the button
8
+ */
9
+ label?: ReactNode;
10
+ /**
11
+ * Optional content to display inside the button (left)
12
+ */
13
+ leftContent?: ReactNode;
14
+ /**
15
+ * Optional content to display inside the button (right)
16
+ */
17
+ rightContent?: ReactNode;
18
+ /**
19
+ * Helper text to display below the button
20
+ */
21
+ helperText?: ReactNode;
22
+ /**
23
+ * Error message for invalid state
24
+ */
25
+ error?: ReactNode;
26
+ /**
27
+ * Actual value to store in the hidden input (can be any serializable type)
28
+ * Used for form submission when name is provided
29
+ */
30
+ value?: string | number | boolean | string[] | number[] | object;
31
+ /**
32
+ * Display value to show in the button UI
33
+ * If not provided, will attempt to stringify the value
34
+ * Useful when value is a FK/ID and displayValue is the human-readable representation
35
+ */
36
+ displayValue?: string;
37
+ /**
38
+ * Placeholder text when no value is present
39
+ */
40
+ placeholder?: string;
41
+ /**
42
+ * Whether the field is required
43
+ */
44
+ required?: boolean;
45
+ /**
46
+ * Name attribute for the hidden input
47
+ */
48
+ name?: string;
49
+ /**
50
+ * ID for the component
51
+ */
52
+ id?: string;
53
+ }
@@ -21,6 +21,7 @@ const symbolToSubpath = {
21
21
  "SelectableSingleInput": "forms",
22
22
  "SwitchInput": "forms",
23
23
  "TextInput": "forms",
24
+ "TextInputAsButton": "forms",
24
25
  "TextAreaInput": "forms",
25
26
  "TimePickerInput": "forms",
26
27
  "AppBar": "layouts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dimasbaguspm/versaur",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "description": "React UI library with Tailwind CSS",
5
5
  "author": "Dimas Bagus Prayogo Mukti<dimas.bagus.pm@gmail.com>",
6
6
  "license": "MIT",