@kirill.konshin/bootstrap 0.0.1 → 0.0.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.
- package/.ctirc +19 -10
- package/.turbo/turbo-build.log +18 -11
- package/CHANGELOG.md +8 -0
- package/dist/adaptiveContainer.d.ts +2 -1
- package/dist/adaptiveContainer.d.ts.map +1 -1
- package/dist/adaptiveContainer.js +3 -2
- package/dist/adaptiveContainer.js.map +1 -1
- package/dist/adaptiveContainer.stories.d.ts +9 -0
- package/dist/adaptiveContainer.stories.d.ts.map +1 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +3 -2
- package/dist/error.js.map +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +3 -2
- package/dist/field.js.map +1 -1
- package/dist/footer.d.ts +4 -1
- package/dist/footer.d.ts.map +1 -1
- package/dist/footer.js +5 -4
- package/dist/footer.js.map +1 -1
- package/dist/footer.stories.d.ts +12 -0
- package/dist/footer.stories.d.ts.map +1 -0
- package/dist/globalLoading.d.ts.map +1 -1
- package/dist/globalLoading.js +3 -2
- package/dist/globalLoading.js.map +1 -1
- package/dist/responsiveHelper.d.ts.map +1 -1
- package/dist/responsiveHelper.js +3 -3
- package/dist/responsiveHelper.js.map +1 -1
- package/dist/responsiveHelper.stories.d.ts +9 -0
- package/dist/responsiveHelper.stories.d.ts.map +1 -0
- package/dist/toaster.d.ts.map +1 -1
- package/dist/toaster.js +3 -3
- package/dist/toaster.js.map +1 -1
- package/dist/useModal.js.map +1 -1
- package/package.json +2 -2
- package/src/adaptiveContainer.stories.tsx +59 -0
- package/src/adaptiveContainer.tsx +5 -3
- package/src/error.tsx +3 -3
- package/src/field.tsx +3 -3
- package/src/footer.stories.tsx +121 -0
- package/src/footer.tsx +8 -4
- package/src/globalLoading.tsx +3 -3
- package/src/responsiveHelper.stories.tsx +109 -0
- package/src/responsiveHelper.tsx +3 -3
- package/src/toaster.tsx +3 -3
- package/src/useModal.tsx +2 -2
package/.ctirc
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"options": [
|
|
3
|
+
{
|
|
4
|
+
"mode": "create",
|
|
5
|
+
"project": "tsconfig.json",
|
|
6
|
+
"include": "src/**/*.{ts,tsx}",
|
|
7
|
+
"exclude": [
|
|
8
|
+
"**/*.stories.*",
|
|
9
|
+
"**/*.test.*",
|
|
10
|
+
"**/*.fixture.*"
|
|
11
|
+
],
|
|
12
|
+
"startFrom": "src",
|
|
13
|
+
"backup": false,
|
|
14
|
+
"overwrite": true,
|
|
15
|
+
"generationStyle": "default-alias-named-star",
|
|
16
|
+
"output": "src",
|
|
17
|
+
"verbose": true
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
[36mvite v7.0.6 [32mbuilding SSR bundle for production...[36m[39m
|
|
2
|
-
create
|
|
2
|
+
- ctix 'create' mode start, ...
|
|
3
|
+
✔ /home/runner/work/utils/utils/packages/bootstrap/tsconfig.json loading complete!
|
|
4
|
+
✔ analysis export statements completed!
|
|
5
|
+
- build "index.ts" file start
|
|
6
|
+
- output file exists check, ...
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
✔ ctix 'create' mode complete!
|
|
3
10
|
transforming...
|
|
4
11
|
[32m✓[39m 13 modules transformed.
|
|
5
12
|
rendering chunks...
|
|
6
13
|
|
|
7
14
|
[vite:dts] Start generate declaration files...
|
|
8
|
-
[2mdist/[22m[36madaptiveContainer.js [39m[1m[2m0.
|
|
9
|
-
[2mdist/[22m[36mglobalLoading.js [39m[1m[2m0.
|
|
15
|
+
[2mdist/[22m[36madaptiveContainer.js [39m[1m[2m0.46 kB[22m[1m[22m[2m │ map: 0.80 kB[22m
|
|
16
|
+
[2mdist/[22m[36mglobalLoading.js [39m[1m[2m0.49 kB[22m[1m[22m[2m │ map: 0.94 kB[22m
|
|
10
17
|
[2mdist/[22m[36mloading.js [39m[1m[2m0.59 kB[22m[1m[22m[2m │ map: 1.12 kB[22m
|
|
11
|
-
[2mdist/[22m[36merror.js [39m[1m[2m0.
|
|
12
|
-
[2mdist/[22m[36mfield.js [39m[1m[2m0.
|
|
18
|
+
[2mdist/[22m[36merror.js [39m[1m[2m0.84 kB[22m[1m[22m[2m │ map: 1.72 kB[22m
|
|
19
|
+
[2mdist/[22m[36mfield.js [39m[1m[2m0.85 kB[22m[1m[22m[2m │ map: 1.68 kB[22m
|
|
13
20
|
[2mdist/[22m[36museWrappedForm.js [39m[1m[2m0.90 kB[22m[1m[22m[2m │ map: 2.27 kB[22m
|
|
14
21
|
[2mdist/[22m[36mindex.js [39m[1m[2m0.97 kB[22m[1m[22m[2m │ map: 0.10 kB[22m
|
|
15
|
-
[2mdist/[22m[36mtoaster.js [39m[1m[2m1.
|
|
16
|
-
[2mdist/[22m[36mfooter.js [39m[1m[2m1.
|
|
17
|
-
[2mdist/[22m[36mresponsiveHelper.js [39m[1m[2m1.
|
|
18
|
-
[2mdist/[22m[36museModal.js [39m[1m[2m2.08 kB[22m[1m[22m[2m │ map: 4.
|
|
22
|
+
[2mdist/[22m[36mtoaster.js [39m[1m[2m1.09 kB[22m[1m[22m[2m │ map: 2.14 kB[22m
|
|
23
|
+
[2mdist/[22m[36mfooter.js [39m[1m[2m1.62 kB[22m[1m[22m[2m │ map: 2.97 kB[22m
|
|
24
|
+
[2mdist/[22m[36mresponsiveHelper.js [39m[1m[2m1.83 kB[22m[1m[22m[2m │ map: 3.04 kB[22m
|
|
25
|
+
[2mdist/[22m[36museModal.js [39m[1m[2m2.08 kB[22m[1m[22m[2m │ map: 4.91 kB[22m
|
|
19
26
|
[2mdist/[22m[36mcontrols.js [39m[1m[2m2.69 kB[22m[1m[22m[2m │ map: 5.90 kB[22m
|
|
20
27
|
[2mdist/[22m[36mscreen.js [39m[1m[2m3.42 kB[22m[1m[22m[2m │ map: 7.17 kB[22m
|
|
21
|
-
[vite:dts] Declaration files built in
|
|
28
|
+
[vite:dts] Declaration files built in 3640ms.
|
|
22
29
|
|
|
23
|
-
[32m✓ built in
|
|
30
|
+
[32m✓ built in 7.24s[39m
|
|
24
31
|
Updated package.json with exports
|
package/CHANGELOG.md
ADDED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ContainerProps } from 'react-bootstrap';
|
|
3
|
-
export
|
|
3
|
+
export type AdaptiveContainerProps = ContainerProps;
|
|
4
|
+
export declare const AdaptiveContainer: FC<AdaptiveContainerProps>;
|
|
4
5
|
//# sourceMappingURL=adaptiveContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptiveContainer.d.ts","sourceRoot":"","sources":["../src/adaptiveContainer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"adaptiveContainer.d.ts","sourceRoot":"","sources":["../src/adaptiveContainer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AACxC,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5D,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAEpD,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAOvD,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
2
3
|
import { Container } from "react-bootstrap";
|
|
3
4
|
import { useBreakpoint } from "./responsiveHelper.js";
|
|
4
|
-
const AdaptiveContainer = function AdaptiveContainer2({ children, ...props }) {
|
|
5
|
+
const AdaptiveContainer = memo(function AdaptiveContainer2({ children, ...props }) {
|
|
5
6
|
const { isMobile } = useBreakpoint();
|
|
6
7
|
return /* @__PURE__ */ jsx(Container, { fluid: isMobile, ...props, children });
|
|
7
|
-
};
|
|
8
|
+
});
|
|
8
9
|
export {
|
|
9
10
|
AdaptiveContainer
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptiveContainer.js","sources":["../src/adaptiveContainer.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Container, ContainerProps } from 'react-bootstrap';\nimport { useBreakpoint } from './responsiveHelper';\n\nexport const AdaptiveContainer: FC<
|
|
1
|
+
{"version":3,"file":"adaptiveContainer.js","sources":["../src/adaptiveContainer.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\nimport { Container, ContainerProps } from 'react-bootstrap';\nimport { useBreakpoint } from './responsiveHelper';\n\nexport type AdaptiveContainerProps = ContainerProps;\n\nexport const AdaptiveContainer: FC<AdaptiveContainerProps> = memo(function AdaptiveContainer({ children, ...props }) {\n const { isMobile } = useBreakpoint();\n return (\n <Container fluid={isMobile} {...props}>\n {children}\n </Container>\n );\n});\n"],"names":["AdaptiveContainer"],"mappings":";;;;AAMO,MAAM,oBAAgD,KAAK,SAASA,mBAAkB,EAAE,UAAU,GAAG,SAAS;AACjH,QAAM,EAAE,SAAA,IAAa,cAAA;AACrB,6BACK,WAAA,EAAU,OAAO,UAAW,GAAG,OAC3B,UACL;AAER,CAAC;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AdaptiveContainer } from './adaptiveContainer';
|
|
3
|
+
declare const meta: Meta<typeof AdaptiveContainer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithClassName: Story;
|
|
8
|
+
export declare const WithContent: Story;
|
|
9
|
+
//# sourceMappingURL=adaptiveContainer.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptiveContainer.stories.d.ts","sourceRoot":"","sources":["../src/adaptiveContainer.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,iBAAiB,CAWxC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAK3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAsBzB,CAAC"}
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AACxC,OAAO,EAA6B,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzE,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,GAAG,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAwBzC,CAAC"}
|
package/dist/error.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { memo } from "react";
|
|
3
4
|
import { Alert, Button } from "react-bootstrap";
|
|
4
|
-
const ErrorAlert = function ErrorAlert2({ onRetry, children, buttonProps, ...props }) {
|
|
5
|
+
const ErrorAlert = memo(function ErrorAlert2({ onRetry, children, buttonProps, ...props }) {
|
|
5
6
|
if (!children) return null;
|
|
6
7
|
return /* @__PURE__ */ jsxs(Alert, { variant: "danger", ...props, children: [
|
|
7
8
|
/* @__PURE__ */ jsx("div", { children: children.message || children.toString() }),
|
|
@@ -20,7 +21,7 @@ const ErrorAlert = function ErrorAlert2({ onRetry, children, buttonProps, ...pro
|
|
|
20
21
|
}
|
|
21
22
|
) })
|
|
22
23
|
] });
|
|
23
|
-
};
|
|
24
|
+
});
|
|
24
25
|
export {
|
|
25
26
|
ErrorAlert
|
|
26
27
|
};
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sources":["../src/error.tsx"],"sourcesContent":["'use client';\n\nimport React, { FC } from 'react';\nimport { Alert, AlertProps, Button, ButtonProps } from 'react-bootstrap';\n\nexport type ErrorAlertProps = {\n children?: Error | string | any;\n onRetry?: () => any;\n buttonProps?: ButtonProps;\n};\n\n//TODO Create MUI-specific?\nexport const ErrorAlert: FC<ErrorAlertProps> = function ErrorAlert({ onRetry, children, buttonProps, ...props }) {\n if (!children) return null;\n\n return (\n <Alert variant=\"danger\" {...props}>\n <div>{children.message || children.toString()}</div>\n {onRetry && (\n <div>\n <Button\n variant=\"link\"\n className=\"alert-link\"\n {...buttonProps}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n onRetry();\n }}\n >\n Retry\n </Button>\n </div>\n )}\n </Alert>\n );\n};\n"],"names":["ErrorAlert"],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.js","sources":["../src/error.tsx"],"sourcesContent":["'use client';\n\nimport React, { FC, memo } from 'react';\nimport { Alert, AlertProps, Button, ButtonProps } from 'react-bootstrap';\n\nexport type ErrorAlertProps = {\n children?: Error | string | any;\n onRetry?: () => any;\n buttonProps?: ButtonProps;\n};\n\n//TODO Create MUI-specific?\nexport const ErrorAlert: FC<ErrorAlertProps> = memo(function ErrorAlert({ onRetry, children, buttonProps, ...props }) {\n if (!children) return null;\n\n return (\n <Alert variant=\"danger\" {...props}>\n <div>{children.message || children.toString()}</div>\n {onRetry && (\n <div>\n <Button\n variant=\"link\"\n className=\"alert-link\"\n {...buttonProps}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n onRetry();\n }}\n >\n Retry\n </Button>\n </div>\n )}\n </Alert>\n );\n});\n"],"names":["ErrorAlert"],"mappings":";;;;AAYO,MAAM,aAAkC,KAAK,SAASA,YAAW,EAAE,SAAS,UAAU,aAAa,GAAG,SAAS;AAClH,MAAI,CAAC,SAAU,QAAO;AAEtB,SACI,qBAAC,OAAA,EAAM,SAAQ,UAAU,GAAG,OACxB,UAAA;AAAA,IAAA,oBAAC,OAAA,EAAK,UAAA,SAAS,WAAW,SAAS,YAAW;AAAA,IAC7C,+BACI,OAAA,EACG,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,SAAQ;AAAA,QACR,WAAU;AAAA,QACT,GAAG;AAAA,QACJ,SAAS,CAAC,MAAM;AACZ,YAAE,eAAA;AACF,YAAE,gBAAA;AACF,kBAAA;AAAA,QACJ;AAAA,QACH,UAAA;AAAA,MAAA;AAAA,IAAA,EAED,CACJ;AAAA,EAAA,GAER;AAER,CAAC;"}
|
package/dist/field.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AACxC,OAAO,EAAQ,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEtF,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG;IAC3C,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAyBzC,CAAC"}
|
package/dist/field.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
2
3
|
import { Form } from "react-bootstrap";
|
|
3
|
-
const FieldGroup = function FieldGroup2({
|
|
4
|
+
const FieldGroup = memo(function FieldGroup2({
|
|
4
5
|
label,
|
|
5
6
|
labelProps = {},
|
|
6
7
|
text,
|
|
@@ -22,7 +23,7 @@ const FieldGroup = function FieldGroup2({
|
|
|
22
23
|
text && !horizontal && /* @__PURE__ */ jsx(Form.Text, { ...textProps, children: text }),
|
|
23
24
|
" "
|
|
24
25
|
] });
|
|
25
|
-
};
|
|
26
|
+
});
|
|
26
27
|
export {
|
|
27
28
|
FieldGroup
|
|
28
29
|
};
|
package/dist/field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sources":["../src/field.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Form, FormGroupProps, FormLabelProps, FormTextProps } from 'react-bootstrap';\n\nexport type FieldGroupProps = FormGroupProps & {\n label?: any;\n labelProps?: FormLabelProps;\n text?: any;\n textProps?: FormTextProps;\n horizontal?: boolean;\n};\n\nexport const FieldGroup: FC<FieldGroupProps> = function FieldGroup({\n label,\n labelProps = {},\n text,\n textProps = {},\n horizontal,\n children,\n ...props\n}) {\n if (horizontal) {\n props.className = 'hstack gap-3 ' + (props.className || '');\n labelProps.className = 'm-0 ' + (labelProps.className || '');\n }\n\n if (text && horizontal) {\n throw new Error('Cannot use text and horizontal together');\n }\n\n return (\n <Form.Group {...props}>\n {label && <Form.Label {...labelProps}>{label}</Form.Label>}\n {children}\n {text && !horizontal && <Form.Text {...textProps}>{text}</Form.Text>}{' '}\n </Form.Group>\n );\n};\n"],"names":["FieldGroup"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../src/field.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\nimport { Form, FormGroupProps, FormLabelProps, FormTextProps } from 'react-bootstrap';\n\nexport type FieldGroupProps = FormGroupProps & {\n label?: any;\n labelProps?: FormLabelProps;\n text?: any;\n textProps?: FormTextProps;\n horizontal?: boolean;\n};\n\nexport const FieldGroup: FC<FieldGroupProps> = memo(function FieldGroup({\n label,\n labelProps = {},\n text,\n textProps = {},\n horizontal,\n children,\n ...props\n}) {\n if (horizontal) {\n props.className = 'hstack gap-3 ' + (props.className || '');\n labelProps.className = 'm-0 ' + (labelProps.className || '');\n }\n\n if (text && horizontal) {\n throw new Error('Cannot use text and horizontal together');\n }\n\n return (\n <Form.Group {...props}>\n {label && <Form.Label {...labelProps}>{label}</Form.Label>}\n {children}\n {text && !horizontal && <Form.Text {...textProps}>{text}</Form.Text>}{' '}\n </Form.Group>\n );\n});\n"],"names":["FieldGroup"],"mappings":";;;AAWO,MAAM,aAAkC,KAAK,SAASA,YAAW;AAAA,EACpE;AAAA,EACA,aAAa,CAAA;AAAA,EACb;AAAA,EACA,YAAY,CAAA;AAAA,EACZ;AAAA,EACA;AAAA,EACA,GAAG;AACP,GAAG;AACC,MAAI,YAAY;AACZ,UAAM,YAAY,mBAAmB,MAAM,aAAa;AACxD,eAAW,YAAY,UAAU,WAAW,aAAa;AAAA,EAC7D;AAEA,MAAI,QAAQ,YAAY;AACpB,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC7D;AAEA,SACI,qBAAC,KAAK,OAAL,EAAY,GAAG,OACX,UAAA;AAAA,IAAA,6BAAU,KAAK,OAAL,EAAY,GAAG,YAAa,UAAA,OAAM;AAAA,IAC5C;AAAA,IACA,QAAQ,CAAC,cAAc,oBAAC,KAAK,MAAL,EAAW,GAAG,WAAY,UAAA,MAAK;AAAA,IAAc;AAAA,EAAA,GAC1E;AAER,CAAC;"}
|
package/dist/footer.d.ts
CHANGED
|
@@ -6,5 +6,8 @@ export type FooterNavItemProps = {
|
|
|
6
6
|
children?: string | undefined;
|
|
7
7
|
};
|
|
8
8
|
export declare const FooterNavItem: FC<FooterNavItemProps>;
|
|
9
|
-
export
|
|
9
|
+
export type FooterProps = {
|
|
10
|
+
children: any;
|
|
11
|
+
};
|
|
12
|
+
export declare const Footer: FC<FooterProps>;
|
|
10
13
|
//# sourceMappingURL=footer.d.ts.map
|
package/dist/footer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../src/footer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../src/footer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAKxC,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAgC/C,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,GAAG,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAcjC,CAAC"}
|
package/dist/footer.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
2
3
|
import { Nav, Navbar } from "react-bootstrap";
|
|
3
4
|
import { useBreakpoint } from "./responsiveHelper.js";
|
|
4
5
|
import { AdaptiveContainer } from "./adaptiveContainer.js";
|
|
5
|
-
const FooterNavItem = function FooterNavItem2({
|
|
6
|
+
const FooterNavItem = memo(function FooterNavItem2({
|
|
6
7
|
href,
|
|
7
8
|
icon,
|
|
8
9
|
active = false,
|
|
@@ -27,8 +28,8 @@ const FooterNavItem = function FooterNavItem2({
|
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
return /* @__PURE__ */ jsx(Nav.Item, { style: { flex: 1 }, children: link });
|
|
30
|
-
};
|
|
31
|
-
const Footer = function Footer2({ children }) {
|
|
31
|
+
});
|
|
32
|
+
const Footer = memo(function Footer2({ children }) {
|
|
32
33
|
const { isDesktop } = useBreakpoint();
|
|
33
34
|
return (
|
|
34
35
|
// border-bottom
|
|
@@ -37,7 +38,7 @@ const Footer = function Footer2({ children }) {
|
|
|
37
38
|
/* @__PURE__ */ jsx(Nav, { className: isDesktop ? "me-auto" : "justify-content-center flex-nowrap w-100", children })
|
|
38
39
|
] }) }) })
|
|
39
40
|
);
|
|
40
|
-
};
|
|
41
|
+
});
|
|
41
42
|
export {
|
|
42
43
|
Footer,
|
|
43
44
|
FooterNavItem
|
package/dist/footer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sources":["../src/footer.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { Nav, Navbar } from 'react-bootstrap';\nimport { useBreakpoint } from './responsiveHelper';\nimport { AdaptiveContainer } from './adaptiveContainer';\n\nexport type FooterNavItemProps = {\n href: any;\n icon: any;\n active?: boolean | undefined;\n children?: string | undefined;\n};\n\nexport const FooterNavItem: FC<FooterNavItemProps> = function FooterNavItem({\n href,\n icon,\n active = false,\n children = '',\n}) {\n // const pathname = usePathname();\n\n const isFilepath = icon.includes('.');\n let iconElement;\n\n if (isFilepath) {\n iconElement = <img src={icon} alt=\"icon\" className=\"me-lg-2\" />;\n } else {\n iconElement = <span className={`lead me-lg-2 ${icon}`} />;\n }\n\n // const active = isActivePath(href, pathname);\n\n const link = (\n <Nav.Link\n // as={Link}\n href={href}\n // active={active} // has no effect when not pills or tabs\n className={`px-0 px-lg-3 d-flex align-items-center flex-column flex-lg-row ${active ? 'text-primary' : ''}`}\n >\n {iconElement}\n {children}\n </Nav.Link>\n );\n\n return <Nav.Item style={{ flex: 1 }}>{link}</Nav.Item>;\n};\n\nexport const Footer: FC<
|
|
1
|
+
{"version":3,"file":"footer.js","sources":["../src/footer.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\nimport { Nav, Navbar } from 'react-bootstrap';\nimport { useBreakpoint } from './responsiveHelper';\nimport { AdaptiveContainer } from './adaptiveContainer';\n\nexport type FooterNavItemProps = {\n href: any;\n icon: any;\n active?: boolean | undefined;\n children?: string | undefined;\n};\n\nexport const FooterNavItem: FC<FooterNavItemProps> = memo(function FooterNavItem({\n href,\n icon,\n active = false,\n children = '',\n}) {\n // const pathname = usePathname();\n\n const isFilepath = icon.includes('.');\n let iconElement;\n\n if (isFilepath) {\n iconElement = <img src={icon} alt=\"icon\" className=\"me-lg-2\" />;\n } else {\n iconElement = <span className={`lead me-lg-2 ${icon}`} />;\n }\n\n // const active = isActivePath(href, pathname);\n\n const link = (\n <Nav.Link\n // as={Link}\n href={href}\n // active={active} // has no effect when not pills or tabs\n className={`px-0 px-lg-3 d-flex align-items-center flex-column flex-lg-row ${active ? 'text-primary' : ''}`}\n >\n {iconElement}\n {children}\n </Nav.Link>\n );\n\n return <Nav.Item style={{ flex: 1 }}>{link}</Nav.Item>;\n});\n\nexport type FooterProps = {\n children: any;\n};\n\nexport const Footer: FC<FooterProps> = memo(function Footer({ children }) {\n const { isDesktop } = useBreakpoint();\n\n return (\n // border-bottom\n <div className={isDesktop ? '' : 'border-top'}>\n <Navbar className={isDesktop ? '' : 'py-0'}>\n <AdaptiveContainer>\n {isDesktop && <Navbar.Brand href=\"/\">Le Brand</Navbar.Brand>}\n <Nav className={isDesktop ? 'me-auto' : 'justify-content-center flex-nowrap w-100'}>{children}</Nav>\n </AdaptiveContainer>\n </Navbar>\n </div>\n );\n});\n"],"names":["FooterNavItem","Footer"],"mappings":";;;;;AAYO,MAAM,gBAAwC,KAAK,SAASA,eAAc;AAAA,EAC7E;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AACf,GAAG;AAGC,QAAM,aAAa,KAAK,SAAS,GAAG;AACpC,MAAI;AAEJ,MAAI,YAAY;AACZ,sCAAe,OAAA,EAAI,KAAK,MAAM,KAAI,QAAO,WAAU,WAAU;AAAA,EACjE,OAAO;AACH,kBAAc,oBAAC,QAAA,EAAK,WAAW,gBAAgB,IAAI,IAAI;AAAA,EAC3D;AAIA,QAAM,OACF;AAAA,IAAC,IAAI;AAAA,IAAJ;AAAA,MAEG;AAAA,MAEA,WAAW,kEAAkE,SAAS,iBAAiB,EAAE;AAAA,MAExG,UAAA;AAAA,QAAA;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIT,SAAO,oBAAC,IAAI,MAAJ,EAAS,OAAO,EAAE,MAAM,EAAA,GAAM,UAAA,MAAK;AAC/C,CAAC;AAMM,MAAM,SAA0B,KAAK,SAASC,QAAO,EAAE,YAAY;AACtE,QAAM,EAAE,UAAA,IAAc,cAAA;AAEtB;AAAA;AAAA,IAEI,oBAAC,OAAA,EAAI,WAAW,YAAY,KAAK,cAC7B,UAAA,oBAAC,QAAA,EAAO,WAAW,YAAY,KAAK,QAChC,+BAAC,mBAAA,EACI,UAAA;AAAA,MAAA,iCAAc,OAAO,OAAP,EAAa,MAAK,KAAI,UAAA,YAAQ;AAAA,0BAC5C,KAAA,EAAI,WAAW,YAAY,YAAY,4CAA6C,SAAA,CAAS;AAAA,IAAA,EAAA,CAClG,GACJ,EAAA,CACJ;AAAA;AAER,CAAC;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Footer, FooterNavItem } from './footer';
|
|
3
|
+
declare const meta: Meta<typeof Footer>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithActiveItem: Story;
|
|
8
|
+
export declare const ManyItems: Story;
|
|
9
|
+
export declare const NavItemDefault: StoryObj<typeof FooterNavItem>;
|
|
10
|
+
export declare const NavItemActive: StoryObj<typeof FooterNavItem>;
|
|
11
|
+
export declare const NavItemIconOnly: StoryObj<typeof FooterNavItem>;
|
|
12
|
+
//# sourceMappingURL=footer.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"footer.stories.d.ts","sourceRoot":"","sources":["../src/footer.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAQ7B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAmB5B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAsBvB,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,OAAO,aAAa,CAWzD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,OAAO,aAAa,CAYxD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,OAAO,aAAa,CAU1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalLoading.d.ts","sourceRoot":"","sources":["../src/globalLoading.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"globalLoading.d.ts","sourceRoot":"","sources":["../src/globalLoading.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAQ,MAAM,OAAO,CAAC;AAIxC,MAAM,MAAM,kBAAkB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAY/C,CAAC"}
|
package/dist/globalLoading.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
2
3
|
import { Loading } from "./loading.js";
|
|
3
|
-
const GlobalLoading = function GlobalLoading2({ loading }) {
|
|
4
|
+
const GlobalLoading = memo(function GlobalLoading2({ loading }) {
|
|
4
5
|
if (!loading) return null;
|
|
5
6
|
return /* @__PURE__ */ jsx("div", { className: "bg-white position-absolute top-0 start-0 w-100 h-100 z-3 d-flex align-items-center justify-content-center", children: /* @__PURE__ */ jsx(Loading, {}) });
|
|
6
|
-
};
|
|
7
|
+
});
|
|
7
8
|
export {
|
|
8
9
|
GlobalLoading
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalLoading.js","sources":["../src/globalLoading.tsx"],"sourcesContent":["import React, { FC } from 'react';\n// import { useLoading, useLoadingTimeout } from '../redux/loadingSlice';\nimport { Loading } from './loading';\n\nexport type GlobalLoadingProps = { loading: boolean };\n\nexport const GlobalLoading: FC<GlobalLoadingProps> = function GlobalLoading({ loading }) {\n // const { loading } = useLoading();\n\n // useLoadingTimeout(15000); // escape latch if something is stuck\n\n if (!loading) return null;\n\n return (\n <div className=\"bg-white position-absolute top-0 start-0 w-100 h-100 z-3 d-flex align-items-center justify-content-center\">\n <Loading />\n </div>\n );\n};\n"],"names":["GlobalLoading"],"mappings":"
|
|
1
|
+
{"version":3,"file":"globalLoading.js","sources":["../src/globalLoading.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\n// import { useLoading, useLoadingTimeout } from '../redux/loadingSlice';\nimport { Loading } from './loading';\n\nexport type GlobalLoadingProps = { loading: boolean };\n\nexport const GlobalLoading: FC<GlobalLoadingProps> = memo(function GlobalLoading({ loading }) {\n // const { loading } = useLoading();\n\n // useLoadingTimeout(15000); // escape latch if something is stuck\n\n if (!loading) return null;\n\n return (\n <div className=\"bg-white position-absolute top-0 start-0 w-100 h-100 z-3 d-flex align-items-center justify-content-center\">\n <Loading />\n </div>\n );\n});\n"],"names":["GlobalLoading"],"mappings":";;;AAMO,MAAM,gBAAwC,KAAK,SAASA,eAAc,EAAE,WAAW;AAK1F,MAAI,CAAC,QAAS,QAAO;AAErB,6BACK,OAAA,EAAI,WAAU,6GACX,UAAA,oBAAC,WAAQ,GACb;AAER,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsiveHelper.d.ts","sourceRoot":"","sources":["../src/responsiveHelper.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"responsiveHelper.d.ts","sourceRoot":"","sources":["../src/responsiveHelper.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAA6B,MAAM,OAAO,CAAC;AAE7D,wBAAgB,aAAa,IAAI;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACtB,CAiCA;AAED,eAAO,MAAM,kBAAkB,EAAE,EAW/B,CAAC"}
|
package/dist/responsiveHelper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect } from "react";
|
|
3
|
+
import { memo, useState, useEffect } from "react";
|
|
4
4
|
function useBreakpoint() {
|
|
5
5
|
const [breakpoint, setBreakpoint] = useState("xs");
|
|
6
6
|
useEffect(() => {
|
|
@@ -29,7 +29,7 @@ function useBreakpoint() {
|
|
|
29
29
|
const isMobile = ["xs", "sm", "md"].includes(breakpoint);
|
|
30
30
|
return { breakpoint, isMobile, isDesktop: !isMobile };
|
|
31
31
|
}
|
|
32
|
-
const ResponsiveHelperBS = function ResponsiveHelperBS2() {
|
|
32
|
+
const ResponsiveHelperBS = memo(function ResponsiveHelperBS2() {
|
|
33
33
|
return /* @__PURE__ */ jsxs("span", { className: "small position-fixed bottom-0 z-3", style: { fontSize: "9px", right: 1, lineHeight: 1 }, children: [
|
|
34
34
|
/* @__PURE__ */ jsx("small", { className: "d-block d-sm-none", children: "XS" }),
|
|
35
35
|
/* @__PURE__ */ jsx("small", { className: "d-none d-sm-block d-md-none", children: "SM" }),
|
|
@@ -38,7 +38,7 @@ const ResponsiveHelperBS = function ResponsiveHelperBS2() {
|
|
|
38
38
|
/* @__PURE__ */ jsx("small", { className: "d-none d-xl-block d-xxl-none", children: "XL" }),
|
|
39
39
|
/* @__PURE__ */ jsx("small", { className: "d-none d-xxl-block", children: "XXL" })
|
|
40
40
|
] });
|
|
41
|
-
};
|
|
41
|
+
});
|
|
42
42
|
export {
|
|
43
43
|
ResponsiveHelperBS,
|
|
44
44
|
useBreakpoint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responsiveHelper.js","sources":["../src/responsiveHelper.tsx"],"sourcesContent":["'use client';\n\nimport React, { FC, useEffect, useState } from 'react';\n\nexport function useBreakpoint(): {\n breakpoint: string;\n isMobile: boolean;\n isDesktop: boolean;\n} {\n const [breakpoint, setBreakpoint] = useState('xs');\n\n useEffect(() => {\n const updateBreakpoint = () => {\n const width = window.innerWidth;\n if (width < 576) {\n setBreakpoint('xs');\n } else if (width < 768) {\n setBreakpoint('sm');\n } else if (width < 992) {\n setBreakpoint('md');\n } else if (width < 1200) {\n setBreakpoint('lg');\n } else if (width < 1400) {\n setBreakpoint('xl');\n } else {\n setBreakpoint('xxl');\n }\n };\n\n updateBreakpoint();\n\n window.addEventListener('resize', updateBreakpoint);\n\n return () => {\n window.removeEventListener('resize', updateBreakpoint);\n };\n }, []);\n\n const isMobile = ['xs', 'sm', 'md'].includes(breakpoint);\n\n return { breakpoint, isMobile, isDesktop: !isMobile };\n}\n\nexport const ResponsiveHelperBS: FC = function ResponsiveHelperBS() {\n return (\n <span className=\"small position-fixed bottom-0 z-3\" style={{ fontSize: '9px', right: 1, lineHeight: 1 }}>\n <small className=\"d-block d-sm-none\">XS</small>\n <small className=\"d-none d-sm-block d-md-none\">SM</small>\n <small className=\"d-none d-md-block d-lg-none\">MD</small>\n <small className=\"d-none d-lg-block d-xl-none\">LG</small>\n <small className=\"d-none d-xl-block d-xxl-none\">XL</small>\n <small className=\"d-none d-xxl-block\">XXL</small>\n </span>\n );\n};\n"],"names":["ResponsiveHelperBS"],"mappings":";;;AAIO,SAAS,gBAId;AACE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,IAAI;AAEjD,YAAU,MAAM;AACZ,UAAM,mBAAmB,MAAM;AAC3B,YAAM,QAAQ,OAAO;AACrB,UAAI,QAAQ,KAAK;AACb,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,KAAK;AACpB,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,KAAK;AACpB,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,MAAM;AACrB,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,MAAM;AACrB,sBAAc,IAAI;AAAA,MACtB,OAAO;AACH,sBAAc,KAAK;AAAA,MACvB;AAAA,IACJ;AAEA,qBAAA;AAEA,WAAO,iBAAiB,UAAU,gBAAgB;AAElD,WAAO,MAAM;AACT,aAAO,oBAAoB,UAAU,gBAAgB;AAAA,IACzD;AAAA,EACJ,GAAG,CAAA,CAAE;AAEL,QAAM,WAAW,CAAC,MAAM,MAAM,IAAI,EAAE,SAAS,UAAU;AAEvD,SAAO,EAAE,YAAY,UAAU,WAAW,CAAC,SAAA;AAC/C;AAEO,MAAM,qBAAyB,SAASA,sBAAqB;
|
|
1
|
+
{"version":3,"file":"responsiveHelper.js","sources":["../src/responsiveHelper.tsx"],"sourcesContent":["'use client';\n\nimport React, { FC, memo, useEffect, useState } from 'react';\n\nexport function useBreakpoint(): {\n breakpoint: string;\n isMobile: boolean;\n isDesktop: boolean;\n} {\n const [breakpoint, setBreakpoint] = useState('xs');\n\n useEffect(() => {\n const updateBreakpoint = () => {\n const width = window.innerWidth;\n if (width < 576) {\n setBreakpoint('xs');\n } else if (width < 768) {\n setBreakpoint('sm');\n } else if (width < 992) {\n setBreakpoint('md');\n } else if (width < 1200) {\n setBreakpoint('lg');\n } else if (width < 1400) {\n setBreakpoint('xl');\n } else {\n setBreakpoint('xxl');\n }\n };\n\n updateBreakpoint();\n\n window.addEventListener('resize', updateBreakpoint);\n\n return () => {\n window.removeEventListener('resize', updateBreakpoint);\n };\n }, []);\n\n const isMobile = ['xs', 'sm', 'md'].includes(breakpoint);\n\n return { breakpoint, isMobile, isDesktop: !isMobile };\n}\n\nexport const ResponsiveHelperBS: FC = memo(function ResponsiveHelperBS() {\n return (\n <span className=\"small position-fixed bottom-0 z-3\" style={{ fontSize: '9px', right: 1, lineHeight: 1 }}>\n <small className=\"d-block d-sm-none\">XS</small>\n <small className=\"d-none d-sm-block d-md-none\">SM</small>\n <small className=\"d-none d-md-block d-lg-none\">MD</small>\n <small className=\"d-none d-lg-block d-xl-none\">LG</small>\n <small className=\"d-none d-xl-block d-xxl-none\">XL</small>\n <small className=\"d-none d-xxl-block\">XXL</small>\n </span>\n );\n});\n"],"names":["ResponsiveHelperBS"],"mappings":";;;AAIO,SAAS,gBAId;AACE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,IAAI;AAEjD,YAAU,MAAM;AACZ,UAAM,mBAAmB,MAAM;AAC3B,YAAM,QAAQ,OAAO;AACrB,UAAI,QAAQ,KAAK;AACb,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,KAAK;AACpB,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,KAAK;AACpB,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,MAAM;AACrB,sBAAc,IAAI;AAAA,MACtB,WAAW,QAAQ,MAAM;AACrB,sBAAc,IAAI;AAAA,MACtB,OAAO;AACH,sBAAc,KAAK;AAAA,MACvB;AAAA,IACJ;AAEA,qBAAA;AAEA,WAAO,iBAAiB,UAAU,gBAAgB;AAElD,WAAO,MAAM;AACT,aAAO,oBAAoB,UAAU,gBAAgB;AAAA,IACzD;AAAA,EACJ,GAAG,CAAA,CAAE;AAEL,QAAM,WAAW,CAAC,MAAM,MAAM,IAAI,EAAE,SAAS,UAAU;AAEvD,SAAO,EAAE,YAAY,UAAU,WAAW,CAAC,SAAA;AAC/C;AAEO,MAAM,qBAAyB,KAAK,SAASA,sBAAqB;AACrE,SACI,qBAAC,QAAA,EAAK,WAAU,qCAAoC,OAAO,EAAE,UAAU,OAAO,OAAO,GAAG,YAAY,EAAA,GAChG,UAAA;AAAA,IAAA,oBAAC,SAAA,EAAM,WAAU,qBAAoB,UAAA,MAAE;AAAA,IACvC,oBAAC,SAAA,EAAM,WAAU,+BAA8B,UAAA,MAAE;AAAA,IACjD,oBAAC,SAAA,EAAM,WAAU,+BAA8B,UAAA,MAAE;AAAA,IACjD,oBAAC,SAAA,EAAM,WAAU,+BAA8B,UAAA,MAAE;AAAA,IACjD,oBAAC,SAAA,EAAM,WAAU,gCAA+B,UAAA,MAAE;AAAA,IAClD,oBAAC,SAAA,EAAM,WAAU,sBAAqB,UAAA,MAAA,CAAG;AAAA,EAAA,GAC7C;AAER,CAAC;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ResponsiveHelperBS } from './responsiveHelper';
|
|
3
|
+
declare const meta: Meta<typeof ResponsiveHelperBS>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const UseBreakpointHook: Story;
|
|
8
|
+
export declare const CombinedDemo: Story;
|
|
9
|
+
//# sourceMappingURL=responsiveHelper.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsiveHelper.stories.d.ts","sourceRoot":"","sources":["../src/responsiveHelper.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAiB,MAAM,oBAAoB,CAAC;AAEvE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CAQzC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAkBrB,CAAC;AA8CF,eAAO,MAAM,iBAAiB,EAAE,KAS/B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAc1B,CAAC"}
|
package/dist/toaster.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../src/toaster.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../src/toaster.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAY,EAAE,EAAQ,MAAM,OAAO,CAAC;AAClD,OAAO,EAAS,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;KAAE,CAAC;CAChG,GAAG,UAAU,CAAC;AAEf,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CA6BnC,CAAC"}
|
package/dist/toaster.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { memo, useState } from "react";
|
|
4
4
|
import { Toast } from "react-bootstrap";
|
|
5
|
-
const Toaster = function Toaster2({ toast }) {
|
|
5
|
+
const Toaster = memo(function Toaster2({ toast }) {
|
|
6
6
|
const [dismissed, setDismissed] = useState(false);
|
|
7
7
|
const msg = typeof toast === "string" ? toast : toast?.message;
|
|
8
8
|
const variant = typeof toast === "string" ? "" : toast?.variant;
|
|
@@ -27,7 +27,7 @@ const Toaster = function Toaster2({ toast }) {
|
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
|
-
};
|
|
30
|
+
});
|
|
31
31
|
export {
|
|
32
32
|
Toaster
|
|
33
33
|
};
|
package/dist/toaster.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.js","sources":["../src/toaster.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState, FC } from 'react';\nimport { Toast, ToastProps } from 'react-bootstrap';\n// import { useToaster } from '../redux/toasterSlice';\n\nexport type ToasterProps = {\n toast: string | { message: string; title?: string; variant?: 'dark' | 'success' | 'danger' };\n} & ToastProps;\n\nexport const Toaster: FC<ToasterProps> = function Toaster({ toast }) {\n //const { toast, setToast } = useToaster();\n const [dismissed, setDismissed] = useState(false);\n\n const msg = typeof toast === 'string' ? toast : toast?.message;\n // const title = typeof toast === 'string' ? 'Notification' : toast?.title;\n const variant = typeof toast === 'string' ? '' : toast?.variant;\n\n return (\n <Toast\n onClose={() => setDismissed(true)}\n show={!dismissed}\n delay={10000}\n autohide\n bg={variant?.toLowerCase()}\n className=\"position-fixed top-50 right-50 min-w-200px z-3\"\n >\n <Toast.Header>\n <strong className=\"me-auto\">Notification</strong>\n </Toast.Header>\n <Toast.Body\n className={\n ['dark', 'success', 'danger'].includes((variant as string)?.toLowerCase()) ? 'text-white' : ''\n }\n >\n {msg}\n </Toast.Body>\n </Toast>\n );\n};\n"],"names":["Toaster"],"mappings":";;;;AAUO,MAAM,UAA4B,SAASA,SAAQ,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"toaster.js","sources":["../src/toaster.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState, FC, memo } from 'react';\nimport { Toast, ToastProps } from 'react-bootstrap';\n// import { useToaster } from '../redux/toasterSlice';\n\nexport type ToasterProps = {\n toast: string | { message: string; title?: string; variant?: 'dark' | 'success' | 'danger' };\n} & ToastProps;\n\nexport const Toaster: FC<ToasterProps> = memo(function Toaster({ toast }) {\n //const { toast, setToast } = useToaster();\n const [dismissed, setDismissed] = useState(false);\n\n const msg = typeof toast === 'string' ? toast : toast?.message;\n // const title = typeof toast === 'string' ? 'Notification' : toast?.title;\n const variant = typeof toast === 'string' ? '' : toast?.variant;\n\n return (\n <Toast\n onClose={() => setDismissed(true)}\n show={!dismissed}\n delay={10000}\n autohide\n bg={variant?.toLowerCase()}\n className=\"position-fixed top-50 right-50 min-w-200px z-3\"\n >\n <Toast.Header>\n <strong className=\"me-auto\">Notification</strong>\n </Toast.Header>\n <Toast.Body\n className={\n ['dark', 'success', 'danger'].includes((variant as string)?.toLowerCase()) ? 'text-white' : ''\n }\n >\n {msg}\n </Toast.Body>\n </Toast>\n );\n});\n"],"names":["Toaster"],"mappings":";;;;AAUO,MAAM,UAA4B,KAAK,SAASA,SAAQ,EAAE,SAAS;AAEtE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,QAAM,MAAM,OAAO,UAAU,WAAW,QAAQ,OAAO;AAEvD,QAAM,UAAU,OAAO,UAAU,WAAW,KAAK,OAAO;AAExD,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,SAAS,MAAM,aAAa,IAAI;AAAA,MAChC,MAAM,CAAC;AAAA,MACP,OAAO;AAAA,MACP,UAAQ;AAAA,MACR,IAAI,SAAS,YAAA;AAAA,MACb,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,oBAAC,MAAM,QAAN,EACG,UAAA,oBAAC,YAAO,WAAU,WAAU,0BAAY,EAAA,CAC5C;AAAA,QACA;AAAA,UAAC,MAAM;AAAA,UAAN;AAAA,YACG,WACI,CAAC,QAAQ,WAAW,QAAQ,EAAE,SAAU,SAAoB,YAAA,CAAa,IAAI,eAAe;AAAA,YAG/F,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACL;AAAA,IAAA;AAAA,EAAA;AAGZ,CAAC;"}
|
package/dist/useModal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModal.js","sources":["../src/useModal.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState, JSX, FC, memo } from 'react';\nimport { Button, Modal, ModalProps, Offcanvas, OffcanvasProps, Stack } from 'react-bootstrap';\n\nexport type UseModalArgs = { onClose?: any; showOnMount?: boolean };\n\nexport type UseModalProps = {\n children?: any;\n show?: boolean;\n onSubmit?: (e: any) => void;\n submitButton?: string | any;\n cancelButton?: string | any;\n offcanvas?: boolean;\n title?: string | any;\n containerProps?: ModalProps | OffcanvasProps;\n};\n\nexport function useModal({ onClose, showOnMount }: UseModalArgs = {}): {\n show: boolean | undefined;\n close: () => void;\n open: () => void;\n ModalDialog: FC<ModalProps>;\n} {\n const [show, setShow] = useState(showOnMount);\n\n const close = useCallback((): void => {\n setShow(false);\n onClose?.();\n }, [onClose]);\n\n const open = useCallback((): void => setShow(true), []);\n\n const defaultOnSubmit = useCallback(\n (e: any) => {\n e.preventDefault();\n close();\n },\n [close],\n );\n\n const ModalDialog = useMemo(\n () =>\n memo(function ModalDialog({\n children,\n show,\n onSubmit = defaultOnSubmit,\n submitButton = 'Done',\n cancelButton = 'Cancel',\n offcanvas = false,\n title = null as any,\n containerProps = {},\n }
|
|
1
|
+
{"version":3,"file":"useModal.js","sources":["../src/useModal.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState, JSX, FC, memo } from 'react';\nimport { Button, Modal, ModalProps, Offcanvas, OffcanvasProps, Stack } from 'react-bootstrap';\n\nexport type UseModalArgs = { onClose?: any; showOnMount?: boolean };\n\nexport type UseModalProps = {\n children?: any;\n show?: boolean;\n onSubmit?: (e: any) => void;\n submitButton?: string | any;\n cancelButton?: string | any;\n offcanvas?: boolean;\n title?: string | any;\n containerProps?: ModalProps | OffcanvasProps;\n};\n\nexport function useModal({ onClose, showOnMount }: UseModalArgs = {}): {\n show: boolean | undefined;\n close: () => void;\n open: () => void;\n ModalDialog: FC<ModalProps>;\n} {\n const [show, setShow] = useState(showOnMount);\n\n const close = useCallback((): void => {\n setShow(false);\n onClose?.();\n }, [onClose]);\n\n const open = useCallback((): void => setShow(true), []);\n\n const defaultOnSubmit = useCallback(\n (e: any) => {\n e.preventDefault();\n close();\n },\n [close],\n );\n\n const ModalDialog: FC<UseModalProps> = useMemo(\n () =>\n memo(function ModalDialog({\n children,\n show,\n onSubmit = defaultOnSubmit,\n submitButton = 'Done',\n cancelButton = 'Cancel',\n offcanvas = false,\n title = null as any,\n containerProps = {},\n }) {\n const Container = offcanvas ? Offcanvas : Modal;\n const containerDefaultProps = offcanvas ? { style: { maxWidth: '85%' } } : {};\n const Body = offcanvas ? Offcanvas.Body : Modal.Body;\n const Header = offcanvas ? Offcanvas.Header : Modal.Header;\n const Title = offcanvas ? Offcanvas.Title : Modal.Title;\n\n return (\n <Container {...{ ...containerDefaultProps, ...containerProps }} show={show} onHide={close}>\n <form onSubmit={onSubmit}>\n {title && (\n <Header closeButton>\n <Title>{title}</Title>\n </Header>\n )}\n\n <Body as={Stack} gap={3}>\n {show && children}\n </Body>\n\n {!offcanvas && (submitButton || cancelButton) && (\n <Modal.Footer>\n {cancelButton && (\n <Button variant=\"outline-secondary\" onClick={close}>\n {cancelButton}\n </Button>\n )}\n {submitButton && (\n <Button variant=\"secondary\" type=\"submit\">\n {submitButton}\n </Button>\n )}\n </Modal.Footer>\n )}\n </form>\n </Container>\n );\n }),\n [close, defaultOnSubmit],\n );\n\n return { show, close, open, ModalDialog };\n}\n"],"names":["ModalDialog","show"],"mappings":";;;AAgBO,SAAS,SAAS,EAAE,SAAS,YAAA,IAA8B,CAAA,GAKhE;AACE,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,WAAW;AAE5C,QAAM,QAAQ,YAAY,MAAY;AAClC,YAAQ,KAAK;AACb,cAAA;AAAA,EACJ,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,OAAO,YAAY,MAAY,QAAQ,IAAI,GAAG,CAAA,CAAE;AAEtD,QAAM,kBAAkB;AAAA,IACpB,CAAC,MAAW;AACR,QAAE,eAAA;AACF,YAAA;AAAA,IACJ;AAAA,IACA,CAAC,KAAK;AAAA,EAAA;AAGV,QAAM,cAAiC;AAAA,IACnC,MACI,KAAK,SAASA,aAAY;AAAA,MACtB;AAAA,MACA,MAAAC;AAAAA,MACA,WAAW;AAAA,MACX,eAAe;AAAA,MACf,eAAe;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,iBAAiB,CAAA;AAAA,IAAC,GACnB;AACC,YAAM,YAAY,YAAY,YAAY;AAC1C,YAAM,wBAAwB,YAAY,EAAE,OAAO,EAAE,UAAU,MAAA,EAAM,IAAM,CAAA;AAC3E,YAAM,OAAO,YAAY,UAAU,OAAO,MAAM;AAChD,YAAM,SAAS,YAAY,UAAU,SAAS,MAAM;AACpD,YAAM,QAAQ,YAAY,UAAU,QAAQ,MAAM;AAElD,aACI,oBAAC,WAAA,EAAW,GAAG,EAAE,GAAG,uBAAuB,GAAG,kBAAkB,MAAMA,OAAM,QAAQ,OAChF,UAAA,qBAAC,UAAK,UACD,UAAA;AAAA,QAAA,6BACI,QAAA,EAAO,aAAW,MACf,UAAA,oBAAC,OAAA,EAAO,iBAAM,EAAA,CAClB;AAAA,QAGJ,oBAAC,QAAK,IAAI,OAAO,KAAK,GACjB,UAAAA,SAAQ,UACb;AAAA,QAEC,CAAC,cAAc,gBAAgB,iBAC5B,qBAAC,MAAM,QAAN,EACI,UAAA;AAAA,UAAA,oCACI,QAAA,EAAO,SAAQ,qBAAoB,SAAS,OACxC,UAAA,cACL;AAAA,UAEH,gBACG,oBAAC,QAAA,EAAO,SAAQ,aAAY,MAAK,UAC5B,UAAA,aAAA,CACL;AAAA,QAAA,EAAA,CAER;AAAA,MAAA,EAAA,CAER,EAAA,CACJ;AAAA,IAER,CAAC;AAAA,IACL,CAAC,OAAO,eAAe;AAAA,EAAA;AAG3B,SAAO,EAAE,MAAM,OAAO,MAAM,YAAA;AAChC;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirill.konshin/bootstrap",
|
|
3
3
|
"description": "Utilities",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"----- BUILD -----": "",
|
|
8
8
|
"clean": "rm -rf dist .tscache tsconfig.tsbuildinfo",
|
|
9
9
|
"build": "vite build",
|
|
10
|
-
"build:index": "
|
|
10
|
+
"build:index": "ctix build",
|
|
11
11
|
"build:check-types": "attw --pack .",
|
|
12
12
|
"start": "yarn build --watch",
|
|
13
13
|
"wait": "wait-on ./dist/index.js",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { AdaptiveContainer } from './adaptiveContainer';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof AdaptiveContainer> = {
|
|
7
|
+
title: 'Bootstrap / AdaptiveContainer',
|
|
8
|
+
component: AdaptiveContainer,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
children: { control: 'text' },
|
|
15
|
+
className: { control: 'text' },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
children:
|
|
26
|
+
'This container adapts to the viewport size. On mobile it becomes fluid, on desktop it has max-width.',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const WithClassName: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
children: 'Container with custom class',
|
|
33
|
+
className: 'bg-light p-3',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const WithContent: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<AdaptiveContainer className="py-4">
|
|
40
|
+
<h1>Adaptive Container Demo</h1>
|
|
41
|
+
<p>
|
|
42
|
+
Resize the viewport to see how this container behaves. On mobile viewports (xs, sm, md), it becomes
|
|
43
|
+
fluid and takes full width. On desktop viewports (lg, xl, xxl), it has a max-width constraint.
|
|
44
|
+
</p>
|
|
45
|
+
<div className="row">
|
|
46
|
+
<div className="col-md-6">
|
|
47
|
+
<div className="card">
|
|
48
|
+
<div className="card-body">Column 1</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="col-md-6">
|
|
52
|
+
<div className="card">
|
|
53
|
+
<div className="card-body">Column 2</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</AdaptiveContainer>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, memo } from 'react';
|
|
2
2
|
import { Container, ContainerProps } from 'react-bootstrap';
|
|
3
3
|
import { useBreakpoint } from './responsiveHelper';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export type AdaptiveContainerProps = ContainerProps;
|
|
6
|
+
|
|
7
|
+
export const AdaptiveContainer: FC<AdaptiveContainerProps> = memo(function AdaptiveContainer({ children, ...props }) {
|
|
6
8
|
const { isMobile } = useBreakpoint();
|
|
7
9
|
return (
|
|
8
10
|
<Container fluid={isMobile} {...props}>
|
|
9
11
|
{children}
|
|
10
12
|
</Container>
|
|
11
13
|
);
|
|
12
|
-
};
|
|
14
|
+
});
|
package/src/error.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { FC } from 'react';
|
|
3
|
+
import React, { FC, memo } from 'react';
|
|
4
4
|
import { Alert, AlertProps, Button, ButtonProps } from 'react-bootstrap';
|
|
5
5
|
|
|
6
6
|
export type ErrorAlertProps = {
|
|
@@ -10,7 +10,7 @@ export type ErrorAlertProps = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
//TODO Create MUI-specific?
|
|
13
|
-
export const ErrorAlert: FC<ErrorAlertProps> = function ErrorAlert({ onRetry, children, buttonProps, ...props }) {
|
|
13
|
+
export const ErrorAlert: FC<ErrorAlertProps> = memo(function ErrorAlert({ onRetry, children, buttonProps, ...props }) {
|
|
14
14
|
if (!children) return null;
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -34,4 +34,4 @@ export const ErrorAlert: FC<ErrorAlertProps> = function ErrorAlert({ onRetry, ch
|
|
|
34
34
|
)}
|
|
35
35
|
</Alert>
|
|
36
36
|
);
|
|
37
|
-
};
|
|
37
|
+
});
|
package/src/field.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, memo } from 'react';
|
|
2
2
|
import { Form, FormGroupProps, FormLabelProps, FormTextProps } from 'react-bootstrap';
|
|
3
3
|
|
|
4
4
|
export type FieldGroupProps = FormGroupProps & {
|
|
@@ -9,7 +9,7 @@ export type FieldGroupProps = FormGroupProps & {
|
|
|
9
9
|
horizontal?: boolean;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const FieldGroup: FC<FieldGroupProps> = function FieldGroup({
|
|
12
|
+
export const FieldGroup: FC<FieldGroupProps> = memo(function FieldGroup({
|
|
13
13
|
label,
|
|
14
14
|
labelProps = {},
|
|
15
15
|
text,
|
|
@@ -34,4 +34,4 @@ export const FieldGroup: FC<FieldGroupProps> = function FieldGroup({
|
|
|
34
34
|
{text && !horizontal && <Form.Text {...textProps}>{text}</Form.Text>}{' '}
|
|
35
35
|
</Form.Group>
|
|
36
36
|
);
|
|
37
|
-
};
|
|
37
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Footer, FooterNavItem } from './footer';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Footer> = {
|
|
7
|
+
title: 'Bootstrap / Footer',
|
|
8
|
+
component: Footer,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
children: (
|
|
23
|
+
<>
|
|
24
|
+
<FooterNavItem href="#" icon="bi-house">
|
|
25
|
+
Home
|
|
26
|
+
</FooterNavItem>
|
|
27
|
+
<FooterNavItem href="#" icon="bi-search">
|
|
28
|
+
Search
|
|
29
|
+
</FooterNavItem>
|
|
30
|
+
<FooterNavItem href="#" icon="bi-person">
|
|
31
|
+
Profile
|
|
32
|
+
</FooterNavItem>
|
|
33
|
+
</>
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const WithActiveItem: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
children: (
|
|
41
|
+
<>
|
|
42
|
+
<FooterNavItem href="#" icon="bi-house" active>
|
|
43
|
+
Home
|
|
44
|
+
</FooterNavItem>
|
|
45
|
+
<FooterNavItem href="#" icon="bi-search">
|
|
46
|
+
Search
|
|
47
|
+
</FooterNavItem>
|
|
48
|
+
<FooterNavItem href="#" icon="bi-gear">
|
|
49
|
+
Settings
|
|
50
|
+
</FooterNavItem>
|
|
51
|
+
<FooterNavItem href="#" icon="bi-person">
|
|
52
|
+
Profile
|
|
53
|
+
</FooterNavItem>
|
|
54
|
+
</>
|
|
55
|
+
),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const ManyItems: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
children: (
|
|
62
|
+
<>
|
|
63
|
+
<FooterNavItem href="#" icon="bi-house">
|
|
64
|
+
Home
|
|
65
|
+
</FooterNavItem>
|
|
66
|
+
<FooterNavItem href="#" icon="bi-search">
|
|
67
|
+
Search
|
|
68
|
+
</FooterNavItem>
|
|
69
|
+
<FooterNavItem href="#" icon="bi-bell">
|
|
70
|
+
Notifications
|
|
71
|
+
</FooterNavItem>
|
|
72
|
+
<FooterNavItem href="#" icon="bi-chat">
|
|
73
|
+
Messages
|
|
74
|
+
</FooterNavItem>
|
|
75
|
+
<FooterNavItem href="#" icon="bi-person">
|
|
76
|
+
Profile
|
|
77
|
+
</FooterNavItem>
|
|
78
|
+
</>
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// FooterNavItem stories - rendered within Footer for proper context
|
|
84
|
+
export const NavItemDefault: StoryObj<typeof FooterNavItem> = {
|
|
85
|
+
args: {
|
|
86
|
+
href: '#',
|
|
87
|
+
icon: 'bi-house',
|
|
88
|
+
children: 'Home',
|
|
89
|
+
},
|
|
90
|
+
render: (args) => (
|
|
91
|
+
<Footer>
|
|
92
|
+
<FooterNavItem {...args} />
|
|
93
|
+
</Footer>
|
|
94
|
+
),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const NavItemActive: StoryObj<typeof FooterNavItem> = {
|
|
98
|
+
args: {
|
|
99
|
+
href: '#',
|
|
100
|
+
icon: 'bi-house',
|
|
101
|
+
children: 'Home',
|
|
102
|
+
active: true,
|
|
103
|
+
},
|
|
104
|
+
render: (args) => (
|
|
105
|
+
<Footer>
|
|
106
|
+
<FooterNavItem {...args} />
|
|
107
|
+
</Footer>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const NavItemIconOnly: StoryObj<typeof FooterNavItem> = {
|
|
112
|
+
args: {
|
|
113
|
+
href: '#',
|
|
114
|
+
icon: 'bi-bell',
|
|
115
|
+
},
|
|
116
|
+
render: (args) => (
|
|
117
|
+
<Footer>
|
|
118
|
+
<FooterNavItem {...args} />
|
|
119
|
+
</Footer>
|
|
120
|
+
),
|
|
121
|
+
};
|
package/src/footer.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, memo } from 'react';
|
|
2
2
|
import { Nav, Navbar } from 'react-bootstrap';
|
|
3
3
|
import { useBreakpoint } from './responsiveHelper';
|
|
4
4
|
import { AdaptiveContainer } from './adaptiveContainer';
|
|
@@ -10,7 +10,7 @@ export type FooterNavItemProps = {
|
|
|
10
10
|
children?: string | undefined;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const FooterNavItem: FC<FooterNavItemProps> = function FooterNavItem({
|
|
13
|
+
export const FooterNavItem: FC<FooterNavItemProps> = memo(function FooterNavItem({
|
|
14
14
|
href,
|
|
15
15
|
icon,
|
|
16
16
|
active = false,
|
|
@@ -42,9 +42,13 @@ export const FooterNavItem: FC<FooterNavItemProps> = function FooterNavItem({
|
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
return <Nav.Item style={{ flex: 1 }}>{link}</Nav.Item>;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export type FooterProps = {
|
|
48
|
+
children: any;
|
|
45
49
|
};
|
|
46
50
|
|
|
47
|
-
export const Footer: FC<
|
|
51
|
+
export const Footer: FC<FooterProps> = memo(function Footer({ children }) {
|
|
48
52
|
const { isDesktop } = useBreakpoint();
|
|
49
53
|
|
|
50
54
|
return (
|
|
@@ -58,4 +62,4 @@ export const Footer: FC<any> = function Footer({ children }) {
|
|
|
58
62
|
</Navbar>
|
|
59
63
|
</div>
|
|
60
64
|
);
|
|
61
|
-
};
|
|
65
|
+
});
|
package/src/globalLoading.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, memo } from 'react';
|
|
2
2
|
// import { useLoading, useLoadingTimeout } from '../redux/loadingSlice';
|
|
3
3
|
import { Loading } from './loading';
|
|
4
4
|
|
|
5
5
|
export type GlobalLoadingProps = { loading: boolean };
|
|
6
6
|
|
|
7
|
-
export const GlobalLoading: FC<GlobalLoadingProps> = function GlobalLoading({ loading }) {
|
|
7
|
+
export const GlobalLoading: FC<GlobalLoadingProps> = memo(function GlobalLoading({ loading }) {
|
|
8
8
|
// const { loading } = useLoading();
|
|
9
9
|
|
|
10
10
|
// useLoadingTimeout(15000); // escape latch if something is stuck
|
|
@@ -16,4 +16,4 @@ export const GlobalLoading: FC<GlobalLoadingProps> = function GlobalLoading({ lo
|
|
|
16
16
|
<Loading />
|
|
17
17
|
</div>
|
|
18
18
|
);
|
|
19
|
-
};
|
|
19
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { ResponsiveHelperBS, useBreakpoint } from './responsiveHelper';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof ResponsiveHelperBS> = {
|
|
7
|
+
title: 'Bootstrap / ResponsiveHelperBS',
|
|
8
|
+
component: ResponsiveHelperBS,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'fullscreen',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
story: 'A small indicator in the bottom-right corner showing the current Bootstrap breakpoint. Resize the viewport to see it change.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
render: () => (
|
|
29
|
+
<div style={{ minHeight: '200px', position: 'relative' }}>
|
|
30
|
+
<div className="p-4">
|
|
31
|
+
<h4>Responsive Helper</h4>
|
|
32
|
+
<p>Look at the bottom-right corner to see the current breakpoint indicator.</p>
|
|
33
|
+
<p>Resize the viewport to see it change between XS, SM, MD, LG, XL, and XXL.</p>
|
|
34
|
+
</div>
|
|
35
|
+
<ResponsiveHelperBS />
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Demo component for useBreakpoint hook
|
|
41
|
+
function UseBreakpointDemo() {
|
|
42
|
+
const { breakpoint, isMobile, isDesktop } = useBreakpoint();
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="p-4">
|
|
46
|
+
<h4>useBreakpoint Hook Demo</h4>
|
|
47
|
+
<table className="table">
|
|
48
|
+
<tbody>
|
|
49
|
+
<tr>
|
|
50
|
+
<th>Current Breakpoint</th>
|
|
51
|
+
<td>
|
|
52
|
+
<code>{breakpoint}</code>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<th>isMobile</th>
|
|
57
|
+
<td>
|
|
58
|
+
<code>{isMobile ? 'true' : 'false'}</code>
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<th>isDesktop</th>
|
|
63
|
+
<td>
|
|
64
|
+
<code>{isDesktop ? 'true' : 'false'}</code>
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</tbody>
|
|
68
|
+
</table>
|
|
69
|
+
<div className="alert alert-info">
|
|
70
|
+
<strong>Breakpoint ranges:</strong>
|
|
71
|
+
<ul className="mb-0 mt-2">
|
|
72
|
+
<li>
|
|
73
|
+
<strong>Mobile:</strong> xs (<576px), sm (≥576px), md (≥768px)
|
|
74
|
+
</li>
|
|
75
|
+
<li>
|
|
76
|
+
<strong>Desktop:</strong> lg (≥992px), xl (≥1200px), xxl (≥1400px)
|
|
77
|
+
</li>
|
|
78
|
+
</ul>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const UseBreakpointHook: Story = {
|
|
85
|
+
parameters: {
|
|
86
|
+
docs: {
|
|
87
|
+
description: {
|
|
88
|
+
story: 'Demonstrates the `useBreakpoint` hook which provides the current breakpoint and mobile/desktop flags.',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
render: () => <UseBreakpointDemo />,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const CombinedDemo: Story = {
|
|
96
|
+
parameters: {
|
|
97
|
+
docs: {
|
|
98
|
+
description: {
|
|
99
|
+
story: 'Shows both the visual indicator and the hook values together.',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
render: () => (
|
|
104
|
+
<div style={{ minHeight: '300px', position: 'relative' }}>
|
|
105
|
+
<UseBreakpointDemo />
|
|
106
|
+
<ResponsiveHelperBS />
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
};
|
package/src/responsiveHelper.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { FC, useEffect, useState } from 'react';
|
|
3
|
+
import React, { FC, memo, useEffect, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
export function useBreakpoint(): {
|
|
6
6
|
breakpoint: string;
|
|
@@ -41,7 +41,7 @@ export function useBreakpoint(): {
|
|
|
41
41
|
return { breakpoint, isMobile, isDesktop: !isMobile };
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export const ResponsiveHelperBS: FC = function ResponsiveHelperBS() {
|
|
44
|
+
export const ResponsiveHelperBS: FC = memo(function ResponsiveHelperBS() {
|
|
45
45
|
return (
|
|
46
46
|
<span className="small position-fixed bottom-0 z-3" style={{ fontSize: '9px', right: 1, lineHeight: 1 }}>
|
|
47
47
|
<small className="d-block d-sm-none">XS</small>
|
|
@@ -52,4 +52,4 @@ export const ResponsiveHelperBS: FC = function ResponsiveHelperBS() {
|
|
|
52
52
|
<small className="d-none d-xxl-block">XXL</small>
|
|
53
53
|
</span>
|
|
54
54
|
);
|
|
55
|
-
};
|
|
55
|
+
});
|
package/src/toaster.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { useState, FC } from 'react';
|
|
3
|
+
import React, { useState, FC, memo } from 'react';
|
|
4
4
|
import { Toast, ToastProps } from 'react-bootstrap';
|
|
5
5
|
// import { useToaster } from '../redux/toasterSlice';
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ export type ToasterProps = {
|
|
|
8
8
|
toast: string | { message: string; title?: string; variant?: 'dark' | 'success' | 'danger' };
|
|
9
9
|
} & ToastProps;
|
|
10
10
|
|
|
11
|
-
export const Toaster: FC<ToasterProps> = function Toaster({ toast }) {
|
|
11
|
+
export const Toaster: FC<ToasterProps> = memo(function Toaster({ toast }) {
|
|
12
12
|
//const { toast, setToast } = useToaster();
|
|
13
13
|
const [dismissed, setDismissed] = useState(false);
|
|
14
14
|
|
|
@@ -37,4 +37,4 @@ export const Toaster: FC<ToasterProps> = function Toaster({ toast }) {
|
|
|
37
37
|
</Toast.Body>
|
|
38
38
|
</Toast>
|
|
39
39
|
);
|
|
40
|
-
};
|
|
40
|
+
});
|
package/src/useModal.tsx
CHANGED
|
@@ -37,7 +37,7 @@ export function useModal({ onClose, showOnMount }: UseModalArgs = {}): {
|
|
|
37
37
|
[close],
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
const ModalDialog = useMemo(
|
|
40
|
+
const ModalDialog: FC<UseModalProps> = useMemo(
|
|
41
41
|
() =>
|
|
42
42
|
memo(function ModalDialog({
|
|
43
43
|
children,
|
|
@@ -48,7 +48,7 @@ export function useModal({ onClose, showOnMount }: UseModalArgs = {}): {
|
|
|
48
48
|
offcanvas = false,
|
|
49
49
|
title = null as any,
|
|
50
50
|
containerProps = {},
|
|
51
|
-
}
|
|
51
|
+
}) {
|
|
52
52
|
const Container = offcanvas ? Offcanvas : Modal;
|
|
53
53
|
const containerDefaultProps = offcanvas ? { style: { maxWidth: '85%' } } : {};
|
|
54
54
|
const Body = offcanvas ? Offcanvas.Body : Modal.Body;
|