@voiceflow/style 1.6.1 → 1.8.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.
Files changed (157) hide show
  1. package/build/cjs/ThemeContext.d.ts +0 -1
  2. package/build/cjs/ThemeContext.d.ts.map +1 -1
  3. package/build/cjs/__fixtures__/Button/Button.component.d.ts +0 -1
  4. package/build/cjs/__fixtures__/Button/Button.component.d.ts.map +1 -1
  5. package/build/cjs/__fixtures__/Button/Button.styled.d.ts +0 -1
  6. package/build/cjs/__fixtures__/Button/Button.styled.d.ts.map +1 -1
  7. package/build/cjs/__fixtures__/Button/index.d.ts +0 -1
  8. package/build/cjs/__fixtures__/Button/index.d.ts.map +1 -1
  9. package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts +0 -1
  10. package/build/cjs/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts.map +1 -1
  11. package/build/cjs/__fixtures__/InlineThemedButton/index.d.ts +0 -1
  12. package/build/cjs/__fixtures__/InlineThemedButton/index.d.ts.map +1 -1
  13. package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts +0 -1
  14. package/build/cjs/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts.map +1 -1
  15. package/build/cjs/__fixtures__/InlineVarButton/index.d.ts +0 -1
  16. package/build/cjs/__fixtures__/InlineVarButton/index.d.ts.map +1 -1
  17. package/build/cjs/__fixtures__/RecipeButton/RecipeButton.component.d.ts +0 -1
  18. package/build/cjs/__fixtures__/RecipeButton/RecipeButton.component.d.ts.map +1 -1
  19. package/build/cjs/__fixtures__/RecipeButton/index.d.ts +0 -1
  20. package/build/cjs/__fixtures__/RecipeButton/index.d.ts.map +1 -1
  21. package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts +0 -1
  22. package/build/cjs/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts.map +1 -1
  23. package/build/cjs/__fixtures__/ReuseCSS/index.d.ts +0 -1
  24. package/build/cjs/__fixtures__/ReuseCSS/index.d.ts.map +1 -1
  25. package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts +0 -1
  26. package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts.map +1 -1
  27. package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts +0 -1
  28. package/build/cjs/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts.map +1 -1
  29. package/build/cjs/__fixtures__/ReuseStyled/index.d.ts +0 -1
  30. package/build/cjs/__fixtures__/ReuseStyled/index.d.ts.map +1 -1
  31. package/build/cjs/__fixtures__/ThemedButton/ThemedButton.component.d.ts +0 -1
  32. package/build/cjs/__fixtures__/ThemedButton/ThemedButton.component.d.ts.map +1 -1
  33. package/build/cjs/__fixtures__/ThemedButton/ThemedButton.styled.d.ts +0 -1
  34. package/build/cjs/__fixtures__/ThemedButton/ThemedButton.styled.d.ts.map +1 -1
  35. package/build/cjs/__fixtures__/ThemedButton/index.d.ts +0 -1
  36. package/build/cjs/__fixtures__/ThemedButton/index.d.ts.map +1 -1
  37. package/build/cjs/__fixtures__/VariantButton/VariantButton.component.d.ts +0 -1
  38. package/build/cjs/__fixtures__/VariantButton/VariantButton.component.d.ts.map +1 -1
  39. package/build/cjs/__fixtures__/VariantButton/index.d.ts +0 -1
  40. package/build/cjs/__fixtures__/VariantButton/index.d.ts.map +1 -1
  41. package/build/cjs/main.d.ts +1 -0
  42. package/build/cjs/main.d.ts.map +1 -1
  43. package/build/cjs/main.js +1 -0
  44. package/build/cjs/styled/factory.d.ts +2 -1
  45. package/build/cjs/styled/factory.d.ts.map +1 -1
  46. package/build/cjs/styled/types.d.ts +0 -1
  47. package/build/cjs/styled/types.d.ts.map +1 -1
  48. package/build/cjs/testing.d.ts +6 -0
  49. package/build/cjs/testing.d.ts.map +1 -0
  50. package/build/cjs/testing.js +17 -0
  51. package/build/esm/ThemeContext.d.ts +0 -1
  52. package/build/esm/ThemeContext.d.ts.map +1 -1
  53. package/build/esm/__fixtures__/Button/Button.component.d.ts +0 -1
  54. package/build/esm/__fixtures__/Button/Button.component.d.ts.map +1 -1
  55. package/build/esm/__fixtures__/Button/Button.styled.d.ts +0 -1
  56. package/build/esm/__fixtures__/Button/Button.styled.d.ts.map +1 -1
  57. package/build/esm/__fixtures__/Button/index.d.ts +0 -1
  58. package/build/esm/__fixtures__/Button/index.d.ts.map +1 -1
  59. package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts +0 -1
  60. package/build/esm/__fixtures__/InlineThemedButton/InlineThemedButton.component.d.ts.map +1 -1
  61. package/build/esm/__fixtures__/InlineThemedButton/index.d.ts +0 -1
  62. package/build/esm/__fixtures__/InlineThemedButton/index.d.ts.map +1 -1
  63. package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts +0 -1
  64. package/build/esm/__fixtures__/InlineVarButton/InlineVarButton.component.d.ts.map +1 -1
  65. package/build/esm/__fixtures__/InlineVarButton/index.d.ts +0 -1
  66. package/build/esm/__fixtures__/InlineVarButton/index.d.ts.map +1 -1
  67. package/build/esm/__fixtures__/RecipeButton/RecipeButton.component.d.ts +0 -1
  68. package/build/esm/__fixtures__/RecipeButton/RecipeButton.component.d.ts.map +1 -1
  69. package/build/esm/__fixtures__/RecipeButton/index.d.ts +0 -1
  70. package/build/esm/__fixtures__/RecipeButton/index.d.ts.map +1 -1
  71. package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts +0 -1
  72. package/build/esm/__fixtures__/ReuseCSS/ReuseCSS.component.d.ts.map +1 -1
  73. package/build/esm/__fixtures__/ReuseCSS/index.d.ts +0 -1
  74. package/build/esm/__fixtures__/ReuseCSS/index.d.ts.map +1 -1
  75. package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts +0 -1
  76. package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.component.d.ts.map +1 -1
  77. package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts +0 -1
  78. package/build/esm/__fixtures__/ReuseStyled/ReuseStyled.styled.d.ts.map +1 -1
  79. package/build/esm/__fixtures__/ReuseStyled/index.d.ts +0 -1
  80. package/build/esm/__fixtures__/ReuseStyled/index.d.ts.map +1 -1
  81. package/build/esm/__fixtures__/ThemedButton/ThemedButton.component.d.ts +0 -1
  82. package/build/esm/__fixtures__/ThemedButton/ThemedButton.component.d.ts.map +1 -1
  83. package/build/esm/__fixtures__/ThemedButton/ThemedButton.styled.d.ts +0 -1
  84. package/build/esm/__fixtures__/ThemedButton/ThemedButton.styled.d.ts.map +1 -1
  85. package/build/esm/__fixtures__/ThemedButton/index.d.ts +0 -1
  86. package/build/esm/__fixtures__/ThemedButton/index.d.ts.map +1 -1
  87. package/build/esm/__fixtures__/VariantButton/VariantButton.component.d.ts +0 -1
  88. package/build/esm/__fixtures__/VariantButton/VariantButton.component.d.ts.map +1 -1
  89. package/build/esm/__fixtures__/VariantButton/index.d.ts +0 -1
  90. package/build/esm/__fixtures__/VariantButton/index.d.ts.map +1 -1
  91. package/build/esm/main.d.ts +1 -0
  92. package/build/esm/main.d.ts.map +1 -1
  93. package/build/esm/main.js +1 -0
  94. package/build/esm/styled/factory.d.ts +2 -1
  95. package/build/esm/styled/factory.d.ts.map +1 -1
  96. package/build/esm/styled/types.d.ts +0 -1
  97. package/build/esm/styled/types.d.ts.map +1 -1
  98. package/build/esm/testing.d.ts +6 -0
  99. package/build/esm/testing.d.ts.map +1 -0
  100. package/build/esm/testing.js +13 -0
  101. package/package.json +24 -31
  102. package/CHANGELOG.md +0 -99
  103. package/build/cjs/styled/factory.test.d.ts +0 -2
  104. package/build/cjs/styled/factory.test.d.ts.map +0 -1
  105. package/build/cjs/styled/factory.test.js +0 -140
  106. package/build/esm/styled/factory.test.d.ts +0 -2
  107. package/build/esm/styled/factory.test.d.ts.map +0 -1
  108. package/build/esm/styled/factory.test.js +0 -138
  109. package/config/test/setup.js +0 -9
  110. package/sonar-project.properties +0 -10
  111. package/src/ThemeContext.tsx +0 -14
  112. package/src/__fixtures__/Button/Button.component.tsx +0 -7
  113. package/src/__fixtures__/Button/Button.css.ts +0 -7
  114. package/src/__fixtures__/Button/Button.styled.ts +0 -5
  115. package/src/__fixtures__/Button/index.ts +0 -7
  116. package/src/__fixtures__/InlineThemedButton/InlineThemedButton.component.tsx +0 -13
  117. package/src/__fixtures__/InlineThemedButton/InlineThemedButton.css.ts +0 -8
  118. package/src/__fixtures__/InlineThemedButton/InlineThemedButton.styled.ts +0 -7
  119. package/src/__fixtures__/InlineThemedButton/index.ts +0 -4
  120. package/src/__fixtures__/InlineVarButton/InlineVarButton.component.tsx +0 -12
  121. package/src/__fixtures__/InlineVarButton/InlineVarButton.css.ts +0 -12
  122. package/src/__fixtures__/InlineVarButton/InlineVarButton.styled.ts +0 -10
  123. package/src/__fixtures__/InlineVarButton/index.ts +0 -4
  124. package/src/__fixtures__/RecipeButton/RecipeButton.component.tsx +0 -13
  125. package/src/__fixtures__/RecipeButton/RecipeButton.css.ts +0 -22
  126. package/src/__fixtures__/RecipeButton/RecipeButton.styled.ts +0 -6
  127. package/src/__fixtures__/RecipeButton/index.ts +0 -4
  128. package/src/__fixtures__/ReuseCSS/ReuseCSS.component.tsx +0 -8
  129. package/src/__fixtures__/ReuseCSS/ReuseCSS.css.ts +0 -11
  130. package/src/__fixtures__/ReuseCSS/index.ts +0 -4
  131. package/src/__fixtures__/ReuseStyled/ReuseStyled.component.tsx +0 -6
  132. package/src/__fixtures__/ReuseStyled/ReuseStyled.css.ts +0 -6
  133. package/src/__fixtures__/ReuseStyled/ReuseStyled.styled.ts +0 -6
  134. package/src/__fixtures__/ReuseStyled/index.ts +0 -4
  135. package/src/__fixtures__/ThemedButton/ThemedButton.component.tsx +0 -6
  136. package/src/__fixtures__/ThemedButton/ThemedButton.css.ts +0 -8
  137. package/src/__fixtures__/ThemedButton/ThemedButton.styled.ts +0 -6
  138. package/src/__fixtures__/ThemedButton/index.ts +0 -4
  139. package/src/__fixtures__/VariantButton/VariantButton.component.tsx +0 -13
  140. package/src/__fixtures__/VariantButton/VariantButton.css.ts +0 -6
  141. package/src/__fixtures__/VariantButton/VariantButton.styled.ts +0 -6
  142. package/src/__fixtures__/VariantButton/index.ts +0 -4
  143. package/src/__fixtures__/index.ts +0 -9
  144. package/src/__fixtures__/theme.css.ts +0 -21
  145. package/src/main.ts +0 -8
  146. package/src/styled/constants.ts +0 -1
  147. package/src/styled/factory.test.tsx +0 -181
  148. package/src/styled/factory.tsx +0 -39
  149. package/src/styled/index.ts +0 -4
  150. package/src/styled/types.ts +0 -87
  151. package/src/styled/utils.ts +0 -56
  152. package/src/types.ts +0 -10
  153. package/tsconfig.build.cjs.json +0 -8
  154. package/tsconfig.build.esm.json +0 -11
  155. package/tsconfig.build.json +0 -5
  156. package/tsconfig.json +0 -9
  157. package/vitest.config.ts +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__fixtures__/VariantButton/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,eAAO,MAAM,aAAa;;CAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/__fixtures__/VariantButton/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,eAAO,MAAM,aAAa;;CAAiD,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './styled/index.js';
2
+ export * from './testing.js';
2
3
  export * from './ThemeContext.js';
3
4
  export * from './types.js';
4
5
  export * from '@vanilla-extract/css';
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC"}
package/build/esm/main.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './styled/index.js';
2
+ export * from './testing.js';
2
3
  export * from './ThemeContext.js';
3
4
  export * from './types.js';
4
5
  export * from '@vanilla-extract/css';
@@ -88,6 +88,7 @@ export declare const styled: {
88
88
  ruby: StyledFactory<"ruby">;
89
89
  s: StyledFactory<"s">;
90
90
  samp: StyledFactory<"samp">;
91
+ search: StyledFactory<"search">;
91
92
  slot: StyledFactory<"slot">;
92
93
  script: StyledFactory<"script">;
93
94
  section: StyledFactory<"section">;
@@ -168,6 +169,7 @@ export declare const styled: {
168
169
  polyline: StyledFactory<"polyline">;
169
170
  radialGradient: StyledFactory<"radialGradient">;
170
171
  rect: StyledFactory<"rect">;
172
+ set: StyledFactory<"set">;
171
173
  stop: StyledFactory<"stop">;
172
174
  switch: StyledFactory<"switch">;
173
175
  symbol: StyledFactory<"symbol">;
@@ -176,6 +178,5 @@ export declare const styled: {
176
178
  tspan: StyledFactory<"tspan">;
177
179
  use: StyledFactory<"use">;
178
180
  view: StyledFactory<"view">;
179
- search: StyledFactory<"search">;
180
181
  };
181
182
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +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"}
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"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { assignInlineVars } from '@vanilla-extract/dynamic';
3
2
  import type { RecipeVariants, RuntimeFn } from '@vanilla-extract/recipes';
4
3
  import type { STYLED_CLASS } from './constants.js';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/styled/types.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,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AC,GACzC,eAAe,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;QAAE,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC,CAAC;IAEtG,CACE,OAAO,SAAS,MAAM,EACtB,KAAK,SAAS,aAAa,GAAG,IAAI,GAAG,IAAI,EACzC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,EAEtD,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,EACjC,OAAO,CAAC,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,GACzC,eAAe,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IAEtF,CAAC,KAAK,SAAS,aAAa,GAAG,IAAI,GAAG,IAAI,EAAE,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,EAChG,OAAO,EAAE,WAAW,EAAE,EACtB,OAAO,CAAC,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,GACzC,eAAe,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;CACjE;AAED,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,EAAE,GAAG,GAAG,IACrD,SAAS,CAAC,QAAQ,CAAC,GACnB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtB,WAAW,EAAE,CAAC;AAElB,MAAM,MAAM,oBAAoB,GAAG,WAAW,EAAE,GAAG,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * the pattern for data-testid attributes is based off of BEM naming
3
+ * https://getbem.com/naming/
4
+ */
5
+ export declare const tid: (block: string | undefined, elements: string | [string, string, ...string[]], modifier?: string) => string | undefined;
6
+ //# sourceMappingURL=testing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/testing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,GAAG,UAAW,MAAM,GAAG,SAAS,YAAY,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,aAAa,MAAM,uBASjH,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * the pattern for data-testid attributes is based off of BEM naming
3
+ * https://getbem.com/naming/
4
+ */
5
+ export const tid = (block, elements, modifier) => {
6
+ if (!block)
7
+ return undefined;
8
+ const elementList = typeof elements === 'string' ? [elements] : elements;
9
+ const blockElement = [block, ...elementList].join('__');
10
+ if (!modifier)
11
+ return blockElement;
12
+ return `${blockElement}--${modifier}`;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voiceflow/style",
3
- "version": "1.6.1",
3
+ "version": "1.8.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./build/cjs/main.d.ts",
@@ -10,46 +10,39 @@
10
10
  },
11
11
  "main": "build/cjs/main.js",
12
12
  "types": "build/cjs/main.d.ts",
13
+ "files": [
14
+ "build"
15
+ ],
13
16
  "scripts": {
14
- "build": "yarn g:run-p build:cjs build:esm",
15
- "prebuild:cjs": "yarn g:rimraf build/cjs",
16
- "build:cjs": "yarn prebuild:cjs && yarn g:tsc -p tsconfig.build.cjs.json && yarn g:tsc-alias -p tsconfig.build.cjs.json && yarn postbuild:cjs",
17
- "postbuild:cjs": "touch build/cjs/package.json && echo '{ \"type\": \"commonjs\" }' > build/cjs/package.json",
18
- "prebuild:esm": "yarn g:rimraf build/esm",
19
- "build:esm": "yarn prebuild:esm && yarn g:tsc -p tsconfig.build.esm.json && yarn g:tsc-alias -p tsconfig.build.esm.json && yarn postbuild:esm",
20
- "postbuild:esm": "touch build/esm/package.json && echo '{ \"type\": \"module\" }' > build/esm/package.json",
21
- "lint": "yarn g:run-p lint:eslint \"lint:prettier --check\"",
22
- "lint:eslint": "yarn g:eslint \"src/**/*.{js,ts}\"",
23
- "lint:fix": "yarn g:run-p \"lint:eslint --fix\" \"lint:prettier --write\"",
24
- "lint:prettier": "yarn g:prettier . \"!**/*.{js,ts}\"",
25
- "lint:report": "yarn g:eslint-output --quiet './src/**/*.{js,ts}'",
26
- "test": "yarn g:vitest",
27
- "test:check": "yarn g:tsc --noEmit",
28
- "test:dependencies": "yarn g:depcheck",
29
- "test:unit": "yarn g:vitest run"
30
- },
31
- "prettier": "@voiceflow-meta/prettier-config",
32
- "eslintConfig": {
33
- "extends": "@voiceflow-meta/eslint-config"
17
+ "build": "yarn g:turbo run build:cmd --filter=@voiceflow/style...",
18
+ "build:cjs": "yarn g:build:pkg cjs",
19
+ "build:cmd": "yarn g:run-p build:cjs build:esm",
20
+ "build:esm": "yarn g:build:pkg esm",
21
+ "clean": "yarn g:rimraf build",
22
+ "lint": "yarn g:run-p -c lint:eslint lint:prettier",
23
+ "lint:eslint": "yarn g:eslint",
24
+ "lint:fix": "yarn g:run-p -c \"lint:eslint --fix\" \"lint:prettier --write\"",
25
+ "lint:prettier": "yarn g:prettier --check",
26
+ "tdd": "yarn g:vitest",
27
+ "test": "yarn g:run-p -c test:dependencies test:types test:unit",
28
+ "test:dependencies": "yarn g:depcruise",
29
+ "test:types": "yarn g:tsc --noEmit",
30
+ "test:unit": "yarn g:vitest run --coverage"
34
31
  },
35
32
  "dependencies": {
36
33
  "@vanilla-extract/css": "1.13.0",
37
34
  "@vanilla-extract/dynamic": "2.0.3",
38
35
  "@vanilla-extract/recipes": "0.4.0",
39
36
  "clsx": "1.2.1",
40
- "type-fest": "3.13.1"
37
+ "type-fest": "4.15.0"
41
38
  },
42
39
  "devDependencies": {
43
- "@testing-library/jest-dom": "5.16.5",
44
- "@testing-library/react": "14.0.0",
45
- "@types/react": "18.0.35",
40
+ "@testing-library/jest-dom": "6.4.2",
41
+ "@testing-library/react": "15.0.2",
42
+ "@types/react": "18.2.77",
46
43
  "@vanilla-extract/vite-plugin": "3.9.0",
47
- "@voiceflow-meta/eslint-config": "1.3.2",
48
- "@voiceflow-meta/prettier-config": "1.1.2",
49
- "@voiceflow-meta/typescript-config": "1.0.2",
50
44
  "jsdom": "21.1.1",
51
- "react": "18.2.0",
52
- "vite-tsconfig-paths": "4.2.0"
45
+ "react": "18.2.0"
53
46
  },
54
47
  "peerDependencies": {
55
48
  "react": "^18"
@@ -57,5 +50,5 @@
57
50
  "volta": {
58
51
  "extends": "../../package.json"
59
52
  },
60
- "gitHead": "844cec71f4ea87938aa6d76c00257cbe062679b2"
53
+ "gitHead": "355332de54f9dabcef2f8b1903beecaae5734bb3"
61
54
  }
package/CHANGELOG.md DELETED
@@ -1,99 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [1.6.1](https://github.com/voiceflow/design/compare/@voiceflow/style@1.6.0...@voiceflow/style@1.6.1) (2024-01-19)
7
-
8
- **Note:** Version bump only for package @voiceflow/style
9
-
10
- # [1.6.0](https://github.com/voiceflow/design/compare/@voiceflow/style@1.5.3...@voiceflow/style@1.6.0) (2023-09-18)
11
-
12
- ### Features
13
-
14
- * adds classes identifiers (CV3-352) ([#215](https://github.com/voiceflow/design/issues/215)) ([b87182c](https://github.com/voiceflow/design/commit/b87182c68dbb1823eefe09523957ae74bca65a0f))
15
-
16
- ## [1.5.3](https://github.com/voiceflow/design/compare/@voiceflow/style@1.5.2...@voiceflow/style@1.5.3) (2023-09-12)
17
-
18
- **Note:** Version bump only for package @voiceflow/style
19
-
20
- ## [1.5.2](https://github.com/voiceflow/design/compare/@voiceflow/style@1.5.1...@voiceflow/style@1.5.2) (2023-09-07)
21
-
22
- **Note:** Version bump only for package @voiceflow/style
23
-
24
- ## [1.5.1](https://github.com/voiceflow/design/compare/@voiceflow/style@1.5.0...@voiceflow/style@1.5.1) (2023-08-28)
25
-
26
- **Note:** Version bump only for package @voiceflow/style
27
-
28
- # [1.5.0](https://github.com/voiceflow/design/compare/@voiceflow/style@1.4.1...@voiceflow/style@1.5.0) (2023-08-10)
29
-
30
- ### Features
31
-
32
- * update some libs ([#169](https://github.com/voiceflow/design/issues/169)) ([fb3ef72](https://github.com/voiceflow/design/commit/fb3ef72974a9e2db7645e8d385d3e5d08c4753ab))
33
-
34
- ## [1.4.1](https://github.com/voiceflow/design/compare/@voiceflow/style@1.4.0...@voiceflow/style@1.4.1) (2023-07-18)
35
-
36
- **Note:** Version bump only for package @voiceflow/style
37
-
38
- # [1.4.0](https://github.com/voiceflow/design/compare/@voiceflow/style@1.3.0...@voiceflow/style@1.4.0) (2023-07-07)
39
-
40
- ### Features
41
-
42
- * improve components to support SlateEditor (DX-000) ([#105](https://github.com/voiceflow/design/issues/105)) ([51c41e5](https://github.com/voiceflow/design/commit/51c41e53dc20c05244186638f8b22b2b2b768e75))
43
-
44
- # [1.3.0](https://github.com/voiceflow/design/compare/@voiceflow/style@1.2.5...@voiceflow/style@1.3.0) (2023-07-07)
45
-
46
- ### Features
47
-
48
- * improve menu component (DX-000) ([#110](https://github.com/voiceflow/design/issues/110)) ([fc772b5](https://github.com/voiceflow/design/commit/fc772b53d9b1c6184cff239354b7e085117c065b))
49
-
50
- ## [1.2.5](https://github.com/voiceflow/design/compare/@voiceflow/style@1.2.4...@voiceflow/style@1.2.5) (2023-07-05)
51
-
52
- ### Bug Fixes
53
-
54
- * types ([a5e92b0](https://github.com/voiceflow/design/commit/a5e92b0b370331e69d18ebd495e181283b411b3e))
55
-
56
- ## [1.2.4](https://github.com/voiceflow/design/compare/@voiceflow/style@1.2.3...@voiceflow/style@1.2.4) (2023-06-12)
57
-
58
- **Note:** Version bump only for package @voiceflow/style
59
-
60
- ## [1.2.3](https://github.com/voiceflow/design/compare/@voiceflow/style@1.2.2...@voiceflow/style@1.2.3) (2023-06-06)
61
-
62
- **Note:** Version bump only for package @voiceflow/style
63
-
64
- ## [1.2.2](https://github.com/voiceflow/design/compare/@voiceflow/style@1.2.1...@voiceflow/style@1.2.2) (2023-05-23)
65
-
66
- **Note:** Version bump only for package @voiceflow/style
67
-
68
- ## [1.2.1](https://github.com/voiceflow/design/compare/@voiceflow/style@1.2.0...@voiceflow/style@1.2.1) (2023-05-18)
69
-
70
- **Note:** Version bump only for package @voiceflow/style
71
-
72
- # [1.2.0](https://github.com/voiceflow/design/compare/@voiceflow/style@1.1.1...@voiceflow/style@1.2.0) (2023-05-09)
73
-
74
- ### Features
75
-
76
- * Button Component (DX-385) ([#19](https://github.com/voiceflow/design/issues/19)) ([1793b66](https://github.com/voiceflow/design/commit/1793b666a6dd80e5a86d820eb8fa14b3e8135b7e))
77
-
78
- ## [1.1.1](https://github.com/voiceflow/design/compare/@voiceflow/style@1.1.0...@voiceflow/style@1.1.1) (2023-05-08)
79
-
80
- ### Bug Fixes
81
-
82
- * add basic README docs ([c7041be](https://github.com/voiceflow/design/commit/c7041bea8ecc73c7381985b2d9a85ab6fb706a5c))
83
-
84
- # 1.1.0 (2023-04-26)
85
-
86
- ### Bug Fixes
87
-
88
- * correct import ([127fc98](https://github.com/voiceflow/design/commit/127fc9851e8e5e4e5dbea6d6b4216be6312da922))
89
- * working build ([4802e0c](https://github.com/voiceflow/design/commit/4802e0c7aee6a75d280e9c559be49f4e5c31c7d6))
90
-
91
- ### Features
92
-
93
- * add support for second argument to styled factory ([57c356d](https://github.com/voiceflow/design/commit/57c356d3efbce73a50675f10cba4b900f48844ef))
94
- * Add test setup && storybook setup (DX-407) ([#12](https://github.com/voiceflow/design/issues/12)) ([2c1a679](https://github.com/voiceflow/design/commit/2c1a679fc1e2fd939a83ed29dc73a00b156ce0f1))
95
- * add ui and style scaffolding ([f515d20](https://github.com/voiceflow/design/commit/f515d20df910d52d25a6e0d9b462c488048f27a0))
96
- * inline vars working ([6dbe628](https://github.com/voiceflow/design/commit/6dbe6288c803f971c5d53894257880a76aacb46e))
97
- * style variants ([f8f55d0](https://github.com/voiceflow/design/commit/f8f55d0c8d83e7bf4870e19843ae0f5df57b02e4))
98
- * styled component utils ([8d4a3ab](https://github.com/voiceflow/design/commit/8d4a3abfe20e62bfca810254635ceb1f4ed8afdc))
99
- * styled working ([622a4f1](https://github.com/voiceflow/design/commit/622a4f196051f262fd2bba52545c3dbe73a63306))
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=factory.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.test.d.ts","sourceRoot":"","sources":["../../../src/styled/factory.test.tsx"],"names":[],"mappings":""}
@@ -1,140 +0,0 @@
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
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=factory.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.test.d.ts","sourceRoot":"","sources":["../../../src/styled/factory.test.tsx"],"names":[],"mappings":""}
@@ -1,138 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
3
- import { describe, it } from 'vitest';
4
- import { Button, InlineThemedButton, InlineVarButton, RecipeButton, ReuseCSS, ReuseStyled, Theme, ThemedButton, VariantButton, } from '../__fixtures__/index.js';
5
- import { ThemeProvider } from '../ThemeContext.js';
6
- const BASE_STYLE = {
7
- padding: '20px',
8
- borderRadius: '10px',
9
- margin: '10px',
10
- };
11
- describe('styled factory', () => {
12
- describe('static styling', () => {
13
- it('should inherit styles from static CSS', () => {
14
- render(_jsx(Button, {}));
15
- const el = screen.getByRole('button');
16
- expect(el).toHaveClass(Button.css.base);
17
- expect(el).toHaveStyle(BASE_STYLE);
18
- });
19
- });
20
- describe('reusable CSS', () => {
21
- it('should extend static CSS with overrides', () => {
22
- render(_jsx(ReuseCSS, {}));
23
- const el = screen.getByRole('button');
24
- expect(el).toHaveClass(Button.css.base, ReuseCSS.css.base);
25
- expect(el).toHaveStyle({
26
- padding: '20px',
27
- margin: '10px',
28
- backgroundColor: 'red',
29
- borderRadius: '0',
30
- });
31
- });
32
- });
33
- describe('reusable styled components', () => {
34
- it('should extend styled component with overrides', () => {
35
- render(_jsx(ReuseStyled, {}));
36
- const el = screen.getByRole('button');
37
- expect(el).toHaveClass(Button.css.base, ReuseStyled.css.override);
38
- expect(el).toHaveStyle({
39
- padding: '20px',
40
- border: '1px solid red',
41
- margin: '2px',
42
- });
43
- });
44
- });
45
- describe('style variants', () => {
46
- it('should render the primary style variant', () => {
47
- render(_jsx(VariantButton, { variant: "primary" }));
48
- const el = screen.getByRole('button');
49
- expect(el).toHaveClass(Button.css.base, VariantButton.css.variants.primary);
50
- expect(el).toHaveStyle({
51
- ...BASE_STYLE,
52
- borderWidth: '2px',
53
- borderColor: 'pink',
54
- });
55
- });
56
- it('should render the secondary style variant', () => {
57
- render(_jsx(VariantButton, { variant: "secondary" }));
58
- const el = screen.getByRole('button');
59
- expect(el).toHaveClass(Button.css.base, VariantButton.css.variants.secondary);
60
- expect(el).toHaveStyle({
61
- ...BASE_STYLE,
62
- borderWidth: '2px',
63
- borderColor: 'blue',
64
- });
65
- });
66
- });
67
- describe('style recipes', () => {
68
- it('should render a recipe with default variants', () => {
69
- render(_jsx(RecipeButton, {}));
70
- const el = screen.getByRole('button');
71
- expect(el).toHaveClass(Button.css.base);
72
- expect(el).toHaveStyle({
73
- ...BASE_STYLE,
74
- border: '1px dashed black',
75
- fontSize: '18px',
76
- });
77
- });
78
- it('should render a recipe with selected variants', () => {
79
- render(_jsx(RecipeButton, { fontSize: "sm", color: "warn" }));
80
- const el = screen.getByRole('button');
81
- expect(el).toHaveClass(Button.css.base);
82
- expect(el).toHaveStyle({
83
- ...BASE_STYLE,
84
- border: '1px dashed black',
85
- backgroundColor: 'orange',
86
- fontSize: '10px',
87
- });
88
- });
89
- });
90
- // unable to test CSS variables fully in JSDOM it seems
91
- // https://github.com/jsdom/jsdom/pull/3299
92
- describe.skip('themed components', () => {
93
- it('should render styles from the provided theme', () => {
94
- render(_jsx(ThemeProvider, { theme: Theme.light, children: _jsx(ThemedButton, {}) }));
95
- const el = screen.getByRole('button');
96
- expect(el).toHaveClass(Button.css.base, ThemedButton.css.themed);
97
- expect(el).toHaveStyle({
98
- ...BASE_STYLE,
99
- color: 'red',
100
- borderRadius: '0',
101
- });
102
- });
103
- it('should override styles with contextual themes', () => {
104
- render(_jsx(ThemeProvider, { theme: Theme.light, children: _jsx(ThemeProvider, { theme: Theme.dark, children: _jsx(ThemedButton, {}) }) }));
105
- const el = screen.getByRole('button');
106
- expect(el).toHaveClass(Button.css.base, ThemedButton.css.themed);
107
- expect(el).toHaveStyle({
108
- ...BASE_STYLE,
109
- color: 'blue',
110
- borderRadius: '0',
111
- });
112
- });
113
- });
114
- describe.skip('inline CSS variables', () => {
115
- it('should render style from dynamic values', () => {
116
- render(_jsx(InlineVarButton, { brandColor: "green" }));
117
- const el = screen.getByRole('button');
118
- expect(el).toHaveClass(Button.css.base, InlineVarButton.css.base);
119
- expect(el).toHaveStyle({
120
- ...BASE_STYLE,
121
- color: 'green',
122
- borderRadius: '0',
123
- });
124
- });
125
- });
126
- describe.skip('inline theme', () => {
127
- it('should render style from inline theme', () => {
128
- render(_jsx(InlineThemedButton, { brandColor: "green" }));
129
- const el = screen.getByRole('button');
130
- expect(el).toHaveClass(Button.css.base, InlineThemedButton.css.themed);
131
- expect(el).toHaveStyle({
132
- ...BASE_STYLE,
133
- color: 'green',
134
- borderRadius: '0',
135
- });
136
- });
137
- });
138
- });
@@ -1,9 +0,0 @@
1
- import matchers from '@testing-library/jest-dom/matchers';
2
- import { cleanup } from '@testing-library/react';
3
- import { afterEach, expect } from 'vitest';
4
-
5
- expect.extend(matchers);
6
-
7
- afterEach(() => {
8
- cleanup();
9
- });
@@ -1,10 +0,0 @@
1
- sonar.projectName=design-style
2
- sonar.sources=src/
3
- sonar.tests=src/
4
- sonar.exclusions=src/**/*.test.ts,src/**/test-utils/
5
- sonar.test.inclusions=src/**/*.test.ts,src/**/test-utils/
6
- sonar.cpd.exclusions=src/**/*.test.ts,src/**/test-utils/
7
- sonar.coverage.exclusions=**/**
8
- sonar.eslint.reportPaths=sonar/report.json
9
- sonar.typescript.tsconfigPath=./tsconfig.json
10
- #sonar.javascript.lcov.reportPaths=nyc_coverage_unit/lcov.info
@@ -1,14 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- export const ThemeContext = createContext<string | null>(null);
4
- export const { Consumer: ThemeConsumer } = ThemeContext;
5
-
6
- export interface ThemeProviderProps extends React.PropsWithChildren {
7
- theme: string;
8
- }
9
-
10
- export const ThemeProvider: React.FC<ThemeProviderProps> = ({ theme, children }) => (
11
- <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>
12
- );
13
-
14
- export const useTheme = () => useContext(ThemeContext);
@@ -1,7 +0,0 @@
1
- import * as S from './Button.styled';
2
-
3
- export interface ButtonProps extends React.PropsWithChildren {
4
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
5
- }
6
-
7
- export const Button: React.FC<ButtonProps> = ({ onClick, children }) => <S.Base onClick={onClick}>{children}</S.Base>;
@@ -1,7 +0,0 @@
1
- import { style } from '@/main';
2
-
3
- export const base = style({
4
- padding: 20,
5
- borderRadius: 10,
6
- margin: 10,
7
- });
@@ -1,5 +0,0 @@
1
- import { styled } from '@/main';
2
-
3
- import { base } from './Button.css';
4
-
5
- export const Base = styled.button([base]);