@toptal/picasso-provider 3.5.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{CssBaseline → dist-package/src/CssBaseline}/CssBaseline.d.ts +2 -0
- package/dist-package/src/CssBaseline/CssBaseline.d.ts.map +1 -0
- package/dist-package/src/CssBaseline/CssBaseline.js.map +1 -0
- package/{CssBaseline → dist-package/src/CssBaseline}/index.d.ts +1 -0
- package/dist-package/src/CssBaseline/index.d.ts.map +1 -0
- package/dist-package/src/CssBaseline/index.js.map +1 -0
- package/{CssBaseline → dist-package/src/CssBaseline}/styles.d.ts +1 -0
- package/dist-package/src/CssBaseline/styles.d.ts.map +1 -0
- package/dist-package/src/CssBaseline/styles.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/Favicon.d.ts +2 -0
- package/dist-package/src/Favicon/Favicon.d.ts.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/Favicon.js +2 -3
- package/dist-package/src/Favicon/Favicon.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/icons/development/index.d.ts +1 -0
- package/dist-package/src/Favicon/icons/development/index.d.ts.map +1 -0
- package/dist-package/src/Favicon/icons/development/index.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/icons/index.d.ts +3 -1
- package/dist-package/src/Favicon/icons/index.d.ts.map +1 -0
- package/dist-package/src/Favicon/icons/index.js +27 -0
- package/dist-package/src/Favicon/icons/index.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/icons/production/index.d.ts +1 -0
- package/dist-package/src/Favicon/icons/production/index.d.ts.map +1 -0
- package/dist-package/src/Favicon/icons/production/index.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/icons/staging/index.d.ts +1 -0
- package/dist-package/src/Favicon/icons/staging/index.d.ts.map +1 -0
- package/dist-package/src/Favicon/icons/staging/index.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/icons/temploy/index.d.ts +1 -0
- package/dist-package/src/Favicon/icons/temploy/index.d.ts.map +1 -0
- package/dist-package/src/Favicon/icons/temploy/index.js.map +1 -0
- package/{Favicon → dist-package/src/Favicon}/index.d.ts +1 -0
- package/dist-package/src/Favicon/index.d.ts.map +1 -0
- package/dist-package/src/Favicon/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/FixViewport.d.ts +2 -0
- package/dist-package/src/Picasso/FixViewport.d.ts.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/FixViewport.js +1 -2
- package/dist-package/src/Picasso/FixViewport.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/FontsLoader.d.ts +1 -0
- package/dist-package/src/Picasso/FontsLoader.d.ts.map +1 -0
- package/dist-package/src/Picasso/FontsLoader.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/HelmetProvider/HelmetProvider.d.ts +1 -0
- package/dist-package/src/Picasso/HelmetProvider/HelmetProvider.d.ts.map +1 -0
- package/dist-package/src/Picasso/HelmetProvider/HelmetProvider.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/HelmetProvider/index.d.ts +1 -0
- package/dist-package/src/Picasso/HelmetProvider/index.d.ts.map +1 -0
- package/dist-package/src/Picasso/HelmetProvider/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/NotificationsProvider/NotificationsProvider.d.ts +1 -0
- package/dist-package/src/Picasso/NotificationsProvider/NotificationsProvider.d.ts.map +1 -0
- package/dist-package/src/Picasso/NotificationsProvider/NotificationsProvider.js.map +1 -0
- package/dist-package/src/Picasso/NotificationsProvider/index.d.ts +2 -0
- package/dist-package/src/Picasso/NotificationsProvider/index.d.ts.map +1 -0
- package/dist-package/src/Picasso/NotificationsProvider/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/NotificationsProvider/styles.d.ts +1 -0
- package/dist-package/src/Picasso/NotificationsProvider/styles.d.ts.map +1 -0
- package/dist-package/src/Picasso/NotificationsProvider/styles.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/Picasso.d.ts +1 -0
- package/dist-package/src/Picasso/Picasso.d.ts.map +1 -0
- package/dist-package/src/Picasso/Picasso.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/PicassoGlobalStylesProvider.d.ts +1 -0
- package/dist-package/src/Picasso/PicassoGlobalStylesProvider.d.ts.map +1 -0
- package/dist-package/src/Picasso/PicassoGlobalStylesProvider.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/PicassoLight/PicassoLight.d.ts +1 -0
- package/dist-package/src/Picasso/PicassoLight/PicassoLight.d.ts.map +1 -0
- package/dist-package/src/Picasso/PicassoLight/PicassoLight.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/PicassoLight/index.d.ts +1 -0
- package/dist-package/src/Picasso/PicassoLight/index.d.ts.map +1 -0
- package/dist-package/src/Picasso/PicassoLight/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/PicassoProvider.d.ts +2 -0
- package/dist-package/src/Picasso/PicassoProvider.d.ts.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/PicassoProvider.js +3 -2
- package/dist-package/src/Picasso/PicassoProvider.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/PicassoRootNode.d.ts +1 -0
- package/dist-package/src/Picasso/PicassoRootNode.d.ts.map +1 -0
- package/dist-package/src/Picasso/PicassoRootNode.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/RootContext.d.ts +1 -0
- package/dist-package/src/Picasso/RootContext.d.ts.map +1 -0
- package/dist-package/src/Picasso/RootContext.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/breakpoints.d.ts +1 -0
- package/dist-package/src/Picasso/config/breakpoints.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/breakpoints.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/index.d.ts +3 -1
- package/dist-package/src/Picasso/config/index.d.ts.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/index.js +2 -1
- package/dist-package/src/Picasso/config/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/layout.d.ts +1 -0
- package/dist-package/src/Picasso/config/layout.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/layout.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/palette.d.ts +1 -0
- package/dist-package/src/Picasso/config/palette.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/palette.js.map +1 -0
- package/dist-package/src/Picasso/config/shadows.d.ts +30 -0
- package/dist-package/src/Picasso/config/shadows.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/shadows.js +39 -0
- package/dist-package/src/Picasso/config/shadows.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/sizes.d.ts +1 -0
- package/dist-package/src/Picasso/config/sizes.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/sizes.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/spacings.d.ts +1 -0
- package/dist-package/src/Picasso/config/spacings.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/spacings.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/theme.d.ts +1 -5
- package/dist-package/src/Picasso/config/theme.d.ts.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/theme.js.map +1 -1
- package/{Picasso → dist-package/src/Picasso}/config/transitions.d.ts +1 -0
- package/dist-package/src/Picasso/config/transitions.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/transitions.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/config/typography.d.ts +1 -0
- package/dist-package/src/Picasso/config/typography.d.ts.map +1 -0
- package/dist-package/src/Picasso/config/typography.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/index.d.ts +2 -0
- package/dist-package/src/Picasso/index.d.ts.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/index.js +1 -0
- package/dist-package/src/Picasso/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/styles.d.ts +1 -0
- package/dist-package/src/Picasso/styles.d.ts.map +1 -0
- package/dist-package/src/Picasso/styles.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/generate-random-string.d.ts +1 -0
- package/dist-package/src/Picasso/utils/generate-random-string.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/generate-random-string.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/get-serverside-stylesheets.d.ts +1 -0
- package/dist-package/src/Picasso/utils/get-serverside-stylesheets.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/get-serverside-stylesheets.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/index.d.ts +1 -0
- package/dist-package/src/Picasso/utils/index.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/create-jss-variable-class-names.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/create-jss-variable-class-names.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/create-jss-variable-class-names.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/create-media-queries.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/create-media-queries.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/create-media-queries.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/create-variable-values-jss.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/create-variable-values-jss.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/create-variable-values-jss.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/default-css-prop.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/default-css-prop.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/default-css-prop.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/generate-variable-inline-styles.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/generate-variable-inline-styles.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/generate-variable-inline-styles.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/get-breakpoint-class-names-to-use.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.js.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/index.d.ts +2 -0
- package/dist-package/src/Picasso/utils/responsive-styles/index.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/index.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/make-responsive-spacing-props.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/make-responsive-spacing-props.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/make-responsive-spacing-props.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/media-queries-classes.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/media-queries-classes.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/media-queries-classes.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/to-class-name.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/to-class-name.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/to-class-name.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/to-css-variable-name.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/to-css-variable-name.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/to-css-variable-name.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/types.d.ts +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/types.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/responsive-styles/types.js.map +1 -0
- package/{Picasso → dist-package/src/Picasso}/utils/spacings.d.ts +1 -0
- package/dist-package/src/Picasso/utils/spacings.d.ts.map +1 -0
- package/dist-package/src/Picasso/utils/spacings.js.map +1 -0
- package/{PreventPageWidthChangeOnScrollbar → dist-package/src/PreventPageWidthChangeOnScrollbar}/PreventPageWidthChangeOnScrollbar.d.ts +1 -0
- package/dist-package/src/PreventPageWidthChangeOnScrollbar/PreventPageWidthChangeOnScrollbar.d.ts.map +1 -0
- package/dist-package/src/PreventPageWidthChangeOnScrollbar/PreventPageWidthChangeOnScrollbar.js.map +1 -0
- package/{PreventPageWidthChangeOnScrollbar → dist-package/src/PreventPageWidthChangeOnScrollbar}/index.d.ts +1 -0
- package/dist-package/src/PreventPageWidthChangeOnScrollbar/index.d.ts.map +1 -0
- package/dist-package/src/PreventPageWidthChangeOnScrollbar/index.js.map +1 -0
- package/{PreventPageWidthChangeOnScrollbar → dist-package/src/PreventPageWidthChangeOnScrollbar}/styles.d.ts +1 -0
- package/dist-package/src/PreventPageWidthChangeOnScrollbar/styles.d.ts.map +1 -0
- package/dist-package/src/PreventPageWidthChangeOnScrollbar/styles.js.map +1 -0
- package/dist-package/src/hooks/index.d.ts +2 -0
- package/dist-package/src/hooks/index.d.ts.map +1 -0
- package/dist-package/src/hooks/index.js.map +1 -0
- package/{hooks → dist-package/src/hooks}/use-isomorphic-layout-effect.d.ts +1 -0
- package/dist-package/src/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist-package/src/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/{index.d.ts → dist-package/src/index.d.ts} +3 -0
- package/dist-package/src/index.d.ts.map +1 -0
- package/{index.js → dist-package/src/index.js} +2 -0
- package/dist-package/src/index.js.map +1 -0
- package/{types.d.ts → dist-package/src/types.d.ts} +1 -0
- package/dist-package/src/types.d.ts.map +1 -0
- package/dist-package/src/types.js.map +1 -0
- package/{utils → dist-package/src/utils}/index.d.ts +2 -0
- package/dist-package/src/utils/index.d.ts.map +1 -0
- package/{utils → dist-package/src/utils}/index.js +1 -0
- package/dist-package/src/utils/index.js.map +1 -0
- package/{utils → dist-package/src/utils}/is-browser.d.ts +1 -0
- package/dist-package/src/utils/is-browser.d.ts.map +1 -0
- package/dist-package/src/utils/is-browser.js.map +1 -0
- package/{utils → dist-package/src/utils}/kebab-to-camel-case.d.ts +1 -0
- package/dist-package/src/utils/kebab-to-camel-case.d.ts.map +1 -0
- package/dist-package/src/utils/kebab-to-camel-case.js.map +1 -0
- package/{utils → dist-package/src/utils}/snake-to-camel-case.d.ts +1 -0
- package/dist-package/src/utils/snake-to-camel-case.d.ts.map +1 -0
- package/dist-package/src/utils/snake-to-camel-case.js.map +1 -0
- package/dist-package/src/utils/use-safe-state.d.ts +4 -0
- package/dist-package/src/utils/use-safe-state.d.ts.map +1 -0
- package/dist-package/src/utils/use-safe-state.js +19 -0
- package/dist-package/src/utils/use-safe-state.js.map +1 -0
- package/package.json +19 -10
- package/src/CssBaseline/CssBaseline.tsx +18 -0
- package/src/CssBaseline/index.ts +1 -0
- package/src/CssBaseline/styles.ts +32 -0
- package/src/Favicon/Favicon.tsx +73 -0
- package/src/Favicon/__snapshots__/test.tsx.snap +51 -0
- package/src/Favicon/icons/development/development-16x16.png +0 -0
- package/src/Favicon/icons/development/development-180x180.png +0 -0
- package/src/Favicon/icons/development/development-32x32.png +0 -0
- package/src/Favicon/icons/development/index.ts +11 -0
- package/src/Favicon/icons/index.ts +20 -0
- package/src/Favicon/icons/production/index.ts +11 -0
- package/src/Favicon/icons/production/production-16x16.png +0 -0
- package/src/Favicon/icons/production/production-180x180.png +0 -0
- package/src/Favicon/icons/production/production-32x32.png +0 -0
- package/src/Favicon/icons/staging/index.ts +11 -0
- package/src/Favicon/icons/staging/staging-16x16.png +0 -0
- package/src/Favicon/icons/staging/staging-180x180.png +0 -0
- package/src/Favicon/icons/staging/staging-32x32.png +0 -0
- package/src/Favicon/icons/temploy/index.ts +11 -0
- package/src/Favicon/icons/temploy/temploy-16x16.png +0 -0
- package/src/Favicon/icons/temploy/temploy-180x180.png +0 -0
- package/src/Favicon/icons/temploy/temploy-32x32.png +0 -0
- package/src/Favicon/index.ts +2 -0
- package/src/Favicon/test.tsx +33 -0
- package/src/Picasso/FixViewport.tsx +42 -0
- package/src/Picasso/FontsLoader.tsx +72 -0
- package/src/Picasso/HelmetProvider/HelmetProvider.tsx +20 -0
- package/src/Picasso/HelmetProvider/index.ts +1 -0
- package/src/Picasso/NotificationsProvider/NotificationsProvider.tsx +50 -0
- package/{Picasso/NotificationsProvider/index.d.ts → src/Picasso/NotificationsProvider/index.ts} +1 -1
- package/src/Picasso/NotificationsProvider/styles.ts +24 -0
- package/src/Picasso/NotificationsProvider/test.tsx +55 -0
- package/src/Picasso/Picasso.tsx +142 -0
- package/src/Picasso/PicassoGlobalStylesProvider.tsx +94 -0
- package/src/Picasso/PicassoLight/PicassoLight.tsx +82 -0
- package/src/Picasso/PicassoLight/index.tsx +1 -0
- package/src/Picasso/PicassoProvider.tsx +80 -0
- package/src/Picasso/PicassoRootNode.tsx +31 -0
- package/src/Picasso/RootContext.ts +92 -0
- package/src/Picasso/config/breakpoints.ts +194 -0
- package/src/Picasso/config/index.ts +28 -0
- package/src/Picasso/config/layout.ts +16 -0
- package/src/Picasso/config/palette.ts +110 -0
- package/src/Picasso/config/shadows.ts +73 -0
- package/src/Picasso/config/sizes.ts +27 -0
- package/src/Picasso/config/spacings.ts +102 -0
- package/src/Picasso/config/test.ts +211 -0
- package/src/Picasso/config/theme.ts +21 -0
- package/src/Picasso/config/transitions.ts +5 -0
- package/src/Picasso/config/typography.ts +62 -0
- package/src/Picasso/index.ts +9 -0
- package/src/Picasso/story/BarePicassoLight.example.tsx +33 -0
- package/src/Picasso/story/Default.example.tsx +38 -0
- package/src/Picasso/story/DisableClassNamePrefix.example.tsx +36 -0
- package/src/Picasso/story/DisableResponsiveUI.example.tsx +96 -0
- package/src/Picasso/story/LightWithFixViewportAndFontsLoader.example.tsx +40 -0
- package/src/Picasso/story/LightWithNotificationsAndFavicon.example.tsx +57 -0
- package/src/Picasso/story/index.jsx +84 -0
- package/src/Picasso/styles.tsx +19 -0
- package/src/Picasso/utils/generate-random-string.ts +12 -0
- package/src/Picasso/utils/get-serverside-stylesheets.ts +17 -0
- package/src/Picasso/utils/index.ts +4 -0
- package/src/Picasso/utils/responsive-styles/create-jss-variable-class-names.test.ts +17 -0
- package/src/Picasso/utils/responsive-styles/create-jss-variable-class-names.ts +30 -0
- package/src/Picasso/utils/responsive-styles/create-media-queries.test.ts +32 -0
- package/src/Picasso/utils/responsive-styles/create-media-queries.ts +32 -0
- package/src/Picasso/utils/responsive-styles/create-variable-values-jss.test.ts +24 -0
- package/src/Picasso/utils/responsive-styles/create-variable-values-jss.ts +21 -0
- package/src/Picasso/utils/responsive-styles/default-css-prop.test.ts +15 -0
- package/src/Picasso/utils/responsive-styles/default-css-prop.ts +15 -0
- package/src/Picasso/utils/responsive-styles/generate-variable-inline-styles.test.ts +20 -0
- package/src/Picasso/utils/responsive-styles/generate-variable-inline-styles.ts +26 -0
- package/src/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.test.ts +20 -0
- package/src/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.ts +28 -0
- package/{Picasso/utils/responsive-styles/index.d.ts → src/Picasso/utils/responsive-styles/index.ts} +1 -1
- package/src/Picasso/utils/responsive-styles/make-responsive-spacing-props.ts +34 -0
- package/src/Picasso/utils/responsive-styles/media-queries-classes.test.ts +32 -0
- package/src/Picasso/utils/responsive-styles/media-queries-classes.ts +28 -0
- package/src/Picasso/utils/responsive-styles/to-class-name.test.ts +13 -0
- package/src/Picasso/utils/responsive-styles/to-class-name.ts +9 -0
- package/src/Picasso/utils/responsive-styles/to-css-variable-name.test.ts +13 -0
- package/src/Picasso/utils/responsive-styles/to-css-variable-name.ts +9 -0
- package/src/Picasso/utils/responsive-styles/types.ts +7 -0
- package/src/Picasso/utils/spacings.test.ts +47 -0
- package/src/Picasso/utils/spacings.ts +14 -0
- package/src/PreventPageWidthChangeOnScrollbar/PreventPageWidthChangeOnScrollbar.tsx +20 -0
- package/src/PreventPageWidthChangeOnScrollbar/index.ts +1 -0
- package/src/PreventPageWidthChangeOnScrollbar/styles.ts +17 -0
- package/{hooks/index.d.ts → src/hooks/index.ts} +1 -1
- package/src/hooks/use-isomorphic-layout-effect.ts +8 -0
- package/src/index.ts +59 -0
- package/src/types.ts +12 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/is-browser.ts +3 -0
- package/src/utils/kebab-to-camel-case.test.ts +7 -0
- package/src/utils/kebab-to-camel-case.ts +4 -0
- package/src/utils/snake-to-camel-case.test.ts +41 -0
- package/src/utils/snake-to-camel-case.ts +16 -0
- package/src/utils/use-safe-state.ts +25 -0
- package/CssBaseline/CssBaseline.js.map +0 -1
- package/CssBaseline/index.js.map +0 -1
- package/CssBaseline/styles.js.map +0 -1
- package/Favicon/Favicon.js.map +0 -1
- package/Favicon/icons/development/index.js.map +0 -1
- package/Favicon/icons/index.js +0 -14
- package/Favicon/icons/index.js.map +0 -1
- package/Favicon/icons/production/index.js.map +0 -1
- package/Favicon/icons/staging/index.js.map +0 -1
- package/Favicon/icons/temploy/index.js.map +0 -1
- package/Favicon/index.js.map +0 -1
- package/LICENSE +0 -20
- package/Picasso/FixViewport.js.map +0 -1
- package/Picasso/FontsLoader.js.map +0 -1
- package/Picasso/HelmetProvider/HelmetProvider.js.map +0 -1
- package/Picasso/HelmetProvider/index.js.map +0 -1
- package/Picasso/NotificationsProvider/NotificationsProvider.js.map +0 -1
- package/Picasso/NotificationsProvider/index.js.map +0 -1
- package/Picasso/NotificationsProvider/styles.js.map +0 -1
- package/Picasso/Picasso.js.map +0 -1
- package/Picasso/PicassoGlobalStylesProvider.js.map +0 -1
- package/Picasso/PicassoLight/PicassoLight.js.map +0 -1
- package/Picasso/PicassoLight/index.js.map +0 -1
- package/Picasso/PicassoProvider.js.map +0 -1
- package/Picasso/PicassoRootNode.js.map +0 -1
- package/Picasso/RootContext.js.map +0 -1
- package/Picasso/config/breakpoints.js.map +0 -1
- package/Picasso/config/index.js.map +0 -1
- package/Picasso/config/layout.js.map +0 -1
- package/Picasso/config/palette.js.map +0 -1
- package/Picasso/config/shadows.d.ts +0 -3
- package/Picasso/config/shadows.js +0 -19
- package/Picasso/config/shadows.js.map +0 -1
- package/Picasso/config/sizes.js.map +0 -1
- package/Picasso/config/spacings.js.map +0 -1
- package/Picasso/config/transitions.js.map +0 -1
- package/Picasso/config/typography.js.map +0 -1
- package/Picasso/index.js.map +0 -1
- package/Picasso/styles.js.map +0 -1
- package/Picasso/utils/generate-random-string.js.map +0 -1
- package/Picasso/utils/get-serverside-stylesheets.js.map +0 -1
- package/Picasso/utils/index.js.map +0 -1
- package/Picasso/utils/responsive-styles/create-jss-variable-class-names.js.map +0 -1
- package/Picasso/utils/responsive-styles/create-jss-variable-class-names.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/create-jss-variable-class-names.test.js +0 -14
- package/Picasso/utils/responsive-styles/create-jss-variable-class-names.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/create-media-queries.js.map +0 -1
- package/Picasso/utils/responsive-styles/create-media-queries.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/create-media-queries.test.js +0 -27
- package/Picasso/utils/responsive-styles/create-media-queries.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/create-variable-values-jss.js.map +0 -1
- package/Picasso/utils/responsive-styles/create-variable-values-jss.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/create-variable-values-jss.test.js +0 -20
- package/Picasso/utils/responsive-styles/create-variable-values-jss.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/default-css-prop.js.map +0 -1
- package/Picasso/utils/responsive-styles/default-css-prop.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/default-css-prop.test.js +0 -13
- package/Picasso/utils/responsive-styles/default-css-prop.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/generate-variable-inline-styles.js.map +0 -1
- package/Picasso/utils/responsive-styles/generate-variable-inline-styles.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/generate-variable-inline-styles.test.js +0 -18
- package/Picasso/utils/responsive-styles/generate-variable-inline-styles.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.js.map +0 -1
- package/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.test.js +0 -18
- package/Picasso/utils/responsive-styles/get-breakpoint-class-names-to-use.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/index.js.map +0 -1
- package/Picasso/utils/responsive-styles/make-responsive-spacing-props.js.map +0 -1
- package/Picasso/utils/responsive-styles/media-queries-classes.js.map +0 -1
- package/Picasso/utils/responsive-styles/media-queries-classes.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/media-queries-classes.test.js +0 -27
- package/Picasso/utils/responsive-styles/media-queries-classes.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/to-class-name.js.map +0 -1
- package/Picasso/utils/responsive-styles/to-class-name.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/to-class-name.test.js +0 -11
- package/Picasso/utils/responsive-styles/to-class-name.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/to-css-variable-name.js.map +0 -1
- package/Picasso/utils/responsive-styles/to-css-variable-name.test.d.ts +0 -1
- package/Picasso/utils/responsive-styles/to-css-variable-name.test.js +0 -11
- package/Picasso/utils/responsive-styles/to-css-variable-name.test.js.map +0 -1
- package/Picasso/utils/responsive-styles/types.js.map +0 -1
- package/Picasso/utils/spacings.js.map +0 -1
- package/Picasso/utils/spacings.test.d.ts +0 -1
- package/Picasso/utils/spacings.test.js +0 -35
- package/Picasso/utils/spacings.test.js.map +0 -1
- package/PreventPageWidthChangeOnScrollbar/PreventPageWidthChangeOnScrollbar.js.map +0 -1
- package/PreventPageWidthChangeOnScrollbar/index.js.map +0 -1
- package/PreventPageWidthChangeOnScrollbar/styles.js.map +0 -1
- package/hooks/index.js.map +0 -1
- package/hooks/use-isomorphic-layout-effect.js.map +0 -1
- package/index.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/index.js.map +0 -1
- package/utils/is-browser.js.map +0 -1
- package/utils/kebab-to-camel-case.js.map +0 -1
- package/utils/kebab-to-camel-case.test.d.ts +0 -1
- package/utils/kebab-to-camel-case.test.js +0 -7
- package/utils/kebab-to-camel-case.test.js.map +0 -1
- package/utils/snake-to-camel-case.js.map +0 -1
- package/utils/snake-to-camel-case.test.d.ts +0 -1
- package/utils/snake-to-camel-case.test.js +0 -30
- package/utils/snake-to-camel-case.test.js.map +0 -1
- /package/{CssBaseline → dist-package/src/CssBaseline}/CssBaseline.js +0 -0
- /package/{CssBaseline → dist-package/src/CssBaseline}/index.js +0 -0
- /package/{CssBaseline → dist-package/src/CssBaseline}/styles.js +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/development/development-16x16.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/development/development-180x180.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/development/development-32x32.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/development/index.js +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/production/index.js +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/production/production-16x16.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/production/production-180x180.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/production/production-32x32.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/staging/index.js +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/staging/staging-16x16.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/staging/staging-180x180.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/staging/staging-32x32.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/temploy/index.js +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/temploy/temploy-16x16.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/temploy/temploy-180x180.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/icons/temploy/temploy-32x32.png +0 -0
- /package/{Favicon → dist-package/src/Favicon}/index.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/FontsLoader.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/HelmetProvider/HelmetProvider.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/HelmetProvider/index.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/NotificationsProvider/NotificationsProvider.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/NotificationsProvider/index.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/NotificationsProvider/styles.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/Picasso.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/PicassoGlobalStylesProvider.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/PicassoLight/PicassoLight.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/PicassoLight/index.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/PicassoRootNode.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/RootContext.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/breakpoints.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/layout.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/palette.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/sizes.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/spacings.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/theme.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/transitions.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/config/typography.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/styles.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/generate-random-string.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/get-serverside-stylesheets.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/index.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/create-jss-variable-class-names.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/create-media-queries.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/create-variable-values-jss.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/default-css-prop.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/generate-variable-inline-styles.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/get-breakpoint-class-names-to-use.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/index.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/make-responsive-spacing-props.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/media-queries-classes.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/to-class-name.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/to-css-variable-name.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/responsive-styles/types.js +0 -0
- /package/{Picasso → dist-package/src/Picasso}/utils/spacings.js +0 -0
- /package/{PreventPageWidthChangeOnScrollbar → dist-package/src/PreventPageWidthChangeOnScrollbar}/PreventPageWidthChangeOnScrollbar.js +0 -0
- /package/{PreventPageWidthChangeOnScrollbar → dist-package/src/PreventPageWidthChangeOnScrollbar}/index.js +0 -0
- /package/{PreventPageWidthChangeOnScrollbar → dist-package/src/PreventPageWidthChangeOnScrollbar}/styles.js +0 -0
- /package/{hooks → dist-package/src/hooks}/index.js +0 -0
- /package/{hooks → dist-package/src/hooks}/use-isomorphic-layout-effect.js +0 -0
- /package/{types.js → dist-package/src/types.js} +0 -0
- /package/{utils → dist-package/src/utils}/is-browser.js +0 -0
- /package/{utils → dist-package/src/utils}/kebab-to-camel-case.js +0 -0
- /package/{utils → dist-package/src/utils}/snake-to-camel-case.js +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core'
|
|
2
|
+
import { createStyles } from '@material-ui/core'
|
|
3
|
+
|
|
4
|
+
export default ({ typography }: Theme) =>
|
|
5
|
+
createStyles({
|
|
6
|
+
root: {
|
|
7
|
+
flex: 1,
|
|
8
|
+
boxSizing: 'border-box',
|
|
9
|
+
|
|
10
|
+
'& *': {
|
|
11
|
+
fontFamily: typography.fontFamily,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
// https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
|
|
15
|
+
'& *, & *::before, & *::after': {
|
|
16
|
+
boxSizing: 'inherit',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const generateRandomStringOrGetEmptyInTest = (base = '') => {
|
|
2
|
+
if (process.env.NODE_ENV === 'test') {
|
|
3
|
+
return base
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return base + generateRandomString()
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
|
|
10
|
+
const generateRandomString = () => Math.random().toString(36).substring(7)
|
|
11
|
+
|
|
12
|
+
export { generateRandomString, generateRandomStringOrGetEmptyInTest }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createGenerateClassName, ServerStyleSheets } from '@material-ui/core'
|
|
2
|
+
|
|
3
|
+
const getServersideStylesheets = (
|
|
4
|
+
generateClassNameSeed = ''
|
|
5
|
+
): ServerStyleSheets => {
|
|
6
|
+
const generateClassName = createGenerateClassName({
|
|
7
|
+
seed: generateClassNameSeed,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const sheets = new ServerStyleSheets({
|
|
11
|
+
serverGenerateClassName: generateClassName,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return sheets
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { getServersideStylesheets }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createJssVariableClassNames } from './create-jss-variable-class-names'
|
|
2
|
+
|
|
3
|
+
describe('createJssVariableClassNames', () => {
|
|
4
|
+
it('returns an object with the correct class name and CSS property', () => {
|
|
5
|
+
const breakpoint = 'md'
|
|
6
|
+
const cssProp = 'padding'
|
|
7
|
+
|
|
8
|
+
const expectedClassName = 'md--padding'
|
|
9
|
+
const expectedVariable = 'var(--picasso-responsive--md--padding)'
|
|
10
|
+
|
|
11
|
+
const result = createJssVariableClassNames(breakpoint, cssProp)
|
|
12
|
+
|
|
13
|
+
expect(Object.keys(result)).toHaveLength(1)
|
|
14
|
+
expect(result[expectedClassName]).toBeDefined()
|
|
15
|
+
expect(result[expectedClassName][cssProp]).toEqual(expectedVariable)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BreakpointKeys } from '../../config'
|
|
2
|
+
import { toClassName } from './to-class-name'
|
|
3
|
+
import { toCssVariableName } from './to-css-variable-name'
|
|
4
|
+
import type { ResponsiveCssProp } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a CSS class for a given breakpoint and CSS property
|
|
8
|
+
* that sets the value of the CSS property to the value of the CSS variable
|
|
9
|
+
* for that breakpoint and CSS property.
|
|
10
|
+
*
|
|
11
|
+
* Simplified example, for `margin-top` CSS property and `xs` breakpoint:
|
|
12
|
+
* ```css
|
|
13
|
+
* .xs--margin-top {
|
|
14
|
+
* margin-top: var(--picasso-responsive--xs--margin-top);
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const createJssVariableClassNames = (
|
|
19
|
+
breakpoint: BreakpointKeys,
|
|
20
|
+
cssProp: ResponsiveCssProp
|
|
21
|
+
) => {
|
|
22
|
+
const className = toClassName(breakpoint, cssProp)
|
|
23
|
+
const variable = `var(${toCssVariableName(breakpoint, cssProp)})`
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
[className]: {
|
|
27
|
+
[cssProp]: variable,
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core'
|
|
2
|
+
|
|
3
|
+
import { createMediaQueries } from './create-media-queries'
|
|
4
|
+
|
|
5
|
+
describe('createMediaQueries', () => {
|
|
6
|
+
it('returns media queries with the correct class names and CSS properties', () => {
|
|
7
|
+
const cssProp = 'padding'
|
|
8
|
+
const theme = {
|
|
9
|
+
breakpoints: {
|
|
10
|
+
keys: ['sm', 'md'],
|
|
11
|
+
up: (breakpoint: number) => `@media (min-width: ${breakpoint})`,
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const expectedMediaQueries = {
|
|
16
|
+
'@media (min-width: md)': {
|
|
17
|
+
'md--padding': {
|
|
18
|
+
padding: 'var(--picasso-responsive--md--padding)',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
'@media (min-width: sm)': {
|
|
22
|
+
'sm--padding': {
|
|
23
|
+
padding: 'var(--picasso-responsive--sm--padding)',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = createMediaQueries(cssProp, theme as Theme)
|
|
29
|
+
|
|
30
|
+
expect(result).toEqual(expectedMediaQueries)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core/styles'
|
|
2
|
+
|
|
3
|
+
import { createJssVariableClassNames } from './create-jss-variable-class-names'
|
|
4
|
+
import type { ResponsiveCssProp } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a CSS class for *every* breakpoint and a given CSS property
|
|
8
|
+
* containing a media query for that breakpoint and sets the value of the CSS property
|
|
9
|
+
* to the value of the CSS variable for that breakpoint and CSS property.
|
|
10
|
+
*
|
|
11
|
+
* Simplified example, for `margin-top` CSS property and `xs` breakpoint:
|
|
12
|
+
* ```css
|
|
13
|
+
* @media (min-width: 0px) {
|
|
14
|
+
* .xs--margin-top {
|
|
15
|
+
* margin-top: var(--picasso-responsive--xs--margin-top);
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const createMediaQueries = (
|
|
21
|
+
cssProp: ResponsiveCssProp,
|
|
22
|
+
theme: Theme
|
|
23
|
+
) => {
|
|
24
|
+
const mediaQueries: Record<string, {}> = {}
|
|
25
|
+
|
|
26
|
+
for (const breakpoint of [...theme.breakpoints.keys].reverse()) {
|
|
27
|
+
mediaQueries[theme.breakpoints.up(breakpoint)] =
|
|
28
|
+
createJssVariableClassNames(breakpoint, cssProp)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return mediaQueries
|
|
32
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SPACING_2, SPACING_4, SPACING_6 } from '../../config/spacings'
|
|
2
|
+
import { createVariableValuesJss } from './create-variable-values-jss'
|
|
3
|
+
|
|
4
|
+
describe('createVariableValuesJss', () => {
|
|
5
|
+
it('returns an object with the correct variable names and values', () => {
|
|
6
|
+
const spacing = {
|
|
7
|
+
sm: SPACING_2,
|
|
8
|
+
md: SPACING_4,
|
|
9
|
+
lg: SPACING_6,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const prop = 'margin'
|
|
13
|
+
|
|
14
|
+
const expectedStyles = {
|
|
15
|
+
'--picasso-responsive--lg--margin': '1.5rem',
|
|
16
|
+
'--picasso-responsive--md--margin': '1rem',
|
|
17
|
+
'--picasso-responsive--sm--margin': '0.5rem',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const result = createVariableValuesJss(spacing, prop)
|
|
21
|
+
|
|
22
|
+
expect(result).toEqual(expectedStyles)
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BreakpointKeys, ResponsiveSpacingType } from '../../config'
|
|
2
|
+
import { spacingToRem } from '../spacings'
|
|
3
|
+
import { toCssVariableName } from './to-css-variable-name'
|
|
4
|
+
import type { ResponsiveCssProp } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a CSS class setting the picasso responsive CSS variable of the given CSS property
|
|
8
|
+
* for all breakpoints on the responsive spacing value
|
|
9
|
+
*/
|
|
10
|
+
export const createVariableValuesJss = (
|
|
11
|
+
spacing: ResponsiveSpacingType,
|
|
12
|
+
prop: ResponsiveCssProp
|
|
13
|
+
) => {
|
|
14
|
+
const styles: Record<string, string> = {}
|
|
15
|
+
|
|
16
|
+
for (const [brk, value] of Object.entries(spacing)) {
|
|
17
|
+
styles[toCssVariableName(brk as BreakpointKeys, prop)] = spacingToRem(value)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return styles
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defaultCssProp } from './default-css-prop'
|
|
2
|
+
|
|
3
|
+
describe('defaultCssProp', () => {
|
|
4
|
+
it('returns an object with the kebab-case CSS property converted to camelCase and the value converted to rem format', () => {
|
|
5
|
+
const value = 8
|
|
6
|
+
const prop = 'margin'
|
|
7
|
+
const expectedStyles = {
|
|
8
|
+
margin: '8rem',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const result = defaultCssProp(value, prop)
|
|
12
|
+
|
|
13
|
+
expect(result).toEqual(expectedStyles)
|
|
14
|
+
})
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { kebabToCamelCase } from '../../../utils'
|
|
2
|
+
import type { ResponsiveSpacingType, SpacingType } from '../../config'
|
|
3
|
+
import type { ResponsiveCssProp } from './types'
|
|
4
|
+
import { spacingToRem } from '../spacings'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Just the default for a value that is not responsive
|
|
8
|
+
* Just set the prop directly on all media queries
|
|
9
|
+
*/
|
|
10
|
+
export const defaultCssProp = (
|
|
11
|
+
value: Exclude<SpacingType, ResponsiveSpacingType>,
|
|
12
|
+
prop: ResponsiveCssProp
|
|
13
|
+
) => ({
|
|
14
|
+
[kebabToCamelCase(prop)]: spacingToRem(value),
|
|
15
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SPACING_4, SPACING_8 } from '../../config/spacings'
|
|
2
|
+
import { generateVariableInlineStyles } from './generate-variable-inline-styles'
|
|
3
|
+
|
|
4
|
+
describe('generateVariableInlineStyles', () => {
|
|
5
|
+
it('returns an object with inline styles based on the provided props and values', () => {
|
|
6
|
+
const props = ['margin', 'padding']
|
|
7
|
+
const values = {
|
|
8
|
+
margin: SPACING_8,
|
|
9
|
+
padding: SPACING_4,
|
|
10
|
+
}
|
|
11
|
+
const expectedInlineStyles = {
|
|
12
|
+
margin: '2rem',
|
|
13
|
+
padding: '1rem',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const result = generateVariableInlineStyles(props, values)
|
|
17
|
+
|
|
18
|
+
expect(result).toEqual(expectedInlineStyles)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isResponsiveSpacing } from '../../config'
|
|
2
|
+
import { createVariableValuesJss } from './create-variable-values-jss'
|
|
3
|
+
import { defaultCssProp } from './default-css-prop'
|
|
4
|
+
import type { ResponsiveCssSpacings } from './types'
|
|
5
|
+
|
|
6
|
+
export const generateVariableInlineStyles = <K extends string>(
|
|
7
|
+
props: readonly K[],
|
|
8
|
+
values: ResponsiveCssSpacings<K>
|
|
9
|
+
) => {
|
|
10
|
+
const styles: Record<string, string> = {}
|
|
11
|
+
|
|
12
|
+
for (const prop of props) {
|
|
13
|
+
const value = values[prop]
|
|
14
|
+
|
|
15
|
+
if (value) {
|
|
16
|
+
Object.assign(
|
|
17
|
+
styles,
|
|
18
|
+
isResponsiveSpacing(value)
|
|
19
|
+
? createVariableValuesJss(value, prop)
|
|
20
|
+
: defaultCssProp(value, prop)
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return styles
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SPACING_1, SPACING_2, SPACING_4 } from '../../config/spacings'
|
|
2
|
+
import { getBreakpointClassNamesToUse } from './get-breakpoint-class-names-to-use'
|
|
3
|
+
|
|
4
|
+
describe('getBreakpointClassNamesToUse', () => {
|
|
5
|
+
it('returns an array of unique classNames based on the provided props and propSizes', () => {
|
|
6
|
+
const props = ['margin', 'padding']
|
|
7
|
+
const propSizes = {
|
|
8
|
+
margin: SPACING_1,
|
|
9
|
+
padding: {
|
|
10
|
+
sm: SPACING_2,
|
|
11
|
+
md: SPACING_4,
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
const expectedClassNames = ['sm--padding', 'md--padding']
|
|
15
|
+
|
|
16
|
+
const result = getBreakpointClassNamesToUse(props, propSizes)
|
|
17
|
+
|
|
18
|
+
expect(result).toEqual(expectedClassNames)
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BreakpointKeys } from '../../config'
|
|
2
|
+
import { isResponsiveSpacing } from '../../config'
|
|
3
|
+
import { toClassName } from './to-class-name'
|
|
4
|
+
import type { ResponsiveCssSpacings } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Filter which media queries CSS classes should be applied,
|
|
8
|
+
* we want to the element to fallback to the previous layer, so we only apply
|
|
9
|
+
* the media queries that are explicitly set on spacing value
|
|
10
|
+
*/
|
|
11
|
+
export const getBreakpointClassNamesToUse = <K extends string>(
|
|
12
|
+
props: readonly K[],
|
|
13
|
+
propSizes: ResponsiveCssSpacings<K>
|
|
14
|
+
) => {
|
|
15
|
+
const classNames = new Set<string>()
|
|
16
|
+
|
|
17
|
+
for (const prop of props) {
|
|
18
|
+
const spacing = propSizes[prop]
|
|
19
|
+
|
|
20
|
+
if (spacing && isResponsiveSpacing(spacing)) {
|
|
21
|
+
Object.keys(spacing)
|
|
22
|
+
.map(brk => toClassName(brk as BreakpointKeys, prop))
|
|
23
|
+
.forEach(classNames.add, classNames)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return [...classNames]
|
|
28
|
+
}
|
package/{Picasso/utils/responsive-styles/index.d.ts → src/Picasso/utils/responsive-styles/index.ts}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as makeResponsiveSpacingProps } from './make-responsive-spacing-props'
|
|
1
|
+
export { default as makeResponsiveSpacingProps } from './make-responsive-spacing-props'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import type { Theme } from '@material-ui/core'
|
|
3
|
+
import { makeStyles } from '@material-ui/core'
|
|
4
|
+
|
|
5
|
+
import { mediaQueriesClasses } from './media-queries-classes'
|
|
6
|
+
import type { ResponsiveCssProp, ResponsiveCssSpacings } from './types'
|
|
7
|
+
import { getBreakpointClassNamesToUse } from './get-breakpoint-class-names-to-use'
|
|
8
|
+
import { generateVariableInlineStyles } from './generate-variable-inline-styles'
|
|
9
|
+
|
|
10
|
+
const makeResponsiveSpacingProps = <K extends ResponsiveCssProp>(
|
|
11
|
+
props: readonly K[],
|
|
12
|
+
name: string
|
|
13
|
+
) => {
|
|
14
|
+
const useStyles = makeStyles<Theme>(
|
|
15
|
+
(theme: Theme) => mediaQueriesClasses(props, theme),
|
|
16
|
+
{
|
|
17
|
+
name: name,
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const useResponsiveClassNames = (propValues: ResponsiveCssSpacings<K>) => {
|
|
22
|
+
const classes = useStyles()
|
|
23
|
+
const mediaQueries = getBreakpointClassNamesToUse(props, propValues)
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
className: cx(...mediaQueries.map(brkClassName => classes[brkClassName])),
|
|
27
|
+
style: generateVariableInlineStyles(props, propValues),
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return useResponsiveClassNames
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default makeResponsiveSpacingProps
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core'
|
|
2
|
+
|
|
3
|
+
import { mediaQueriesClasses } from './media-queries-classes'
|
|
4
|
+
|
|
5
|
+
describe('mediaQueriesClasses', () => {
|
|
6
|
+
it('returns an object with media queries classes based on the responsive props and theme', () => {
|
|
7
|
+
const responsiveProps = ['margin']
|
|
8
|
+
const theme = {
|
|
9
|
+
breakpoints: {
|
|
10
|
+
keys: ['sm', 'md'],
|
|
11
|
+
up: (breakpoint: number) => `@media (min-width: ${breakpoint})`,
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const expectedMediaQueries = {
|
|
16
|
+
'@media (min-width: md)': {
|
|
17
|
+
'md--margin': {
|
|
18
|
+
margin: 'var(--picasso-responsive--md--margin)',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
'@media (min-width: sm)': {
|
|
22
|
+
'sm--margin': {
|
|
23
|
+
margin: 'var(--picasso-responsive--sm--margin)',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const result = mediaQueriesClasses(responsiveProps, theme as Theme)
|
|
29
|
+
|
|
30
|
+
expect(result).toEqual(expectedMediaQueries)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core'
|
|
2
|
+
|
|
3
|
+
import type { ResponsiveCssProp } from './types'
|
|
4
|
+
import { createMediaQueries } from './create-media-queries'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Just aggregate all the media queries classes
|
|
8
|
+
* for all responsive props passed
|
|
9
|
+
*/
|
|
10
|
+
export const mediaQueriesClasses = <K extends ResponsiveCssProp>(
|
|
11
|
+
responsiveProps: readonly K[],
|
|
12
|
+
theme: Theme
|
|
13
|
+
) => {
|
|
14
|
+
const mediaQueries: Record<string, Record<string, string>> = {}
|
|
15
|
+
|
|
16
|
+
for (const prop of responsiveProps) {
|
|
17
|
+
const newMediaQueries = createMediaQueries(prop, theme)
|
|
18
|
+
|
|
19
|
+
for (const [brk, value] of Object.entries(newMediaQueries)) {
|
|
20
|
+
mediaQueries[brk] = {
|
|
21
|
+
...mediaQueries[brk],
|
|
22
|
+
...value,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return mediaQueries
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { toClassName } from './to-class-name'
|
|
2
|
+
|
|
3
|
+
describe('toClassName', () => {
|
|
4
|
+
it('returns a string with the breakpoint and prop separated by a double dash', () => {
|
|
5
|
+
const breakpoint = 'md'
|
|
6
|
+
const prop = 'color'
|
|
7
|
+
const expectedClassName = 'md--color'
|
|
8
|
+
|
|
9
|
+
const result = toClassName(breakpoint, prop)
|
|
10
|
+
|
|
11
|
+
expect(result).toBe(expectedClassName)
|
|
12
|
+
})
|
|
13
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { toCssVariableName } from './to-css-variable-name'
|
|
2
|
+
|
|
3
|
+
describe('toCssVariableName', () => {
|
|
4
|
+
it('returns a string in the correct format with the breakpoint and prop', () => {
|
|
5
|
+
const breakpoint = 'md'
|
|
6
|
+
const prop = 'color'
|
|
7
|
+
const expectedCssVariableName = '--picasso-responsive--md--color'
|
|
8
|
+
|
|
9
|
+
const result = toCssVariableName(breakpoint, prop)
|
|
10
|
+
|
|
11
|
+
expect(result).toBe(expectedCssVariableName)
|
|
12
|
+
})
|
|
13
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BreakpointKeys } from '../../config'
|
|
2
|
+
import type { ResponsiveCssProp } from './types'
|
|
3
|
+
|
|
4
|
+
export const toCssVariableName = (
|
|
5
|
+
breakpoint: BreakpointKeys,
|
|
6
|
+
prop: ResponsiveCssProp
|
|
7
|
+
) => {
|
|
8
|
+
return `--picasso-responsive--${breakpoint}--${prop}`
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { spacingToRem } from './spacings'
|
|
2
|
+
import {
|
|
3
|
+
SPACING_0,
|
|
4
|
+
SPACING_1,
|
|
5
|
+
SPACING_2,
|
|
6
|
+
SPACING_3,
|
|
7
|
+
SPACING_4,
|
|
8
|
+
SPACING_6,
|
|
9
|
+
SPACING_8,
|
|
10
|
+
SPACING_10,
|
|
11
|
+
SPACING_12,
|
|
12
|
+
} from '../config/spacings'
|
|
13
|
+
|
|
14
|
+
describe('spacingUtils', () => {
|
|
15
|
+
describe('spacingToRem', () => {
|
|
16
|
+
describe('when spacing is a number', () => {
|
|
17
|
+
it('converts to rem', () => {
|
|
18
|
+
expect(spacingToRem(1)).toBe('1rem')
|
|
19
|
+
expect(spacingToRem(2.5)).toBe('2.5rem')
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
describe('when spacing is a valid Picasso spacing', () => {
|
|
24
|
+
it('converts to rem', () => {
|
|
25
|
+
expect(spacingToRem(SPACING_0)).toBe('0rem')
|
|
26
|
+
expect(spacingToRem(SPACING_1)).toBe('0.25rem')
|
|
27
|
+
expect(spacingToRem(SPACING_2)).toBe('0.5rem')
|
|
28
|
+
expect(spacingToRem(SPACING_3)).toBe('0.75rem')
|
|
29
|
+
expect(spacingToRem(SPACING_4)).toBe('1rem')
|
|
30
|
+
expect(spacingToRem(SPACING_6)).toBe('1.5rem')
|
|
31
|
+
expect(spacingToRem(SPACING_8)).toBe('2rem')
|
|
32
|
+
expect(spacingToRem(SPACING_10)).toBe('2.5rem')
|
|
33
|
+
expect(spacingToRem(SPACING_12)).toBe('3rem')
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('when spacing is a string Picasso spacing', () => {
|
|
38
|
+
it('converts to rem', () => {
|
|
39
|
+
expect(spacingToRem('xsmall')).toBe('0.5rem')
|
|
40
|
+
expect(spacingToRem('small')).toBe('1rem')
|
|
41
|
+
expect(spacingToRem('medium')).toBe('1.5rem')
|
|
42
|
+
expect(spacingToRem('large')).toBe('2rem')
|
|
43
|
+
expect(spacingToRem('xlarge')).toBe('2.5rem')
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResponsiveSpacingType, SpacingType } from '../config/spacings'
|
|
2
|
+
import { SpacingEnum, isPicassoSpacing } from '../config/spacings'
|
|
3
|
+
|
|
4
|
+
const spacingToRem = (
|
|
5
|
+
spacing: Exclude<SpacingType, ResponsiveSpacingType>
|
|
6
|
+
): string => {
|
|
7
|
+
if (typeof spacing == 'number' || isPicassoSpacing(spacing)) {
|
|
8
|
+
return `${spacing.valueOf()}rem`
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return `${SpacingEnum[spacing]}rem`
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { spacingToRem }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core/styles'
|
|
2
|
+
import { makeStyles } from '@material-ui/core/styles'
|
|
3
|
+
|
|
4
|
+
import styles from './styles'
|
|
5
|
+
|
|
6
|
+
const useStyles = makeStyles<Theme>(styles, {
|
|
7
|
+
name: 'PicassoPreventPageWidthChangeOnScrollbar',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This component applies global styles that fix the problem with jumping page width.
|
|
12
|
+
* The problem comes from disappearing vertical page scrollbar due to varying page height.
|
|
13
|
+
*/
|
|
14
|
+
const PreventPageWidthChangeOnScrollbar = () => {
|
|
15
|
+
useStyles()
|
|
16
|
+
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default PreventPageWidthChangeOnScrollbar
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PreventPageWidthChangeOnScrollbar'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core/styles'
|
|
2
|
+
import { createStyles } from '@material-ui/core/styles'
|
|
3
|
+
|
|
4
|
+
export default ({ screens }: Theme) =>
|
|
5
|
+
createStyles({
|
|
6
|
+
'@global': {
|
|
7
|
+
[screens('md', 'lg', 'xl')]: {
|
|
8
|
+
html: {
|
|
9
|
+
width: '100%',
|
|
10
|
+
overflowX: 'hidden',
|
|
11
|
+
},
|
|
12
|
+
body: {
|
|
13
|
+
width: '100vw',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect'
|
|
1
|
+
export { default as useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// eslint-disable-next-line no-restricted-imports
|
|
2
|
+
import { useLayoutEffect, useEffect } from 'react'
|
|
3
|
+
|
|
4
|
+
import isBrowser from '../utils/is-browser'
|
|
5
|
+
|
|
6
|
+
const useIsomorphicLayoutEffect = isBrowser() ? useLayoutEffect : useEffect
|
|
7
|
+
|
|
8
|
+
export default useIsomorphicLayoutEffect
|