dist/material-ui-pickers.umd.js
/**
   * Convert nested rules to separate, remove them from original styles.
   *
   * @param {Rule} rule
   * @api public
   */
Convert nested rules to separate, remove them from original styles.
@param {Rule} rule
@api public
Convert nested rules to separate remove them from original styles . @param { Rule } rule @api public
function jssNested() {
    function getReplaceRef(container, sheet) {
      return function (match, key) {
        var rule = container.getRule(key) || sheet && sheet.getRule(key);
        if (rule) {
          rule = rule;
          return rule.selector;
        }
         warning(false, "[JSS] Could not find the referenced rule \"" + key + "\" in \"" + (container.options.meta || container.toString()) + "\".") ;
        return key;
      };
    }
    function replaceParentRefs(nestedProp, parentProp) {
      var parentSelectors = parentProp.split(separatorRegExp$1);
      var nestedSelectors = nestedProp.split(separatorRegExp$1);
      var result = '';
      for (var i = 0; i < parentSelectors.length; i++) {
        var parent = parentSelectors[i];
        for (var j = 0; j < nestedSelectors.length; j++) {
          var nested = nestedSelectors[j];
          if (result) result += ', '; 
          result += nested.indexOf('&') !== -1 ? nested.replace(parentRegExp, parent) : parent + " " + nested;
        }
      }
      return result;
    }
    function getOptions(rule, container, prevOptions) {
      if (prevOptions) return _extends({}, prevOptions, {
        index: prevOptions.index + 1
      });
      var nestingLevel = rule.options.nestingLevel;
      nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1;
      var options = _extends({}, rule.options, {
        nestingLevel: nestingLevel,
        index: container.indexOf(rule) + 1 
      });
      delete options.name;
      return options;
    }
    function onProcessStyle(style, rule, sheet) {
      if (rule.type !== 'style') return style;
      var styleRule = rule;
      var container = styleRule.options.parent;
      var options;
      var replaceRef;
      for (var prop in style) {
        var isNested = prop.indexOf('&') !== -1;
        var isNestedConditional = prop[0] === '@';
        if (!isNested && !isNestedConditional) continue;
        options = getOptions(styleRule, container, options);
        if (isNested) {
          var selector = replaceParentRefs(prop, styleRule.selector); 
          if (!replaceRef) replaceRef = getReplaceRef(container, sheet); 
          selector = selector.replace(refRegExp$1, replaceRef);
          container.addRule(selector, style[prop], _extends({}, options, {
            selector: selector
          }));
        } else if (isNestedConditional) {
          container.addRule(prop, {}, options) 
          .addRule(styleRule.key, style[prop], {
            selector: styleRule.selector
          });
        }
        delete style[prop];
      }
      return style;
    }
    return {
      onProcessStyle: onProcessStyle
    };
  }
function jssNested ( ) { function getReplaceRef ( container , sheet ) { return function ( match , key ) { var rule = container . getRule ( key ) || sheet && sheet . getRule ( key ) ; if ( rule ) { rule = rule ; return rule . selector ; } warning ( false , "[JSS] Could not find the referenced rule \"" + key + "\" in \"" + ( container . options . meta || container . toString ( ) ) + "\"." ) ; return key ; } ; } function replaceParentRefs ( nestedProp , parentProp ) { var parentSelectors = parentProp . split ( separatorRegExp$1 ) ; var nestedSelectors = nestedProp . split ( separatorRegExp$1 ) ; var result = '' ; for ( var i = 0 ; i < parentSelectors . length ; i ++ ) { var parent = parentSelectors [ i ] ; for ( var j = 0 ; j < nestedSelectors . length ; j ++ ) { var nested = nestedSelectors [ j ] ; if ( result ) result += ', ' ; result += nested . indexOf ( '&' ) !== - 1 ? nested . replace ( parentRegExp , parent ) : parent + " " + nested ; } } return result ; } function getOptions ( rule , container , prevOptions ) { if ( prevOptions ) return _extends ( { } , prevOptions , { index : prevOptions . index + 1 } ) ; var nestingLevel = rule . options . nestingLevel ; nestingLevel = nestingLevel === undefined ? 1 : nestingLevel + 1 ; var options = _extends ( { } , rule . options , { nestingLevel : nestingLevel , index : container . indexOf ( rule ) + 1 } ) ; delete options . name ; return options ; } function onProcessStyle ( style , rule , sheet ) { if ( rule . type !== 'style' ) return style ; var styleRule = rule ; var container = styleRule . options . parent ; var options ; var replaceRef ; for ( var prop in style ) { var isNested = prop . indexOf ( '&' ) !== - 1 ; var isNestedConditional = prop [ 0 ] === '@' ; if ( ! isNested && ! isNestedConditional ) continue ; options = getOptions ( styleRule , container , options ) ; if ( isNested ) { var selector = replaceParentRefs ( prop , styleRule . selector ) ; if ( ! replaceRef ) replaceRef = getReplaceRef ( container , sheet ) ; selector = selector . replace ( refRegExp$1 , replaceRef ) ; container . addRule ( selector , style [ prop ] , _extends ( { } , options , { selector : selector } ) ) ; } else if ( isNestedConditional ) { container . addRule ( prop , { } , options ) . addRule ( styleRule . key , style [ prop ] , { selector : styleRule . selector } ) ; } delete style [ prop ] ; } return style ; } return { onProcessStyle : onProcessStyle } ; }
Convert nested rules to separate, remove them from original styles.
Convert nested rules to separate remove them from original styles .
// Get a function to be used for $ref replacement. // Replace all & by the parent or prefix & with the parent. // Options has been already created, now we only increase index. // We don't need the parent name to be set options for chlid. // Lazily create the ref replacer function just once for // all nested rules within the sheet. // Replace all $refs. // Place conditional right after the parent rule to ensure right ordering. // Flow expects more options but they aren't required // And flow doesn't know this will always be a StyleRule which has the addRule method // $FlowFixMe