@bethinkpl/design-system 18.9.3 → 19.0.1

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.
Files changed (74) hide show
  1. package/dist/design-system.umd.js +479 -645
  2. package/dist/design-system.umd.js.map +1 -1
  3. package/dist/lib/js/components/BadgeScore/BadgeScore.consts.d.ts +13 -0
  4. package/dist/lib/js/components/BadgeScore/BadgeScore.spec.d.ts +1 -0
  5. package/dist/lib/js/components/BadgeScore/BadgeScore.stories.d.ts +14 -0
  6. package/dist/lib/js/components/BadgeScore/BadgeScore.vue.d.ts +66 -0
  7. package/dist/lib/js/components/BadgeScore/index.d.ts +3 -0
  8. package/dist/lib/js/components/Banner/Banner.vue.d.ts +1 -0
  9. package/dist/lib/js/components/Buttons/Button/Button.vue.d.ts +1 -0
  10. package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +1 -0
  11. package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +1 -0
  12. package/dist/lib/js/components/Chip/Chip.consts.d.ts +22 -0
  13. package/dist/lib/js/components/Chip/Chip.spec.d.ts +1 -0
  14. package/dist/lib/js/components/Chip/Chip.stories.d.ts +6 -0
  15. package/dist/lib/js/components/Chip/Chip.vue.d.ts +290 -0
  16. package/dist/lib/js/components/Chip/index.d.ts +3 -0
  17. package/dist/lib/js/components/Drawer/DrawerDivider/DrawerDivider.vue.d.ts +3 -20
  18. package/dist/lib/js/components/Drawer/DrawerListItemGroup/DrawerListItemGroup.vue.d.ts +3 -4
  19. package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +3 -231
  20. package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +3 -63
  21. package/dist/lib/js/components/Form/Checkbox/Checkbox.vue.d.ts +1 -0
  22. package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +1 -0
  23. package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +1 -0
  24. package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +1 -0
  25. package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +1 -0
  26. package/dist/lib/js/components/Modal/Modal.vue.d.ts +1 -0
  27. package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +1 -0
  28. package/dist/lib/js/components/Outline/OutlineItem/OutlineItem.vue.d.ts +1 -0
  29. package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +1 -0
  30. package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +1 -0
  31. package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +1 -0
  32. package/dist/lib/js/components/RichList/RichListItem/RichListItem.vue.d.ts +1 -0
  33. package/dist/lib/js/components/SelectionTile/SelectionTile.vue.d.ts +1 -0
  34. package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +1 -0
  35. package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +1 -0
  36. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +1 -0
  37. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +1 -0
  38. package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +1 -0
  39. package/dist/lib/js/components/Tile/Tile.vue.d.ts +1 -0
  40. package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +1 -0
  41. package/dist/lib/js/icons/fontawesome.d.ts +1 -0
  42. package/dist/lib/js/index.d.ts +4 -7
  43. package/docs/945.e016d4dc.iframe.bundle.js +2 -0
  44. package/docs/iframe.html +1 -1
  45. package/docs/main.74394c0a.iframe.bundle.js +1 -0
  46. package/docs/project.json +1 -1
  47. package/lib/js/components/{Badges/BadgeScore → BadgeScore}/BadgeScore.stories.ts +1 -1
  48. package/lib/js/components/{Badges/BadgeScore → BadgeScore}/BadgeScore.vue +4 -4
  49. package/lib/js/components/{Pill/Pill.consts.ts → Chip/Chip.consts.ts} +8 -3
  50. package/lib/js/components/{Pill/Pill.spec.ts → Chip/Chip.spec.ts} +36 -35
  51. package/lib/js/components/Chip/Chip.stories.ts +99 -0
  52. package/lib/js/components/{Pill/Pill.vue → Chip/Chip.vue} +109 -44
  53. package/lib/js/components/Chip/index.ts +4 -0
  54. package/lib/js/components/Chip/logo-badge.svg +1 -0
  55. package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.stories.ts +2 -2
  56. package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue +4 -4
  57. package/lib/js/components/Outline/OutlineItem/OutlineItem.stories.ts +3 -3
  58. package/lib/js/icons/fontawesome.ts +2 -0
  59. package/lib/js/index.ts +4 -7
  60. package/lib/styles/settings/_radiuses.scss +2 -0
  61. package/package.json +1 -1
  62. package/docs/988.4ee26573.iframe.bundle.js +0 -2
  63. package/docs/main.de4dcb7a.iframe.bundle.js +0 -1
  64. package/lib/js/components/Badges/Badge/Badge.consts.ts +0 -4
  65. package/lib/js/components/Badges/Badge/Badge.spec.ts +0 -36
  66. package/lib/js/components/Badges/Badge/Badge.stories.ts +0 -54
  67. package/lib/js/components/Badges/Badge/Badge.vue +0 -114
  68. package/lib/js/components/Badges/Badge/index.ts +0 -4
  69. package/lib/js/components/Pill/Pill.stories.ts +0 -60
  70. package/lib/js/components/Pill/index.ts +0 -4
  71. /package/docs/{988.4ee26573.iframe.bundle.js.LICENSE.txt → 945.e016d4dc.iframe.bundle.js.LICENSE.txt} +0 -0
  72. /package/lib/js/components/{Badges/BadgeScore → BadgeScore}/BadgeScore.consts.ts +0 -0
  73. /package/lib/js/components/{Badges/BadgeScore → BadgeScore}/BadgeScore.spec.ts +0 -0
  74. /package/lib/js/components/{Badges/BadgeScore → BadgeScore}/index.ts +0 -0
package/docs/project.json CHANGED
@@ -1 +1 @@
1
- {"generatedAt":1708002388355,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"vue-cli","packageName":"@vue/cli-service","version":"5.0.8"},"packageManager":{"type":"yarn","version":"1.22.21"},"storybookVersion":"6.5.13","language":"typescript","storybookPackages":{"@storybook/builder-webpack5":{"version":"6.5.13"},"@storybook/manager-webpack5":{"version":"6.5.13"},"@storybook/vue3":{"version":"6.5.13"},"eslint-plugin-storybook":{"version":"0.6.6"}},"framework":{"name":"vue3"},"addons":{"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/addon-docs":{"version":"6.5.15"},"@storybook/addon-controls":{"version":"6.5.15"},"@storybook/addon-storysource":{"version":"6.5.15"},"@storybook/addon-viewport":{"version":"6.5.15"},"storybook-addon-designs":{"version":"6.3.1"}}}
1
+ {"generatedAt":1709738701008,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"metaFramework":{"name":"vue-cli","packageName":"@vue/cli-service","version":"5.0.8"},"packageManager":{"type":"yarn","version":"1.22.21"},"storybookVersion":"6.5.13","language":"typescript","storybookPackages":{"@storybook/builder-webpack5":{"version":"6.5.13"},"@storybook/manager-webpack5":{"version":"6.5.13"},"@storybook/vue3":{"version":"6.5.13"},"eslint-plugin-storybook":{"version":"0.6.6"}},"framework":{"name":"vue3"},"addons":{"@storybook/addon-actions":{"version":"6.5.16"},"@storybook/addon-docs":{"version":"6.5.15"},"@storybook/addon-controls":{"version":"6.5.15"},"@storybook/addon-storysource":{"version":"6.5.15"},"@storybook/addon-viewport":{"version":"6.5.15"},"storybook-addon-designs":{"version":"6.3.1"}}}
@@ -1,6 +1,6 @@
1
1
  import BadgeScore from './BadgeScore.vue';
2
2
  import { BADGE_SCORE_COLORS, BADGE_SCORE_SIZES } from './BadgeScore.consts';
3
- import { ICONS } from '../../Icons/Icon';
3
+ import { ICONS } from '../Icons/Icon';
4
4
 
5
5
  import { Meta, StoryFn } from '@storybook/vue3';
6
6
 
@@ -20,9 +20,9 @@
20
20
  </template>
21
21
 
22
22
  <style scoped lang="scss">
23
- @import '../../../../styles/settings/spacings';
24
- @import '../../../../styles/settings/colors/tokens';
25
- @import '../../../../styles/settings/typography/tokens';
23
+ @import '../../../styles/settings/spacings';
24
+ @import '../../../styles/settings/colors/tokens';
25
+ @import '../../../styles/settings/typography/tokens';
26
26
 
27
27
  $badge-score-min-width: 66px;
28
28
  $badge-score-small-min-width: 56px;
@@ -159,7 +159,7 @@ $badge-score-colors: (
159
159
 
160
160
  <script lang="ts">
161
161
  import { BADGE_SCORE_COLORS, BADGE_SCORE_SIZES } from './BadgeScore.consts';
162
- import WnlIcon, { ICONS, ICON_SIZES } from '../../Icons/Icon';
162
+ import WnlIcon, { ICONS, ICON_SIZES } from '../Icons/Icon';
163
163
  import { toRaw } from 'vue';
164
164
 
165
165
  export default {
@@ -1,9 +1,9 @@
1
- export const PILL_SIZES = {
1
+ export const CHIP_SIZES = {
2
2
  X_SMALL: 'x-small',
3
3
  SMALL: 'small',
4
4
  } as const;
5
5
 
6
- export const PILL_COLORS = {
6
+ export const CHIP_COLORS = {
7
7
  PRIMARY: 'primary',
8
8
  PRIMARY_STRONG: 'primaryStrong',
9
9
  NEUTRAL: 'neutral',
@@ -14,7 +14,12 @@ export const PILL_COLORS = {
14
14
  INFO: 'info',
15
15
  } as const;
16
16
 
17
- export const PILL_STATES = {
17
+ export const CHIP_STATES = {
18
18
  DEFAULT: 'default',
19
19
  DISABLED: 'disabled',
20
20
  } as const;
21
+
22
+ export const CHIP_RADIUSES = {
23
+ CAPSULE: 'capsule',
24
+ ROUNDED: 'rounded',
25
+ } as const;
@@ -1,31 +1,32 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
 
3
- import Pill from './Pill.vue';
3
+ import Chip from './Chip.vue';
4
4
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
5
5
  import { ICONS } from '../Icons/Icon';
6
- import { PILL_COLORS, PILL_SIZES } from './Pill.consts';
6
+ import { CHIP_COLORS, CHIP_SIZES } from './Chip.consts';
7
+ import Icon from '../Icons/Icon';
7
8
 
8
9
  interface createComponentOptions {
9
10
  label?: string;
10
11
  leftIcon?: IconDefinition | null;
11
- hasDelete?: boolean;
12
+ isRemovable?: boolean;
12
13
  size?: string;
13
14
  color?: string;
14
15
  }
15
16
 
16
- describe('Pill', () => {
17
+ describe('Chip', () => {
17
18
  const createComponent = ({
18
19
  label = 'random label',
19
20
  leftIcon = null,
20
- hasDelete = false,
21
- size = PILL_SIZES.SMALL,
22
- color = PILL_COLORS.NEUTRAL,
21
+ isRemovable = false,
22
+ size = CHIP_SIZES.SMALL,
23
+ color = CHIP_COLORS.NEUTRAL,
23
24
  }: createComponentOptions = {}) => {
24
- return shallowMount(Pill, {
25
+ return shallowMount(Chip, {
25
26
  props: {
26
27
  label,
27
28
  leftIcon,
28
- hasDelete,
29
+ isRemovable,
29
30
  size,
30
31
  color,
31
32
  } as any,
@@ -48,56 +49,56 @@ describe('Pill', () => {
48
49
  it("doesn't render leftIcon by default", () => {
49
50
  const component = createComponent({ leftIcon: null });
50
51
 
51
- expect(component.find('.pill__leftIcon').exists()).toBe(false);
52
+ expect(component.find('.chip__leftIcon').exists()).toBe(false);
52
53
  });
53
54
 
54
55
  it('renders leftIcon', () => {
55
56
  const component = createComponent({ leftIcon: Object.freeze(ICONS.FA_TAG) });
56
57
 
57
- expect(component.find('.pill__leftIcon').exists()).toBe(true);
58
- expect(component.findComponent<typeof Pill>('.pill__leftIcon').props().icon).toEqual(
58
+ expect(component.find('.chip__leftIcon').exists()).toBe(true);
59
+ expect(component.find('.chip__leftIcon').findComponent(Icon).props().icon).toEqual(
59
60
  ICONS.FA_TAG,
60
61
  );
61
62
  });
62
63
 
63
64
  it("doesn't render leftIcon by default", () => {
64
- const component = createComponent({ hasDelete: false });
65
+ const component = createComponent({ isRemovable: false });
65
66
 
66
- expect(component.find('.pill__delete').exists()).toBe(false);
67
+ expect(component.find('.chip__remove').exists()).toBe(false);
67
68
  });
68
69
 
69
- it('renders delete', () => {
70
- const component = createComponent({ hasDelete: true });
70
+ it('renders remove', () => {
71
+ const component = createComponent({ isRemovable: true });
71
72
 
72
- const deleteButton = component.findComponent<typeof Pill>('.pill__delete');
73
- expect(deleteButton.exists()).toBe(true);
74
- expect(deleteButton.props().icon).toBe(ICONS.FA_XMARK);
73
+ const removeButton = component.findComponent<typeof Chip>('.chip__remove');
74
+ expect(removeButton.exists()).toBe(true);
75
+ expect(removeButton.props().icon).toBe(ICONS.FA_XMARK);
75
76
 
76
- deleteButton.trigger('click');
77
- expect(component.emitted('delete')?.length).toBe(1);
77
+ removeButton.trigger('click');
78
+ expect(component.emitted('remove')?.length).toBe(1);
78
79
  });
79
80
 
80
81
  it("doesn' contain x-small class by default", () => {
81
- const component = createComponent({ size: PILL_SIZES.SMALL });
82
+ const component = createComponent({ size: CHIP_SIZES.SMALL });
82
83
 
83
84
  expect(component.classes()).not.toContain('-x-small');
84
85
  });
85
86
 
86
87
  it('has size class when x-small', () => {
87
- const component = createComponent({ size: PILL_SIZES.X_SMALL });
88
+ const component = createComponent({ size: CHIP_SIZES.X_SMALL });
88
89
 
89
90
  expect(component.classes()).toContain('-x-small');
90
91
  });
91
92
 
92
93
  test.each([
93
- [PILL_COLORS.PRIMARY, '-color-primary'],
94
- [PILL_COLORS.PRIMARY_STRONG, '-color-primaryStrong'],
95
- [PILL_COLORS.NEUTRAL, '-color-neutral'],
96
- [PILL_COLORS.FAIL, '-color-fail'],
97
- [PILL_COLORS.SUCCESS, '-color-success'],
98
- [PILL_COLORS.INFO, '-color-info'],
99
- [PILL_COLORS.WARNING, '-color-warning'],
100
- [PILL_COLORS.INVERTED, '-color-inverted'],
94
+ [CHIP_COLORS.PRIMARY, '-color-primary'],
95
+ [CHIP_COLORS.PRIMARY_STRONG, '-color-primaryStrong'],
96
+ [CHIP_COLORS.NEUTRAL, '-color-neutral'],
97
+ [CHIP_COLORS.FAIL, '-color-fail'],
98
+ [CHIP_COLORS.SUCCESS, '-color-success'],
99
+ [CHIP_COLORS.INFO, '-color-info'],
100
+ [CHIP_COLORS.WARNING, '-color-warning'],
101
+ [CHIP_COLORS.INVERTED, '-color-inverted'],
101
102
  ])(
102
103
  'correct class for color: %s prop, expectedClass: %s',
103
104
  (color: string, expectedClass: string) => {
@@ -124,10 +125,10 @@ describe('Pill', () => {
124
125
  },
125
126
  );
126
127
 
127
- it("doesn't render delete when size x-small", () => {
128
- const component = createComponent({ hasDelete: true, size: PILL_SIZES.X_SMALL });
128
+ it("doesn't render remove when size x-small", () => {
129
+ const component = createComponent({ isRemovable: true, size: CHIP_SIZES.X_SMALL });
129
130
 
130
- const deleteButton = component.find('.pill__delete');
131
- expect(deleteButton.exists()).toBe(false);
131
+ const removeButton = component.find('.chip__remove');
132
+ expect(removeButton.exists()).toBe(false);
132
133
  });
133
134
  });
@@ -0,0 +1,99 @@
1
+ import Chip from './Chip.vue';
2
+ import { CHIP_COLORS, CHIP_RADIUSES, CHIP_SIZES, CHIP_STATES } from './Chip.consts';
3
+ import { ICONS } from '../Icons/Icon';
4
+ import LogoBadge from './logo-badge.svg';
5
+ import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
6
+
7
+ export default {
8
+ title: 'Components/Chip',
9
+ component: Chip,
10
+ } as Meta<typeof Chip>;
11
+
12
+ const StoryTemplate: StoryFn<typeof Chip> = (args) => ({
13
+ components: { Chip, LogoBadge },
14
+ setup() {
15
+ return { ...args };
16
+ },
17
+ template:
18
+ '<chip :label="label" :is-label-uppercase="isLabelUppercase" :left-icon="ICONS[leftIcon]" :is-removable="isRemovable" :size="size" :color="color" :color-hex="colorHex" :state="state" :radius="radius" />',
19
+ data() {
20
+ return {
21
+ ICONS: Object.freeze(ICONS),
22
+ };
23
+ },
24
+ });
25
+ const StoryTemplateWithAccessory: StoryFn<typeof Chip> = (args) => ({
26
+ components: { Chip, LogoBadge },
27
+ setup() {
28
+ return { ...args };
29
+ },
30
+ template:
31
+ '<chip :label="label" :is-label-uppercase="isLabelUppercase" :left-icon="ICONS[leftIcon]" :is-removable="isRemovable" :size="size" :color="color" :color-hex="colorHex" :state="state" :radius="radius">' +
32
+ '<template #accessory><logo-badge :style="svgStyle" /></template>' +
33
+ '</chip>',
34
+ data() {
35
+ return {
36
+ ICONS: Object.freeze(ICONS),
37
+ };
38
+ },
39
+ computed: {
40
+ svgStyle() {
41
+ if (this.size === CHIP_SIZES.SMALL) {
42
+ return { width: '12px', height: '12px' };
43
+ }
44
+
45
+ return { width: '8px', height: '8px' };
46
+ },
47
+ },
48
+ });
49
+
50
+ export const Interactive = StoryTemplate.bind({});
51
+ export const InteractiveWithAccessory = StoryTemplateWithAccessory.bind({});
52
+ const args = {
53
+ label: 'Chip z labelem',
54
+ isLabelUppercase: false,
55
+ leftIcon: null,
56
+ radius: CHIP_RADIUSES.CAPSULE,
57
+ size: CHIP_SIZES.SMALL,
58
+ color: CHIP_COLORS.NEUTRAL,
59
+ colorHex: '',
60
+ isRemovable: false,
61
+ } as Args;
62
+ const argTypes = {
63
+ leftIcon: {
64
+ control: { type: 'select', options: [null, ...Object.keys(ICONS)] },
65
+ },
66
+ size: {
67
+ control: { type: 'select', options: Object.values(CHIP_SIZES) },
68
+ },
69
+ color: {
70
+ control: { type: 'select', options: Object.values(CHIP_COLORS) },
71
+ },
72
+ state: {
73
+ control: { type: 'select', options: Object.values(CHIP_STATES) },
74
+ defaultValue: CHIP_STATES.DEFAULT,
75
+ },
76
+ radius: {
77
+ control: { type: 'select', options: Object.values(CHIP_RADIUSES) },
78
+ defaultValue: CHIP_RADIUSES.CAPSULE,
79
+ },
80
+ } as ArgTypes;
81
+
82
+ Interactive.argTypes = argTypes;
83
+ Interactive.args = args;
84
+
85
+ Interactive.parameters = {
86
+ design: {
87
+ type: 'figma',
88
+ url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS---Components?node-id=3690%3A69072',
89
+ },
90
+ };
91
+ InteractiveWithAccessory.argTypes = argTypes;
92
+ InteractiveWithAccessory.args = args;
93
+
94
+ InteractiveWithAccessory.parameters = {
95
+ design: {
96
+ type: 'figma',
97
+ url: 'https://www.figma.com/file/izQdYyiBR1GQgFkaOIfIJI/LMS---DS---Components?node-id=3690%3A69072',
98
+ },
99
+ };
@@ -1,26 +1,31 @@
1
1
  <template>
2
2
  <div
3
- class="pill"
3
+ class="chip"
4
4
  :class="{
5
- '-x-small': size === PILL_SIZES.X_SMALL,
5
+ '-x-small': size === CHIP_SIZES.X_SMALL,
6
6
  [colorClassName]: true,
7
- '-disabled': state === PILL_STATES.DISABLED,
7
+ '-disabled': state === CHIP_STATES.DISABLED,
8
+ '-uppercase': isLabelUppercase,
9
+ '-rounded': radius === CHIP_RADIUSES.ROUNDED,
8
10
  }"
9
11
  :title="label"
12
+ :style="{ backgroundColor: colorHex }"
10
13
  >
11
- <icon
12
- v-if="leftIcon"
13
- class="pill__leftIcon"
14
- :icon="leftIcon"
15
- :size="size === PILL_SIZES.X_SMALL ? ICON_SIZES.XXX_SMALL : ICON_SIZES.XX_SMALL"
16
- />
17
- <span class="pill__label">{{ label }}</span>
14
+ <span v-if="$slots.accessory || leftIcon" class="chip__leftIcon">
15
+ <slot name="accessory">
16
+ <icon
17
+ :icon="leftIcon"
18
+ :size="size === CHIP_SIZES.X_SMALL ? ICON_SIZES.XXX_SMALL : ICON_SIZES.XX_SMALL"
19
+ />
20
+ </slot>
21
+ </span>
22
+ <span class="chip__label">{{ label }}</span>
18
23
  <icon-button
19
- v-if="size !== PILL_SIZES.X_SMALL && hasDelete"
20
- class="pill__delete"
24
+ v-if="size !== CHIP_SIZES.X_SMALL && isRemovable"
25
+ class="chip__remove"
21
26
  :touchable="false"
22
27
  :state="
23
- state === PILL_STATES.DISABLED
28
+ state === CHIP_STATES.DISABLED
24
29
  ? ICON_BUTTON_STATES.DISABLED
25
30
  : ICON_BUTTON_STATES.DEFAULT
26
31
  "
@@ -28,18 +33,19 @@
28
33
  :size="ICON_BUTTON_SIZES.XX_SMALL"
29
34
  :icon="ICONS.FA_XMARK"
30
35
  :elevation="BUTTON_ELEVATIONS.X_SMALL"
31
- @click="$emit('delete')"
36
+ @click="$emit('remove')"
32
37
  />
33
38
  </div>
34
39
  </template>
35
40
 
36
41
  <style lang="scss" scoped>
37
42
  @import '../../../styles/settings/spacings';
43
+ @import '../../../styles/settings/radiuses';
38
44
  @import '../../../styles/settings/colors/tokens';
39
45
  @import '../../../styles/settings/typography/tokens';
40
46
 
41
- $pill-min-height: 16px;
42
- $pill-colors: (
47
+ $chip-min-height: 16px;
48
+ $chip-colors: (
43
49
  'neutral': (
44
50
  'label': $color-neutral-text-strong,
45
51
  'icon': $color-neutral-icon,
@@ -120,17 +126,26 @@ $pill-colors: (
120
126
  'background': $color-default-background,
121
127
  ),
122
128
  ),
129
+ 'invertedHex': (
130
+ 'label': $color-inverted-text,
131
+ 'icon': $color-inverted-icon,
132
+ 'disabled': (
133
+ 'label': $color-inverted-text-disabled,
134
+ 'icon': $color-inverted-icon-disabled,
135
+ ),
136
+ ),
123
137
  );
124
138
 
125
- .pill {
139
+ .chip {
126
140
  $self: &;
127
141
 
128
- @each $color-name, $color-map in $pill-colors {
142
+ @each $color-name, $color-map in $chip-colors {
129
143
  &.-color-#{$color-name} {
130
144
  background-color: map-get($color-map, 'background');
131
145
 
132
146
  #{$self}__leftIcon {
133
147
  color: map-get($color-map, 'icon');
148
+ fill: map-get($color-map, 'icon');
134
149
  }
135
150
 
136
151
  #{$self}__label {
@@ -142,6 +157,7 @@ $pill-colors: (
142
157
 
143
158
  #{$self}__leftIcon {
144
159
  color: map-get(map-get($color-map, 'disabled'), 'icon');
160
+ fill: map-get($color-map, 'icon');
145
161
  }
146
162
 
147
163
  #{$self}__label {
@@ -152,7 +168,7 @@ $pill-colors: (
152
168
  }
153
169
 
154
170
  align-items: center;
155
- border-radius: 100px;
171
+ border-radius: $radius-xl;
156
172
  display: inline-flex;
157
173
  padding: $space-xxxxxs $space-xxxxxs $space-xxxxxs $space-xxs;
158
174
 
@@ -160,6 +176,16 @@ $pill-colors: (
160
176
  pointer-events: none;
161
177
  }
162
178
 
179
+ &.-rounded {
180
+ border-radius: $radius-s;
181
+ }
182
+
183
+ &.-uppercase {
184
+ #{$self}__label {
185
+ @include label-s-default-bold-uppercase;
186
+ }
187
+ }
188
+
163
189
  &__label {
164
190
  @include label-s-default-bold;
165
191
 
@@ -170,11 +196,12 @@ $pill-colors: (
170
196
  }
171
197
 
172
198
  &__leftIcon {
199
+ display: flex;
173
200
  margin-right: $space-xxxxs;
174
201
  }
175
202
 
176
203
  &.-x-small {
177
- min-height: $pill-min-height;
204
+ min-height: $chip-min-height;
178
205
  padding-left: $space-xxxs;
179
206
 
180
207
  #{$self}__leftIcon {
@@ -186,12 +213,22 @@ $pill-colors: (
186
213
 
187
214
  margin: 0 $space-xxxxs 0 0;
188
215
  }
216
+
217
+ &.-uppercase {
218
+ #{$self}__label {
219
+ @include label-xs-default-bold-uppercase;
220
+ }
221
+ }
222
+
223
+ &.-rounded {
224
+ border-radius: $radius-xs;
225
+ }
189
226
  }
190
227
  }
191
228
  </style>
192
229
 
193
230
  <script lang="ts">
194
- import { PILL_COLORS, PILL_SIZES, PILL_STATES } from './Pill.consts';
231
+ import { CHIP_COLORS, CHIP_RADIUSES, CHIP_SIZES, CHIP_STATES } from './Chip.consts';
195
232
  import IconButton, {
196
233
  ICON_BUTTON_COLORS,
197
234
  ICON_BUTTON_SIZES,
@@ -202,25 +239,29 @@ import { BUTTON_ELEVATIONS } from '../Buttons/Button';
202
239
  import { Value } from '../../utils/type.utils';
203
240
  import { toRaw } from 'vue';
204
241
 
205
- const PILL_ICON_BUTTONS_COLOR_MAP = {
206
- [PILL_COLORS.INVERTED]: ICON_BUTTON_COLORS.PRIMARY,
207
- [PILL_COLORS.NEUTRAL]: ICON_BUTTON_COLORS.NEUTRAL,
208
- [PILL_COLORS.PRIMARY]: ICON_BUTTON_COLORS.PRIMARY,
209
- [PILL_COLORS.PRIMARY_STRONG]: ICON_BUTTON_COLORS.PRIMARY,
210
- [PILL_COLORS.FAIL]: ICON_BUTTON_COLORS.FAIL,
211
- [PILL_COLORS.WARNING]: ICON_BUTTON_COLORS.WARNING,
212
- [PILL_COLORS.SUCCESS]: ICON_BUTTON_COLORS.SUCCESS,
213
- [PILL_COLORS.INFO]: ICON_BUTTON_COLORS.INFO,
242
+ const CHIP_ICON_BUTTONS_COLOR_MAP = {
243
+ [CHIP_COLORS.INVERTED]: ICON_BUTTON_COLORS.PRIMARY,
244
+ [CHIP_COLORS.NEUTRAL]: ICON_BUTTON_COLORS.NEUTRAL,
245
+ [CHIP_COLORS.PRIMARY]: ICON_BUTTON_COLORS.PRIMARY,
246
+ [CHIP_COLORS.PRIMARY_STRONG]: ICON_BUTTON_COLORS.PRIMARY,
247
+ [CHIP_COLORS.FAIL]: ICON_BUTTON_COLORS.FAIL,
248
+ [CHIP_COLORS.WARNING]: ICON_BUTTON_COLORS.WARNING,
249
+ [CHIP_COLORS.SUCCESS]: ICON_BUTTON_COLORS.SUCCESS,
250
+ [CHIP_COLORS.INFO]: ICON_BUTTON_COLORS.INFO,
214
251
  };
215
252
 
216
253
  export default {
217
- name: 'Pill',
254
+ name: 'Chip',
218
255
  components: { Icon, IconButton },
219
256
  props: {
220
257
  label: {
221
258
  type: String,
222
259
  required: true,
223
260
  },
261
+ isLabelUppercase: {
262
+ type: Boolean,
263
+ default: false,
264
+ },
224
265
  leftIcon: {
225
266
  type: Object,
226
267
  default: null,
@@ -228,33 +269,44 @@ export default {
228
269
  return Object.values(ICONS).includes(toRaw(icon));
229
270
  },
230
271
  },
272
+ radius: {
273
+ type: String,
274
+ default: CHIP_RADIUSES.CAPSULE,
275
+ validator(value: Value<typeof CHIP_RADIUSES>) {
276
+ return Object.values(CHIP_RADIUSES).includes(value);
277
+ },
278
+ },
231
279
  size: {
232
280
  type: String,
233
- default: PILL_SIZES.SMALL,
281
+ default: CHIP_SIZES.SMALL,
234
282
  validator(size) {
235
- return Object.values(PILL_SIZES).includes(size);
283
+ return Object.values(CHIP_SIZES).includes(size);
236
284
  },
237
285
  },
238
286
  color: {
239
287
  type: String,
240
- default: PILL_COLORS.NEUTRAL,
288
+ default: CHIP_COLORS.NEUTRAL,
241
289
  validator(color) {
242
- return Object.values(PILL_COLORS).includes(color);
290
+ return Object.values(CHIP_COLORS).includes(color);
243
291
  },
244
292
  },
293
+ colorHex: {
294
+ type: String,
295
+ default: null,
296
+ },
245
297
  state: {
246
298
  type: String,
247
- default: PILL_STATES.DEFAULT,
248
- validator(value: Value<typeof PILL_STATES>) {
249
- return Object.values(PILL_STATES).includes(value);
299
+ default: CHIP_STATES.DEFAULT,
300
+ validator(value: Value<typeof CHIP_STATES>) {
301
+ return Object.values(CHIP_STATES).includes(value);
250
302
  },
251
303
  },
252
- hasDelete: {
304
+ isRemovable: {
253
305
  type: Boolean,
254
306
  default: false,
255
307
  },
256
308
  },
257
- emits: ['delete'],
309
+ emits: ['remove'],
258
310
  data() {
259
311
  return {
260
312
  ICONS: Object.freeze(ICONS),
@@ -262,17 +314,30 @@ export default {
262
314
  ICON_BUTTON_STATES: Object.freeze(ICON_BUTTON_STATES),
263
315
  ICON_BUTTON_SIZES: Object.freeze(ICON_BUTTON_SIZES),
264
316
  ICON_SIZES: Object.freeze(ICON_SIZES),
265
- PILL_SIZES: Object.freeze(PILL_SIZES),
266
- PILL_STATES: Object.freeze(PILL_STATES),
317
+ CHIP_SIZES: Object.freeze(CHIP_SIZES),
318
+ CHIP_STATES: Object.freeze(CHIP_STATES),
319
+ CHIP_RADIUSES: Object.freeze(CHIP_RADIUSES),
267
320
  };
268
321
  },
269
322
  computed: {
270
323
  colorClassName(): string {
324
+ if (this.colorHex) {
325
+ return `-color-invertedHex`;
326
+ }
271
327
  return `-color-${this.color}`;
272
328
  },
273
-
329
+ customStyle() {
330
+ const styles: { backgroundColor?: string } = {};
331
+ if (this.colorHex) {
332
+ styles.backgroundColor = this.colorHex;
333
+ }
334
+ return styles;
335
+ },
274
336
  iconButtonColor(): string {
275
- return PILL_ICON_BUTTONS_COLOR_MAP[this.color] || ICON_BUTTON_COLORS.PRIMARY;
337
+ if (this.colorHex) {
338
+ return ICON_BUTTON_COLORS.NEUTRAL;
339
+ }
340
+ return CHIP_ICON_BUTTONS_COLOR_MAP[this.color] || ICON_BUTTON_COLORS.PRIMARY;
276
341
  },
277
342
  },
278
343
  };
@@ -0,0 +1,4 @@
1
+ import Chip from './Chip.vue';
2
+
3
+ export default Chip;
4
+ export * from './Chip.consts';
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 23" ><path fill-rule="evenodd" d="M13.47 3.952 3.951 13.47a3.702 3.702 0 0 0 5.235 5.234l9.517-9.517a3.701 3.701 0 1 0-5.235-5.235zM2.207 20.449a6.17 6.17 0 0 0 8.724 0l9.518-9.518a6.17 6.17 0 1 0-8.724-8.724l-9.518 9.518a6.17 6.17 0 0 0 0 8.724z" clip-rule="evenodd"/><path d="M2.207 20.45a6.17 6.17 0 0 0 8.724 0l5.405-5.406L7.612 6.32l-5.405 5.405a6.17 6.17 0 0 0 0 8.724z"/></svg>
@@ -28,7 +28,7 @@ const StoryTemplate: StoryFn<typeof DrawerHeader> = (args) => ({
28
28
  :is-interactive-eyebrow="isInteractiveEyebrow"
29
29
  :is-second-level="isSecondLevel"
30
30
  :left-icon="ICONS[leftIcon]"
31
- :pill-label="pillLabel"
31
+ :chip-label="chipLabel"
32
32
  :title-color="titleColor"
33
33
  :title-ellipsis="titleEllipsis"
34
34
  :title="title"
@@ -42,7 +42,7 @@ const args = {} as Args;
42
42
  const argTypes = {
43
43
  title: { control: { type: 'text' }, defaultValue: 'Header Title' },
44
44
  eyebrowText: { control: { type: 'text' }, defaultValue: 'eyebrow' },
45
- pillLabel: { control: { type: 'text' }, defaultValue: 'pill' },
45
+ chipLabel: { control: { type: 'text' }, defaultValue: 'chip' },
46
46
  hasDivider: { control: { type: 'boolean' }, defaultValue: false },
47
47
  isClosable: { control: { type: 'boolean' }, defaultValue: true },
48
48
  isSecondLevel: { control: { type: 'boolean' }, defaultValue: false },
@@ -35,7 +35,7 @@
35
35
  :title="titleEllipsis ? title : undefined"
36
36
  >{{ title }}</span
37
37
  >
38
- <pill v-if="pillLabel" :label="pillLabel" />
38
+ <chip v-if="chipLabel" :label="chipLabel" />
39
39
  </div>
40
40
  </div>
41
41
  <icon-button
@@ -141,7 +141,7 @@ import { PropType } from 'vue';
141
141
  import Button from '../../Buttons/Button/Button.vue';
142
142
  import Divider from '../../Divider/Divider.vue';
143
143
  import IconButton from '../../Buttons/IconButton/IconButton.vue';
144
- import Pill from '../../Pill/Pill.vue';
144
+ import Chip from '../../Chip/Chip.vue';
145
145
  import Icon from '../../Icons/Icon/Icon.vue';
146
146
  import { BUTTON_TYPES } from '../../Buttons/Button';
147
147
  import { ICON_SIZES, ICONS } from '../../Icons/Icon';
@@ -156,7 +156,7 @@ export default {
156
156
  Divider,
157
157
  Icon,
158
158
  IconButton,
159
- Pill,
159
+ Chip,
160
160
  },
161
161
  props: {
162
162
  title: {
@@ -167,7 +167,7 @@ export default {
167
167
  type: String,
168
168
  default: null,
169
169
  },
170
- pillLabel: {
170
+ chipLabel: {
171
171
  type: String,
172
172
  default: null,
173
173
  },