From 2b35a4239ccdd4720d4edff3ffce3dfd99abdadf Mon Sep 17 00:00:00 2001 From: Navin Date: Mon, 16 Nov 2020 20:41:46 +0530 Subject: [PATCH 01/13] =?UTF-8?q?fix(toast):=20=F0=9F=90=9B=20=20useToast?= =?UTF-8?q?=20is=20not=20a=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/toast/ToastProvider.tsx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/toast/ToastProvider.tsx b/src/toast/ToastProvider.tsx index b9dce5cc2..fbb4f4ce8 100644 --- a/src/toast/ToastProvider.tsx +++ b/src/toast/ToastProvider.tsx @@ -1,11 +1,11 @@ import React from "react"; import ReactDOM from "react-dom"; import { canUseDOM } from "reakit-utils"; +import { objectKeys } from "@chakra-ui/utils"; +import { isFunction } from "../utils"; import { ToastController } from "./ToastController"; -import { isFunction, createContext } from "../utils"; import { IToast, useToastState, ToastStateReturn } from "./ToastState"; -import { objectKeys } from "@chakra-ui/utils"; const DEFAULT_TIMEOUT = 5000; const PLACEMENTS = { @@ -24,12 +24,26 @@ interface IToastContext extends ToastStateReturn { toastTypes: ToastTypes; } -export const [ToastContextProvider, useToast] = createContext({ - name: "useToast", - errorMessage: - "The `useToasts` hook must be called from a descendent of the `ToastProvider`.", - strict: true, -}); +const ToastContext = React.createContext(undefined); +export const ToastContextProvider = ToastContext.Provider; +export function useToast() { + const context = React.useContext(ToastContext); + + if (!context) { + throw new Error( + "The `useToasts` hook must be called from a descendent of the `ToastProvider`.", + ); + } + + return context; +} + +// export const [ToastContextProvider, useToast] = createContext({ +// name: "useToast", +// errorMessage: +// "", +// strict: true, +// }); export type ToastTypes = Record< string, From 551292113dfe16f613027150f9c53143041a0c1d Mon Sep 17 00:00:00 2001 From: Navin Date: Mon, 16 Nov 2020 20:46:02 +0530 Subject: [PATCH 02/13] chore(release): 0.1.1-beta.1 --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6139e6cab..de50b0d57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,42 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.1.1-beta.1](https://github.com/timelessco/renderless-components/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2020-11-16) + +### Features + +- accordion types improvements + ([#143](https://github.com/timelessco/renderless-components/issues/143)) + ([7e45f06](https://github.com/timelessco/renderless-components/commit/7e45f069a2a9ee6de095b6bbb2c46bf232694dab)) + +### Bug Fixes + +- **toast:** 🐛 useToast is not a function + ([2b35a42](https://github.com/timelessco/renderless-components/commit/2b35a4239ccdd4720d4edff3ffce3dfd99abdadf)) + +### Tests + +- refactored all tests + ([#146](https://github.com/timelessco/renderless-components/issues/146)) + ([e61a507](https://github.com/timelessco/renderless-components/commit/e61a50794caf2696c24314e648d0013cb57f798c)) + +### Docs + +- **story:** ✨ isolate story styles with post css + ([#149](https://github.com/timelessco/renderless-components/issues/149)) + ([d66712c](https://github.com/timelessco/renderless-components/commit/d66712caad314443db2796df1bb78222507d5f14)) +- **update:** 📝 beta as deps in stories + ([c79dc71](https://github.com/timelessco/renderless-components/commit/c79dc71be6e91c8db0efa0ef0d6b451439e45e8f)) + +### Others + +- reorganize slider components & improved js generation script + ([#148](https://github.com/timelessco/renderless-components/issues/148)) + ([9e9ef1d](https://github.com/timelessco/renderless-components/commit/9e9ef1d4a04c6210f53797488581c1aa64550011)), + closes [#150](https://github.com/timelessco/renderless-components/issues/150) +- **release:** 0.1.1-beta.0 + ([0820b0a](https://github.com/timelessco/renderless-components/commit/0820b0ab80f05f63264ce2fe3d383fbb997bebca)) + ### [0.1.1-beta.0](https://github.com/timelessco/renderless-components/compare/v0.1.1-alpha.6...v0.1.1-beta.0) (2020-11-09) ### Docs diff --git a/package.json b/package.json index bfcb6e955..e78ddc447 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "renderless-components", - "version": "0.1.1-beta.0", + "version": "0.1.1-beta.1", "description": "Renderless Components", "keywords": [ "renderless-component" From 3fc971c827314d6c7b84bbbc0b6c9b5f9b9b2e0b Mon Sep 17 00:00:00 2001 From: Navin Date: Mon, 16 Nov 2020 21:07:04 +0530 Subject: [PATCH 03/13] =?UTF-8?q?chore(toast):=20=F0=9F=93=8C=20=20pin=20t?= =?UTF-8?q?he=20storybook=20deps=20to=20the=20latest=20beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/create-preview-tabs.ts | 2 +- src/toast/stories/ToastBasic.stories.tsx | 4 ++-- src/toast/stories/ToastCSSAnimated.stories.tsx | 4 ++-- src/toast/stories/ToastReactSpring.stories.tsx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/create-preview-tabs.ts b/scripts/create-preview-tabs.ts index be3b98c04..eeadfba82 100644 --- a/scripts/create-preview-tabs.ts +++ b/scripts/create-preview-tabs.ts @@ -13,7 +13,7 @@ interface Props { export function createPreviewTabs(props: Props) { const { js, ts, css, deps: extraDeps = [] } = props; - const deps = ["renderless-components@0.1.1-beta.0", ...extraDeps]; + const deps = ["renderless-components@0.1.1-beta.1", ...extraDeps]; const tabs = []; if (js) { diff --git a/src/toast/stories/ToastBasic.stories.tsx b/src/toast/stories/ToastBasic.stories.tsx index bb8166945..417dc466f 100644 --- a/src/toast/stories/ToastBasic.stories.tsx +++ b/src/toast/stories/ToastBasic.stories.tsx @@ -14,11 +14,11 @@ import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; const sandboxJs = CreateToastSandbox({ type: "jsx", - deps: ["renderless-components@0.1.1-beta.0"], + deps: ["renderless-components@0.1.1-beta.1"], }); const sandboxTs = CreateToastSandbox({ type: "tsx", - deps: ["renderless-components@0.1.1-beta.0"], + deps: ["renderless-components@0.1.1-beta.1"], }); export default { diff --git a/src/toast/stories/ToastCSSAnimated.stories.tsx b/src/toast/stories/ToastCSSAnimated.stories.tsx index 9c0600275..f6cee7cc3 100644 --- a/src/toast/stories/ToastCSSAnimated.stories.tsx +++ b/src/toast/stories/ToastCSSAnimated.stories.tsx @@ -14,11 +14,11 @@ import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; const sandboxJs = CreateToastSandbox({ type: "jsx", - deps: ["renderless-components@0.1.1-beta.0", "react-transition-group"], + deps: ["renderless-components@0.1.1-beta.1", "react-transition-group"], }); const sandboxTs = CreateToastSandbox({ type: "tsx", - deps: ["renderless-components@0.1.1-beta.0", "react-transition-group"], + deps: ["renderless-components@0.1.1-beta.1", "react-transition-group"], }); export default { diff --git a/src/toast/stories/ToastReactSpring.stories.tsx b/src/toast/stories/ToastReactSpring.stories.tsx index 8b3e2eb8f..e676b0575 100644 --- a/src/toast/stories/ToastReactSpring.stories.tsx +++ b/src/toast/stories/ToastReactSpring.stories.tsx @@ -14,11 +14,11 @@ import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; const sandboxJs = CreateToastSandbox({ type: "jsx", - deps: ["renderless-components@0.1.1-beta.0", "react-spring"], + deps: ["renderless-components@0.1.1-beta.1", "react-spring"], }); const sandboxTs = CreateToastSandbox({ type: "tsx", - deps: ["renderless-components@0.1.1-beta.0", "react-spring"], + deps: ["renderless-components@0.1.1-beta.1", "react-spring"], }); export default { From 797aefaf6050372af6e4e230ae9fb05be8707f0e Mon Sep 17 00:00:00 2001 From: Navin Date: Mon, 16 Nov 2020 21:09:52 +0530 Subject: [PATCH 04/13] =?UTF-8?q?refactor(utils):=20=E2=99=BB=EF=B8=8F=20?= =?UTF-8?q?=20remove=20createContext=20utils=20&=20its=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/toast/ToastProvider.tsx | 7 ------ src/utils/index.ts | 50 ------------------------------------- src/utils/utils.test.tsx | 50 +------------------------------------ 3 files changed, 1 insertion(+), 106 deletions(-) diff --git a/src/toast/ToastProvider.tsx b/src/toast/ToastProvider.tsx index fbb4f4ce8..10224675a 100644 --- a/src/toast/ToastProvider.tsx +++ b/src/toast/ToastProvider.tsx @@ -38,13 +38,6 @@ export function useToast() { return context; } -// export const [ToastContextProvider, useToast] = createContext({ -// name: "useToast", -// errorMessage: -// "", -// strict: true, -// }); - export type ToastTypes = Record< string, React.FC< diff --git a/src/utils/index.ts b/src/utils/index.ts index fca316de9..349846b7f 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,3 @@ -import React from "react"; import { warn } from "@chakra-ui/utils"; import { Booleanish } from "./types"; @@ -70,55 +69,6 @@ export const dataAttr = (condition: boolean | undefined) => export const ariaAttr = (condition: boolean | undefined) => condition ? true : undefined; -export interface CreateContextOptions { - /** - * If `true`, React will throw if context is `null` or `undefined` - * In some cases, you might want to support nested context, so you can set it to `false` - */ - strict?: boolean; - /** - * Error message to throw if the context is `undefined` - */ - errorMessage?: string; - /** - * The display name of the context - */ - name?: string; -} - -type CreateContextReturn = [React.Provider, () => T, React.Context]; - -/** - * Creates a named context, provider, and hook. - * - * @param options create context options - */ -export function createContext(options: CreateContextOptions = {}) { - const { - strict = true, - errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider", - name, - } = options; - - const Context = React.createContext(undefined); - - Context.displayName = name; - - function useContext() { - const context = React.useContext(Context); - - if (!context && strict) { - throw new Error(errorMessage); - } - - return context; - } - - return [Context.Provider, useContext, Context] as CreateContextReturn< - ContextType - >; -} - export const cx = (...classNames: any[]) => classNames.filter(Boolean).join(" "); diff --git a/src/utils/utils.test.tsx b/src/utils/utils.test.tsx index 441bd0f5d..7b6521941 100644 --- a/src/utils/utils.test.tsx +++ b/src/utils/utils.test.tsx @@ -1,6 +1,5 @@ import React from "react"; import MockDate from "mockdate"; -import { render } from "reakit-test-utils"; import { parseDate, @@ -8,7 +7,7 @@ import { parseRangeDate, isInvalidDateRange, } from "./date"; -import { clampValue, createContext, valueToPercent, getOptimumValue } from "."; +import { clampValue, valueToPercent, getOptimumValue } from "."; describe("Utils", () => { test("parseDate", () => { @@ -118,53 +117,6 @@ afterAll(() => { console.error = oldLog; }); -describe("createContext", () => { - it("should create a context", () => { - const [Provider, useContext, Context] = createContext({ - errorMessage: "context is undefined", - name: "Test", - }); - - const ExampleContext: React.FC = () => { - const { count } = useContext() as any; - - return

{count}

; - }; - - const { getByTestId } = render( - - - , - ); - - expect(getByTestId("val")).toHaveTextContent("1"); - }); - - it("should throw error if Provider not wrapped", () => { - const [Provider, useContext, Context] = createContext({ - errorMessage: "context is undefined", - name: "Test", - }); - - const ExampleContext: React.FC = () => { - const { count } = useContext() as any; - return

{count}

; - }; - - const spy = jest.spyOn(ErrorBoundary.prototype, "componentDidCatch"); - - render( - - - , - ); - - expect(ErrorBoundary.prototype.componentDidCatch).toHaveBeenCalled(); - - expect(spy).toHaveBeenCalledTimes(1); - }); -}); - class ErrorBoundary extends React.Component { constructor(props: any) { super(props); From 64f5bee61887f1d56226229776da8b74ca22d3e6 Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 10:58:48 +0530 Subject: [PATCH 05/13] =?UTF-8?q?build(reakit):=20=F0=9F=93=8C=20=20make?= =?UTF-8?q?=20reakit=20as=20a=20peer=20deps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e78ddc447..54ea1379f 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ "@react-aria/interactions": "^3.3.0", "@react-aria/utils": "3.4.0", "date-fns": "2.16.1", - "reakit": "1.3.0", "reakit-system": "0.15.0", "reakit-utils": "0.15.0", "uuid": "8.3.1" @@ -131,6 +130,7 @@ "react-test-renderer": "16.14.0", "react-transition-group": "4.4.1", "react-virtual": "^2.3.1", + "reakit": "1.3.0", "reakit-test-utils": "0.14.5", "rimraf": "3.0.2", "sort-package-json": "1.46.1", @@ -144,7 +144,8 @@ }, "peerDependencies": { "react": "^16.8.0", - "react-dom": "^16.8.0" + "react-dom": "^16.8.0", + "reakit": "^1.3.0" }, "publishConfig": { "access": "public" From b205d1c9aa9f1cf8382b8ff0a0322429eb5a3462 Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 11:00:09 +0530 Subject: [PATCH 06/13] =?UTF-8?q?refactor(uuid):=20=E2=9E=96=20=20remove?= =?UTF-8?q?=20uuid=20from=20deps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 54ea1379f..4ebf6c1b9 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,7 @@ "@react-aria/utils": "3.4.0", "date-fns": "2.16.1", "reakit-system": "0.15.0", - "reakit-utils": "0.15.0", - "uuid": "8.3.1" + "reakit-utils": "0.15.0" }, "devDependencies": { "@babel/cli": "7.12.1", From 9fb7534a27ac74491304032513e74fa31b4a3ca1 Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 11:04:23 +0530 Subject: [PATCH 07/13] chore(release): 0.1.1-beta.2 --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de50b0d57..2dbd283bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,32 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.1.1-beta.2](https://github.com/timelessco/renderless-components/compare/v0.1.1-beta.1...v0.1.1-beta.2) (2020-11-17) + +### Bug Fixes + +- **toast:** 🐛 useToast is not a function + ([2b35a42](https://github.com/timelessco/renderless-components/commit/2b35a4239ccdd4720d4edff3ffce3dfd99abdadf)) + +### Others + +- **release:** 0.1.1-beta.1 + ([5512921](https://github.com/timelessco/renderless-components/commit/551292113dfe16f613027150f9c53143041a0c1d)) +- **toast:** 📌 pin the storybook deps to the latest beta + ([3fc971c](https://github.com/timelessco/renderless-components/commit/3fc971c827314d6c7b84bbbc0b6c9b5f9b9b2e0b)) + +### Build System + +- **reakit:** 📌 make reakit as a peer deps + ([64f5bee](https://github.com/timelessco/renderless-components/commit/64f5bee61887f1d56226229776da8b74ca22d3e6)) + +### Code Refactoring + +- **utils:** ♻️ remove createContext utils & its test + ([797aefa](https://github.com/timelessco/renderless-components/commit/797aefaf6050372af6e4e230ae9fb05be8707f0e)) +- **uuid:** ➖ remove uuid from deps + ([b205d1c](https://github.com/timelessco/renderless-components/commit/b205d1c9aa9f1cf8382b8ff0a0322429eb5a3462)) + ### [0.1.1-beta.1](https://github.com/timelessco/renderless-components/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2020-11-16) ### Features diff --git a/package.json b/package.json index 4ebf6c1b9..cc5293ae8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "renderless-components", - "version": "0.1.1-beta.1", + "version": "0.1.1-beta.2", "description": "Renderless Components", "keywords": [ "renderless-component" From 013feeede303944dc51ba2a4aff6d10d944bfbdf Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 11:09:45 +0530 Subject: [PATCH 08/13] =?UTF-8?q?chore(reakitwarning):=20=E2=9E=95=20=20ad?= =?UTF-8?q?d=20reakit=20warning=20to=20the=20prod=20deps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- yarn.lock | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index cc5293ae8..c0f065ca2 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "@react-aria/utils": "3.4.0", "date-fns": "2.16.1", "reakit-system": "0.15.0", - "reakit-utils": "0.15.0" + "reakit-utils": "0.15.0", + "reakit-warning": "^0.6.0" }, "devDependencies": { "@babel/cli": "7.12.1", diff --git a/yarn.lock b/yarn.lock index aee3e3393..6a3e2b80a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16082,16 +16082,16 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= -uuid@8.3.1, uuid@^8.0.0, uuid@^8.3.0: - version "8.3.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31" - integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg== - uuid@^3.1.0, uuid@^3.3.2: version "3.4.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.0.0, uuid@^8.3.0: + version "8.3.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.1.tgz#2ba2e6ca000da60fce5a196954ab241131e05a31" + integrity sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg== + v8-compile-cache@^2.0.3: version "2.1.1" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" From c8bf70a28d17c6593b42993db3a8b70b242ba98c Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 11:10:00 +0530 Subject: [PATCH 09/13] chore(release): 0.1.1-beta.3 --- CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dbd283bd..6e999094e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.1.1-beta.3](https://github.com/timelessco/renderless-components/compare/v0.1.1-beta.2...v0.1.1-beta.3) (2020-11-17) + +### Bug Fixes + +- **toast:** 🐛 useToast is not a function + ([2b35a42](https://github.com/timelessco/renderless-components/commit/2b35a4239ccdd4720d4edff3ffce3dfd99abdadf)) + +### Build System + +- **reakit:** 📌 make reakit as a peer deps + ([64f5bee](https://github.com/timelessco/renderless-components/commit/64f5bee61887f1d56226229776da8b74ca22d3e6)) + +### Code Refactoring + +- **utils:** ♻️ remove createContext utils & its test + ([797aefa](https://github.com/timelessco/renderless-components/commit/797aefaf6050372af6e4e230ae9fb05be8707f0e)) +- **uuid:** ➖ remove uuid from deps + ([b205d1c](https://github.com/timelessco/renderless-components/commit/b205d1c9aa9f1cf8382b8ff0a0322429eb5a3462)) + +### Others + +- **reakitwarning:** ➕ add reakit warning to the prod deps + ([013feee](https://github.com/timelessco/renderless-components/commit/013feeede303944dc51ba2a4aff6d10d944bfbdf)) +- **release:** 0.1.1-beta.1 + ([5512921](https://github.com/timelessco/renderless-components/commit/551292113dfe16f613027150f9c53143041a0c1d)) +- **release:** 0.1.1-beta.2 + ([9fb7534](https://github.com/timelessco/renderless-components/commit/9fb7534a27ac74491304032513e74fa31b4a3ca1)) +- **toast:** 📌 pin the storybook deps to the latest beta + ([3fc971c](https://github.com/timelessco/renderless-components/commit/3fc971c827314d6c7b84bbbc0b6c9b5f9b9b2e0b)) + ### [0.1.1-beta.2](https://github.com/timelessco/renderless-components/compare/v0.1.1-beta.1...v0.1.1-beta.2) (2020-11-17) ### Bug Fixes diff --git a/package.json b/package.json index c0f065ca2..0fcb8848a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "renderless-components", - "version": "0.1.1-beta.2", + "version": "0.1.1-beta.3", "description": "Renderless Components", "keywords": [ "renderless-component" From 11267379fdd302fa56030d56799927a6557ef36f Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 11:35:31 +0530 Subject: [PATCH 10/13] =?UTF-8?q?docs(update):=20=E2=9E=95=20=20add=20reak?= =?UTF-8?q?it=20to=20the=20deps=20list=20for=20csb=20examples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 10 ++++++++-- scripts/create-preview-tabs.ts | 2 +- src/toast/stories/ToastBasic.stories.tsx | 4 ++-- src/toast/stories/ToastCSSAnimated.stories.tsx | 12 ++++++++++-- src/toast/stories/ToastReactSpring.stories.tsx | 4 ++-- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 0fcb8848a..b6320ce75 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,15 @@ { "name": "renderless-components", "version": "0.1.1-beta.3", - "description": "Renderless Components", + "description": "Renderless Components for building accessible components with any UI", "keywords": [ - "renderless-component" + "renderless-component", + "reakit", + "a11y", + "react", + "ui", + "toolkit", + "components" ], "homepage": "https://github.com/timelessco/renderless-components#readme", "bugs": { diff --git a/scripts/create-preview-tabs.ts b/scripts/create-preview-tabs.ts index eeadfba82..f00155c87 100644 --- a/scripts/create-preview-tabs.ts +++ b/scripts/create-preview-tabs.ts @@ -13,7 +13,7 @@ interface Props { export function createPreviewTabs(props: Props) { const { js, ts, css, deps: extraDeps = [] } = props; - const deps = ["renderless-components@0.1.1-beta.1", ...extraDeps]; + const deps = ["renderless-components@0.1.1-beta.3", "reakit", ...extraDeps]; const tabs = []; if (js) { diff --git a/src/toast/stories/ToastBasic.stories.tsx b/src/toast/stories/ToastBasic.stories.tsx index 417dc466f..3d4784416 100644 --- a/src/toast/stories/ToastBasic.stories.tsx +++ b/src/toast/stories/ToastBasic.stories.tsx @@ -14,11 +14,11 @@ import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; const sandboxJs = CreateToastSandbox({ type: "jsx", - deps: ["renderless-components@0.1.1-beta.1"], + deps: ["renderless-components@0.1.1-beta.3", "reakit"], }); const sandboxTs = CreateToastSandbox({ type: "tsx", - deps: ["renderless-components@0.1.1-beta.1"], + deps: ["renderless-components@0.1.1-beta.3", "reakit"], }); export default { diff --git a/src/toast/stories/ToastCSSAnimated.stories.tsx b/src/toast/stories/ToastCSSAnimated.stories.tsx index f6cee7cc3..ca9c3de93 100644 --- a/src/toast/stories/ToastCSSAnimated.stories.tsx +++ b/src/toast/stories/ToastCSSAnimated.stories.tsx @@ -14,11 +14,19 @@ import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; const sandboxJs = CreateToastSandbox({ type: "jsx", - deps: ["renderless-components@0.1.1-beta.1", "react-transition-group"], + deps: [ + "renderless-components@0.1.1-beta.3", + "reakit", + "react-transition-group", + ], }); const sandboxTs = CreateToastSandbox({ type: "tsx", - deps: ["renderless-components@0.1.1-beta.1", "react-transition-group"], + deps: [ + "renderless-components@0.1.1-beta.3", + "reakit", + "react-transition-group", + ], }); export default { diff --git a/src/toast/stories/ToastReactSpring.stories.tsx b/src/toast/stories/ToastReactSpring.stories.tsx index e676b0575..96d38c499 100644 --- a/src/toast/stories/ToastReactSpring.stories.tsx +++ b/src/toast/stories/ToastReactSpring.stories.tsx @@ -14,11 +14,11 @@ import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; const sandboxJs = CreateToastSandbox({ type: "jsx", - deps: ["renderless-components@0.1.1-beta.1", "react-spring"], + deps: ["renderless-components@0.1.1-beta.3", "reakit", "react-spring"], }); const sandboxTs = CreateToastSandbox({ type: "tsx", - deps: ["renderless-components@0.1.1-beta.1", "react-spring"], + deps: ["renderless-components@0.1.1-beta.3", "reakit", "react-spring"], }); export default { From 9af33ca8d5e11cf2ff40b236ea61076baa4eab85 Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 11:47:58 +0530 Subject: [PATCH 11/13] =?UTF-8?q?docs(stories):=20=F0=9F=93=9D=20=20update?= =?UTF-8?q?=20select=20examples=20with=20proper=20package=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stories/AccordionBasic.component.tsx | 1 - .../stories/AccordionBasic.stories.tsx | 2 +- src/select/stories/Select.component.tsx | 2 +- .../stories/SelectControlled.component.tsx | 75 ++++++++++++++++++- src/select/stories/SelectCustom.component.tsx | 75 ++++++++++++++++++- .../stories/SelectDynamic.component.tsx | 75 ++++++++++++++++++- src/select/stories/SelectFetch.component.tsx | 2 +- .../stories/SelectMultiple.component.tsx | 75 ++++++++++++++++++- .../stories/SelectVirtual.component.tsx | 75 ++++++++++++++++++- .../stories/SelectWindows.component.tsx | 75 ++++++++++++++++++- src/select/stories/fruits.ts | 71 ------------------ 11 files changed, 441 insertions(+), 87 deletions(-) delete mode 100644 src/select/stories/fruits.ts diff --git a/src/accordion/stories/AccordionBasic.component.tsx b/src/accordion/stories/AccordionBasic.component.tsx index 3c9f1c9ec..8e8e5eca8 100644 --- a/src/accordion/stories/AccordionBasic.component.tsx +++ b/src/accordion/stories/AccordionBasic.component.tsx @@ -6,7 +6,6 @@ import { AccordionTrigger, useAccordionState, } from "renderless-components"; -import { AccordionInitialState } from "../types"; export function App(props: any) { const state = useAccordionState(props); diff --git a/src/accordion/stories/AccordionBasic.stories.tsx b/src/accordion/stories/AccordionBasic.stories.tsx index 58a9bcbaa..a1d2d5f78 100644 --- a/src/accordion/stories/AccordionBasic.stories.tsx +++ b/src/accordion/stories/AccordionBasic.stories.tsx @@ -4,8 +4,8 @@ import { Meta } from "@storybook/react"; import { CompositeState } from "reakit/ts"; import { AccordionInitialState } from "../types"; import { App as Accordion } from "./AccordionBasic.component"; -import { accordionBasicTemplate, accordionBasicTemplateJs } from "./templates"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; +import { accordionBasicTemplate, accordionBasicTemplateJs } from "./templates"; export const Default: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); diff --git a/src/select/stories/SelectControlled.component.tsx b/src/select/stories/SelectControlled.component.tsx index 814d9f3f4..726adf055 100644 --- a/src/select/stories/SelectControlled.component.tsx +++ b/src/select/stories/SelectControlled.component.tsx @@ -7,8 +7,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; -import { fruits } from "./fruits"; +} from "renderless-components"; export const App: React.FC = () => { const [fruit, setFruit] = React.useState(null); @@ -75,3 +74,75 @@ const SelectComp: React.FC = props => { }; export default App; + +const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/select/stories/SelectCustom.component.tsx b/src/select/stories/SelectCustom.component.tsx index 66e726b4a..201c98186 100644 --- a/src/select/stories/SelectCustom.component.tsx +++ b/src/select/stories/SelectCustom.component.tsx @@ -6,8 +6,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; -import { fruits } from "./fruits"; +} from "renderless-components"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); @@ -45,3 +44,75 @@ export const App: React.FC = props => { }; export default App; + +const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/select/stories/SelectDynamic.component.tsx b/src/select/stories/SelectDynamic.component.tsx index b31b9ec31..81fad6d13 100644 --- a/src/select/stories/SelectDynamic.component.tsx +++ b/src/select/stories/SelectDynamic.component.tsx @@ -6,8 +6,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; -import { fruits } from "./fruits"; +} from "renderless-components"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); @@ -29,3 +28,75 @@ export const App: React.FC = props => { }; export default App; + +const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/select/stories/SelectFetch.component.tsx b/src/select/stories/SelectFetch.component.tsx index 75234d1e5..1fe82e57b 100644 --- a/src/select/stories/SelectFetch.component.tsx +++ b/src/select/stories/SelectFetch.component.tsx @@ -6,7 +6,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; +} from "renderless-components"; type User = { value: string; label: string }; diff --git a/src/select/stories/SelectMultiple.component.tsx b/src/select/stories/SelectMultiple.component.tsx index debad8075..189050d68 100644 --- a/src/select/stories/SelectMultiple.component.tsx +++ b/src/select/stories/SelectMultiple.component.tsx @@ -6,8 +6,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; -import { fruits } from "./fruits"; +} from "renderless-components"; export const App: React.FC = props => { const [selectedItems, setSelectedItems] = React.useState([]); @@ -68,3 +67,75 @@ export const App: React.FC = props => { }; export default App; + +const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/select/stories/SelectVirtual.component.tsx b/src/select/stories/SelectVirtual.component.tsx index 0a07364e5..611cfe0b4 100644 --- a/src/select/stories/SelectVirtual.component.tsx +++ b/src/select/stories/SelectVirtual.component.tsx @@ -7,8 +7,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; -import { fruits } from "./fruits"; +} from "renderless-components"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, values: fruits, ...props }); @@ -73,3 +72,75 @@ export const App: React.FC = props => { }; export default App; + +const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/select/stories/SelectWindows.component.tsx b/src/select/stories/SelectWindows.component.tsx index 88ec45898..5988fbe9c 100644 --- a/src/select/stories/SelectWindows.component.tsx +++ b/src/select/stories/SelectWindows.component.tsx @@ -6,8 +6,7 @@ import { Select, SelectPopover, SelectOption, -} from "../index"; -import { fruits } from "./fruits"; +} from "renderless-components"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); @@ -87,3 +86,75 @@ export const App: React.FC = props => { }; export default App; + +const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/select/stories/fruits.ts b/src/select/stories/fruits.ts deleted file mode 100644 index 8473b7c35..000000000 --- a/src/select/stories/fruits.ts +++ /dev/null @@ -1,71 +0,0 @@ -export const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; From b7d984c6cd7ff9f1dbe834f68af202aa1a296677 Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 14:12:23 +0530 Subject: [PATCH 12/13] =?UTF-8?q?docs(story):=20=F0=9F=93=9D=20=20update?= =?UTF-8?q?=20csb=20template=20for=20utils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/create-preview-tabs.ts | 81 +++++++++++------- src/select/stories/Select.component.tsx | 6 +- .../stories/SelectControlled.component.tsx | 83 ++----------------- .../stories/SelectControlled.stories.tsx | 6 +- src/select/stories/SelectCustom.component.tsx | 79 +----------------- src/select/stories/SelectCustom.stories.tsx | 6 +- .../stories/SelectDynamic.component.tsx | 79 +----------------- src/select/stories/SelectDynamic.stories.tsx | 6 +- src/select/stories/SelectFetch.component.tsx | 6 +- src/select/stories/SelectFetch.stories.tsx | 2 +- .../stories/SelectMultiple.component.tsx | 79 +----------------- src/select/stories/SelectMultiple.stories.tsx | 6 +- .../stories/SelectVirtual.component.tsx | 79 +----------------- src/select/stories/SelectVirtual.stories.tsx | 60 +++++++------- .../stories/SelectWindows.component.tsx | 80 ++---------------- src/select/stories/SelectWindows.stories.tsx | 6 +- src/select/stories/Utils.component.tsx | 71 ++++++++++++++++ src/toast/stories/ToastBasic.component.tsx | 2 +- src/toast/stories/ToastBasic.stories.tsx | 62 +++----------- .../stories/ToastCSSAnimated.component.tsx | 4 +- .../stories/ToastCSSAnimated.stories.tsx | 68 +++------------ .../stories/ToastReactSpring.component.tsx | 3 +- .../stories/ToastReactSpring.stories.tsx | 60 +++----------- ...tils.component.tsx => Utils.component.tsx} | 1 + 24 files changed, 254 insertions(+), 681 deletions(-) create mode 100644 src/select/stories/Utils.component.tsx rename src/toast/stories/{ToastUtils.component.tsx => Utils.component.tsx} (99%) diff --git a/scripts/create-preview-tabs.ts b/scripts/create-preview-tabs.ts index f00155c87..1aaf59704 100644 --- a/scripts/create-preview-tabs.ts +++ b/scripts/create-preview-tabs.ts @@ -1,18 +1,18 @@ -import { - CodeSandboxTemplate, - DEFAULT_REACT_CODESANDBOX, - DEFAULT_REACTJS_CODESANDBOX, -} from "storybook-addon-preview"; +import { CodeSandboxTemplate } from "storybook-addon-preview"; interface Props { js?: string; ts?: string; + jsUtils?: string; + tsUtils?: string; css?: string; deps?: string[]; + jsSandbox?: CodeSandboxTemplate; + tsSandbox?: CodeSandboxTemplate; } export function createPreviewTabs(props: Props) { - const { js, ts, css, deps: extraDeps = [] } = props; + const { js, ts, jsUtils, tsUtils, css, deps: extraDeps = [] } = props; const deps = ["renderless-components@0.1.1-beta.3", "reakit", ...extraDeps]; const tabs = []; @@ -22,7 +22,17 @@ export function createPreviewTabs(props: Props) { template: js, language: "jsx", copy: true, - codesandbox: DEFAULT_REACTJS_CODESANDBOX(deps), + codesandbox: REACTJS_CUSTOM_CODESANDBOX(deps), + }); + } + + if (jsUtils) { + tabs.push({ + tab: "UtilsJS", + template: jsUtils, + language: "jsx", + copy: true, + codesandbox: REACTJS_CUSTOM_CODESANDBOX(deps), }); } @@ -32,7 +42,17 @@ export function createPreviewTabs(props: Props) { template: ts, language: "tsx", copy: true, - codesandbox: DEFAULT_REACT_CODESANDBOX(deps), + codesandbox: REACT_CUSTOM_CODESANDBOX(deps), + }); + } + + if (tsUtils) { + tabs.push({ + tab: "Utils", + template: tsUtils, + language: "tsx", + copy: true, + codesandbox: REACT_CUSTOM_CODESANDBOX(deps), }); } @@ -52,25 +72,28 @@ const joinStrs = (strs: string[]) => { return `[${strs.map(str => `"${str}"`).join(", ")}]`; }; -export const CreateToastSandbox = ({ - type = "tsx", - deps = [], -}: { - type?: string; - deps?: string[]; -}) => { - const utilTab = type === "tsx" ? "Utils.tsx" : "Utils.jsx"; - const ReactTab = type === "tsx" ? "React" : "ReactJS"; +const REACTJS_CUSTOM_CODESANDBOX = (dependencies: string[]) => + new Function(` +var previews = arguments[0]; +return { + framework: "reactjs", + files: { + "src/App.js": previews["ReactJS"][0], + "src/styles.css": previews["CSS"] ? previews["CSS"][0] : "", + "src/Utils.component.js": previews["UtilsJS"] ? previews["UtilsJS"][0] : "", + }, + userDependencies: ${joinStrs(dependencies)}, +};`) as CodeSandboxTemplate; - return new Function(` - var previews = arguments[0]; - return { - framework: "${ReactTab.toLowerCase()}", - files: { - "src/App.${type}": previews["${ReactTab}"][0], - "src/styles.css": previews["CSS"] ? previews["CSS"][0] : "", - "src/ToastUtils.component.${type}": previews["${utilTab}"] ? previews["${utilTab}"][0] : "", - }, - userDependencies: ${joinStrs(deps)}, - };`) as CodeSandboxTemplate; -}; +const REACT_CUSTOM_CODESANDBOX = (dependencies: string[]) => + new Function(` +var previews = arguments[0]; +return { + framework: "react", + files: { + "src/App.tsx": previews["React"][0], + "src/styles.css": previews["CSS"] ? previews["CSS"][0] : "", + "src/Utils.component.tsx": previews["Utils"] ? previews["Utils"][0] : "", + }, + userDependencies: ${joinStrs(dependencies)}, +};`) as CodeSandboxTemplate; diff --git a/src/select/stories/Select.component.tsx b/src/select/stories/Select.component.tsx index 6db75299f..d134bac9f 100644 --- a/src/select/stories/Select.component.tsx +++ b/src/select/stories/Select.component.tsx @@ -1,11 +1,11 @@ import * as React from "react"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; export const App: React.FC = props => { diff --git a/src/select/stories/SelectControlled.component.tsx b/src/select/stories/SelectControlled.component.tsx index 726adf055..7f512edbd 100644 --- a/src/select/stories/SelectControlled.component.tsx +++ b/src/select/stories/SelectControlled.component.tsx @@ -1,13 +1,13 @@ import * as React from "react"; -import { isUndefined } from "@chakra-ui/utils"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; +import { fruits } from "./Utils.component"; export const App: React.FC = () => { const [fruit, setFruit] = React.useState(null); @@ -50,7 +50,8 @@ const SelectComp: React.FC = props => { }); React.useEffect(() => { - if (!isUndefined(value)) select.setSelectedValue(value); + if (value !== undefined) select.setSelectedValue(value); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [select.setSelectedValue, value]); React.useEffect(() => { @@ -74,75 +75,3 @@ const SelectComp: React.FC = props => { }; export default App; - -const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; diff --git a/src/select/stories/SelectControlled.stories.tsx b/src/select/stories/SelectControlled.stories.tsx index f3c28989b..b56074860 100644 --- a/src/select/stories/SelectControlled.stories.tsx +++ b/src/select/stories/SelectControlled.stories.tsx @@ -3,9 +3,11 @@ import { Meta, Story } from "@storybook/react"; import "./Select.css"; import { + utilsTemplate, + utilsTemplateJs, + selectCssTemplate, selectControlledTemplate, selectControlledTemplateJs, - selectCssTemplate, } from "./templates"; import { App as SelectControlled } from "./SelectControlled.component"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; @@ -16,7 +18,9 @@ export default { parameters: { preview: createPreviewTabs({ js: selectControlledTemplateJs, + jsUtils: utilsTemplateJs, ts: selectControlledTemplate, + tsUtils: utilsTemplate, css: selectCssTemplate, }), }, diff --git a/src/select/stories/SelectCustom.component.tsx b/src/select/stories/SelectCustom.component.tsx index 201c98186..ce417713c 100644 --- a/src/select/stories/SelectCustom.component.tsx +++ b/src/select/stories/SelectCustom.component.tsx @@ -1,12 +1,13 @@ import * as React from "react"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; +import { fruits } from "./Utils.component"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); @@ -44,75 +45,3 @@ export const App: React.FC = props => { }; export default App; - -const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; diff --git a/src/select/stories/SelectCustom.stories.tsx b/src/select/stories/SelectCustom.stories.tsx index 1d57c702d..a2adcf4a4 100644 --- a/src/select/stories/SelectCustom.stories.tsx +++ b/src/select/stories/SelectCustom.stories.tsx @@ -3,9 +3,11 @@ import { Meta, Story } from "@storybook/react"; import "./Select.css"; import { + utilsTemplate, + utilsTemplateJs, + selectCssTemplate, selectCustomTemplate, selectCustomTemplateJs, - selectCssTemplate, } from "./templates"; import { App as SelectCustom } from "./SelectCustom.component"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; @@ -16,7 +18,9 @@ export default { parameters: { preview: createPreviewTabs({ js: selectCustomTemplateJs, + jsUtils: utilsTemplateJs, ts: selectCustomTemplate, + tsUtils: utilsTemplate, css: selectCssTemplate, }), }, diff --git a/src/select/stories/SelectDynamic.component.tsx b/src/select/stories/SelectDynamic.component.tsx index 81fad6d13..1355ca287 100644 --- a/src/select/stories/SelectDynamic.component.tsx +++ b/src/select/stories/SelectDynamic.component.tsx @@ -1,12 +1,13 @@ import * as React from "react"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; +import { fruits } from "./Utils.component"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); @@ -28,75 +29,3 @@ export const App: React.FC = props => { }; export default App; - -const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; diff --git a/src/select/stories/SelectDynamic.stories.tsx b/src/select/stories/SelectDynamic.stories.tsx index 668c1fe24..27db6158c 100644 --- a/src/select/stories/SelectDynamic.stories.tsx +++ b/src/select/stories/SelectDynamic.stories.tsx @@ -3,9 +3,11 @@ import { Meta, Story } from "@storybook/react"; import "./Select.css"; import { + utilsTemplate, + utilsTemplateJs, + selectCssTemplate, selectDynamicTemplate, selectDynamicTemplateJs, - selectCssTemplate, } from "./templates"; import { App as SelectDynamic } from "./SelectDynamic.component"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; @@ -16,7 +18,9 @@ export default { parameters: { preview: createPreviewTabs({ js: selectDynamicTemplateJs, + jsUtils: utilsTemplateJs, ts: selectDynamicTemplate, + tsUtils: utilsTemplate, css: selectCssTemplate, }), }, diff --git a/src/select/stories/SelectFetch.component.tsx b/src/select/stories/SelectFetch.component.tsx index 1fe82e57b..3f765d751 100644 --- a/src/select/stories/SelectFetch.component.tsx +++ b/src/select/stories/SelectFetch.component.tsx @@ -1,11 +1,11 @@ import * as React from "react"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; type User = { value: string; label: string }; diff --git a/src/select/stories/SelectFetch.stories.tsx b/src/select/stories/SelectFetch.stories.tsx index 042e42fa1..dca4304f7 100644 --- a/src/select/stories/SelectFetch.stories.tsx +++ b/src/select/stories/SelectFetch.stories.tsx @@ -3,9 +3,9 @@ import { Meta, Story } from "@storybook/react"; import "./Select.css"; import { + selectCssTemplate, selectFetchTemplate, selectFetchTemplateJs, - selectCssTemplate, } from "./templates"; import { App as SelectFetch } from "./SelectFetch.component"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; diff --git a/src/select/stories/SelectMultiple.component.tsx b/src/select/stories/SelectMultiple.component.tsx index 189050d68..1445a8156 100644 --- a/src/select/stories/SelectMultiple.component.tsx +++ b/src/select/stories/SelectMultiple.component.tsx @@ -1,12 +1,13 @@ import * as React from "react"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; +import { fruits } from "./Utils.component"; export const App: React.FC = props => { const [selectedItems, setSelectedItems] = React.useState([]); @@ -67,75 +68,3 @@ export const App: React.FC = props => { }; export default App; - -const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; diff --git a/src/select/stories/SelectMultiple.stories.tsx b/src/select/stories/SelectMultiple.stories.tsx index bfb883378..7d8775a97 100644 --- a/src/select/stories/SelectMultiple.stories.tsx +++ b/src/select/stories/SelectMultiple.stories.tsx @@ -3,9 +3,11 @@ import { Meta, Story } from "@storybook/react"; import "./Select.css"; import { + selectCssTemplate, + utilsTemplate, + utilsTemplateJs, selectMultipleTemplate, selectMultipleTemplateJs, - selectCssTemplate, } from "./templates"; import { App as SelectMultiple } from "./SelectMultiple.component"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; @@ -16,7 +18,9 @@ export default { parameters: { preview: createPreviewTabs({ js: selectMultipleTemplateJs, + jsUtils: utilsTemplateJs, ts: selectMultipleTemplate, + tsUtils: utilsTemplate, css: selectCssTemplate, }), }, diff --git a/src/select/stories/SelectVirtual.component.tsx b/src/select/stories/SelectVirtual.component.tsx index 611cfe0b4..cfe130a7a 100644 --- a/src/select/stories/SelectVirtual.component.tsx +++ b/src/select/stories/SelectVirtual.component.tsx @@ -2,12 +2,13 @@ import * as React from "react"; import { useVirtual } from "react-virtual"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; +import { fruits } from "./Utils.component"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, values: fruits, ...props }); @@ -72,75 +73,3 @@ export const App: React.FC = props => { }; export default App; - -const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; diff --git a/src/select/stories/SelectVirtual.stories.tsx b/src/select/stories/SelectVirtual.stories.tsx index a89feb1e4..9a904c6c9 100644 --- a/src/select/stories/SelectVirtual.stories.tsx +++ b/src/select/stories/SelectVirtual.stories.tsx @@ -1,34 +1,38 @@ -import * as React from "react"; -import { Meta, Story } from "@storybook/react"; +// import * as React from "react"; +// import { Meta, Story } from "@storybook/react"; -import "./Select.css"; -import { - selectVirtualTemplate, - selectVirtualTemplateJs, - selectCssTemplate, -} from "./templates"; -import { App as SelectVirtual } from "./SelectVirtual.component"; -import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; +// import "./Select.css"; +// import { +// utilsTemplate, +// utilsTemplateJs, +// selectVirtualTemplate, +// selectCssTemplate, +// selectVirtualTemplateJs, +// } from "./templates"; +// import { App as SelectVirtual } from "./SelectVirtual.component"; +// import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; -export default { - component: SelectVirtual, - title: "Select/SelectVirtual", - parameters: { - preview: createPreviewTabs({ - js: selectVirtualTemplateJs, - ts: selectVirtualTemplate, - css: selectCssTemplate, - }), - }, - decorators: [ - Story => { - document.body.id = "select"; - return ; - }, - ], -} as Meta; +// export default { +// component: SelectVirtual, +// title: "Select/SelectVirtual", +// parameters: { +// preview: createPreviewTabs({ +// js: selectVirtualTemplateJs, +// jsUtils: utilsTemplateJs, +// ts: selectVirtualTemplate, +// tsUtils: utilsTemplate, +// css: selectCssTemplate, +// }), +// }, +// decorators: [ +// Story => { +// document.body.id = "select"; +// return ; +// }, +// ], +// } as Meta; -const Base: Story = args => ; +// const Base: Story = args => ; // export const Default = Base.bind({}); // Default.args = {}; diff --git a/src/select/stories/SelectWindows.component.tsx b/src/select/stories/SelectWindows.component.tsx index 5988fbe9c..f61024990 100644 --- a/src/select/stories/SelectWindows.component.tsx +++ b/src/select/stories/SelectWindows.component.tsx @@ -1,12 +1,13 @@ import * as React from "react"; import { - SelectInitialState, - useSelectState, Select, - SelectPopover, SelectOption, + SelectPopover, + useSelectState, + SelectInitialState, } from "renderless-components"; +import { fruits } from "./Utils.component"; export const App: React.FC = props => { const select = useSelectState({ gutter: 8, ...props }); @@ -53,6 +54,7 @@ export const App: React.FC = props => { const action = keyMap[event.key as keyof typeof keyMap]; if (action) action(); }, + // eslint-disable-next-line react-hooks/exhaustive-deps [ select.values, select.visible, @@ -86,75 +88,3 @@ export const App: React.FC = props => { }; export default App; - -const fruits = [ - "Acerola", - "Apple", - "Apricots", - "Avocado", - "Banana", - "Blackberries", - "Blackcurrant", - "Blueberries", - "Breadfruit", - "Cantaloupe", - "Carambola", - "Cherimoya", - "Cherries", - "Clementine", - "Coconut Meat", - "Cranberries", - "Custard-Apple", - "Date Fruit", - "Durian", - "Elderberries", - "Feijoa", - "Figs", - "Gooseberries", - "Grapefruit", - "Grapes", - "Guava", - "Honeydew Melon", - "Jackfruit", - "Java-Plum", - "Jujube Fruit", - "Kiwifruit", - "Kumquat", - "Lemon", - "Lime", - "Longan", - "Loquat", - "Lychee", - "Mandarin", - "Mango", - "Mangosteen", - "Mulberries", - "Nectarine", - "Olives", - "Orange", - "Papaya", - "Passion Fruit", - "Peaches", - "Pear", - "Persimmon", - "Pitaya", - "Pineapple", - "Pitanga", - "Plantain", - "Plums", - "Pomegranate", - "Prickly Pear", - "Prunes", - "Pummelo", - "Quince", - "Raspberries", - "Rhubarb", - "Rose-Apple", - "Sapodilla", - "Soursop", - "Strawberries", - "Sugar-Apple", - "Tamarind", - "Tangerine", - "Watermelon", -]; diff --git a/src/select/stories/SelectWindows.stories.tsx b/src/select/stories/SelectWindows.stories.tsx index 8495dc2d1..de190f7cd 100644 --- a/src/select/stories/SelectWindows.stories.tsx +++ b/src/select/stories/SelectWindows.stories.tsx @@ -3,9 +3,11 @@ import { Meta, Story } from "@storybook/react"; import "./Select.css"; import { + utilsTemplate, + utilsTemplateJs, + selectCssTemplate, selectWindowsTemplate, selectWindowsTemplateJs, - selectCssTemplate, } from "./templates"; import { App as SelectWindows } from "./SelectWindows.component"; import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; @@ -16,7 +18,9 @@ export default { parameters: { preview: createPreviewTabs({ js: selectWindowsTemplateJs, + jsUtils: utilsTemplateJs, ts: selectWindowsTemplate, + tsUtils: utilsTemplate, css: selectCssTemplate, }), }, diff --git a/src/select/stories/Utils.component.tsx b/src/select/stories/Utils.component.tsx new file mode 100644 index 000000000..8473b7c35 --- /dev/null +++ b/src/select/stories/Utils.component.tsx @@ -0,0 +1,71 @@ +export const fruits = [ + "Acerola", + "Apple", + "Apricots", + "Avocado", + "Banana", + "Blackberries", + "Blackcurrant", + "Blueberries", + "Breadfruit", + "Cantaloupe", + "Carambola", + "Cherimoya", + "Cherries", + "Clementine", + "Coconut Meat", + "Cranberries", + "Custard-Apple", + "Date Fruit", + "Durian", + "Elderberries", + "Feijoa", + "Figs", + "Gooseberries", + "Grapefruit", + "Grapes", + "Guava", + "Honeydew Melon", + "Jackfruit", + "Java-Plum", + "Jujube Fruit", + "Kiwifruit", + "Kumquat", + "Lemon", + "Lime", + "Longan", + "Loquat", + "Lychee", + "Mandarin", + "Mango", + "Mangosteen", + "Mulberries", + "Nectarine", + "Olives", + "Orange", + "Papaya", + "Passion Fruit", + "Peaches", + "Pear", + "Persimmon", + "Pitaya", + "Pineapple", + "Pitanga", + "Plantain", + "Plums", + "Pomegranate", + "Prickly Pear", + "Prunes", + "Pummelo", + "Quince", + "Raspberries", + "Rhubarb", + "Rose-Apple", + "Sapodilla", + "Soursop", + "Strawberries", + "Sugar-Apple", + "Tamarind", + "Tangerine", + "Watermelon", +]; diff --git a/src/toast/stories/ToastBasic.component.tsx b/src/toast/stories/ToastBasic.component.tsx index 6f29d714b..374ec17fc 100644 --- a/src/toast/stories/ToastBasic.component.tsx +++ b/src/toast/stories/ToastBasic.component.tsx @@ -1,7 +1,7 @@ import React from "react"; import { ToastProvider } from "renderless-components"; -import { Variants, Placements } from "./ToastUtils.component"; +import { Variants, Placements } from "./Utils.component"; export const App: React.FC = () => { return ( diff --git a/src/toast/stories/ToastBasic.stories.tsx b/src/toast/stories/ToastBasic.stories.tsx index 3d4784416..36ae02c7a 100644 --- a/src/toast/stories/ToastBasic.stories.tsx +++ b/src/toast/stories/ToastBasic.stories.tsx @@ -2,66 +2,28 @@ import React from "react"; import { Meta } from "@storybook/react"; import { - toastBasicCssTemplate, + utilsTemplate, + utilsTemplateJs, toastBasicTemplate, toastBasicTemplateJs, - toastUtilsTemplate, - toastUtilsTemplateJs, + toastBasicCssTemplate, } from "./templates"; import "./ToastBasic.css"; import { App as Toast } from "./ToastBasic.component"; -import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; - -const sandboxJs = CreateToastSandbox({ - type: "jsx", - deps: ["renderless-components@0.1.1-beta.3", "reakit"], -}); -const sandboxTs = CreateToastSandbox({ - type: "tsx", - deps: ["renderless-components@0.1.1-beta.3", "reakit"], -}); +import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; export default { component: Toast, title: "Toast/Basic", parameters: { - preview: [ - { - tab: "ReactJS", - template: toastBasicTemplateJs, - language: "jsx", - copy: true, - codesandbox: sandboxJs, - }, - { - tab: "Utils.jsx", - template: toastUtilsTemplateJs, - language: "jsx", - copy: true, - codesandbox: sandboxJs, - }, - { - tab: "React", - template: toastBasicTemplate, - language: "tsx", - copy: true, - codesandbox: sandboxTs, - }, - { - tab: "Utils.tsx", - template: toastUtilsTemplate, - language: "tsx", - copy: true, - codesandbox: sandboxTs, - }, - { - tab: "CSS", - template: toastBasicCssTemplate, - language: "css", - copy: true, - codesandbox: sandboxTs, - }, - ], + preview: createPreviewTabs({ + js: toastBasicTemplateJs, + jsUtils: utilsTemplateJs, + ts: toastBasicTemplate, + tsUtils: utilsTemplate, + css: toastBasicCssTemplate, + deps: ["react-spring"], + }), }, } as Meta; diff --git a/src/toast/stories/ToastCSSAnimated.component.tsx b/src/toast/stories/ToastCSSAnimated.component.tsx index c87362130..b413a783a 100644 --- a/src/toast/stories/ToastCSSAnimated.component.tsx +++ b/src/toast/stories/ToastCSSAnimated.component.tsx @@ -1,8 +1,8 @@ import React from "react"; import { CSSTransition } from "react-transition-group"; -import { ToastProvider, TToastWrapper } from "renderless-components"; -import { Variants, Placements } from "./ToastUtils.component"; +import { Variants, Placements } from "./Utils.component"; +import { ToastProvider, TToastWrapper } from "renderless-components"; const CSSTransitionAnimationWrapper: TToastWrapper = ({ isVisible, diff --git a/src/toast/stories/ToastCSSAnimated.stories.tsx b/src/toast/stories/ToastCSSAnimated.stories.tsx index ca9c3de93..b02adcb5c 100644 --- a/src/toast/stories/ToastCSSAnimated.stories.tsx +++ b/src/toast/stories/ToastCSSAnimated.stories.tsx @@ -3,73 +3,27 @@ import { Meta } from "@storybook/react"; import "./ToastBasic.css"; import { + utilsTemplate, + utilsTemplateJs, toastBasicCssTemplate, - toastUtilsTemplate, - toastUtilsTemplateJs, toastCssAnimatedTemplate, toastCssAnimatedTemplateJs, } from "./templates"; import { App as CSSAnimatedToast } from "./ToastCSSAnimated.component"; -import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; - -const sandboxJs = CreateToastSandbox({ - type: "jsx", - deps: [ - "renderless-components@0.1.1-beta.3", - "reakit", - "react-transition-group", - ], -}); -const sandboxTs = CreateToastSandbox({ - type: "tsx", - deps: [ - "renderless-components@0.1.1-beta.3", - "reakit", - "react-transition-group", - ], -}); +import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; export default { component: CSSAnimatedToast, title: "Toast/CSSAnimated", parameters: { - preview: [ - { - tab: "ReactJS", - template: toastCssAnimatedTemplateJs, - language: "jsx", - copy: true, - codesandbox: sandboxJs, - }, - { - tab: "Utils.jsx", - template: toastUtilsTemplateJs, - language: "jsx", - copy: true, - codesandbox: sandboxJs, - }, - { - tab: "React", - template: toastCssAnimatedTemplate, - language: "tsx", - copy: true, - codesandbox: sandboxTs, - }, - { - tab: "Utils.tsx", - template: toastUtilsTemplate, - language: "tsx", - copy: true, - codesandbox: sandboxTs, - }, - { - tab: "CSS", - template: toastBasicCssTemplate, - language: "css", - copy: true, - codesandbox: sandboxTs, - }, - ], + preview: createPreviewTabs({ + js: toastCssAnimatedTemplateJs, + jsUtils: utilsTemplateJs, + ts: toastCssAnimatedTemplate, + tsUtils: utilsTemplate, + css: toastBasicCssTemplate, + deps: ["react-transition-group"], + }), }, decorators: [ Story => { diff --git a/src/toast/stories/ToastReactSpring.component.tsx b/src/toast/stories/ToastReactSpring.component.tsx index d6bfe2108..40933e3ff 100644 --- a/src/toast/stories/ToastReactSpring.component.tsx +++ b/src/toast/stories/ToastReactSpring.component.tsx @@ -1,7 +1,8 @@ import React from "react"; import { animated, useTransition } from "react-spring"; + +import { Variants, Placements } from "./Utils.component"; import { ToastProvider, TToastWrapper } from "renderless-components"; -import { Variants, Placements } from "./ToastUtils.component"; const SpringAnimationWrapper: TToastWrapper = ({ placement, diff --git a/src/toast/stories/ToastReactSpring.stories.tsx b/src/toast/stories/ToastReactSpring.stories.tsx index 96d38c499..fc8fbb43d 100644 --- a/src/toast/stories/ToastReactSpring.stories.tsx +++ b/src/toast/stories/ToastReactSpring.stories.tsx @@ -3,65 +3,27 @@ import { Meta } from "@storybook/react"; import "./ToastBasic.css"; import { + utilsTemplate, + utilsTemplateJs, toastBasicCssTemplate, - toastUtilsTemplate, - toastUtilsTemplateJs, toastReactSpringTemplate, toastReactSpringTemplateJs, } from "./templates"; import { App as ReactSpringToast } from "./ToastCSSAnimated.component"; -import { CreateToastSandbox } from "../../../scripts/create-preview-tabs"; - -const sandboxJs = CreateToastSandbox({ - type: "jsx", - deps: ["renderless-components@0.1.1-beta.3", "reakit", "react-spring"], -}); -const sandboxTs = CreateToastSandbox({ - type: "tsx", - deps: ["renderless-components@0.1.1-beta.3", "reakit", "react-spring"], -}); +import { createPreviewTabs } from "../../../scripts/create-preview-tabs"; export default { component: ReactSpringToast, title: "Toast/ReactSpring", parameters: { - preview: [ - { - tab: "ReactJS", - template: toastReactSpringTemplateJs, - language: "jsx", - copy: true, - codesandbox: sandboxJs, - }, - { - tab: "Utils.jsx", - template: toastUtilsTemplateJs, - language: "jsx", - copy: true, - codesandbox: sandboxJs, - }, - { - tab: "React", - template: toastReactSpringTemplate, - language: "tsx", - copy: true, - codesandbox: sandboxTs, - }, - { - tab: "Utils.tsx", - template: toastUtilsTemplate, - language: "tsx", - copy: true, - codesandbox: sandboxTs, - }, - { - tab: "CSS", - template: toastBasicCssTemplate, - language: "css", - copy: true, - codesandbox: sandboxTs, - }, - ], + preview: createPreviewTabs({ + js: toastReactSpringTemplateJs, + jsUtils: utilsTemplateJs, + ts: toastReactSpringTemplate, + tsUtils: utilsTemplate, + css: toastBasicCssTemplate, + deps: ["react-spring"], + }), }, decorators: [ Story => { diff --git a/src/toast/stories/ToastUtils.component.tsx b/src/toast/stories/Utils.component.tsx similarity index 99% rename from src/toast/stories/ToastUtils.component.tsx rename to src/toast/stories/Utils.component.tsx index 9b42baba9..e112bb7ca 100644 --- a/src/toast/stories/ToastUtils.component.tsx +++ b/src/toast/stories/Utils.component.tsx @@ -1,4 +1,5 @@ import React from "react"; + import { useToast, Placements as IPlacements } from "renderless-components"; const randomType = (): string => { From e8f32305a67a55b696bf2d0c693a4571b37c911c Mon Sep 17 00:00:00 2001 From: Navin Date: Tue, 17 Nov 2020 14:16:00 +0530 Subject: [PATCH 13/13] =?UTF-8?q?chore(deps):=20=E2=9E=96=20=20remove=20uu?= =?UTF-8?q?id=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - yarn.lock | 5 ----- 2 files changed, 6 deletions(-) diff --git a/package.json b/package.json index b6320ce75..c0da00e32 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "@types/react-dom": "16.9.9", "@types/react-transition-group": "4.4.0", "@types/testing-library__jest-dom": "5.9.5", - "@types/uuid": "8.3.0", "@typescript-eslint/eslint-plugin": "4.6.0", "@typescript-eslint/parser": "4.6.0", "babel-eslint": "10.1.0", diff --git a/yarn.lock b/yarn.lock index 6a3e2b80a..de8df3645 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3248,11 +3248,6 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ== -"@types/uuid@8.3.0": - version "8.3.0" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.0.tgz#215c231dff736d5ba92410e6d602050cce7e273f" - integrity sha512-eQ9qFW/fhfGJF8WKHGEHZEyVWfZxrT+6CLIJGBcZPfxUh/+BnEj+UCGYMlr9qZuX/2AltsvwrGqp0LhEW8D0zQ== - "@types/warning@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/warning/-/warning-3.0.0.tgz#0d2501268ad8f9962b740d387c4654f5f8e23e52"