@entur/chip 0.6.13 → 0.6.14

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.
@@ -18,32 +18,26 @@ function _extends() {
18
18
  _extends = Object.assign || function (target) {
19
19
  for (var i = 1; i < arguments.length; i++) {
20
20
  var source = arguments[i];
21
-
22
21
  for (var key in source) {
23
22
  if (Object.prototype.hasOwnProperty.call(source, key)) {
24
23
  target[key] = source[key];
25
24
  }
26
25
  }
27
26
  }
28
-
29
27
  return target;
30
28
  };
31
-
32
29
  return _extends.apply(this, arguments);
33
30
  }
34
-
35
31
  function _objectWithoutPropertiesLoose(source, excluded) {
36
32
  if (source == null) return {};
37
33
  var target = {};
38
34
  var sourceKeys = Object.keys(source);
39
35
  var key, i;
40
-
41
36
  for (i = 0; i < sourceKeys.length; i++) {
42
37
  key = sourceKeys[i];
43
38
  if (excluded.indexOf(key) >= 0) continue;
44
39
  target[key] = source[key];
45
40
  }
46
-
47
41
  return target;
48
42
  }
49
43
 
@@ -51,24 +45,21 @@ var ChoiceChipGroupContext = /*#__PURE__*/React__default["default"].createContex
51
45
  var ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;
52
46
  var useChoiceChipGroupContext = function useChoiceChipGroupContext() {
53
47
  var context = React__default["default"].useContext(ChoiceChipGroupContext);
54
-
55
48
  if (!context) {
56
49
  throw new Error('You need to wrap your ChoiceChips in a ChoiceChipGroup-component');
57
50
  }
58
-
59
51
  return context;
60
52
  };
61
53
 
62
54
  var _excluded$4 = ["className", "children", "value", "disabled", "style"];
63
55
  var ChoiceChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
64
56
  var className = _ref.className,
65
- children = _ref.children,
66
- value = _ref.value,
67
- _ref$disabled = _ref.disabled,
68
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
69
- style = _ref.style,
70
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
71
-
57
+ children = _ref.children,
58
+ value = _ref.value,
59
+ _ref$disabled = _ref.disabled,
60
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
61
+ style = _ref.style,
62
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
72
63
  var childrenArray = React__default["default"].Children.toArray(children);
73
64
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
74
65
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
@@ -77,12 +68,10 @@ var ChoiceChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
77
68
  'eds-chip--leading-icon': hasLeadingIcon,
78
69
  'eds-chip--trailing-icon': hasTrailingIcon
79
70
  });
80
-
81
71
  var _useChoiceChipGroupCo = useChoiceChipGroupContext(),
82
- name = _useChoiceChipGroupCo.name,
83
- selectedValue = _useChoiceChipGroupCo.value,
84
- onChange = _useChoiceChipGroupCo.onChange;
85
-
72
+ name = _useChoiceChipGroupCo.name,
73
+ selectedValue = _useChoiceChipGroupCo.value,
74
+ onChange = _useChoiceChipGroupCo.onChange;
86
75
  return React__default["default"].createElement("label", {
87
76
  className: "eds-choice-chip",
88
77
  style: style
@@ -103,21 +92,18 @@ var ChoiceChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
103
92
  var _excluded$3 = ["children", "className", "loading"];
104
93
  var ActionChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
105
94
  var children = _ref.children,
106
- className = _ref.className,
107
- _ref$loading = _ref.loading,
108
- loading = _ref$loading === void 0 ? false : _ref$loading,
109
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
110
-
95
+ className = _ref.className,
96
+ _ref$loading = _ref.loading,
97
+ loading = _ref$loading === void 0 ? false : _ref$loading,
98
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
111
99
  var childrenArray = React__default["default"].Children.toArray(children);
112
100
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
113
101
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
114
-
115
102
  var ariaLabelValue = function ariaLabelValue() {
116
103
  if (rest['aria-label']) return rest['aria-label'];
117
104
  if (loading) return ariaLabelWhenLoading;
118
105
  return undefined;
119
106
  };
120
-
121
107
  var ariaLabelWhenLoading = childrenArray.filter(function (child) {
122
108
  return typeof child === 'string';
123
109
  }).join(' ');
@@ -134,24 +120,21 @@ var ActionChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
134
120
  }, rest), loading ? React__default["default"].createElement(loader.LoadingDots, {
135
121
  className: "eds-action-chip__loading-dots"
136
122
  }) : children);
137
-
138
123
  if (rest.disabled) {
139
124
  return React__default["default"].createElement("div", {
140
125
  className: "eds-action-chip--disabled__wrapper"
141
126
  }, actionChip);
142
127
  }
143
-
144
128
  return React__default["default"].createElement(React__default["default"].Fragment, null, actionChip);
145
129
  });
146
130
 
147
131
  var _excluded$2 = ["children", "className", "onClose", "closeButtonAriaLabel"];
148
132
  var TagChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
149
133
  var children = _ref.children,
150
- className = _ref.className,
151
- onClose = _ref.onClose,
152
- closeButtonAriaLabel = _ref.closeButtonAriaLabel,
153
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
154
-
134
+ className = _ref.className,
135
+ onClose = _ref.onClose,
136
+ closeButtonAriaLabel = _ref.closeButtonAriaLabel,
137
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
155
138
  var selectedCloseLabel = closeButtonAriaLabel != null ? closeButtonAriaLabel : 'Fjern ' + (children == null ? void 0 : children.toString());
156
139
  return React__default["default"].createElement("div", _extends({
157
140
  className: classNames__default["default"]('eds-chip', 'eds-tag-chip', className)
@@ -167,14 +150,13 @@ var TagChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
167
150
  var _excluded$1 = ["className", "children", "value", "disabled", "name", "style"];
168
151
  var FilterChip = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
169
152
  var className = _ref.className,
170
- children = _ref.children,
171
- value = _ref.value,
172
- _ref$disabled = _ref.disabled,
173
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
174
- name = _ref.name,
175
- style = _ref.style,
176
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
177
-
153
+ children = _ref.children,
154
+ value = _ref.value,
155
+ _ref$disabled = _ref.disabled,
156
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
157
+ name = _ref.name,
158
+ style = _ref.style,
159
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
178
160
  var classList = classNames__default["default"](className, 'eds-chip', 'eds-filter-chip');
179
161
  return React__default["default"].createElement("label", {
180
162
  className: classList,
@@ -190,7 +172,6 @@ var FilterChip = /*#__PURE__*/React__default["default"].forwardRef(function (_re
190
172
  className: "eds-filter-chip__icon"
191
173
  }, React__default["default"].createElement(CheckboxIcon, null)), children);
192
174
  });
193
-
194
175
  var CheckboxIcon = function CheckboxIcon() {
195
176
  return React__default["default"].createElement("svg", {
196
177
  className: "eds-filter-chip-icon",
@@ -207,12 +188,11 @@ var CheckboxIcon = function CheckboxIcon() {
207
188
  var _excluded = ["name", "value", "children", "onChange", "label"];
208
189
  var ChoiceChipGroup = function ChoiceChipGroup(_ref) {
209
190
  var name = _ref.name,
210
- value = _ref.value,
211
- children = _ref.children,
212
- onChange = _ref.onChange,
213
- label = _ref.label,
214
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
215
-
191
+ value = _ref.value,
192
+ children = _ref.children,
193
+ onChange = _ref.onChange,
194
+ label = _ref.label,
195
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
216
196
  var contextValue = React__default["default"].useMemo(function () {
217
197
  return {
218
198
  name: name,
@@ -1 +1 @@
1
- {"version":3,"file":"chip.cjs.development.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAbo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AO;AAAEjC,MAAAA,IAAI,EAAJA,IAAF;AAAQZ,MAAAA,KAAK,EAALA,KAAR;AAAec,MAAAA,QAAQ,EAARA;AAAf,KAAP;AAAA,GADmB,EAEnB,CAACF,IAAD,EAAOZ,KAAP,EAAcc,QAAd,CAFmB,CAArB;AAIA,SACE3B,uCAAA,CAACE,8BAAD;AAAgCW,IAAAA,KAAK,EAAE4C;GAAvC,EACEzD,uCAAA,CAAC2D,aAAD;AAAUhD,IAAAA,SAAS,EAAC,wBAApB;AAA6C6C,IAAAA,KAAK,EAAEA;AAApD,KAA+DxC,IAA/D,GACGJ,QADH,CADF,CADF;AAOD;;ACjCDgD,4BAAsB,CAAC,MAAD,EAAS,MAAT,CAAtB;;;;;;;;"}
1
+ {"version":3,"file":"chip.cjs.development.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,sBAAsB,gBAC1BC,yBAAK,CAACC,aAAa,CAAqC,IAAI,CAAC;AAExD,IAAMC,8BAA8B,GAAGH,sBAAsB,CAACI,QAAQ;AAEtE,IAAMC,yBAAyB,GACpC,SADWA,yBAAyB;EAElC,IAAMC,OAAO,GAAGL,yBAAK,CAACM,UAAU,CAACP,sBAAsB,CAAC;EACxD,IAAI,CAACM,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,kEAAkE,CACnE;;EAEH,OAAOF,OAAO;AAChB,CAAC;;;ICGUG,UAAU,gBAAGR,yBAAK,CAACS,UAAU,CACxC,gBAEEC,GAAgC;MAD9BC,SAAS,QAATA,SAAS;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,KAAK,QAALA,KAAK;IAAA,qBAAEC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAEC,KAAK,QAALA,KAAK;IAAKC,IA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MAAM,EAAC,KAAK;IACZC,OAAO,EAAC;KAERpD;IACEW,SAAS,EAAC,4BAA4B;IACtC0C,CAAC,EAAC,8BAA8B;IAChCC,IAAI,EAAC;IACL,CACE;AAEV,CAAC;;;ICvCYC,eAAe,GAAmC,SAAlDA,eAAe;MAC1B9B,IAAI,QAAJA,IAAI;IACJZ,KAAK,QAALA,KAAK;IACLD,QAAQ,QAARA,QAAQ;IACRe,QAAQ,QAARA,QAAQ;IACR6B,KAAK,QAALA,KAAK;IACFxC,IAAI;EAEP,IAAMyC,YAAY,GAAGzD,yBAAK,CAAC0D,OAAO,CAChC;IAAA,OAAO;MAAEjC,IAAI,EAAJA,IAAI;MAAEZ,KAAK,EAALA,KAAK;MAAEc,QAAQ,EAARA;KAAU;GAAC,EACjC,CAACF,IAAI,EAAEZ,KAAK,EAAEc,QAAQ,CAAC,CACxB;EACD,OACE3B,wCAACE,8BAA8B;IAACW,KAAK,EAAE4C;KACrCzD,wCAAC2D,aAAQ;IAAChD,SAAS,EAAC,wBAAwB;IAAC6C,KAAK,EAAEA;KAAWxC,IAAI,GAChEJ,QAAQ,CACA,CACoB;AAErC;;ACjCAgD,4BAAsB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"chip.cjs.production.min.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/index.tsx","../src/ChoiceChipGroup.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","classList","cx","length","context","useContext","Error","useChoiceChipGroupContext","type","name","checked","onChange","ActionChip","loading","hasLeadingIcon","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","warnAboutMissingStyles","label","contextValue","useMemo","Fieldset"],"mappings":"yoBAQA,IAAMA,EACJC,UAAMC,cAAkD,MAE7CC,EAAiCH,EAAuBI,+DCcxDC,EAAaJ,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,UAAOC,SAAAA,gBAAkBC,IAAAA,MAAUC,SAGpDC,EAAgBb,UAAMc,SAASC,QAAQP,GAOvCQ,EAAYC,UAAGV,EAAW,WAAY,sBACpBG,2BANtBG,EAAcK,OAAS,GAAiC,iBAArBL,EAAc,6BAEjDA,EAAcK,OAA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GAELN,wBAAC4C,oFCxBEC,EAAa7C,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,UAAOC,SAAAA,gBAAkBc,IAAAA,KAAMb,IAAAA,MAAUC,SAG1DI,EAAYC,UAAGV,EAAW,WAAY,0BAG1CP,iCAAOO,UAAWS,EAAWL,MAAOA,GAClCX,mCACEO,UAAU,yBACVgB,KAAK,WACLC,KAAMA,EACNlB,IAAKA,EACLG,MAAOA,EACPC,SAAUA,GACNE,IAENZ,gCAAMO,UAAU,yBACdP,wBAAC8C,SAEFtC,MAMHsC,EAAyB,kBAE3B9C,+BACEO,UAAU,uBACVwC,MAAM,OACNC,OAAO,MACPC,QAAQ,cAERjD,gCACEO,UAAU,6BACV2C,EAAE,+BACFC,KAAK,4DCjDbC,yBAAuB,OAAQ,0ECcgC,gBAC7D5B,IAAAA,KACAf,IAAAA,MACAD,IAAAA,SACAkB,IAAAA,SACA2B,IAAAA,MACGzC,SAEG0C,EAAetD,UAAMuD,SACzB,iBAAO,CAAE/B,KAAAA,EAAMf,MAAAA,EAAOiB,SAAAA,KACtB,CAACF,EAAMf,EAAOiB,WAGd1B,wBAACE,GAA+BO,MAAO6C,GACrCtD,wBAACwD,cAASjD,UAAU,yBAAyB8C,MAAOA,GAAWzC,GAC5DJ"}
1
+ {"version":3,"file":"chip.cjs.production.min.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/index.tsx","../src/ChoiceChipGroup.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","ChoiceChip","forwardRef","ref","className","children","value","_ref$disabled","disabled","style","rest","childrenArray","Children","toArray","classList","cx","length","context","useContext","Error","useChoiceChipGroupContext","type","name","checked","onChange","ActionChip","_ref$loading","loading","hasLeadingIcon","hasTrailingIcon","ariaLabelWhenLoading","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","warnAboutMissingStyles","label","contextValue","useMemo","Fieldset"],"mappings":"yoBAQA,IAAMA,EACJC,UAAMC,cAAkD,MAE7CC,EAAiCH,EAAuBI,+DCcxDC,EAAaJ,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,MAAKC,IAAEC,SAAAA,gBAAkBC,IAAAA,MAAUC,SAGpDC,EAAgBd,UAAMe,SAASC,QAAQR,GAOvCS,EAAYC,UAAGX,EAAW,WAAY,CAC1C,qB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BAAWlC,SAAAA,EAAUoC,YAE/C,OACE5C,iCACEO,UAAW+B,UAAW,WAAY,eAAgB/B,IAC9CM,GAEHL,EACDR,kCACEO,UAAU,6BACViB,KAAK,SACLqB,QAASJ,eACGE,EACZrC,IAAKA,GAELN,wBAAC8C,oFCxBEC,EAAa/C,UAAMK,YAC9B,WAEEC,OADEC,IAAAA,UAAWC,IAAAA,SAAUC,IAAAA,MAAKC,IAAEC,SAAAA,gBAAkBc,IAAAA,KAAMb,IAAAA,MAAUC,SAG1DI,EAAYC,UAAGX,EAAW,WAAY,mBAE5C,OACEP,iCAAOO,UAAWU,EAAWL,MAAOA,GAClCZ,mCACEO,UAAU,yBACViB,KAAK,WACLC,KAAMA,EACNnB,IAAKA,EACLG,MAAOA,EACPE,SAAUA,GACNE,IAENb,gCAAMO,UAAU,yBACdP,wBAACgD,SAEFxC,MAMHwC,EAAyB,WAC7B,OACEhD,+BACEO,UAAU,uBACV0C,MAAM,OACNC,OAAO,MACPC,QAAQ,cAERnD,gCACEO,UAAU,6BACV6C,EAAE,+BACFC,KAAK,4DCjDbC,yBAAuB,OAAQ,0ECcgC,gBAC7D7B,IAAAA,KACAhB,IAAAA,MACAD,IAAAA,SACAmB,IAAAA,SACA4B,IAAAA,MACG1C,SAEG2C,EAAexD,UAAMyD,SACzB,WAAA,MAAO,CAAEhC,KAAAA,EAAMhB,MAAAA,EAAOkB,SAAAA,KACtB,CAACF,EAAMhB,EAAOkB,IAEhB,OACE3B,wBAACE,GAA+BO,MAAO+C,GACrCxD,wBAAC0D,cAASnD,UAAU,yBAAyBgD,MAAOA,GAAW1C,GAC5DL"}
package/dist/chip.esm.js CHANGED
@@ -9,32 +9,26 @@ function _extends() {
9
9
  _extends = Object.assign || function (target) {
10
10
  for (var i = 1; i < arguments.length; i++) {
11
11
  var source = arguments[i];
12
-
13
12
  for (var key in source) {
14
13
  if (Object.prototype.hasOwnProperty.call(source, key)) {
15
14
  target[key] = source[key];
16
15
  }
17
16
  }
18
17
  }
19
-
20
18
  return target;
21
19
  };
22
-
23
20
  return _extends.apply(this, arguments);
24
21
  }
25
-
26
22
  function _objectWithoutPropertiesLoose(source, excluded) {
27
23
  if (source == null) return {};
28
24
  var target = {};
29
25
  var sourceKeys = Object.keys(source);
30
26
  var key, i;
31
-
32
27
  for (i = 0; i < sourceKeys.length; i++) {
33
28
  key = sourceKeys[i];
34
29
  if (excluded.indexOf(key) >= 0) continue;
35
30
  target[key] = source[key];
36
31
  }
37
-
38
32
  return target;
39
33
  }
40
34
 
@@ -42,24 +36,21 @@ var ChoiceChipGroupContext = /*#__PURE__*/React.createContext(null);
42
36
  var ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;
43
37
  var useChoiceChipGroupContext = function useChoiceChipGroupContext() {
44
38
  var context = React.useContext(ChoiceChipGroupContext);
45
-
46
39
  if (!context) {
47
40
  throw new Error('You need to wrap your ChoiceChips in a ChoiceChipGroup-component');
48
41
  }
49
-
50
42
  return context;
51
43
  };
52
44
 
53
45
  var _excluded$4 = ["className", "children", "value", "disabled", "style"];
54
46
  var ChoiceChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
55
47
  var className = _ref.className,
56
- children = _ref.children,
57
- value = _ref.value,
58
- _ref$disabled = _ref.disabled,
59
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
60
- style = _ref.style,
61
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
62
-
48
+ children = _ref.children,
49
+ value = _ref.value,
50
+ _ref$disabled = _ref.disabled,
51
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
52
+ style = _ref.style,
53
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
63
54
  var childrenArray = React.Children.toArray(children);
64
55
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
65
56
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
@@ -68,12 +59,10 @@ var ChoiceChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
68
59
  'eds-chip--leading-icon': hasLeadingIcon,
69
60
  'eds-chip--trailing-icon': hasTrailingIcon
70
61
  });
71
-
72
62
  var _useChoiceChipGroupCo = useChoiceChipGroupContext(),
73
- name = _useChoiceChipGroupCo.name,
74
- selectedValue = _useChoiceChipGroupCo.value,
75
- onChange = _useChoiceChipGroupCo.onChange;
76
-
63
+ name = _useChoiceChipGroupCo.name,
64
+ selectedValue = _useChoiceChipGroupCo.value,
65
+ onChange = _useChoiceChipGroupCo.onChange;
77
66
  return React.createElement("label", {
78
67
  className: "eds-choice-chip",
79
68
  style: style
@@ -94,21 +83,18 @@ var ChoiceChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
94
83
  var _excluded$3 = ["children", "className", "loading"];
95
84
  var ActionChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
96
85
  var children = _ref.children,
97
- className = _ref.className,
98
- _ref$loading = _ref.loading,
99
- loading = _ref$loading === void 0 ? false : _ref$loading,
100
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
101
-
86
+ className = _ref.className,
87
+ _ref$loading = _ref.loading,
88
+ loading = _ref$loading === void 0 ? false : _ref$loading,
89
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
102
90
  var childrenArray = React.Children.toArray(children);
103
91
  var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string';
104
92
  var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string';
105
-
106
93
  var ariaLabelValue = function ariaLabelValue() {
107
94
  if (rest['aria-label']) return rest['aria-label'];
108
95
  if (loading) return ariaLabelWhenLoading;
109
96
  return undefined;
110
97
  };
111
-
112
98
  var ariaLabelWhenLoading = childrenArray.filter(function (child) {
113
99
  return typeof child === 'string';
114
100
  }).join(' ');
@@ -125,24 +111,21 @@ var ActionChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
125
111
  }, rest), loading ? React.createElement(LoadingDots, {
126
112
  className: "eds-action-chip__loading-dots"
127
113
  }) : children);
128
-
129
114
  if (rest.disabled) {
130
115
  return React.createElement("div", {
131
116
  className: "eds-action-chip--disabled__wrapper"
132
117
  }, actionChip);
133
118
  }
134
-
135
119
  return React.createElement(React.Fragment, null, actionChip);
136
120
  });
137
121
 
138
122
  var _excluded$2 = ["children", "className", "onClose", "closeButtonAriaLabel"];
139
123
  var TagChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
140
124
  var children = _ref.children,
141
- className = _ref.className,
142
- onClose = _ref.onClose,
143
- closeButtonAriaLabel = _ref.closeButtonAriaLabel,
144
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
145
-
125
+ className = _ref.className,
126
+ onClose = _ref.onClose,
127
+ closeButtonAriaLabel = _ref.closeButtonAriaLabel,
128
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
146
129
  var selectedCloseLabel = closeButtonAriaLabel != null ? closeButtonAriaLabel : 'Fjern ' + (children == null ? void 0 : children.toString());
147
130
  return React.createElement("div", _extends({
148
131
  className: classNames('eds-chip', 'eds-tag-chip', className)
@@ -158,14 +141,13 @@ var TagChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
158
141
  var _excluded$1 = ["className", "children", "value", "disabled", "name", "style"];
159
142
  var FilterChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
160
143
  var className = _ref.className,
161
- children = _ref.children,
162
- value = _ref.value,
163
- _ref$disabled = _ref.disabled,
164
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
165
- name = _ref.name,
166
- style = _ref.style,
167
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
168
-
144
+ children = _ref.children,
145
+ value = _ref.value,
146
+ _ref$disabled = _ref.disabled,
147
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
148
+ name = _ref.name,
149
+ style = _ref.style,
150
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
169
151
  var classList = classNames(className, 'eds-chip', 'eds-filter-chip');
170
152
  return React.createElement("label", {
171
153
  className: classList,
@@ -181,7 +163,6 @@ var FilterChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
181
163
  className: "eds-filter-chip__icon"
182
164
  }, React.createElement(CheckboxIcon, null)), children);
183
165
  });
184
-
185
166
  var CheckboxIcon = function CheckboxIcon() {
186
167
  return React.createElement("svg", {
187
168
  className: "eds-filter-chip-icon",
@@ -198,12 +179,11 @@ var CheckboxIcon = function CheckboxIcon() {
198
179
  var _excluded = ["name", "value", "children", "onChange", "label"];
199
180
  var ChoiceChipGroup = function ChoiceChipGroup(_ref) {
200
181
  var name = _ref.name,
201
- value = _ref.value,
202
- children = _ref.children,
203
- onChange = _ref.onChange,
204
- label = _ref.label,
205
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
206
-
182
+ value = _ref.value,
183
+ children = _ref.children,
184
+ onChange = _ref.onChange,
185
+ label = _ref.label,
186
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
207
187
  var contextValue = React.useMemo(function () {
208
188
  return {
209
189
  name: name,
@@ -1 +1 @@
1
- {"version":3,"file":"chip.esm.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,sBAAsB,gBAC1BC,KAAK,CAACC,aAAN,CAAwD,IAAxD,CADF;AAGO,IAAMC,8BAA8B,GAAGH,sBAAsB,CAACI,QAA9D;AAEA,IAAMC,yBAAyB,GACpC,SADWA,yBACX;AACE,MAAMC,OAAO,GAAGL,KAAK,CAACM,UAAN,CAAiBP,sBAAjB,CAAhB;;AACA,MAAI,CAACM,OAAL,EAAc;AACZ,UAAM,IAAIE,KAAJ,CACJ,kEADI,CAAN;AAGD;;AACD,SAAOF,OAAP;AACD,CATI;;;ICYMG,UAAU,gBAAGR,KAAK,CA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"version":3,"file":"chip.esm.js","sources":["../src/ChoiceChipGroupContext.tsx","../src/ChoiceChip.tsx","../src/ActionChip.tsx","../src/TagChip.tsx","../src/FilterChip.tsx","../src/ChoiceChipGroup.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\ntype ChoiceChipGroupContextProps = {\n name: string;\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n value: string | null;\n};\n\nconst ChoiceChipGroupContext =\n React.createContext<ChoiceChipGroupContextProps | null>(null);\n\nexport const ChoiceChipGroupContextProvider = ChoiceChipGroupContext.Provider;\n\nexport const useChoiceChipGroupContext: () => ChoiceChipGroupContextProps =\n () => {\n const context = React.useContext(ChoiceChipGroupContext);\n if (!context) {\n throw new Error(\n 'You need to wrap your ChoiceChips in a ChoiceChipGroup-component',\n );\n }\n return context;\n };\n","import React from 'react';\nimport cx from 'classnames';\nimport { useChoiceChipGroupContext } from './ChoiceChipGroupContext';\nimport './BaseChip.scss';\nimport './ChoiceChip.scss';\n\nexport type ChoiceChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Om Choicechip er deaktivert eller ikke\n * @default false\n */\n disabled?: boolean;\n /** Label til ChoiceChip */\n children?: React.ReactNode;\n /** Verdien til ChoiceChip */\n value: string;\n} & Omit<\n React.DetailedHTMLProps<\n React.InputHTMLAttributes<HTMLInputElement>,\n HTMLInputElement\n >,\n 'value'\n>;\n\nexport const ChoiceChip = React.forwardRef<HTMLInputElement, ChoiceChipProps>(\n (\n { className, children, value, disabled = false, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const classList = cx(className, 'eds-chip', {\n 'eds-chip--disabled': disabled,\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n });\n const {\n name,\n value: selectedValue,\n onChange,\n } = useChoiceChipGroupContext();\n return (\n <label className=\"eds-choice-chip\" style={style}>\n <input\n className=\"eds-choice-chip__input\"\n type=\"radio\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n checked={selectedValue === value}\n onChange={onChange}\n {...rest}\n />\n <div className={classList}>{children}</div>\n </label>\n );\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { LoadingDots } from '@entur/loader';\nimport './BaseChip.scss';\nimport './ActionChip.scss';\n\nexport type ActionChipProps = {\n /** Teksten som vises i ActionChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Om chip-en er opptatt, f.eks med å oppdatere informasjon\n * @default false\n */\n loading?: boolean;\n} & React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nexport const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(\n (\n { children, className, loading = false, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const childrenArray = React.Children.toArray(children);\n const hasLeadingIcon =\n childrenArray.length > 1 && typeof childrenArray[0] !== 'string';\n const hasTrailingIcon =\n childrenArray.length > 1 &&\n typeof childrenArray[childrenArray.length - 1] !== 'string';\n\n const ariaLabelValue = () => {\n if (rest['aria-label']) return rest['aria-label'];\n if (loading) return ariaLabelWhenLoading;\n return undefined;\n };\n\n const ariaLabelWhenLoading = childrenArray\n .filter(child => typeof child === 'string')\n .join(' ');\n\n const actionChip = (\n <button\n className={classNames(\n 'eds-chip',\n 'eds-action-chip',\n {\n 'eds-chip--leading-icon': hasLeadingIcon,\n 'eds-chip--trailing-icon': hasTrailingIcon,\n 'eds-action-chip--disabled': rest.disabled,\n },\n className,\n )}\n ref={ref}\n aria-busy={loading}\n aria-label={ariaLabelValue()}\n type=\"button\"\n {...rest}\n >\n {loading ? (\n <LoadingDots className=\"eds-action-chip__loading-dots\" />\n ) : (\n children\n )}\n </button>\n );\n\n if (rest.disabled) {\n return (\n <div className=\"eds-action-chip--disabled__wrapper\">{actionChip}</div>\n );\n }\n return <>{actionChip}</>;\n },\n);\n","import React from 'react';\nimport classNames from 'classnames';\nimport { CloseIcon } from '@entur/icons';\nimport './BaseChip.scss';\nimport './TagChip.scss';\n\nexport type TagChipProps = {\n /** Teksten som vises i TagChip */\n children: React.ReactNode;\n /** Ekstra klassenavn */\n className?: string;\n /** Callback for når man klikker på krysset */\n onClose: () => void;\n /** Skjermlesertekst for X-knappen */\n closeButtonAriaLabel?: string;\n};\n\nexport const TagChip = React.forwardRef<HTMLButtonElement, TagChipProps>(\n (\n { children, className, onClose, closeButtonAriaLabel, ...rest },\n ref: React.Ref<HTMLButtonElement>,\n ) => {\n const selectedCloseLabel =\n closeButtonAriaLabel ?? 'Fjern ' + children?.toString();\n\n return (\n <div\n className={classNames('eds-chip', 'eds-tag-chip', className)}\n {...rest}\n >\n {children}\n <button\n className=\"eds-tag-chip__close-button\"\n type=\"button\"\n onClick={onClose}\n aria-label={selectedCloseLabel}\n ref={ref}\n >\n <CloseIcon />\n </button>\n </div>\n );\n },\n);\n","import React from 'react';\nimport cx from 'classnames';\nimport './BaseChip.scss';\nimport './FilterChip.scss';\n\nexport type FilterChipProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Label til FilterChip */\n children?: React.ReactNode;\n /** Verdien til FilterChip */\n value: string;\n} & React.InputHTMLAttributes<HTMLInputElement>;\n\nexport const FilterChip = React.forwardRef<HTMLInputElement, FilterChipProps>(\n (\n { className, children, value, disabled = false, name, style, ...rest },\n ref: React.Ref<HTMLInputElement>,\n ) => {\n const classList = cx(className, 'eds-chip', 'eds-filter-chip');\n\n return (\n <label className={classList} style={style}>\n <input\n className=\"eds-filter-chip__input\"\n type=\"checkbox\"\n name={name}\n ref={ref}\n value={value}\n disabled={disabled}\n {...rest}\n />\n <span className=\"eds-filter-chip__icon\">\n <CheckboxIcon />\n </span>\n {children}\n </label>\n );\n },\n);\n\nconst CheckboxIcon: React.FC = () => {\n return (\n <svg\n className=\"eds-filter-chip-icon\"\n width=\"11px\"\n height=\"9px\"\n viewBox=\"6 11 37 33\"\n >\n <path\n className=\"eds-filter-chip-icon__path\"\n d=\"M14.1 27.2l7.1 7.2 14.6-14.8\"\n fill=\"none\"\n />\n </svg>\n );\n};\n","import React from 'react';\nimport { ChoiceChipGroupContextProvider } from './ChoiceChipGroupContext';\nimport { Fieldset } from '@entur/form';\nexport type ChoiceChipGroupProps = {\n /** Navnet til ChoiceChipsGroup */\n name: string;\n /** Verdien til den valgte ChoiceChipen */\n value: string | null;\n /** ChoiceChip-komponentene sendes inn som children */\n children: React.ReactNode;\n /** En callback som blir kalles hver gang en ChoiceChip klikkes på */\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;\n /** Labelen til ChoiceChip-gruppen. */\n label?: React.ReactNode;\n [key: string]: any;\n};\n\nexport const ChoiceChipGroup: React.FC<ChoiceChipGroupProps> = ({\n name,\n value,\n children,\n onChange,\n label,\n ...rest\n}) => {\n const contextValue = React.useMemo(\n () => ({ name, value, onChange }),\n [name, value, onChange],\n );\n return (\n <ChoiceChipGroupContextProvider value={contextValue}>\n <Fieldset className=\"eds-choice-chips-group\" label={label} {...rest}>\n {children}\n </Fieldset>\n </ChoiceChipGroupContextProvider>\n );\n};\n","import { warnAboutMissingStyles } from '@entur/utils';\nimport './index.scss';\n\nwarnAboutMissingStyles('chip', 'form');\n\nexport * from './ChoiceChip';\nexport * from './ActionChip';\nexport * from './TagChip';\nexport * from './FilterChip';\nexport * from './ChoiceChipGroup';\n"],"names":["ChoiceChipGroupContext","React","createContext","ChoiceChipGroupContextProvider","Provider","useChoiceChipGroupContext","context","useContext","Error","ChoiceChip","forwardRef","ref","className","children","value","disabled","style","rest","childrenArray","Children","toArray","hasLeadingIcon","length","hasTrailingIcon","classList","cx","name","selectedValue","onChange","type","checked","ActionChip","loading","ariaLabelValue","ariaLabelWhenLoading","undefined","filter","child","join","actionChip","classNames","LoadingDots","TagChip","onClose","closeButtonAriaLabel","selectedCloseLabel","toString","onClick","CloseIcon","FilterChip","CheckboxIcon","width","height","viewBox","d","fill","ChoiceChipGroup","label","contextValue","useMemo","Fieldset","warnAboutMissingStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAMA,sBAAsB,gBAC1BC,KAAK,CAACC,aAAa,CAAqC,IAAI,CAAC;AAExD,IAAMC,8BAA8B,GAAGH,sBAAsB,CAACI,QAAQ;AAEtE,IAAMC,yBAAyB,GACpC,SADWA,yBAAyB;EAElC,IAAMC,OAAO,GAAGL,KAAK,CAACM,UAAU,CAACP,sBAAsB,CAAC;EACxD,IAAI,CAACM,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CACb,kEAAkE,CACnE;;EAEH,OAAOF,OAAO;AAChB,CAAC;;;ICGUG,UAAU,gBAAGR,KAAK,CAACS,UAAU,CACxC,gBAEEC,GAAgC;MAD9BC,SAAS,QAATA,SAAS;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,KAAK,QAALA,KAAK;IAAA,qBAAEC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAEC,KAAK,QAALA,KAAK;IAAKC,IAAI;EAG9D,IAAMC,aAAa,GAAGjB,KAAK,CAACkB,QAAQ,CAACC,OAAO,CAACP,QAAQ,CAAC;EACtD,IAAMQ,cAAc,GAClBH,aAAa,CAACI,MAAM,GAAG,CAAC,IAAI,OAAOJ,aAAa,CAAC,CAAC,CAAC,KAAK,QAAQ;EAClE,IAAMK,eAAe,GACnBL,aAAa,CAACI,MAAM,GAAG,CAAC,IACxB,OAAOJ,aAAa,CAACA,aAAa,CAACI,MAAM,GAAG,CAAC,CAAC,KAAK,QAAQ;EAE7D,IAAME,SAAS,GAAGC,UAAE,CAACb,SAAS,EAAE,UAAU,EAAE;IAC1C,oBAAoB,EAAEG,QAAQ;IAC9B,wBAAwB,EAAEM,cAAc;IACxC,yBAAyB,EAAEE;GAC5B,CAAC;EAC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AAEZ,KAAK,EAAEc,QAAQ,CAAC,CACxB;EACD,OACE3B,oBAACE,8BAA8B;IAACW,KAAK,EAAE4C;KACrCzD,oBAAC2D,QAAQ;IAAChD,SAAS,EAAC,wBAAwB;IAAC6C,KAAK,EAAEA;KAAWxC,IAAI,GAChEJ,QAAQ,CACA,CACoB;AAErC;;ACjCAgD,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;"}
package/dist/styles.css CHANGED
@@ -2,6 +2,44 @@
2
2
  --eds-chip: 1;
3
3
  }/* DO NOT CHANGE!*/
4
4
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
5
+ .eds-action-chip {
6
+ cursor: pointer;
7
+ }
8
+ .eds-action-chip:focus {
9
+ outline: none;
10
+ box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
11
+ outline-offset: 0.125rem;
12
+ }
13
+ .eds-contrast .eds-action-chip:focus {
14
+ box-shadow: 0 0 0 0.125rem #181c56, 0 0 0 0.25rem #ffffff;
15
+ }
16
+ .eds-action-chip:hover {
17
+ border-color: #181c56;
18
+ }
19
+ .eds-contrast .eds-action-chip:hover {
20
+ background-color: #54568c;
21
+ border-color: #54568c;
22
+ }
23
+ .eds-action-chip:active {
24
+ background: #d1d4e3;
25
+ }
26
+ .eds-contrast .eds-action-chip:active {
27
+ background-color: #292b6a;
28
+ border-color: #292b6a;
29
+ }
30
+ .eds-action-chip--disabled {
31
+ opacity: 0.5;
32
+ pointer-events: none;
33
+ }
34
+ .eds-action-chip--disabled__wrapper {
35
+ cursor: not-allowed;
36
+ width: -moz-fit-content;
37
+ width: fit-content;
38
+ }
39
+ .eds-contrast .eds-action-chip__loading-dots .eds-loading-dots__dot {
40
+ background-color: #ffffff;
41
+ }/* DO NOT CHANGE!*/
42
+ /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
5
43
  .eds-chip {
6
44
  background: #ebebf1;
7
45
  border: 0.0625rem solid #d1d4e3;
@@ -102,49 +140,9 @@
102
140
  color: #babbcf;
103
141
  }/* DO NOT CHANGE!*/
104
142
  /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
105
- .eds-action-chip {
106
- cursor: pointer;
107
- }
108
- .eds-action-chip:focus {
109
- outline: none;
110
- box-shadow: 0 0 0 0.125rem #ffffff, 0 0 0 0.25rem #181c56;
111
- outline-offset: 0.125rem;
112
- }
113
- .eds-contrast .eds-action-chip:focus {
114
- box-shadow: 0 0 0 0.125rem #181c56, 0 0 0 0.25rem #ffffff;
115
- }
116
- .eds-action-chip:hover {
117
- border-color: #181c56;
118
- }
119
- .eds-contrast .eds-action-chip:hover {
120
- background-color: #54568c;
121
- border-color: #54568c;
122
- }
123
- .eds-action-chip:active {
124
- background: #d1d4e3;
125
- }
126
- .eds-contrast .eds-action-chip:active {
127
- background-color: #292b6a;
128
- border-color: #292b6a;
129
- }
130
- .eds-action-chip--disabled {
131
- opacity: 0.5;
132
- pointer-events: none;
133
- }
134
- .eds-action-chip--disabled__wrapper {
135
- cursor: not-allowed;
136
- width: -webkit-fit-content;
137
- width: -moz-fit-content;
138
- width: fit-content;
139
- }
140
- .eds-contrast .eds-action-chip__loading-dots .eds-loading-dots__dot {
141
- background-color: #ffffff;
142
- }/* DO NOT CHANGE!*/
143
- /* This file is automatically generated from @entur/tokens! Changes will be overwritten. */
144
143
  .eds-tag-chip {
145
144
  cursor: default;
146
145
  padding-right: 0.25rem;
147
- width: -webkit-fit-content;
148
146
  width: -moz-fit-content;
149
147
  width: fit-content;
150
148
  }
@@ -185,10 +183,8 @@
185
183
  cursor: pointer;
186
184
  -webkit-user-select: none;
187
185
  -moz-user-select: none;
188
- -ms-user-select: none;
189
186
  user-select: none;
190
187
  padding-left: 0.25rem;
191
- width: -webkit-fit-content;
192
188
  width: -moz-fit-content;
193
189
  width: fit-content;
194
190
  }
@@ -203,8 +199,7 @@
203
199
  }
204
200
  .eds-filter-chip__input:checked + .eds-filter-chip__icon .eds-filter-chip-icon__path {
205
201
  stroke: #181c56;
206
- -webkit-animation: stroke ease-in-out 0.2s 0.1s forwards;
207
- animation: stroke ease-in-out 0.2s 0.1s forwards;
202
+ animation: stroke ease-in-out 0.2s 0.1s forwards;
208
203
  }
209
204
  .eds-contrast .eds-filter-chip__input:checked + .eds-filter-chip__icon .eds-filter-chip-icon__path {
210
205
  stroke: #5ac39a;
@@ -263,12 +258,6 @@
263
258
  stroke-width: 0.375rem;
264
259
  }
265
260
 
266
- @-webkit-keyframes stroke {
267
- 100% {
268
- stroke-dashoffset: 0;
269
- }
270
- }
271
-
272
261
  @keyframes stroke {
273
262
  100% {
274
263
  stroke-dashoffset: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entur/chip",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/chip.esm.js",
@@ -17,20 +17,27 @@
17
17
  "access": "public"
18
18
  },
19
19
  "scripts": {
20
- "start": "dts watch --noClean",
21
- "build": "dts build",
22
- "test": "dts test --env=jsdom",
23
- "lint": "dts lint"
20
+ "start": "yarn run dts watch --noClean",
21
+ "build": "yarn run dts build",
22
+ "test": "yarn run dts test --env=jsdom",
23
+ "lint": "yarn run dts lint"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": ">=16.8.0",
27
27
  "react-dom": ">=16.8.0"
28
28
  },
29
29
  "dependencies": {
30
- "@entur/form": "^5.4.10",
31
- "@entur/tokens": "^3.4.1",
32
- "@entur/utils": "^0.4.6",
30
+ "@entur/form": "^5.4.11",
31
+ "@entur/tokens": "^3.4.2",
32
+ "@entur/utils": "^0.4.7",
33
33
  "classnames": "^2.3.1"
34
34
  },
35
- "gitHead": "11fde5ffbfd805773572c3a7d999d63f2733e0c7"
35
+ "devDependencies": {
36
+ "dts-cli": "^1.1.6",
37
+ "jest": "^27.0.0",
38
+ "jest-watch-typeahead": "^2.2.0",
39
+ "ts-jest": "^27.0.0",
40
+ "typescript": "^4.8.0"
41
+ },
42
+ "gitHead": "8915b1630bd936740ba9a4a88883f3432948a80e"
36
43
  }
package/CHANGELOG.md DELETED
@@ -1,492 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [0.6.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.12...@entur/chip@0.6.13) (2022-10-31)
7
-
8
- **Note:** Version bump only for package @entur/chip
9
-
10
- ## [0.6.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.11...@entur/chip@0.6.12) (2022-10-31)
11
-
12
- **Note:** Version bump only for package @entur/chip
13
-
14
- ## [0.6.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.10...@entur/chip@0.6.11) (2022-10-31)
15
-
16
- **Note:** Version bump only for package @entur/chip
17
-
18
- ## [0.6.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.9...@entur/chip@0.6.10) (2022-10-20)
19
-
20
- **Note:** Version bump only for package @entur/chip
21
-
22
- ## [0.6.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.8...@entur/chip@0.6.9) (2022-10-20)
23
-
24
- **Note:** Version bump only for package @entur/chip
25
-
26
- ## [0.6.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.7...@entur/chip@0.6.8) (2022-10-12)
27
-
28
- **Note:** Version bump only for package @entur/chip
29
-
30
- ## [0.6.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.5...@entur/chip@0.6.6) (2022-08-31)
31
-
32
- **Note:** Version bump only for package @entur/chip
33
-
34
- ## [0.6.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.4...@entur/chip@0.6.5) (2022-08-24)
35
-
36
- **Note:** Version bump only for package @entur/chip
37
-
38
- ## [0.6.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.3...@entur/chip@0.6.4) (2022-08-12)
39
-
40
- ### Bug Fixes
41
-
42
- - **choice chip:** remove opacitiy when chip is disabled ([7412724](https://bitbucket.org/enturas/design-system/commits/741272400dda7ff77aa58b5032dd91f91d3a0393))
43
-
44
- ## [0.6.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.2...@entur/chip@0.6.3) (2022-08-09)
45
-
46
- **Note:** Version bump only for package @entur/chip
47
-
48
- ## [0.6.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.1...@entur/chip@0.6.2) (2022-08-09)
49
-
50
- **Note:** Version bump only for package @entur/chip
51
-
52
- ## [0.6.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.6.0...@entur/chip@0.6.1) (2022-07-05)
53
-
54
- **Note:** Version bump only for package @entur/chip
55
-
56
- # [0.6.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.8...@entur/chip@0.6.0) (2022-06-28)
57
-
58
- ### Features
59
-
60
- - **action chip:** add aria-loading and aria-label text to action chip when loading ([2eaadbe](https://bitbucket.org/enturas/design-system/commits/2eaadbe743049a57613d0c89cb17fab8128da915))
61
- - **action chip:** add visual disabled indicator to actionChip ([15edd0d](https://bitbucket.org/enturas/design-system/commits/15edd0da4111c79465f620dd008b7047fbf9cee7))
62
- - **tag chip:** add autogenerated aria-label for tag close/remove button ([9e63b0a](https://bitbucket.org/enturas/design-system/commits/9e63b0af9dfb618caa301aab3c954974aecb9bb0))
63
-
64
- ### BREAKING CHANGES
65
-
66
- - **tag chip:** This change will add aria-label to all tag chip close buttons. If you already use this component,
67
- you should check that the accessible text makes sense and if it doesn't, change the text using the
68
- closeButtonAriaLabel prop
69
-
70
- ## [0.5.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.7...@entur/chip@0.5.8) (2022-06-24)
71
-
72
- **Note:** Version bump only for package @entur/chip
73
-
74
- ## [0.5.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.6...@entur/chip@0.5.7) (2022-06-02)
75
-
76
- **Note:** Version bump only for package @entur/chip
77
-
78
- ## [0.5.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.5...@entur/chip@0.5.6) (2022-05-13)
79
-
80
- **Note:** Version bump only for package @entur/chip
81
-
82
- ## [0.5.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.4...@entur/chip@0.5.5) (2022-05-04)
83
-
84
- **Note:** Version bump only for package @entur/chip
85
-
86
- ## [0.5.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.3...@entur/chip@0.5.4) (2022-04-27)
87
-
88
- **Note:** Version bump only for package @entur/chip
89
-
90
- ## [0.5.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.2...@entur/chip@0.5.3) (2022-04-20)
91
-
92
- **Note:** Version bump only for package @entur/chip
93
-
94
- ## [0.5.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.1...@entur/chip@0.5.2) (2022-04-19)
95
-
96
- **Note:** Version bump only for package @entur/chip
97
-
98
- ## [0.5.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.5.0...@entur/chip@0.5.1) (2022-03-17)
99
-
100
- ### Bug Fixes
101
-
102
- - **ChoiceChip:** add -webkit fallback for Safari ([d19f8c3](https://bitbucket.org/enturas/design-system/commits/d19f8c34b401676283ff5fbc3b10ec0a1f04d3b8))
103
-
104
- # [0.5.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.24...@entur/chip@0.5.0) (2022-03-14)
105
-
106
- ### Features
107
-
108
- - **action chip:** add loading state to action chip ([290e709](https://bitbucket.org/enturas/design-system/commits/290e709baef2c7513fc3b85e834fabb34697842e))
109
-
110
- ## [0.4.24](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.23...@entur/chip@0.4.24) (2022-03-01)
111
-
112
- **Note:** Version bump only for package @entur/chip
113
-
114
- ## [0.4.23](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.22...@entur/chip@0.4.23) (2022-02-09)
115
-
116
- **Note:** Version bump only for package @entur/chip
117
-
118
- ## [0.4.22](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.21...@entur/chip@0.4.22) (2022-01-21)
119
-
120
- **Note:** Version bump only for package @entur/chip
121
-
122
- ## [0.4.21](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.20...@entur/chip@0.4.21) (2022-01-05)
123
-
124
- **Note:** Version bump only for package @entur/chip
125
-
126
- ## [0.4.20](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.19...@entur/chip@0.4.20) (2021-12-10)
127
-
128
- **Note:** Version bump only for package @entur/chip
129
-
130
- ## [0.4.19](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.18...@entur/chip@0.4.19) (2021-11-17)
131
-
132
- **Note:** Version bump only for package @entur/chip
133
-
134
- ## [0.4.18](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.17...@entur/chip@0.4.18) (2021-10-25)
135
-
136
- **Note:** Version bump only for package @entur/chip
137
-
138
- ## [0.4.17](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.16...@entur/chip@0.4.17) (2021-10-18)
139
-
140
- **Note:** Version bump only for package @entur/chip
141
-
142
- ## [0.4.16](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.15...@entur/chip@0.4.16) (2021-09-23)
143
-
144
- **Note:** Version bump only for package @entur/chip
145
-
146
- ## [0.4.15](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.14...@entur/chip@0.4.15) (2021-09-13)
147
-
148
- **Note:** Version bump only for package @entur/chip
149
-
150
- ## [0.4.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.13...@entur/chip@0.4.14) (2021-09-07)
151
-
152
- ### Bug Fixes
153
-
154
- - improve typings ([423e06a](https://bitbucket.org/enturas/design-system/commits/423e06a1048731509fe0d3d6606e3fe390a868e1))
155
- - utilize reworked focus token ([586758f](https://bitbucket.org/enturas/design-system/commits/586758fc86eb5aa52116c63c14ef033eb2e8b12f))
156
-
157
- ## [0.4.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.12...@entur/chip@0.4.13) (2021-08-13)
158
-
159
- **Note:** Version bump only for package @entur/chip
160
-
161
- ## [0.4.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.11...@entur/chip@0.4.12) (2021-07-16)
162
-
163
- **Note:** Version bump only for package @entur/chip
164
-
165
- ## [0.4.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.10...@entur/chip@0.4.11) (2021-06-25)
166
-
167
- ### Bug Fixes
168
-
169
- - update dependencies ([b7f5e2d](https://bitbucket.org/enturas/design-system/commits/b7f5e2dd6ccfd066d61fdda5d1892994ea5b28dd))
170
-
171
- ## [0.4.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.9...@entur/chip@0.4.10) (2021-06-04)
172
-
173
- **Note:** Version bump only for package @entur/chip
174
-
175
- ## [0.4.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.8...@entur/chip@0.4.9) (2021-05-19)
176
-
177
- **Note:** Version bump only for package @entur/chip
178
-
179
- ## [0.4.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.7...@entur/chip@0.4.8) (2021-05-05)
180
-
181
- **Note:** Version bump only for package @entur/chip
182
-
183
- ## [0.4.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.6...@entur/chip@0.4.7) (2021-04-23)
184
-
185
- ### Bug Fixes
186
-
187
- - utilize new focus tokens ([17113ef](https://bitbucket.org/enturas/design-system/commits/17113ef3f791c86fa6e19e71680fd5acdbae4990))
188
-
189
- ## [0.4.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.5...@entur/chip@0.4.6) (2021-04-09)
190
-
191
- **Note:** Version bump only for package @entur/chip
192
-
193
- ## [0.4.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.4...@entur/chip@0.4.5) (2021-03-02)
194
-
195
- **Note:** Version bump only for package @entur/chip
196
-
197
- ## [0.4.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.3...@entur/chip@0.4.4) (2021-02-17)
198
-
199
- **Note:** Version bump only for package @entur/chip
200
-
201
- ## [0.4.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.2...@entur/chip@0.4.3) (2021-02-05)
202
-
203
- **Note:** Version bump only for package @entur/chip
204
-
205
- ## [0.4.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.1...@entur/chip@0.4.2) (2021-01-29)
206
-
207
- **Note:** Version bump only for package @entur/chip
208
-
209
- ## [0.4.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.4.0...@entur/chip@0.4.1) (2021-01-20)
210
-
211
- ### Bug Fixes
212
-
213
- - **choicechipgroup:** add label prop explicitly to typings ([eace8d6](https://bitbucket.org/enturas/design-system/commits/eace8d6cd2a91dc79003b9a54042d007d8cd5a8c))
214
-
215
- # [0.4.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.41...@entur/chip@0.4.0) (2021-01-13)
216
-
217
- ### Features
218
-
219
- - **choicechip:** update value type with support for null ([0311c32](https://bitbucket.org/enturas/design-system/commits/0311c329f9a35a8d150c48e26d53bb902e4b3787))
220
-
221
- ## [0.3.41](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.40...@entur/chip@0.3.41) (2021-01-05)
222
-
223
- ### Bug Fixes
224
-
225
- - **actionchip:** improved typings ([66b3acc](https://bitbucket.org/enturas/design-system/commits/66b3accad09a69a2c9cd0f8cd1221f2b32931489))
226
- - **choicechip:** improve typings ([c839400](https://bitbucket.org/enturas/design-system/commits/c839400ca651020bc685840d7a18a5d382d907b0))
227
-
228
- ## [0.3.40](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.39...@entur/chip@0.3.40) (2020-12-04)
229
-
230
- ### Bug Fixes
231
-
232
- - **actionchip:** improve typings ([3999811](https://bitbucket.org/enturas/design-system/commits/399981153891f5131bd7af1e28bb5fc7f8fdf874))
233
- - **choicechip:** improve typings ([17b93c1](https://bitbucket.org/enturas/design-system/commits/17b93c197b05c277cec1b9bc28b0106b7e244be0))
234
- - **filterchip:** improve typings ([c9ad609](https://bitbucket.org/enturas/design-system/commits/c9ad6099243911b427885382dc0f5c1001cdee1d))
235
- - **tagchip:** improve typings ([33b4310](https://bitbucket.org/enturas/design-system/commits/33b431078ac73cde364a40dd27a44c4497f58d89))
236
-
237
- ## [0.3.39](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.38...@entur/chip@0.3.39) (2020-11-26)
238
-
239
- **Note:** Version bump only for package @entur/chip
240
-
241
- ## [0.3.38](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.37...@entur/chip@0.3.38) (2020-11-10)
242
-
243
- ### Bug Fixes
244
-
245
- - **choice chip:** improve typing of onchange prop ([e790234](https://bitbucket.org/enturas/design-system/commits/e79023473e27c2c21016cb6394070a2ce8cd6f89))
246
-
247
- ## [0.3.37](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.36...@entur/chip@0.3.37) (2020-11-05)
248
-
249
- **Note:** Version bump only for package @entur/chip
250
-
251
- ## [0.3.36](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.35...@entur/chip@0.3.36) (2020-10-28)
252
-
253
- **Note:** Version bump only for package @entur/chip
254
-
255
- ## [0.3.35](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.34...@entur/chip@0.3.35) (2020-10-23)
256
-
257
- **Note:** Version bump only for package @entur/chip
258
-
259
- ## [0.3.34](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.33...@entur/chip@0.3.34) (2020-10-16)
260
-
261
- **Note:** Version bump only for package @entur/chip
262
-
263
- ## [0.3.33](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.32...@entur/chip@0.3.33) (2020-10-09)
264
-
265
- **Note:** Version bump only for package @entur/chip
266
-
267
- ## [0.3.32](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.31...@entur/chip@0.3.32) (2020-10-09)
268
-
269
- **Note:** Version bump only for package @entur/chip
270
-
271
- ## [0.3.31](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.30...@entur/chip@0.3.31) (2020-09-25)
272
-
273
- **Note:** Version bump only for package @entur/chip
274
-
275
- ## [0.3.30](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.29...@entur/chip@0.3.30) (2020-09-14)
276
-
277
- **Note:** Version bump only for package @entur/chip
278
-
279
- ## [0.3.29](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.28...@entur/chip@0.3.29) (2020-09-10)
280
-
281
- **Note:** Version bump only for package @entur/chip
282
-
283
- ## [0.3.28](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.27...@entur/chip@0.3.28) (2020-09-02)
284
-
285
- **Note:** Version bump only for package @entur/chip
286
-
287
- ## [0.3.27](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.26...@entur/chip@0.3.27) (2020-08-26)
288
-
289
- **Note:** Version bump only for package @entur/chip
290
-
291
- ## [0.3.26](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.25...@entur/chip@0.3.26) (2020-08-20)
292
-
293
- **Note:** Version bump only for package @entur/chip
294
-
295
- ## [0.3.25](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.24...@entur/chip@0.3.25) (2020-08-19)
296
-
297
- **Note:** Version bump only for package @entur/chip
298
-
299
- ## [0.3.24](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.23...@entur/chip@0.3.24) (2020-08-14)
300
-
301
- **Note:** Version bump only for package @entur/chip
302
-
303
- ## [0.3.23](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.22...@entur/chip@0.3.23) (2020-08-11)
304
-
305
- ### Bug Fixes
306
-
307
- - adjust disabled choicechip styling ([713a2ab](https://bitbucket.org/enturas/design-system/commits/713a2abfc0285f0d78ee4c990e6bd2ee0c2b5e08))
308
-
309
- ## [0.3.22](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.21...@entur/chip@0.3.22) (2020-07-24)
310
-
311
- **Note:** Version bump only for package @entur/chip
312
-
313
- ## [0.3.21](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.20...@entur/chip@0.3.21) (2020-07-22)
314
-
315
- **Note:** Version bump only for package @entur/chip
316
-
317
- ## [0.3.20](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.19...@entur/chip@0.3.20) (2020-07-16)
318
-
319
- **Note:** Version bump only for package @entur/chip
320
-
321
- ## [0.3.19](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.18...@entur/chip@0.3.19) (2020-07-13)
322
-
323
- **Note:** Version bump only for package @entur/chip
324
-
325
- ## [0.3.18](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.17...@entur/chip@0.3.18) (2020-07-09)
326
-
327
- ### Bug Fixes
328
-
329
- - adjust choice chip background color ([0097236](https://bitbucket.org/enturas/design-system/commits/009723686e9ff61e1fe9a24dee8e2c7a38cecb81))
330
-
331
- ## [0.3.17](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.16...@entur/chip@0.3.17) (2020-07-03)
332
-
333
- **Note:** Version bump only for package @entur/chip
334
-
335
- ## [0.3.16](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.15...@entur/chip@0.3.16) (2020-06-17)
336
-
337
- ### Bug Fixes
338
-
339
- - fix wrong definition of forward referencing ([e5cad92](https://bitbucket.org/enturas/design-system/commits/e5cad92c59bc6453ab4dbe9a18c4c7e42dd7e00d))
340
-
341
- ## [0.3.15](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.14...@entur/chip@0.3.15) (2020-05-27)
342
-
343
- **Note:** Version bump only for package @entur/chip
344
-
345
- ## [0.3.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.13...@entur/chip@0.3.14) (2020-05-26)
346
-
347
- **Note:** Version bump only for package @entur/chip
348
-
349
- ## [0.3.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.12...@entur/chip@0.3.13) (2020-05-20)
350
-
351
- ### Bug Fixes
352
-
353
- - add forward referencing to TagChip ([08d0a57](https://bitbucket.org/enturas/design-system/commits/08d0a579469ce615e2dfbe63d8ddc20e56b490a2))
354
-
355
- ## [0.3.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.11...@entur/chip@0.3.12) (2020-04-27)
356
-
357
- **Note:** Version bump only for package @entur/chip
358
-
359
- ## [0.3.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.10...@entur/chip@0.3.11) (2020-04-23)
360
-
361
- ### Bug Fixes
362
-
363
- - updated to use new focus styling where applicable ([d0a52c0](https://bitbucket.org/enturas/design-system/commits/d0a52c096b673c6647070a90dd79bef9003ee0ad))
364
-
365
- ## [0.3.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.9...@entur/chip@0.3.10) (2020-04-08)
366
-
367
- **Note:** Version bump only for package @entur/chip
368
-
369
- ## [0.3.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.7...@entur/chip@0.3.9) (2020-03-25)
370
-
371
- **Note:** Version bump only for package @entur/chip
372
-
373
- ## [0.3.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.7...@entur/chip@0.3.8) (2020-03-25)
374
-
375
- **Note:** Version bump only for package @entur/chip
376
-
377
- ## [0.3.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.6...@entur/chip@0.3.7) (2020-03-20)
378
-
379
- **Note:** Version bump only for package @entur/chip
380
-
381
- ## [0.3.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.5...@entur/chip@0.3.6) (2020-03-18)
382
-
383
- **Note:** Version bump only for package @entur/chip
384
-
385
- ## [0.3.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.4...@entur/chip@0.3.5) (2020-03-05)
386
-
387
- **Note:** Version bump only for package @entur/chip
388
-
389
- ## [0.3.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.3...@entur/chip@0.3.4) (2020-02-26)
390
-
391
- **Note:** Version bump only for package @entur/chip
392
-
393
- ## [0.3.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.2...@entur/chip@0.3.3) (2020-02-20)
394
-
395
- **Note:** Version bump only for package @entur/chip
396
-
397
- ## [0.3.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.1...@entur/chip@0.3.2) (2020-02-14)
398
-
399
- **Note:** Version bump only for package @entur/chip
400
-
401
- ## [0.3.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.3.0...@entur/chip@0.3.1) (2020-02-12)
402
-
403
- **Note:** Version bump only for package @entur/chip
404
-
405
- # [0.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.14...@entur/chip@0.3.0) (2020-02-10)
406
-
407
- ### Features
408
-
409
- - add new components: tagchip and filterchip ([9363b20](https://bitbucket.org/enturas/design-system/commits/9363b204f04c8d10a2cee3a8076313b0800e027e))
410
-
411
- ## [0.2.14](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.13...@entur/chip@0.2.14) (2020-02-05)
412
-
413
- ### Bug Fixes
414
-
415
- - remove test-files from build process ([e0b24af](https://bitbucket.org/enturas/design-system/commits/e0b24af05d5c2ad8de4ae587d83c389495235890))
416
-
417
- ## [0.2.13](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.12...@entur/chip@0.2.13) (2020-01-31)
418
-
419
- **Note:** Version bump only for package @entur/chip
420
-
421
- ## [0.2.12](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.11...@entur/chip@0.2.12) (2020-01-28)
422
-
423
- **Note:** Version bump only for package @entur/chip
424
-
425
- ## [0.2.11](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.10...@entur/chip@0.2.11) (2020-01-27)
426
-
427
- ### Bug Fixes
428
-
429
- - **types:** place types in the correct place ([acace09](https://bitbucket.org/enturas/design-system/commits/acace09ec0e258c5cff3a65e13ab29d6603780d9))
430
-
431
- ## [0.2.10](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.9...@entur/chip@0.2.10) (2020-01-20)
432
-
433
- **Note:** Version bump only for package @entur/chip
434
-
435
- ## [0.2.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.8...@entur/chip@0.2.9) (2020-01-14)
436
-
437
- **Note:** Version bump only for package @entur/chip
438
-
439
- ## [0.2.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.7...@entur/chip@0.2.8) (2020-01-13)
440
-
441
- **Note:** Version bump only for package @entur/chip
442
-
443
- ## [0.2.7](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.6...@entur/chip@0.2.7) (2020-01-10)
444
-
445
- **Note:** Version bump only for package @entur/chip
446
-
447
- ## [0.2.6](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.5...@entur/chip@0.2.6) (2020-01-08)
448
-
449
- ### Bug Fixes
450
-
451
- - warn in development if the developer have forgotten the CSS ([e5c30fc](https://bitbucket.org/enturas/design-system/commits/e5c30fc08624ef22c02773892778abd92205c6b0))
452
-
453
- ## [0.2.5](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.4...@entur/chip@0.2.5) (2020-01-06)
454
-
455
- **Note:** Version bump only for package @entur/chip
456
-
457
- ## [0.2.4](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.3...@entur/chip@0.2.4) (2019-12-17)
458
-
459
- **Note:** Version bump only for package @entur/chip
460
-
461
- ## [0.2.3](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.2...@entur/chip@0.2.3) (2019-12-10)
462
-
463
- ### Bug Fixes
464
-
465
- - decreasing min-width for chips to 48px ([fe273db](https://bitbucket.org/enturas/design-system/commits/fe273dbd587a31514d852e743da564c2402ef13a))
466
- - fixing label support for choice chips group ([8bebf95](https://bitbucket.org/enturas/design-system/commits/8bebf9503ccb7dadd100fbd177b3da31a9375483))
467
-
468
- ## [0.2.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.1...@entur/chip@0.2.2) (2019-12-10)
469
-
470
- ### Bug Fixes
471
-
472
- - spreading styles on ChoiceChip-components ([4bdfef8](https://bitbucket.org/enturas/design-system/commits/4bdfef86acdc29e3620a9b20792812672b58bfa6))
473
- - **icon position:** consistent spacing for icons in chips ([f8ab91f](https://bitbucket.org/enturas/design-system/commits/f8ab91f255e70f1945d7145e6aef7c5136232bc1))
474
- - adding default prop as part of documentation ([1ef7510](https://bitbucket.org/enturas/design-system/commits/1ef75107362f6262429d7fe31519b4353eccc8de))
475
-
476
- ## [0.2.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.0...@entur/chip@0.2.1) (2019-11-29)
477
-
478
- ### Bug Fixes
479
-
480
- - using new box shadow tokens ([9ff30bd](https://bitbucket.org/enturas/design-system/commits/9ff30bd52ad2b6e6d770565684a05e15f0b0ba9a))
481
-
482
- # [0.2.0](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.1.1...@entur/chip@0.2.0) (2019-11-22)
483
-
484
- ### Features
485
-
486
- - **types:** exporting all public types for public components ([4a277ab](https://bitbucket.org/enturas/design-system/commits/4a277ab266fdb32a6760821a07b1c6cc716bac85))
487
-
488
- ## 0.1.1 (2019-11-18)
489
-
490
- ### Bug Fixes
491
-
492
- - fixing improper styling of chips ([eb48017](https://bitbucket.org/enturas/design-system/commits/eb48017876785665900062461470b35ef05a1e9f))