@revotech-group/revotech-ui-kit 0.2.1 → 0.2.2

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 (148) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +30 -30
  3. package/dist/library.css +10598 -9715
  4. package/dist/rtg-ui-kit.js +8189 -8673
  5. package/dist/rtg-ui-kit.umd.cjs +654 -804
  6. package/dist/src/assets/icons/anchor.icon.d.ts +3 -0
  7. package/dist/src/assets/icons/app-window.icon.d.ts +3 -0
  8. package/dist/src/assets/icons/arrow-right.icon.d.ts +3 -0
  9. package/dist/src/assets/icons/arrow-up-right.icon.d.ts +3 -0
  10. package/dist/src/assets/icons/arrow-up.icon.d.ts +3 -0
  11. package/dist/src/assets/icons/asterisk.icon.d.ts +3 -0
  12. package/dist/src/assets/icons/badge-alert.icon.d.ts +3 -0
  13. package/dist/src/assets/icons/badge-check.icon.d.ts +3 -0
  14. package/dist/src/assets/icons/badge-info.icon.d.ts +3 -0
  15. package/dist/src/assets/icons/badge-x.icon.d.ts +3 -0
  16. package/dist/src/assets/icons/captions.icon.d.ts +3 -0
  17. package/dist/src/assets/icons/check.icon.d.ts +3 -0
  18. package/dist/src/assets/icons/circle-alert.icon.d.ts +3 -0
  19. package/dist/src/assets/icons/circle-check.icon.d.ts +3 -1
  20. package/dist/src/assets/icons/circle-fading-arrow-up.icon.d.ts +3 -0
  21. package/dist/src/assets/icons/code.icon.d.ts +3 -0
  22. package/dist/src/assets/icons/external-link.icon.d.ts +3 -0
  23. package/dist/src/assets/icons/git-branch-minus.icon.d.ts +3 -0
  24. package/dist/src/assets/icons/git-branch-plus.icon.d.ts +3 -0
  25. package/dist/src/assets/icons/house.icon.d.ts +3 -0
  26. package/dist/src/assets/icons/index.d.ts +41 -14
  27. package/dist/src/assets/icons/info.icon.d.ts +3 -0
  28. package/dist/src/assets/icons/loader-circle.icon.d.ts +3 -0
  29. package/dist/src/assets/icons/mail-warning.icon.d.ts +3 -0
  30. package/dist/src/assets/icons/minus.icon.d.ts +3 -1
  31. package/dist/src/assets/icons/plus.icon.d.ts +1 -1
  32. package/dist/src/assets/icons/rabbit.icon.d.ts +3 -0
  33. package/dist/src/assets/icons/refresh-cw.icon.d.ts +3 -0
  34. package/dist/src/assets/icons/search.icon.d.ts +3 -1
  35. package/dist/src/assets/icons/settings.icon.d.ts +3 -0
  36. package/dist/src/assets/icons/shopping-bag.icon.d.ts +3 -0
  37. package/dist/src/assets/icons/wand.icon.d.ts +3 -0
  38. package/dist/src/components/ui/alert/_alert-action.d.ts +22 -0
  39. package/dist/src/components/ui/alert/_alert-description.d.ts +22 -0
  40. package/dist/src/components/ui/alert/_alert-title.d.ts +21 -0
  41. package/dist/src/components/ui/alert/_alert.d.ts +26 -0
  42. package/dist/src/components/ui/alert/alert.d.ts +11 -19
  43. package/dist/src/components/ui/alert/alert.defs.d.ts +4 -0
  44. package/dist/src/components/ui/alert/alert.stories.d.ts +10 -6
  45. package/dist/src/components/ui/avatar/_avatar-badge.d.ts +22 -0
  46. package/dist/src/components/ui/avatar/_avatar-fallback.d.ts +22 -0
  47. package/dist/src/components/ui/avatar/_avatar-group-count.d.ts +22 -0
  48. package/dist/src/components/ui/avatar/_avatar-group.d.ts +22 -0
  49. package/dist/src/components/ui/avatar/_avatar-image.d.ts +29 -0
  50. package/dist/src/components/ui/avatar/_avatar.d.ts +66 -0
  51. package/dist/src/components/ui/avatar/avatar.d.ts +14 -13
  52. package/dist/src/components/ui/avatar/avatar.defs.d.ts +8 -0
  53. package/dist/src/components/ui/avatar/avatar.stories.d.ts +13 -4
  54. package/dist/src/components/ui/button/_button.d.ts +63 -0
  55. package/dist/src/components/ui/button/button.d.ts +9 -20
  56. package/dist/src/components/ui/button/button.defs.d.ts +14 -0
  57. package/dist/src/components/ui/button/button.stories.d.ts +9 -1
  58. package/dist/src/components/ui/button/button.style.d.ts +1 -1
  59. package/dist/src/components/ui/card/_card-action.d.ts +22 -0
  60. package/dist/src/components/ui/card/_card-content.d.ts +21 -0
  61. package/dist/src/components/ui/card/_card-description.d.ts +22 -0
  62. package/dist/src/components/ui/card/_card-footer.d.ts +27 -0
  63. package/dist/src/components/ui/card/_card-header.d.ts +27 -0
  64. package/dist/src/components/ui/card/_card-title.d.ts +21 -0
  65. package/dist/src/components/ui/card/_card.d.ts +26 -0
  66. package/dist/src/components/ui/card/card.d.ts +14 -18
  67. package/dist/src/components/ui/card/card.defs.d.ts +10 -0
  68. package/dist/src/components/ui/card/card.stories.d.ts +9 -3
  69. package/dist/src/components/ui/checkbox/_checkbox.d.ts +66 -0
  70. package/dist/src/components/ui/checkbox/checkbox.d.ts +5 -13
  71. package/dist/src/components/ui/checkbox/checkbox.defs.d.ts +11 -0
  72. package/dist/src/components/ui/checkbox/checkbox.stories.d.ts +8 -7
  73. package/dist/src/components/ui/index.d.ts +1 -1
  74. package/dist/src/components/ui/input/_input.d.ts +164 -0
  75. package/dist/src/components/ui/input/input.d.ts +7 -29
  76. package/dist/src/components/ui/input/input.defs.d.ts +28 -0
  77. package/dist/src/components/ui/input/input.stories.d.ts +16 -6
  78. package/dist/src/components/ui/input-otp/_input-otp-group.d.ts +26 -0
  79. package/dist/src/components/ui/input-otp/_input-otp-separator.d.ts +16 -0
  80. package/dist/src/components/ui/input-otp/_input-otp-slot.d.ts +35 -0
  81. package/dist/src/components/ui/input-otp/_input-otp.d.ts +213 -0
  82. package/dist/src/components/ui/input-otp/input-otp.d.ts +12 -28
  83. package/dist/src/components/ui/input-otp/input-otp.defs.d.ts +28 -0
  84. package/dist/src/components/ui/input-otp/input-otp.stories.d.ts +10 -7
  85. package/dist/src/components/ui/label/_label.d.ts +27 -0
  86. package/dist/src/components/ui/label/label.d.ts +5 -7
  87. package/dist/src/components/ui/label/label.defs.d.ts +3 -0
  88. package/dist/src/components/ui/label/label.stories.d.ts +10 -5
  89. package/dist/src/components/ui/pagination/pagination-link.d.ts +2 -2
  90. package/dist/src/components/ui/pagination/pagination.styles.d.ts +1 -1
  91. package/dist/src/components/ui/sample-demo/sample-demo.d.ts +1 -1
  92. package/dist/src/components/ui/sample-demo/sample.style.d.ts +1 -1
  93. package/dist/src/components/ui/separator/_separator.d.ts +22 -0
  94. package/dist/src/components/ui/separator/separator.d.ts +5 -10
  95. package/dist/src/components/ui/separator/separator.defs.d.ts +4 -9
  96. package/dist/src/components/ui/separator/separator.stories.d.ts +3 -1
  97. package/dist/src/components/ui/tabs/_tabs-content.d.ts +30 -0
  98. package/dist/src/components/ui/tabs/_tabs-list.d.ts +30 -0
  99. package/dist/src/components/ui/tabs/_tabs-trigger.d.ts +47 -0
  100. package/dist/src/components/ui/tabs/_tabs.d.ts +99 -0
  101. package/dist/src/components/ui/tabs/tabs.d.ts +18 -0
  102. package/dist/src/components/ui/tabs/tabs.defs.d.ts +22 -0
  103. package/dist/src/components/ui/tabs/tabs.helpers.d.ts +24 -0
  104. package/dist/src/components/ui/tabs/tabs.stories.d.ts +13 -0
  105. package/dist/src/{components/ui/input/countryOptions.d.ts → helpers/country-codes.d.ts} +1 -1
  106. package/dist/src/helpers/index.d.ts +3 -2
  107. package/dist/src/tokens/tailwind/border-radius.d.ts +0 -9
  108. package/dist/src/tokens/tailwind/border-width.d.ts +0 -4
  109. package/dist/src/tokens/tailwind/box-shadow.d.ts +0 -6
  110. package/dist/src/tokens/tailwind/color.d.ts +0 -78
  111. package/dist/src/tokens/tailwind/font-size.d.ts +1 -37
  112. package/dist/src/tokens/tailwind/font-weight.d.ts +0 -8
  113. package/dist/src/tokens/tailwind/index.d.ts +1 -202
  114. package/dist/src/tokens/tailwind/opacity.d.ts +0 -5
  115. package/dist/src/tokens/tailwind/ring-offset-width.d.ts +0 -1
  116. package/dist/src/tokens/tailwind/ring-width.d.ts +0 -5
  117. package/dist/src/tokens/tailwind/spacing.d.ts +0 -45
  118. package/package.json +136 -136
  119. package/dist/src/components/ui/alert/alert.styles.d.ts +0 -10
  120. package/dist/src/components/ui/alert/alert.types.d.ts +0 -1
  121. package/dist/src/components/ui/alert/helpers.d.ts +0 -10
  122. package/dist/src/components/ui/avatar/avatar-fallback.d.ts +0 -15
  123. package/dist/src/components/ui/avatar/avatar-image.d.ts +0 -17
  124. package/dist/src/components/ui/avatar/avatar.style.d.ts +0 -4
  125. package/dist/src/components/ui/button/button.type.d.ts +0 -3
  126. package/dist/src/components/ui/card/card-content.d.ts +0 -11
  127. package/dist/src/components/ui/card/card-description.d.ts +0 -11
  128. package/dist/src/components/ui/card/card-footer.d.ts +0 -11
  129. package/dist/src/components/ui/card/card-header.d.ts +0 -11
  130. package/dist/src/components/ui/card/card-title.d.ts +0 -11
  131. package/dist/src/components/ui/card/card.styles.d.ts +0 -4
  132. package/dist/src/components/ui/checkbox/checkbox.style.d.ts +0 -4
  133. package/dist/src/components/ui/checkbox/checkbox.type.d.ts +0 -21
  134. package/dist/src/components/ui/input/input.styles.d.ts +0 -7
  135. package/dist/src/components/ui/input/input.type.d.ts +0 -21
  136. package/dist/src/components/ui/input-otp/input-otp-group.d.ts +0 -18
  137. package/dist/src/components/ui/input-otp/input-otp-separator.d.ts +0 -12
  138. package/dist/src/components/ui/input-otp/input-otp-slot.d.ts +0 -26
  139. package/dist/src/components/ui/input-otp/input-otp.styles.d.ts +0 -10
  140. package/dist/src/components/ui/label/label.style.d.ts +0 -1
  141. package/dist/src/components/ui/separator/separator.styles.d.ts +0 -5
  142. package/dist/src/components/ui/tabs/tab-contents.d.ts +0 -24
  143. package/dist/src/components/ui/tabs/tab-list.d.ts +0 -25
  144. package/dist/src/components/ui/tabs/tab-trigger.d.ts +0 -26
  145. package/dist/src/components/ui/tabs/tab.d.ts +0 -27
  146. package/dist/src/components/ui/tabs/tab.stories.d.ts +0 -16
  147. package/dist/src/components/ui/tabs/tabs.style.d.ts +0 -12
  148. package/dist/src/tokens/tailwind/grid-template-columns.d.ts +0 -4
@@ -0,0 +1,164 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { InputProps, InputAutocomplete, InputType } from './input.defs';
3
+
4
+ /**
5
+ * The `<rtg-input>` component is a text input component for forms and user data
6
+ * entry with built-in styling and accessibility features.
7
+ *
8
+ * @element rtg-input
9
+ * @slot input
10
+ */
11
+ export declare class Input extends LitElement implements InputProps {
12
+ /**
13
+ * Hint for expected file type in file upload controls. Permitted for file.
14
+ */
15
+ accept?: string;
16
+ /**
17
+ * Hint for form autofill feature.
18
+ */
19
+ autocomplete?: InputAutocomplete;
20
+ /**
21
+ * When `true`, prevents the user from interacting with the input.
22
+ */
23
+ disabled?: boolean;
24
+ /**
25
+ * The form name that the input is associated with.
26
+ */
27
+ form?: string;
28
+ /**
29
+ * A unique id for the input element.
30
+ */
31
+ id: string;
32
+ /**
33
+ * When `true`, sets the `aria-invalid` attribute and styles the input
34
+ * accordingly.
35
+ */
36
+ invalid?: boolean;
37
+ /**
38
+ * The greatest value in the range of permitted values. Permitted for date,
39
+ * time, and number.
40
+ */
41
+ max?: number;
42
+ /**
43
+ * The maximum string length that the user can enter into the field. Permitted
44
+ * for text, search, url, tel, email, and password.
45
+ */
46
+ maxlength?: number;
47
+ /**
48
+ * The most negative value in the range of permitted values. Permitted for
49
+ * date, time, and number.
50
+ */
51
+ min?: number;
52
+ /**
53
+ * The minimum string length that the user can enter into the field. Permitted
54
+ * for text, search, url, tel, email, and password.
55
+ */
56
+ minlength?: number;
57
+ /**
58
+ * When `true`, the user can enter comma separated email addresses in the
59
+ * `email` input or can choose more than one file with the `file` input.
60
+ */
61
+ multiple?: boolean;
62
+ /**
63
+ * The name of the input. Submitted with its owning form as part of a
64
+ * name/value pair.
65
+ */
66
+ name?: string;
67
+ /**
68
+ * Used to compile a regular expression that the input's value must match.
69
+ * Permitted for text, search, url, tel, email, and password.
70
+ */
71
+ pattern?: string;
72
+ /**
73
+ * The value of the placeholder text, providing a brief hint to the user.
74
+ * Permitted for text, search, url, tel, email, password, and number.
75
+ */
76
+ placeholder?: string;
77
+ /**
78
+ * When `true`, indicates that the user should not be able to edit the value
79
+ * of the input.
80
+ */
81
+ readonly?: boolean;
82
+ /**
83
+ * When `true`, indicates that the user must fill the input before the owning
84
+ * form can be submitted.
85
+ */
86
+ required?: boolean;
87
+ /**
88
+ * A number that specifies the granularity that the value must adhere to.
89
+ * Permitted for date, time, and number.
90
+ */
91
+ step?: number;
92
+ /**
93
+ * The type of the input.
94
+ */
95
+ type: InputType;
96
+ /**
97
+ * The value of the input. When specified as a prop, it is the initial value.
98
+ */
99
+ value?: string;
100
+ /**
101
+ * The user-defined "on click" handler for the input.
102
+ */
103
+ onClick?: (event: MouseEvent) => void;
104
+ /**
105
+ * The user-defined "on input" handler for the input.
106
+ */
107
+ onInput?: (event: Event) => void;
108
+ /**
109
+ * The user-defined "on change" handler for the input.
110
+ */
111
+ onChange?: (event: Event) => void;
112
+ /**
113
+ * The user-defined "on focus" handler for the input.
114
+ */
115
+ onFocus?: (event: FocusEvent) => void;
116
+ /**
117
+ * The user-defined "on blur" handler for the input.
118
+ */
119
+ onBlur?: (event: FocusEvent) => void;
120
+ /**
121
+ * The id of the input element, determined by the provided `id` prop.
122
+ */
123
+ private _inputId?;
124
+ /**
125
+ * Overrides the default behaviour to render into the light DOM.
126
+ */
127
+ protected createRenderRoot(): this;
128
+ /**
129
+ * Handles the updated callback, transferring the `id` prop's value to
130
+ * `_inputId` and removing it from the parent (if changed).
131
+ */
132
+ protected updated(changed: PropertyValues): void;
133
+ /**
134
+ * Handles the first updated callback, transferring the `id` prop's value to
135
+ * `_inputId` and removing it from the parent.
136
+ */
137
+ protected firstUpdated(): void;
138
+ /**
139
+ * Handles the click event of the input, invoking the user-provided event
140
+ * handler (if provided).
141
+ */
142
+ private _onClick;
143
+ /**
144
+ * Handles the input event of the input, updating the stored `value` and
145
+ * invoking the user-provided event handler (if provided).
146
+ */
147
+ private _onInput;
148
+ /**
149
+ * Handles the change event of the input, updating the stored `value` and
150
+ * invoking the user-provided event handler (if provided).
151
+ */
152
+ private _onChange;
153
+ /**
154
+ * Handles the focus event of the input, dispatching the focus event (so it
155
+ * bubbles) and invoking the user-provided event handler (if provided).
156
+ */
157
+ private _onFocus;
158
+ /**
159
+ * Handles the blur event of the input, dispatching the focus event (so it
160
+ * bubbles) and invoking the user-provided event handler (if provided).
161
+ */
162
+ private _onBlur;
163
+ render(): import('lit').TemplateResult<1>;
164
+ }
@@ -1,34 +1,12 @@
1
- import { PropertyValues } from 'lit';
2
- import { BaseElement } from '../../../helpers';
1
+ import { Input } from './_input';
3
2
 
4
- import * as inputType from './input.type';
5
- export declare class RtgInput extends BaseElement {
6
- constructor();
7
- inputElement: HTMLInputElement;
8
- disabled: boolean;
9
- type: inputType.InputType;
10
- placeholder: string;
11
- defaultValue: string;
12
- value: string;
13
- dataKey: string;
14
- country: string;
15
- countryCode: string;
16
- selectedLabel: string;
17
- private rawTelValue;
18
- private showPassword;
19
- private togglePasswordVisibility;
20
- private handleCountryChange;
21
- protected firstUpdated(_changedProperties: PropertyValues): void;
22
- private handleInputChange;
23
- private emitValueChange;
24
- handleFocus(): void;
25
- protected getAttributesToExclude(): string[];
26
- protected getAttributesToRemoveFromParent(): string[];
27
- protected createRenderRoot(): HTMLElement | DocumentFragment;
28
- render(): import('lit').TemplateResult<1>;
29
- }
3
+ export { Input };
4
+ /**
5
+ * A text input component for forms and user data entry with built-in styling
6
+ * and accessibility features.
7
+ */
30
8
  declare global {
31
9
  interface HTMLElementTagNameMap {
32
- 'rtg-input': RtgInput;
10
+ 'rtg-input': Input;
33
11
  }
34
12
  }
@@ -0,0 +1,28 @@
1
+ export type InputAutocomplete = 'off' | 'on' | string;
2
+ export type InputType = 'date' | 'email' | 'file' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url';
3
+ export interface InputProps {
4
+ accept?: string;
5
+ autocomplete?: InputAutocomplete;
6
+ disabled?: boolean;
7
+ form?: string;
8
+ id: string;
9
+ invalid?: boolean;
10
+ max?: number;
11
+ maxlength?: number;
12
+ min?: number;
13
+ minlength?: number;
14
+ multiple?: boolean;
15
+ name?: string;
16
+ pattern?: string;
17
+ placeholder?: string;
18
+ readonly?: boolean;
19
+ required?: boolean;
20
+ step?: number;
21
+ type: InputType;
22
+ value?: string;
23
+ onClick?: (event: MouseEvent) => void;
24
+ onInput?: (event: Event) => void;
25
+ onChange?: (event: Event) => void;
26
+ onFocus?: (event: FocusEvent) => void;
27
+ onBlur?: (event: FocusEvent) => void;
28
+ }
@@ -1,7 +1,17 @@
1
- import { Meta, StoryFn } from '@storybook/web-components-vite';
2
- import { InputArgs } from './input.type';
1
+ import { Meta, StoryObj } from '@storybook/web-components-vite';
3
2
 
4
- declare const _default: Meta;
5
- export default _default;
6
- export declare const Input: StoryFn<InputArgs>;
7
- export declare const SpecificInput: StoryFn;
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ type Story = StoryObj;
6
+ export declare const Demo: Story;
7
+ export declare const Basic: Story;
8
+ export declare const Field: Story;
9
+ export declare const FieldGroup: Story;
10
+ export declare const Disabled: Story;
11
+ export declare const Invalid: Story;
12
+ export declare const File: Story;
13
+ export declare const Inline: Story;
14
+ export declare const Grid: Story;
15
+ export declare const Required: Story;
16
+ export declare const Badge: Story;
17
+ export declare const Form: Story;
@@ -0,0 +1,26 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ /**
4
+ * The `<rtg-input-otp-group>` component is a container for input OTP slots. An
5
+ * input OTP may have a single group holding all the slots, or multiple groups,
6
+ * each holding a subset of the slots.
7
+ *
8
+ * @element rtg-input-otp-group
9
+ * @slot input-otp-group
10
+ */
11
+ export declare class InputOTPGroup extends LitElement {
12
+ /**
13
+ * Overrides the default behaviour to render into the light DOM.
14
+ */
15
+ protected createRenderRoot(): this;
16
+ /**
17
+ * The slot of the input otp group.
18
+ */
19
+ private get _groupSlot();
20
+ /**
21
+ * Handles the first updated callback, appending the children to the group
22
+ * slot.
23
+ */
24
+ protected firstUpdated(): void;
25
+ render(): import('lit').TemplateResult<1>;
26
+ }
@@ -0,0 +1,16 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ /**
4
+ * The `<rtg-input-otp-separator>` component is a separator used between input
5
+ * OTP groups.
6
+ *
7
+ * @element rtg-input-otp-separator
8
+ * @slot input-otp-separator
9
+ */
10
+ export declare class InputOTPSeparator extends LitElement {
11
+ /**
12
+ * Overrides the default behaviour to render into the light DOM.
13
+ */
14
+ protected createRenderRoot(): this;
15
+ render(): import('lit').TemplateResult<1>;
16
+ }
@@ -0,0 +1,35 @@
1
+ import { LitElement } from 'lit';
2
+ import { InputOTPSlotProps } from './input-otp.defs';
3
+
4
+ /**
5
+ * The `<rtg-input-otp-slot>` component is a decorative container of the
6
+ * character at a certain index of the input's value.
7
+ *
8
+ * @element rtg-input-otp-slot
9
+ * @slot input-otp-slot
10
+ */
11
+ export declare class InputOTPSlot extends LitElement implements InputOTPSlotProps {
12
+ /**
13
+ * The index of the character being displayed in the slot.
14
+ */
15
+ index: number;
16
+ /**
17
+ * When `true`, sets the `aria-invalid` attribute and styles the input OTP
18
+ * slot accordingly.
19
+ */
20
+ invalid?: boolean;
21
+ /**
22
+ * Overrides the default behaviour to render into the light DOM.
23
+ */
24
+ protected createRenderRoot(): this;
25
+ /**
26
+ * The slot of the input otp slot.
27
+ */
28
+ get _slotSlot(): HTMLElement | null;
29
+ /**
30
+ * Handles the click event of the input OTP slot, invoking the parent input
31
+ * OTP's event listener.
32
+ */
33
+ private _handleClick;
34
+ render(): import('lit').TemplateResult<1>;
35
+ }
@@ -0,0 +1,213 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { InputOTPProps, InputOTPAutocomplete, InputOTPInputmode } from './input-otp.defs';
3
+
4
+ /**
5
+ * The `<rtg-input-otp>` component is the root input OTP container, holding the
6
+ * input OTP groups and separators, as well as the input element.
7
+ *
8
+ * @element rtg-input-otp
9
+ * @slot input-otp-container
10
+ * @slot input-otp-wrapper
11
+ * @slot input-otp
12
+ */
13
+ export declare class InputOTP extends LitElement implements InputOTPProps {
14
+ /**
15
+ * Hint for form autofill feature.
16
+ */
17
+ autocomplete: InputOTPAutocomplete;
18
+ /**
19
+ * The default value of the input, used to initialise the internal `_value`
20
+ * state.
21
+ */
22
+ defaultValue?: string;
23
+ /**
24
+ * When `true`, prevents the user from interacting with the input OTP.
25
+ */
26
+ disabled?: boolean;
27
+ /**
28
+ * The form name that the input OTP is associated with.
29
+ */
30
+ form?: string;
31
+ /**
32
+ * A unique id for the input OTP input element.
33
+ */
34
+ id: string;
35
+ /**
36
+ * Virtual keyboard appearance on mobile.
37
+ */
38
+ inputmode: InputOTPInputmode;
39
+ /**
40
+ * The number of slots.
41
+ */
42
+ maxlength: number;
43
+ /**
44
+ * The name of the input. Submitted with its owning form as part of a
45
+ * name/value pair.
46
+ */
47
+ name?: string;
48
+ /**
49
+ * Used to compile a regular expression that the input OTP's value must match.
50
+ */
51
+ pattern?: string;
52
+ /**
53
+ * When `true`, indicates that the user must fill the input OTP before the
54
+ * owning form can be submitted.
55
+ */
56
+ required?: boolean;
57
+ /**
58
+ * The controlled value of the input OTP. Should be used in conjunction with
59
+ * `onChange`.
60
+ */
61
+ value?: string;
62
+ /**
63
+ * Event handler called when the value changes.
64
+ */
65
+ onChange?: (newValue: string) => unknown;
66
+ /**
67
+ * Callback when the input is complete.
68
+ */
69
+ onComplete?: (...args: any[]) => unknown;
70
+ /**
71
+ * The user-defined blur handler for the input OTP input.
72
+ */
73
+ onBlur?: (event: FocusEvent) => void;
74
+ /**
75
+ * The user-defined focus handler for the input OTP input.
76
+ */
77
+ onFocus?: (event: FocusEvent) => void;
78
+ /**
79
+ * The user-defined paste handler for the input OTP input.
80
+ */
81
+ onPaste?: (event: ClipboardEvent) => void;
82
+ /**
83
+ * Transfomer function that allows pasting.
84
+ */
85
+ pasteTransformer?: (pastedText: string) => string;
86
+ /**
87
+ * The index of the current active slot.
88
+ */
89
+ private _activeSlot;
90
+ /**
91
+ * Whether or not the input OTP is currently in a focus state.
92
+ */
93
+ private _hasFocus;
94
+ /**
95
+ * The uncontrolled value of the input OTP.
96
+ */
97
+ private _value;
98
+ /**
99
+ * Initial user children of the input otp.
100
+ */
101
+ private _children;
102
+ /**
103
+ * The id of the input element, determined by the provided `id` prop.
104
+ */
105
+ private _inputId?;
106
+ /**
107
+ * Initialise `_children`, capturing the user children before Lit renders.
108
+ */
109
+ constructor();
110
+ /**
111
+ * Overrides the default behaviour to render into the light DOM.
112
+ */
113
+ protected createRenderRoot(): this;
114
+ /**
115
+ * The container/outermost slot of the input otp.
116
+ */
117
+ private get _containerSlot();
118
+ /**
119
+ * The wrapper slot of the input otp - child of container, parent of input.
120
+ */
121
+ private get _wrapperSlot();
122
+ /**
123
+ * The input OTP slot children.
124
+ */
125
+ private get _slots();
126
+ /**
127
+ * Whether or not the tabs element is 'controlled' - determined by whether or
128
+ * not the value prop was provided by the user.
129
+ */
130
+ private get _isControlled();
131
+ /**
132
+ * The value of the input OTP: user-provided value if controlled, otherwise,
133
+ * the internal, uncontrolled value.
134
+ */
135
+ private get _currentValue();
136
+ /**
137
+ * The input element of the input otp - inside the wrapper slot.
138
+ */
139
+ private _inputEl;
140
+ /**
141
+ * Returns the regex expression of the `pattern` prop.
142
+ */
143
+ private _regex;
144
+ /**
145
+ * Determines the next active slot index.
146
+ */
147
+ private _clampIndex;
148
+ /**
149
+ * Determines the initial active slot, handling inputs given a default value
150
+ * or inputs that are prefilled.
151
+ */
152
+ private _computeInitialActiveSlot;
153
+ /**
154
+ * The 'fake' caret element to display in the input OTP slot when active and
155
+ * empty.
156
+ */
157
+ private _createCaret;
158
+ /**
159
+ * Syncs all the input OTP's input OTP slot children, setting their state
160
+ * attribute and content.
161
+ */
162
+ private _sync;
163
+ /**
164
+ * Updates the internal `_value` state (if not controlled) and invokes the
165
+ * user-provided `onChange` handler if provided.
166
+ */
167
+ private _updateValue;
168
+ /**
169
+ * Helper function that invokes the user-provided `onComplete` handler if the
170
+ * input is complete (reached `maxlength`).
171
+ */
172
+ private _checkComplete;
173
+ /**
174
+ * Helper function, handling the insertion of characters into the input.
175
+ */
176
+ private _insertChar;
177
+ /**
178
+ * Helper function, handling the deletion of characters from the input.
179
+ */
180
+ private _deleteChar;
181
+ /**
182
+ * Handles the updated callback, transferring the `id` prop's value to
183
+ * `_inputId` and removing it from the parent (if changed).
184
+ */
185
+ protected updated(changed: PropertyValues): void;
186
+ /**
187
+ * Handles the first updated callback, appending the children to the container
188
+ * slot, transferring the `id` prop, and initialising the internal value.
189
+ */
190
+ protected firstUpdated(): void;
191
+ /**
192
+ * Handles the blur event of the input, dispatching the focus event (so it
193
+ * bubbles) and invoking the user-provided event handler (if provided).
194
+ */
195
+ private _handleBlur;
196
+ /**
197
+ * Handles the focus event of the input, dispatching the focus event (so it
198
+ * bubbles) and invoking the user-provided event handler (if provided).
199
+ */
200
+ private _handleFocus;
201
+ /**
202
+ * Handles the key down event of the input OTP input, updating internal
203
+ * states, handling both insertion and deletion.
204
+ */
205
+ private _handleKeyDown;
206
+ /**
207
+ * Handles the paste event of the input OTP input, invoking the user-provided
208
+ * `pasteTransformer` (if provided), updating the input value and handling
209
+ * pattern validation.
210
+ */
211
+ private _handlePaste;
212
+ render(): import('lit').TemplateResult<1>;
213
+ }
@@ -1,33 +1,17 @@
1
- import { BaseElement } from '../../../helpers';
2
- import { PropertyValues } from 'lit';
3
- import { InputOtpGroup } from './input-otp-group';
4
- import { InputOtpSeparator } from './input-otp-separator';
5
- import { InputOtpSlot } from './input-otp-slot';
1
+ import { InputOTP } from './_input-otp';
2
+ import { InputOTPGroup } from './_input-otp-group';
3
+ import { InputOTPSlot } from './_input-otp-slot';
4
+ import { InputOTPSeparator } from './_input-otp-separator';
6
5
 
7
- declare class InputOtp extends BaseElement {
8
- constructor();
9
- connectedCallback(): void;
10
- protected getAttributesToExclude(): string[];
11
- get _containerElement(): HTMLDivElement | null;
12
- maxLength: number;
13
- onChange: () => void;
14
- pin: any[];
15
- variant: 'digits_only' | 'with_spacing' | 'simple' | 'with_separator';
16
- inputes: {
17
- value: string;
18
- index: number;
19
- isSelected: boolean;
20
- userIndex: number;
21
- }[];
22
- raiseEvent(index: number, eventType?: 'changes' | 'focus', customIndex?: number): void;
23
- protected createRenderRoot(): HTMLElement | DocumentFragment;
24
- protected firstUpdated(_changedProperties: PropertyValues): void;
25
- checkIfCompleteAndSubmit(): void;
26
- protected render(): import('lit').TemplateResult<1>;
27
- }
28
- export { InputOtp, InputOtpGroup, InputOtpSeparator, InputOtpSlot };
6
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
7
+ /**
8
+ * Accessible one-time password component with copy paste functionality.
9
+ */
29
10
  declare global {
30
11
  interface HTMLElementTagNameMap {
31
- 'rtg-input-otp': InputOtp;
12
+ 'rtg-input-otp': InputOTP;
13
+ 'rtg-input-otp-group': InputOTPGroup;
14
+ 'rtg-input-otp-slot': InputOTPSlot;
15
+ 'rtg-input-otp-separator': InputOTPSeparator;
32
16
  }
33
17
  }
@@ -0,0 +1,28 @@
1
+ export type InputOTPAutocomplete = 'off' | 'on' | string;
2
+ export type InputOTPInputmode = 'numeric' | 'text' | 'decimal' | 'tel' | 'search' | 'email' | 'url';
3
+ export interface InputOTPProps {
4
+ autocomplete: InputOTPAutocomplete;
5
+ defaultValue?: string;
6
+ disabled?: boolean;
7
+ form?: string;
8
+ id: string;
9
+ inputmode: InputOTPInputmode;
10
+ maxlength: number;
11
+ name?: string;
12
+ pattern?: string;
13
+ required?: boolean;
14
+ value?: string;
15
+ onChange?: (newValue: string) => unknown;
16
+ onComplete?: (...args: any[]) => unknown;
17
+ onBlur?: (event: FocusEvent) => void;
18
+ onFocus?: (event: FocusEvent) => void;
19
+ onPaste?: (event: ClipboardEvent) => void;
20
+ pasteTransformer?: (pastedText: string) => string;
21
+ }
22
+ export declare const REGEXP_ONLY_DIGITS = "\\d+";
23
+ export declare const REGEXP_ONLY_CHARS = "[a-zA-Z]+";
24
+ export declare const REGEXP_ONLY_DIGITS_AND_CHARS = "[a-zA-Z0-9]+";
25
+ export interface InputOTPSlotProps {
26
+ index: number;
27
+ invalid?: boolean;
28
+ }
@@ -1,10 +1,13 @@
1
1
  import { Meta, StoryObj } from '@storybook/web-components-vite';
2
2
 
3
- declare const _default: Meta;
4
- export default _default;
3
+ declare const meta: Meta;
4
+ export default meta;
5
5
  type Story = StoryObj;
6
- export declare const DigitsOnly: Story;
7
- export declare const WithSpacing: Story;
8
- export declare const Simple: Story;
9
- export declare const WithSeparator: Story;
10
- export declare const InteractiveDemo: Story;
6
+ export declare const Demo: Story;
7
+ export declare const Pattern: Story;
8
+ export declare const Separator: Story;
9
+ export declare const Disabled: Story;
10
+ export declare const Invalid: Story;
11
+ export declare const FourDigits: Story;
12
+ export declare const Alphanumeric: Story;
13
+ export declare const Form: Story;
@@ -0,0 +1,27 @@
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import { LabelProps } from './label.defs';
3
+
4
+ /**
5
+ * The `<rtg-label>` component renders an accessible label associated with
6
+ * controls.
7
+ *
8
+ * @element rtg-label
9
+ * @slot label
10
+ */
11
+ export declare class Label extends LitElement implements LabelProps {
12
+ /**
13
+ * The id of the element the label is associated with.
14
+ */
15
+ for?: string;
16
+ /**
17
+ * The slot of the label root.
18
+ */
19
+ private get _rootSlot();
20
+ /**
21
+ * Handles the first updated callback, appending the children to the root
22
+ * slot.
23
+ */
24
+ protected firstUpdated(_changedProperties: PropertyValues): void;
25
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
26
+ render(): import('lit').TemplateResult<1>;
27
+ }