stargazer-ui 1.2.1 → 1.3.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/Bar/Bar.type.d.ts +6 -0
- package/Bar/index.js +2 -0
- package/Bar/index.js.map +1 -0
- package/Bar/package.json +1 -0
- package/Button/Button.js +12 -0
- package/Button/Button.js.map +1 -0
- package/{types/components/Button → Button}/Button.types.d.ts +1 -2
- package/Button/index.d.ts +3 -0
- package/Button/index.js +7 -0
- package/Button/index.js.map +1 -0
- package/Button/package.json +1 -0
- package/ButtonGroup/ButtonGroup.d.ts +4 -0
- package/ButtonGroup/ButtonGroup.js +10 -0
- package/ButtonGroup/ButtonGroup.js.map +1 -0
- package/ButtonGroup/ButtonGroup.types.d.ts +7 -0
- package/ButtonGroup/index.d.ts +3 -0
- package/ButtonGroup/index.js +7 -0
- package/ButtonGroup/index.js.map +1 -0
- package/ButtonGroup/package.json +1 -0
- package/Card/Card.js +41 -0
- package/Card/Card.js.map +1 -0
- package/{types/components/Card → Card}/Card.types.d.ts +3 -1
- package/Card/index.d.ts +3 -0
- package/Card/index.js +7 -0
- package/Card/index.js.map +1 -0
- package/Card/package.json +1 -0
- package/CloseButton/CloseButton.js +11 -0
- package/CloseButton/CloseButton.js.map +1 -0
- package/{types/components/CloseButton → CloseButton}/CloseButton.types.d.ts +1 -1
- package/CloseButton/index.d.ts +3 -0
- package/CloseButton/index.js +7 -0
- package/CloseButton/index.js.map +1 -0
- package/CloseButton/package.json +1 -0
- package/Dropdown/Dropdown.js +309 -0
- package/Dropdown/Dropdown.js.map +1 -0
- package/{types/components/Dropdown → Dropdown}/Dropdown.types.d.ts +3 -10
- package/Dropdown/index.d.ts +4 -0
- package/Dropdown/index.js +8 -0
- package/Dropdown/index.js.map +1 -0
- package/Dropdown/package.json +1 -0
- package/FileUploadButton/FileUploadButton.d.ts +4 -0
- package/FileUploadButton/FileUploadButton.js +21 -0
- package/FileUploadButton/FileUploadButton.js.map +1 -0
- package/FileUploadButton/FileUploadButton.types.d.ts +7 -0
- package/FileUploadButton/index.d.ts +3 -0
- package/FileUploadButton/index.js +7 -0
- package/FileUploadButton/index.js.map +1 -0
- package/FileUploadButton/package.json +1 -0
- package/FloatingLabel/FloatingLabel.js +17 -0
- package/FloatingLabel/FloatingLabel.js.map +1 -0
- package/{types/components/FloatingLabel → FloatingLabel}/FloatingLabel.types.d.ts +1 -1
- package/FloatingLabel/index.d.ts +3 -0
- package/FloatingLabel/index.js +7 -0
- package/FloatingLabel/index.js.map +1 -0
- package/FloatingLabel/package.json +1 -0
- package/Form/Form.d.ts +42 -0
- package/Form/Form.js +370 -0
- package/Form/Form.js.map +1 -0
- package/Form/Form.types.d.ts +135 -0
- package/Form/index.d.ts +4 -0
- package/Form/index.js +8 -0
- package/Form/index.js.map +1 -0
- package/Form/package.json +1 -0
- package/InputGroup/InputGroup.d.ts +7 -0
- package/InputGroup/InputGroup.js +31 -0
- package/InputGroup/InputGroup.js.map +1 -0
- package/InputGroup/InputGroup.types.d.ts +16 -0
- package/InputGroup/index.d.ts +4 -0
- package/InputGroup/index.js +7 -0
- package/InputGroup/index.js.map +1 -0
- package/InputGroup/package.json +1 -0
- package/List/List.d.ts +14 -0
- package/List/List.js +76 -0
- package/List/List.js.map +1 -0
- package/List/List.types.d.ts +28 -0
- package/List/index.d.ts +3 -0
- package/List/index.js +7 -0
- package/List/index.js.map +1 -0
- package/List/package.json +1 -0
- package/{types/components/Modal → Modal}/Modal.d.ts +1 -1
- package/Modal/Modal.js +160 -0
- package/Modal/Modal.js.map +1 -0
- package/{types/components/Modal → Modal}/Modal.types.d.ts +3 -2
- package/Modal/index.d.ts +3 -0
- package/Modal/index.js +7 -0
- package/Modal/index.js.map +1 -0
- package/Modal/package.json +1 -0
- package/Nav/Nav.js +28 -0
- package/Nav/Nav.js.map +1 -0
- package/{types/components/Nav → Nav}/Nav.types.d.ts +1 -1
- package/Nav/index.d.ts +4 -0
- package/Nav/index.js +7 -0
- package/Nav/index.js.map +1 -0
- package/Nav/package.json +1 -0
- package/{types/components/NavBar → NavBar}/Navbar.d.ts +1 -2
- package/NavBar/Navbar.js +36 -0
- package/NavBar/Navbar.js.map +1 -0
- package/{types/components/NavBar → NavBar}/Navbar.types.d.ts +2 -1
- package/NavBar/index.d.ts +4 -0
- package/NavBar/index.js +8 -0
- package/NavBar/index.js.map +1 -0
- package/NavBar/package.json +1 -0
- package/{types/components/NavDropdown → NavDropdown}/NavDropdown.d.ts +2 -2
- package/NavDropdown/NavDropdown.js +77 -0
- package/NavDropdown/NavDropdown.js.map +1 -0
- package/NavDropdown/index.d.ts +3 -0
- package/NavDropdown/index.js +7 -0
- package/NavDropdown/index.js.map +1 -0
- package/NavDropdown/package.json +1 -0
- package/Overlay/Overlay.d.ts +4 -0
- package/Overlay/Overlay.js +236 -0
- package/Overlay/Overlay.js.map +1 -0
- package/Overlay/Overlay.types.d.ts +22 -0
- package/{src/Overlay/index.ts → Overlay/index.d.ts} +3 -3
- package/Overlay/index.js +7 -0
- package/Overlay/index.js.map +1 -0
- package/Overlay/package.json +1 -0
- package/Popout/Popout.js +110 -0
- package/Popout/Popout.js.map +1 -0
- package/{types/components/Popout → Popout}/Popout.types.d.ts +1 -1
- package/Popout/index.d.ts +3 -0
- package/Popout/index.js +7 -0
- package/Popout/index.js.map +1 -0
- package/Popout/package.json +1 -0
- package/Spinner/Spinner.js +12 -0
- package/Spinner/Spinner.js.map +1 -0
- package/Spinner/index.d.ts +3 -0
- package/Spinner/index.js +7 -0
- package/Spinner/index.js.map +1 -0
- package/Spinner/package.json +1 -0
- package/Table/Table.js +11 -0
- package/Table/Table.js.map +1 -0
- package/{types/components/Table → Table}/Table.types.d.ts +1 -1
- package/Table/index.d.ts +3 -0
- package/Table/index.js +7 -0
- package/Table/index.js.map +1 -0
- package/Table/package.json +1 -0
- package/Tabs/Tabs.js +168 -0
- package/Tabs/Tabs.js.map +1 -0
- package/{types/components/Tabs → Tabs}/Tabs.types.d.ts +12 -1
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +7 -0
- package/Tabs/index.js.map +1 -0
- package/Tabs/package.json +1 -0
- package/ToggleButton/ToggleButton.d.ts +4 -0
- package/ToggleButton/ToggleButton.js +17 -0
- package/ToggleButton/ToggleButton.js.map +1 -0
- package/ToggleButton/ToggleButton.types.d.ts +7 -0
- package/ToggleButton/index.d.ts +3 -0
- package/ToggleButton/index.js +7 -0
- package/ToggleButton/index.js.map +1 -0
- package/ToggleButton/package.json +1 -0
- package/{src/hooks/index.ts → hooks/index.d.ts} +6 -6
- package/hooks/index.js +7 -0
- package/hooks/index.js.map +1 -0
- package/hooks/package.json +1 -0
- package/hooks/useClassname.d.ts +2 -0
- package/hooks/useClassname.js +7 -0
- package/hooks/useClassname.js.map +1 -0
- package/hooks/useDraggable.d.ts +23 -0
- package/hooks/useDraggable.js +147 -0
- package/hooks/useDraggable.js.map +1 -0
- package/hooks/useKeepElementFocused.d.ts +2 -0
- package/hooks/useKeepElementFocused.js +37 -0
- package/hooks/useKeepElementFocused.js.map +1 -0
- package/hooks/useQueryParams.d.ts +2 -0
- package/hooks/useQueryParams.js +13 -0
- package/hooks/useQueryParams.js.map +1 -0
- package/hooks/useScreenSize.d.ts +5 -0
- package/hooks/useScreenSize.js +21 -0
- package/hooks/useScreenSize.js.map +1 -0
- package/index.d.ts +18 -0
- package/index.js +19 -0
- package/index.js.map +1 -0
- package/package.json +1 -79
- package/styles/stargazerui.css +6513 -0
- package/styles/stargazerui.css.map +1 -0
- package/{src/utils/BaseTypes.ts → utils/BaseTypes.d.ts} +24 -30
- package/utils/ContrastingColor.d.ts +1 -0
- package/utils/MergeClassnames.d.ts +2 -0
- package/utils/MergeClassnames.js +7 -0
- package/utils/MergeClassnames.js.map +1 -0
- package/utils/MergeRefs.d.ts +2 -0
- package/utils/MergeRefs.js +16 -0
- package/utils/MergeRefs.js.map +1 -0
- package/.babelrc.json +0 -10
- package/.eslintrc.cjs +0 -18
- package/.gitattributes +0 -2
- package/LICENSE +0 -21
- package/dev/index.html +0 -12
- package/dev/index.jsx +0 -49
- package/dev/index.scss +0 -59
- package/dev/pages/ButtonPage.jsx +0 -44
- package/dev/pages/CardPage.jsx +0 -81
- package/dev/pages/DropdownPage.jsx +0 -31
- package/dev/pages/FormPage.jsx +0 -130
- package/dev/pages/ListPage.jsx +0 -52
- package/dev/pages/ModalPage.jsx +0 -37
- package/dev/pages/OverlayPage.jsx +0 -35
- package/dev/pages/components.jsx +0 -19
- package/dev/stargazerui.css +0 -3762
- package/dev/stargazerui.css.map +0 -1
- package/dev/test.jsx +0 -88
- package/rollup.config.js +0 -140
- package/scripts/writePackageJsons.js +0 -42
- package/src/Bar/Bar.tsx +0 -0
- package/src/Bar/Bar.type.ts +0 -9
- package/src/Bar/index.ts +0 -0
- package/src/Button/Button.tsx +0 -17
- package/src/Button/Button.types.ts +0 -8
- package/src/Button/index.ts +0 -3
- package/src/ButtonGroup/ButtonGroup.tsx +0 -14
- package/src/ButtonGroup/ButtonGroup.types.ts +0 -8
- package/src/ButtonGroup/index.ts +0 -3
- package/src/Card/Card.tsx +0 -70
- package/src/Card/Card.types.ts +0 -33
- package/src/Card/index.ts +0 -3
- package/src/CloseButton/CloseButton.tsx +0 -14
- package/src/CloseButton/CloseButton.types.ts +0 -6
- package/src/CloseButton/index.ts +0 -3
- package/src/Dropdown/Dropdown.tsx +0 -358
- package/src/Dropdown/Dropdown.types.ts +0 -52
- package/src/Dropdown/index.ts +0 -4
- package/src/FileUploadButton/FileUploadButton.tsx +0 -27
- package/src/FileUploadButton/FileUploadButton.types.ts +0 -9
- package/src/FileUploadButton/index.ts +0 -3
- package/src/FloatingLabel/FloatingLabel.tsx +0 -22
- package/src/FloatingLabel/FloatingLabel.types.ts +0 -11
- package/src/FloatingLabel/index.ts +0 -3
- package/src/Form/Form.tsx +0 -445
- package/src/Form/Form.types.ts +0 -117
- package/src/Form/index.ts +0 -4
- package/src/InputGroup/InputGroup.tsx +0 -46
- package/src/InputGroup/InputGroup.types.ts +0 -21
- package/src/InputGroup/index.ts +0 -4
- package/src/List/List.tsx +0 -112
- package/src/List/List.types.ts +0 -34
- package/src/List/index.ts +0 -4
- package/src/Modal/Modal.tsx +0 -220
- package/src/Modal/Modal.types.ts +0 -49
- package/src/Modal/index.ts +0 -4
- package/src/Nav/Nav.tsx +0 -43
- package/src/Nav/Nav.types.ts +0 -21
- package/src/Nav/index.ts +0 -4
- package/src/NavBar/Navbar.tsx +0 -57
- package/src/NavBar/Navbar.types.ts +0 -24
- package/src/NavBar/index.ts +0 -4
- package/src/NavDropdown/NavDropdown.tsx +0 -93
- package/src/NavDropdown/NavDropdown.types.ts +0 -6
- package/src/NavDropdown/index.ts +0 -3
- package/src/Overlay/Overlay.tsx +0 -277
- package/src/Overlay/Overlay.types.ts +0 -20
- package/src/Popout/Popout.tsx +0 -155
- package/src/Popout/Popout.types.ts +0 -42
- package/src/Popout/index.ts +0 -3
- package/src/Spinner/Spinner.tsx +0 -15
- package/src/Spinner/Spinner.types.ts +0 -7
- package/src/Spinner/index.ts +0 -3
- package/src/Table/Table.tsx +0 -16
- package/src/Table/Table.types.ts +0 -9
- package/src/Table/index.ts +0 -3
- package/src/Tabs/Tabs.tsx +0 -215
- package/src/Tabs/Tabs.types.ts +0 -49
- package/src/Tabs/index.ts +0 -3
- package/src/ToggleButton/ToggleButton.tsx +0 -21
- package/src/ToggleButton/ToggleButton.types.ts +0 -8
- package/src/ToggleButton/index.ts +0 -3
- package/src/hooks/useClassname.ts +0 -5
- package/src/hooks/useDraggable.ts +0 -186
- package/src/hooks/useKeepElementFocused.ts +0 -37
- package/src/hooks/useScreenSize.ts +0 -24
- package/src/index.ts +0 -21
- package/src/styles/_Card.scss +0 -166
- package/src/styles/_CloseButton.scss +0 -51
- package/src/styles/_CustomButton.scss +0 -132
- package/src/styles/_Dropdown.scss +0 -120
- package/src/styles/_FloatingLabel.scss +0 -56
- package/src/styles/_Forms.scss +0 -7
- package/src/styles/_Grid.scss +0 -178
- package/src/styles/_InputGroup.scss +0 -71
- package/src/styles/_List.scss +0 -62
- package/src/styles/_Modal.scss +0 -234
- package/src/styles/_ModalOld.scss +0 -242
- package/src/styles/_Nav.scss +0 -36
- package/src/styles/_NavBar.scss +0 -116
- package/src/styles/_NavDropdown.scss +0 -34
- package/src/styles/_OffCanvas.scss +0 -260
- package/src/styles/_OverLay.scss +0 -56
- package/src/styles/_Popout.scss +0 -75
- package/src/styles/_Spinner.scss +0 -19
- package/src/styles/_Table.scss +0 -34
- package/src/styles/_Tabs.scss +0 -129
- package/src/styles/_colors.scss +0 -510
- package/src/styles/_components.scss +0 -40
- package/src/styles/_functions.scss +0 -134
- package/src/styles/_mixins.scss +0 -26
- package/src/styles/_reset.scss +0 -231
- package/src/styles/_utilities.scss +0 -2480
- package/src/styles/_variables.scss +0 -146
- package/src/styles/forms/_FormCheck.scss +0 -269
- package/src/styles/forms/_FormControl.scss +0 -102
- package/src/styles/forms/_FormGroup.scss +0 -21
- package/src/styles/forms/_FormLabel.scss +0 -3
- package/src/styles/forms/_FormSelect.scss +0 -164
- package/src/styles/forms/_FormSlider.scss +0 -116
- package/src/styles/forms/_FormText.scss +0 -6
- package/src/utils/ContrastingColor.ts +0 -25
- package/src/utils/FileImportExport.js +0 -50
- package/src/utils/MergeClassnames.ts +0 -5
- package/src/utils/MergeRefs.ts +0 -12
- package/src/vite-env.d.ts +0 -1
- package/tsconfig-build.json +0 -4
- package/tsconfig.json +0 -79
- package/tsconfig.node.json +0 -10
- package/types/BaseTypes.d.ts +0 -19
- package/types/components/Button/index.d.ts +0 -1
- package/types/components/Card/index.d.ts +0 -1
- package/types/components/CloseButton/index.d.ts +0 -1
- package/types/components/Dropdown/index.d.ts +0 -1
- package/types/components/FloatingLabel/index.d.ts +0 -1
- package/types/components/Form/Form.d.ts +0 -17
- package/types/components/Form/Form.types.d.ts +0 -50
- package/types/components/Form/index.d.ts +0 -1
- package/types/components/InputGroup/InputGroup.d.ts +0 -6
- package/types/components/InputGroup/InputGroup.types.d.ts +0 -10
- package/types/components/InputGroup/index.d.ts +0 -1
- package/types/components/Modal/index.d.ts +0 -1
- package/types/components/Nav/index.d.ts +0 -1
- package/types/components/NavBar/index.d.ts +0 -1
- package/types/components/NavDropdown/index.d.ts +0 -1
- package/types/components/Popout/index.d.ts +0 -1
- package/types/components/Spinner/index.d.ts +0 -1
- package/types/components/Table/index.d.ts +0 -1
- package/types/components/Tabs/index.d.ts +0 -1
- package/types/components/ToggleButton/ToggleButton.d.ts +0 -9
- package/types/components/ToggleButton/ToggleButton.types.d.ts +0 -0
- package/types/components/ToggleButton/index.d.ts +0 -1
- package/types/components/index.d.ts +0 -16
- package/types/index.d.ts +0 -1
- package/vite.config.js +0 -57
- package/vite.config.js.timestamp-1708777378490-e94428ceb2bf9.mjs +0 -42
- /package/{types/components/Button → Button}/Button.d.ts +0 -0
- /package/{types/components/Card → Card}/Card.d.ts +0 -0
- /package/{types/components/CloseButton → CloseButton}/CloseButton.d.ts +0 -0
- /package/{types/components/Dropdown → Dropdown}/Dropdown.d.ts +0 -0
- /package/{types/components/FloatingLabel → FloatingLabel}/FloatingLabel.d.ts +0 -0
- /package/{types/components/Nav → Nav}/Nav.d.ts +0 -0
- /package/{types/components/NavDropdown → NavDropdown}/NavDropdown.types.d.ts +0 -0
- /package/{types/components/Popout → Popout}/Popout.d.ts +0 -0
- /package/{types/components/Spinner → Spinner}/Spinner.d.ts +0 -0
- /package/{types/components/Spinner → Spinner}/Spinner.types.d.ts +0 -0
- /package/{types/components/Table → Table}/Table.d.ts +0 -0
- /package/{types/components/Tabs → Tabs}/Tabs.d.ts +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { ReactNode, Dispatch } from "react";
|
|
2
|
+
import { BaseParagraphType, BaseDivType, BaseFormType, BaseInputType, BaseLabelType, BaseLItemType, BaseSelectType, BaseSpanType, BaseSmallType, BaseUListType, BaseSVGType } from "../utils/BaseTypes";
|
|
3
|
+
export type FormTagContextType = {
|
|
4
|
+
noValidate: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type FormContextType = {
|
|
7
|
+
controlId?: string;
|
|
8
|
+
isInputGroup?: boolean;
|
|
9
|
+
isFLoatingLabel?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type FormType = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
} & BaseFormType;
|
|
14
|
+
type ErrorMessageType = {
|
|
15
|
+
message: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
} & BaseParagraphType;
|
|
20
|
+
type HintMessageType = {
|
|
21
|
+
message: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
} & BaseParagraphType;
|
|
25
|
+
export type ErrorType = {
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
} & ErrorMessageType;
|
|
28
|
+
export type HintType = {
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
} & HintMessageType;
|
|
31
|
+
export type FormControlType = {
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
className?: string;
|
|
34
|
+
plaintext?: boolean;
|
|
35
|
+
id?: string;
|
|
36
|
+
type?: string;
|
|
37
|
+
autoFocus?: boolean;
|
|
38
|
+
error?: ErrorMessageType;
|
|
39
|
+
hint?: HintMessageType;
|
|
40
|
+
} & BaseInputType;
|
|
41
|
+
export type SelectContextType = {
|
|
42
|
+
internalId?: string;
|
|
43
|
+
showList: boolean;
|
|
44
|
+
setShowList: Dispatch<React.SetStateAction<boolean>>;
|
|
45
|
+
activeDescendant: string;
|
|
46
|
+
setActiveDescendant: Dispatch<React.SetStateAction<string>>;
|
|
47
|
+
inputValue: string;
|
|
48
|
+
setInputValue: Dispatch<React.SetStateAction<string>>;
|
|
49
|
+
};
|
|
50
|
+
export type FormSelectType = {
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
className?: string;
|
|
53
|
+
id?: string;
|
|
54
|
+
required?: boolean;
|
|
55
|
+
} & (BaseSelectType & BaseDivType);
|
|
56
|
+
export type FormSelectControlType = {
|
|
57
|
+
children?: ReactNode;
|
|
58
|
+
className?: string;
|
|
59
|
+
placeholder?: string;
|
|
60
|
+
searchable?: boolean;
|
|
61
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
62
|
+
inputOptions?: FormSelectInputType;
|
|
63
|
+
} & BaseDivType;
|
|
64
|
+
export type FormSelectInputType = {
|
|
65
|
+
className?: string;
|
|
66
|
+
id?: string;
|
|
67
|
+
} & BaseInputType;
|
|
68
|
+
export type FormSelectListType = {
|
|
69
|
+
children: ReactNode;
|
|
70
|
+
className?: string;
|
|
71
|
+
id?: string;
|
|
72
|
+
} & BaseUListType;
|
|
73
|
+
export type FormSelectListItemType = {
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
className?: string;
|
|
76
|
+
id?: string;
|
|
77
|
+
value?: string;
|
|
78
|
+
} & BaseLItemType;
|
|
79
|
+
export type FormGroupType = {
|
|
80
|
+
children: ReactNode;
|
|
81
|
+
className?: string;
|
|
82
|
+
controlId: string;
|
|
83
|
+
vertical?: boolean;
|
|
84
|
+
} & BaseDivType;
|
|
85
|
+
export type FormLabelType = {
|
|
86
|
+
children: ReactNode;
|
|
87
|
+
className?: string;
|
|
88
|
+
htmlFor?: string;
|
|
89
|
+
} & BaseLabelType;
|
|
90
|
+
export type FormCheckType = {
|
|
91
|
+
children?: ReactNode;
|
|
92
|
+
style?: React.CSSProperties;
|
|
93
|
+
classNameContainer?: string;
|
|
94
|
+
containerRef?: React.LegacyRef<HTMLDivElement>;
|
|
95
|
+
containerId?: string;
|
|
96
|
+
styleContainer?: React.CSSProperties;
|
|
97
|
+
classNameLabel?: string;
|
|
98
|
+
labelRef?: React.LegacyRef<HTMLLabelElement>;
|
|
99
|
+
label?: string;
|
|
100
|
+
labelId?: string;
|
|
101
|
+
styleLabel?: React.CSSProperties;
|
|
102
|
+
className?: string;
|
|
103
|
+
type?: string;
|
|
104
|
+
controlId?: string;
|
|
105
|
+
reverse?: boolean;
|
|
106
|
+
} & BaseInputType;
|
|
107
|
+
export type FormTextType = {
|
|
108
|
+
children: ReactNode;
|
|
109
|
+
className?: string;
|
|
110
|
+
} & BaseSmallType;
|
|
111
|
+
export type FormSliderType = {
|
|
112
|
+
children?: ReactNode;
|
|
113
|
+
className?: string;
|
|
114
|
+
style?: React.CSSProperties;
|
|
115
|
+
controlId: string;
|
|
116
|
+
min?: number;
|
|
117
|
+
max?: number;
|
|
118
|
+
step?: number;
|
|
119
|
+
defaultValue?: number;
|
|
120
|
+
value: number;
|
|
121
|
+
onChange(value: number): () => any;
|
|
122
|
+
} & BaseSpanType;
|
|
123
|
+
export type SliderContextType = {
|
|
124
|
+
children: ReactNode;
|
|
125
|
+
controlId: string;
|
|
126
|
+
min?: number;
|
|
127
|
+
max?: number;
|
|
128
|
+
step?: number;
|
|
129
|
+
};
|
|
130
|
+
export type WarningIconType = {
|
|
131
|
+
alt?: string;
|
|
132
|
+
size?: string | number;
|
|
133
|
+
color?: string;
|
|
134
|
+
} & BaseSVGType;
|
|
135
|
+
export {};
|
package/Form/index.d.ts
ADDED
package/Form/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"stargazer-ui/Form","private":false,"module":"./index.js","types":"./index.d.ts","peerDependencies":{"lodash":"^4.17.21","react":">=17.0.0","react-dom":">=17.0.0"}}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { InputGroupText, InputGroupType, InputGroupGridType } from "./InputGroup.types";
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<InputGroupType, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
4
|
+
Text: React.ForwardRefExoticComponent<Omit<InputGroupText, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
5
|
+
Grid: React.ForwardRefExoticComponent<Omit<InputGroupGridType, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
3
|
+
import { FormContextProvider, useFormContext } from '../Form/Form.js';
|
|
4
|
+
import useClassname from '../hooks/useClassname.js';
|
|
5
|
+
import 'lodash';
|
|
6
|
+
|
|
7
|
+
const InputGroup = forwardRef(({ children, className, controlId, ...restProps }, ref) => {
|
|
8
|
+
const context = useMemo(() => {
|
|
9
|
+
return { controlId: controlId, isInputGroup: true };
|
|
10
|
+
}, [controlId]);
|
|
11
|
+
return (React.createElement("div", { ref: ref, className: useClassname("sg-input-group", className), ...restProps },
|
|
12
|
+
React.createElement(FormContextProvider, { value: context }, children)));
|
|
13
|
+
});
|
|
14
|
+
InputGroup.displayName = "InputGroup";
|
|
15
|
+
const Grid = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
16
|
+
return (React.createElement("div", { ref: ref, className: useClassname("sg-input-group-grid", className) }, children));
|
|
17
|
+
});
|
|
18
|
+
Grid.displayName = "InputGroupGrid";
|
|
19
|
+
const Text = forwardRef(({ children, className, htmlFor, ...restProps }, ref) => {
|
|
20
|
+
const { controlId } = useFormContext();
|
|
21
|
+
const computedHtmlFor = controlId ?? htmlFor;
|
|
22
|
+
return (React.createElement("label", { ref: ref, htmlFor: computedHtmlFor, className: useClassname("sg-input-group-text", className), ...restProps }, children));
|
|
23
|
+
});
|
|
24
|
+
Text.displayName = "InputGroupText";
|
|
25
|
+
var InputGroup$1 = Object.assign(InputGroup, {
|
|
26
|
+
Text: Text,
|
|
27
|
+
Grid: Grid
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { InputGroup$1 as default };
|
|
31
|
+
//# sourceMappingURL=InputGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input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AAI,OAAO,CAAA;IAC5C,QACI,KAAO,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAA,GAAM,SAAS,EAC9G,EAAA,QAAQ,CACL,EACX;AACL,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAA;AAEnC,mBAAgB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;AACtC,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,IAAI,EAAE,IAAI;AACb,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseDivType, BaseLabelType } from "../utils/BaseTypes";
|
|
3
|
+
export type InputGroupType = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
controlId: string;
|
|
7
|
+
} & BaseDivType;
|
|
8
|
+
export type InputGroupText = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
htmlFor?: string;
|
|
12
|
+
} & BaseLabelType;
|
|
13
|
+
export type InputGroupGridType = {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
} & BaseDivType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"stargazer-ui/InputGroup","private":false,"module":"./index.js","types":"./index.d.ts","peerDependencies":{"lodash":"^4.17.21","react":">=17.0.0","react-dom":">=17.0.0"}}
|
package/List/List.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ListType, ListSublistType, ListItemType, ListLabelType, FormContextType } from "./List.types";
|
|
3
|
+
export declare const ListContext: React.Context<FormContextType | null>;
|
|
4
|
+
export declare const ListContextProvider: ({ children, value }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
value: FormContextType;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export declare const useListContext: () => FormContextType | null;
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<ListType, "ref"> & React.RefAttributes<HTMLUListElement>> & {
|
|
10
|
+
Sublist: React.ForwardRefExoticComponent<Omit<ListSublistType, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
11
|
+
Item: React.ForwardRefExoticComponent<Omit<ListItemType, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
12
|
+
Label: React.ForwardRefExoticComponent<Omit<ListLabelType, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
package/List/List.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { createContext, forwardRef, useMemo, useRef, cloneElement, useContext } from 'react';
|
|
3
|
+
import useDraggable from '../hooks/useDraggable.js';
|
|
4
|
+
import useClassname from '../hooks/useClassname.js';
|
|
5
|
+
import mergeRefs from '../utils/MergeRefs.js';
|
|
6
|
+
|
|
7
|
+
const ListContext = createContext(null);
|
|
8
|
+
const ListContextProvider = ({ children, value }) => {
|
|
9
|
+
return (React.createElement(ListContext.Provider, { value: value }, children));
|
|
10
|
+
};
|
|
11
|
+
const useListContext = () => {
|
|
12
|
+
const context = useContext(ListContext);
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
/*
|
|
16
|
+
const handlePhantomInsert = (event: React.PointerEvent, item: HTMLElement | null) => {
|
|
17
|
+
event.stopPropagation()
|
|
18
|
+
document.querySelectorAll(".phantom").forEach(phantom => phantom.remove())
|
|
19
|
+
if(item) { insertPhantomElement(item)}
|
|
20
|
+
}
|
|
21
|
+
*/
|
|
22
|
+
const List = forwardRef(({ children, className, depth, tree = false, dragdrop = false, ...restProps }, ref) => {
|
|
23
|
+
const context = useListContext();
|
|
24
|
+
const initialContext = useMemo(() => ({
|
|
25
|
+
tree: tree,
|
|
26
|
+
draggable: dragdrop
|
|
27
|
+
}), []);
|
|
28
|
+
return (React.createElement("ul", { ref: ref, id: "test-list", "data-context": context ? "true" : "false", className: useClassname("sg-list", className), style: { "--depth": depth }, ...restProps }, !context ?
|
|
29
|
+
React.createElement(ListContextProvider, { value: initialContext }, children)
|
|
30
|
+
:
|
|
31
|
+
children));
|
|
32
|
+
});
|
|
33
|
+
List.displayName = "List";
|
|
34
|
+
const Sublist = forwardRef(({ children, className, depth, ...restProps }, ref) => {
|
|
35
|
+
const { draggable } = useListContext();
|
|
36
|
+
const itemRef = useRef(null);
|
|
37
|
+
const { coordinates, isMouseDown } = useDraggable(itemRef, { draggable });
|
|
38
|
+
return (React.createElement("li", { ref: mergeRefs([ref, itemRef]), "data-phantom": "none", className: useClassname("sg-sublist", className), style: { "--depth": depth, top: coordinates.top, left: coordinates.left, width: coordinates.width }, ...restProps }, children));
|
|
39
|
+
});
|
|
40
|
+
Sublist.displayName = "ListSubList";
|
|
41
|
+
const Item = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
42
|
+
const { draggable } = useListContext();
|
|
43
|
+
const itemRef = useRef(null);
|
|
44
|
+
const { coordinates, isMouseDown } = useDraggable(itemRef, { draggable });
|
|
45
|
+
return (React.createElement("li", { ref: itemRef, "data-phantom": "none", className: useClassname("sg-list-item", className), style: { top: coordinates.top, left: coordinates.left, width: coordinates.width }, ...restProps }, children));
|
|
46
|
+
});
|
|
47
|
+
Item.displayName = "ListItem";
|
|
48
|
+
const Label = forwardRef(({ children, className, style, ...restProps }, ref) => {
|
|
49
|
+
const labelRef = useRef(null);
|
|
50
|
+
const computedClass = useClassname("sg-list-label", className);
|
|
51
|
+
//const coordinates = useDraggable(labelRef)
|
|
52
|
+
return ((typeof children === "string") ?
|
|
53
|
+
React.createElement("span", { ref: mergeRefs([ref, labelRef]), className: computedClass, style: { ...style }, ...restProps }, children)
|
|
54
|
+
:
|
|
55
|
+
cloneElement(children, {
|
|
56
|
+
ref: mergeRefs([ref, labelRef]),
|
|
57
|
+
className: computedClass,
|
|
58
|
+
style: { ...children.props.style }
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
Label.displayName = "ListLabel";
|
|
62
|
+
/*
|
|
63
|
+
List.Sublist = Sublist
|
|
64
|
+
List.Item = Item
|
|
65
|
+
List.Label = Label
|
|
66
|
+
|
|
67
|
+
export default List
|
|
68
|
+
*/
|
|
69
|
+
var List$1 = Object.assign(List, {
|
|
70
|
+
Sublist: Sublist,
|
|
71
|
+
Item: Item,
|
|
72
|
+
Label: Label
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export { ListContext, ListContextProvider, List$1 as default, useListContext };
|
|
76
|
+
//# sourceMappingURL=List.js.map
|
package/List/List.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../src/List/List.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;MAOa,WAAW,GAAG,aAAa,CAAyB,IAAI,EAAC;AACzD,MAAA,mBAAmB,GAAG,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAsD,KAAI;AAC1G,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,EAC7B,QAAQ,CACU,EAC1B;AACL,EAAC;AACM,MAAM,cAAc,GAAG,MAAK;AAC/B,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;AAEvC,IAAA,OAAO,OAAO,CAAA;AAClB,EAAC;AAED;;;;;;AAME;AAEF,MAAM,IAAI,GAAG,UAAU,CAA8B,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,GAAC,KAAK,EAAE,QAAQ,GAAC,KAAK,EAAE,GAAG,SAAS,EAAC,EAAE,GAAG,KAA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AAQ;QACzB,KAAM,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAC,EAAM,GAAA,SAAS,EAC7F,EAAA,QAAQ,CACN;;YAEP,YAAY,CAAC,QAAe,EACxB;gBACI,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC/B,gBAAA,SAAS,EAAE,aAAa;gBACxB,KAAK,EAAE,EAAE,GAAI,QAAyB,CAAC,KAAK,CAAC,KAAK,EAAC;AACtD,aAAA,CACJ,EAER;AACL,CAAC,CAAC,CAAA;AACF,KAAK,CAAC,WAAW,GAAG,WAAW,CAAA;AAC/B;;;;;;AAME;AACF,aAAgB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;AAChC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,KAAK;AACf,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseUListType, BaseLItemType, BaseSpanType } from "../utils/BaseTypes";
|
|
3
|
+
export type FormContextType = {
|
|
4
|
+
depth?: number;
|
|
5
|
+
tree?: boolean;
|
|
6
|
+
draggable?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type ListType = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className: string;
|
|
11
|
+
depth: number;
|
|
12
|
+
tree: boolean;
|
|
13
|
+
dragdrop: boolean;
|
|
14
|
+
} & BaseUListType;
|
|
15
|
+
export type ListSublistType = {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
className: string;
|
|
18
|
+
depth: number;
|
|
19
|
+
} & BaseLItemType;
|
|
20
|
+
export type ListItemType = {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
className: string;
|
|
23
|
+
} & BaseLItemType;
|
|
24
|
+
export type ListLabelType = {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className: string;
|
|
27
|
+
label: string;
|
|
28
|
+
} & BaseSpanType;
|
package/List/index.d.ts
ADDED
package/List/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"stargazer-ui/List","private":false,"module":"./index.js","types":"./index.d.ts","peerDependencies":{"lodash":"^4.17.21","react":">=17.0.0","react-dom":">=17.0.0"}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ModalBodyType, ModalType } from "./Modal.types";
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<ModalType, "ref"> & React.RefAttributes<HTMLDialogElement>> & {
|
|
4
4
|
Header: React.ForwardRefExoticComponent<(Omit<{
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
package/Modal/Modal.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { createContext, forwardRef, useState, useRef, useEffect, useContext } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import CloseButton from '../CloseButton/CloseButton.js';
|
|
5
|
+
import Button from '../Button/Button.js';
|
|
6
|
+
import mergeRefs from '../utils/MergeRefs.js';
|
|
7
|
+
|
|
8
|
+
const ModalContext = createContext(null);
|
|
9
|
+
const ModalContextProvider = ({ children, value }) => {
|
|
10
|
+
return (React.createElement(ModalContext.Provider, { value: value }, children));
|
|
11
|
+
};
|
|
12
|
+
const useModalContext = () => {
|
|
13
|
+
const context = useContext(ModalContext);
|
|
14
|
+
if (!context) {
|
|
15
|
+
throw new Error("useModalContext has to be used within ModalContextProvider!");
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
};
|
|
19
|
+
const Modal = forwardRef(({ children, size = "md", show, backdrop = "static", fill = false, onHide, className, id, stretch, style, ...restProps }, ref) => {
|
|
20
|
+
const [showModal, setShowModal] = useState(show);
|
|
21
|
+
if (show && show != showModal) {
|
|
22
|
+
setShowModal(show);
|
|
23
|
+
}
|
|
24
|
+
const modalRef = useRef(null);
|
|
25
|
+
useKeepElementFocused(modalRef);
|
|
26
|
+
let typeCheck = typeof (show) === "boolean" && typeof (onHide) === "function" ? undefined : { show: typeof (show) === "boolean", onHide: typeof (onHide) === "function" };
|
|
27
|
+
if (typeCheck) {
|
|
28
|
+
console.error(!typeCheck.show ? "The variable 'show' must be used and must be a boolean used to decide when to show the modal!" : null, !typeCheck.onHide ? "The variable 'onHide' must be used and must be a function which is used to set 'show' as the modal gets closed!" : null);
|
|
29
|
+
}
|
|
30
|
+
const closeModal = () => {
|
|
31
|
+
const modal = modalRef.current;
|
|
32
|
+
modal.classList.add("close");
|
|
33
|
+
modal.addEventListener('animationend', (event) => {
|
|
34
|
+
console.log(event);
|
|
35
|
+
if (event.animationName === "scale-down") {
|
|
36
|
+
if (onHide) {
|
|
37
|
+
onHide();
|
|
38
|
+
}
|
|
39
|
+
setShowModal(false);
|
|
40
|
+
}
|
|
41
|
+
}, { once: true });
|
|
42
|
+
};
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const modal = modalRef.current;
|
|
45
|
+
if (!modal)
|
|
46
|
+
return;
|
|
47
|
+
if (showModal) {
|
|
48
|
+
modal.classList.remove('close');
|
|
49
|
+
modal.showModal();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// modal.classList.add('close')
|
|
53
|
+
modal.close();
|
|
54
|
+
}
|
|
55
|
+
}, [showModal]);
|
|
56
|
+
let classNameComputed = `sg-modal-tag`;
|
|
57
|
+
if (className) {
|
|
58
|
+
classNameComputed += " " + className;
|
|
59
|
+
}
|
|
60
|
+
if (backdrop === "static" || backdrop === "true") {
|
|
61
|
+
classNameComputed += " sg-modal-static";
|
|
62
|
+
}
|
|
63
|
+
if (fill)
|
|
64
|
+
classNameComputed += " sg-modal-fill";
|
|
65
|
+
if (size && !fill)
|
|
66
|
+
classNameComputed += ` sg-modal-${size}`;
|
|
67
|
+
const handleKeyDown = (event) => {
|
|
68
|
+
const key = event.key;
|
|
69
|
+
if (key != "Escape") {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
closeModal();
|
|
74
|
+
};
|
|
75
|
+
return (createPortal(React.createElement("dialog", { ref: mergeRefs([ref, modalRef]), className: classNameComputed, onKeyDown: (event) => handleKeyDown(event), ...restProps, style: { "--height": stretch ? "80%" : null, ...style } },
|
|
76
|
+
React.createElement(ModalContextProvider, { value: closeModal }, !typeCheck ?
|
|
77
|
+
children :
|
|
78
|
+
React.createElement(ErrorModal, { typeCheck: typeCheck, closeModal: closeModal }))), document.body));
|
|
79
|
+
});
|
|
80
|
+
Modal.displayName = "Modal";
|
|
81
|
+
const Header = forwardRef(({ children, as = "", className = "", closeButton = false, onClick, ...restProps }, ref) => {
|
|
82
|
+
let validAs = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"];
|
|
83
|
+
let Component = validAs.find(valid => valid === as) ? as : "div";
|
|
84
|
+
const closeModal = useModalContext();
|
|
85
|
+
const onCloseButtonClick = (event) => {
|
|
86
|
+
if (onClick) {
|
|
87
|
+
onClick(event);
|
|
88
|
+
}
|
|
89
|
+
closeModal();
|
|
90
|
+
};
|
|
91
|
+
return (React.createElement(Component, { ref: ref, className: `sg-modal-header ${className}`, ...restProps },
|
|
92
|
+
children,
|
|
93
|
+
closeButton ? React.createElement(CloseButton, { variant: true, onClick: event => onCloseButtonClick(event) }) : null));
|
|
94
|
+
});
|
|
95
|
+
Header.displayName = "ModalHeader";
|
|
96
|
+
const Title = forwardRef(({ children, as = "h4", className, ...restProps }, ref) => {
|
|
97
|
+
let validAs = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"];
|
|
98
|
+
let Component = validAs.find(valid => valid === as) ? as : "h4";
|
|
99
|
+
return (React.createElement(Component, { ref: ref, className: `sg-modal-title ${className}`, ...restProps }, children));
|
|
100
|
+
});
|
|
101
|
+
Title.displayName = "ModalTitle";
|
|
102
|
+
const Body = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
103
|
+
return (React.createElement("div", { ref: ref, className: `sg-modal-body ${className}`, ...restProps }, children));
|
|
104
|
+
});
|
|
105
|
+
Body.displayName = "ModalBody";
|
|
106
|
+
const Footer = forwardRef(({ children, className, ...restProps }, ref) => {
|
|
107
|
+
return (React.createElement("div", { ref: ref, className: `sg-modal-footer ${className}`, ...restProps }, children));
|
|
108
|
+
});
|
|
109
|
+
Footer.displayName = "ModalFooter";
|
|
110
|
+
var Modal$1 = Object.assign(Modal, {
|
|
111
|
+
Header: Header,
|
|
112
|
+
Title: Title,
|
|
113
|
+
Body: Body,
|
|
114
|
+
Footer: Footer
|
|
115
|
+
});
|
|
116
|
+
const useKeepElementFocused = function (elementRef) {
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
const onKeyDown = (event) => {
|
|
119
|
+
const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
120
|
+
const modal = elementRef.current;
|
|
121
|
+
if (modal) {
|
|
122
|
+
const firstFocusableElement = modal.querySelectorAll(focusableElements)[0];
|
|
123
|
+
const focusableContent = modal.querySelectorAll(focusableElements);
|
|
124
|
+
const lastFocusableElement = focusableContent[focusableContent.length - 1];
|
|
125
|
+
let isTabPressed = event.key === 'Tab';
|
|
126
|
+
if (!isTabPressed) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (event.shiftKey) {
|
|
130
|
+
if (document.activeElement === firstFocusableElement) {
|
|
131
|
+
lastFocusableElement.focus();
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else if (document.activeElement === lastFocusableElement) {
|
|
136
|
+
firstFocusableElement.focus();
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
142
|
+
return function cleanup() {
|
|
143
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
144
|
+
};
|
|
145
|
+
}, [elementRef]);
|
|
146
|
+
};
|
|
147
|
+
const ErrorModal = ({ typeCheck, closeModal }) => {
|
|
148
|
+
return (React.createElement(React.Fragment, null,
|
|
149
|
+
React.createElement(Header, { closeButton: true },
|
|
150
|
+
React.createElement(Title, null, "An Error ocurred!")),
|
|
151
|
+
React.createElement(Body, null,
|
|
152
|
+
React.createElement("p", null,
|
|
153
|
+
!typeCheck.show ? "The variable 'show' must be used and must be a boolean used to decide when to show the modal!" : null,
|
|
154
|
+
!typeCheck.onHide ? "The variable 'onHide' must be used and must be a function which is used to set 'show' as the modal gets closed!" : null)),
|
|
155
|
+
React.createElement(Footer, null,
|
|
156
|
+
React.createElement(Button, { variant: "danger", type: "button", onClick: () => closeModal() }, "Close"))));
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export { Modal$1 as default, useKeepElementFocused };
|
|
160
|
+
//# sourceMappingURL=Modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AASA,MAAM,YAAY,GAAG,aAAa,CAAmB,IAAI,CAAC,CAAA;AAC1D,MAAM,oBAAoB,GAAG,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAoD,KAAI;AAClG,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,YAAY,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,EAC9B,QAAQ,CACW,EAC3B;AACL,CAAC,CAAA;AACD,MAAM,eAAe,GAAG,MAAK;AACzB,IAAA,MAA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,IAAA;gBACK,CAAC,SAAS,CAAC,IAAI,GAAG,+FAA+F,GAAG,IAAI;AACxH,gBAAA,CAAC,SAAS,CAAC,MAAM,GAAG,iHAAiH,GAAG,IAAI,CAC7I,CACD;AACP,QAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,IAAA;YACH,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,MAAM,UAAU,EAAE,EAEzD,EAAA,OAAA,CAAA,CACJ,CACV,EACN;AACL,CAAC;;;;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { BaseDialogType, BaseDivType, BaseHeadingType, BaseSpanType } from "
|
|
2
|
+
import { BaseDialogType, BaseDivType, BaseHeadingType, BaseSpanType } from "../utils/BaseTypes";
|
|
3
3
|
export type ModalContextType = Function | null;
|
|
4
4
|
export type ModalType = {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
id?: string;
|
|
8
|
-
|
|
8
|
+
fill?: boolean;
|
|
9
9
|
size?: string;
|
|
10
10
|
show: boolean;
|
|
11
11
|
backdrop?: string;
|
|
12
12
|
onHide: Function;
|
|
13
|
+
stretch?: boolean;
|
|
13
14
|
} & BaseDialogType;
|
|
14
15
|
export type ModalHeaderType = {
|
|
15
16
|
children: ReactNode;
|
package/Modal/index.d.ts
ADDED
package/Modal/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"stargazer-ui/Modal","private":false,"module":"./index.js","types":"./index.d.ts","peerDependencies":{"lodash":"^4.17.21","react":">=17.0.0","react-dom":">=17.0.0"}}
|
package/Nav/Nav.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { useNavbarContext } from '../NavBar/Navbar.js';
|
|
4
|
+
|
|
5
|
+
const Nav = forwardRef(({ children, className, as = "ul", ...restProps }, ref) => {
|
|
6
|
+
const Component = as;
|
|
7
|
+
const navbarContext = useNavbarContext();
|
|
8
|
+
const navbarPrefix = navbarContext ? navbarContext : "sg-navbar-";
|
|
9
|
+
return (React.createElement(Component, { ref: ref, className: `${className} ${navbarPrefix}nav`, ...restProps }, children));
|
|
10
|
+
});
|
|
11
|
+
Nav.displayName = "Nav";
|
|
12
|
+
const Item = forwardRef(({ children, className, as = "li", ...restProps }, ref) => {
|
|
13
|
+
const Component = as;
|
|
14
|
+
return (React.createElement(Component, { role: "none", ref: ref, className: `sg-nav-item${className ? " " + className : ""}`, ...restProps }, children));
|
|
15
|
+
});
|
|
16
|
+
Item.displayName = "NavItem";
|
|
17
|
+
const Link = forwardRef(({ children, className, as = "a", ...restProps }, ref) => {
|
|
18
|
+
const Component = as;
|
|
19
|
+
return (React.createElement(Component, { role: "menuitem", ref: ref, className: `sg-nav-link${className ? " " + className : ""}`, ...restProps }, children));
|
|
20
|
+
});
|
|
21
|
+
Link.displayName = "NavLink";
|
|
22
|
+
var Nav$1 = Object.assign(Nav, {
|
|
23
|
+
Item: Item,
|
|
24
|
+
Link: Link
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { Nav$1 as default };
|
|
28
|
+
//# sourceMappingURL=Nav.js.map
|