@trackunit/react-form-components 0.0.104 → 0.0.106

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-form-components",
3
- "version": "0.0.104",
3
+ "version": "0.0.106",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@trackunit/css-class-variance-utilities": "0.0.11",
11
11
  "@trackunit/i18n-library-translation": "0.0.67",
12
- "@trackunit/react-components": "0.1.139",
12
+ "@trackunit/react-components": "0.1.140",
13
13
  "@trackunit/tailwind-styled-components": "0.0.60",
14
14
  "date-fns": "2.29.3",
15
15
  "libphonenumber-js": "1.10.36",
@@ -22,5 +22,5 @@ interface ActionButtonProps extends ButtonCommonProps, CommonProps {
22
22
  * @param {ActionButtonProps} props - The props for the ActionButton component
23
23
  * @returns {JSX.Element} ActionButton component
24
24
  */
25
- export declare const ActionButton: ({ type, value, dataTestId, iconSize, disabled }: ActionButtonProps) => JSX.Element;
25
+ export declare const ActionButton: ({ type, value, dataTestId, iconSize, disabled, className, }: ActionButtonProps) => JSX.Element;
26
26
  export {};
@@ -0,0 +1,4 @@
1
+ export declare const cvaActionButton: (props?: ({
2
+ size?: "small" | "medium" | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ export declare const cvaActionContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -49,6 +49,14 @@ export interface BaseInputProps extends FilteredInputProps, CommonProps {
49
49
  * A flag to disable interaction with input for example if you want to use input as a child of higher component
50
50
  */
51
51
  nonInteractive?: boolean;
52
+ /**
53
+ * Custom css classes for the inner Input element.
54
+ */
55
+ inputClassName?: string;
56
+ /**
57
+ * Custom css classes for the addon before element.
58
+ */
59
+ addonBeforeClassName?: string;
52
60
  }
53
61
  /**
54
62
  * A base input component that can be used for text inputs, password inputs, etc.
@@ -0,0 +1,21 @@
1
+ export declare const cvaInputBase: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
+ export declare const cvaInputBaseDisabled: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaInputBaseInvalid: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
4
+ export declare const cvaInput: (props?: ({
5
+ size?: "small" | "medium" | null | undefined;
6
+ disabled?: boolean | null | undefined;
7
+ invalid?: boolean | null | undefined;
8
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
9
+ export declare const cvaInputField: (props?: ({
10
+ size?: "small" | "medium" | null | undefined;
11
+ disabled?: boolean | null | undefined;
12
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
13
+ export declare const cvaInputAddon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
14
+ export declare const cvaInputAddonBefore: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
15
+ export declare const cvaInputAddonAfter: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
16
+ export declare const cvaInputPrefix: (props?: ({
17
+ disabled?: boolean | null | undefined;
18
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
19
+ export declare const cvaInputSuffix: (props?: ({
20
+ disabled?: boolean | null | undefined;
21
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1 +1,2 @@
1
1
  export * from "./BaseInput";
2
+ export * from "./BaseInput.variants";
@@ -0,0 +1,8 @@
1
+ export declare const cvaCheckbox: (props?: ({
2
+ disabled?: boolean | null | undefined;
3
+ invalid?: boolean | null | undefined;
4
+ state?: "selected" | "deselected" | "indeterminate" | null | undefined;
5
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
6
+ export declare const cvaCheckboxContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
+ export declare const cvaCheckboxInput: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
8
+ export declare const cvaCheckboxIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -0,0 +1,8 @@
1
+ export declare const cvaDropZone: (props?: ({
2
+ size?: "small" | "medium" | "large" | null | undefined;
3
+ disabled?: boolean | null | undefined;
4
+ dragActive?: boolean | null | undefined;
5
+ dropComplete?: boolean | null | undefined;
6
+ invalid?: boolean | null | undefined;
7
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
+ export declare const cvaDropZoneLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -0,0 +1,8 @@
1
+ export declare const cvaFormGroup: (props?: ({
2
+ disabled?: boolean | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ export declare const cvaFormGroupContainerBefore: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
5
+ export declare const cvaFormGroupContainerAfter: (props?: ({
6
+ invalid?: boolean | null | undefined;
7
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
+ export declare const cvaHelpAddon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,6 +1,5 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
2
  import * as React from "react";
3
- import "./Label.css";
4
3
  export interface LabelProps extends CommonProps {
5
4
  /**
6
5
  * ID of the label.
@@ -0,0 +1,4 @@
1
+ export declare const cvaLabel: (props?: ({
2
+ invalid?: boolean | null | undefined;
3
+ disabled?: boolean | null | undefined;
4
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,5 @@
1
+ export declare const cvaOptionCardLabel: (props?: ({
2
+ disabled?: boolean | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ export declare const cvaOptionCardContent: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
5
+ export declare const cvaOptionCardContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,6 +1,5 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
2
  import * as React from "react";
3
- import "./RadioGroup.css";
4
3
  export interface RadioGroupProps<V extends string | number> extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
5
4
  /**
6
5
  */
@@ -0,0 +1,13 @@
1
+ export declare const cvaRadioGroup: (props?: ({
2
+ layout?: "inline" | null | undefined;
3
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
4
+ export declare const cvaRadioItem: (props?: ({
5
+ checked?: boolean | null | undefined;
6
+ invalid?: boolean | null | undefined;
7
+ disabled?: boolean | null | undefined;
8
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
9
+ export declare const cvaRadioItemWrapper: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
10
+ export declare const cvaRadioItemLabelContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
11
+ export declare const cvaRadioItemDescription: (props?: ({
12
+ disabled?: boolean | null | undefined;
13
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -51,7 +51,6 @@ export interface SearchProps extends CommonProps, TextInputProps {
51
51
  * Event that search box is cleared.
52
52
  */
53
53
  onClear?: () => void;
54
- ref?: React.Ref<HTMLInputElement | undefined>;
55
54
  }
56
55
  /**
57
56
  * The Search component is used to render a search input field.
@@ -59,4 +58,4 @@ export interface SearchProps extends CommonProps, TextInputProps {
59
58
  * @param {SearchProps} props - The props for the Search component
60
59
  * @returns {JSX.Element} Search component
61
60
  */
62
- export declare const Search: ({ className, placeholder, value, widenInputOnFocus, showBorderWhenNotInFocus, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete, ref, ...rest }: SearchProps) => JSX.Element;
61
+ export declare const Search: ({ className, placeholder, value, widenInputOnFocus, showBorderWhenNotInFocus, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete, ...rest }: SearchProps) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const cvaSearch: (props?: ({
2
+ border?: boolean | null | undefined;
3
+ widenOnFocus?: boolean | null | undefined;
4
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,15 @@
1
+ export declare const cvaSelect: (props?: ({
2
+ invalid?: boolean | null | undefined;
3
+ disabled?: boolean | null | undefined;
4
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
5
+ export declare const cvaSelectIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
6
+ export declare const cvaSelectPrefix: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
7
+ export declare const cvaSelectXIcon: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
8
+ export declare const cvaSelectMenuList: (props?: ({
9
+ menuIsOpen?: boolean | null | undefined;
10
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
11
+ export declare const cvaSelectDynamicTagContainer: (props?: ({
12
+ visible?: boolean | null | undefined;
13
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
14
+ export declare const cvaSelectCounter: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
15
+ export declare const cvaSelectMenu: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,6 +1,7 @@
1
1
  import ValueType from "react-select";
2
2
  export * from "./CreatableSelect";
3
3
  export * from "./Select";
4
+ export * from "./Select.variants";
4
5
  export * from "./SelectMenuItem/SelectMenuItem";
5
6
  export * from "./shared";
6
7
  export * from "./useCustomComponents";
@@ -12,4 +12,3 @@ export declare function isMultiValue<Option>(arg: MultiValue<Option> | SingleVal
12
12
  * @returns {OptionsOrGroups<Option, Group>} An array of ordered options with selected on top
13
13
  */
14
14
  export declare const getOrderedOptions: <Option, Group extends GroupBase<Option>>(options: OptionsOrGroups<Option, Group> | undefined, value: PropsValue<Option> | undefined) => OptionsOrGroups<Option, Group>;
15
- export declare const SelectPrefix: import("dist/libs/ui/tailwind-styled-components/src/lib/types").TailwindComponent<import("dist/libs/ui/tailwind-styled-components/src/lib/types").TailwindHtmlComponent<"div">, {}>;
@@ -0,0 +1,5 @@
1
+ export declare const cvaTextArea: (props?: ({
2
+ disabled?: boolean | null | undefined;
3
+ invalid?: boolean | null | undefined;
4
+ resize?: "both" | "vertical" | "horizontal" | "none" | null | undefined;
5
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -1,10 +1,9 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
2
  import * as React from "react";
3
- import "./Toggle.css";
4
3
  export type ToggleSize = "small" | "medium";
5
4
  export interface ToggleProps extends CommonProps {
6
5
  /**
7
- * ID of the toggle.
6
+ * id of the toggle.
8
7
  */
9
8
  id: string;
10
9
  /**
@@ -16,7 +15,7 @@ export interface ToggleProps extends CommonProps {
16
15
  */
17
16
  onChange: (toggled: boolean, event?: React.ChangeEvent<HTMLInputElement>) => void;
18
17
  /**
19
- * OnClick event handler it is thrown on root element of the component tree.
18
+ * onClick event handler it is thrown on root element of the component tree.
20
19
  */
21
20
  onClick?: React.MouseEventHandler<HTMLDivElement>;
22
21
  /**
@@ -0,0 +1,16 @@
1
+ export declare const cvaToggleWrapper: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
+ export declare const cvaToggleInputContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
3
+ export declare const cvaToggleTrack: (props?: ({
4
+ size?: "small" | "medium" | null | undefined;
5
+ disabled?: boolean | null | undefined;
6
+ toggled?: boolean | null | undefined;
7
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
8
+ export declare const cvaToggleThumb: (props?: ({
9
+ toggled?: boolean | null | undefined;
10
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
11
+ export declare const cvaToggleInput: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
12
+ export declare const cvaToggleLabelContainer: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
13
+ export declare const cvaToggleLabel: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
14
+ export declare const cvaToggleDescription: (props?: ({
15
+ disabled?: boolean | null | undefined;
16
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
@@ -0,0 +1,2 @@
1
+ export declare const cvaUploadInputField: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
2
+ export declare const cvaUploadInputAddonBefore: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
package/index.cjs.css DELETED
@@ -1,259 +0,0 @@
1
- /* CSS related to the Label component */
2
-
3
- .tu-label {
4
- @apply text-base
5
- text-slate-700
6
- overflow-hidden
7
- whitespace-nowrap
8
- text-ellipsis
9
- hover:text-slate-800
10
- group-hover:text-slate-800
11
- active:text-slate-800
12
- group-active:text-slate-800;
13
-
14
- &--invalid {
15
- @apply text-red-600
16
- hover:text-red-700
17
- group-hover:text-red-700
18
- active:text-red-700
19
- group-active:text-red-700;
20
- }
21
-
22
- &--disabled {
23
- @apply text-slate-400
24
- hover:text-slate-400
25
- group-hover:text-slate-400;
26
- }
27
- }
28
-
29
- /* CSS related to the RadioGroup component */
30
- .tu-radiogroup {
31
- @apply flex
32
- gap-2
33
- flex-col
34
- items-start;
35
-
36
- &--inline {
37
- @apply flex
38
- gap-3
39
- flex-row
40
- items-center;
41
- }
42
- }
43
-
44
- .tu-radioitem {
45
- @apply w-4
46
- h-4
47
- appearance-none
48
- rounded-3xl
49
- bg-white
50
- border-solid
51
- border
52
- border-slate-300
53
- shadow-sm
54
- shrink-0
55
- transition
56
- box-border
57
- hover:cursor-pointer
58
- hover:bg-slate-100
59
- focus:ring-2
60
- focus:ring-offset-2
61
- focus:ring-blue-700;
62
-
63
- &__wrapper {
64
- @apply flex
65
- gap-2
66
- items-center;
67
- }
68
-
69
- &--checked {
70
- @apply border-solid
71
- border-4
72
- border-blue-600
73
- bg-white
74
- hover:bg-slate-100
75
- hover:cursor-pointer
76
- outline-0
77
- active:bg-slate-200
78
- active:ring-2
79
- active:ring-offset-2
80
- active:ring-blue-700
81
- focus:bg-slate-200
82
- focus:ring-2
83
- focus:ring-offset-2
84
- focus:ring-blue-700
85
- group-active:ring-2
86
- group-active:ring-offset-2
87
- group-active:ring-blue-700;
88
- }
89
-
90
- &--invalid {
91
- @apply border-red-600
92
- active:ring-red-700
93
- focus:ring-red-700
94
- group-focus:ring-2
95
- group-focus:ring-offset-2;
96
- }
97
-
98
- &--disabled {
99
- @apply bg-slate-400
100
- border-slate-300
101
- cursor-not-allowed
102
- group-hover:bg-slate-400
103
- group-focus:bg-slate-400
104
- hover:bg-slate-400
105
- focus:bg-slate-400
106
- active:bg-slate-400
107
- focus:ring-0
108
- focus:ring-offset-0
109
- group-active:ring-0
110
- group-active:ring-offset-0;
111
- }
112
-
113
- &--disabled.tu-radioitem--checked {
114
- @apply bg-white;
115
- }
116
-
117
- &__label-container {
118
- @apply gap-y-1
119
- grid;
120
- }
121
-
122
- &__description {
123
- @apply text-sm
124
- font-normal
125
- text-slate-500
126
- text-left
127
- whitespace-nowrap
128
- text-ellipsis
129
- overflow-hidden;
130
-
131
- &--disabled {
132
- @apply text-slate-400
133
- hover:text-slate-400
134
- group-hover:text-slate-400;
135
- }
136
- }
137
- }
138
-
139
- /* CSS related to the toggle component */
140
- .tu-toggle {
141
- @apply rounded-full
142
- bg-white
143
- h-full
144
- aspect-square
145
- translate-x-0
146
- transition-all;
147
-
148
- &__wrapper {
149
- @apply flex
150
- gap-2;
151
- }
152
-
153
- &__input-container {
154
- @apply flex
155
- self-start
156
- w-fit
157
- active:shadow
158
- rounded-full
159
- cursor-pointer
160
- focus-within:ring
161
- focus-within:ring-offset-2
162
- focus-within:ring-blue-700;
163
- }
164
-
165
- &__input {
166
- @apply absolute
167
- opacity-0
168
- -z-10;
169
- }
170
-
171
- &__switch-container {
172
- @apply flex
173
- items-center
174
- p-1
175
- cursor-pointer
176
- rounded-full
177
- bg-slate-300
178
- focus:bg-slate-400
179
- hover:bg-slate-400
180
- active:bg-slate-500;
181
- }
182
-
183
- &__switch {
184
- @apply bg-white
185
- rounded-full
186
- h-full
187
- w-5/12
188
- aspect-square
189
- translate-x-4
190
- transition-all;
191
- }
192
-
193
- &--medium {
194
- @apply flex
195
- items-center
196
- p-1
197
- cursor-pointer
198
- w-9
199
- h-5;
200
- }
201
-
202
- &--small {
203
- @apply flex
204
- items-center
205
- p-1
206
- cursor-pointer
207
- w-8
208
- h-4;
209
-
210
- .tu-toggle__switch {
211
- @apply w-4/12;
212
- }
213
- }
214
-
215
- &--toggled {
216
- @apply flex
217
- items-center
218
- p-1
219
- cursor-pointer
220
- bg-blue-600
221
- focus:bg-blue-700
222
- hover:bg-blue-700
223
- active:bg-blue-800;
224
- }
225
-
226
- &--disabled {
227
- @apply flex
228
- items-center
229
- p-1
230
- cursor-not-allowed
231
- pointer-events-none
232
- bg-slate-200;
233
- }
234
-
235
- &--disabled.tu-toggle--toggled {
236
- @apply bg-slate-400;
237
- }
238
-
239
- &__label-container {
240
- @apply gap-y-1
241
- grid;
242
- }
243
-
244
- &__description {
245
- @apply text-sm
246
- font-normal
247
- text-slate-500
248
- text-left
249
- whitespace-nowrap
250
- text-ellipsis
251
- overflow-hidden;
252
-
253
- &--disabled {
254
- @apply text-slate-400
255
- hover:text-slate-400
256
- group-hover:text-slate-400;
257
- }
258
- }
259
- }