diff --git a/.documentation.json b/.documentation.json index 35881c41..68ca695c 100644 --- a/.documentation.json +++ b/.documentation.json @@ -10,12 +10,8 @@ }, "clearFix", "ellipsis", - "hideText", -<<<<<<< HEAD -======= "hiDPI", - "selection", ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules + "hideText", "placeholder", "retinaImage", "selection", @@ -24,17 +20,11 @@ "wordWrap", { "name": "Shorthands", -<<<<<<< HEAD "description": "Functions that help write nicer code. They're shorter, of course, but they also make it easy to pass in multiple variables without resorting to string concatenation." }, "animation", -======= - "description": "Shorthands for generating multiple lines of css quickly." - }, - "animation", "buttons", "textInputs", ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules { "name": "Helpers", "description": "Tiny helper functions that make your life easier." diff --git a/docs/docs/index.html b/docs/docs/index.html index b8535a23..34bc9022 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -155,6 +155,26 @@

polished

+
  • + buttons + + + +
  • + + +
  • + textInputs + + + +
  • + +
  • @@ -239,7 +259,7 @@

    -
    + src/mixins/clearFix.js @@ -325,7 +345,7 @@

    - + src/mixins/ellipsis.js @@ -414,7 +434,7 @@

    - + src/mixins/hiDPI.js @@ -506,7 +526,7 @@

    - + src/mixins/hideText.js @@ -581,7 +601,7 @@

    - + src/mixins/placeholder.js @@ -684,7 +704,7 @@

    - + src/mixins/retinaImage.js @@ -809,7 +829,7 @@

    - + src/mixins/selection.js @@ -908,7 +928,7 @@

    - + src/mixins/size.js @@ -1001,7 +1021,7 @@

    - + src/mixins/timingFunctions.js @@ -1084,7 +1104,7 @@

    - + src/mixins/wordWrap.js @@ -1185,7 +1205,7 @@

    - + src/shorthands/animation.js @@ -1271,6 +1291,198 @@

    + + + + + +
    + + +
    + +

    + buttons +

    + + + + src/shorthands/buttons.js + + +
    + + +

    Populates selectors that target all buttons. You can pass optional states to append to the selectors.

    + + +
    buttons(states: ...Array<State>)
    + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + states (...Array<State>) + +
    + +
    + +
    + + + + + + + + + +
    Example
    + + +
    // Styles as object usage
    +const styles = {
    +  [buttons('active')]: {
    +    'border': 'none'
    +  }
    +}
    +
    +// styled-components usage
    +const div = styled.div`
    +  > ${buttons('active')} {
    +    border: none;
    +  }
    +`
    +
    +// CSS in JS Output
    +
    + 'button:active,
    + 'input[type="button"]:active,
    + 'input[type=\"reset\"]:active,
    + 'input[type=\"submit\"]:active: {
    +  'border': 'none'
    +}
    + + + + + + + + +
    + + + + +
    + + +
    + +

    + textInputs +

    + + + + src/shorthands/textInputs.js + + +
    + + +

    Populates selectors that target all text inputs. You can pass optional states to append to the selectors.

    + + +
    textInputs(states: ...Array<State>)
    + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + states (...Array<State>) + +
    + +
    + +
    + + + + + + + + + +
    Example
    + + +
    // Styles as object usage
    +const styles = {
    +  [textInputs('active')]: {
    +    'border': 'none'
    +  }
    +}
    +
    +// styled-components usage
    +const div = styled.div`
    +  > ${textInputs('active')} {
    +    border: none;
    +  }
    +`
    +
    +// CSS in JS Output
    +
    + ''input[type="color"]:active,
    + 'input[type="date"]:active,
    + 'input[type="datetime"]:active,
    + 'input[type="datetime-local"]:active,
    + 'input[type="email"]:active,
    + 'input[type="month"]:active,
    + 'input[type="number"]:active,
    + 'input[type="password"]:active,
    + 'input[type="search"]:active,
    + 'input[type="tel"]:active,
    + 'input[type="text"]:active,
    + 'input[type="time"]:active,
    + 'input[type="url"]:active,
    + 'input[type="week"]:active,
    + input:not([type]):active,
    + textarea:active': {
    +  'border': 'none'
    +}
    + + + + + + + +
    @@ -1301,7 +1513,7 @@

    - + src/helpers/em.js @@ -1394,7 +1606,7 @@

    - + src/helpers/modularScale.js @@ -1497,7 +1709,7 @@

    - + src/helpers/rem.js @@ -1590,7 +1802,7 @@

    - + src/helpers/stripUnit.js diff --git a/docs/index.html b/docs/index.html index 604164a5..34bc9022 100644 --- a/docs/index.html +++ b/docs/index.html @@ -9,236 +9,232 @@ -<<<<<<< HEAD -======= -
    -
    -
    - -
    +
    +
    + - -
    +

    Mixins @@ -250,10 +246,10 @@

    - - -
    + + +
    @@ -263,15 +259,7 @@

    -<<<<<<< HEAD -<<<<<<< HEAD - -======= - ->>>>>>> d0f4766... chore(docs): Changes to buttons and textInputs docs -======= - ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules + src/mixins/clearFix.js @@ -281,7 +269,7 @@

    CSS to contain a float (credit to CSSMojo).

    -
    clearFix(parent: string?)
    +
    clearFix(parent: [string])
    @@ -297,7 +285,7 @@

    - parent (string? + parent ([string] = '&')
    @@ -344,10 +332,10 @@

    - - -
    + + +
    @@ -357,15 +345,7 @@

    -<<<<<<< HEAD -<<<<<<< HEAD - -======= - ->>>>>>> d0f4766... chore(docs): Changes to buttons and textInputs docs -======= - ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules + src/mixins/ellipsis.js @@ -375,7 +355,7 @@

    CSS to represent truncated text with an ellipsis.

    -
    ellipsis(width: string?)
    +
    ellipsis(width: [string])
    @@ -391,7 +371,7 @@

    - width (string? + width ([string] = '100%')
    @@ -441,39 +421,30 @@

    - - -
    + + +
    -

    CSS to hide text to show a background image in a SEO-Friendly.

    +

    Generates a media query to target HiDPI devices.

    -
    hideText()
    +
    hiDPI(ratio: [number])
    @@ -484,6 +455,20 @@

    +
    Parameters
    +
    + +
    +
    + ratio ([number] + = 1.3) + +
    + +
    + +
    + @@ -496,24 +481,27 @@

    // Styles as object usage
    -const styles = {
    -  'background-image': 'url(logo.png)',
    -  ...hideText(),
    +const styles = {
    + [hiDPI(1.5)]: {
    +   width: 200px;
    + }
     }
     
     // styled-components usage
    -const div = styled.div`
    -  background-image: url(logo.png);
    -  ${hideText()};
    +const div = styled.div`
    +  ${hiDPI(1.5)} {
    +    width: 200px;
    +  }
     `
     
     // CSS as JS Output
     
    -'div': {
    -  'background-image': 'url(logo.png)',
    -  'text-indent': '101%',
    -  'overflow': 'hidden',
    -  'white-space': 'nowrap',
    +'@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
    + only screen and (min--moz-device-pixel-ratio: 1.5),
    + only screen and (-o-min-device-pixel-ratio: 1.5/1),
    + only screen and (min-resolution: 144dpi),
    + only screen and (min-resolution: 1.5dppx)': {
    +  'width': '200px',
     }
    @@ -525,39 +513,30 @@

    - - -
    + + +
    -

    Generates a media query to target HiDPI devices.

    +

    CSS to hide text to show a background image in a SEO-Friendly.

    -
    hiDPI(ratio: number?)
    +
    hideText()
    @@ -568,20 +547,6 @@

    -
    Parameters
    -
    - -
    -
    - ratio (number? - = 1.3) - -
    - -
    - -
    - @@ -594,27 +559,24 @@

    // Styles as object usage
    -const styles = {
    - [hiDPI(1.5)]: {
    -   width: 200px;
    - }
    +const styles = {
    +  'background-image': 'url(logo.png)',
    +  ...hideText(),
     }
     
     // styled-components usage
    -const div = styled.div`
    -  ${hiDPI(1.5)} {
    -    width: 200px;
    -  }
    +const div = styled.div`
    +  background-image: url(logo.png);
    +  ${hideText()};
     `
     
     // CSS as JS Output
     
    -'@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
    - only screen and (min--moz-device-pixel-ratio: 1.5),
    - only screen and (-o-min-device-pixel-ratio: 1.5/1),
    - only screen and (min-resolution: 144dpi),
    - only screen and (min-resolution: 1.5dppx)': {
    -  'width': '200px',
    +'div': {
    +  'background-image': 'url(logo.png)',
    +  'text-indent': '101%',
    +  'overflow': 'hidden',
    +  'white-space': 'nowrap',
     }
    @@ -626,10 +588,10 @@

    - - -
    + + +
    @@ -658,7 +611,7 @@

    CSS to style the selection psuedo-element.

    -
    placeholder(styles: Object, parent: string?)
    +
    placeholder(styles: Object, parent: [string])
    @@ -682,7 +635,7 @@

    - parent (string? + parent ([string] = '&')
    @@ -738,10 +691,10 @@

    - - -
    + + +
    @@ -772,7 +716,7 @@

    a _2x.png filename suffix by default.

    -
    retinaImage(filename: string, backgroundSize: string, extension: string?, retinaFilename: string, retinaSuffix: string?)
    +
    retinaImage(filename: string, backgroundSize: string, extension: [string], retinaFilename: string, retinaSuffix: [string])
    @@ -804,7 +748,7 @@

    - extension (string? + extension ([string] = 'png')
    @@ -821,7 +765,7 @@

    - retinaSuffix (string? + retinaSuffix ([string] = '_2x')
    @@ -872,10 +816,10 @@

    - - -
    + + +
    @@ -904,7 +839,7 @@

    CSS to style the selection psuedo-element.

    -
    selection(styles: Object, parent: string?)
    +
    selection(styles: Object, parent: [string])
    @@ -928,7 +863,7 @@

    - parent (string? + parent ([string] = '')
    @@ -980,10 +915,10 @@

    - - -
    + + +
    @@ -1012,7 +938,7 @@

    Mixin to set the height and width properties in a single statement.

    -
    size(height: string, width: string?)
    +
    size(height: string, width: [string])
    @@ -1036,7 +962,7 @@

    - width (string? + width ([string] = height)
    @@ -1052,25 +978,15 @@

    ->>>>>>> 3111967... chore(textInput): textInput shorthand +
    Example
    -<<<<<<< HEAD -

    polished

    -
    -=======
    // Styles as object usage
     const styles = {
       ...size('300px', '250px')
     }
    ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules
     
    -<<<<<<< HEAD
    -  
    -  
    -  
    -=======
     // styled-components usage
     const div = styled.div`
       ${size('300px', '250px')}
    @@ -1092,10 +1008,10 @@ 

    polished

    - - -
    + + +
    @@ -1184,10 +1091,10 @@

    - - -
    + + +
    @@ -1216,11 +1114,7 @@

    Provides an easy way to change the word-wrap property

    -<<<<<<< HEAD -
    em(pxval: (string | number), base: (string | number)?): String
    -======= -
    wordWrap(wrap: string?)
    ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules +
    wordWrap(wrap: [string])
    @@ -1236,25 +1130,9 @@

    -<<<<<<< HEAD - pxval ((string | number)) - The pixel value you want to convert - -
    - -
    - -
    -
    - base ((string | number)? - = "16px") - The base size to convert from - -======= - wrap (string? + wrap ([string] = 'break-word') ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules
    @@ -1265,16 +1143,6 @@

    -<<<<<<< HEAD - -<<<<<<< HEAD -
    Returns
    - String: - The converted value -======= - - src/helpers/rem.js -======= @@ -1309,25 +1177,25 @@

    - - -
    + + +

    Shorthands

    -

    Shorthands for generating multiple lines of css quickly.

    +

    Functions that help write nicer code. They're shorter, of course, but they also make it easy to pass in multiple variables without resorting to string concatenation.

    - - -
    + + +
    @@ -1349,7 +1216,7 @@

    or a single animation spread over the arguments.

    -
    animation(args: ...Array<(Array<AnimationProperty> | AnimationProperty)>)
    +
    animation(args: ...Array<(Array<AnimationProperty> | AnimationProperty)>)
    @@ -1358,19 +1225,14 @@

    ->>>>>>> d0f4766... chore(docs): Changes to buttons and textInputs docs -<<<<<<< HEAD - - -=======
    Parameters
    - args (...Array<(Array<AnimationProperty> | AnimationProperty)>) + args (...Array<(Array<AnimationProperty> | AnimationProperty)>)
    @@ -1381,7 +1243,6 @@

    ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules @@ -1391,16 +1252,6 @@

    // Styles as object usage
    -<<<<<<< HEAD
    -const styles = {
    -  'height': em('16px')
    -}
    -
    -// styled-components usage
    -const div = styled.div`
    -  height: ${em('16px')}
    -`
    -=======
     const styles = {
       ...animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])
     }
    @@ -1409,17 +1260,9 @@ 

    const div = styled.div` ${animation(['rotate', '1s', 'ease-in-out'], ['colorchange', '2s'])} ` ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules // CSS as JS Output -<<<<<<< HEAD -element { -<<<<<<< HEAD - 'height': '1em' -======= - 'height': '1rem' -======= div { 'animation': 'rotate 1s ease-in-out, colorchange 2s' }

    @@ -1439,7 +1282,6 @@

    div { 'animation': 'rotate 1s ease-in-out' ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules } @@ -1451,10 +1293,10 @@

    - - -
    + + +
    @@ -1464,7 +1306,7 @@

    - + src/shorthands/buttons.js @@ -1474,7 +1316,7 @@

    Populates selectors that target all buttons. You can pass optional states to append to the selectors.

    -
    buttons(states: ...Array<State>)
    +
    buttons(states: ...Array<State>)
    @@ -1490,7 +1332,7 @@

    - states (...Array<State>) + states (...Array<State>)
    @@ -1541,10 +1383,10 @@

    - - -
    + + +
    @@ -1554,7 +1396,7 @@

    - + src/shorthands/textInputs.js @@ -1564,7 +1406,7 @@

    Populates selectors that target all text inputs. You can pass optional states to append to the selectors.

    -
    textInputs(states: ...Array<State>)
    +
    textInputs(states: ...Array<State>)
    @@ -1580,7 +1422,7 @@

    - states (...Array<State>) + states (...Array<State>)
    @@ -1615,7 +1457,7 @@

    // CSS in JS Output - 'input[type="color"]:active, + ''input[type="color"]:active, 'input[type="date"]:active, 'input[type="datetime"]:active, 'input[type="datetime-local"]:active, @@ -1643,10 +1485,10 @@

    - - -
    + + +

    Helpers @@ -1658,10 +1500,10 @@

    - - -
    + + +
    @@ -1671,7 +1513,7 @@

    - + src/helpers/em.js @@ -1682,7 +1524,7 @@

    second argument to the function.

    -
    em(pxval: (string | number), base: (string | number)?)
    +
    em(pxval: (string | number), base: [(string | number)])
    @@ -1706,7 +1548,7 @@

    - base ((string | number)? + base ([(string | number)] = '16px')
    @@ -1751,10 +1593,10 @@

    - - -
    + + +
    @@ -1764,7 +1606,7 @@

    - + src/helpers/modularScale.js @@ -1774,7 +1616,7 @@

    Establish consistent measurements and spacial relationships throughout your projects by incrementing up or down a defined scale. We provide a list of commonly used scales as pre-defined variables, see below.

    -
    modularScale(steps: number, base: (number | string)?, ratio: Ratio?)
    +
    modularScale(steps: number, base: [(number | string)], ratio: [Ratio])
    @@ -1798,7 +1640,7 @@

    - base ((number | string)? + base ([(number | string)] = '1em')
    @@ -1807,7 +1649,7 @@

    - ratio (Ratio? + ratio ([Ratio] = 'perfectFourth')
    @@ -1854,10 +1696,10 @@

    - - -
    + + +
    @@ -1867,7 +1709,7 @@

    - + src/helpers/rem.js @@ -1878,7 +1720,7 @@

    second argument to the function.

    -
    rem(pxval: (string | number), base: (string | number)?)
    +
    rem(pxval: (string | number), base: [(string | number)])
    @@ -1902,7 +1744,7 @@

    - base ((string | number)? + base ([(string | number)] = '16px')
    @@ -1947,10 +1789,10 @@

    - - -
    + + +
    @@ -1960,7 +1802,7 @@

    - + src/helpers/stripUnit.js @@ -2022,29 +1864,8 @@

    // CSS in JS Output -<<<<<<< HEAD - 'input[type="color"]:active, - 'input[type="date"]:active, - 'input[type="datetime"]:active, - 'input[type="datetime-local"]:active, - 'input[type="email"]:active, - 'input[type="month"]:active, - 'input[type="number"]:active, - 'input[type="password"]:active, - 'input[type="search"]:active, - 'input[type="tel"]:active, - 'input[type="text"]:active, - 'input[type="time"]:active, - 'input[type="url"]:active, - 'input[type="week"]:active, - input:not([type]):active, - textarea:active': { - 'border': 'none' ->>>>>>> d0f4766... chore(docs): Changes to buttons and textInputs docs -======= element { '--dimension': 100 ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules } @@ -2056,13 +1877,14 @@

    - -
    +
    - - ->>>>>>> 3111967... chore(textInput): textInput shorthand +
    + + + + diff --git a/src/index.js b/src/index.js index 0073a41c..21050933 100644 --- a/src/index.js +++ b/src/index.js @@ -1,17 +1,9 @@ // @flow // Helpers import em from './helpers/em' -<<<<<<< HEAD -<<<<<<< HEAD import modularScale from './helpers/modularScale' import rem from './helpers/rem' -======= -======= -import modularScale from './helpers/modularScale' -import rem from './helpers/rem' ->>>>>>> a6eba2a... chore(docs): Update TOC with missing modules import stripUnit from './helpers/stripUnit' ->>>>>>> 4042d23... chore(shorthand): Simplify Buttons and Inputs to use shared helper // Mixins import clearFix from './mixins/clearFix' @@ -25,34 +17,14 @@ import size from './mixins/size' import timingFunctions from './mixins/timingFunctions' import wordWrap from './mixins/wordWrap' -<<<<<<< HEAD // Shorthands import animation from './shorthands/animation' +import buttons from './shorthands/buttons' +import textInputs from './shorthands/textInputs' -const polished = { - animation, - clearFix, - ellipsis, - em, - modularScale, - hideText, - hiDPI, - placeholder, - rem, - retinaImage, - selection, - size, - stripUnit, - timingFunctions, - wordWrap, -} - -export default polished - -======= ->>>>>>> 4042d23... chore(shorthand): Simplify Buttons and Inputs to use shared helper export { animation, + buttons, clearFix, ellipsis, em, @@ -65,6 +37,7 @@ export { selection, size, stripUnit, + textInputs, timingFunctions, wordWrap, } diff --git a/src/internalHelpers/statefulSelectors.js b/src/internalHelpers/_statefulSelectors.js similarity index 100% rename from src/internalHelpers/statefulSelectors.js rename to src/internalHelpers/_statefulSelectors.js diff --git a/src/internalHelpers/test/__snapshots__/statefulSelectors.test.js.snap b/src/internalHelpers/test/__snapshots__/_statefulSelectors.test.js.snap similarity index 100% rename from src/internalHelpers/test/__snapshots__/statefulSelectors.test.js.snap rename to src/internalHelpers/test/__snapshots__/_statefulSelectors.test.js.snap diff --git a/src/internalHelpers/test/statefulSelectors.test.js b/src/internalHelpers/test/_statefulSelectors.test.js similarity index 97% rename from src/internalHelpers/test/statefulSelectors.test.js rename to src/internalHelpers/test/_statefulSelectors.test.js index cecaaa63..0d33677c 100644 --- a/src/internalHelpers/test/statefulSelectors.test.js +++ b/src/internalHelpers/test/_statefulSelectors.test.js @@ -1,4 +1,4 @@ -import statefulSelectors from '../statefulSelectors' +import statefulSelectors from '../_statefulSelectors' const mockStateMap = [null, ':before', ':after'] diff --git a/src/shorthand/buttons.js b/src/shorthands/buttons.js similarity index 93% rename from src/shorthand/buttons.js rename to src/shorthands/buttons.js index 0095c672..0cd96c42 100644 --- a/src/shorthand/buttons.js +++ b/src/shorthands/buttons.js @@ -1,5 +1,21 @@ // @flow -import statefulSelectors from '../internalHelpers/statefulSelectors' +import statefulSelectors from '../internalHelpers/_statefulSelectors' + +const stateMap = [undefined, null, 'active', 'focus', 'hover'] + +function template(state) { + return `button${state}, + input[type="button"]${state}, + input[type="reset"]${state}, + input[type="submit"]${state}` +} + +type State = + | typeof(undefined) + | null + | 'active' + | 'focus' + | 'hover'; /** * Populates selectors that target all buttons. You can pass optional states to append to the selectors. @@ -28,22 +44,6 @@ import statefulSelectors from '../internalHelpers/statefulSelectors' * } */ -const stateMap = [undefined, null, 'active', 'focus', 'hover'] - -function template(state) { - return `button${state}, - input[type="button"]${state}, - input[type="reset"]${state}, - input[type="submit"]${state}` -} - -type State = - | typeof(undefined) - | null - | 'active' - | 'focus' - | 'hover'; - function buttons(...states: Array) { return statefulSelectors(states, template, stateMap) } diff --git a/src/shorthand/test/__snapshots__/buttons.test.js.snap b/src/shorthands/test/__snapshots__/buttons.test.js.snap similarity index 100% rename from src/shorthand/test/__snapshots__/buttons.test.js.snap rename to src/shorthands/test/__snapshots__/buttons.test.js.snap diff --git a/src/shorthand/test/__snapshots__/textInputs.test.js.snap b/src/shorthands/test/__snapshots__/textInputs.test.js.snap similarity index 100% rename from src/shorthand/test/__snapshots__/textInputs.test.js.snap rename to src/shorthands/test/__snapshots__/textInputs.test.js.snap diff --git a/src/shorthand/test/buttons.test.js b/src/shorthands/test/buttons.test.js similarity index 100% rename from src/shorthand/test/buttons.test.js rename to src/shorthands/test/buttons.test.js diff --git a/src/shorthand/test/textInputs.test.js b/src/shorthands/test/textInputs.test.js similarity index 100% rename from src/shorthand/test/textInputs.test.js rename to src/shorthands/test/textInputs.test.js diff --git a/src/shorthand/textInputs.js b/src/shorthands/textInputs.js similarity index 96% rename from src/shorthand/textInputs.js rename to src/shorthands/textInputs.js index 75be938f..f17f72b7 100644 --- a/src/shorthand/textInputs.js +++ b/src/shorthands/textInputs.js @@ -1,5 +1,33 @@ // @flow -import statefulSelectors from '../internalHelpers/statefulSelectors' +import statefulSelectors from '../internalHelpers/_statefulSelectors' + +const stateMap = [undefined, null, 'active', 'focus', 'hover'] + +function template(state) { + return `input[type="color"]${state}, + input[type="date"]${state}, + input[type="datetime"]${state}, + input[type="datetime-local"]${state}, + input[type="email"]${state}, + input[type="month"]${state}, + input[type="number"]${state}, + input[type="password"]${state}, + input[type="search"]${state}, + input[type="tel"]${state}, + input[type="text"]${state}, + input[type="time"]${state}, + input[type="url"]${state}, + input[type="week"]${state}, + input:not([type])${state}, + textarea${state}` +} + +type State = + | typeof(undefined) + | null + | 'active' + | 'focus' + | 'hover'; /** * Populates selectors that target all text inputs. You can pass optional states to append to the selectors. @@ -40,34 +68,6 @@ import statefulSelectors from '../internalHelpers/statefulSelectors' * } */ -const stateMap = [undefined, null, 'active', 'focus', 'hover'] - -function template(state) { - return `input[type="color"]${state}, - input[type="date"]${state}, - input[type="datetime"]${state}, - input[type="datetime-local"]${state}, - input[type="email"]${state}, - input[type="month"]${state}, - input[type="number"]${state}, - input[type="password"]${state}, - input[type="search"]${state}, - input[type="tel"]${state}, - input[type="text"]${state}, - input[type="time"]${state}, - input[type="url"]${state}, - input[type="week"]${state}, - input:not([type])${state}, - textarea${state}` -} - -type State = - | typeof(undefined) - | null - | 'active' - | 'focus' - | 'hover'; - function textInputs(...states: Array) { return statefulSelectors(states, template, stateMap) }