@websolutespa/bom-mixer-ui 0.4.2 → 0.4.3

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 0.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: Text added getFontVariantResponsive.
8
+
3
9
  ## 0.4.2
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -730,6 +730,34 @@ function getCssResponsive(props, defaultValue) {
730
730
  }
731
731
  return rules;
732
732
  }
733
+ function getVariantResponsive(props, callback) {
734
+ const keys = ['variant', 'variantSm', 'variantMd', 'variantLg', 'variantXl'];
735
+ const theme = props.theme;
736
+ const mediaQuery = theme.mediaQuery;
737
+ return keys.map(key => {
738
+ const value = props[key];
739
+ if (value) {
740
+ const rule = callback(value, theme);
741
+ if (key !== 'variant') {
742
+ const size = key.replace('variant', '').toLowerCase();
743
+ // console.log('size', size, 'rule', rule);
744
+ return styled.css`@media(min-width: ${mediaQuery[size]}) {
745
+ ${rule}
746
+ }`;
747
+ } else {
748
+ return rule;
749
+ }
750
+ } else {
751
+ return undefined;
752
+ }
753
+ }).filter(Boolean);
754
+ }
755
+ function getFontVariantResponsive(props, callback) {
756
+ return getVariantResponsive(props, (key, theme) => {
757
+ const font = theme.font[key];
758
+ return font ? callback(key, font) : '';
759
+ });
760
+ }
733
761
  function getAspectResponsive(props, defaultValue) {
734
762
  if (defaultValue === void 0) {
735
763
  defaultValue = {};
@@ -4514,25 +4542,17 @@ const CssUl = styled.css`
4514
4542
  }
4515
4543
  `;
4516
4544
  const StyledText = styled__default.default.div`
4517
- ${props => {
4518
- const variant = props.variant;
4519
- const font = variant && props.theme.font[variant];
4520
- // console.log(props.children, variant, size);
4521
- return styled.css`
4522
- ${font ? styled.css`
4523
- font-family: var(--font-${variant}-family, var(--base-font-family));
4524
- // font-size: var(--font-${variant}-size, 1rem);
4525
- ${font.size && typeof font.size === 'object' ? eachMedia(props, key => `font-size: var(--font-${variant}-size-${key});`) : `font-size: var(--font-${variant}-size, 1rem)`};
4526
- font-weight: var(--font-${variant}-font-weight, inherit);
4527
- line-height: var(--font-${variant}-line-height, 1);
4528
- ` : ''}
4529
- ${props.gradient ? styled.css`
4530
- background: -webkit-linear-gradient(0deg, var(--color-secondary-500), var(--color-primary-500));
4531
- -webkit-background-clip: text;
4532
- -webkit-text-fill-color: transparent;
4533
- ` : ''}
4534
- `;
4535
- }}
4545
+ ${props => getFontVariantResponsive(props, (variant, font) => styled.css`
4546
+ ${font.family ? styled.css`font-family: var(--font-${variant}-family, var(--base-font-family));` : ''}
4547
+ ${font.size ? styled.css`font-size: var(--font-${variant}-size, 1rem);` : ''}
4548
+ ${font.lineHeight ? styled.css`line-height: var(--font-${variant}-line-height, 1);` : ''}
4549
+ ${font.fontWeight ? styled.css`font-weight: var(--font-${variant}-font-weight, inherit);` : ''}
4550
+ `)};
4551
+ ${props => props.gradient ? styled.css`
4552
+ background: -webkit-linear-gradient(0deg, var(--color-secondary-500), var(--color-primary-500));
4553
+ -webkit-background-clip: text;
4554
+ -webkit-text-fill-color: transparent;
4555
+ ` : ''}
4536
4556
  ${CssH}
4537
4557
  ${CssA}
4538
4558
  ${CssP}
@@ -20708,9 +20728,11 @@ exports.getAspectResponsive = getAspectResponsive;
20708
20728
  exports.getChildsByType = getChildsByType;
20709
20729
  exports.getContainer = getContainer;
20710
20730
  exports.getCssResponsive = getCssResponsive;
20731
+ exports.getFontVariantResponsive = getFontVariantResponsive;
20711
20732
  exports.getGrid = getGrid;
20712
20733
  exports.getShortName = getShortName;
20713
20734
  exports.getVariant = getVariant;
20735
+ exports.getVariantResponsive = getVariantResponsive;
20714
20736
  exports.hasChildOfType = hasChildOfType;
20715
20737
  exports.hypenize = hypenize;
20716
20738
  exports.isChildElement = isChildElement;