@nuralyui/input 0.0.9 → 0.0.10

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 (55) hide show
  1. package/bundle.js +1277 -0
  2. package/input.component.d.ts +118 -26
  3. package/input.component.js +229 -228
  4. package/input.component.js.map +1 -1
  5. package/input.style.js +154 -0
  6. package/input.style.js.map +1 -1
  7. package/input.style.variable.js +19 -0
  8. package/input.style.variable.js.map +1 -1
  9. package/input.types.d.ts +90 -1
  10. package/input.types.js +73 -0
  11. package/input.types.js.map +1 -1
  12. package/package.json +16 -2
  13. package/demo/input-demo.d.ts +0 -19
  14. package/demo/input-demo.d.ts.map +0 -1
  15. package/demo/input-demo.js +0 -339
  16. package/demo/input-demo.js.map +0 -1
  17. package/index.d.ts.map +0 -1
  18. package/input.component.d.ts.map +0 -1
  19. package/input.style.d.ts.map +0 -1
  20. package/input.style.variable.d.ts.map +0 -1
  21. package/input.types.d.ts.map +0 -1
  22. package/mixins/focus-mixin.d.ts +0 -60
  23. package/mixins/focus-mixin.d.ts.map +0 -1
  24. package/mixins/focus-mixin.js +0 -65
  25. package/mixins/focus-mixin.js.map +0 -1
  26. package/mixins/index.d.ts +0 -9
  27. package/mixins/index.d.ts.map +0 -1
  28. package/mixins/index.js +0 -9
  29. package/mixins/index.js.map +0 -1
  30. package/mixins/number-mixin.d.ts +0 -51
  31. package/mixins/number-mixin.d.ts.map +0 -1
  32. package/mixins/number-mixin.js +0 -131
  33. package/mixins/number-mixin.js.map +0 -1
  34. package/mixins/selection-mixin.d.ts +0 -57
  35. package/mixins/selection-mixin.d.ts.map +0 -1
  36. package/mixins/selection-mixin.js +0 -80
  37. package/mixins/selection-mixin.js.map +0 -1
  38. package/react.d.ts.map +0 -1
  39. package/test/hy-input_test.d.ts +0 -2
  40. package/test/hy-input_test.d.ts.map +0 -1
  41. package/test/hy-input_test.js +0 -159
  42. package/test/hy-input_test.js.map +0 -1
  43. package/utils/index.d.ts +0 -8
  44. package/utils/index.d.ts.map +0 -1
  45. package/utils/index.js +0 -8
  46. package/utils/index.js.map +0 -1
  47. package/utils/input-renderers.d.ts +0 -54
  48. package/utils/input-renderers.d.ts.map +0 -1
  49. package/utils/input-renderers.js +0 -174
  50. package/utils/input-renderers.js.map +0 -1
  51. package/utils/input-validation.utils.d.ts +0 -26
  52. package/utils/input-validation.utils.d.ts.map +0 -1
  53. package/utils/input-validation.utils.js +0 -105
  54. package/utils/input-validation.utils.js.map +0 -1
  55. package/validation.d.ts.map +0 -1
@@ -4,65 +4,109 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
  import { LitElement, PropertyValues } from 'lit';
7
- import { INPUT_TYPE, INPUT_STATE, INPUT_SIZE, INPUT_VARIANT } from './input.types.js';
8
- declare const InputBaseMixin: (new (...args: any[]) => import("./mixins/number-mixin.js").NumberCapable) & (new (...args: any[]) => import("./mixins/focus-mixin.js").FocusCapable) & (new (...args: any[]) => import("./mixins/selection-mixin.js").SelectionCapable) & (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
9
- export declare class NrInputElement extends InputBaseMixin {
7
+ import '../icon/icon.component.js';
8
+ import { INPUT_TYPE, INPUT_STATE, INPUT_SIZE, INPUT_VARIANT, ValidationRule, InputValidationResult } from './input.types.js';
9
+ import { InputValidationHost, InputEventHost } from './controllers/index.js';
10
+ declare const NrInputElement_base: (new (...args: any[]) => import("./mixins/number-mixin.js").NumberCapable) & (new (...args: any[]) => import("./mixins/focus-mixin.js").FocusCapable) & (new (...args: any[]) => import("./mixins/selection-mixin.js").SelectionCapable) & (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
11
+ /**
12
+ * Versatile input component with validation, multiple types, and interactive features.
13
+ *
14
+ * @example
15
+ * ```html
16
+ * <nr-input type="text" placeholder="Enter name"></nr-input>
17
+ * <nr-input type="password"></nr-input>
18
+ * <nr-input type="number" min="0" max="100"></nr-input>
19
+ * ```
20
+ *
21
+ * @fires nr-input - Value changes
22
+ * @fires nr-focus - Input focused
23
+ * @fires nr-blur - Input blurred
24
+ * @fires nr-enter - Enter key pressed
25
+ * @fires nr-clear - Clear button clicked
26
+ *
27
+ * @slot label - Input label
28
+ * @slot helper-text - Helper text
29
+ * @slot addon-before - Content before input
30
+ * @slot addon-after - Content after input
31
+ */
32
+ export declare class NrInputElement extends NrInputElement_base implements InputValidationHost, InputEventHost {
10
33
  static styles: import("lit").CSSResult[];
34
+ private validationController;
35
+ private eventController;
36
+ /** Disables the input */
11
37
  disabled: boolean;
38
+ /** Makes the input read-only */
12
39
  readonly: boolean;
40
+ /** Visual state (default, success, warning, error) */
13
41
  state: INPUT_STATE;
42
+ /** Current input value */
14
43
  value: string;
44
+ /** Input size (small, medium, large) */
15
45
  size: INPUT_SIZE;
46
+ /** Visual variant (outlined, underlined, filled) */
16
47
  variant: INPUT_VARIANT;
48
+ /** Input type (text, password, number, email, etc.) */
17
49
  type: INPUT_TYPE;
50
+ /** Step value for number inputs */
18
51
  step?: string;
52
+ /** Minimum value for number inputs */
19
53
  min?: string;
54
+ /** Maximum value for number inputs */
20
55
  max?: string;
56
+ /** Placeholder text */
21
57
  placeholder: string;
58
+ /** HTML autocomplete attribute */
22
59
  autocomplete: string;
60
+ /** Field name for form submission */
61
+ name?: string;
62
+ /** Required field indicator */
63
+ required?: boolean;
64
+ /** Shows copy button */
23
65
  withCopy: boolean;
66
+ /** Shows clear button */
24
67
  allowClear: boolean;
68
+ /** Shows character counter */
25
69
  showCount: boolean;
70
+ /** Maximum character limit */
26
71
  maxLength?: number;
72
+ /** Array of validation rules */
73
+ rules: ValidationRule[];
74
+ /** Validate on change */
75
+ validateOnChangeInput: boolean;
76
+ /** Validate on blur */
77
+ validateOnBlurInput: boolean;
78
+ /** Show validation status icon */
79
+ hasFeedback: boolean;
80
+ /** Allow validation warnings */
81
+ allowWarnings: boolean;
82
+ /** Custom validation trigger */
83
+ validationTrigger: 'change' | 'blur' | 'submit';
84
+ /** Validation debounce delay in milliseconds */
85
+ validationDebounce?: number;
86
+ /** Input label for better error messages */
87
+ label?: string;
88
+ /** Validation message */
89
+ validationMessage?: string;
27
90
  inputType: string;
28
91
  hasAddonBefore: boolean;
29
92
  hasAddonAfter: boolean;
30
93
  focused: boolean;
31
94
  private get _input();
32
- /**
33
- * Get the character count display text
34
- */
35
95
  get characterCountDisplay(): string;
36
- /**
37
- * Check if character count is over the limit
38
- */
39
96
  get isOverCharacterLimit(): boolean;
40
- /**
41
- * Get the input element
42
- */
43
97
  protected get input(): HTMLInputElement;
44
- /**
45
- * Override inputElement getter from mixins to use our @query property
46
- */
47
98
  protected get inputElement(): HTMLInputElement;
48
- /**
49
- * Required components that must be registered for this component to work properly
50
- */
51
99
  requiredComponents: string[];
100
+ connectedCallback(): void;
101
+ disconnectedCallback(): void;
52
102
  /**
53
- * Check for required dependencies when component is connected to DOM
103
+ * Handle validation events from the controller
54
104
  */
55
- connectedCallback(): void;
105
+ private _handleValidationEvent;
56
106
  willUpdate(_changedProperties: PropertyValues): void;
57
107
  updated(_changedProperties: PropertyValues): void;
58
108
  firstUpdated(): void;
59
- /**
60
- * Check initial slot content on first render
61
- */
62
109
  private _checkInitialSlotContent;
63
- /**
64
- * Handle slot changes to determine addon visibility
65
- */
66
110
  private _handleSlotChange;
67
111
  private _handleKeyDown;
68
112
  private _valueChange;
@@ -75,6 +119,54 @@ export declare class NrInputElement extends InputBaseMixin {
75
119
  private _decrement;
76
120
  private _togglePasswordIcon;
77
121
  private _getAriaDescribedBy;
122
+ /**
123
+ * Setup default validation rules based on input properties
124
+ */
125
+ /**
126
+ * Override the form mixin's validateValue method with controller logic
127
+ */
128
+ protected validateValue(_value: string): boolean;
129
+ /**
130
+ * Add validation rule dynamically
131
+ */
132
+ addRule(rule: ValidationRule): void;
133
+ /**
134
+ * Remove validation rule
135
+ */
136
+ removeRule(predicate: (rule: ValidationRule) => boolean): void;
137
+ /**
138
+ * Clear all validation rules
139
+ */
140
+ clearRules(): void;
141
+ /**
142
+ * Get current validation status
143
+ */
144
+ getValidationStatus(): {
145
+ isValid: boolean;
146
+ isValidating: boolean;
147
+ errors: string[];
148
+ warnings: string[];
149
+ };
150
+ /**
151
+ * Trigger validation manually
152
+ */
153
+ validateInput(): Promise<boolean>;
154
+ /**
155
+ * Set validation state externally (for form integration)
156
+ */
157
+ setValidationStatus(result: InputValidationResult): void;
158
+ /**
159
+ * Get validation classes for CSS styling
160
+ */
161
+ protected getValidationClasses(): Record<string, boolean>;
162
+ /**
163
+ * Render validation feedback icon
164
+ */
165
+ private renderValidationIcon;
166
+ /**
167
+ * Render validation message
168
+ */
169
+ private renderValidationMessage;
78
170
  render(): import("lit").TemplateResult<1>;
79
171
  }
80
172
  export {};