{
  "version": 3,
  "file": "index.css",
  "sources": [
    "../Switch.svelte"
  ],
  "sourcesContent": [
    "<!--\n  INPUT SWITCH COMPONENT\n\n  This component is intended to be an alternative to checkbox inputs in forms\n  when there's a need to toggle something with an on and off state. From a UX\n  perspective, it should be clearly understood that something is being turned on\n  or off.\n\n  An example of this is a switch to turn on or off sound in an interactive web\n  app. On the other hand, you should use a checkbox when users are accustomed to\n  seeing a checkbox such as an input to accept terms and conditions in a\n  transaction flow. That said, most of the time this is a great option.\n\n  USAGE:\n    Simply import this component into your vue file and use it in your template\n    as if it was a normal input; bind it to a vue model. Example:\n\n      <Switch bind:value=\"switch\"/>\n\n    The default switch is the same size as buttons. If this is too big, you can\n    add a \"mini\" property for a compact version. Example:\n\n      <Switch bind:value=\"switch\" mini/>\n\n    It's possible to change the text from \"ON\"/\"OFF\" by passing the props textOn\n    and textOff. If you change this you may need to modify the width too, which\n    can be done via the --switch-width CSS variable. Example:\n\n      <Switch bind:value=\"switch\" textOn=\"YES\" textOff=\"NO\"/>\n\n  TIPS:\n    - It's a good idea to add a title attribute so desktop users can understand\n      the elements purpose more clearly.\n    - If following accessibility guidelines it's recommended to label the\n      purpose of the switch by adding an `aria-label` or `aria-labelledby`\n      attribute.\n    - If used in a form this component won't send any data by default. If you\n      wish to use it as a form input you'll need to bind the v-model to a\n      hidden input.\n    - The `disabled` attribute is not valid on <div> so we use a class.\n\n  @format\n-->\n\n<!--\n  TODO: Ability to drag the switch using mouse/touch in a high performance way.\n-->\n\n<script>\n  import { afterUpdate, createEventDispatcher } from 'svelte';\n\n  export let textOn = 'ON';\n  export let textOff = 'OFF';\n  export let mini = false;\n  export let disabled = false;\n  export let value;\n\n  const dispatch = createEventDispatcher();\n\n  let previousValue = value;\n\n  function toggle() {\n    if (!disabled) {\n      value = !value;\n    }\n  }\n\n  function handleKeyDown(event) {\n    // Choose key with graceful fallback for old browsers\n    /* eslint-disable @typescript-eslint/no-magic-numbers */\n    switch (event.key || event.keyCode) {\n      case 'Enter':\n      case 13: // Enter\n      case ' ':\n      case 'Spacebar':\n      case 32:\n        event.preventDefault(); // Don't submit form (enter) or scroll page (space)\n        toggle();\n        break;\n      default:\n        // No matching key\n    }\n    /* eslint-enable @typescript-eslint/no-magic-numbers */\n  }\n\n  afterUpdate(() => {\n    if (value !== previousValue) {\n      previousValue = value;\n      dispatch('change', value);\n    }\n  });\n</script>\n\n<style type=\"text/postcss\">.switch{position:relative;display:inline-flex;width:6em;padding:.627em 0;color:#211f37;text-align:center;vertical-align:middle;background-color:#dbdde0;border-radius:.25rem;box-shadow:inset 0 -.125rem .6rem rgba(28,76,143,.15),inset 0 -1em .625em 0 rgba(28,76,143,.03);-webkit-backface-visibility:hidden;backface-visibility:hidden;cursor:pointer;transition:background-color .13s ease-out;transition-delay:0s;-webkit-user-select:none;-ms-user-select:none;user-select:none}.switch.switch-mini{width:4.6em;padding:.3135em 0}.switch-checked{background-color:#26a269;transition-delay:.18s;transition-duration:.18s}.switch-off,.switch-on{flex-basis:3em}.switch-on{color:#fff}.switch-disabled>.switch-on{color:rgba(116,118,129,.5)}.switch-slider{position:absolute;top:0;bottom:0;width:50%;background:#fff;border:1px solid #97999d;border-radius:.25rem;box-shadow:inset 0 -1rem .4rem rgba(28,76,143,.05);transition:transform .18s ease-out}.switch-checked>.switch-slider{transform:translateX(100%)}.switch-mini>.switch-slider{box-shadow:inset 0 -.7rem .4rem rgba(28,76,143,.05)}.switch:focus>.switch-slider,.switch:hover>.switch-slider{background:#dbdde0}.switch-disabled>.switch-slider{box-shadow:none;transition:none}.switch-disabled:focus>.switch-slider,.switch-disabled:hover>.switch-slider,.switch-disabled>.switch-slider{background:#dbdde0}.switch-disabled{color:rgba(116,118,129,.5);background-color:#fff;border:1px solid #dbdde0;box-shadow:none;cursor:not-allowed;transition:none}.switch-disabled:focus,.switch-disabled:hover{outline:none}</style>\n\n<svelte:options immutable=\"{true}\" />\n\n<div\n  class=\"switch {mini ? 'switch-mini' : ''} {disabled ? 'switch-disabled' : ''} {value ? 'switch-checked' : ''}\"\n  role=\"switch\"\n  tabindex=\"{disabled ? -1 : 0}\"\n  aria-checked=\"{!!value}\"\n  on:click=\"{toggle}\"\n  on:keydown=\"{handleKeyDown}\"\n>\n  <div class=\"switch-slider\"></div>\n  <div class=\"switch-on\">{textOn}</div>\n  <div class=\"switch-off\">{textOff}</div>\n</div>\n"
  ],
  "names": [],
  "mappings": "AA6F2B,qCAAO,CAAC,SAAS,QAAQ,CAAC,QAAQ,WAAW,CAAC,MAAM,GAAG,CAAC,QAAQ,MAAM,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,WAAW,MAAM,CAAC,eAAe,MAAM,CAAC,iBAAiB,OAAO,CAAC,cAAc,MAAM,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,4BAA4B,MAAM,CAAC,oBAAoB,MAAM,CAAC,OAAO,OAAO,CAAC,WAAW,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,oBAAoB,IAAI,CAAC,gBAAgB,IAAI,CAAC,YAAY,IAAI,CAAC,OAAO,0CAAY,CAAC,MAAM,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,6CAAe,CAAC,iBAAiB,OAAO,CAAC,iBAAiB,IAAI,CAAC,oBAAoB,IAAI,CAAC,yCAAW,CAAC,wCAAU,CAAC,WAAW,GAAG,CAAC,wCAAU,CAAC,MAAM,IAAI,CAAC,+BAAgB,CAAC,yBAAU,CAAC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,4CAAc,CAAC,SAAS,QAAQ,CAAC,IAAI,CAAC,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