@paygreen/pgui 2.0.0 → 2.1.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 (45) hide show
  1. package/README.md +110 -0
  2. package/dist/cjs/index.js +42703 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/cjs/types/components/ActionsButton/index.d.ts +6 -0
  5. package/dist/cjs/types/components/DataList/index.d.ts +42 -0
  6. package/dist/cjs/types/components/FormGroup/index.d.ts +12 -0
  7. package/dist/cjs/types/components/Pagination/index.d.ts +43 -0
  8. package/dist/cjs/types/components/SearchInput/index.d.ts +11 -0
  9. package/dist/cjs/types/components/Select/index.d.ts +114 -0
  10. package/dist/cjs/types/components/index.d.ts +6 -0
  11. package/dist/cjs/types/index.d.ts +2 -0
  12. package/dist/cjs/types/theme/components/badge.d.ts +8 -0
  13. package/dist/cjs/types/theme/components/button.d.ts +141 -0
  14. package/dist/cjs/types/theme/components/index.d.ts +4 -0
  15. package/dist/cjs/types/theme/components/input.d.ts +48 -0
  16. package/dist/cjs/types/theme/components/tag.d.ts +9 -0
  17. package/dist/cjs/types/theme/foundations/colors.d.ts +65 -0
  18. package/dist/cjs/types/theme/foundations/index.d.ts +86 -0
  19. package/dist/cjs/types/theme/foundations/shadows.d.ts +10 -0
  20. package/dist/cjs/types/theme/foundations/typography.d.ts +10 -0
  21. package/dist/cjs/types/theme/index.d.ts +1 -0
  22. package/dist/cjs/types/theme/theme.d.ts +1 -0
  23. package/dist/esm/index.js +42654 -0
  24. package/dist/esm/index.js.map +1 -0
  25. package/dist/esm/types/components/ActionsButton/index.d.ts +6 -0
  26. package/dist/esm/types/components/DataList/index.d.ts +42 -0
  27. package/dist/esm/types/components/FormGroup/index.d.ts +12 -0
  28. package/dist/esm/types/components/Pagination/index.d.ts +43 -0
  29. package/dist/esm/types/components/SearchInput/index.d.ts +11 -0
  30. package/dist/esm/types/components/Select/index.d.ts +114 -0
  31. package/dist/esm/types/components/index.d.ts +6 -0
  32. package/dist/esm/types/index.d.ts +2 -0
  33. package/dist/esm/types/theme/components/badge.d.ts +8 -0
  34. package/dist/esm/types/theme/components/button.d.ts +141 -0
  35. package/dist/esm/types/theme/components/index.d.ts +4 -0
  36. package/dist/esm/types/theme/components/input.d.ts +48 -0
  37. package/dist/esm/types/theme/components/tag.d.ts +9 -0
  38. package/dist/esm/types/theme/foundations/colors.d.ts +65 -0
  39. package/dist/esm/types/theme/foundations/index.d.ts +86 -0
  40. package/dist/esm/types/theme/foundations/shadows.d.ts +10 -0
  41. package/dist/esm/types/theme/foundations/typography.d.ts +10 -0
  42. package/dist/esm/types/theme/index.d.ts +1 -0
  43. package/dist/esm/types/theme/theme.d.ts +1 -0
  44. package/dist/index.d.ts +233 -0
  45. package/package.json +85 -6
@@ -0,0 +1,233 @@
1
+ import React, { FC, ReactNode } from 'react';
2
+ import * as _chakra_ui_react from '@chakra-ui/react';
3
+ import { IconButtonProps, FlexProps, AccordionProps, FormControlProps, StackProps, InputProps, BoxProps } from '@chakra-ui/react';
4
+ import * as react_select_dist_declarations_src_useStateManager from 'react-select/dist/declarations/src/useStateManager';
5
+ import * as react_select from 'react-select';
6
+ import { GroupBase, Props } from 'react-select';
7
+ import * as react_select_dist_declarations_src_filters from 'react-select/dist/declarations/src/filters';
8
+ import * as react_select_dist_declarations_src_components from 'react-select/dist/declarations/src/components';
9
+ import * as react_select_dist_declarations_src_Select from 'react-select/dist/declarations/src/Select';
10
+
11
+ declare type ActionsButtonProps = Omit<IconButtonProps, 'aria-label'> & {
12
+ label: string;
13
+ };
14
+ declare const ActionsButton: FC<React.PropsWithChildren<ActionsButtonProps>>;
15
+
16
+ declare type DataListColumns = Record<string, DataListCellProps>;
17
+ declare type DataListContextValue = {
18
+ setColumns: React.Dispatch<React.SetStateAction<DataListColumns>>;
19
+ columns: DataListColumns;
20
+ isHover: boolean;
21
+ };
22
+ declare const DataListContext: React.Context<DataListContextValue>;
23
+ declare const DataListHeaderContext: React.Context<boolean>;
24
+ declare type DataListCellProps = FlexProps & {
25
+ colName?: string;
26
+ colWidth?: string | number | Record<string, string | number>;
27
+ isVisible?: boolean | boolean[] | Record<string, boolean>;
28
+ };
29
+ declare const DataListCell: ({ children, colName, colWidth, isVisible, ...rest }: DataListCellProps) => JSX.Element | null;
30
+ declare const DataListAccordion: ({ ...rest }: {
31
+ [x: string]: any;
32
+ }) => JSX.Element;
33
+ declare const DataListAccordionButton: ({ ...rest }: {
34
+ [x: string]: any;
35
+ }) => JSX.Element;
36
+ declare const DataListAccordionIcon: ({ ...rest }: {
37
+ [x: string]: any;
38
+ }) => JSX.Element;
39
+ declare const DataListAccordionPanel: ({ ...rest }: {
40
+ [x: string]: any;
41
+ }) => JSX.Element;
42
+ declare type DataListRowProps = FlexProps & {
43
+ isVisible?: boolean | boolean[] | Record<string, boolean>;
44
+ isDisabled?: boolean;
45
+ };
46
+ declare const DataListRow: FC<React.PropsWithChildren<DataListRowProps>>;
47
+ declare type DataListHeaderProps = DataListRowProps;
48
+ declare const DataListHeader: FC<React.PropsWithChildren<DataListHeaderProps>>;
49
+ declare type DataListFooterProps = DataListRowProps;
50
+ declare const DataListFooter: FC<React.PropsWithChildren<DataListFooterProps>>;
51
+ declare type DataListProps = AccordionProps & {
52
+ isHover?: boolean;
53
+ };
54
+ declare const DataList: FC<React.PropsWithChildren<DataListProps>>;
55
+
56
+ declare type FormGroupProps = Omit<FormControlProps, 'onChange' | 'defaultValue' | 'label'> & {
57
+ children?: ReactNode;
58
+ errorMessage?: ReactNode;
59
+ helper?: ReactNode;
60
+ id?: string;
61
+ isRequired?: boolean;
62
+ label?: ReactNode;
63
+ showError?: boolean;
64
+ };
65
+ declare const FormGroup: ({ children, errorMessage, helper, id, isRequired, label, showError, ...props }: FormGroupProps) => JSX.Element;
66
+
67
+ declare const getPaginationInfo: ({ page, pageSize, totalItems, }: {
68
+ page?: number | undefined;
69
+ pageSize?: number | undefined;
70
+ totalItems?: number | undefined;
71
+ }) => {
72
+ firstPage: number;
73
+ lastPage: number;
74
+ firstItemOnPage: number;
75
+ lastItemOnPage: number;
76
+ isFirstPage: boolean;
77
+ isLastPage: boolean;
78
+ };
79
+ declare type PaginationContextValue<PageType = number> = {
80
+ page: PageType;
81
+ setPage: (page: PageType) => void;
82
+ firstPage: PageType;
83
+ isFirstPage: boolean;
84
+ lastPage: PageType;
85
+ isLastPage: boolean;
86
+ totalItems: number;
87
+ isLoadingPage: boolean;
88
+ pageSize: number;
89
+ firstItemOnPage: number;
90
+ lastItemOnPage: number;
91
+ };
92
+ declare const PaginationContext: React.Context<PaginationContextValue<number>>;
93
+ declare const PaginationButtonFirstPage: FC<React.PropsWithChildren<Omit<IconButtonProps, 'aria-label'>>>;
94
+ declare const PaginationButtonPrevPage: FC<React.PropsWithChildren<Omit<IconButtonProps, 'aria-label'>>>;
95
+ declare const PaginationButtonLastPage: FC<React.PropsWithChildren<Omit<IconButtonProps, 'aria-label'>>>;
96
+ declare const PaginationButtonNextPage: FC<React.PropsWithChildren<Omit<IconButtonProps, 'aria-label'>>>;
97
+ declare const PaginationInfo: ({ ...rest }: {
98
+ [x: string]: any;
99
+ }) => JSX.Element;
100
+ declare type PaginationProps = StackProps & {
101
+ setPage: (page: number) => void;
102
+ page?: number;
103
+ pageSize?: number;
104
+ totalItems?: number;
105
+ isLoadingPage?: boolean;
106
+ };
107
+ declare const Pagination: ({ setPage, page, pageSize, totalItems, isLoadingPage, ...rest }: PaginationProps) => JSX.Element;
108
+
109
+ declare type CustomProps = {
110
+ value?: string;
111
+ defaultValue?: string;
112
+ onChange?(value?: string): void;
113
+ delay?: number;
114
+ clearLabel?: string;
115
+ };
116
+ declare type SearchInputProps = Overwrite<InputProps, CustomProps>;
117
+ declare const SearchInput: _chakra_ui_react.ComponentWithAs<"input", SearchInputProps>;
118
+
119
+ declare module 'react' {
120
+ function forwardRef<T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
121
+ }
122
+ declare type SelectProps<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>> = {
123
+ isAsync?: boolean;
124
+ isCreatable?: boolean;
125
+ isError?: boolean;
126
+ size?: string;
127
+ formatCreateLabel?: (inputValue: string) => ReactNode;
128
+ loadOptions?: (input: unknown) => TODO;
129
+ defaultOptions?: unknown | boolean;
130
+ debounceDelay?: number;
131
+ } & Props<Option, IsMulti, Group> & Omit<BoxProps, 'defaultValue'>;
132
+ declare const Select: <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: {
133
+ isAsync?: boolean | undefined;
134
+ isCreatable?: boolean | undefined;
135
+ isError?: boolean | undefined;
136
+ size?: string | undefined;
137
+ formatCreateLabel?: ((inputValue: string) => ReactNode) | undefined;
138
+ loadOptions?: ((input: unknown) => TODO) | undefined;
139
+ defaultOptions?: unknown | boolean;
140
+ debounceDelay?: number | undefined;
141
+ } & Omit<Pick<react_select_dist_declarations_src_Select.Props<Option, IsMulti, Group>, "aria-label" | "form" | "autoFocus" | "name" | "value" | "className" | "id" | "aria-errormessage" | "aria-invalid" | "aria-labelledby" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "ariaLiveMessages" | "classNamePrefix" | "delimiter" | "formatOptionLabel" | "hideSelectedOptions" | "inputValue" | "inputId" | "instanceId" | "isClearable" | "isOptionSelected" | "menuPortalTarget" | "onInputChange" | "onMenuOpen" | "onMenuClose" | "onMenuScrollToTop" | "onMenuScrollToBottom" | "theme"> & {
142
+ placeholder?: React.ReactNode;
143
+ tabIndex?: number | undefined;
144
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
145
+ isLoading?: boolean | undefined;
146
+ isDisabled?: boolean | undefined;
147
+ components?: Partial<react_select_dist_declarations_src_components.SelectComponents<Option, IsMulti, Group>> | undefined;
148
+ pageSize?: number | undefined;
149
+ backspaceRemovesValue?: boolean | undefined;
150
+ blurInputOnSelect?: boolean | undefined;
151
+ captureMenuScroll?: boolean | undefined;
152
+ closeMenuOnSelect?: boolean | undefined;
153
+ closeMenuOnScroll?: boolean | ((event: Event) => boolean) | undefined;
154
+ controlShouldRenderValue?: boolean | undefined;
155
+ escapeClearsValue?: boolean | undefined;
156
+ filterOption?: ((option: react_select_dist_declarations_src_filters.FilterOptionOption<Option>, inputValue: string) => boolean) | null | undefined;
157
+ formatGroupLabel?: ((group: Group) => React.ReactNode) | undefined;
158
+ getOptionLabel?: react_select.GetOptionLabel<Option> | undefined;
159
+ getOptionValue?: react_select.GetOptionValue<Option> | undefined;
160
+ isOptionDisabled?: ((option: Option, selectValue: react_select.Options<Option>) => boolean) | undefined;
161
+ isMulti?: IsMulti | undefined;
162
+ isRtl?: boolean | undefined;
163
+ isSearchable?: boolean | undefined;
164
+ loadingMessage?: ((obj: {
165
+ inputValue: string;
166
+ }) => React.ReactNode) | undefined;
167
+ minMenuHeight?: number | undefined;
168
+ maxMenuHeight?: number | undefined;
169
+ menuIsOpen?: boolean | undefined;
170
+ menuPlacement?: react_select.MenuPlacement | undefined;
171
+ menuPosition?: react_select.MenuPosition | undefined;
172
+ menuShouldBlockScroll?: boolean | undefined;
173
+ menuShouldScrollIntoView?: boolean | undefined;
174
+ noOptionsMessage?: ((obj: {
175
+ inputValue: string;
176
+ }) => React.ReactNode) | undefined;
177
+ openMenuOnFocus?: boolean | undefined;
178
+ openMenuOnClick?: boolean | undefined;
179
+ options?: react_select.OptionsOrGroups<Option, Group> | undefined;
180
+ screenReaderStatus?: ((obj: {
181
+ count: number;
182
+ }) => string) | undefined;
183
+ styles?: react_select.StylesConfig<Option, IsMulti, Group> | undefined;
184
+ tabSelectsValue?: boolean | undefined;
185
+ } & {}, "value" | "onChange" | "inputValue" | "menuIsOpen" | "onInputChange" | "onMenuOpen" | "onMenuClose"> & Partial<Pick<react_select_dist_declarations_src_Select.Props<Option, IsMulti, Group>, "aria-label" | "form" | "autoFocus" | "name" | "value" | "className" | "id" | "aria-errormessage" | "aria-invalid" | "aria-labelledby" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "ariaLiveMessages" | "classNamePrefix" | "delimiter" | "formatOptionLabel" | "hideSelectedOptions" | "inputValue" | "inputId" | "instanceId" | "isClearable" | "isOptionSelected" | "menuPortalTarget" | "onInputChange" | "onMenuOpen" | "onMenuClose" | "onMenuScrollToTop" | "onMenuScrollToBottom" | "theme"> & {
186
+ placeholder?: React.ReactNode;
187
+ tabIndex?: number | undefined;
188
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
189
+ isLoading?: boolean | undefined;
190
+ isDisabled?: boolean | undefined;
191
+ components?: Partial<react_select_dist_declarations_src_components.SelectComponents<Option, IsMulti, Group>> | undefined;
192
+ pageSize?: number | undefined;
193
+ backspaceRemovesValue?: boolean | undefined;
194
+ blurInputOnSelect?: boolean | undefined;
195
+ captureMenuScroll?: boolean | undefined;
196
+ closeMenuOnSelect?: boolean | undefined;
197
+ closeMenuOnScroll?: boolean | ((event: Event) => boolean) | undefined;
198
+ controlShouldRenderValue?: boolean | undefined;
199
+ escapeClearsValue?: boolean | undefined;
200
+ filterOption?: ((option: react_select_dist_declarations_src_filters.FilterOptionOption<Option>, inputValue: string) => boolean) | null | undefined;
201
+ formatGroupLabel?: ((group: Group) => React.ReactNode) | undefined;
202
+ getOptionLabel?: react_select.GetOptionLabel<Option> | undefined;
203
+ getOptionValue?: react_select.GetOptionValue<Option> | undefined;
204
+ isOptionDisabled?: ((option: Option, selectValue: react_select.Options<Option>) => boolean) | undefined;
205
+ isMulti?: IsMulti | undefined;
206
+ isRtl?: boolean | undefined;
207
+ isSearchable?: boolean | undefined;
208
+ loadingMessage?: ((obj: {
209
+ inputValue: string;
210
+ }) => React.ReactNode) | undefined;
211
+ minMenuHeight?: number | undefined;
212
+ maxMenuHeight?: number | undefined;
213
+ menuIsOpen?: boolean | undefined;
214
+ menuPlacement?: react_select.MenuPlacement | undefined;
215
+ menuPosition?: react_select.MenuPosition | undefined;
216
+ menuShouldBlockScroll?: boolean | undefined;
217
+ menuShouldScrollIntoView?: boolean | undefined;
218
+ noOptionsMessage?: ((obj: {
219
+ inputValue: string;
220
+ }) => React.ReactNode) | undefined;
221
+ openMenuOnFocus?: boolean | undefined;
222
+ openMenuOnClick?: boolean | undefined;
223
+ options?: react_select.OptionsOrGroups<Option, Group> | undefined;
224
+ screenReaderStatus?: ((obj: {
225
+ count: number;
226
+ }) => string) | undefined;
227
+ styles?: react_select.StylesConfig<Option, IsMulti, Group> | undefined;
228
+ tabSelectsValue?: boolean | undefined;
229
+ } & {}> & react_select_dist_declarations_src_useStateManager.StateManagerAdditionalProps<Option> & Omit<BoxProps, "defaultValue"> & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
230
+
231
+ declare const theme: any;
232
+
233
+ export { ActionsButton, ActionsButtonProps, DataList, DataListAccordion, DataListAccordionButton, DataListAccordionIcon, DataListAccordionPanel, DataListCell, DataListCellProps, DataListContext, DataListFooter, DataListFooterProps, DataListHeader, DataListHeaderContext, DataListHeaderProps, DataListProps, DataListRow, DataListRowProps, FormGroup, FormGroupProps, Pagination, PaginationButtonFirstPage, PaginationButtonLastPage, PaginationButtonNextPage, PaginationButtonPrevPage, PaginationContext, PaginationContextValue, PaginationInfo, PaginationProps, SearchInput, Select, SelectProps, getPaginationInfo, theme };
package/package.json CHANGED
@@ -1,11 +1,38 @@
1
1
  {
2
2
  "name": "@paygreen/pgui",
3
- "version": "2.0.0",
4
- "description": "",
5
- "main": "index.js",
3
+ "version": "2.1.2",
4
+ "description": "PGUI is the design system coming from Paygreen.",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "types": "dist/index.d.ts",
6
11
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
12
+ "build": "rm -rf ./dist && rollup -c rollup.config.js",
13
+ "lint": "eslint src/**/*.{js,jsx,ts,tsx,json} --max-warnings=0",
14
+ "lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx,json}'",
15
+ "format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc.json",
16
+ "link-local-lib": "npm link @chakra-ui/react react",
17
+ "storybook": "start-storybook -p 6006",
18
+ "build-storybook": "build-storybook",
19
+ "prepare": "husky install"
8
20
  },
21
+ "lint-staged": {
22
+ "**/*.{ts,tsx,json,mdx}": [
23
+ "prettier --write --config ./.prettierrc.json",
24
+ "eslint --fix --max-warnings=0"
25
+ ]
26
+ },
27
+ "keywords": [
28
+ "design",
29
+ "system",
30
+ "chakra-ui",
31
+ "component",
32
+ "library",
33
+ "theme",
34
+ "react"
35
+ ],
9
36
  "repository": {
10
37
  "type": "git",
11
38
  "url": "git+https://gitlab.com/Paygreen-paygreen/v3/pgui.git"
@@ -15,5 +42,57 @@
15
42
  "bugs": {
16
43
  "url": "https://gitlab.com/Paygreen-paygreen/v3/pgui/issues"
17
44
  },
18
- "homepage": "https://gitlab.com/Paygreen-paygreen/v3/pgui#readme"
19
- }
45
+ "homepage": "https://gitlab.com/Paygreen-paygreen/v3/pgui#readme",
46
+ "devDependencies": {
47
+ "@babel/core": "^7.18.9",
48
+ "@chakra-ui/react": "^2.2.3",
49
+ "@chakra-ui/theme-tools": "^2.0.5",
50
+ "@emotion/react": "^11.9.3",
51
+ "@emotion/styled": "^11.9.3",
52
+ "@rollup/plugin-commonjs": "^22.0.1",
53
+ "@rollup/plugin-node-resolve": "^13.3.0",
54
+ "@rollup/plugin-typescript": "^8.3.3",
55
+ "@storybook/addon-actions": "^6.5.9",
56
+ "@storybook/addon-essentials": "^6.5.9",
57
+ "@storybook/addon-interactions": "^6.5.9",
58
+ "@storybook/addon-links": "^6.5.9",
59
+ "@storybook/builder-webpack4": "^6.5.9",
60
+ "@storybook/manager-webpack4": "^6.5.9",
61
+ "@storybook/react": "^6.5.9",
62
+ "@storybook/testing-library": "^0.0.13",
63
+ "@trivago/prettier-plugin-sort-imports": "^3.3.0",
64
+ "@types/react": "^18.0.15",
65
+ "@typescript-eslint/eslint-plugin": "^5.30.6",
66
+ "@typescript-eslint/parser": "^5.30.6",
67
+ "babel-loader": "^8.2.5",
68
+ "dayjs": "^1.11.4",
69
+ "eslint": "^8.20.0",
70
+ "eslint-config-airbnb-base": "^15.0.0",
71
+ "eslint-config-airbnb-typescript": "^17.0.0",
72
+ "eslint-config-prettier": "^8.5.0",
73
+ "eslint-import-resolver-typescript": "^3.2.7",
74
+ "eslint-plugin-import": "^2.26.0",
75
+ "eslint-plugin-jsx-a11y": "^6.6.0",
76
+ "eslint-plugin-prettier": "^4.2.1",
77
+ "eslint-plugin-react": "^7.30.1",
78
+ "eslint-plugin-react-hooks": "^4.6.0",
79
+ "eslint-plugin-storybook": "^0.6.1",
80
+ "framer-motion": "4.1.17",
81
+ "husky": "^8.0.1",
82
+ "lint-staged": "^13.0.3",
83
+ "prettier": "^2.7.1",
84
+ "react": "^18.2.0",
85
+ "react-dom": "^18.2.0",
86
+ "react-focus-lock": "^2.9.1",
87
+ "react-icons": "^4.4.0",
88
+ "react-select": "^5.4.0",
89
+ "rollup": "^2.77.0",
90
+ "rollup-plugin-dts": "^4.2.2",
91
+ "rollup-plugin-node-externals": "^4.1.1",
92
+ "rollup-plugin-peer-deps-external": "^2.2.4",
93
+ "rollup-plugin-postcss": "^4.0.2",
94
+ "rollup-plugin-terser": "^7.0.2",
95
+ "sass": "^1.53.0",
96
+ "typescript": "^4.7.4"
97
+ }
98
+ }