react-miui 0.28.0 → 0.28.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/CHANGELOG.md +9 -0
- package/dist/components/form/ColorPicker.js +1 -3
- package/dist/components/form/ColorPicker.js.map +1 -1
- package/dist/components/form/choice/Choice.d.ts +4 -4
- package/dist/components/form/choice/Choice.d.ts.map +1 -1
- package/dist/components/form/choice/Choice.js.map +1 -1
- package/dist/components/form/input/Input.d.ts +1 -1
- package/dist/components/form/input/Input.d.ts.map +1 -1
- package/dist/components/form/input/Input.js +3 -2
- package/dist/components/form/input/Input.js.map +1 -1
- package/dist/components/utils/Spacer.d.ts +83 -4
- package/dist/components/utils/Spacer.d.ts.map +1 -1
- package/dist/components/utils/Spacer.js +2 -8
- package/dist/components/utils/Spacer.js.map +1 -1
- package/dist/components/utils/colors.d.ts.map +1 -1
- package/dist/components/utils/colors.js +1 -1
- package/dist/components/utils/colors.js.map +1 -1
- package/docs/classes/Drawer.html +14 -14
- package/docs/classes/Pop.html +14 -14
- package/docs/classes/ToasterProvider.html +10 -10
- package/docs/enums/ICON.html +14 -14
- package/docs/functions/Action.html +4 -4
- package/docs/functions/Button.html +4 -4
- package/docs/functions/Card.html +4 -4
- package/docs/functions/Checkbox.html +4 -4
- package/docs/functions/Choice.html +13 -12
- package/docs/functions/ColorPicker.html +4 -4
- package/docs/functions/CoveringLoader.html +4 -4
- package/docs/functions/DirectionPad.html +4 -4
- package/docs/functions/EqualActions.html +4 -4
- package/docs/functions/FullLoader.html +4 -4
- package/docs/functions/HandleEsc.html +4 -4
- package/docs/functions/Header.html +4 -4
- package/docs/functions/HeaderIconAction.html +4 -4
- package/docs/functions/Icon-1.html +4 -4
- package/docs/functions/If.html +4 -4
- package/docs/functions/Input.html +8 -10
- package/docs/functions/KeyValue.html +4 -4
- package/docs/functions/Label.html +4 -4
- package/docs/functions/Line.html +4 -4
- package/docs/functions/List-1.html +4 -4
- package/docs/functions/Loader.html +4 -4
- package/docs/functions/Loading.html +4 -4
- package/docs/functions/Message.html +4 -4
- package/docs/functions/Modal-1.html +4 -4
- package/docs/functions/ModalButtons.html +4 -4
- package/docs/functions/PopLoader.html +4 -4
- package/docs/functions/PopOption.html +4 -4
- package/docs/functions/Progress.html +4 -4
- package/docs/functions/SearchContainer.html +4 -4
- package/docs/functions/Section.html +4 -4
- package/docs/functions/Select.html +4 -4
- package/docs/functions/Selector.html +5 -5
- package/docs/functions/Spacer.html +35 -12
- package/docs/functions/Stats.html +4 -4
- package/docs/functions/StickyHeader.html +4 -4
- package/docs/functions/Table.html +4 -4
- package/docs/functions/TextArea.html +4 -4
- package/docs/functions/Toggle.html +4 -4
- package/docs/functions/ToolButton.html +4 -4
- package/docs/functions/borderPxToRem.html +5 -5
- package/docs/functions/createTheme.html +4 -4
- package/docs/functions/css.html +4 -4
- package/docs/functions/dimensionsPxToRem.html +5 -5
- package/docs/functions/fontPxToRem.html +5 -5
- package/docs/functions/getCssText.html +4 -4
- package/docs/functions/globalCss.html +4 -4
- package/docs/functions/keyframes.html +4 -4
- package/docs/functions/pxToRem.html +5 -5
- package/docs/functions/styled.html +4 -4
- package/docs/functions/useToaster.html +5 -5
- package/docs/index.html +4 -4
- package/docs/interfaces/IconProps.html +7 -7
- package/docs/interfaces/InputCustomProps.html +11 -11
- package/docs/interfaces/LabelProps.html +8 -8
- package/docs/interfaces/StickyHeaderProps.html +9 -9
- package/docs/interfaces/ToggleProps.html +10 -10
- package/docs/modules/List.html +7 -7
- package/docs/modules/Modal.html +6 -6
- package/docs/modules.html +4 -4
- package/docs/pages/tutorials/Test.html +4 -4
- package/docs/types/ActionProps.html +5 -5
- package/docs/types/ChoiceProps.html +7 -12
- package/docs/types/InputProps.html +5 -5
- package/docs/types/OverwriteProps.html +5 -5
- package/docs/types/ThemeCSS.html +5 -5
- package/docs/variables/List.Header.html +5 -5
- package/docs/variables/List.Item.html +5 -5
- package/docs/variables/Modal.RemovePadding.html +5 -5
- package/docs/variables/config.html +5 -5
- package/docs/variables/cssReset.html +5 -5
- package/docs/variables/miuiScrollbars.html +5 -5
- package/docs/variables/theme.html +5 -5
- package/esm/components/form/Checkbox.stories.d.ts +9 -0
- package/esm/components/form/Checkbox.stories.d.ts.map +1 -0
- package/esm/components/form/Checkbox.stories.js +80 -0
- package/esm/components/form/Checkbox.stories.js.map +1 -0
- package/esm/components/form/ColorPicker.js +1 -3
- package/esm/components/form/ColorPicker.js.map +1 -1
- package/esm/components/form/ColorPicker.stories.d.ts +10 -0
- package/esm/components/form/ColorPicker.stories.d.ts.map +1 -0
- package/esm/components/form/ColorPicker.stories.js +75 -0
- package/esm/components/form/ColorPicker.stories.js.map +1 -0
- package/esm/components/form/Label.stories.d.ts +11 -0
- package/esm/components/form/Label.stories.d.ts.map +1 -0
- package/esm/components/form/Label.stories.js +43 -0
- package/esm/components/form/Label.stories.js.map +1 -0
- package/esm/components/form/Select.stories.d.ts +8 -0
- package/esm/components/form/Select.stories.d.ts.map +1 -0
- package/esm/components/form/Select.stories.js +24 -0
- package/esm/components/form/Select.stories.js.map +1 -0
- package/esm/components/form/Toggle.stories.d.ts +14 -0
- package/esm/components/form/Toggle.stories.d.ts.map +1 -0
- package/esm/components/form/Toggle.stories.js +76 -0
- package/esm/components/form/Toggle.stories.js.map +1 -0
- package/esm/components/form/choice/Choice.d.ts +4 -4
- package/esm/components/form/choice/Choice.d.ts.map +1 -1
- package/esm/components/form/choice/Choice.js.map +1 -1
- package/esm/components/form/choice/Choice.stories.d.ts +10 -0
- package/esm/components/form/choice/Choice.stories.d.ts.map +1 -0
- package/esm/components/form/choice/Choice.stories.js +80 -0
- package/esm/components/form/choice/Choice.stories.js.map +1 -0
- package/esm/components/form/input/Input.d.ts +1 -1
- package/esm/components/form/input/Input.d.ts.map +1 -1
- package/esm/components/form/input/Input.js +3 -2
- package/esm/components/form/input/Input.js.map +1 -1
- package/esm/components/form/input/Input.stories.d.ts +10 -0
- package/esm/components/form/input/Input.stories.d.ts.map +1 -0
- package/esm/components/form/input/Input.stories.js +53 -0
- package/esm/components/form/input/Input.stories.js.map +1 -0
- package/esm/components/form/textarea/TextArea.stories.d.ts +8 -0
- package/esm/components/form/textarea/TextArea.stories.d.ts.map +1 -0
- package/esm/components/form/textarea/TextArea.stories.js +19 -0
- package/esm/components/form/textarea/TextArea.stories.js.map +1 -0
- package/esm/components/layout/header/Header.stories.d.ts +11 -0
- package/esm/components/layout/header/Header.stories.d.ts.map +1 -0
- package/esm/components/layout/header/Header.stories.js +56 -0
- package/esm/components/layout/header/Header.stories.js.map +1 -0
- package/esm/components/layout/header/HeaderIconAction.stories.d.ts +9 -0
- package/esm/components/layout/header/HeaderIconAction.stories.d.ts.map +1 -0
- package/esm/components/layout/header/HeaderIconAction.stories.js +24 -0
- package/esm/components/layout/header/HeaderIconAction.stories.js.map +1 -0
- package/esm/components/layout/header/StickyHeader.stories.d.ts +9 -0
- package/esm/components/layout/header/StickyHeader.stories.d.ts.map +1 -0
- package/esm/components/layout/header/StickyHeader.stories.js +60 -0
- package/esm/components/layout/header/StickyHeader.stories.js.map +1 -0
- package/esm/components/layout/list/Header.stories.d.ts +8 -0
- package/esm/components/layout/list/Header.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Header.stories.js +27 -0
- package/esm/components/layout/list/Header.stories.js.map +1 -0
- package/esm/components/layout/list/Item.stories.d.ts +11 -0
- package/esm/components/layout/list/Item.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Item.stories.js +100 -0
- package/esm/components/layout/list/Item.stories.js.map +1 -0
- package/esm/components/layout/list/Label.stories.d.ts +8 -0
- package/esm/components/layout/list/Label.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Label.stories.js +29 -0
- package/esm/components/layout/list/Label.stories.js.map +1 -0
- package/esm/components/layout/list/List.stories.d.ts +9 -0
- package/esm/components/layout/list/List.stories.d.ts.map +1 -0
- package/esm/components/layout/list/List.stories.js +46 -0
- package/esm/components/layout/list/List.stories.js.map +1 -0
- package/esm/components/layout/list/Value.stories.d.ts +8 -0
- package/esm/components/layout/list/Value.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Value.stories.js +23 -0
- package/esm/components/layout/list/Value.stories.js.map +1 -0
- package/esm/components/layout/section/Section.stories.d.ts +8 -0
- package/esm/components/layout/section/Section.stories.d.ts.map +1 -0
- package/esm/components/layout/section/Section.stories.js +31 -0
- package/esm/components/layout/section/Section.stories.js.map +1 -0
- package/esm/components/layout/table/Table.stories.d.ts +8 -0
- package/esm/components/layout/table/Table.stories.d.ts.map +1 -0
- package/esm/components/layout/table/Table.stories.js +49 -0
- package/esm/components/layout/table/Table.stories.js.map +1 -0
- package/esm/components/ui/action/Action.stories.d.ts +11 -0
- package/esm/components/ui/action/Action.stories.d.ts.map +1 -0
- package/esm/components/ui/action/Action.stories.js +58 -0
- package/esm/components/ui/action/Action.stories.js.map +1 -0
- package/esm/components/ui/button/Button.stories.d.ts +9 -0
- package/esm/components/ui/button/Button.stories.d.ts.map +1 -0
- package/esm/components/ui/button/Button.stories.js +35 -0
- package/esm/components/ui/button/Button.stories.js.map +1 -0
- package/esm/components/ui/line/Line.stories.d.ts +8 -0
- package/esm/components/ui/line/Line.stories.d.ts.map +1 -0
- package/esm/components/ui/line/Line.stories.js +27 -0
- package/esm/components/ui/line/Line.stories.js.map +1 -0
- package/esm/components/ui/loader/CoveringLoader.stories.d.ts +8 -0
- package/esm/components/ui/loader/CoveringLoader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/CoveringLoader.stories.js +25 -0
- package/esm/components/ui/loader/CoveringLoader.stories.js.map +1 -0
- package/esm/components/ui/loader/FullLoader.stories.d.ts +8 -0
- package/esm/components/ui/loader/FullLoader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/FullLoader.stories.js +19 -0
- package/esm/components/ui/loader/FullLoader.stories.js.map +1 -0
- package/esm/components/ui/loader/Loader.stories.d.ts +8 -0
- package/esm/components/ui/loader/Loader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/Loader.stories.js +23 -0
- package/esm/components/ui/loader/Loader.stories.js.map +1 -0
- package/esm/components/ui/loader/Loading.stories.d.ts +8 -0
- package/esm/components/ui/loader/Loading.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/Loading.stories.js +32 -0
- package/esm/components/ui/loader/Loading.stories.js.map +1 -0
- package/esm/components/ui/loader/PopLoader.stories.d.ts +8 -0
- package/esm/components/ui/loader/PopLoader.stories.d.ts.map +1 -0
- package/esm/components/ui/loader/PopLoader.stories.js +24 -0
- package/esm/components/ui/loader/PopLoader.stories.js.map +1 -0
- package/esm/components/ui/message/Message.stories.d.ts +9 -0
- package/esm/components/ui/message/Message.stories.d.ts.map +1 -0
- package/esm/components/ui/message/Message.stories.js +43 -0
- package/esm/components/ui/message/Message.stories.js.map +1 -0
- package/esm/components/ui/modal/Modal.stories.d.ts +10 -0
- package/esm/components/ui/modal/Modal.stories.d.ts.map +1 -0
- package/esm/components/ui/modal/Modal.stories.js +84 -0
- package/esm/components/ui/modal/Modal.stories.js.map +1 -0
- package/esm/components/ui/modal/ModalButtons.stories.d.ts +8 -0
- package/esm/components/ui/modal/ModalButtons.stories.d.ts.map +1 -0
- package/esm/components/ui/modal/ModalButtons.stories.js +19 -0
- package/esm/components/ui/modal/ModalButtons.stories.js.map +1 -0
- package/esm/components/ui/pop/Pop.stories.d.ts +8 -0
- package/esm/components/ui/pop/Pop.stories.d.ts.map +1 -0
- package/esm/components/ui/pop/Pop.stories.js +65 -0
- package/esm/components/ui/pop/Pop.stories.js.map +1 -0
- package/esm/components/ui/progress/Progress.stories.d.ts +9 -0
- package/esm/components/ui/progress/Progress.stories.d.ts.map +1 -0
- package/esm/components/ui/progress/Progress.stories.js +29 -0
- package/esm/components/ui/progress/Progress.stories.js.map +1 -0
- package/esm/components/ui/toaster/Toaster.stories.d.ts +7 -0
- package/esm/components/ui/toaster/Toaster.stories.d.ts.map +1 -0
- package/esm/components/ui/toaster/Toaster.stories.js +39 -0
- package/esm/components/ui/toaster/Toaster.stories.js.map +1 -0
- package/esm/components/ui/toolButton/ToolButton.stories.d.ts +8 -0
- package/esm/components/ui/toolButton/ToolButton.stories.d.ts.map +1 -0
- package/esm/components/ui/toolButton/ToolButton.stories.js +29 -0
- package/esm/components/ui/toolButton/ToolButton.stories.js.map +1 -0
- package/esm/components/utils/Spacer.d.ts +83 -4
- package/esm/components/utils/Spacer.d.ts.map +1 -1
- package/esm/components/utils/Spacer.js +2 -5
- package/esm/components/utils/Spacer.js.map +1 -1
- package/esm/components/utils/colors.d.ts.map +1 -1
- package/esm/components/utils/colors.js +1 -1
- package/esm/components/utils/colors.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/ColorPicker.tsx +3 -3
- package/src/components/form/Label.styled.ts +1 -1
- package/src/components/form/choice/Choice.tsx +6 -6
- package/src/components/form/input/Input.stories.tsx +22 -2
- package/src/components/form/input/Input.tsx +8 -2
- package/src/components/ui/pop/Pop.stories.tsx +0 -1
- package/src/components/utils/Spacer.tsx +2 -8
- package/src/components/utils/colors.ts +3 -1
- package/src/demo/Main.tsx +1 -1
- package/dist/components/utils/Spacer.module.scss +0 -3
- package/esm/components/utils/Spacer.module.scss +0 -3
- package/src/components/form/choice/Choice.js +0 -32
- package/src/components/form/choice/Choice.styled.js +0 -65
- package/src/components/utils/Spacer.module.scss +0 -3
- package/src/theme.js +0 -98
- package/src/types/form.js +0 -2
- package/src/utils/index.js +0 -19
- package/src/utils/makeVariants.js +0 -13
- package/src/utils/toObjectValue.js +0 -7
- package/src/utils/useKeyPress.js +0 -29
|
@@ -3,14 +3,14 @@ import type { ObjectValue, Value } from "../../../types/form";
|
|
|
3
3
|
import { StyledChoice } from "./Choice.styled";
|
|
4
4
|
type Variant = "wide" | "left";
|
|
5
5
|
type StyledProps = React.ComponentProps<typeof StyledChoice>;
|
|
6
|
-
type Props
|
|
7
|
-
values: Value<
|
|
6
|
+
type Props = Omit<StyledProps, "onChange"> & {
|
|
7
|
+
values: Value<string>[];
|
|
8
8
|
value: string;
|
|
9
9
|
name: string;
|
|
10
|
-
onChange: (value: Exclude<Value<
|
|
10
|
+
onChange: (value: Exclude<Value<string>, ObjectValue>) => void;
|
|
11
11
|
variant?: Variant | Variant[];
|
|
12
12
|
};
|
|
13
|
-
declare const Choice:
|
|
13
|
+
declare const Choice: React.FC<Props>;
|
|
14
14
|
export { Choice };
|
|
15
15
|
export type { Props as ChoiceProps, };
|
|
16
16
|
//# sourceMappingURL=Choice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../../src/components/form/choice/Choice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAK9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/B,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAE7D,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"Choice.d.ts","sourceRoot":"","sources":["../../../../src/components/form/choice/Choice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAK9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/B,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAE7D,KAAK,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG;IACzC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;IAC/D,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CACjC,CAAC;AAIF,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsB3B,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,YAAY,EACR,KAAK,IAAI,WAAW,GACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Choice.js","sourceRoot":"","sources":["../../../../src/components/form/choice/Choice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Choice.js","sourceRoot":"","sources":["../../../../src/components/form/choice/Choice.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAgB/C,MAAM,MAAM,GAAoB,CAAC,EAE7B,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,EAC1C,EAAE,EAAE;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CACH,oBAAC,UAAU,IACP,GAAG,EAAE,GAAG,CAAC,KAAK,EACd,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,KAAK,KAAK,GAAG,CAAC,KAAK,GAC7B,CACL,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,OAAO,CACH,oBAAC,YAAY,OAAK,KAAK,IAClB,IAAI,CACM,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { Choice } from "./Choice";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof Choice>;
|
|
5
|
+
declare const Basic: Story;
|
|
6
|
+
declare const WithObjectValues: Story;
|
|
7
|
+
declare const Variants: Story;
|
|
8
|
+
export default meta;
|
|
9
|
+
export { Basic, WithObjectValues, Variants, };
|
|
10
|
+
//# sourceMappingURL=Choice.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Choice.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/form/choice/Choice.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AASrC,QAAA,MAAM,KAAK,EAAE,KAgBZ,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAAE,KA8BvB,CAAC;AAUF,QAAA,MAAM,QAAQ,EAAE,KAuDf,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,OAAO,EACH,KAAK,EACL,gBAAgB,EAChB,QAAQ,GACX,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { styled } from "../../../theme.js";
|
|
3
|
+
import { Section } from "../../layout/section/Section.js";
|
|
4
|
+
import { Choice } from "./Choice.js";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/Form/Choice",
|
|
7
|
+
component: Choice,
|
|
8
|
+
tags: ["autodocs", "form"],
|
|
9
|
+
};
|
|
10
|
+
const Container = styled("div", {
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
gap: "2rem",
|
|
14
|
+
padding: "1rem",
|
|
15
|
+
});
|
|
16
|
+
const Basic = {
|
|
17
|
+
render: () => {
|
|
18
|
+
const values = ["Single", "Multiple words"];
|
|
19
|
+
const [current, setCurrent] = useState(values[0]);
|
|
20
|
+
return (React.createElement(Section, { vertical: true, horizontal: true },
|
|
21
|
+
React.createElement(Choice, { values: values, value: current, name: "basic-choice", onChange: setCurrent })));
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const WithObjectValues = {
|
|
25
|
+
render: () => {
|
|
26
|
+
const values = [
|
|
27
|
+
{
|
|
28
|
+
label: "Option 1",
|
|
29
|
+
value: "one",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "Option 2",
|
|
33
|
+
value: "two",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "Option 3",
|
|
37
|
+
value: "three",
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
const [current, setCurrent] = useState(values[0].value);
|
|
41
|
+
return (React.createElement(Section, { vertical: true, horizontal: true },
|
|
42
|
+
React.createElement(Choice, { values: values, value: current, name: "object-choice", onChange: setCurrent }),
|
|
43
|
+
React.createElement("p", null,
|
|
44
|
+
"Current value: ",
|
|
45
|
+
current)));
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const Blue = styled(Choice, {
|
|
49
|
+
"--choice-text": "#59a5c2",
|
|
50
|
+
"--choice-border": "#10a4dc",
|
|
51
|
+
"--choice-bg": "#f9fdff",
|
|
52
|
+
"--choice-active-text": "#145b79",
|
|
53
|
+
"--choice-active-bg": "#ddf5ff",
|
|
54
|
+
});
|
|
55
|
+
const Variants = {
|
|
56
|
+
render: () => {
|
|
57
|
+
const values = [
|
|
58
|
+
{ label: "Option 1", value: "one" },
|
|
59
|
+
{ label: "Option 2", value: "two" },
|
|
60
|
+
{ label: "Option 3", value: "three" },
|
|
61
|
+
];
|
|
62
|
+
const [current, setCurrent] = useState(values[0].value);
|
|
63
|
+
return (React.createElement(Container, null,
|
|
64
|
+
React.createElement(Section, { vertical: true, horizontal: true },
|
|
65
|
+
React.createElement("h3", null, "Default (centered)"),
|
|
66
|
+
React.createElement(Choice, { values: values, value: current, name: "default-choice", onChange: setCurrent })),
|
|
67
|
+
React.createElement(Section, { vertical: true, horizontal: true },
|
|
68
|
+
React.createElement("h3", null, "Wide variant"),
|
|
69
|
+
React.createElement(Choice, { values: values, value: current, name: "wide-choice", onChange: setCurrent, wide: true })),
|
|
70
|
+
React.createElement(Section, { vertical: true, horizontal: true },
|
|
71
|
+
React.createElement("h3", null, "Left aligned variant"),
|
|
72
|
+
React.createElement(Choice, { values: values, value: current, name: "left-choice", onChange: setCurrent, unaligned: true })),
|
|
73
|
+
React.createElement(Section, { vertical: true, horizontal: true },
|
|
74
|
+
React.createElement("h3", null, "Custom colors"),
|
|
75
|
+
React.createElement(Blue, { values: values, value: current, name: "combined-choice", onChange: setCurrent }))));
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export default meta;
|
|
79
|
+
export { Basic, WithObjectValues, Variants, };
|
|
80
|
+
//# sourceMappingURL=Choice.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Choice.stories.js","sourceRoot":"","sources":["../../../../src/components/form/choice/Choice.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,IAAI,GAAS;IAC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,EAAE,UAAU,EAAE,IAAI;gBACrC,uDAA6B;gBAC7B,oBAAC,MAAM,IACH,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,IAAI,GACjB,CACI;YAEV,oBAAC,OAAO,IAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;gBACrC,gDAAsB;gBACtB,oBAAC,IAAI,IACD,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,UAAU,GACtB,CACI,CACF,CACf,CAAC;IACN,CAAC;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,OAAO,EACH,KAAK,EACL,gBAAgB,EAChB,QAAQ,GACX,CAAC"}
|
|
@@ -9,7 +9,7 @@ interface CustomProps<T extends string> {
|
|
|
9
9
|
onSuggestionMatch?: (value: Exclude<Value<T>, ObjectValue>, __chromiumPickedFromList: boolean) => void;
|
|
10
10
|
}
|
|
11
11
|
type Props<T extends string> = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix"> & CustomProps<T>;
|
|
12
|
-
declare const Input: <T extends string>(
|
|
12
|
+
declare const Input: <T extends string>(props: Props<T> & React.RefAttributes<HTMLInputElement>) => JSX.Element;
|
|
13
13
|
export { Input, };
|
|
14
14
|
export type { Props as InputProps, CustomProps as InputCustomProps, };
|
|
15
15
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/form/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAM9D,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM;IAClC,QAAQ,CAAC,EAAE,KAAK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AQ,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAyF5G,QAAA,MAAM,KAAK,EAAmC,CAAC,CAAC,SAAS,MAAM,EAC3D,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,KACtD,GAAG,CAAC,OAAO,CAAC;AAEjB,OAAO,EACH,KAAK,GACR,CAAC;AAEF,YAAY,EACR,KAAK,IAAI,UAAU,EACnB,WAAW,IAAI,gBAAgB,GAClC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useId, useState } from "react";
|
|
2
2
|
import { Suggestions } from "../Suggestions.js";
|
|
3
3
|
import { StyledInput, StyledWrapper, StyledPrefix, StyledSuffix } from "./Input.styled.js";
|
|
4
|
-
const
|
|
4
|
+
const InputInner = ({ className, children, prefix, suffix, onFocus, onBlur, onKeyDown, onChange, suggestions, onSuggestionMatch, error, ...props }, ref) => {
|
|
5
5
|
const [focused, setFocused] = useState(false);
|
|
6
6
|
const suggestionsId = useId();
|
|
7
7
|
const [info] = useState({});
|
|
@@ -45,9 +45,10 @@ const Input = ({ className, children, prefix, suffix, onFocus, onBlur, onKeyDown
|
|
|
45
45
|
}
|
|
46
46
|
return (React.createElement(StyledWrapper, { className: className, focused: Boolean(focused), disabled: Boolean(props.disabled), readOnly: Boolean(props.readOnly), error: Boolean(error) },
|
|
47
47
|
prefixElem,
|
|
48
|
-
React.createElement(StyledInput, { ...props, ...extraProps, onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, "data-error": Boolean(error) }),
|
|
48
|
+
React.createElement(StyledInput, { ref: ref, ...props, ...extraProps, onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, "data-error": Boolean(error) }),
|
|
49
49
|
React.createElement(Suggestions, { id: suggestionsId, suggestions: suggestions }),
|
|
50
50
|
suffixElem));
|
|
51
51
|
};
|
|
52
|
+
const Input = React.forwardRef(InputInner);
|
|
52
53
|
export { Input, };
|
|
53
54
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/form/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgBxF,MAAM,
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/form/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgBxF,MAAM,UAAU,GAAG,CAAmB,EAClC,SAAS,EAAE,QAAQ,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EACpC,WAAW,EACX,iBAAiB,EACjB,KAAK,EACL,GAAG,KAAK,EACD,EAAE,GAAgC,EAAE,EAAE;IAC7C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,KAAK,EAAE,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAuB,EAAE,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAqC,EAAE,EAAE;QACtE,UAAU,CAAC,IAAI,CAAC,C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, Meta } from "@storybook/react";
|
|
2
|
+
import { Input } from "./Input";
|
|
3
|
+
declare const meta: Meta<typeof Input>;
|
|
4
|
+
type Story = StoryObj<typeof Input>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
declare const Mixed: Story;
|
|
7
|
+
declare const InputRef: Story;
|
|
8
|
+
export { Primary, Mixed, InputRef, };
|
|
9
|
+
export default meta;
|
|
10
|
+
//# sourceMappingURL=Input.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/form/input/Input.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAY5B,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,QAAA,MAAM,OAAO,EAAE,KAMd,CAAC;AAMF,QAAA,MAAM,KAAK,EAAE,KAeZ,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAiBf,CAAC;AAEF,OAAO,EACH,OAAO,EAAE,KAAK,EAAE,QAAQ,GAC3B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { Icon, ICON } from "../../icons/Icon.js";
|
|
3
|
+
import { countries } from "../../../demo/components/form/countries.const.js";
|
|
4
|
+
import { Button } from "../../ui/button/Button.js";
|
|
5
|
+
import { Input } from "./Input.js";
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Components/Form/Input",
|
|
8
|
+
component: Input,
|
|
9
|
+
tags: ["autodocs", "form"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
error: { type: "boolean" },
|
|
12
|
+
disabled: { type: "boolean" },
|
|
13
|
+
readOnly: { type: "boolean" },
|
|
14
|
+
prefix: { type: "string" },
|
|
15
|
+
suffix: { type: "string" },
|
|
16
|
+
children: { table: { disable: true } },
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const Primary = {
|
|
20
|
+
args: {
|
|
21
|
+
placeholder: "Capacity",
|
|
22
|
+
prefix: React.createElement(Icon, { name: ICON.battery }),
|
|
23
|
+
suffix: "kWh",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const handleSuggestionMatch = (s, picked) => {
|
|
27
|
+
alert("Suggestion " + (picked ? "picked" : "matched") + " : " + s);
|
|
28
|
+
};
|
|
29
|
+
const Mixed = {
|
|
30
|
+
render: () => (React.createElement(React.Fragment, null,
|
|
31
|
+
React.createElement(Input, { placeholder: "Capacity", prefix: React.createElement(Icon, { name: ICON.battery }), suffix: "kWh" }),
|
|
32
|
+
React.createElement(Input, { value: "William J. Welter" }),
|
|
33
|
+
React.createElement(Input, { prefix: "Text prefix", value: "Polly W. Wilson" }),
|
|
34
|
+
React.createElement(Input, { prefix: "Disabled", value: "Clayton J. Foster", disabled: true }),
|
|
35
|
+
React.createElement(Input, { prefix: "Read only", value: "Norma J. Gomez", readOnly: true }),
|
|
36
|
+
React.createElement(Input, { placeholder: "With suggestions, try country name", suggestions: countries, onSuggestionMatch: handleSuggestionMatch }))),
|
|
37
|
+
};
|
|
38
|
+
const InputRef = {
|
|
39
|
+
render: () => {
|
|
40
|
+
const ref = React.useRef(null);
|
|
41
|
+
const handleRandomValue = useCallback(() => {
|
|
42
|
+
if (ref.current) {
|
|
43
|
+
ref.current.value = (Math.random() * 100).toFixed(2);
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
return (React.createElement(React.Fragment, null,
|
|
47
|
+
React.createElement(Input, { ref: ref, placeholder: "Capacity", prefix: React.createElement(Icon, { name: ICON.battery }), suffix: "kWh" }),
|
|
48
|
+
React.createElement(Button, { onClick: handleRandomValue }, "Set random value")));
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export { Primary, Mixed, InputRef, };
|
|
52
|
+
export default meta;
|
|
53
|
+
//# sourceMappingURL=Input.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.stories.js","sourceRoot":"","sources":["../../../../src/components/form/input/Input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAI3C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,IAAI,GAAuB;IAC7B,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE;QACN,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;KACzC;CACJ,CAAC;AAIF,MAAM,OAAO,GAAU;IACnB,IAAI,EAAE;QACF,WAAW,EAAE,UAAU;QACvB,MAAM,EAAE,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,OAAO,GAAI;QACpC,MAAM,EAAE,KAAK;KAChB;CACJ,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,CAAS,EA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EP,OAAO,CACH;YACI,oBAAC,KAAK,IAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,CAAC,OAAO,GAAI,EAAE,MAAM,EAAE,KAAK,GAAI;YACjG,oBAAC,MAAM,IAAC,OAAO,EAAE,iBAAiB,uBAA2B,CAC9D,CACN,CAAC;IACN,CAAC;CACJ,CAAC;AAEF,OAAO,EACH,OAAO,EAAE,KAAK,EAAE,QAAQ,GAC3B,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { TextArea } from "./TextArea";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof TextArea>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
export { Primary, };
|
|
7
|
+
export default meta;
|
|
8
|
+
//# sourceMappingURL=TextArea.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/form/textarea/TextArea.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IASX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,QAAA,MAAM,OAAO,EAAE,KAId,CAAC;AAEF,OAAO,EACH,OAAO,GACV,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextArea } from "./TextArea.js";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: "Components/Form/TextArea",
|
|
4
|
+
component: TextArea,
|
|
5
|
+
tags: ["autodocs", "form"],
|
|
6
|
+
argTypes: {
|
|
7
|
+
error: { type: "boolean" },
|
|
8
|
+
disabled: { type: "boolean" },
|
|
9
|
+
readOnly: { type: "boolean" },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const Primary = {
|
|
13
|
+
args: {
|
|
14
|
+
placeholder: "Type something here",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export { Primary, };
|
|
18
|
+
export default meta;
|
|
19
|
+
//# sourceMappingURL=TextArea.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.stories.js","sourceRoot":"","sources":["../../../../src/components/form/textarea/TextArea.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,IAAI,GAAS;IACf,KAAK,EAAE,0BAA0B;IACjC,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE;QACN,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAChC;CACJ,CAAC;AAIF,MAAM,OAAO,GAAU;IACnB,IAAI,EAAE;QACF,WAAW,EAAE,qBAAqB;KACrC;CACJ,CAAC;AAEF,OAAO,EACH,OAAO,GACV,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { Header } from "./Header";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof Header>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
declare const LongContent: Story;
|
|
7
|
+
declare const WithButtons: Story;
|
|
8
|
+
declare const Vertical: Story;
|
|
9
|
+
export { Primary, LongContent, WithButtons, Vertical, };
|
|
10
|
+
export default meta;
|
|
11
|
+
//# sourceMappingURL=Header.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/header/Header.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,QAAA,MAAM,IAAI,EAAE,IAsBX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,QAAA,MAAM,OAAO,EAAE,KAAU,CAAC;AAC1B,QAAA,MAAM,WAAW,EAAE,KAalB,CAAC;AAIF,QAAA,MAAM,WAAW,EAAE,KASlB,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KAYf,CAAC;AAEF,OAAO,EACH,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,GACX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ICON } from "../../icons/Icon.js";
|
|
3
|
+
import { Header } from "./Header.js";
|
|
4
|
+
import { HeaderIconAction } from "./HeaderIconAction.js";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/Layout/Header/Header",
|
|
7
|
+
component: Header,
|
|
8
|
+
tags: ["autodocs", "layout"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
before: {
|
|
11
|
+
control: {
|
|
12
|
+
type: "text",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
after: {
|
|
16
|
+
control: {
|
|
17
|
+
type: "text",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
args: {
|
|
22
|
+
before: "Left side",
|
|
23
|
+
children: "Title",
|
|
24
|
+
after: "[Icons]",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const Primary = {};
|
|
28
|
+
const LongContent = {
|
|
29
|
+
render: (args) => {
|
|
30
|
+
const longContent = new Array(1000).fill(null).map((_, key) => React.createElement("div", { key: key }, "content"));
|
|
31
|
+
return (React.createElement(React.Fragment, null,
|
|
32
|
+
React.createElement(Header, { ...args }),
|
|
33
|
+
longContent));
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const handleClick = () => { alert(1); };
|
|
37
|
+
const WithButtons = {
|
|
38
|
+
args: {
|
|
39
|
+
before: (React.createElement(React.Fragment, null,
|
|
40
|
+
React.createElement(HeaderIconAction, { icon: ICON.back, onClick: handleClick }),
|
|
41
|
+
React.createElement(HeaderIconAction, { icon: ICON.checkmark, onClick: handleClick }))),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const Vertical = {
|
|
45
|
+
args: {
|
|
46
|
+
before: (React.createElement(React.Fragment, null,
|
|
47
|
+
React.createElement(HeaderIconAction, { icon: ICON.back, onClick: handleClick }),
|
|
48
|
+
React.createElement(HeaderIconAction, { icon: ICON.checkmark, onClick: handleClick }))),
|
|
49
|
+
after: null,
|
|
50
|
+
position: "left",
|
|
51
|
+
children: "M",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export { Primary, LongContent, WithButtons, Vertical, };
|
|
55
|
+
export default meta;
|
|
56
|
+
//# sourceMappingURL=Header.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.stories.js","sourceRoot":"","sources":["../../../../src/components/layout/header/Header.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,IAAI,GAAS;IACf,KAAK,EAAE,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,EAAE,OAAO,EAAE,WAAW,GAAI;YAC3D,oBAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,GAAI,CACjE,CACN;QACD,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,GAAG;KAChB;CACJ,CAAC;AAEF,OAAO,EACH,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,GACX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { Header } from "./Header";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof Header>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
declare const MultipleIcons: Story;
|
|
7
|
+
export { Primary, MultipleIcons, };
|
|
8
|
+
export default meta;
|
|
9
|
+
//# sourceMappingURL=HeaderIconAction.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderIconAction.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/header/HeaderIconAction.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,QAAA,MAAM,IAAI,EAAE,IAWX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,QAAA,MAAM,OAAO,EAAE,KAAU,CAAC;AAE1B,QAAA,MAAM,aAAa,EAAE,KAepB,CAAC;AAEF,OAAO,EACH,OAAO,EACP,aAAa,GAChB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Header } from "./Header.js";
|
|
3
|
+
import { HeaderIconAction } from "./HeaderIconAction.js";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Layout/Header/HeaderIconAction",
|
|
6
|
+
component: HeaderIconAction,
|
|
7
|
+
tags: ["autodocs", "layout"],
|
|
8
|
+
render: (args) => {
|
|
9
|
+
return (React.createElement(Header, { before: React.createElement(HeaderIconAction, { ...args, icon: React.createElement(React.Fragment, null, "i") }) }, "On the left you can see the icon"));
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const Primary = {};
|
|
13
|
+
const MultipleIcons = {
|
|
14
|
+
render: ({ onClick: _onClick, ...args }) => {
|
|
15
|
+
const after = (React.createElement(React.Fragment, null,
|
|
16
|
+
React.createElement("div", null, "some text"),
|
|
17
|
+
React.createElement(HeaderIconAction, { ...args, icon: React.createElement(React.Fragment, null, "i") }),
|
|
18
|
+
React.createElement(HeaderIconAction, { ...args, icon: React.createElement(React.Fragment, null, "i") })));
|
|
19
|
+
return (React.createElement(Header, { after: after }, "On the left you can see the icon"));
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export { Primary, MultipleIcons, };
|
|
23
|
+
export default meta;
|
|
24
|
+
//# sourceMappingURL=HeaderIconAction.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderIconAction.stories.js","sourceRoot":"","sources":["../../../../src/components/layout/header/HeaderIconAction.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,IAAI,GAAS;IACf,KAAK,EAAE,2CAA2C;IAClD,SAAS,EAAE,gBAAgB;IAC3B,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACb,OAAO,CACH,oBAAC,MAAM,IAAC,MAAM,EAAE,oBAAC,gBAAgB,OAAK,IAAI,EAAE,IAAI,EAAE,8CAAM,GAAI,uCAEnD,CACZ,CAAC;IACN,CAAC;CACJ,CAAC;AAIF,MAAM,OAAO,GAAU,EAAE,CAAC;AAE1B,MAAM,aAAa,GAAU;IACzB,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;QACvC,MAAM,KAAK,GAAG,CACV;YACI,6CAAoB;YACpB,oBAAC,gBAAgB,OAAK,IAAI,EAAE,IAAI,EAAE,8CAAM,GAAI;YAC5C,oBAAC,gBAAgB,OAAK,IAAI,EAAE,IAAI,EAAE,8CAAM,GAAI,CAC7C,CACN,CAAC;QACF,OAAO,CACH,oBAAC,MAAM,IAAC,KAAK,EAAE,KAAK,uCAEX,CACZ,CAAC;IACN,CAAC;CACJ,CAAC;AAEF,OAAO,EACH,OAAO,EACP,aAAa,GAChB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { StickyHeader } from "./StickyHeader";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof StickyHeader>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
declare const RefsDemo: Story;
|
|
7
|
+
export { Primary, RefsDemo, };
|
|
8
|
+
export default meta;
|
|
9
|
+
//# sourceMappingURL=StickyHeader.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyHeader.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/header/StickyHeader.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,QAAA,MAAM,IAAI,EAAE,IAmBX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAC;AAE3C,QAAA,MAAM,OAAO,EAAE,KAmBd,CAAC;AAEF,QAAA,MAAM,QAAQ,EAAE,KA0Bf,CAAC;AAEF,OAAO,EACH,OAAO,EACP,QAAQ,GACX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { useForceUpdate } from "@ezez/hooks";
|
|
3
|
+
import { StickyHeader } from "./StickyHeader.js";
|
|
4
|
+
import { Header } from "./Header.js";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/Layout/Header/StickyHeader",
|
|
7
|
+
component: StickyHeader,
|
|
8
|
+
tags: ["autodocs", "layout"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: {
|
|
11
|
+
control: {
|
|
12
|
+
disable: true,
|
|
13
|
+
},
|
|
14
|
+
description: "Usual children",
|
|
15
|
+
},
|
|
16
|
+
position: {
|
|
17
|
+
control: {
|
|
18
|
+
type: "select",
|
|
19
|
+
},
|
|
20
|
+
description: "Position of the header",
|
|
21
|
+
options: ["top", "left", "right", "bottom"],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const Primary = {
|
|
26
|
+
render: (args) => {
|
|
27
|
+
const longContent = new Array(1000).fill(null).map((_, key) => React.createElement("div", { key: key }, "content"));
|
|
28
|
+
return (React.createElement(React.Fragment, null,
|
|
29
|
+
React.createElement("style", null, `#story--components-layout-header-stickyheader--primary--primary-inner {
|
|
30
|
+
height: 400px;
|
|
31
|
+
}`),
|
|
32
|
+
React.createElement(StickyHeader, { ...args },
|
|
33
|
+
React.createElement(Header, null, "x"),
|
|
34
|
+
React.createElement(StickyHeader.Content, null, longContent))));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const RefsDemo = {
|
|
38
|
+
render: (args) => {
|
|
39
|
+
const ref = React.useRef(null);
|
|
40
|
+
const refContent = React.useRef(null);
|
|
41
|
+
const handleForceUpdate = useForceUpdate();
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
handleForceUpdate();
|
|
44
|
+
}, []);
|
|
45
|
+
console.info("RefsDemo", {
|
|
46
|
+
ref: ref.current, refContent: refContent.current,
|
|
47
|
+
});
|
|
48
|
+
return (React.createElement(React.Fragment, null,
|
|
49
|
+
React.createElement(StickyHeader, { ...args, ref: ref },
|
|
50
|
+
React.createElement(Header, null, "x"),
|
|
51
|
+
React.createElement(StickyHeader.Content, { ref: refContent },
|
|
52
|
+
`Ref: ${ref.current ? `set ${ref.current.nodeName}` : "not set"}`,
|
|
53
|
+
React.createElement("br", null),
|
|
54
|
+
`RefContent: ${refContent.current ? `set ${refContent.current.nodeName}` : "not set"}`,
|
|
55
|
+
React.createElement("br", null)))));
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export { Primary, RefsDemo, };
|
|
59
|
+
export default meta;
|
|
60
|
+
//# sourceMappingURL=StickyHeader.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyHeader.stories.js","sourceRoot":"","sources":["../../../../src/components/layout/header/StickyHeader.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAI7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,IAAI,GAAS;IACf,KAAK,EAAE,uCAAuC;IAC9C,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5B,QAAQ,EAAE;QACN,QAAQ,EAAE;YACN,OAAO,EAAE;gBACL,OAAO,EAAE,IAAI;aAChB;YACD,WAAW,EAAE,gBAAgB;SAChC;QACD,QAAQ,EAAE;YACN,OA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AAE,UAAU;oBAChC,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE;oBAAC,+BAAM;oBACxE,eAAe,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE;oBAAC,+BAAM,CAC3E,CACZ,CAChB,CACN,CAAC;IACN,CAAC;CACJ,CAAC;AAEF,OAAO,EACH,OAAO,EACP,QAAQ,GACX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { Header } from "./Header";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof Header>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
export { Primary, };
|
|
7
|
+
export default meta;
|
|
8
|
+
//# sourceMappingURL=Header.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Header.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,QAAA,MAAM,OAAO,EAAE,KAkBd,CAAC;AAEF,OAAO,EACH,OAAO,GACV,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Header } from "./Header.js";
|
|
3
|
+
import { List } from "./List.js";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Layout/List/Header",
|
|
6
|
+
component: Header,
|
|
7
|
+
tags: ["autodocs", "layout"],
|
|
8
|
+
};
|
|
9
|
+
const Primary = {
|
|
10
|
+
args: {
|
|
11
|
+
children: "Section name",
|
|
12
|
+
},
|
|
13
|
+
render: (args) => {
|
|
14
|
+
return (React.createElement(List, null,
|
|
15
|
+
React.createElement(Header, { ...args }),
|
|
16
|
+
React.createElement(List.Item, null, "Item 1"),
|
|
17
|
+
React.createElement(List.Item, null, "Item 2"),
|
|
18
|
+
React.createElement(List.Item, null, "Item 3"),
|
|
19
|
+
React.createElement(Header, { ...args }),
|
|
20
|
+
React.createElement(List.Item, null, "Item 1"),
|
|
21
|
+
React.createElement(List.Item, null, "Item 2"),
|
|
22
|
+
React.createElement(List.Item, null, "Item 3")));
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export { Primary, };
|
|
26
|
+
export default meta;
|
|
27
|
+
//# sourceMappingURL=Header.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.stories.js","sourceRoot":"","sources":["../../../../src/components/layout/list/Header.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,IAAI,GAAS;IACf,KAAK,EAAE,+BAA+B;IACtC,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;CAC/B,CAAC;AAIF,MAAM,OAAO,GAAU;IACnB,IAAI,EAAE;QACF,QAAQ,EAAE,cAAc;KAC3B;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACb,OAAO,CACH,oBAAC,IAAI;YACD,oBAAC,MAAM,OAAK,IAAI,GAAI;YACpB,oBAAC,IAAI,CAAC,IAAI,iBAAmB;YAC7B,oBAAC,IAAI,CAAC,IAAI,iBAAmB;YAC7B,oBAAC,IAAI,CAAC,IAAI,iBAAmB;YAC7B,oBAAC,MAAM,OAAK,IAAI,GAAI;YACpB,oBAAC,IAAI,CAAC,IAAI,iBAAmB;YAC7B,oBAAC,IAAI,CAAC,IAAI,iBAAmB;YAC7B,oBAAC,IAAI,CAAC,IAAI,iBAAmB,CAC1B,CACV,CAAC;IACN,CAAC;CACJ,CAAC;AAEF,OAAO,EACH,OAAO,GACV,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
2
|
+
import { Item } from "./Item";
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
type Story = StoryObj<typeof Item>;
|
|
5
|
+
declare const Primary: Story;
|
|
6
|
+
declare const Alignment: Story;
|
|
7
|
+
declare const OnClick: Story;
|
|
8
|
+
declare const Complex: Story;
|
|
9
|
+
export { Primary, Alignment, OnClick, Complex, };
|
|
10
|
+
export default meta;
|
|
11
|
+
//# sourceMappingURL=Item.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/list/Item.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAW9B,QAAA,MAAM,IAAI,EAAE,IAoBX,CAAC;AAEF,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,QAAA,MAAM,OAAO,EAAE,KA0Bd,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAkBhB,CAAC;AAEF,QAAA,MAAM,OAAO,EAAE,KAgBd,CAAC;AAEF,QAAA,MAAM,OAAO,EAAE,KAiBd,CAAC;AAEF,OAAO,EACH,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,GACV,CAAC;AAEF,eAAe,IAAI,CAAC"}
|