Skip to content

Commit

Permalink
Merge pull request #543 from sebgroup/develop
Browse files Browse the repository at this point in the history
Beta release of dynamic forms
  • Loading branch information
mario-subo authored Mar 19, 2021
2 parents 4e55226 + c029079 commit d8eb067
Show file tree
Hide file tree
Showing 35 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/docs/accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Accordion, AccordionItem } from "@sebgroup/react-components/Accordion";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Button } from "@sebgroup/react-components/Button";
import { Textbox } from "@sebgroup/react-components/Textbox";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Breadcrumb, BreadcrumbItem } from "@sebgroup/react-components/Breadcrumb";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const homeIcon: JSX.Element = (
<svg xmlns="http://www.w3.org/2000/svg" width="1.3em" fill="currentColor" viewBox="0 0 16 16" style={{ verticalAlign: "baseline" }}>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Button, ButtonSize, ButtonTheme } from "@sebgroup/react-components/Button";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const importString: string = require("!raw-loader!@sebgroup/react-components/Button/Button");
const code: string = `<Button>Click me</Button>`;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/buttongroup.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { ButtonGroup, ButtonGroupProps } from "@sebgroup/react-components/ButtonGroup";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Button } from "@sebgroup/react-components/Button";

const importString: string = require("!raw-loader!@sebgroup/react-components/ButtonGroup/ButtonGroup");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Docs from "@common/Docs";
import { Carousel, CarouselItem, CarouselProps } from "@sebgroup/react-components/Carousel";
import { Img } from "@sebgroup/react-components/Image";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const images = [
require("../../assets/images/painting-1.jpg"),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Checkbox } from "@sebgroup/react-components/Checkbox/Checkbox";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { FeedbackIndicator, Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";
import { CodeSnippet } from "@common/CodeSnippet";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/closebutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Docs from "@common/Docs";
import { CloseButton } from "@sebgroup/react-components/CloseButton";
import { Slider } from "@sebgroup/react-components/Slider";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const importString: string = require("!raw-loader!@sebgroup/react-components/CloseButton/CloseButton");
const code: string = `<CloseButton />`;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/datepicker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Datepicker } from "@sebgroup/react-components/Datepicker";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const importString: string = require("!raw-loader!@sebgroup/react-components/Datepicker/Datepicker");
const code: string = `<Datepicker value={dateValue} onChange={setDateValue} />`;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Dropdown } from "@sebgroup/react-components/Dropdown";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { CodeSnippet } from "@common/CodeSnippet";

const importString: string = require("!raw-loader!@sebgroup/react-components/Dropdown/Dropdown");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/feedbackindicator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { FeedbackIndicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Checkbox } from "@sebgroup/react-components/Checkbox";
import { RadioButton } from "@sebgroup/react-components/RadioButton";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/image.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Img, ImgProps } from "@sebgroup/react-components/Image/Img";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Button } from "@sebgroup/react-components/Button";
const image: string = require("../../assets/images/rabbit-on-the-spot.jpg");

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/imagecropper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { ImageCropper } from "@sebgroup/react-components/ImageCropper/ImageCropper";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const importString: string = require("!raw-loader!@sebgroup/react-components/ImageCropper/ImageCropper");
const code: string = `<ImageCropper value={image} onChange={setImage} />`;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/loader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Docs from "@common/Docs";
import React from "react";
import { Loader, LoaderSize, LoaderType } from "@sebgroup/react-components/Loader";
import { useDynamicForm, DynamicFormOption } from "@hooks/useDynamicForm";
import { useDynamicForm, DynamicFormOption } from "@sebgroup/react-components/hooks/useDynamicForm";

const importString: string = require("!raw-loader!@sebgroup/react-components/Loader/Loader");
const code: string = `<Loader toggle={toggle} />`;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Docs from "@common/Docs";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Button } from "@sebgroup/react-components/Button";
import { Modal, ModalSize, ModalPosition } from "@sebgroup/react-components/Modal";
import { Textbox } from "@sebgroup/react-components/Textbox";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/notification.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Notification, NotificationProps } from "@sebgroup/react-components/Notification";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Button } from "@sebgroup/react-components/Button";
import { CodeSnippet } from "@common/CodeSnippet";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Docs from "@common/Docs";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Pagination, Page, CustomNavs, PaginationProps } from "@sebgroup/react-components/Pagination";
import CPUIcon from "../../../static/icons/cpu.svg";
import GameControllerIcon from "../../../static/icons/game-controller.svg";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/progressbar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { ProgressBar, ProgressBarProps } from "@sebgroup/react-components/ProgressBar";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Slider } from "@sebgroup/react-components/Slider";

const importString: string = require("!raw-loader!@sebgroup/react-components/ProgressBar/ProgressBar");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/radiobutton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Docs from "@common/Docs";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { RadioButton, RadioGroup } from "@sebgroup/react-components/RadioButton";
import { CodeSnippet } from "@common/CodeSnippet";
import { Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/rating.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Rating } from "@sebgroup/react-components/Rating";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import HeartSVG from "../../../static/icons/heart.svg";

const importString: string = require("!raw-loader!@sebgroup/react-components/Rating/Rating");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/slider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { SliderLabel, Slider, SliderTheme } from "@sebgroup/react-components/Slider";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";

const importString: string = require("!raw-loader!@sebgroup/react-components/Slider/Slider");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/stepper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Docs from "@common/Docs";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Stepper } from "@sebgroup/react-components/Stepper";
import { Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/steptracker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import Docs from "@common/Docs";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { StepTracker } from "@sebgroup/react-components/StepTracker";
import StepLabel, { StepLabelProps } from "@sebgroup/react-components/StepTracker/StepLabel";

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/table.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Table, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow } from "@sebgroup/react-components/Table";
import { useDynamicForm } from "@hooks/useDynamicForm";
import { useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import makeData from "@utils/makeData";
import { Dropdown } from "@sebgroup/react-components/Dropdown";
import { checkDynamicFormSelectedKey } from "@utils/helpers";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Textarea } from "@sebgroup/react-components/Textarea";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";

const importString: string = require("!raw-loader!@sebgroup/react-components/Textarea/Textarea");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/textbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Docs from "@common/Docs";
import SearchIcon from "../../../static/icons/search.svg";
import { Textbox } from "@sebgroup/react-components/Textbox";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";

const importString: string = require("!raw-loader!@sebgroup/react-components/Textbox/Textbox");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/textlabel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { TextLabel } from "@sebgroup/react-components/TextLabel";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const TextLabelPage: React.FC = React.memo(() => {
const importString: string = require("!raw-loader!@sebgroup/react-components/TextLabel/TextLabel");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/timeline.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Timeline, TimelineDirection, TimelineItem } from "@sebgroup/react-components/Timeline";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { loremIpsum } from "lorem-ipsum";

const importString: string = require("!raw-loader!@sebgroup/react-components/Timeline/Timeline");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/timer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Timer } from "@sebgroup/react-components/Timer";
import { DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const importString: string = require("!raw-loader!@sebgroup/react-components/Timer/Timer");
const code: string = `<Timer duration={90000} callback={() => { console.log("TIMER ENDED callback"); }} />`;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/toggle-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { ToggleSelector, ToggleSelectorItem } from "@sebgroup/react-components/ToggleSelector";
import { DynamicFormOption, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";
import { Indicator, IndicatorType } from "@sebgroup/react-components/FeedbackIndicator";
import LaughingIcon from "../../../static/icons/emoji-laughing-fill.svg";
import DizzyIcon from "../../../static/icons/emoji-dizzy-fill.svg";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Toggle } from "@sebgroup/react-components/Toggle";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const TogglePage: React.FC = () => {
const importString: string = require("!raw-loader!@sebgroup/react-components/Toggle/Toggle");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Docs from "@common/Docs";
import { Tooltip } from "@sebgroup/react-components/Tooltip";
import { Notification } from "@sebgroup/react-components/Notification";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const TooltipPage: React.FC = () => {
const importString: string = require("!raw-loader!@sebgroup/react-components/Tooltip/Tooltip");
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/docs/video.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Docs from "@common/Docs";
import { Video } from "@sebgroup/react-components/Video";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@hooks/useDynamicForm";
import { DynamicFormOption, DynamicFormSection, useDynamicForm } from "@sebgroup/react-components/hooks/useDynamicForm";

const VideoPage: React.FC = () => {
const defaultSrc: string = "https://www.youtube.com/embed/f19fctL72CY";
Expand Down
2 changes: 1 addition & 1 deletion docs/src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamicFormOption } from "@hooks/useDynamicForm";
import { DynamicFormOption } from "@sebgroup/react-components/hooks/useDynamicForm";

/** check if key selected from options */

Expand Down
1 change: 1 addition & 0 deletions lib/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./useCombinedRef";
export * from "./useDynamicForm";
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useState, ReactNode, useMemo, useCallback } from "react";
import classnames from "classnames";

import { Checkbox } from "@sebgroup/react-components/Checkbox";
import { Textbox } from "@sebgroup/react-components/Textbox";
import { Textarea } from "@sebgroup/react-components/Textarea";
import { Dropdown, getValueOfMultipleSelect } from "@sebgroup/react-components/Dropdown";
import { Datepicker } from "@sebgroup/react-components/Datepicker";
import { Stepper } from "@sebgroup/react-components/Stepper";
import { RadioButton, RadioGroup } from "@sebgroup/react-components/RadioButton";
import { Checkbox } from "../Checkbox";
import { Textbox } from "../Textbox";
import { Textarea } from "../Textarea";
import { Dropdown, getValueOfMultipleSelect } from "../Dropdown";
import { Datepicker } from "../Datepicker";
import { Stepper } from "../Stepper";
import { RadioButton, RadioGroup } from "../RadioButton";

type DynamicFormInternalStateValue = string | string[] | DynamicFormOption | DynamicFormOption[] | Date | boolean | number;
export interface DynamicFormItem {
Expand Down Expand Up @@ -283,7 +283,6 @@ const DynamicFormItemComponent: React.FC<{
}

case "Dropdown": {
console.log(props.state);
formItem = (
<>
{props.item?.label && <label>{props.item?.label}</label>}
Expand Down

0 comments on commit d8eb067

Please sign in to comment.