@voiceflow/style 1.1.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/CHANGELOG.md +21 -0
- package/build/cjs/ThemeContext.d.ts +9 -0
- package/build/cjs/ThemeContext.d.ts.map +1 -0
- package/build/cjs/ThemeContext.js +11 -0
- package/build/cjs/__fixtures__/Button/Button.component.d.ts +6 -0
- package/build/cjs/__fixtures__/Button/Button.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/Button/Button.component.js +30 -0
- package/build/cjs/__fixtures__/Button/Button.css.d.ts +2 -0
- package/build/cjs/__fixtures__/Button/Button.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/Button/Button.css.js +9 -0
- package/build/cjs/__fixtures__/Button/Button.styled.d.ts +2 -0
- package/build/cjs/__fixtures__/Button/Button.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/Button/Button.styled.js +6 -0
- package/build/cjs/__fixtures__/Button/index.d.ts +8 -0
- package/build/cjs/__fixtures__/Button/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/Button/index.js +30 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts +7 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.component.js +31 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.css.d.ts +2 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.css.js +32 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.styled.d.ts +11 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.styled.js +31 -0
- package/build/cjs/__fixtures__/InlineThemedButton/index.d.ts +6 -0
- package/build/cjs/__fixtures__/InlineThemedButton/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineThemedButton/index.js +29 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts +7 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.component.js +30 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.css.d.ts +3 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.css.js +12 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.styled.d.ts +4 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.styled.js +11 -0
- package/build/cjs/__fixtures__/InlineVarButton/index.d.ts +6 -0
- package/build/cjs/__fixtures__/InlineVarButton/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/InlineVarButton/index.js +29 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.component.d.ts +7 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.component.js +30 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.css.d.ts +22 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.css.js +23 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.styled.d.ts +7 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/RecipeButton/RecipeButton.styled.js +7 -0
- package/build/cjs/__fixtures__/RecipeButton/index.d.ts +9 -0
- package/build/cjs/__fixtures__/RecipeButton/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/RecipeButton/index.js +29 -0
- package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts +4 -0
- package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.component.js +7 -0
- package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.css.d.ts +2 -0
- package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.css.js +12 -0
- package/build/cjs/__fixtures__/ReuseCSS/index.d.ts +6 -0
- package/build/cjs/__fixtures__/ReuseCSS/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseCSS/index.js +29 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts +4 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.component.js +30 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.css.d.ts +2 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.css.js +8 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts +2 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.styled.js +7 -0
- package/build/cjs/__fixtures__/ReuseStyled/index.d.ts +6 -0
- package/build/cjs/__fixtures__/ReuseStyled/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ReuseStyled/index.js +29 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.component.d.ts +4 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.component.js +30 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.css.d.ts +2 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.css.js +32 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.styled.d.ts +2 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ThemedButton/ThemedButton.styled.js +7 -0
- package/build/cjs/__fixtures__/ThemedButton/index.d.ts +6 -0
- package/build/cjs/__fixtures__/ThemedButton/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/ThemedButton/index.js +29 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.component.d.ts +8 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.component.d.ts.map +1 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.component.js +30 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.css.d.ts +2 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.css.js +8 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.styled.d.ts +4 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.styled.d.ts.map +1 -0
- package/build/cjs/__fixtures__/VariantButton/VariantButton.styled.js +7 -0
- package/build/cjs/__fixtures__/VariantButton/index.d.ts +6 -0
- package/build/cjs/__fixtures__/VariantButton/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/VariantButton/index.js +29 -0
- package/build/cjs/__fixtures__/index.d.ts +10 -0
- package/build/cjs/__fixtures__/index.d.ts.map +1 -0
- package/build/cjs/__fixtures__/index.js +38 -0
- package/build/cjs/__fixtures__/theme.css.d.ts +17 -0
- package/build/cjs/__fixtures__/theme.css.d.ts.map +1 -0
- package/build/cjs/__fixtures__/theme.css.js +22 -0
- package/build/cjs/main.d.ts +7 -0
- package/build/cjs/main.d.ts.map +1 -0
- package/build/cjs/main.js +24 -0
- package/build/cjs/package.json +1 -0
- package/build/cjs/styled/constants.d.ts +2 -0
- package/build/cjs/styled/constants.d.ts.map +1 -0
- package/build/cjs/styled/constants.js +4 -0
- package/build/cjs/styled/factory.d.ts +180 -0
- package/build/cjs/styled/factory.d.ts.map +1 -0
- package/build/cjs/styled/factory.js +25 -0
- package/build/cjs/styled/factory.test.d.ts +2 -0
- package/build/cjs/styled/factory.test.d.ts.map +1 -0
- package/build/cjs/styled/factory.test.js +140 -0
- package/build/cjs/styled/index.d.ts +5 -0
- package/build/cjs/styled/index.d.ts.map +1 -0
- package/build/cjs/styled/index.js +20 -0
- package/build/cjs/styled/types.d.ts +47 -0
- package/build/cjs/styled/types.d.ts.map +1 -0
- package/build/cjs/styled/types.js +2 -0
- package/build/cjs/styled/utils.d.ts +9 -0
- package/build/cjs/styled/utils.d.ts.map +1 -0
- package/build/cjs/styled/utils.js +37 -0
- package/build/esm/ThemeContext.d.ts +9 -0
- package/build/esm/ThemeContext.d.ts.map +1 -0
- package/build/esm/ThemeContext.js +6 -0
- package/build/esm/__fixtures__/Button/Button.component.d.ts +6 -0
- package/build/esm/__fixtures__/Button/Button.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/Button/Button.component.js +3 -0
- package/build/esm/__fixtures__/Button/Button.css.d.ts +2 -0
- package/build/esm/__fixtures__/Button/Button.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/Button/Button.css.js +6 -0
- package/build/esm/__fixtures__/Button/Button.styled.d.ts +2 -0
- package/build/esm/__fixtures__/Button/Button.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/Button/Button.styled.js +3 -0
- package/build/esm/__fixtures__/Button/index.d.ts +8 -0
- package/build/esm/__fixtures__/Button/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/Button/index.js +4 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts +7 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.component.js +4 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.css.d.ts +2 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.css.js +6 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.styled.d.ts +11 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.styled.js +5 -0
- package/build/esm/__fixtures__/InlineThemedButton/index.d.ts +6 -0
- package/build/esm/__fixtures__/InlineThemedButton/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineThemedButton/index.js +3 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts +7 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.component.js +3 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.css.d.ts +3 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.css.js +9 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.styled.d.ts +4 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.styled.js +8 -0
- package/build/esm/__fixtures__/InlineVarButton/index.d.ts +6 -0
- package/build/esm/__fixtures__/InlineVarButton/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/InlineVarButton/index.js +3 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.component.d.ts +7 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.component.js +3 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.css.d.ts +22 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.css.js +20 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.styled.d.ts +7 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/RecipeButton/RecipeButton.styled.js +4 -0
- package/build/esm/__fixtures__/RecipeButton/index.d.ts +9 -0
- package/build/esm/__fixtures__/RecipeButton/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/RecipeButton/index.js +3 -0
- package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts +4 -0
- package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.component.js +3 -0
- package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.css.d.ts +2 -0
- package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.css.js +9 -0
- package/build/esm/__fixtures__/ReuseCSS/index.d.ts +6 -0
- package/build/esm/__fixtures__/ReuseCSS/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseCSS/index.js +3 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts +4 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.component.js +3 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.css.d.ts +2 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.css.js +5 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts +2 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.styled.js +4 -0
- package/build/esm/__fixtures__/ReuseStyled/index.d.ts +6 -0
- package/build/esm/__fixtures__/ReuseStyled/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/ReuseStyled/index.js +3 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.component.d.ts +4 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.component.js +3 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.css.d.ts +2 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.css.js +6 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.styled.d.ts +2 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/ThemedButton/ThemedButton.styled.js +4 -0
- package/build/esm/__fixtures__/ThemedButton/index.d.ts +6 -0
- package/build/esm/__fixtures__/ThemedButton/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/ThemedButton/index.js +3 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.component.d.ts +8 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.component.d.ts.map +1 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.component.js +3 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.css.d.ts +2 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.css.js +5 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.styled.d.ts +4 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.styled.d.ts.map +1 -0
- package/build/esm/__fixtures__/VariantButton/VariantButton.styled.js +4 -0
- package/build/esm/__fixtures__/VariantButton/index.d.ts +6 -0
- package/build/esm/__fixtures__/VariantButton/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/VariantButton/index.js +3 -0
- package/build/esm/__fixtures__/index.d.ts +10 -0
- package/build/esm/__fixtures__/index.d.ts.map +1 -0
- package/build/esm/__fixtures__/index.js +9 -0
- package/build/esm/__fixtures__/theme.css.d.ts +17 -0
- package/build/esm/__fixtures__/theme.css.d.ts.map +1 -0
- package/build/esm/__fixtures__/theme.css.js +18 -0
- package/build/esm/main.d.ts +7 -0
- package/build/esm/main.d.ts.map +1 -0
- package/build/esm/main.js +6 -0
- package/build/esm/package.json +1 -0
- package/build/esm/styled/constants.d.ts +2 -0
- package/build/esm/styled/constants.d.ts.map +1 -0
- package/build/esm/styled/constants.js +1 -0
- package/build/esm/styled/factory.d.ts +180 -0
- package/build/esm/styled/factory.d.ts.map +1 -0
- package/build/esm/styled/factory.js +22 -0
- package/build/esm/styled/factory.test.d.ts +2 -0
- package/build/esm/styled/factory.test.d.ts.map +1 -0
- package/build/esm/styled/factory.test.js +138 -0
- package/build/esm/styled/index.d.ts +5 -0
- package/build/esm/styled/index.d.ts.map +1 -0
- package/build/esm/styled/index.js +4 -0
- package/build/esm/styled/types.d.ts +47 -0
- package/build/esm/styled/types.d.ts.map +1 -0
- package/build/esm/styled/types.js +1 -0
- package/build/esm/styled/utils.d.ts +9 -0
- package/build/esm/styled/utils.d.ts.map +1 -0
- package/build/esm/styled/utils.js +30 -0
- package/config/test/setup.js +9 -0
- package/package.json +57 -0
- package/sonar-project.properties +10 -0
- package/src/ThemeContext.tsx +14 -0
- package/src/__fixtures__/Button/Button.component.tsx +7 -0
- package/src/__fixtures__/Button/Button.css.ts +7 -0
- package/src/__fixtures__/Button/Button.styled.ts +5 -0
- package/src/__fixtures__/Button/index.ts +7 -0
- package/src/__fixtures__/InlineThemedButton/InlineThemedButton.component.tsx +13 -0
- package/src/__fixtures__/InlineThemedButton/InlineThemedButton.css.ts +8 -0
- package/src/__fixtures__/InlineThemedButton/InlineThemedButton.styled.ts +7 -0
- package/src/__fixtures__/InlineThemedButton/index.ts +4 -0
- package/src/__fixtures__/InlineVarButton/InlineVarButton.component.tsx +12 -0
- package/src/__fixtures__/InlineVarButton/InlineVarButton.css.ts +12 -0
- package/src/__fixtures__/InlineVarButton/InlineVarButton.styled.ts +10 -0
- package/src/__fixtures__/InlineVarButton/index.ts +4 -0
- package/src/__fixtures__/RecipeButton/RecipeButton.component.tsx +13 -0
- package/src/__fixtures__/RecipeButton/RecipeButton.css.ts +22 -0
- package/src/__fixtures__/RecipeButton/RecipeButton.styled.ts +6 -0
- package/src/__fixtures__/RecipeButton/index.ts +4 -0
- package/src/__fixtures__/ReuseCSS/ReuseCSS.component.tsx +8 -0
- package/src/__fixtures__/ReuseCSS/ReuseCSS.css.ts +11 -0
- package/src/__fixtures__/ReuseCSS/index.ts +4 -0
- package/src/__fixtures__/ReuseStyled/ReuseStyled.component.tsx +6 -0
- package/src/__fixtures__/ReuseStyled/ReuseStyled.css.ts +6 -0
- package/src/__fixtures__/ReuseStyled/ReuseStyled.styled.ts +6 -0
- package/src/__fixtures__/ReuseStyled/index.ts +4 -0
- package/src/__fixtures__/ThemedButton/ThemedButton.component.tsx +6 -0
- package/src/__fixtures__/ThemedButton/ThemedButton.css.ts +8 -0
- package/src/__fixtures__/ThemedButton/ThemedButton.styled.ts +6 -0
- package/src/__fixtures__/ThemedButton/index.ts +4 -0
- package/src/__fixtures__/VariantButton/VariantButton.component.tsx +13 -0
- package/src/__fixtures__/VariantButton/VariantButton.css.ts +6 -0
- package/src/__fixtures__/VariantButton/VariantButton.styled.ts +6 -0
- package/src/__fixtures__/VariantButton/index.ts +4 -0
- package/src/__fixtures__/index.ts +9 -0
- package/src/__fixtures__/theme.css.ts +21 -0
- package/src/main.ts +6 -0
- package/src/styled/constants.ts +1 -0
- package/src/styled/factory.test.tsx +181 -0
- package/src/styled/factory.tsx +39 -0
- package/src/styled/index.ts +4 -0
- package/src/styled/types.ts +87 -0
- package/src/styled/utils.ts +56 -0
- package/tsconfig.build.cjs.json +8 -0
- package/tsconfig.build.esm.json +11 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +16 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.clsx = void 0;
|
|
18
|
+
__exportStar(require("./styled"), exports);
|
|
19
|
+
__exportStar(require("./ThemeContext"), exports);
|
|
20
|
+
__exportStar(require("@vanilla-extract/css"), exports);
|
|
21
|
+
__exportStar(require("@vanilla-extract/dynamic"), exports);
|
|
22
|
+
__exportStar(require("@vanilla-extract/recipes"), exports);
|
|
23
|
+
var clsx_1 = require("clsx");
|
|
24
|
+
Object.defineProperty(exports, "clsx", { enumerable: true, get: function () { return clsx_1.clsx; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs" }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/styled/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,eAAyB,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { StyledFactory } from './types';
|
|
2
|
+
export declare const styled: {
|
|
3
|
+
a: StyledFactory<"a">;
|
|
4
|
+
abbr: StyledFactory<"abbr">;
|
|
5
|
+
address: StyledFactory<"address">;
|
|
6
|
+
area: StyledFactory<"area">;
|
|
7
|
+
article: StyledFactory<"article">;
|
|
8
|
+
aside: StyledFactory<"aside">;
|
|
9
|
+
audio: StyledFactory<"audio">;
|
|
10
|
+
b: StyledFactory<"b">;
|
|
11
|
+
base: StyledFactory<"base">;
|
|
12
|
+
bdi: StyledFactory<"bdi">;
|
|
13
|
+
bdo: StyledFactory<"bdo">;
|
|
14
|
+
big: StyledFactory<"big">;
|
|
15
|
+
blockquote: StyledFactory<"blockquote">;
|
|
16
|
+
body: StyledFactory<"body">;
|
|
17
|
+
br: StyledFactory<"br">;
|
|
18
|
+
button: StyledFactory<"button">;
|
|
19
|
+
canvas: StyledFactory<"canvas">;
|
|
20
|
+
caption: StyledFactory<"caption">;
|
|
21
|
+
center: StyledFactory<"center">;
|
|
22
|
+
cite: StyledFactory<"cite">;
|
|
23
|
+
code: StyledFactory<"code">;
|
|
24
|
+
col: StyledFactory<"col">;
|
|
25
|
+
colgroup: StyledFactory<"colgroup">;
|
|
26
|
+
data: StyledFactory<"data">;
|
|
27
|
+
datalist: StyledFactory<"datalist">;
|
|
28
|
+
dd: StyledFactory<"dd">;
|
|
29
|
+
del: StyledFactory<"del">;
|
|
30
|
+
details: StyledFactory<"details">;
|
|
31
|
+
dfn: StyledFactory<"dfn">;
|
|
32
|
+
dialog: StyledFactory<"dialog">;
|
|
33
|
+
div: StyledFactory<"div">;
|
|
34
|
+
dl: StyledFactory<"dl">;
|
|
35
|
+
dt: StyledFactory<"dt">;
|
|
36
|
+
em: StyledFactory<"em">;
|
|
37
|
+
embed: StyledFactory<"embed">;
|
|
38
|
+
fieldset: StyledFactory<"fieldset">;
|
|
39
|
+
figcaption: StyledFactory<"figcaption">;
|
|
40
|
+
figure: StyledFactory<"figure">;
|
|
41
|
+
footer: StyledFactory<"footer">;
|
|
42
|
+
form: StyledFactory<"form">;
|
|
43
|
+
h1: StyledFactory<"h1">;
|
|
44
|
+
h2: StyledFactory<"h2">;
|
|
45
|
+
h3: StyledFactory<"h3">;
|
|
46
|
+
h4: StyledFactory<"h4">;
|
|
47
|
+
h5: StyledFactory<"h5">;
|
|
48
|
+
h6: StyledFactory<"h6">;
|
|
49
|
+
head: StyledFactory<"head">;
|
|
50
|
+
header: StyledFactory<"header">;
|
|
51
|
+
hgroup: StyledFactory<"hgroup">;
|
|
52
|
+
hr: StyledFactory<"hr">;
|
|
53
|
+
html: StyledFactory<"html">;
|
|
54
|
+
i: StyledFactory<"i">;
|
|
55
|
+
iframe: StyledFactory<"iframe">;
|
|
56
|
+
img: StyledFactory<"img">;
|
|
57
|
+
input: StyledFactory<"input">;
|
|
58
|
+
ins: StyledFactory<"ins">;
|
|
59
|
+
kbd: StyledFactory<"kbd">;
|
|
60
|
+
keygen: StyledFactory<"keygen">;
|
|
61
|
+
label: StyledFactory<"label">;
|
|
62
|
+
legend: StyledFactory<"legend">;
|
|
63
|
+
li: StyledFactory<"li">;
|
|
64
|
+
link: StyledFactory<"link">;
|
|
65
|
+
main: StyledFactory<"main">;
|
|
66
|
+
map: StyledFactory<"map">;
|
|
67
|
+
mark: StyledFactory<"mark">;
|
|
68
|
+
menu: StyledFactory<"menu">;
|
|
69
|
+
menuitem: StyledFactory<"menuitem">;
|
|
70
|
+
meta: StyledFactory<"meta">;
|
|
71
|
+
meter: StyledFactory<"meter">;
|
|
72
|
+
nav: StyledFactory<"nav">;
|
|
73
|
+
noindex: StyledFactory<"noindex">;
|
|
74
|
+
noscript: StyledFactory<"noscript">;
|
|
75
|
+
object: StyledFactory<"object">;
|
|
76
|
+
ol: StyledFactory<"ol">;
|
|
77
|
+
optgroup: StyledFactory<"optgroup">;
|
|
78
|
+
option: StyledFactory<"option">;
|
|
79
|
+
output: StyledFactory<"output">;
|
|
80
|
+
p: StyledFactory<"p">;
|
|
81
|
+
param: StyledFactory<"param">;
|
|
82
|
+
picture: StyledFactory<"picture">;
|
|
83
|
+
pre: StyledFactory<"pre">;
|
|
84
|
+
progress: StyledFactory<"progress">;
|
|
85
|
+
q: StyledFactory<"q">;
|
|
86
|
+
rp: StyledFactory<"rp">;
|
|
87
|
+
rt: StyledFactory<"rt">;
|
|
88
|
+
ruby: StyledFactory<"ruby">;
|
|
89
|
+
s: StyledFactory<"s">;
|
|
90
|
+
samp: StyledFactory<"samp">;
|
|
91
|
+
slot: StyledFactory<"slot">;
|
|
92
|
+
script: StyledFactory<"script">;
|
|
93
|
+
section: StyledFactory<"section">;
|
|
94
|
+
select: StyledFactory<"select">;
|
|
95
|
+
small: StyledFactory<"small">;
|
|
96
|
+
source: StyledFactory<"source">;
|
|
97
|
+
span: StyledFactory<"span">;
|
|
98
|
+
strong: StyledFactory<"strong">;
|
|
99
|
+
style: StyledFactory<"style">;
|
|
100
|
+
sub: StyledFactory<"sub">;
|
|
101
|
+
summary: StyledFactory<"summary">;
|
|
102
|
+
sup: StyledFactory<"sup">;
|
|
103
|
+
table: StyledFactory<"table">;
|
|
104
|
+
template: StyledFactory<"template">;
|
|
105
|
+
tbody: StyledFactory<"tbody">;
|
|
106
|
+
td: StyledFactory<"td">;
|
|
107
|
+
textarea: StyledFactory<"textarea">;
|
|
108
|
+
tfoot: StyledFactory<"tfoot">;
|
|
109
|
+
th: StyledFactory<"th">;
|
|
110
|
+
thead: StyledFactory<"thead">;
|
|
111
|
+
time: StyledFactory<"time">;
|
|
112
|
+
title: StyledFactory<"title">;
|
|
113
|
+
tr: StyledFactory<"tr">;
|
|
114
|
+
track: StyledFactory<"track">;
|
|
115
|
+
u: StyledFactory<"u">;
|
|
116
|
+
ul: StyledFactory<"ul">;
|
|
117
|
+
var: StyledFactory<"var">;
|
|
118
|
+
video: StyledFactory<"video">;
|
|
119
|
+
wbr: StyledFactory<"wbr">;
|
|
120
|
+
webview: StyledFactory<"webview">;
|
|
121
|
+
svg: StyledFactory<"svg">;
|
|
122
|
+
animate: StyledFactory<"animate">;
|
|
123
|
+
animateMotion: StyledFactory<"animateMotion">;
|
|
124
|
+
animateTransform: StyledFactory<"animateTransform">;
|
|
125
|
+
circle: StyledFactory<"circle">;
|
|
126
|
+
clipPath: StyledFactory<"clipPath">;
|
|
127
|
+
defs: StyledFactory<"defs">;
|
|
128
|
+
desc: StyledFactory<"desc">;
|
|
129
|
+
ellipse: StyledFactory<"ellipse">;
|
|
130
|
+
feBlend: StyledFactory<"feBlend">;
|
|
131
|
+
feColorMatrix: StyledFactory<"feColorMatrix">;
|
|
132
|
+
feComponentTransfer: StyledFactory<"feComponentTransfer">;
|
|
133
|
+
feComposite: StyledFactory<"feComposite">;
|
|
134
|
+
feConvolveMatrix: StyledFactory<"feConvolveMatrix">;
|
|
135
|
+
feDiffuseLighting: StyledFactory<"feDiffuseLighting">;
|
|
136
|
+
feDisplacementMap: StyledFactory<"feDisplacementMap">;
|
|
137
|
+
feDistantLight: StyledFactory<"feDistantLight">;
|
|
138
|
+
feDropShadow: StyledFactory<"feDropShadow">;
|
|
139
|
+
feFlood: StyledFactory<"feFlood">;
|
|
140
|
+
feFuncA: StyledFactory<"feFuncA">;
|
|
141
|
+
feFuncB: StyledFactory<"feFuncB">;
|
|
142
|
+
feFuncG: StyledFactory<"feFuncG">;
|
|
143
|
+
feFuncR: StyledFactory<"feFuncR">;
|
|
144
|
+
feGaussianBlur: StyledFactory<"feGaussianBlur">;
|
|
145
|
+
feImage: StyledFactory<"feImage">;
|
|
146
|
+
feMerge: StyledFactory<"feMerge">;
|
|
147
|
+
feMergeNode: StyledFactory<"feMergeNode">;
|
|
148
|
+
feMorphology: StyledFactory<"feMorphology">;
|
|
149
|
+
feOffset: StyledFactory<"feOffset">;
|
|
150
|
+
fePointLight: StyledFactory<"fePointLight">;
|
|
151
|
+
feSpecularLighting: StyledFactory<"feSpecularLighting">;
|
|
152
|
+
feSpotLight: StyledFactory<"feSpotLight">;
|
|
153
|
+
feTile: StyledFactory<"feTile">;
|
|
154
|
+
feTurbulence: StyledFactory<"feTurbulence">;
|
|
155
|
+
filter: StyledFactory<"filter">;
|
|
156
|
+
foreignObject: StyledFactory<"foreignObject">;
|
|
157
|
+
g: StyledFactory<"g">;
|
|
158
|
+
image: StyledFactory<"image">;
|
|
159
|
+
line: StyledFactory<"line">;
|
|
160
|
+
linearGradient: StyledFactory<"linearGradient">;
|
|
161
|
+
marker: StyledFactory<"marker">;
|
|
162
|
+
mask: StyledFactory<"mask">;
|
|
163
|
+
metadata: StyledFactory<"metadata">;
|
|
164
|
+
mpath: StyledFactory<"mpath">;
|
|
165
|
+
path: StyledFactory<"path">;
|
|
166
|
+
pattern: StyledFactory<"pattern">;
|
|
167
|
+
polygon: StyledFactory<"polygon">;
|
|
168
|
+
polyline: StyledFactory<"polyline">;
|
|
169
|
+
radialGradient: StyledFactory<"radialGradient">;
|
|
170
|
+
rect: StyledFactory<"rect">;
|
|
171
|
+
stop: StyledFactory<"stop">;
|
|
172
|
+
switch: StyledFactory<"switch">;
|
|
173
|
+
symbol: StyledFactory<"symbol">;
|
|
174
|
+
text: StyledFactory<"text">;
|
|
175
|
+
textPath: StyledFactory<"textPath">;
|
|
176
|
+
tspan: StyledFactory<"tspan">;
|
|
177
|
+
use: StyledFactory<"use">;
|
|
178
|
+
view: StyledFactory<"view">;
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/styled/factory.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAMV,aAAa,EACd,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBjB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.styled = void 0;
|
|
4
|
+
const clsx_1 = require("clsx");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ThemeContext_1 = require("../ThemeContext");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
exports.styled = new Proxy({}, {
|
|
10
|
+
get: (_target, tag) => (firstArg, secondArg, thirdArg) => {
|
|
11
|
+
const staticClass = (0, utils_1.getStaticClass)(firstArg, secondArg);
|
|
12
|
+
const dynamicOptions = (0, utils_1.getDynamicOptions)(secondArg, thirdArg);
|
|
13
|
+
const StyledComponent = (props) => {
|
|
14
|
+
const themeClass = (0, ThemeContext_1.useTheme)();
|
|
15
|
+
const dynamicClass = (0, utils_1.useDynamicClass)(firstArg, props);
|
|
16
|
+
const inlineStyle = (0, utils_1.useInlineStyle)(props, dynamicOptions);
|
|
17
|
+
return (0, react_1.createElement)(tag, {
|
|
18
|
+
...props,
|
|
19
|
+
className: (0, clsx_1.clsx)(themeClass, staticClass, dynamicClass, props.className),
|
|
20
|
+
style: { ...inlineStyle, ...props.style },
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
return Object.assign(StyledComponent, { [constants_1.STYLED_CLASS]: staticClass });
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.test.d.ts","sourceRoot":"","sources":["../../../src/styled/factory.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("@testing-library/react");
|
|
5
|
+
const vitest_1 = require("vitest");
|
|
6
|
+
const __fixtures__1 = require("../__fixtures__");
|
|
7
|
+
const ThemeContext_1 = require("../ThemeContext");
|
|
8
|
+
const BASE_STYLE = {
|
|
9
|
+
padding: '20px',
|
|
10
|
+
borderRadius: '10px',
|
|
11
|
+
margin: '10px',
|
|
12
|
+
};
|
|
13
|
+
(0, vitest_1.describe)('styled factory', () => {
|
|
14
|
+
(0, vitest_1.describe)('static styling', () => {
|
|
15
|
+
(0, vitest_1.it)('should inherit styles from static CSS', () => {
|
|
16
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.Button, {}));
|
|
17
|
+
const el = react_1.screen.getByRole('button');
|
|
18
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base);
|
|
19
|
+
expect(el).toHaveStyle(BASE_STYLE);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
(0, vitest_1.describe)('reusable CSS', () => {
|
|
23
|
+
(0, vitest_1.it)('should extend static CSS with overrides', () => {
|
|
24
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.ReuseCSS, {}));
|
|
25
|
+
const el = react_1.screen.getByRole('button');
|
|
26
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.ReuseCSS.css.base);
|
|
27
|
+
expect(el).toHaveStyle({
|
|
28
|
+
padding: '20px',
|
|
29
|
+
margin: '10px',
|
|
30
|
+
backgroundColor: 'red',
|
|
31
|
+
borderRadius: '0',
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
(0, vitest_1.describe)('reusable styled components', () => {
|
|
36
|
+
(0, vitest_1.it)('should extend styled component with overrides', () => {
|
|
37
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.ReuseStyled, {}));
|
|
38
|
+
const el = react_1.screen.getByRole('button');
|
|
39
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.ReuseStyled.css.override);
|
|
40
|
+
expect(el).toHaveStyle({
|
|
41
|
+
padding: '20px',
|
|
42
|
+
border: '1px solid red',
|
|
43
|
+
margin: '2px',
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.describe)('style variants', () => {
|
|
48
|
+
(0, vitest_1.it)('should render the primary style variant', () => {
|
|
49
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.VariantButton, { variant: "primary" }));
|
|
50
|
+
const el = react_1.screen.getByRole('button');
|
|
51
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.VariantButton.css.variants.primary);
|
|
52
|
+
expect(el).toHaveStyle({
|
|
53
|
+
...BASE_STYLE,
|
|
54
|
+
borderWidth: '2px',
|
|
55
|
+
borderColor: 'pink',
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('should render the secondary style variant', () => {
|
|
59
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.VariantButton, { variant: "secondary" }));
|
|
60
|
+
const el = react_1.screen.getByRole('button');
|
|
61
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.VariantButton.css.variants.secondary);
|
|
62
|
+
expect(el).toHaveStyle({
|
|
63
|
+
...BASE_STYLE,
|
|
64
|
+
borderWidth: '2px',
|
|
65
|
+
borderColor: 'blue',
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
(0, vitest_1.describe)('style recipes', () => {
|
|
70
|
+
(0, vitest_1.it)('should render a recipe with default variants', () => {
|
|
71
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.RecipeButton, {}));
|
|
72
|
+
const el = react_1.screen.getByRole('button');
|
|
73
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base);
|
|
74
|
+
expect(el).toHaveStyle({
|
|
75
|
+
...BASE_STYLE,
|
|
76
|
+
border: '1px dashed black',
|
|
77
|
+
fontSize: '18px',
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
(0, vitest_1.it)('should render a recipe with selected variants', () => {
|
|
81
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.RecipeButton, { fontSize: "sm", color: "warn" }));
|
|
82
|
+
const el = react_1.screen.getByRole('button');
|
|
83
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base);
|
|
84
|
+
expect(el).toHaveStyle({
|
|
85
|
+
...BASE_STYLE,
|
|
86
|
+
border: '1px dashed black',
|
|
87
|
+
backgroundColor: 'orange',
|
|
88
|
+
fontSize: '10px',
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
// unable to test CSS variables fully in JSDOM it seems
|
|
93
|
+
// https://github.com/jsdom/jsdom/pull/3299
|
|
94
|
+
vitest_1.describe.skip('themed components', () => {
|
|
95
|
+
(0, vitest_1.it)('should render styles from the provided theme', () => {
|
|
96
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ThemeContext_1.ThemeProvider, { theme: __fixtures__1.Theme.light, children: (0, jsx_runtime_1.jsx)(__fixtures__1.ThemedButton, {}) }));
|
|
97
|
+
const el = react_1.screen.getByRole('button');
|
|
98
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.ThemedButton.css.themed);
|
|
99
|
+
expect(el).toHaveStyle({
|
|
100
|
+
...BASE_STYLE,
|
|
101
|
+
color: 'red',
|
|
102
|
+
borderRadius: '0',
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
(0, vitest_1.it)('should override styles with contextual themes', () => {
|
|
106
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ThemeContext_1.ThemeProvider, { theme: __fixtures__1.Theme.light, children: (0, jsx_runtime_1.jsx)(ThemeContext_1.ThemeProvider, { theme: __fixtures__1.Theme.dark, children: (0, jsx_runtime_1.jsx)(__fixtures__1.ThemedButton, {}) }) }));
|
|
107
|
+
const el = react_1.screen.getByRole('button');
|
|
108
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.ThemedButton.css.themed);
|
|
109
|
+
expect(el).toHaveStyle({
|
|
110
|
+
...BASE_STYLE,
|
|
111
|
+
color: 'blue',
|
|
112
|
+
borderRadius: '0',
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
vitest_1.describe.skip('inline CSS variables', () => {
|
|
117
|
+
(0, vitest_1.it)('should render style from dynamic values', () => {
|
|
118
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.InlineVarButton, { brandColor: "green" }));
|
|
119
|
+
const el = react_1.screen.getByRole('button');
|
|
120
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.InlineVarButton.css.base);
|
|
121
|
+
expect(el).toHaveStyle({
|
|
122
|
+
...BASE_STYLE,
|
|
123
|
+
color: 'green',
|
|
124
|
+
borderRadius: '0',
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
vitest_1.describe.skip('inline theme', () => {
|
|
129
|
+
(0, vitest_1.it)('should render style from inline theme', () => {
|
|
130
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(__fixtures__1.InlineThemedButton, { brandColor: "green" }));
|
|
131
|
+
const el = react_1.screen.getByRole('button');
|
|
132
|
+
expect(el).toHaveClass(__fixtures__1.Button.css.base, __fixtures__1.InlineThemedButton.css.themed);
|
|
133
|
+
expect(el).toHaveStyle({
|
|
134
|
+
...BASE_STYLE,
|
|
135
|
+
color: 'green',
|
|
136
|
+
borderRadius: '0',
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/styled/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./factory"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { assignInlineVars } from '@vanilla-extract/dynamic';
|
|
3
|
+
import type { RecipeVariants, RuntimeFn } from '@vanilla-extract/recipes';
|
|
4
|
+
import type { STYLED_CLASS } from './constants';
|
|
5
|
+
export type ThemeContract = Parameters<typeof assignInlineVars>[0];
|
|
6
|
+
export interface DynamicOptions<Theme extends ThemeContract | null = ThemeContract, Variables extends Record<string, string> | null = Record<string, string>> {
|
|
7
|
+
/**
|
|
8
|
+
* the contract for a theme that can be overridden via a `theme` prop
|
|
9
|
+
*/
|
|
10
|
+
theme?: Theme;
|
|
11
|
+
/**
|
|
12
|
+
* variables that can be overridden via a `vars` prop
|
|
13
|
+
*/
|
|
14
|
+
vars?: Variables;
|
|
15
|
+
}
|
|
16
|
+
export type DynamicThemeProps<Theme> = Theme extends ThemeContract ? {
|
|
17
|
+
/**
|
|
18
|
+
* inline override for the theme used to style this component
|
|
19
|
+
*/
|
|
20
|
+
theme?: Parameters<typeof assignInlineVars<Theme>>[1];
|
|
21
|
+
} : {};
|
|
22
|
+
export type DynamicVariablesProps<Variables> = Variables extends Record<string, string> ? {
|
|
23
|
+
/**
|
|
24
|
+
* inline override for variables used to styled this component
|
|
25
|
+
*/
|
|
26
|
+
vars?: Partial<{
|
|
27
|
+
[K in keyof Variables]: string;
|
|
28
|
+
}>;
|
|
29
|
+
} : {};
|
|
30
|
+
export type StyledComponentProps<Tag extends keyof JSX.IntrinsicElements, Theme, Variables, Extras extends object = {}> = React.ComponentProps<Tag> & DynamicThemeProps<Theme> & DynamicVariablesProps<Variables> & Extras;
|
|
31
|
+
export interface StyledComponent<Props = {}> extends React.FunctionComponent<Props> {
|
|
32
|
+
(props: Props, context?: any): React.ReactElement<any, any> | null;
|
|
33
|
+
[STYLED_CLASS]: string | null;
|
|
34
|
+
}
|
|
35
|
+
export type StyleSource = StyledComponent | string;
|
|
36
|
+
export interface StyledFactory<Tag extends keyof JSX.IntrinsicElements> {
|
|
37
|
+
<Recipe extends RuntimeFn<Record<string, any>>, Theme extends ThemeContract | null = null, Variables extends Record<string, string> | null = null>(recipe: Recipe, sources?: StyleSource[], dynamic?: DynamicOptions<Theme, Variables>): StyledComponent<StyledComponentProps<Tag, Theme, Variables, {
|
|
38
|
+
variants: RecipeVariants<Recipe>;
|
|
39
|
+
}>>;
|
|
40
|
+
<Variant extends string, Theme extends ThemeContract | null = null, Variables extends Record<string, string> | null = null>(variants: Record<Variant, string>, sources?: StyleSource[], dynamic?: DynamicOptions<Theme, Variables>): StyledComponent<StyledComponentProps<Tag, Theme, Variables, {
|
|
41
|
+
variant: Variant;
|
|
42
|
+
}>>;
|
|
43
|
+
<Theme extends ThemeContract | null = null, Variables extends Record<string, string> | null = null>(sources: StyleSource[], dynamic?: DynamicOptions<Theme, Variables>): StyledComponent<StyledComponentProps<Tag, Theme, Variables>>;
|
|
44
|
+
}
|
|
45
|
+
export type FirstStyledArgument<Variants extends {} = any> = RuntimeFn<Variants> | Record<string, string> | StyleSource[];
|
|
46
|
+
export type SecondStyledArgument = StyleSource[] | DynamicOptions;
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/styled/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DynamicOptions, FirstStyledArgument, SecondStyledArgument, StyledComponentProps, ThemeContract } from './types';
|
|
2
|
+
export declare const getStaticClass: (firstArg: FirstStyledArgument, secondArg?: SecondStyledArgument) => string | null;
|
|
3
|
+
export declare const getDynamicOptions: (secondArg?: SecondStyledArgument, thirdArg?: DynamicOptions) => DynamicOptions | null;
|
|
4
|
+
export declare const useDynamicClass: (firstArg: FirstStyledArgument<any>, props: {
|
|
5
|
+
variant?: string;
|
|
6
|
+
variants?: Record<string, any>;
|
|
7
|
+
}) => string | null;
|
|
8
|
+
export declare const useInlineStyle: (props: StyledComponentProps<keyof JSX.IntrinsicElements, ThemeContract, Record<string, string>>, dynamicOptions: DynamicOptions | null) => {};
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/styled/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,cAAc,aAAc,mBAAmB,cAAc,oBAAoB,KAAG,MAAM,GAAG,IAOzG,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAAgB,oBAAoB,aAAa,cAAc,KAAG,cAAc,GAAG,IACtD,CAAC;AAE5D,eAAO,MAAM,eAAe,aAChB,oBAAoB,GAAG,CAAC,SAC3B;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,kBAOd,CAAC;AAEhD,eAAO,MAAM,cAAc,UAClB,qBAAqB,MAAM,IAAI,iBAAiB,EAAE,aAAa,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC,kBAC/E,cAAc,GAAG,IAAI,OAiBtC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInlineStyle = exports.useDynamicClass = exports.getDynamicOptions = exports.getStaticClass = void 0;
|
|
4
|
+
const dynamic_1 = require("@vanilla-extract/dynamic");
|
|
5
|
+
const clsx_1 = require("clsx");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const getStaticClass = (firstArg, secondArg) => {
|
|
9
|
+
// eslint-disable-next-line no-nested-ternary
|
|
10
|
+
const classNames = (Array.isArray(firstArg) ? firstArg : Array.isArray(secondArg) ? secondArg : []).map((source) => typeof source === 'string' ? source : source[constants_1.STYLED_CLASS]);
|
|
11
|
+
return classNames.length ? (0, clsx_1.clsx)(classNames) : null;
|
|
12
|
+
};
|
|
13
|
+
exports.getStaticClass = getStaticClass;
|
|
14
|
+
const getDynamicOptions = (secondArg, thirdArg) => (Array.isArray(secondArg) ? thirdArg : secondArg) ?? null;
|
|
15
|
+
exports.getDynamicOptions = getDynamicOptions;
|
|
16
|
+
const useDynamicClass = (firstArg, props) => (0, react_1.useMemo)(() => {
|
|
17
|
+
if (typeof firstArg === 'function')
|
|
18
|
+
return firstArg(props.variants);
|
|
19
|
+
if (Array.isArray(firstArg) || !props.variant)
|
|
20
|
+
return null;
|
|
21
|
+
return firstArg[props.variant];
|
|
22
|
+
}, [firstArg, props.variants, props.variant]);
|
|
23
|
+
exports.useDynamicClass = useDynamicClass;
|
|
24
|
+
const useInlineStyle = (props, dynamicOptions) => {
|
|
25
|
+
const { theme, vars } = dynamicOptions ?? {};
|
|
26
|
+
return (0, react_1.useMemo)(() => {
|
|
27
|
+
const style = {};
|
|
28
|
+
if (theme && props.theme) {
|
|
29
|
+
Object.assign(style, (0, dynamic_1.assignInlineVars)(theme, props.theme));
|
|
30
|
+
}
|
|
31
|
+
if (vars && props.vars) {
|
|
32
|
+
Object.assign(style, (0, dynamic_1.assignInlineVars)(props.vars));
|
|
33
|
+
}
|
|
34
|
+
return style;
|
|
35
|
+
}, [props.theme, props.vars]);
|
|
36
|
+
};
|
|
37
|
+
exports.useInlineStyle = useInlineStyle;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ThemeContext: import("react").Context<string | null>;
|
|
3
|
+
export declare const ThemeConsumer: import("react").Consumer<string | null>;
|
|
4
|
+
export interface ThemeProviderProps extends React.PropsWithChildren {
|
|
5
|
+
theme: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
8
|
+
export declare const useTheme: () => string | null;
|
|
9
|
+
//# sourceMappingURL=ThemeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../src/ThemeContext.tsx"],"names":[],"mappings":";AAEA,eAAO,MAAM,YAAY,wCAAqC,CAAC;AAC/D,eAAO,MAAkB,aAAa,yCAAiB,CAAC;AAExD,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,iBAAiB;IACjE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAEtD,CAAC;AAEF,eAAO,MAAM,QAAQ,qBAAiC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
export const ThemeContext = createContext(null);
|
|
4
|
+
export const { Consumer: ThemeConsumer } = ThemeContext;
|
|
5
|
+
export const ThemeProvider = ({ theme, children }) => (_jsx(ThemeContext.Provider, { value: theme, children: children }));
|
|
6
|
+
export const useTheme = () => useContext(ThemeContext);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.component.d.ts","sourceRoot":"","sources":["../../../../src/__fixtures__/Button/Button.component.tsx"],"names":[],"mappings":";AAEA,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,iBAAiB;IAC1D,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAA4E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.css.d.ts","sourceRoot":"","sources":["../../../../src/__fixtures__/Button/Button.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,QAIf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.styled.d.ts","sourceRoot":"","sources":["../../../../src/__fixtures__/Button/Button.styled.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,mGAAwB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as css from './Button.css.js';
|
|
3
|
+
import * as styled from './Button.styled.js';
|
|
4
|
+
export type { ButtonProps } from './Button.component.js';
|
|
5
|
+
export declare const Button: import("react").FC<import("./Button.component.js").ButtonProps> & typeof styled & {
|
|
6
|
+
css: typeof css;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__fixtures__/Button/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAE1C,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,MAAM;;CAAkD,CAAC"}
|