coles-solid-library 0.0.9 → 0.1.0
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/dist/components/Form/form.d.ts +17 -0
- package/dist/components/Form/formGroup.d.ts +35 -0
- package/dist/components/FormField/formField.d.ts +2 -1
- package/dist/components/FormField/formProvider.d.ts +6 -4
- package/dist/components/Icon/icon.d.ts +28 -0
- package/dist/components/Select/select.component.d.ts +2 -2
- package/dist/components/Table/table.d.ts +3 -2
- package/dist/components/Table/tableProvider.d.ts +1 -0
- package/dist/components/TableV2/cell.d.ts +16 -0
- package/dist/components/TableV2/column.d.ts +8 -0
- package/dist/components/TableV2/customElements.d.ts +9 -0
- package/dist/components/TableV2/header.d.ts +8 -0
- package/dist/components/TableV2/row.d.ts +22 -0
- package/dist/components/TableV2/table.d.ts +19 -0
- package/dist/components/TableV2/tableProvider.d.ts +77 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.esm.js +109024 -461
- package/dist/styles.css +1036 -0
- package/package.json +4 -4
- package/readme.md +13 -9
- package/themes/_mixins.scss +0 -0
- package/themes/_variables.scss +23 -0
- package/themes/themes.scss +6 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
import { SetStoreFunction } from "solid-js/store";
|
|
3
|
+
import { FormGroup } from "./formGroup";
|
|
4
|
+
interface FormContext<T extends object> {
|
|
5
|
+
data: T;
|
|
6
|
+
setData: SetStoreFunction<T>;
|
|
7
|
+
formGroup: FormGroup<T>;
|
|
8
|
+
}
|
|
9
|
+
declare const FormContext: import("solid-js").Context<FormContext<any> | undefined>;
|
|
10
|
+
export declare const useFormContext: <T extends object = any>() => FormContext<T>;
|
|
11
|
+
interface Props<T extends object> {
|
|
12
|
+
data: FormGroup<T>;
|
|
13
|
+
children: JSX.Element;
|
|
14
|
+
onSubmit: (data: T) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const Form: <T extends object>(props: Props<T>) => JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interface ValidatorResult<T> {
|
|
2
|
+
revalidate: (val: T) => boolean;
|
|
3
|
+
errKey: string;
|
|
4
|
+
}
|
|
5
|
+
export type ValidatorObject<T> = {
|
|
6
|
+
[P in keyof T]?: ValidatorResult<T[P]>[];
|
|
7
|
+
};
|
|
8
|
+
type FormGroupData<T extends object> = {
|
|
9
|
+
[P in keyof T]: [T[P], ValidatorResult<T[P]>[]];
|
|
10
|
+
};
|
|
11
|
+
export declare class FormGroup<T extends object> {
|
|
12
|
+
data: FormGroupData<T>;
|
|
13
|
+
private internalDataSignal;
|
|
14
|
+
private validators;
|
|
15
|
+
private errors;
|
|
16
|
+
constructor(data: FormGroupData<T>);
|
|
17
|
+
get(): T;
|
|
18
|
+
get(key: keyof T): T[keyof T];
|
|
19
|
+
hasValidator(key: keyof T, errKey: string): boolean;
|
|
20
|
+
hasError(key: keyof T): boolean;
|
|
21
|
+
set(key: keyof T, value: T[keyof T]): void;
|
|
22
|
+
validate(key?: keyof T): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class Validators {
|
|
25
|
+
private static required;
|
|
26
|
+
static get Required(): ValidatorResult<unknown>;
|
|
27
|
+
private static email;
|
|
28
|
+
static get Email(): ValidatorResult<string>;
|
|
29
|
+
static minLength(length: number): ValidatorResult<string | any[]>;
|
|
30
|
+
static maxLength(length: number): ValidatorResult<string | any[]>;
|
|
31
|
+
static pattern(errKey: string, pattern: RegExp): ValidatorResult<string>;
|
|
32
|
+
static custom<T>(errKey: string, validator: (value: T) => boolean): ValidatorResult<T>;
|
|
33
|
+
private static createValidatorResult;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -3,9 +3,10 @@ interface Props extends JSX.FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
|
3
3
|
children: JSX.Element;
|
|
4
4
|
styleType?: "primary" | "accent" | "tertiary";
|
|
5
5
|
name: string;
|
|
6
|
+
formName?: string;
|
|
6
7
|
class?: string;
|
|
7
|
-
value?: string;
|
|
8
8
|
legendClass?: string;
|
|
9
|
+
required?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const FormField: Component<Props>;
|
|
11
12
|
export { FormField };
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { Accessor, JSX, Component, Setter } from "solid-js";
|
|
2
|
-
interface formFieldContext {
|
|
2
|
+
interface formFieldContext<T = string> {
|
|
3
3
|
getName: Accessor<string>;
|
|
4
4
|
setName: Setter<string>;
|
|
5
5
|
getTextInside: Accessor<boolean>;
|
|
6
6
|
setTextInside: Setter<boolean>;
|
|
7
7
|
getFocused: Accessor<boolean>;
|
|
8
8
|
setFocused: Setter<boolean>;
|
|
9
|
-
getValue: Accessor<
|
|
10
|
-
setValue: Setter<
|
|
9
|
+
getValue: Accessor<T>;
|
|
10
|
+
setValue: Setter<T>;
|
|
11
11
|
getFieldType: Accessor<string>;
|
|
12
12
|
setFieldType: Setter<string>;
|
|
13
|
+
formName?: string;
|
|
13
14
|
}
|
|
14
15
|
interface ProviderProps {
|
|
15
16
|
children: JSX.Element;
|
|
16
17
|
name?: string;
|
|
17
18
|
value?: string;
|
|
18
19
|
type?: string;
|
|
20
|
+
formName?: string;
|
|
19
21
|
}
|
|
20
22
|
export declare const Provider: Component<ProviderProps>;
|
|
21
|
-
export declare function useFormProvider(): formFieldContext
|
|
23
|
+
export declare function useFormProvider<T = string>(): formFieldContext<T>;
|
|
22
24
|
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component } from "solid-js";
|
|
2
|
+
interface IconProps {
|
|
3
|
+
name: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
stroke?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders an icon from the Tabler Icons library.
|
|
10
|
+
*
|
|
11
|
+
* This component retrieves an icon component dynamically by its name, applying default properties
|
|
12
|
+
* if certain props are not provided:
|
|
13
|
+
* - size defaults to 24
|
|
14
|
+
* - color defaults to "currentColor"
|
|
15
|
+
* - stroke defaults to 2
|
|
16
|
+
*
|
|
17
|
+
* If the specified icon cannot be found in the Tabler Icons collection, an error is logged to the console
|
|
18
|
+
* and the component returns null.
|
|
19
|
+
*
|
|
20
|
+
* @param props - The icon properties.
|
|
21
|
+
* @param props.name - The name of the icon to render (e.g., "ArrowRight"). It should match the React Name key in the Tabler Icons library.
|
|
22
|
+
* @param props.size - The size to be applied to the icon. Defaults to 24 if not provided.
|
|
23
|
+
* @param props.color - The color to be applied to the icon. Defaults to "currentColor" if not provided.
|
|
24
|
+
* @param props.stroke - The stroke width for the icon's paths. Defaults to 2 if not provided.
|
|
25
|
+
* @returns A JSX element for the specified icon, or null if the icon name is not found.
|
|
26
|
+
*/
|
|
27
|
+
export declare const Icon: Component<IconProps>;
|
|
28
|
+
export {};
|
|
@@ -10,11 +10,11 @@ interface SelectContextValue<T> {
|
|
|
10
10
|
export declare const SelectContext: import("solid-js").Context<SelectContextValue<any> | undefined>;
|
|
11
11
|
interface SelectProps<T = string, K = boolean> {
|
|
12
12
|
multiple?: K;
|
|
13
|
-
value
|
|
13
|
+
value?: T;
|
|
14
14
|
transparent?: boolean;
|
|
15
15
|
id?: string;
|
|
16
16
|
defaultValue?: T;
|
|
17
|
-
onChange
|
|
17
|
+
onChange?: (value: T) => void;
|
|
18
18
|
placeholder?: string;
|
|
19
19
|
tooltip?: string;
|
|
20
20
|
renderValue?: (selected: T) => JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { JSX, type Accessor } from "solid-js";
|
|
2
2
|
export type ColumnState<T> = (item: T, index: number) => JSX.Element;
|
|
3
3
|
interface TableProps<T> extends JSX.HTMLAttributes<HTMLTableElement> {
|
|
4
|
-
data
|
|
4
|
+
data?: Accessor<T[]>;
|
|
5
5
|
columns: string[];
|
|
6
|
-
children
|
|
6
|
+
children: JSX.Element;
|
|
7
7
|
dropdown?: boolean;
|
|
8
|
+
formName?: string;
|
|
8
9
|
dropdownArrow?: {
|
|
9
10
|
width: string;
|
|
10
11
|
height: string;
|
|
@@ -13,6 +13,7 @@ export interface TableState<T = any> {
|
|
|
13
13
|
export interface TableContext<T = any> {
|
|
14
14
|
tableState: Accessor<TableState<StateType<T>>>;
|
|
15
15
|
setTableState: Setter<TableState<StateType<T>>>;
|
|
16
|
+
formName?: string;
|
|
16
17
|
}
|
|
17
18
|
interface TableProviderProps<T = any> {
|
|
18
19
|
children: JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
interface BaseCellProps<T> extends Omit<JSX.HTMLAttributes<HTMLTableCellElement>, "children"> {
|
|
3
|
+
style?: JSX.CSSProperties;
|
|
4
|
+
class?: string;
|
|
5
|
+
}
|
|
6
|
+
interface FooterCellProps<T> extends BaseCellProps<T> {
|
|
7
|
+
footer: boolean;
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
interface RegularCellProps<T> extends BaseCellProps<T> {
|
|
11
|
+
footer?: false | undefined;
|
|
12
|
+
children: (item: T, index: number) => JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
type CellProps<T> = FooterCellProps<T> | RegularCellProps<T>;
|
|
15
|
+
export declare const Cell: <T>(props: CellProps<T>) => JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
interface HeaderProps extends JSX.HTMLAttributes<HTMLTableCellElement> {
|
|
3
|
+
children: JSX.Element;
|
|
4
|
+
style?: JSX.CSSProperties;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Header: <T>(props: HeaderProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
interface BaseRowProps extends JSX.HTMLAttributes<HTMLTableRowElement> {
|
|
3
|
+
children?: JSX.Element[];
|
|
4
|
+
rowNumber?: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
style?: JSX.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
interface HeaderRowProps extends BaseRowProps {
|
|
9
|
+
header?: true | undefined;
|
|
10
|
+
footer?: never;
|
|
11
|
+
}
|
|
12
|
+
interface BodyRowProps extends BaseRowProps {
|
|
13
|
+
header?: never;
|
|
14
|
+
footer?: never;
|
|
15
|
+
}
|
|
16
|
+
interface FooterRowProps extends BaseRowProps {
|
|
17
|
+
footer?: true | undefined;
|
|
18
|
+
header?: never;
|
|
19
|
+
}
|
|
20
|
+
export type RowProps = HeaderRowProps | BodyRowProps | FooterRowProps;
|
|
21
|
+
export declare const Row: <T>(props: RowProps) => JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JSX, Setter } from "solid-js";
|
|
2
|
+
import { StyleContainer } from "./tableProvider";
|
|
3
|
+
interface TableProps<T> {
|
|
4
|
+
children: JSX.Element;
|
|
5
|
+
data: T[];
|
|
6
|
+
setData?: Setter<T[]>;
|
|
7
|
+
columns: string[];
|
|
8
|
+
formName?: string;
|
|
9
|
+
style?: JSX.CSSProperties;
|
|
10
|
+
id?: string;
|
|
11
|
+
class?: string;
|
|
12
|
+
otherStyles?: {
|
|
13
|
+
thead?: StyleContainer<HTMLTableSectionElement>;
|
|
14
|
+
tbody?: StyleContainer<HTMLTableSectionElement>;
|
|
15
|
+
tfoot?: StyleContainer<HTMLTableSectionElement>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const Table: <T>(props: TableProps<T>) => JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { JSX } from "solid-js";
|
|
2
|
+
export interface StyleContainer<T> {
|
|
3
|
+
class?: string;
|
|
4
|
+
style?: JSX.CSSProperties | string;
|
|
5
|
+
all?: JSX.HTMLAttributes<T>;
|
|
6
|
+
}
|
|
7
|
+
export interface HeadStyle {
|
|
8
|
+
[colName: string]: StyleContainer<HTMLTableCellElement>;
|
|
9
|
+
}
|
|
10
|
+
export interface HeadRowStyle {
|
|
11
|
+
[rowIndex: string]: StyleContainer<HTMLTableRowElement>;
|
|
12
|
+
}
|
|
13
|
+
export interface HeaderOrganized {
|
|
14
|
+
[headIndex: string]: HeaderStorage;
|
|
15
|
+
}
|
|
16
|
+
export interface HeaderStorage {
|
|
17
|
+
[name: string]: JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export interface RowStyle {
|
|
20
|
+
[rowIndex: string]: StyleContainer<HTMLTableRowElement>;
|
|
21
|
+
}
|
|
22
|
+
export interface CellRowStyle {
|
|
23
|
+
[rowIndex: string]: CellStyle;
|
|
24
|
+
}
|
|
25
|
+
export interface CellStyle {
|
|
26
|
+
[colName: string]: StyleContainer<HTMLTableCellElement>;
|
|
27
|
+
}
|
|
28
|
+
export interface RowStorage<T> {
|
|
29
|
+
[name: string]: (item: T, index: number) => JSX.Element;
|
|
30
|
+
}
|
|
31
|
+
export interface RowOrganized<T> {
|
|
32
|
+
[rowIndex: string]: RowStorage<T>;
|
|
33
|
+
}
|
|
34
|
+
export interface ShoeBox {
|
|
35
|
+
[rowIndex: string]: StyleContainer<HTMLTableRowElement>;
|
|
36
|
+
}
|
|
37
|
+
export interface Socks {
|
|
38
|
+
[name: string]: JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
export interface SockDrawer {
|
|
41
|
+
[rowIndex: string]: Socks;
|
|
42
|
+
}
|
|
43
|
+
export interface ColumnStyle {
|
|
44
|
+
[colName: string]: StyleContainer<HTMLTableColElement>;
|
|
45
|
+
}
|
|
46
|
+
export interface TableContext<T> {
|
|
47
|
+
getDataSource: () => T[];
|
|
48
|
+
setDataSource: (data: T[]) => void;
|
|
49
|
+
addHeaderCell: (name: string, index: number, header: JSX.Element) => void;
|
|
50
|
+
addRowCell: (index: number, name: string, cell: (item: T, index: number) => JSX.Element) => void;
|
|
51
|
+
addFooterCell: (index: number, name: string, cell: JSX.Element) => void;
|
|
52
|
+
addColumnStyle: (name: string, style: StyleContainer<HTMLTableColElement>) => void;
|
|
53
|
+
addHeaderStyle: (name: string, style: StyleContainer<HTMLTableCellElement>) => void;
|
|
54
|
+
addRowStyle: (index: number, style: StyleContainer<HTMLTableRowElement>) => void;
|
|
55
|
+
addFooterRowStyle: (index: number, style: StyleContainer<HTMLTableRowElement>) => void;
|
|
56
|
+
addHeaderRowStyle: (index: number, style: StyleContainer<HTMLTableRowElement>) => void;
|
|
57
|
+
}
|
|
58
|
+
export declare function useTableContext<T>(): TableContext<T>;
|
|
59
|
+
interface TableProviderProps<T> extends TableContext<T> {
|
|
60
|
+
children: JSX.Element;
|
|
61
|
+
}
|
|
62
|
+
export declare const TableProvider: <T>(props: TableProviderProps<T>) => JSX.Element;
|
|
63
|
+
interface ColumnProps {
|
|
64
|
+
children: JSX.Element[];
|
|
65
|
+
name: string;
|
|
66
|
+
rowNumber?: number;
|
|
67
|
+
}
|
|
68
|
+
export declare const ColumnProvider: (props: ColumnProps) => JSX.Element;
|
|
69
|
+
export declare const useColumnContext: () => {
|
|
70
|
+
name: string;
|
|
71
|
+
rowNumber?: number;
|
|
72
|
+
};
|
|
73
|
+
export interface ColumnInfo {
|
|
74
|
+
name: string;
|
|
75
|
+
rowNumber: number;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,18 @@ export * from './components/Input/Input';
|
|
|
9
9
|
export * from './components/Select/select.component';
|
|
10
10
|
export * from './components/Select/option.component';
|
|
11
11
|
export * from './components/Snackbar/snackbar';
|
|
12
|
-
export * from './components/Table/table';
|
|
13
12
|
export * from './components/popup/popup.component';
|
|
14
13
|
export * from './components/Tabs/tabs';
|
|
15
14
|
export * from './components/TextArea/TextArea';
|
|
16
15
|
export * from './components/expansion/expansion';
|
|
17
16
|
export * from './components/popup/popup.component';
|
|
18
|
-
export
|
|
17
|
+
export * from './components/Icon/icon';
|
|
18
|
+
export { Form } from './components/Form/form';
|
|
19
|
+
export { FormGroup, Validators } from './components/Form/formGroup';
|
|
20
|
+
export { addTheme } from './tools/tools';
|
|
21
|
+
export { Table } from './components/TableV2/table';
|
|
22
|
+
export { Row } from './components/TableV2/row';
|
|
23
|
+
export { Column } from './components/TableV2/column';
|
|
24
|
+
export { Cell } from './components/TableV2/cell';
|
|
25
|
+
export { Header } from './components/TableV2/header';
|
|
26
|
+
export { type StyleContainer } from './components/TableV2/tableProvider';
|