diff --git a/babel.config.js b/babel.config.js index 3650eee2d..de2e1b498 100644 --- a/babel.config.js +++ b/babel.config.js @@ -8,8 +8,10 @@ module.exports = { ], plugins: [ 'inline-react-svg', - '@babel/plugin-proposal-class-properties', + ['@babel/plugin-proposal-class-properties', { loose: true }], '@babel/plugin-transform-typescript', + ['@babel/plugin-proposal-private-property-in-object', { loose: true }], + ['@babel/plugin-proposal-private-methods', { loose: true }], ], env: { test: { diff --git a/package.json b/package.json index 6aba7aec6..38594fb5a 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "devDependencies": { "@babel/core": "^7.17.8", "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-private-methods": "^7.18.6", "@babel/plugin-proposal-object-rest-spread": "^7.17.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-arrow-functions": "^7.16.7", diff --git a/platform/ui/.storybook/main.js b/platform/ui/.storybook/main.js index bb96ab74d..399f439b4 100644 --- a/platform/ui/.storybook/main.js +++ b/platform/ui/.storybook/main.js @@ -2,7 +2,11 @@ const path = require('path'); module.exports = { stories: ['../src/**/*.stories.@(mdx)'], - addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-google-analytics'], + addons: [ + '@storybook/addon-links', + '@storybook/addon-essentials', + '@storybook/addon-google-analytics', + ], core: { builder: 'webpack5', }, @@ -11,11 +15,22 @@ module.exports = { // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION' // You can change the configuration based on that. // 'PRODUCTION' is used when building the static version of storybook. + // config.module.rules[0].use[0].options.plugins[1] = [ // '@babel/plugin-proposal-class-properties', // { loose: true }, // ]; + // config.module.rules[0].use[0].options.plugins[3] = [ + // '@babel/plugin-proposal-private-methods', + // { loose: true }, + // ]; + + // config.module.rules[0].use[0].options.plugins[4] = [ + // '@babel/plugin-proposal-private-property-in-object', + // { loose: true }, + // ]; + // Make whatever fine-grained changes you need config.module.rules.push({ test: /\.m?js/, @@ -30,8 +45,6 @@ module.exports = { ); fileLoaderRule.exclude = /\.svg$/; - // console.log(JSON.stringify(config.module.rules, null, 2)); - config.module.rules.push({ test: /\.svg$/, use: [ diff --git a/platform/ui/.storybook/preview.js b/platform/ui/.storybook/preview.tsx similarity index 90% rename from platform/ui/.storybook/preview.js rename to platform/ui/.storybook/preview.tsx index 2fde6ba92..111a3276c 100644 --- a/platform/ui/.storybook/preview.js +++ b/platform/ui/.storybook/preview.tsx @@ -1,6 +1,6 @@ -import { parameters } from '@storybook/addon-docs/dist/esm/frameworks/react/config'; +import React from 'react'; import { addParameters } from '@storybook/react'; -import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; +import { DocsPage, DocsContainer } from '@storybook/addon-docs'; import { Heading, SectionName, @@ -15,7 +15,6 @@ import './custom.css'; // https://github.com/mondaycom/monday-ui-react-core/tree/master/.storybook addParameters({ docs: { - ...parameters.docs, inlineStories: true, container: ({ children, context }) => ( {children} diff --git a/platform/ui/src/components/AboutModal/__stories__/aboutModal.stories.mdx b/platform/ui/src/components/AboutModal/__stories__/aboutModal.stories.mdx index 5e48f2b23..3e5127be6 100644 --- a/platform/ui/src/components/AboutModal/__stories__/aboutModal.stories.mdx +++ b/platform/ui/src/components/AboutModal/__stories__/aboutModal.stories.mdx @@ -20,7 +20,7 @@ export const aboutTemplate = args => ( - [Overview](#overview) diff --git a/platform/ui/src/components/Button/__stories__/button.stories.mdx b/platform/ui/src/components/Button/__stories__/button.stories.mdx index 9e90e3a8d..bb62b5927 100644 --- a/platform/ui/src/components/Button/__stories__/button.stories.mdx +++ b/platform/ui/src/components/Button/__stories__/button.stories.mdx @@ -14,22 +14,20 @@ export const argTypes = { export const buttonTemplate = createComponentTemplate(Button); - + - [Overview](#overview) - [Props](#props) - [Usage](#usage) - [Contribute](#contribute) - ## Overview -You can use the button component to create a button. It can be used in different ways, the default -button is a simple button with a text. +You can use the button component to create a button. It can be used in different +ways, the default button is a simple button with a text. - + {buttonTemplate.bind({})} @@ -39,13 +37,14 @@ button is a simple button with a text. ## Usage -### Variants -There can be different variants of buttons: `text`, `outlined`, -`contained`, and `disabled`. +### Variants + +There can be different variants of buttons: `text`, `outlined`, `contained`, and +`disabled`. - +
@@ -55,13 +54,13 @@ There can be different variants of buttons: `text`, `outlined`, - ### Colors -There are different colors for the button: `default`, `primary`, `secondary`, `white`, `black`, `inherit`, `light`. +There are different colors for the button: `default`, `primary`, `secondary`, +`white`, `black`, `inherit`, `light`. - +
@@ -75,96 +74,105 @@ There are different colors for the button: `default`, `primary`, `secondary`, `w ### Mixing props + You can mix different props together to create a button. - - + + ### Disabled + You can disable the button by setting the variant to `disabled`. - - + + - ### Start/End Icons + You can add an icon to the start of the button. It accepts an icon component. - - - {() => { - // svg icon for github - const Github = () => { - return ( - - - - ) - } - return ; - }} + + {() => { + // svg icon for github + const Github = () => { + return ( + + + + ); + }; + return ; + }} }} End Icon is the same as start icon, but for the end of the button. - - - {() => { - // svg icon for github - const Github = () => { - return ( - - - - ) - } - return ; - }} + + {() => { + // svg icon for github + const Github = () => { + return ( + + + + ); + }; + return ( + + ); + }} }} - ### Full width + You can make the button full width by setting the `fullWidth` prop to `true`. - - + + ## Contribute -