@capyx/components-library 0.0.1 → 0.0.3
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/README.md +250 -210
- package/dist/addons/AutocompleteInput.d.ts +40 -0
- package/dist/addons/AutocompleteInput.d.ts.map +1 -0
- package/dist/addons/AutocompleteInput.js +101 -0
- package/dist/addons/CharacterCountInput.d.ts +73 -0
- package/dist/addons/CharacterCountInput.d.ts.map +1 -0
- package/dist/addons/CharacterCountInput.js +130 -0
- package/dist/addons/index.d.ts +5 -0
- package/dist/addons/index.d.ts.map +1 -0
- package/dist/addons/index.js +2 -0
- package/dist/components/CheckInput.d.ts +49 -0
- package/dist/components/CheckInput.d.ts.map +1 -0
- package/dist/components/CheckInput.js +58 -0
- package/dist/components/DateInput.d.ts +63 -0
- package/dist/components/DateInput.d.ts.map +1 -0
- package/dist/components/DateInput.js +86 -0
- package/dist/components/FileInput.d.ts +102 -0
- package/dist/components/FileInput.d.ts.map +1 -0
- package/dist/components/FileInput.js +164 -0
- package/dist/components/RichTextInput.d.ts +34 -0
- package/dist/components/RichTextInput.d.ts.map +1 -0
- package/dist/components/RichTextInput.js +57 -0
- package/dist/components/SelectInput.d.ts +54 -0
- package/dist/components/SelectInput.d.ts.map +1 -0
- package/dist/components/SelectInput.js +64 -0
- package/dist/components/SwitchInput.d.ts +46 -0
- package/dist/components/SwitchInput.d.ts.map +1 -0
- package/dist/components/SwitchInput.js +53 -0
- package/dist/components/TagsInput.d.ts +35 -0
- package/dist/components/TagsInput.d.ts.map +1 -0
- package/dist/components/TagsInput.js +67 -0
- package/dist/components/TextAreaInput.d.ts +71 -0
- package/dist/components/TextAreaInput.d.ts.map +1 -0
- package/dist/components/TextAreaInput.js +113 -0
- package/dist/components/TextInput.d.ts +68 -0
- package/dist/components/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput.js +77 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/index.cjs +18 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +87 -72
- package/.storybook/main.ts +0 -33
- package/.storybook/preview.ts +0 -36
- package/.storybook/vitest.setup.ts +0 -7
- package/biome.json +0 -37
- package/lib/addons/CharacterCountInput.tsx +0 -204
- package/lib/addons/index.ts +0 -2
- package/lib/components/CheckInput.tsx +0 -126
- package/lib/components/DateInput.tsx +0 -179
- package/lib/components/FileInput.tsx +0 -353
- package/lib/components/RichTextInput.tsx +0 -112
- package/lib/components/SelectInput.tsx +0 -144
- package/lib/components/SwitchInput.tsx +0 -116
- package/lib/components/TagsInput.tsx +0 -118
- package/lib/components/TextAreaInput.tsx +0 -211
- package/lib/components/TextInput.tsx +0 -381
- package/stories/CharacterCountInput.stories.tsx +0 -104
- package/stories/CheckInput.stories.tsx +0 -80
- package/stories/DateInput.stories.tsx +0 -137
- package/stories/FileInput.stories.tsx +0 -125
- package/stories/RichTextInput.stories.tsx +0 -77
- package/stories/SelectInput.stories.tsx +0 -131
- package/stories/SwitchInput.stories.tsx +0 -80
- package/stories/TagsInput.stories.tsx +0 -69
- package/stories/TextAreaInput.stories.tsx +0 -117
- package/stories/TextInput.stories.tsx +0 -167
- package/vitest.config.ts +0 -37
- package/vitest.shims.d.ts +0 -1
- /package/{lib/components/index.ts → dist/components/index.js} +0 -0
- /package/{lib/index.ts → dist/index.js} +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import debounce from 'lodash.debounce';
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { Form } from 'react-bootstrap';
|
|
5
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
6
|
+
const MIN_TEXTAREA_HEIGHT = 32;
|
|
7
|
+
/**
|
|
8
|
+
* A flexible textarea input component with automatic height adjustment,
|
|
9
|
+
* react-hook-form integration, and optional debouncing.
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Auto-expands height based on content
|
|
13
|
+
* - Seamless integration with react-hook-form for validation
|
|
14
|
+
* - Debounced onChange callback to reduce update frequency
|
|
15
|
+
* - Built-in validation rules (required, maxLength)
|
|
16
|
+
* - Works in both controlled and standalone modes
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Basic usage with react-hook-form
|
|
20
|
+
* <TextAreaInput
|
|
21
|
+
* name="description"
|
|
22
|
+
* label="Description"
|
|
23
|
+
* required
|
|
24
|
+
* maxLength={500}
|
|
25
|
+
* placeholder="Enter description..."
|
|
26
|
+
* />
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // With custom onChange and debouncing
|
|
30
|
+
* <TextAreaInput
|
|
31
|
+
* name="notes"
|
|
32
|
+
* label="Notes"
|
|
33
|
+
* debounceMs={300}
|
|
34
|
+
* onChange={(value) => console.log(value)}
|
|
35
|
+
* />
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Standalone mode without form context
|
|
39
|
+
* <TextAreaInput
|
|
40
|
+
* name="comment"
|
|
41
|
+
* value={commentText}
|
|
42
|
+
* onChange={setCommentText}
|
|
43
|
+
* placeholder="Add your comment..."
|
|
44
|
+
* />
|
|
45
|
+
*/
|
|
46
|
+
export const TextAreaInput = ({ name, label, required = false, maxLength, controlSize, placeholder, value, onChange, disabled = false, isReadOnly = false, isPlainText = false, debounceMs, }) => {
|
|
47
|
+
const formContext = useFormContext();
|
|
48
|
+
// Create ref for debounced onChange to clean up on unmount
|
|
49
|
+
const debouncedOnChangeRef = useRef(null);
|
|
50
|
+
// Create debounced version of onChange if debounceMs is provided
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (debounceMs && onChange) {
|
|
53
|
+
debouncedOnChangeRef.current = debounce(onChange, debounceMs);
|
|
54
|
+
}
|
|
55
|
+
// Cleanup on unmount
|
|
56
|
+
return () => {
|
|
57
|
+
debouncedOnChangeRef.current?.cancel();
|
|
58
|
+
};
|
|
59
|
+
}, [debounceMs, onChange]);
|
|
60
|
+
// Helper to handle onChange with optional debouncing
|
|
61
|
+
const handleChange = (value) => {
|
|
62
|
+
if (debounceMs && debouncedOnChangeRef.current) {
|
|
63
|
+
debouncedOnChangeRef.current(value);
|
|
64
|
+
}
|
|
65
|
+
else if (onChange) {
|
|
66
|
+
onChange(value);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const getFieldError = (fieldName) => {
|
|
70
|
+
try {
|
|
71
|
+
const error = formContext?.formState?.errors?.[fieldName];
|
|
72
|
+
return error?.message;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const errorMessage = getFieldError(name);
|
|
79
|
+
const isInvalid = !!errorMessage;
|
|
80
|
+
const textareaRef = useRef(null);
|
|
81
|
+
const [_textAreaValue, setTextAreaValue] = useState('');
|
|
82
|
+
const _handleTextAreaChange = (event) => {
|
|
83
|
+
setTextAreaValue(event.target.value);
|
|
84
|
+
handleChange(event.target.value);
|
|
85
|
+
};
|
|
86
|
+
useLayoutEffect(() => {
|
|
87
|
+
if (textareaRef.current) {
|
|
88
|
+
textareaRef.current.style.height = 'inherit';
|
|
89
|
+
textareaRef.current.style.height = `${Math.max(textareaRef.current.scrollHeight, MIN_TEXTAREA_HEIGHT)}px`;
|
|
90
|
+
}
|
|
91
|
+
}, []);
|
|
92
|
+
// Integrated with react-hook-form
|
|
93
|
+
if (formContext) {
|
|
94
|
+
return (_jsx(Controller, { name: name, control: formContext.control, rules: {
|
|
95
|
+
required: required ? `${label || 'This field'} is required` : false,
|
|
96
|
+
maxLength: maxLength
|
|
97
|
+
? {
|
|
98
|
+
value: maxLength,
|
|
99
|
+
message: `Maximum ${maxLength} characters allowed`,
|
|
100
|
+
}
|
|
101
|
+
: undefined,
|
|
102
|
+
}, render: ({ field }) => (_jsx(Form.Control, { ...field, onChange: (e) => {
|
|
103
|
+
field.onChange(e);
|
|
104
|
+
setTextAreaValue(e.target.value);
|
|
105
|
+
handleChange(e.target.value);
|
|
106
|
+
}, ref: textareaRef, style: {
|
|
107
|
+
minHeight: MIN_TEXTAREA_HEIGHT,
|
|
108
|
+
resize: 'none',
|
|
109
|
+
}, as: "textarea", required: required, maxLength: maxLength, size: controlSize, placeholder: placeholder, disabled: disabled, readOnly: isReadOnly, plaintext: isPlainText, isInvalid: isInvalid })) }));
|
|
110
|
+
}
|
|
111
|
+
// Standalone mode
|
|
112
|
+
return (_jsx(Form.Control, { as: "textarea", required: required, maxLength: maxLength, size: controlSize, placeholder: placeholder, value: value || '', disabled: disabled, readOnly: isReadOnly, plaintext: isPlainText }));
|
|
113
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the TextInput component
|
|
4
|
+
*/
|
|
5
|
+
export type TextInputProps = {
|
|
6
|
+
/** The name of the text input field */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Label text displayed for the input */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** HTML input type (default: "text") */
|
|
11
|
+
type?: string;
|
|
12
|
+
/** Placeholder text shown when input is empty */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
/** Size of the input control */
|
|
15
|
+
size?: 'sm' | 'lg';
|
|
16
|
+
/** Current input value (standalone mode) */
|
|
17
|
+
value?: string | number;
|
|
18
|
+
/** Callback function called when the input value changes */
|
|
19
|
+
onChange?: (value: string) => void;
|
|
20
|
+
/** Callback function called when the input loses focus */
|
|
21
|
+
onBlur?: () => void;
|
|
22
|
+
/** Whether the field is required */
|
|
23
|
+
required?: boolean;
|
|
24
|
+
/** Whether the input is disabled */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Whether the input is read-only */
|
|
27
|
+
readOnly?: boolean;
|
|
28
|
+
/** Whether to render as plain text */
|
|
29
|
+
plainText?: boolean;
|
|
30
|
+
/** Minimum value for number inputs */
|
|
31
|
+
min?: string | number;
|
|
32
|
+
/** Maximum value for number inputs */
|
|
33
|
+
max?: string | number;
|
|
34
|
+
/** Maximum number of characters allowed */
|
|
35
|
+
maxLength?: number;
|
|
36
|
+
/** Regex pattern for validation */
|
|
37
|
+
pattern?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* TextInput - A text input component with react-hook-form integration
|
|
41
|
+
*
|
|
42
|
+
* Provides a text input that works both standalone and with react-hook-form.
|
|
43
|
+
* Supports various input types (text, number, email, tel, password, etc.) and
|
|
44
|
+
* automatic validation.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* // With react-hook-form
|
|
49
|
+
* <TextInput
|
|
50
|
+
* name="email"
|
|
51
|
+
* label="Email Address"
|
|
52
|
+
* type="email"
|
|
53
|
+
* required
|
|
54
|
+
* placeholder="Enter your email"
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* // Standalone mode
|
|
58
|
+
* <TextInput
|
|
59
|
+
* name="username"
|
|
60
|
+
* label="Username"
|
|
61
|
+
* value={username}
|
|
62
|
+
* onChange={setUsername}
|
|
63
|
+
* maxLength={50}
|
|
64
|
+
* />
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare const TextInput: FC<TextInputProps>;
|
|
68
|
+
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../lib/components/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,EAAE,EAAE,MAAM,OAAO,CAAC;AAI7C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA6GxC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Form } from 'react-bootstrap';
|
|
3
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
4
|
+
/**
|
|
5
|
+
* TextInput - A text input component with react-hook-form integration
|
|
6
|
+
*
|
|
7
|
+
* Provides a text input that works both standalone and with react-hook-form.
|
|
8
|
+
* Supports various input types (text, number, email, tel, password, etc.) and
|
|
9
|
+
* automatic validation.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // With react-hook-form
|
|
14
|
+
* <TextInput
|
|
15
|
+
* name="email"
|
|
16
|
+
* label="Email Address"
|
|
17
|
+
* type="email"
|
|
18
|
+
* required
|
|
19
|
+
* placeholder="Enter your email"
|
|
20
|
+
* />
|
|
21
|
+
*
|
|
22
|
+
* // Standalone mode
|
|
23
|
+
* <TextInput
|
|
24
|
+
* name="username"
|
|
25
|
+
* label="Username"
|
|
26
|
+
* value={username}
|
|
27
|
+
* onChange={setUsername}
|
|
28
|
+
* maxLength={50}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const TextInput = ({ name, label, type = 'text', placeholder, size, value, onChange, onBlur, required = false, disabled = false, readOnly = false, plainText = false, min, max, maxLength, pattern, }) => {
|
|
33
|
+
const formContext = useFormContext();
|
|
34
|
+
// Helper to safely get nested error
|
|
35
|
+
const getFieldError = (fieldName) => {
|
|
36
|
+
try {
|
|
37
|
+
const error = formContext?.formState?.errors?.[fieldName];
|
|
38
|
+
return error?.message;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const errorMessage = getFieldError(name);
|
|
45
|
+
const handleTextChange = (event) => {
|
|
46
|
+
onChange?.(event.currentTarget.value);
|
|
47
|
+
};
|
|
48
|
+
// Integrated with react-hook-form
|
|
49
|
+
if (formContext) {
|
|
50
|
+
return (_jsx(Controller, { name: name, control: formContext.control, rules: {
|
|
51
|
+
required: required ? `${label || 'This field'} is required` : false,
|
|
52
|
+
maxLength: maxLength
|
|
53
|
+
? {
|
|
54
|
+
value: maxLength,
|
|
55
|
+
message: `Maximum ${maxLength} characters allowed`,
|
|
56
|
+
}
|
|
57
|
+
: undefined,
|
|
58
|
+
min: min
|
|
59
|
+
? { value: Number(min), message: `Minimum value is ${min}` }
|
|
60
|
+
: undefined,
|
|
61
|
+
max: max
|
|
62
|
+
? { value: Number(max), message: `Maximum value is ${max}` }
|
|
63
|
+
: undefined,
|
|
64
|
+
pattern: pattern
|
|
65
|
+
? { value: new RegExp(pattern), message: 'Invalid format' }
|
|
66
|
+
: undefined,
|
|
67
|
+
}, render: ({ field }) => (_jsx(Form.Control, { ...field, value: field.value ?? '', type: type, size: size, min: min, max: max, required: required, maxLength: maxLength, placeholder: placeholder, onChange: (e) => {
|
|
68
|
+
field.onChange(e);
|
|
69
|
+
onChange?.(e.target.value);
|
|
70
|
+
}, onBlur: () => {
|
|
71
|
+
field.onBlur();
|
|
72
|
+
onBlur?.();
|
|
73
|
+
}, disabled: disabled, readOnly: readOnly, plaintext: plainText, pattern: pattern, isInvalid: !!errorMessage })) }));
|
|
74
|
+
}
|
|
75
|
+
// Standalone mode (no form context)
|
|
76
|
+
return (_jsx(Form.Control, { type: type, size: size, min: min, max: max, required: required, maxLength: maxLength, placeholder: placeholder, value: value ?? '', onChange: handleTextChange, onBlur: onBlur, disabled: disabled, readOnly: readOnly, plaintext: plainText, pattern: pattern }));
|
|
77
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { CheckInput } from './CheckInput';
|
|
2
|
+
export { DateInput } from './DateInput';
|
|
3
|
+
export { FileInput } from './FileInput';
|
|
4
|
+
export { RichTextInput } from './RichTextInput';
|
|
5
|
+
export { SelectInput } from './SelectInput';
|
|
6
|
+
export { SwitchInput } from './SwitchInput';
|
|
7
|
+
export { TagsInput } from './TagsInput';
|
|
8
|
+
export { TextAreaInput } from './TextAreaInput';
|
|
9
|
+
export { TextInput } from './TextInput';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./addons"), exports);
|
|
18
|
+
__exportStar(require("./components"), exports);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,72 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@capyx/components-library",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Capyx Components Library for forms across applications",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"components",
|
|
10
|
+
"library",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://gitlab.com/capyx/rmt/components-library#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://gitlab.com/capyx/rmt/components-library/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+ssh://git@gitlab.com/capyx/rmt/components-library.git"
|
|
20
|
+
},
|
|
21
|
+
"author": "tinael.devresse@capyx.be",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.js",
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"directories": {
|
|
37
|
+
"lib": "lib"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc && npm run build:cjs",
|
|
41
|
+
"build:cjs": "tsc --module commonjs --outDir dist-cjs && node scripts/rename-cjs.js",
|
|
42
|
+
"prepublishOnly": "npm run build",
|
|
43
|
+
"lint": "biome lint .",
|
|
44
|
+
"lint:fix": "biome lint --write .",
|
|
45
|
+
"format": "biome format .",
|
|
46
|
+
"format:fix": "biome format --write .",
|
|
47
|
+
"check": "biome check .",
|
|
48
|
+
"check:fix": "biome check --write .",
|
|
49
|
+
"storybook": "storybook dev -p 6006",
|
|
50
|
+
"build-storybook": "storybook build"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@biomejs/biome": "^2.3.11",
|
|
54
|
+
"@chromatic-com/storybook": "^5.0.0",
|
|
55
|
+
"@storybook/addon-a11y": "^10.1.11",
|
|
56
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
57
|
+
"@storybook/addon-onboarding": "^10.1.11",
|
|
58
|
+
"@storybook/addon-vitest": "^10.1.11",
|
|
59
|
+
"@storybook/react-vite": "^10.1.11",
|
|
60
|
+
"@types/dateformat": "^5.0.3",
|
|
61
|
+
"@types/lodash.debounce": "^4.0.9",
|
|
62
|
+
"@types/node": "^25.0.9",
|
|
63
|
+
"@types/react": "^19.2.8",
|
|
64
|
+
"@types/react-autosuggest": "^10.1.11",
|
|
65
|
+
"@types/react-datepicker": "^7.0.0",
|
|
66
|
+
"@vitest/browser-playwright": "^4.0.17",
|
|
67
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
68
|
+
"playwright": "^1.57.0",
|
|
69
|
+
"storybook": "^10.1.11",
|
|
70
|
+
"typescript": "^5.9.3",
|
|
71
|
+
"vitest": "^4.0.17"
|
|
72
|
+
},
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"@emotion/styled": "^11.14.1",
|
|
75
|
+
"@mui/material": "^7.3.7",
|
|
76
|
+
"@mui/x-date-pickers": "^8.25.0",
|
|
77
|
+
"bootstrap": "^5.3.8",
|
|
78
|
+
"dateformat": "^5.0.3",
|
|
79
|
+
"dayjs": "^1.11.19",
|
|
80
|
+
"lodash.debounce": "^4.0.8",
|
|
81
|
+
"react": "^19.2.3",
|
|
82
|
+
"react-autosuggest": "^10.1.0",
|
|
83
|
+
"react-bootstrap": "^2.10.10",
|
|
84
|
+
"react-hook-form": "^7.71.1",
|
|
85
|
+
"react-quill-new": "^3.7.0"
|
|
86
|
+
}
|
|
87
|
+
}
|
package/.storybook/main.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
"stories": [
|
|
5
|
-
"../stories/**/*.mdx",
|
|
6
|
-
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
7
|
-
],
|
|
8
|
-
"addons": [
|
|
9
|
-
"@chromatic-com/storybook",
|
|
10
|
-
"@storybook/addon-vitest",
|
|
11
|
-
"@storybook/addon-a11y",
|
|
12
|
-
"@storybook/addon-docs",
|
|
13
|
-
"@storybook/addon-onboarding"
|
|
14
|
-
],
|
|
15
|
-
"framework": "@storybook/react-vite",
|
|
16
|
-
async viteFinal(config) {
|
|
17
|
-
// Suppress "use client" directive warnings from MUI components
|
|
18
|
-
if (config.build) {
|
|
19
|
-
config.build.rollupOptions = {
|
|
20
|
-
...config.build.rollupOptions,
|
|
21
|
-
onwarn(warning, warn) {
|
|
22
|
-
// Ignore "use client" directive warnings
|
|
23
|
-
if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes('"use client"')) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
warn(warning);
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return config;
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
export default config;
|
package/.storybook/preview.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/react-vite'
|
|
2
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
3
|
-
import 'react-quill-new/dist/quill.snow.css';
|
|
4
|
-
|
|
5
|
-
const preview: Preview = {
|
|
6
|
-
parameters: {
|
|
7
|
-
backgrounds: {
|
|
8
|
-
default: 'dark',
|
|
9
|
-
values: [
|
|
10
|
-
{
|
|
11
|
-
name: 'dark',
|
|
12
|
-
value: '#1a1a1a',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'light',
|
|
16
|
-
value: '#ffffff',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
controls: {
|
|
21
|
-
matchers: {
|
|
22
|
-
color: /(background|color)$/i,
|
|
23
|
-
date: /Date$/i,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
a11y: {
|
|
28
|
-
// 'todo' - show a11y violations in the test UI only
|
|
29
|
-
// 'error' - fail CI on a11y violations
|
|
30
|
-
// 'off' - skip a11y checks entirely
|
|
31
|
-
test: 'todo'
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default preview;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
|
|
2
|
-
import { setProjectAnnotations } from '@storybook/react-vite';
|
|
3
|
-
import * as projectAnnotations from './preview';
|
|
4
|
-
|
|
5
|
-
// This is an important step to apply the right configuration when testing your stories.
|
|
6
|
-
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
|
7
|
-
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
|
package/biome.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
|
|
3
|
-
"vcs": {
|
|
4
|
-
"enabled": false,
|
|
5
|
-
"clientKind": "git",
|
|
6
|
-
"useIgnoreFile": false
|
|
7
|
-
},
|
|
8
|
-
"files": {
|
|
9
|
-
"ignoreUnknown": false
|
|
10
|
-
},
|
|
11
|
-
"formatter": {
|
|
12
|
-
"enabled": true,
|
|
13
|
-
"indentStyle": "tab"
|
|
14
|
-
},
|
|
15
|
-
"linter": {
|
|
16
|
-
"enabled": true,
|
|
17
|
-
"rules": {
|
|
18
|
-
"recommended": true,
|
|
19
|
-
"suspicious": {
|
|
20
|
-
"noExplicitAny": "warn"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"javascript": {
|
|
25
|
-
"formatter": {
|
|
26
|
-
"quoteStyle": "single"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"assist": {
|
|
30
|
-
"enabled": true,
|
|
31
|
-
"actions": {
|
|
32
|
-
"source": {
|
|
33
|
-
"organizeImports": "on"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|