@kirill.konshin/bootstrap 0.0.1 → 0.0.3

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 (94) hide show
  1. package/dist/adaptiveContainer.d.ts +2 -1
  2. package/dist/adaptiveContainer.d.ts.map +1 -1
  3. package/dist/adaptiveContainer.js +16 -10
  4. package/dist/adaptiveContainer.js.map +1 -1
  5. package/dist/adaptiveContainer.stories.d.ts +9 -0
  6. package/dist/adaptiveContainer.stories.d.ts.map +1 -0
  7. package/dist/controls.d.ts +4 -4
  8. package/dist/controls.d.ts.map +1 -1
  9. package/dist/controls.js +79 -72
  10. package/dist/controls.js.map +1 -1
  11. package/dist/controls.stories.d.ts +2 -2
  12. package/dist/controls.stories.d.ts.map +1 -1
  13. package/dist/error.d.ts.map +1 -1
  14. package/dist/error.js +25 -25
  15. package/dist/error.js.map +1 -1
  16. package/dist/error.stories.d.ts +2 -2
  17. package/dist/error.stories.d.ts.map +1 -1
  18. package/dist/field.d.ts.map +1 -1
  19. package/dist/field.js +29 -28
  20. package/dist/field.js.map +1 -1
  21. package/dist/field.stories.d.ts +2 -2
  22. package/dist/field.stories.d.ts.map +1 -1
  23. package/dist/footer.d.ts +4 -1
  24. package/dist/footer.d.ts.map +1 -1
  25. package/dist/footer.js +43 -43
  26. package/dist/footer.js.map +1 -1
  27. package/dist/footer.stories.d.ts +12 -0
  28. package/dist/footer.stories.d.ts.map +1 -0
  29. package/dist/globalLoading.d.ts.map +1 -1
  30. package/dist/globalLoading.js +14 -9
  31. package/dist/globalLoading.js.map +1 -1
  32. package/dist/globalLoading.stories.d.ts +2 -2
  33. package/dist/globalLoading.stories.d.ts.map +1 -1
  34. package/dist/index.d.ts +12 -12
  35. package/dist/index.js +3 -25
  36. package/dist/loading.d.ts.map +1 -1
  37. package/dist/loading.js +19 -17
  38. package/dist/loading.js.map +1 -1
  39. package/dist/loading.stories.d.ts +2 -2
  40. package/dist/loading.stories.d.ts.map +1 -1
  41. package/dist/responsiveHelper.d.ts.map +1 -1
  42. package/dist/responsiveHelper.js +70 -43
  43. package/dist/responsiveHelper.js.map +1 -1
  44. package/dist/responsiveHelper.stories.d.ts +9 -0
  45. package/dist/responsiveHelper.stories.d.ts.map +1 -0
  46. package/dist/screen.d.ts.map +1 -1
  47. package/dist/screen.js +84 -77
  48. package/dist/screen.js.map +1 -1
  49. package/dist/screen.stories.d.ts +2 -2
  50. package/dist/screen.stories.d.ts.map +1 -1
  51. package/dist/toaster.d.ts.map +1 -1
  52. package/dist/toaster.js +31 -32
  53. package/dist/toaster.js.map +1 -1
  54. package/dist/toaster.stories.d.ts +2 -2
  55. package/dist/toaster.stories.d.ts.map +1 -1
  56. package/dist/useModal.d.ts.map +1 -1
  57. package/dist/useModal.js +58 -47
  58. package/dist/useModal.js.map +1 -1
  59. package/dist/useModal.stories.d.ts +2 -2
  60. package/dist/useModal.stories.d.ts.map +1 -1
  61. package/dist/useWrappedForm.d.ts.map +1 -1
  62. package/dist/useWrappedForm.js +40 -29
  63. package/dist/useWrappedForm.js.map +1 -1
  64. package/package.json +17 -5
  65. package/.ctirc +0 -11
  66. package/.storybook/main.ts +0 -2
  67. package/.storybook/preview.ts +0 -2
  68. package/.turbo/turbo-build.log +0 -24
  69. package/dist/index.js.map +0 -1
  70. package/src/adaptiveContainer.tsx +0 -12
  71. package/src/controls.stories.tsx +0 -62
  72. package/src/controls.tsx +0 -119
  73. package/src/error.stories.tsx +0 -34
  74. package/src/error.tsx +0 -37
  75. package/src/field.stories.tsx +0 -42
  76. package/src/field.tsx +0 -37
  77. package/src/footer.tsx +0 -61
  78. package/src/globalLoading.stories.tsx +0 -25
  79. package/src/globalLoading.tsx +0 -19
  80. package/src/index.ts +0 -12
  81. package/src/loading.stories.tsx +0 -35
  82. package/src/loading.tsx +0 -24
  83. package/src/main.scss +0 -86
  84. package/src/responsiveHelper.tsx +0 -55
  85. package/src/screen.stories.tsx +0 -160
  86. package/src/screen.tsx +0 -146
  87. package/src/toaster.stories.tsx +0 -32
  88. package/src/toaster.tsx +0 -40
  89. package/src/useModal.stories.tsx +0 -51
  90. package/src/useModal.tsx +0 -93
  91. package/src/useWrappedForm.ts +0 -42
  92. package/tsconfig.json +0 -10
  93. package/turbo.json +0 -10
  94. package/vite.config.ts +0 -2
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
2
  import { ContainerProps } from 'react-bootstrap';
3
- export declare const AdaptiveContainer: FC<ContainerProps>;
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,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5D,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,cAAc,CAOhD,CAAC"}
1
+ {"version":3,"file":"adaptiveContainer.d.ts","sourceRoot":"","sources":["../src/adaptiveContainer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjE,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAEpD,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAOvD,CAAC"}
@@ -1,11 +1,17 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Container } from "react-bootstrap";
3
1
  import { useBreakpoint } from "./responsiveHelper.js";
4
- const AdaptiveContainer = function AdaptiveContainer2({ children, ...props }) {
5
- const { isMobile } = useBreakpoint();
6
- return /* @__PURE__ */ jsx(Container, { fluid: isMobile, ...props, children });
7
- };
8
- export {
9
- AdaptiveContainer
10
- };
11
- //# sourceMappingURL=adaptiveContainer.js.map
2
+ import { memo } from "react";
3
+ import { Container } from "react-bootstrap";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/adaptiveContainer.tsx
6
+ var AdaptiveContainer = memo(function AdaptiveContainer({ children, ...props }) {
7
+ const { isMobile } = useBreakpoint();
8
+ return /* @__PURE__ */ jsx(Container, {
9
+ fluid: isMobile,
10
+ ...props,
11
+ children
12
+ });
13
+ });
14
+ //#endregion
15
+ export { AdaptiveContainer };
16
+
17
+ //# sourceMappingURL=adaptiveContainer.js.map
@@ -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<ContainerProps> = 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":";;;AAIO,MAAM,oBAAwC,SAASA,mBAAkB,EAAE,UAAU,GAAG,SAAS;AACpG,QAAM,EAAE,SAAA,IAAa,cAAA;AACrB,6BACK,WAAA,EAAU,OAAO,UAAW,GAAG,OAC3B,UACL;AAER;"}
1
+ {"version":3,"file":"adaptiveContainer.js","names":[],"sources":["../src/adaptiveContainer.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport { Container, type 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"],"mappings":";;;;;AAMA,IAAa,oBAAgD,KAAK,SAAS,kBAAkB,EAAE,UAAU,GAAG,SAAS;CACjH,MAAM,EAAE,aAAa,cAAc;CACnC,OACI,oBAAC,WAAD;EAAW,OAAO;EAAU,GAAI;EAC3B;CACM,CAAA;AAEnB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { AdaptiveContainer } from './adaptiveContainer.js';
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,uBAAuB,CAAC;AAE5D,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"}
@@ -1,5 +1,5 @@
1
1
  import { default as React, HTMLInputTypeAttribute, FC } from 'react';
2
- export interface ControlProps {
2
+ export type ControlProps = {
3
3
  value?: any;
4
4
  setValue?: (v: any) => void;
5
5
  defaultValue?: any;
@@ -21,17 +21,17 @@ export interface ControlProps {
21
21
  className?: string;
22
22
  } & any;
23
23
  hideValue?: boolean;
24
- }
24
+ };
25
25
  export type LabelProps = Pick<ControlProps, 'name' | 'value' | 'defaultValue'> & {
26
26
  reset: () => void;
27
27
  };
28
28
  export declare const Label: FC<LabelProps>;
29
29
  export declare const Control: FC<ControlProps>;
30
- export interface RangeProps extends ControlProps {
30
+ export type RangeProps = {
31
31
  min: number;
32
32
  max: number;
33
33
  step?: number;
34
- }
34
+ } & ControlProps;
35
35
  export declare const Range: FC<RangeProps>;
36
36
  export declare const Checkbox: FC<ControlProps>;
37
37
  export declare const Select: FC<ControlProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,sBAAsB,EAAQ,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhE,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE;QACT,IAAI,EAAE,sBAAsB,CAAC;QAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;QACjC,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,GAAG,CAAC;IACR,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvG,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAa/B,CAAC;AAEH,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAsCnC,CAAC;AAEH,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAc/B,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,YAAY,CAOpC,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,YAAY,CAMlC,CAAC"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,sBAAsB,EAAQ,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAO1E,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;IACjD,cAAc,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE;QACT,IAAI,EAAE,sBAAsB,CAAC;QAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;QACjC,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,GAAG,GAAG,CAAC;IACR,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAEvG,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAa/B,CAAC;AAEH,eAAO,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CAsCnC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,YAAY,CAAC;AAEjB,eAAO,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAc/B,CAAC;AAEH,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,YAAY,CAOpC,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,YAAY,CAMlC,CAAC"}
package/dist/controls.js CHANGED
@@ -1,78 +1,85 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
1
  import { memo } from "react";
3
- const lcFirst = (str) => str[0].toLowerCase() + str.substring(1, str.length);
4
- const toProperty = (str) => lcFirst(str).split(" ").join("");
5
- const Label = memo(function Label2({ name, reset, value, defaultValue }) {
6
- return /* @__PURE__ */ jsxs("label", { className: "flex-grow-1 mb-0 d-flex align-items-center justify-content-start gap-2", children: [
7
- name,
8
- value !== defaultValue && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("a", { href: "javascript: void(0)", onClick: reset, children: /* @__PURE__ */ jsx("small", { children: "reset" }) }) })
9
- ] });
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import clsx from "clsx";
4
+ //#region src/controls.tsx
5
+ var lcFirst = (str) => str[0].toLowerCase() + str.substring(1, str.length);
6
+ var toProperty = (str) => lcFirst(str).split(" ").join("");
7
+ var Label = memo(function Label({ name, reset, value, defaultValue }) {
8
+ return /* @__PURE__ */ jsxs("label", {
9
+ className: "flex-grow-1 mb-0 d-flex align-items-center justify-content-start gap-2",
10
+ children: [name, value !== defaultValue && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("a", {
11
+ href: "javascript: void(0)",
12
+ onClick: reset,
13
+ children: /* @__PURE__ */ jsx("small", { children: "reset" })
14
+ }) })]
15
+ });
10
16
  });
11
- const Control = memo(function Control2({
12
- value = null,
13
- setValue,
14
- defaultValue = null,
15
- options = {},
16
- setOptions,
17
- defaultOptions = {},
18
- name,
19
- inputProps: { Tag = "input", property = "value", valueExtractor = (e) => e.target.value, ...inputProps } = {},
20
- hideValue = false,
21
- children
22
- }) {
23
- const prop = toProperty(name);
24
- defaultValue = defaultValue || defaultOptions[prop];
25
- value = value || options?.[prop];
26
- setValue = setValue || ((v) => setOptions?.({ [prop]: v }));
27
- const reset = () => setValue(defaultValue);
28
- return /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-2", children: [
29
- /* @__PURE__ */ jsx(Label, { name, reset, value, defaultValue }),
30
- /* @__PURE__ */ jsx(
31
- Tag,
32
- {
33
- ...inputProps,
34
- ...{ [property]: value || "" },
35
- className: `${value === defaultValue ? "opacity-75" : ""} ${inputProps.className}`,
36
- onChange: (e) => setValue(valueExtractor(e)),
37
- children
38
- }
39
- ),
40
- !hideValue && /* @__PURE__ */ jsx("span", { onDoubleClick: reset, className: "text-start", style: { width: "20px" }, children: value })
41
- ] });
17
+ var Control = memo(function Control({ value = null, setValue, defaultValue = null, options = {}, setOptions, defaultOptions = {}, name, inputProps: { Tag = "input", property = "value", valueExtractor = (e) => e.target.value, ...inputProps } = {}, hideValue = false, children }) {
18
+ const prop = toProperty(name);
19
+ defaultValue = defaultValue || defaultOptions[prop];
20
+ value = value || options?.[prop];
21
+ setValue = setValue || ((v) => setOptions?.({ [prop]: v }));
22
+ const reset = () => setValue(defaultValue);
23
+ return /* @__PURE__ */ jsxs("div", {
24
+ className: "d-flex align-items-center gap-2",
25
+ children: [
26
+ /* @__PURE__ */ jsx(Label, {
27
+ name,
28
+ reset,
29
+ value,
30
+ defaultValue
31
+ }),
32
+ /* @__PURE__ */ jsx(Tag, {
33
+ ...inputProps,
34
+ [property]: value || "",
35
+ className: clsx(value === defaultValue && "opacity-75", inputProps.className) || void 0,
36
+ onChange: (e) => setValue(valueExtractor(e)),
37
+ children
38
+ }),
39
+ !hideValue && /* @__PURE__ */ jsx("span", {
40
+ onDoubleClick: reset,
41
+ className: "text-start",
42
+ style: { width: "20px" },
43
+ children: value
44
+ })
45
+ ]
46
+ });
42
47
  });
43
- const Range = memo(function Range2({ min, max, step = 0.1, ...props }) {
44
- return /* @__PURE__ */ jsx(
45
- Control,
46
- {
47
- inputProps: {
48
- type: "range",
49
- min,
50
- max,
51
- step,
52
- className: "form-control-range",
53
- valueExtractor: (e) => parseFloat(e.target.value)
54
- },
55
- ...props
56
- }
57
- );
48
+ var Range = memo(function Range({ min, max, step = .1, ...props }) {
49
+ return /* @__PURE__ */ jsx(Control, {
50
+ inputProps: {
51
+ type: "range",
52
+ min,
53
+ max,
54
+ step,
55
+ className: "form-control-range",
56
+ valueExtractor: (e) => parseFloat(e.target.value)
57
+ },
58
+ ...props
59
+ });
58
60
  });
59
- const Checkbox = memo(function Checkbox2(props) {
60
- return /* @__PURE__ */ jsx(
61
- Control,
62
- {
63
- inputProps: { type: "checkbox", property: "checked", valueExtractor: (e) => e.target.checked },
64
- ...props
65
- }
66
- );
61
+ var Checkbox = memo(function Checkbox(props) {
62
+ return /* @__PURE__ */ jsx(Control, {
63
+ inputProps: {
64
+ type: "checkbox",
65
+ property: "checked",
66
+ valueExtractor: (e) => e.target.checked
67
+ },
68
+ ...props
69
+ });
67
70
  });
68
- const Select = memo(function Select2({ children, ...props }) {
69
- return /* @__PURE__ */ jsx(Control, { inputProps: { Tag: "select", className: "form-select" }, ...props, hideValue: true, children });
71
+ var Select = memo(function Select({ children, ...props }) {
72
+ return /* @__PURE__ */ jsx(Control, {
73
+ inputProps: {
74
+ Tag: "select",
75
+ className: "form-select"
76
+ },
77
+ ...props,
78
+ hideValue: true,
79
+ children
80
+ });
70
81
  });
71
- export {
72
- Checkbox,
73
- Control,
74
- Label,
75
- Range,
76
- Select
77
- };
78
- //# sourceMappingURL=controls.js.map
82
+ //#endregion
83
+ export { Checkbox, Control, Label, Range, Select };
84
+
85
+ //# sourceMappingURL=controls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controls.js","sources":["../src/controls.tsx"],"sourcesContent":["import React, { HTMLInputTypeAttribute, memo, FC } from 'react';\n\nconst lcFirst = (str: string) => str[0].toLowerCase() + str.substring(1, str.length);\n\nconst toProperty = (str: string) => lcFirst(str).split(' ').join('');\n\nexport interface ControlProps {\n value?: any;\n setValue?: (v: any) => void;\n defaultValue?: any;\n options?: { [key: string]: any };\n setOptions?: (v: { [key: string]: any }) => void;\n defaultOptions?: { [key: string]: any };\n name: string;\n children?: React.ReactNode;\n inputProps?: {\n type: HTMLInputTypeAttribute;\n property?: string;\n valueExtractor?: (e: any) => any;\n className?: string;\n } & any;\n hideValue?: boolean;\n}\n\nexport type LabelProps = Pick<ControlProps, 'name' | 'value' | 'defaultValue'> & { reset: () => void };\n\nexport const Label: FC<LabelProps> = memo(function Label({ name, reset, value, defaultValue }) {\n return (\n <label className=\"flex-grow-1 mb-0 d-flex align-items-center justify-content-start gap-2\">\n {name}\n {value !== defaultValue && (\n <>\n <a href=\"javascript: void(0)\" onClick={reset}>\n <small>reset</small>\n </a>\n </>\n )}\n </label>\n );\n});\n\nexport const Control: FC<ControlProps> = memo(function Control({\n value = null,\n setValue,\n defaultValue = null,\n options = {},\n setOptions,\n defaultOptions = {},\n name,\n inputProps: { Tag = 'input', property = 'value', valueExtractor = (e: any) => e.target.value, ...inputProps } = {},\n hideValue = false,\n children,\n}) {\n const prop = toProperty(name);\n\n defaultValue = defaultValue || defaultOptions[prop];\n value = value || options?.[prop];\n setValue = setValue || ((v) => setOptions?.({ [prop]: v }));\n\n const reset = () => setValue(defaultValue);\n\n return (\n <div className=\"d-flex align-items-center gap-2\">\n <Label name={name} reset={reset} value={value} defaultValue={defaultValue} />\n <Tag\n {...inputProps}\n {...{ [property]: value || '' }} // null is needed to make it always controlled\n className={`${value === defaultValue ? 'opacity-75' : ''} ${inputProps.className}`}\n onChange={(e: Event) => setValue(valueExtractor(e))}\n >\n {children}\n </Tag>\n {!hideValue && (\n <span onDoubleClick={reset} className=\"text-start\" style={{ width: '20px' }}>\n {value}\n </span>\n )}\n </div>\n );\n});\n\nexport interface RangeProps extends ControlProps {\n min: number;\n max: number;\n step?: number;\n}\n\nexport const Range: FC<RangeProps> = memo(function Range({ min, max, step = 0.1, ...props }) {\n return (\n <Control\n inputProps={{\n type: 'range',\n min,\n max,\n step,\n className: 'form-control-range',\n valueExtractor: (e: any) => parseFloat(e.target.value),\n }}\n {...props}\n />\n );\n});\n\nexport const Checkbox: FC<ControlProps> = memo(function Checkbox(props) {\n return (\n <Control\n inputProps={{ type: 'checkbox', property: 'checked', valueExtractor: (e: any) => e.target.checked }}\n {...props}\n />\n );\n});\n\nexport const Select: FC<ControlProps> = memo(function Select({ children, ...props }) {\n return (\n <Control inputProps={{ Tag: 'select', className: 'form-select' }} {...props} hideValue={true}>\n {children}\n </Control>\n );\n});\n"],"names":["Label","Control","Range","Checkbox","Select"],"mappings":";;AAEA,MAAM,UAAU,CAAC,QAAgB,IAAI,CAAC,EAAE,gBAAgB,IAAI,UAAU,GAAG,IAAI,MAAM;AAEnF,MAAM,aAAa,CAAC,QAAgB,QAAQ,GAAG,EAAE,MAAM,GAAG,EAAE,KAAK,EAAE;AAsB5D,MAAM,QAAwB,KAAK,SAASA,OAAM,EAAE,MAAM,OAAO,OAAO,gBAAgB;AAC3F,SACI,qBAAC,SAAA,EAAM,WAAU,0EACZ,UAAA;AAAA,IAAA;AAAA,IACA,UAAU,gBACP,oBAAA,UAAA,EACI,UAAA,oBAAC,KAAA,EAAE,MAAK,uBAAsB,SAAS,OACnC,UAAA,oBAAC,SAAA,EAAM,UAAA,SAAK,GAChB,EAAA,CACJ;AAAA,EAAA,GAER;AAER,CAAC;AAEM,MAAM,UAA4B,KAAK,SAASC,SAAQ;AAAA,EAC3D,QAAQ;AAAA,EACR;AAAA,EACA,eAAe;AAAA,EACf,UAAU,CAAA;AAAA,EACV;AAAA,EACA,iBAAiB,CAAA;AAAA,EACjB;AAAA,EACA,YAAY,EAAE,MAAM,SAAS,WAAW,SAAS,iBAAiB,CAAC,MAAW,EAAE,OAAO,OAAO,GAAG,WAAA,IAAe,CAAA;AAAA,EAChH,YAAY;AAAA,EACZ;AACJ,GAAG;AACC,QAAM,OAAO,WAAW,IAAI;AAE5B,iBAAe,gBAAgB,eAAe,IAAI;AAClD,UAAQ,SAAS,UAAU,IAAI;AAC/B,aAAW,aAAa,CAAC,MAAM,aAAa,EAAE,CAAC,IAAI,GAAG,EAAA,CAAG;AAEzD,QAAM,QAAQ,MAAM,SAAS,YAAY;AAEzC,SACI,qBAAC,OAAA,EAAI,WAAU,mCACX,UAAA;AAAA,IAAA,oBAAC,OAAA,EAAM,MAAY,OAAc,OAAc,cAA4B;AAAA,IAC3E;AAAA,MAAC;AAAA,MAAA;AAAA,QACI,GAAG;AAAA,QACH,GAAG,EAAE,CAAC,QAAQ,GAAG,SAAS,GAAA;AAAA,QAC3B,WAAW,GAAG,UAAU,eAAe,eAAe,EAAE,IAAI,WAAW,SAAS;AAAA,QAChF,UAAU,CAAC,MAAa,SAAS,eAAe,CAAC,CAAC;AAAA,QAEjD;AAAA,MAAA;AAAA,IAAA;AAAA,IAEJ,CAAC,aACE,oBAAC,QAAA,EAAK,eAAe,OAAO,WAAU,cAAa,OAAO,EAAE,OAAO,OAAA,GAC9D,UAAA,MAAA,CACL;AAAA,EAAA,GAER;AAER,CAAC;AAQM,MAAM,QAAwB,KAAK,SAASC,OAAM,EAAE,KAAK,KAAK,OAAO,KAAK,GAAG,SAAS;AACzF,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,YAAY;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX,gBAAgB,CAAC,MAAW,WAAW,EAAE,OAAO,KAAK;AAAA,MAAA;AAAA,MAExD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGhB,CAAC;AAEM,MAAM,WAA6B,KAAK,SAASC,UAAS,OAAO;AACpE,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,YAAY,EAAE,MAAM,YAAY,UAAU,WAAW,gBAAgB,CAAC,MAAW,EAAE,OAAO,QAAA;AAAA,MACzF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGhB,CAAC;AAEM,MAAM,SAA2B,KAAK,SAASC,QAAO,EAAE,UAAU,GAAG,SAAS;AACjF,SACI,oBAAC,SAAA,EAAQ,YAAY,EAAE,KAAK,UAAU,WAAW,cAAA,GAAkB,GAAG,OAAO,WAAW,MACnF,SAAA,CACL;AAER,CAAC;"}
1
+ {"version":3,"file":"controls.js","names":[],"sources":["../src/controls.tsx"],"sourcesContent":["import React, { type HTMLInputTypeAttribute, memo, type FC } from 'react';\nimport clsx from 'clsx';\n\nconst lcFirst = (str: string) => str[0].toLowerCase() + str.substring(1, str.length);\n\nconst toProperty = (str: string) => lcFirst(str).split(' ').join('');\n\nexport type ControlProps = {\n value?: any;\n setValue?: (v: any) => void;\n defaultValue?: any;\n options?: { [key: string]: any };\n setOptions?: (v: { [key: string]: any }) => void;\n defaultOptions?: { [key: string]: any };\n name: string;\n children?: React.ReactNode;\n inputProps?: {\n type: HTMLInputTypeAttribute;\n property?: string;\n valueExtractor?: (e: any) => any;\n className?: string;\n } & any;\n hideValue?: boolean;\n};\n\nexport type LabelProps = Pick<ControlProps, 'name' | 'value' | 'defaultValue'> & { reset: () => void };\n\nexport const Label: FC<LabelProps> = memo(function Label({ name, reset, value, defaultValue }) {\n return (\n <label className=\"flex-grow-1 mb-0 d-flex align-items-center justify-content-start gap-2\">\n {name}\n {value !== defaultValue && (\n <>\n <a href=\"javascript: void(0)\" onClick={reset}>\n <small>reset</small>\n </a>\n </>\n )}\n </label>\n );\n});\n\nexport const Control: FC<ControlProps> = memo(function Control({\n value = null,\n setValue,\n defaultValue = null,\n options = {},\n setOptions,\n defaultOptions = {},\n name,\n inputProps: { Tag = 'input', property = 'value', valueExtractor = (e: any) => e.target.value, ...inputProps } = {},\n hideValue = false,\n children,\n}) {\n const prop = toProperty(name);\n\n defaultValue = defaultValue || defaultOptions[prop];\n value = value || options?.[prop];\n setValue = setValue || ((v) => setOptions?.({ [prop]: v }));\n\n const reset = () => setValue(defaultValue);\n\n return (\n <div className=\"d-flex align-items-center gap-2\">\n <Label name={name} reset={reset} value={value} defaultValue={defaultValue} />\n <Tag\n {...inputProps}\n {...{ [property]: value || '' }} // null is needed to make it always controlled\n className={clsx(value === defaultValue && 'opacity-75', inputProps.className) || undefined}\n onChange={(e: Event) => setValue(valueExtractor(e))}\n >\n {children}\n </Tag>\n {!hideValue && (\n <span onDoubleClick={reset} className=\"text-start\" style={{ width: '20px' }}>\n {value}\n </span>\n )}\n </div>\n );\n});\n\nexport type RangeProps = {\n min: number;\n max: number;\n step?: number;\n} & ControlProps;\n\nexport const Range: FC<RangeProps> = memo(function Range({ min, max, step = 0.1, ...props }) {\n return (\n <Control\n inputProps={{\n type: 'range',\n min,\n max,\n step,\n className: 'form-control-range',\n valueExtractor: (e: any) => parseFloat(e.target.value),\n }}\n {...props}\n />\n );\n});\n\nexport const Checkbox: FC<ControlProps> = memo(function Checkbox(props) {\n return (\n <Control\n inputProps={{ type: 'checkbox', property: 'checked', valueExtractor: (e: any) => e.target.checked }}\n {...props}\n />\n );\n});\n\nexport const Select: FC<ControlProps> = memo(function Select({ children, ...props }) {\n return (\n <Control inputProps={{ Tag: 'select', className: 'form-select' }} {...props} hideValue={true}>\n {children}\n </Control>\n );\n});\n"],"mappings":";;;;AAGA,IAAM,WAAW,QAAgB,IAAI,EAAE,CAAC,YAAY,IAAI,IAAI,UAAU,GAAG,IAAI,MAAM;AAEnF,IAAM,cAAc,QAAgB,QAAQ,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE;AAsBnE,IAAa,QAAwB,KAAK,SAAS,MAAM,EAAE,MAAM,OAAO,OAAO,gBAAgB;CAC3F,OACI,qBAAC,SAAD;EAAO,WAAU;YAAjB,CACK,MACA,UAAU,gBACP,oBAAA,UAAA,EAAA,UACI,oBAAC,KAAD;GAAG,MAAK;GAAsB,SAAS;aACnC,oBAAC,SAAD,EAAA,UAAO,QAAY,CAAA;EACpB,CAAA,EACL,CAAA,CAEH;;AAEf,CAAC;AAED,IAAa,UAA4B,KAAK,SAAS,QAAQ,EAC3D,QAAQ,MACR,UACA,eAAe,MACf,UAAU,CAAC,GACX,YACA,iBAAiB,CAAC,GAClB,MACA,YAAY,EAAE,MAAM,SAAS,WAAW,SAAS,kBAAkB,MAAW,EAAE,OAAO,OAAO,GAAG,eAAe,CAAC,GACjH,YAAY,OACZ,YACD;CACC,MAAM,OAAO,WAAW,IAAI;CAE5B,eAAe,gBAAgB,eAAe;CAC9C,QAAQ,SAAS,UAAU;CAC3B,WAAW,cAAc,MAAM,aAAa,GAAG,OAAO,EAAE,CAAC;CAEzD,MAAM,cAAc,SAAS,YAAY;CAEzC,OACI,qBAAC,OAAD;EAAK,WAAU;YAAf;GACI,oBAAC,OAAD;IAAa;IAAa;IAAc;IAAqB;GAAe,CAAA;GAC5E,oBAAC,KAAD;IACI,GAAI;KACG,WAAW,SAAS;IAC3B,WAAW,KAAK,UAAU,gBAAgB,cAAc,WAAW,SAAS,KAAK,KAAA;IACjF,WAAW,MAAa,SAAS,eAAe,CAAC,CAAC;IAEjD;GACA,CAAA;GACJ,CAAC,aACE,oBAAC,QAAD;IAAM,eAAe;IAAO,WAAU;IAAa,OAAO,EAAE,OAAO,OAAO;cACrE;GACC,CAAA;EAET;;AAEb,CAAC;AAQD,IAAa,QAAwB,KAAK,SAAS,MAAM,EAAE,KAAK,KAAK,OAAO,IAAK,GAAG,SAAS;CACzF,OACI,oBAAC,SAAD;EACI,YAAY;GACR,MAAM;GACN;GACA;GACA;GACA,WAAW;GACX,iBAAiB,MAAW,WAAW,EAAE,OAAO,KAAK;EACzD;EACA,GAAI;CACP,CAAA;AAET,CAAC;AAED,IAAa,WAA6B,KAAK,SAAS,SAAS,OAAO;CACpE,OACI,oBAAC,SAAD;EACI,YAAY;GAAE,MAAM;GAAY,UAAU;GAAW,iBAAiB,MAAW,EAAE,OAAO;EAAQ;EAClG,GAAI;CACP,CAAA;AAET,CAAC;AAED,IAAa,SAA2B,KAAK,SAAS,OAAO,EAAE,UAAU,GAAG,SAAS;CACjF,OACI,oBAAC,SAAD;EAAS,YAAY;GAAE,KAAK;GAAU,WAAW;EAAc;EAAG,GAAI;EAAO,WAAW;EACnF;CACI,CAAA;AAEjB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { Control } from './controls';
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Control } from './controls.js';
3
3
  declare const meta: Meta<typeof Control>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
@@ -1 +1 @@
1
- {"version":3,"file":"controls.stories.d.ts","sourceRoot":"","sources":["../src/controls.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAU,OAAO,EAAmB,MAAM,YAAY,CAAC;AAK9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAyB9B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,KAI1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAI7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAS3B,CAAC"}
1
+ {"version":3,"file":"controls.stories.d.ts","sourceRoot":"","sources":["../src/controls.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAU,KAAK,OAAO,EAAmB,MAAM,YAAY,CAAC;AAKnE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAyB9B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,KAI1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAI7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAS3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAClC,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,CAwB1C,CAAC"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAElE,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,27 +1,27 @@
1
1
  "use client";
2
- import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
3
  import { Alert, Button } from "react-bootstrap";
4
- const ErrorAlert = function ErrorAlert2({ onRetry, children, buttonProps, ...props }) {
5
- if (!children) return null;
6
- return /* @__PURE__ */ jsxs(Alert, { variant: "danger", ...props, children: [
7
- /* @__PURE__ */ jsx("div", { children: children.message || children.toString() }),
8
- onRetry && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
9
- Button,
10
- {
11
- variant: "link",
12
- className: "alert-link",
13
- ...buttonProps,
14
- onClick: (e) => {
15
- e.preventDefault();
16
- e.stopPropagation();
17
- onRetry();
18
- },
19
- children: "Retry"
20
- }
21
- ) })
22
- ] });
23
- };
24
- export {
25
- ErrorAlert
26
- };
27
- //# sourceMappingURL=error.js.map
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/error.tsx
6
+ var ErrorAlert = memo(function ErrorAlert({ onRetry, children, buttonProps, ...props }) {
7
+ if (!children) return null;
8
+ return /* @__PURE__ */ jsxs(Alert, {
9
+ variant: "danger",
10
+ ...props,
11
+ children: [/* @__PURE__ */ jsx("div", { children: children.message || children.toString() }), onRetry && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
12
+ variant: "link",
13
+ className: "alert-link",
14
+ ...buttonProps,
15
+ onClick: (e) => {
16
+ e.preventDefault();
17
+ e.stopPropagation();
18
+ onRetry();
19
+ },
20
+ children: "Retry"
21
+ }) })]
22
+ });
23
+ });
24
+ //#endregion
25
+ export { ErrorAlert };
26
+
27
+ //# sourceMappingURL=error.js.map
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":";;;AAYO,MAAM,aAAkC,SAASA,YAAW,EAAE,SAAS,UAAU,aAAa,GAAG,SAAS;AAC7G,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;"}
1
+ {"version":3,"file":"error.js","names":[],"sources":["../src/error.tsx"],"sourcesContent":["'use client';\n\nimport React, { type FC, memo } from 'react';\nimport { Alert, Button, type 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"],"mappings":";;;;;AAYA,IAAa,aAAkC,KAAK,SAAS,WAAW,EAAE,SAAS,UAAU,aAAa,GAAG,SAAS;CAClH,IAAI,CAAC,UAAU,OAAO;CAEtB,OACI,qBAAC,OAAD;EAAO,SAAQ;EAAS,GAAI;YAA5B,CACI,oBAAC,OAAD,EAAA,UAAM,SAAS,WAAW,SAAS,SAAS,EAAO,CAAA,GAClD,WACG,oBAAC,OAAD,EAAA,UACI,oBAAC,QAAD;GACI,SAAQ;GACR,WAAU;GACV,GAAI;GACJ,UAAU,MAAM;IACZ,EAAE,eAAe;IACjB,EAAE,gBAAgB;IAClB,QAAQ;GACZ;aACH;EAEO,CAAA,EACP,CAAA,CAEN;;AAEf,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { ErrorAlert } from './error';
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ErrorAlert } from './error.js';
3
3
  declare const meta: Meta<typeof ErrorAlert>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
@@ -1 +1 @@
1
- {"version":3,"file":"error.stories.d.ts","sourceRoot":"","sources":["../src/error.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAYjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,MAAM,EAAE,KAIpB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC"}
1
+ {"version":3,"file":"error.stories.d.ts","sourceRoot":"","sources":["../src/error.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAYjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,MAAM,EAAE,KAIpB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAClC,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,CAyB1C,CAAC"}
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAQ,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErG,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,CA0BzC,CAAC"}
package/dist/field.js CHANGED
@@ -1,29 +1,30 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
1
+ import { memo } from "react";
2
2
  import { Form } from "react-bootstrap";
3
- const FieldGroup = function FieldGroup2({
4
- label,
5
- labelProps = {},
6
- text,
7
- textProps = {},
8
- horizontal,
9
- children,
10
- ...props
11
- }) {
12
- if (horizontal) {
13
- props.className = "hstack gap-3 " + (props.className || "");
14
- labelProps.className = "m-0 " + (labelProps.className || "");
15
- }
16
- if (text && horizontal) {
17
- throw new Error("Cannot use text and horizontal together");
18
- }
19
- return /* @__PURE__ */ jsxs(Form.Group, { ...props, children: [
20
- label && /* @__PURE__ */ jsx(Form.Label, { ...labelProps, children: label }),
21
- children,
22
- text && !horizontal && /* @__PURE__ */ jsx(Form.Text, { ...textProps, children: text }),
23
- " "
24
- ] });
25
- };
26
- export {
27
- FieldGroup
28
- };
29
- //# sourceMappingURL=field.js.map
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/field.tsx
5
+ var FieldGroup = memo(function FieldGroup({ label, labelProps = {}, text, textProps = {}, horizontal, children, ...props }) {
6
+ if (horizontal) {
7
+ props.className = "hstack gap-3 " + (props.className || "");
8
+ labelProps.className = "m-0 " + (labelProps.className || "");
9
+ }
10
+ if (text && horizontal) throw new Error("Cannot use text and horizontal together");
11
+ return /* @__PURE__ */ jsxs(Form.Group, {
12
+ ...props,
13
+ children: [
14
+ label && /* @__PURE__ */ jsx(Form.Label, {
15
+ ...labelProps,
16
+ children: label
17
+ }),
18
+ children,
19
+ text && !horizontal && /* @__PURE__ */ jsx(Form.Text, {
20
+ ...textProps,
21
+ children: text
22
+ }),
23
+ " "
24
+ ]
25
+ });
26
+ });
27
+ //#endregion
28
+ export { FieldGroup };
29
+
30
+ //# sourceMappingURL=field.js.map
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":";;AAWO,MAAM,aAAkC,SAASA,YAAW;AAAA,EAC/D;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;"}
1
+ {"version":3,"file":"field.js","names":[],"sources":["../src/field.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport { Form, type FormGroupProps, type FormLabelProps, type 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 // eslint-disable-next-line react-hooks/immutability\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"],"mappings":";;;;AAWA,IAAa,aAAkC,KAAK,SAAS,WAAW,EACpE,OACA,aAAa,CAAC,GACd,MACA,YAAY,CAAC,GACb,YACA,UACA,GAAG,SACJ;CACC,IAAI,YAAY;EACZ,MAAM,YAAY,mBAAmB,MAAM,aAAa;EAExD,WAAW,YAAY,UAAU,WAAW,aAAa;CAC7D;CAEA,IAAI,QAAQ,YACR,MAAM,IAAI,MAAM,yCAAyC;CAG7D,OACI,qBAAC,KAAK,OAAN;EAAY,GAAI;YAAhB;GACK,SAAS,oBAAC,KAAK,OAAN;IAAY,GAAI;cAAa;GAAkB,CAAA;GACxD;GACA,QAAQ,CAAC,cAAc,oBAAC,KAAK,MAAN;IAAW,GAAI;cAAY;GAAgB,CAAA;GAAG;EAC9D;;AAEpB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { FieldGroup } from './field';
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { FieldGroup } from './field.js';
3
3
  declare const meta: Meta<typeof FieldGroup>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
@@ -1 +1 @@
1
- {"version":3,"file":"field.stories.d.ts","sourceRoot":"","sources":["../src/field.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAajC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAMxB,CAAC"}
1
+ {"version":3,"file":"field.stories.d.ts","sourceRoot":"","sources":["../src/field.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAajC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAMxB,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 declare const Footer: FC<any>;
9
+ export type FooterProps = {
10
+ children: any;
11
+ };
12
+ export declare const Footer: FC<FooterProps>;
10
13
  //# sourceMappingURL=footer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../src/footer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,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,CAgChD,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,GAAG,CAc1B,CAAC"}
1
+ {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../src/footer.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAK7C,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,45 +1,45 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { Nav, Navbar } from "react-bootstrap";
3
1
  import { useBreakpoint } from "./responsiveHelper.js";
4
2
  import { AdaptiveContainer } from "./adaptiveContainer.js";
5
- const FooterNavItem = function FooterNavItem2({
6
- href,
7
- icon,
8
- active = false,
9
- children = ""
10
- }) {
11
- const isFilepath = icon.includes(".");
12
- let iconElement;
13
- if (isFilepath) {
14
- iconElement = /* @__PURE__ */ jsx("img", { src: icon, alt: "icon", className: "me-lg-2" });
15
- } else {
16
- iconElement = /* @__PURE__ */ jsx("span", { className: `lead me-lg-2 ${icon}` });
17
- }
18
- const link = /* @__PURE__ */ jsxs(
19
- Nav.Link,
20
- {
21
- href,
22
- className: `px-0 px-lg-3 d-flex align-items-center flex-column flex-lg-row ${active ? "text-primary" : ""}`,
23
- children: [
24
- iconElement,
25
- children
26
- ]
27
- }
28
- );
29
- return /* @__PURE__ */ jsx(Nav.Item, { style: { flex: 1 }, children: link });
30
- };
31
- const Footer = function Footer2({ children }) {
32
- const { isDesktop } = useBreakpoint();
33
- return (
34
- // border-bottom
35
- /* @__PURE__ */ jsx("div", { className: isDesktop ? "" : "border-top", children: /* @__PURE__ */ jsx(Navbar, { className: isDesktop ? "" : "py-0", children: /* @__PURE__ */ jsxs(AdaptiveContainer, { children: [
36
- isDesktop && /* @__PURE__ */ jsx(Navbar.Brand, { href: "/", children: "Le Brand" }),
37
- /* @__PURE__ */ jsx(Nav, { className: isDesktop ? "me-auto" : "justify-content-center flex-nowrap w-100", children })
38
- ] }) }) })
39
- );
40
- };
41
- export {
42
- Footer,
43
- FooterNavItem
44
- };
45
- //# sourceMappingURL=footer.js.map
3
+ import { memo } from "react";
4
+ import { Nav, Navbar } from "react-bootstrap";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/footer.tsx
7
+ var FooterNavItem = memo(function FooterNavItem({ href, icon, active = false, children = "" }) {
8
+ const isFilepath = icon.includes(".");
9
+ let iconElement;
10
+ if (isFilepath) iconElement = /* @__PURE__ */ jsx("img", {
11
+ src: icon,
12
+ alt: "icon",
13
+ className: "me-lg-2"
14
+ });
15
+ else iconElement = /* @__PURE__ */ jsx("span", { className: `lead me-lg-2 ${icon}` });
16
+ const link = /* @__PURE__ */ jsxs(Nav.Link, {
17
+ href,
18
+ className: `px-0 px-lg-3 d-flex align-items-center flex-column flex-lg-row ${active ? "text-primary" : ""}`,
19
+ children: [iconElement, children]
20
+ });
21
+ return /* @__PURE__ */ jsx(Nav.Item, {
22
+ style: { flex: 1 },
23
+ children: link
24
+ });
25
+ });
26
+ var Footer = memo(function Footer({ children }) {
27
+ const { isDesktop } = useBreakpoint();
28
+ return /* @__PURE__ */ jsx("div", {
29
+ className: isDesktop ? "" : "border-top",
30
+ children: /* @__PURE__ */ jsx(Navbar, {
31
+ className: isDesktop ? "" : "py-0",
32
+ children: /* @__PURE__ */ jsxs(AdaptiveContainer, { children: [isDesktop && /* @__PURE__ */ jsx(Navbar.Brand, {
33
+ href: "/",
34
+ children: "Le Brand"
35
+ }), /* @__PURE__ */ jsx(Nav, {
36
+ className: isDesktop ? "me-auto" : "justify-content-center flex-nowrap w-100",
37
+ children
38
+ })] })
39
+ })
40
+ });
41
+ });
42
+ //#endregion
43
+ export { Footer, FooterNavItem };
44
+
45
+ //# sourceMappingURL=footer.js.map