function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { Box, Flexbox, Icon, Card } from '../..';
import { FilterChip } from './FilterChip';
var meta = {
  component: FilterChip,
  title: 'Molecules / FilterChip'
};
export default meta;
var onChange = action('on change triggered');
var Template = function Template(args) {
  return React.createElement("div", {
    style: {
      padding: '10px',
      backgroundColor: 'white'
    }
  }, React.createElement(FilterChip, args));
};
export var OnlyLabel = {
  render: Template,
  args: {
    label: 'Default'
  }
};
export var OnlyIcon = {
  render: Template,
  args: {
    icon: React.createElement(Icon.Money16, null)
  }
};
export var BothIconAndLabel = {
  render: Template,
  args: {
    icon: React.createElement(Icon.MonthlySavings16, null),
    label: 'Default'
  }
};
export var AnotherIconAndLabel = {
  render: Template,
  args: {
    icon: React.createElement(Icon.Money16, null),
    label: 'Another label yqPomå'
  }
};
export var WithSelectedInitially = {
  render: Template,
  args: {
    icon: React.createElement(Icon.Money16, null),
    selectedInitially: true
  }
};
export var WithDisabled = {
  render: Template,
  args: {
    icon: React.createElement(Icon.Money16, null),
    label: 'disabled',
    disabled: true
  }
};
export var SustainabilityVariant = function SustainabilityVariant() {
  return React.createElement(Card, null, React.createElement(Box, {
    p: 3
  }, React.createElement(FilterChip, {
    label: "Sustainable",
    value: "Sustainable",
    icon: React.createElement(Icon.Sustainable16, null),
    variant: "sustainability"
  })));
};
export var BrandVariant = function BrandVariant() {
  return React.createElement(Card, null, React.createElement(Box, {
    p: 3
  }, React.createElement(FilterChip, {
    label: "brand",
    value: "brand",
    icon: React.createElement(Icon.Sustainable16, null),
    variant: "brand"
  })));
};
export var EmojiVariant = function EmojiVariant() {
  return React.createElement(Card, null, React.createElement(Box, {
    p: 3
  }, React.createElement(FilterChip, {
    label: "Title",
    value: "Title",
    icon: "\uD83C\uDF3B",
    variant: "brand"
  })));
};
export var WithFourFilterChips = function WithFourFilterChips() {
  return React.createElement(Card, null, React.createElement(Box, {
    p: 2
  }, React.createElement(Flexbox, {
    container: true,
    gap: 1
  }, React.createElement(FilterChip, {
    icon: React.createElement(Icon.MonthlySavings16, null),
    value: "1"
  }), ' ', React.createElement(FilterChip, {
    icon: React.createElement(Icon.MonthlySavings16, null),
    label: "\xA0",
    value: "1"
  }), ' ', React.createElement(FilterChip, {
    icon: React.createElement(Icon.MonthlySavings16, null),
    label: "label",
    value: "1"
  }), ' ', React.createElement(FilterChip, {
    label: "Label one next to icon one",
    value: "0"
  }))));
};
var WithValueControlledBehaviorExample = function WithValueControlledBehaviorExample() {
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    isChecked = _useState2[0],
    setIsChecked = _useState2[1];
  return React.createElement(Card, null, React.createElement(FilterChip, {
    label: "Controlled selection card",
    value: "This component is controlled",
    selected: isChecked,
    onChange: onChange
  }), React.createElement("button", {
    type: "button",
    onClick: function onClick() {
      return setIsChecked(true);
    }
  }, "Selected"), React.createElement("button", {
    type: "button",
    onClick: function onClick() {
      return setIsChecked(false);
    }
  }, "Not selected"), "value: ", isChecked.toString());
};
export var WithValueControlledBehavior = {
  render: function render() {
    return React.createElement(WithValueControlledBehaviorExample, null);
  }
};