stargazer-ui 1.0.16 → 1.0.18

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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Button/Button.d.ts +4 -0
  3. package/dist/Button/Button.js +10 -0
  4. package/dist/Button/Button.js.map +1 -0
  5. package/dist/Button/Button.types.d.ts +7 -0
  6. package/dist/Button/index.d.ts +2 -0
  7. package/dist/Button/index.js +2 -0
  8. package/dist/Button/index.js.map +1 -0
  9. package/dist/Button/package.json +1 -0
  10. package/dist/Card/Card.d.ts +34 -0
  11. package/dist/Card/Card.js +56 -0
  12. package/dist/Card/Card.js.map +1 -0
  13. package/dist/Card/Card.types.d.ts +24 -0
  14. package/dist/Card/index.d.ts +2 -0
  15. package/dist/Card/index.js +2 -0
  16. package/dist/Card/index.js.map +1 -0
  17. package/dist/Card/package.json +1 -0
  18. package/dist/CloseButton/CloseButton.d.ts +4 -0
  19. package/dist/CloseButton/CloseButton.js +9 -0
  20. package/dist/CloseButton/CloseButton.js.map +1 -0
  21. package/dist/CloseButton/CloseButton.types.d.ts +5 -0
  22. package/dist/CloseButton/index.d.ts +2 -0
  23. package/dist/CloseButton/index.js +2 -0
  24. package/dist/CloseButton/index.js.map +1 -0
  25. package/dist/CloseButton/package.json +1 -0
  26. package/dist/Dropdown/Dropdown.d.ts +71 -0
  27. package/dist/Dropdown/Dropdown.js +306 -0
  28. package/dist/Dropdown/Dropdown.js.map +1 -0
  29. package/dist/Dropdown/Dropdown.types.d.ts +55 -0
  30. package/dist/Dropdown/index.d.ts +3 -0
  31. package/dist/Dropdown/index.js +2 -0
  32. package/dist/Dropdown/index.js.map +1 -0
  33. package/dist/Dropdown/package.json +1 -0
  34. package/dist/FloatingLabel/FloatingLabel.d.ts +4 -0
  35. package/dist/FloatingLabel/FloatingLabel.js +15 -0
  36. package/dist/FloatingLabel/FloatingLabel.js.map +1 -0
  37. package/dist/FloatingLabel/FloatingLabel.types.d.ts +9 -0
  38. package/dist/FloatingLabel/index.d.ts +2 -0
  39. package/dist/FloatingLabel/index.js +2 -0
  40. package/dist/FloatingLabel/index.js.map +1 -0
  41. package/dist/FloatingLabel/package.json +1 -0
  42. package/dist/Form/Form.d.ts +17 -0
  43. package/dist/Form/Form.js +66 -0
  44. package/dist/Form/Form.js.map +1 -0
  45. package/dist/Form/Form.types.d.ts +50 -0
  46. package/dist/Form/index.d.ts +3 -0
  47. package/dist/Form/index.js +2 -0
  48. package/dist/Form/index.js.map +1 -0
  49. package/dist/Form/package.json +1 -0
  50. package/dist/InputGroup/InputGroup.d.ts +6 -0
  51. package/dist/InputGroup/InputGroup.js +14 -0
  52. package/dist/InputGroup/InputGroup.js.map +1 -0
  53. package/dist/InputGroup/InputGroup.types.d.ts +10 -0
  54. package/dist/InputGroup/index.d.ts +3 -0
  55. package/dist/InputGroup/index.js +2 -0
  56. package/dist/InputGroup/index.js.map +1 -0
  57. package/dist/InputGroup/package.json +1 -0
  58. package/dist/Modal/Modal.d.ts +40 -0
  59. package/dist/Modal/Modal.js +145 -0
  60. package/dist/Modal/Modal.js.map +1 -0
  61. package/dist/Modal/Modal.types.d.ts +40 -0
  62. package/dist/Modal/index.d.ts +2 -0
  63. package/dist/Modal/index.js +2 -0
  64. package/dist/Modal/index.js.map +1 -0
  65. package/dist/Modal/package.json +1 -0
  66. package/dist/Nav/Nav.d.ts +30 -0
  67. package/dist/Nav/Nav.js +24 -0
  68. package/dist/Nav/Nav.js.map +1 -0
  69. package/dist/Nav/Nav.types.d.ts +17 -0
  70. package/dist/Nav/index.d.ts +3 -0
  71. package/dist/Nav/index.js +2 -0
  72. package/dist/Nav/index.js.map +1 -0
  73. package/dist/Nav/package.json +1 -0
  74. package/dist/NavBar/Navbar.d.ts +19 -0
  75. package/dist/NavBar/Navbar.js +32 -0
  76. package/dist/NavBar/Navbar.js.map +1 -0
  77. package/dist/NavBar/Navbar.types.d.ts +19 -0
  78. package/dist/NavBar/index.d.ts +3 -0
  79. package/dist/NavBar/index.js +2 -0
  80. package/dist/NavBar/index.js.map +1 -0
  81. package/dist/NavBar/package.json +1 -0
  82. package/dist/NavDropdown/NavDropdown.d.ts +35 -0
  83. package/dist/NavDropdown/NavDropdown.js +80 -0
  84. package/dist/NavDropdown/NavDropdown.js.map +1 -0
  85. package/dist/NavDropdown/NavDropdown.types.d.ts +5 -0
  86. package/dist/NavDropdown/index.d.ts +2 -0
  87. package/dist/NavDropdown/index.js +2 -0
  88. package/dist/NavDropdown/index.js.map +1 -0
  89. package/dist/NavDropdown/package.json +1 -0
  90. package/dist/Popout/Popout.d.ts +22 -0
  91. package/dist/Popout/Popout.js +102 -0
  92. package/dist/Popout/Popout.js.map +1 -0
  93. package/dist/Popout/Popout.types.d.ts +36 -0
  94. package/dist/Popout/index.d.ts +2 -0
  95. package/dist/Popout/index.js +2 -0
  96. package/dist/Popout/index.js.map +1 -0
  97. package/dist/Popout/package.json +1 -0
  98. package/dist/Spinner/Spinner.d.ts +4 -0
  99. package/dist/Spinner/Spinner.js +10 -0
  100. package/dist/Spinner/Spinner.js.map +1 -0
  101. package/dist/Spinner/Spinner.types.d.ts +7 -0
  102. package/dist/Spinner/index.d.ts +2 -0
  103. package/dist/Spinner/index.js +2 -0
  104. package/dist/Spinner/index.js.map +1 -0
  105. package/dist/Spinner/package.json +1 -0
  106. package/dist/Table/Table.d.ts +4 -0
  107. package/dist/Table/Table.js +9 -0
  108. package/dist/Table/Table.js.map +1 -0
  109. package/dist/Table/Table.types.d.ts +7 -0
  110. package/dist/Table/index.d.ts +3 -0
  111. package/dist/Table/index.js +2 -0
  112. package/dist/Table/index.js.map +1 -0
  113. package/dist/Table/package.json +1 -0
  114. package/dist/Tabs/Tabs.d.ts +9 -0
  115. package/dist/Tabs/Tabs.js +80 -0
  116. package/dist/Tabs/Tabs.js.map +1 -0
  117. package/dist/Tabs/Tabs.types.d.ts +35 -0
  118. package/dist/Tabs/index.d.ts +2 -0
  119. package/dist/Tabs/index.js +2 -0
  120. package/dist/Tabs/index.js.map +1 -0
  121. package/dist/Tabs/package.json +1 -0
  122. package/dist/ToggleButton/ToggleButton.d.ts +4 -0
  123. package/dist/ToggleButton/ToggleButton.js +15 -0
  124. package/dist/ToggleButton/ToggleButton.js.map +1 -0
  125. package/dist/ToggleButton/ToggleButton.types.d.ts +7 -0
  126. package/dist/ToggleButton/index.d.ts +2 -0
  127. package/dist/ToggleButton/index.js +2 -0
  128. package/dist/ToggleButton/index.js.map +1 -0
  129. package/dist/ToggleButton/package.json +1 -0
  130. package/dist/index.d.ts +17 -0
  131. package/dist/index.js +17 -0
  132. package/dist/index.js.map +1 -0
  133. package/dist/utils/BaseTypes.d.ts +20 -0
  134. package/package.json +4 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Xoror
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ButtonType } from "./Button.types";
3
+ declare const Button: React.ForwardRefExoticComponent<Omit<ButtonType, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ export default Button;
@@ -0,0 +1,10 @@
1
+ import React, { forwardRef } from 'react';
2
+
3
+ const Button = forwardRef(({ children, variant = "primary", className, ...rest }, ref) => {
4
+ //let variants = ["primary", "secondary", "success", "info", "warning", "danger", "dark", "light"] //["red", "blue", "yellow", "green", "purple"]
5
+ // let variantTest = variants.find(variantTest => variantTest === variant) ? variant : "primary"
6
+ return (React.createElement("button", { ref: ref, type: "button", className: `sg-button sg-button-${variant}${className == undefined ? "" : " " + className}`, ...rest }, children));
7
+ });
8
+
9
+ export { Button as default };
10
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":[null],"names":[],"mappings":";;AAIM,MAAA,MAAM,GAAG,UAAU,CAAiC,CAAC,EAAC,QAAQ,EAAE,OAAO,GAAC,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,EAAC,EAAE,GAAG,KAAI;;;AAGjH,IAAA,QACI,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAQ,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAuB,oBAAA,EAAA,OAAO,GAAG,SAAS,IAAI,SAAS,GAAG,EAAE,GAAG,GAAG,GAAC,SAAS,CAAA,CAAE,KAAM,IAAI,EAAA,EAC9H,QAAQ,CACJ,EACZ;AACL,CAAC;;;;"}
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from "react";
2
+ import { BaseButtonType } from "../utils/BaseTypes";
3
+ export type ButtonType = {
4
+ children: ReactNode;
5
+ variant?: string;
6
+ className?: string;
7
+ } & BaseButtonType;
@@ -0,0 +1,2 @@
1
+ export { default as Button } from "./Button";
2
+ export type { ButtonType } from "./Button.types";
@@ -0,0 +1,2 @@
1
+ export { default as Button } from './Button.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"name":"stargazer-ui/Button","private":false,"module":"index.ts","types":".index.d.ts"}
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+ import { CardBodyType, CardFooterType, CardTextType, CardType } from "./Card.types";
3
+ declare const _default: React.ForwardRefExoticComponent<Omit<CardType, "ref"> & React.RefAttributes<HTMLDivElement>> & {
4
+ Header: React.ForwardRefExoticComponent<(Omit<{
5
+ children: React.ReactNode;
6
+ className?: string | undefined;
7
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
8
+ } & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, "ref"> | Omit<{
9
+ children: React.ReactNode;
10
+ className?: string | undefined;
11
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
12
+ } & React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement>, "ref"> | Omit<{
13
+ children: React.ReactNode;
14
+ className?: string | undefined;
15
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
16
+ } & React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement>, "ref">) & React.RefAttributes<HTMLDivElement | HTMLHeadingElement | HTMLSpanElement>>;
17
+ Body: React.ForwardRefExoticComponent<Omit<CardBodyType, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
+ Title: React.ForwardRefExoticComponent<(Omit<{
19
+ children: React.ReactNode;
20
+ className?: string | undefined;
21
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
22
+ } & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, "ref"> | Omit<{
23
+ children: React.ReactNode;
24
+ className?: string | undefined;
25
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
26
+ } & React.ClassAttributes<HTMLHeadingElement> & React.HTMLAttributes<HTMLHeadingElement>, "ref"> | Omit<{
27
+ children: React.ReactNode;
28
+ className?: string | undefined;
29
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
30
+ } & React.ClassAttributes<HTMLSpanElement> & React.HTMLAttributes<HTMLSpanElement>, "ref">) & React.RefAttributes<HTMLHeadingElement>>;
31
+ Text: React.ForwardRefExoticComponent<Omit<CardTextType, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
32
+ Footer: React.ForwardRefExoticComponent<Omit<CardFooterType, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
+ };
34
+ export default _default;
@@ -0,0 +1,56 @@
1
+ import React, { forwardRef } from 'react';
2
+
3
+ const Card = forwardRef(({ children, className, ...restProps }, ref) => {
4
+ /*
5
+ let subComponentList = Object.keys(Card);
6
+ let subComponents = []
7
+ let childs = children.length === undefined ? children : children.filter(child => child != null && child != "")
8
+
9
+ subComponentList.forEach((key) => {
10
+ React.Children.forEach(childs, (child) => (
11
+ child.type.name === key ? subComponents.push(child) : null
12
+ ))
13
+ })
14
+ if(subComponents.length === 0) {
15
+ subComponents = [childs]
16
+ }
17
+ */
18
+ //console.log(subComponents)
19
+ return (React.createElement("div", { ref: ref, className: "sg-card" + " " + className, ...restProps }, children));
20
+ });
21
+ const Header = forwardRef(({ as = "div", className, children, ...restProps }, ref) => {
22
+ let validAs = ["div", "span", "h1", "h2", "h3", "h4", "h5", "h6"];
23
+ let Component = validAs.find(valid => valid === as) ? as : "div";
24
+ return (React.createElement(Component, { ref: ref, className: `sg-card-header ${className}`, ...restProps }, children));
25
+ });
26
+ const Title = forwardRef(({ as = "h5", className, children, ...restProps }, ref) => {
27
+ let validAs = ["h1", "h2", "h3", "h4", "h5", "h6"];
28
+ let Component = validAs.find(valid => valid === as) ? as : "h5";
29
+ return (React.createElement(Component, { ref: ref, className: className, ...restProps }, children));
30
+ });
31
+ const Body = forwardRef(({ children, className, ...restProps }, ref) => {
32
+ /*
33
+ children = children.length ? children.filter(child => child != null && child != "") : children
34
+ let subComponents = []
35
+ React.Children.forEach(children, (child) => {
36
+ subComponents.push(child)
37
+ })
38
+ */
39
+ return (React.createElement("div", { ref: ref, className: `sg-card-body ${className}`, ...restProps }, children));
40
+ });
41
+ const Text = forwardRef(({ children, className, ...restProps }, ref) => {
42
+ return (React.createElement("p", { ref: ref, className: `sg-card-text ${className}`, ...restProps }, children));
43
+ });
44
+ const Footer = forwardRef(({ children, className, ...restProps }, ref) => {
45
+ return (React.createElement("div", { ref: ref, className: `sg-card-footer ${className}`, ...restProps }, children));
46
+ });
47
+ var Card$1 = Object.assign(Card, {
48
+ Header: Header,
49
+ Body: Body,
50
+ Title: Title,
51
+ Text: Text,
52
+ Footer: Footer
53
+ });
54
+
55
+ export { Card$1 as default };
56
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sources":["../../src/Card/Card.tsx"],"sourcesContent":[null],"names":[],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from "react";
2
+ import { BaseDivType, BaseHeadingType, BaseSpanType, BaseParagraphType } from "../utils/BaseTypes";
3
+ export type CardType = {
4
+ children: ReactNode;
5
+ className?: string;
6
+ } & BaseDivType;
7
+ export type CardHeaderPossible = BaseDivType | BaseSpanType | BaseHeadingType;
8
+ export type CardHeaderType = {
9
+ children: ReactNode;
10
+ className?: string;
11
+ as?: React.ElementType;
12
+ } & CardHeaderPossible;
13
+ export type CardBodyType = {
14
+ children: ReactNode;
15
+ className?: string;
16
+ } & BaseDivType;
17
+ export type CardTextType = {
18
+ children: ReactNode;
19
+ className?: string;
20
+ } & BaseParagraphType;
21
+ export type CardFooterType = {
22
+ children: ReactNode;
23
+ className?: string;
24
+ } & BaseDivType;
@@ -0,0 +1,2 @@
1
+ export { default } from "./Card";
2
+ export type { CardBodyType, CardFooterType, CardHeaderPossible, CardHeaderType, CardTextType, CardType } from "./Card.types";
@@ -0,0 +1,2 @@
1
+ export { default } from './Card.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"name":"stargazer-ui/Card","private":false,"module":"index.ts","types":".index.d.ts"}
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { CloseButtonType } from "./CloseButton.types";
3
+ declare const CloseButton: React.ForwardRefExoticComponent<Omit<CloseButtonType, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
+ export default CloseButton;
@@ -0,0 +1,9 @@
1
+ import React, { forwardRef } from 'react';
2
+
3
+ const CloseButton = forwardRef(({ className, variant = false, ...restProps }, ref) => {
4
+ return (React.createElement("button", { ref: ref, className: `sg-button-close${variant ? " sg-button-close-white" : ""} ${className}`, ...restProps },
5
+ React.createElement("span", { className: "sg-close-visually-hidden-label" }, "Close")));
6
+ });
7
+
8
+ export { CloseButton as default };
9
+ //# sourceMappingURL=CloseButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloseButton.js","sources":["../../src/CloseButton/CloseButton.tsx"],"sourcesContent":[null],"names":[],"mappings":";;AAIA,MAAM,WAAW,GAAG,UAAU,CAAsC,CAAC,EAAC,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,SAAS,EAAC,EAAE,GAAG,KAAI;IACpH,QACI,gCAAQ,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,CAAA,eAAA,EAAkB,OAAO,GAAG,wBAAwB,GAAG,EAAE,CAAI,CAAA,EAAA,SAAS,CAAE,CAAA,EAAA,GAAM,SAAS,EAAA;AAChH,QAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,gCAAgC,EAAa,EAAA,OAAA,CAAA,CACxD,EACZ;AACL,CAAC;;;;"}
@@ -0,0 +1,5 @@
1
+ import { BaseButtonType } from "../utils/BaseTypes";
2
+ export type CloseButtonType = {
3
+ className?: string;
4
+ variant?: boolean;
5
+ } & BaseButtonType;
@@ -0,0 +1,2 @@
1
+ export { default as CloseButton } from "./CloseButton";
2
+ export { CloseButtonType } from "./CloseButton.types";
@@ -0,0 +1,2 @@
1
+ export { default as CloseButton } from './CloseButton.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"name":"stargazer-ui/CloseButton","private":false,"module":"index.ts","types":".index.d.ts"}
@@ -0,0 +1,71 @@
1
+ import React from "react";
2
+ import { DropdownContextType, DropdownDividerType, DropdownMenuType, DropdownType } from "./Dropdown.types";
3
+ export declare const DropdownContext: React.Context<DropdownContextType | null>;
4
+ export declare const DropdownContextProvider: ({ children, value }: {
5
+ children: React.ReactNode;
6
+ value: DropdownContextType;
7
+ }) => React.JSX.Element;
8
+ export declare const useDropdownContext: () => DropdownContextType;
9
+ export declare const Toggle: React.ForwardRefExoticComponent<(Omit<{
10
+ children: React.ReactNode;
11
+ className?: string | undefined;
12
+ navDropdown?: boolean | undefined;
13
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
14
+ variant?: string | undefined;
15
+ } & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
16
+ children: React.ReactNode;
17
+ className?: string | undefined;
18
+ navDropdown?: boolean | undefined;
19
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
20
+ variant?: string | undefined;
21
+ } & React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, "ref"> | Omit<{
22
+ children: React.ReactNode;
23
+ className?: string | undefined;
24
+ navDropdown?: boolean | undefined;
25
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
26
+ variant?: string | undefined;
27
+ } & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
28
+ export declare const Menu: React.ForwardRefExoticComponent<Omit<DropdownMenuType, "ref"> & React.RefAttributes<HTMLUListElement>>;
29
+ export declare const Item: React.ForwardRefExoticComponent<(Omit<{
30
+ children: React.ReactNode;
31
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
32
+ className?: string | undefined;
33
+ } & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
34
+ children: React.ReactNode;
35
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
36
+ className?: string | undefined;
37
+ } & React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, "ref">) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
38
+ export declare const Divider: React.ForwardRefExoticComponent<Omit<DropdownDividerType, "ref"> & React.RefAttributes<HTMLHRElement>>;
39
+ declare const _default: React.ForwardRefExoticComponent<Omit<DropdownType, "ref"> & React.RefAttributes<HTMLDivElement>> & {
40
+ Toggle: React.ForwardRefExoticComponent<(Omit<{
41
+ children: React.ReactNode;
42
+ className?: string | undefined;
43
+ navDropdown?: boolean | undefined;
44
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
45
+ variant?: string | undefined;
46
+ } & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
47
+ children: React.ReactNode;
48
+ className?: string | undefined;
49
+ navDropdown?: boolean | undefined;
50
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
51
+ variant?: string | undefined;
52
+ } & React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, "ref"> | Omit<{
53
+ children: React.ReactNode;
54
+ className?: string | undefined;
55
+ navDropdown?: boolean | undefined;
56
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
57
+ variant?: string | undefined;
58
+ } & React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement>, "ref">) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
59
+ Menu: React.ForwardRefExoticComponent<Omit<DropdownMenuType, "ref"> & React.RefAttributes<HTMLUListElement>>;
60
+ Item: React.ForwardRefExoticComponent<(Omit<{
61
+ children: React.ReactNode;
62
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
63
+ className?: string | undefined;
64
+ } & React.ClassAttributes<HTMLAnchorElement> & React.AnchorHTMLAttributes<HTMLAnchorElement>, "ref"> | Omit<{
65
+ children: React.ReactNode;
66
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
67
+ className?: string | undefined;
68
+ } & React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, "ref">) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
69
+ Divider: React.ForwardRefExoticComponent<Omit<DropdownDividerType, "ref"> & React.RefAttributes<HTMLHRElement>>;
70
+ };
71
+ export default _default;
@@ -0,0 +1,306 @@
1
+ import React, { createContext, forwardRef, useState, useMemo, useEffect, useLayoutEffect, useContext } from 'react';
2
+
3
+ //automatic menu placement function
4
+ const getDropdownMenuPlacement = (alignEnd, dropDirection, isRTL = false) => {
5
+ const topStart = isRTL ? 'top-end' : 'top-start';
6
+ const topEnd = isRTL ? 'top-start' : 'top-end';
7
+ const bottomStart = isRTL ? 'bottom-end' : 'bottom-start';
8
+ const bottomEnd = isRTL ? 'bottom-start' : 'bottom-end';
9
+ const leftStart = isRTL ? 'right-start' : 'left-start';
10
+ const leftEnd = isRTL ? 'right-end' : 'left-end';
11
+ const rightStart = isRTL ? 'left-start' : 'right-start';
12
+ const rightEnd = isRTL ? 'left-end' : 'right-end';
13
+ let placement = alignEnd ? bottomEnd : bottomStart;
14
+ if (dropDirection === 'up') {
15
+ placement = alignEnd ? topEnd : topStart;
16
+ }
17
+ else if (dropDirection === 'end') {
18
+ placement = alignEnd ? rightEnd : rightStart;
19
+ }
20
+ else if (dropDirection === 'start') {
21
+ placement = alignEnd ? leftEnd : leftStart;
22
+ }
23
+ else if (dropDirection === 'down-centered') {
24
+ placement = 'bottom';
25
+ }
26
+ else if (dropDirection === 'up-centered') {
27
+ placement = 'top';
28
+ }
29
+ return placement;
30
+ };
31
+ // is click event on the menu
32
+ const isEventOnMenu = (event, controlId = "") => {
33
+ let element = event.target;
34
+ let condition = true;
35
+ let eventIsOnMenu = false;
36
+ while (condition) {
37
+ if (element.id != controlId + "-menu") {
38
+ element = element.parentElement;
39
+ }
40
+ else {
41
+ eventIsOnMenu = true;
42
+ condition = false;
43
+ }
44
+ if (element.id === "root") {
45
+ condition = false;
46
+ eventIsOnMenu = false;
47
+ }
48
+ }
49
+ return eventIsOnMenu;
50
+ };
51
+ const DropdownContext = createContext(null);
52
+ const DropdownContextProvider = ({ children, value }) => {
53
+ return (React.createElement(DropdownContext.Provider, { value: value }, children));
54
+ };
55
+ const useDropdownContext = () => {
56
+ const context = useContext(DropdownContext);
57
+ if (!context) {
58
+ throw new Error("useDropdownContext has to be used within DropdownContextProvider!");
59
+ }
60
+ return context;
61
+ };
62
+ const Dropdown = forwardRef(({ children, className, onSelect, onToggle, controlId, drop = "down", align = "start", autoClose = true, show = "default", ...restProps }, ref) => {
63
+ const [showInternal, setShowInternal] = useState(show === "default" ? false : show);
64
+ // this is an object like {index: string} because we need it to rerender even if the case is the same
65
+ // aka we use a "next/previous" case to navigate through the dropdown menu so need to rerender consecutive "next" cases
66
+ const [activeDescendant, setActiveDescendant] = useState({ case: "" });
67
+ const internalOnToggle = (event) => {
68
+ event.stopPropagation();
69
+ setShowInternal(prev => !prev);
70
+ };
71
+ const alignEnd = align === "end";
72
+ const placement = getDropdownMenuPlacement(alignEnd, drop);
73
+ const contextValue = useMemo(() => ({
74
+ align,
75
+ drop,
76
+ showInternal: show != "default" && onToggle ? show : showInternal,
77
+ handleToggle: show != "default" && onToggle ? onToggle : internalOnToggle,
78
+ placement,
79
+ directionClasses: {
80
+ down: "dropdown",
81
+ 'down-centered': `dropdown-center`,
82
+ up: 'dropup',
83
+ 'up-centered': 'dropup-center dropup',
84
+ end: 'dropend',
85
+ start: 'dropstart'
86
+ },
87
+ controlId: controlId,
88
+ activeDescendant,
89
+ setActiveDescendant
90
+ }), [align, drop, show, showInternal, onToggle, placement, controlId, activeDescendant, setActiveDescendant]);
91
+ return (React.createElement("div", { id: controlId + "-wrapper", ref: ref, className: `sg-dropdown${className ? " " + className : ""}`, ...restProps },
92
+ React.createElement(DropdownContextProvider, { value: contextValue }, children)));
93
+ });
94
+ const Toggle = forwardRef(({ children, className, navDropdown = false, as = "button", variant = "primary", ...restProps }, ref) => {
95
+ const { controlId, handleToggle, setActiveDescendant, showInternal } = useDropdownContext();
96
+ const Component = as;
97
+ const handleKeyPress = (event) => {
98
+ let flag = false;
99
+ console.log(event.key);
100
+ switch (event.key) {
101
+ case "ArrowDown":
102
+ flag = true;
103
+ if (showInternal) {
104
+ setActiveDescendant(prev => ({ ...prev, case: "next" }));
105
+ }
106
+ else {
107
+ handleToggle(event);
108
+ setActiveDescendant(prev => ({ ...prev, case: "first" }));
109
+ }
110
+ break;
111
+ case "ArrowUp":
112
+ flag = true;
113
+ if (showInternal) {
114
+ setActiveDescendant(prev => ({ ...prev, case: "previous" }));
115
+ }
116
+ else {
117
+ handleToggle(event);
118
+ setActiveDescendant(prev => ({ ...prev, case: "last" }));
119
+ }
120
+ break;
121
+ case "Home":
122
+ flag = true;
123
+ if (showInternal) {
124
+ setActiveDescendant(prev => ({ ...prev, case: "first" }));
125
+ }
126
+ break;
127
+ case "End":
128
+ flag = true;
129
+ if (showInternal) {
130
+ setActiveDescendant(prev => ({ ...prev, case: "last" }));
131
+ }
132
+ break;
133
+ case "Tab":
134
+ if (showInternal) {
135
+ handleToggle(event);
136
+ }
137
+ break;
138
+ case "Escape":
139
+ flag = true;
140
+ if (showInternal) {
141
+ handleToggle(event);
142
+ }
143
+ break;
144
+ case "Enter":
145
+ case " ":
146
+ if (showInternal) {
147
+ flag = true;
148
+ const activeElement = document.querySelector(".sg-dropdown-item-visual-focus");
149
+ activeElement.click();
150
+ handleToggle(event);
151
+ break;
152
+ }
153
+ else {
154
+ setActiveDescendant(prev => ({ ...prev, case: "first" }));
155
+ break;
156
+ }
157
+ }
158
+ if (flag) {
159
+ event.stopPropagation();
160
+ event.preventDefault();
161
+ }
162
+ };
163
+ const handleClick = (event) => {
164
+ if (!showInternal)
165
+ return;
166
+ if (event.target.id === controlId)
167
+ return;
168
+ if (!isEventOnMenu(event, controlId)) {
169
+ handleToggle(event);
170
+ }
171
+ else if (isEventOnMenu(event, controlId)) {
172
+ handleToggle(event);
173
+ const toggleElement = document.getElementById(controlId);
174
+ toggleElement?.focus();
175
+ }
176
+ };
177
+ useEffect(() => {
178
+ const toggleElement = document.getElementById(controlId);
179
+ toggleElement.addEventListener("keydown", handleKeyPress, true);
180
+ document.addEventListener("mouseup", handleClick, true);
181
+ return function cleanup() {
182
+ toggleElement.removeEventListener("keydown", handleKeyPress, true);
183
+ document.removeEventListener("mouseup", handleClick, true);
184
+ };
185
+ }, [handleKeyPress, controlId]);
186
+ const toggleButtonClick = (event) => {
187
+ handleToggle(event);
188
+ if (!showInternal) {
189
+ setActiveDescendant(prev => ({ ...prev, case: "first" }));
190
+ }
191
+ };
192
+ let classNamesComputed = `sg-button sg-button${variant ? "-" + variant : "-primary"} sg-dropdown-toggle${className ? " " + className : ""}`;
193
+ if (Component === "a" || navDropdown) {
194
+ classNamesComputed = `sg-nav-dropdown-toggle sg-dropdown-toggle${className ? " " + className : ""}`;
195
+ }
196
+ return (React.createElement(Component, { tabIndex: "0", type: "button", "aria-haspopup": "true", "aria-controls": controlId + "-menu", "aria-expanded": showInternal, id: controlId, ref: ref, className: classNamesComputed, onClick: (event) => toggleButtonClick(event), ...restProps }, children));
197
+ });
198
+ const Menu = forwardRef(({ children, className, style = {}, ...restProps }, ref) => {
199
+ const { controlId, showInternal, activeDescendant } = useDropdownContext();
200
+ const [computedStyle, setComputedStyle] = useState(style);
201
+ useLayoutEffect(() => {
202
+ if (showInternal) {
203
+ const menu = document.getElementById(controlId + "-menu");
204
+ let tempComputedStyle = {};
205
+ if (menu.getBoundingClientRect().right > window.innerWidth) {
206
+ tempComputedStyle = { ...tempComputedStyle, right: 0 };
207
+ }
208
+ else if (menu.getBoundingClientRect().left < 0) {
209
+ tempComputedStyle = { ...tempComputedStyle, left: 0 };
210
+ }
211
+ else if (menu.getBoundingClientRect().top < 0) {
212
+ tempComputedStyle = { ...tempComputedStyle, top: 0 };
213
+ }
214
+ else if (menu.getBoundingClientRect().bottom > window.innerHeight) {
215
+ tempComputedStyle = { ...tempComputedStyle, bottom: 0 };
216
+ }
217
+ setComputedStyle(prev => ({ ...prev, ...tempComputedStyle }));
218
+ }
219
+ }, [showInternal]);
220
+ useEffect(() => {
221
+ if (showInternal) {
222
+ const menu = document.getElementById(controlId + "-menu");
223
+ const menuChildren = document.getElementById(controlId + "-menu").children;
224
+ const menuChildrenLast = menuChildren.length - 1;
225
+ const elementWithVisualFocus = document.querySelector(".sg-dropdown-item-visual-focus");
226
+ let currentIndex = 0, currentChild = menuChildren[0].children[0];
227
+ if (elementWithVisualFocus != null) {
228
+ elementWithVisualFocus.classList.remove("sg-dropdown-item-visual-focus");
229
+ for (let i = 0; i < menuChildren.length; i++) {
230
+ if (menuChildren[i] === elementWithVisualFocus.parentElement) {
231
+ currentIndex = i;
232
+ break;
233
+ }
234
+ }
235
+ }
236
+ switch (activeDescendant.case) {
237
+ case "first":
238
+ currentChild = menuChildren[0].children[0];
239
+ currentIndex = 0;
240
+ break;
241
+ case "last":
242
+ currentChild = menuChildren[menuChildrenLast].children[0];
243
+ currentIndex = menuChildrenLast;
244
+ break;
245
+ case "next":
246
+ currentIndex = currentIndex === menuChildrenLast ? 0 : currentIndex + 1;
247
+ currentChild = menuChildren[currentIndex].children[0];
248
+ break;
249
+ case "previous":
250
+ currentIndex = currentIndex === 0 ? menuChildrenLast : currentIndex - 1;
251
+ currentChild = menuChildren[currentIndex].children[0];
252
+ break;
253
+ }
254
+ menu.setAttribute("aria-activedescendant", currentChild.id);
255
+ menuChildren[currentIndex].children[0].classList.add("sg-dropdown-item-visual-focus");
256
+ }
257
+ else {
258
+ const menu = document.getElementById(controlId + "-menu");
259
+ menu.setAttribute("aria-activedescendant", "");
260
+ }
261
+ }, [controlId, showInternal, activeDescendant]);
262
+ const handleMouseOver = (event) => {
263
+ const target = event.target;
264
+ let active = target.classList.contains("sg-dropdown-item-visual-focus");
265
+ const menu = document.getElementById(controlId + "-menu");
266
+ if (active) {
267
+ return;
268
+ }
269
+ else {
270
+ document.querySelector(".sg-dropdown-item-visual-focus")?.classList.remove("sg-dropdown-item-visual-focus");
271
+ menu.setAttribute("aria-activedescendant", "");
272
+ target.classList.add("sg-dropdown-item-visual-focus");
273
+ menu.setAttribute("aria-activedescendant", target.id);
274
+ }
275
+ };
276
+ useEffect(() => {
277
+ const menu = document.getElementById(controlId + "-menu");
278
+ for (let i = 0; i < menu.children.length; i++) {
279
+ menu.children[i].addEventListener("mouseover", handleMouseOver, true);
280
+ }
281
+ return function cleanup() {
282
+ for (let i = 0; i < menu.children.length; i++) {
283
+ menu.children[i].addEventListener("mouseover", handleMouseOver, true);
284
+ }
285
+ };
286
+ }, []);
287
+ return (React.createElement("ul", { id: controlId + "-menu", role: "menu", tabIndex: -1, "aria-labelledby": controlId, ref: ref, className: `sg-dropdown-list${className ? " " + className : ""}${showInternal ? " show" : ""}`, style: computedStyle, ...restProps }, children));
288
+ });
289
+ const Item = forwardRef(({ children, as = "button", className, ...restProps }, ref) => {
290
+ const Component = as;
291
+ return (React.createElement("li", { role: "none" },
292
+ React.createElement(Component, { ref: ref, role: "menuitem", tabIndex: "-1", className: `sg-dropdown-item${className ? " " + className : ""}`, ...restProps }, children)));
293
+ });
294
+ const Divider = forwardRef(({ className = "", ...restProps }, ref) => {
295
+ return (React.createElement("hr", { ref: ref, className: `.sg-dropdown-divider${className}`, ...restProps }));
296
+ });
297
+ var Dropdown$1 = Object.assign(Dropdown, {
298
+ Toggle: Toggle,
299
+ Menu: Menu,
300
+ Item: Item,
301
+ //Text: Text,
302
+ Divider: Divider
303
+ });
304
+
305
+ export { Divider, DropdownContext, DropdownContextProvider, Item, Menu, Toggle, Dropdown$1 as default, useDropdownContext };
306
+ //# sourceMappingURL=Dropdown.js.map