@bethinkpl/design-system 35.2.3 → 36.0.0

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.
@@ -1,7 +1,19 @@
1
1
  import { Value } from '../../utils/type.utils';
2
2
 
3
3
  export declare const WELL_PADDINGS: {
4
- SMALL: string;
5
- MEDIUM: string;
4
+ readonly SMALL: "small";
5
+ readonly MEDIUM: "medium";
6
6
  };
7
7
  export type WellPadding = Value<typeof WELL_PADDINGS>;
8
+ export declare const WELL_COLORS: {
9
+ readonly ACCENT: "accent";
10
+ readonly PRIMARY: "primary";
11
+ readonly FAIL: "fail";
12
+ readonly INFO: "info";
13
+ readonly INVERTED: "inverted";
14
+ readonly NEUTRAL: "neutral";
15
+ readonly SUCCESS: "success";
16
+ readonly WARNING: "warning";
17
+ };
18
+ export type WellColor = Value<typeof WELL_COLORS>;
19
+ export declare const WELL_DEFAULT_COLOR: "neutral";
@@ -1,30 +1,15 @@
1
- import { WellPadding } from './Well.consts';
2
- import { ChipRadius, ChipColor } from '../Chip';
3
- import { IconItem } from '../Icons/Icon';
1
+ import { WellPadding, WellColor } from './Well.consts';
4
2
 
5
3
  declare function __VLS_template(): {
6
4
  accessory?(_: {}): any;
7
- chipAccessory?(_: {}): any;
8
5
  default?(_: {}): any;
9
6
  };
10
7
  declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
- padding?: WellPadding;
12
- hasChip?: boolean;
13
- chipLabel?: string;
14
- chipLabelUppercase?: boolean;
15
- chipLeftIcon?: IconItem;
16
- chipRadius?: ChipRadius;
17
- chipColor?: ChipColor;
18
- chipColorHex?: string;
8
+ padding?: WellPadding | null;
9
+ color?: WellColor;
19
10
  }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
20
- padding?: WellPadding;
21
- hasChip?: boolean;
22
- chipLabel?: string;
23
- chipLabelUppercase?: boolean;
24
- chipLeftIcon?: IconItem;
25
- chipRadius?: ChipRadius;
26
- chipColor?: ChipColor;
27
- chipColorHex?: string;
11
+ padding?: WellPadding | null;
12
+ color?: WellColor;
28
13
  }>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
29
14
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
30
15
  export default _default;
@@ -3,6 +3,21 @@ import { Value } from '../../utils/type.utils';
3
3
  export const WELL_PADDINGS = {
4
4
  SMALL: 'small',
5
5
  MEDIUM: 'medium',
6
- };
6
+ } as const;
7
7
 
8
8
  export type WellPadding = Value<typeof WELL_PADDINGS>;
9
+
10
+ export const WELL_COLORS = {
11
+ ACCENT: 'accent',
12
+ PRIMARY: 'primary',
13
+ FAIL: 'fail',
14
+ INFO: 'info',
15
+ INVERTED: 'inverted',
16
+ NEUTRAL: 'neutral',
17
+ SUCCESS: 'success',
18
+ WARNING: 'warning',
19
+ } as const;
20
+
21
+ export type WellColor = Value<typeof WELL_COLORS>;
22
+
23
+ export const WELL_DEFAULT_COLOR = WELL_COLORS.NEUTRAL;
@@ -2,47 +2,31 @@
2
2
 
3
3
  import { Args, ArgTypes, Meta, StoryObj } from '@storybook/vue3';
4
4
  import Well from './Well.vue';
5
- import { WELL_PADDINGS } from './Well.consts';
5
+ import { WELL_COLORS, WELL_PADDINGS } from './Well.consts';
6
6
  import type { ComponentProps } from 'vue-component-type-helpers';
7
- import { ICONS } from '../Icons/Icon';
8
- import Chip, { CHIP_COLORS, CHIP_DEFAULT_COLOR, CHIP_RADIUSES } from '../Chip';
9
- import DsBanner, { BANNER_COLORS } from '../Banner';
7
+ import Chip, { CHIP_RADIUSES } from '../Chip';
10
8
 
11
9
  type WellProps = ComponentProps<typeof Well>;
12
10
 
13
- function wrapWithContainer(template: string): string {
14
- // line-height: 0; is to remove extra space below the badge (as it's an inline element)
15
- return `<div style="display: inline-flex; flex-direction: column; width: 100%; gap: 20px;">${template}
16
- <ds-banner :color="BANNER_COLORS.WARNING" title="Taka kombinacja jest niezgodna z design systemem!" v-if="invalidUsage" /></div>
17
- `;
18
- }
19
-
20
11
  const meta: Meta<WellProps> = {
21
12
  title: 'Components/Well',
22
13
  component: Well,
23
14
  render: (args) => ({
24
- components: { Well, DsBanner },
15
+ components: { Well },
25
16
  setup() {
26
- return {
27
- args,
28
- ICONS,
29
- BANNER_COLORS,
30
- };
31
- },
32
- template: wrapWithContainer(
33
- '<well v-bind="args" :chip-left-icon="ICONS[args.chipLeftIcon]"><div v-html="args.content" /></well>',
34
- ),
35
- computed: {
36
- invalidUsage() {
37
- return args.hasChip && !args.padding;
38
- },
17
+ return { args };
39
18
  },
19
+ template: '<well v-bind="args"><div v-html="args.content" /></well>',
40
20
  }),
41
21
  argTypes: {
42
22
  padding: {
43
23
  control: 'select',
44
24
  options: [null, ...Object.values(WELL_PADDINGS)],
45
25
  },
26
+ color: {
27
+ control: 'select',
28
+ options: Object.values(WELL_COLORS),
29
+ },
46
30
  content: {
47
31
  control: 'text',
48
32
  },
@@ -64,33 +48,9 @@ export const Interactive: Story = {
64
48
  content:
65
49
  '<h3 style="margin-top: 0">Content</h3>' +
66
50
  'Voluptatem saepe suscipit optio et delectus esse sed velit. Autem maxime soluta aliquam perspiciatis quidem dolor saepe rerum.',
67
- hasChip: false,
68
- chipLabel: 'Chip z labelem',
69
- chipLabelUppercase: false,
70
- chipLeftIcon: null,
71
- chipRadius: CHIP_RADIUSES.ROUNDED,
72
- color: CHIP_DEFAULT_COLOR,
73
- colorHex: '',
74
51
  } as Args,
75
52
  };
76
53
 
77
- const argTypes = {
78
- chipLeftIcon: {
79
- control: 'select',
80
- options: [null, ...Object.keys(ICONS)],
81
- },
82
- chipColor: {
83
- control: 'select',
84
- options: Object.values(CHIP_COLORS),
85
- },
86
- chipRadius: {
87
- control: 'select',
88
- options: Object.values(CHIP_RADIUSES),
89
- },
90
- } as ArgTypes;
91
-
92
- Interactive.argTypes = argTypes;
93
-
94
54
  export const WithMultipleChips: Story = {
95
55
  render: (args) => {
96
56
  return {
@@ -127,5 +87,3 @@ export const WithMultipleChips: Story = {
127
87
  padding: WELL_PADDINGS.SMALL,
128
88
  },
129
89
  };
130
-
131
- WithMultipleChips.argTypes = argTypes;
@@ -1,26 +1,16 @@
1
1
  <template>
2
2
  <div
3
3
  class="ds-well"
4
- :class="{
5
- '-ds-medium': WELL_PADDINGS.MEDIUM === padding,
6
- '-ds-small': WELL_PADDINGS.SMALL === padding,
7
- }"
4
+ :class="[
5
+ colorClass,
6
+ {
7
+ '-ds-medium': WELL_PADDINGS.MEDIUM === padding,
8
+ '-ds-small': WELL_PADDINGS.SMALL === padding,
9
+ },
10
+ ]"
8
11
  >
9
- <div v-if="hasChip || $slots.accessory" class="ds-well__accessorySlot">
10
- <slot name="accessory">
11
- <chip
12
- :label="chipLabel"
13
- :is-label-uppercase="chipLabelUppercase"
14
- :left-icon="chipLeftIcon"
15
- :radius="chipRadius"
16
- :color="chipColor"
17
- :color-hex="chipColorHex"
18
- >
19
- <template v-if="$slots.chipAccessory" #accessory>
20
- <slot name="chipAccessory" />
21
- </template>
22
- </chip>
23
- </slot>
12
+ <div v-if="$slots.accessory" class="ds-well__accessorySlot">
13
+ <slot name="accessory" />
24
14
  </div>
25
15
 
26
16
  <slot />
@@ -35,10 +25,34 @@
35
25
  .ds-well {
36
26
  $root: &;
37
27
 
38
- background-color: $color-neutral-background;
39
28
  border-radius: $radius-m;
40
29
  position: relative;
41
30
 
31
+ &.-ds-accent {
32
+ background-color: $color-accent-background;
33
+ }
34
+ &.-ds-primary {
35
+ background-color: $color-primary-background;
36
+ }
37
+ &.-ds-fail {
38
+ background-color: $color-fail-background;
39
+ }
40
+ &.-ds-info {
41
+ background-color: $color-info-background;
42
+ }
43
+ &.-ds-inverted {
44
+ background-color: $color-default-background;
45
+ }
46
+ &.-ds-neutral {
47
+ background-color: $color-neutral-background;
48
+ }
49
+ &.-ds-success {
50
+ background-color: $color-success-background;
51
+ }
52
+ &.-ds-warning {
53
+ background-color: $color-warning-background;
54
+ }
55
+
42
56
  &__accessorySlot {
43
57
  display: flex;
44
58
  gap: $space-4xs;
@@ -66,27 +80,31 @@
66
80
  </style>
67
81
 
68
82
  <script lang="ts" setup>
69
- import { WELL_PADDINGS, WellPadding } from './Well.consts';
70
- import Chip, { CHIP_DEFAULT_COLOR, CHIP_RADIUSES, ChipRadius, ChipColor } from '../Chip';
71
- import { IconItem } from '../Icons/Icon';
83
+ import { computed } from 'vue';
84
+ import {
85
+ WELL_PADDINGS,
86
+ WELL_COLORS,
87
+ WELL_DEFAULT_COLOR,
88
+ WellPadding,
89
+ WellColor,
90
+ } from './Well.consts';
72
91
 
73
- const {
74
- padding = null,
75
- hasChip = false,
76
- chipLabel,
77
- chipLabelUppercase = false,
78
- chipLeftIcon = null,
79
- chipRadius = CHIP_RADIUSES.ROUNDED,
80
- chipColor = CHIP_DEFAULT_COLOR,
81
- chipColorHex,
82
- } = defineProps<{
83
- padding?: WellPadding;
84
- hasChip?: boolean;
85
- chipLabel?: string;
86
- chipLabelUppercase?: boolean;
87
- chipLeftIcon?: IconItem;
88
- chipRadius?: ChipRadius;
89
- chipColor?: ChipColor;
90
- chipColorHex?: string;
92
+ const { padding = null, color = WELL_DEFAULT_COLOR } = defineProps<{
93
+ padding?: WellPadding | null;
94
+ color?: WellColor;
91
95
  }>();
96
+
97
+ const colorClass = computed(() => {
98
+ const colorMap: Record<WellColor, string> = {
99
+ [WELL_COLORS.ACCENT]: '-ds-accent',
100
+ [WELL_COLORS.PRIMARY]: '-ds-primary',
101
+ [WELL_COLORS.FAIL]: '-ds-fail',
102
+ [WELL_COLORS.INFO]: '-ds-info',
103
+ [WELL_COLORS.INVERTED]: '-ds-inverted',
104
+ [WELL_COLORS.NEUTRAL]: '-ds-neutral',
105
+ [WELL_COLORS.SUCCESS]: '-ds-success',
106
+ [WELL_COLORS.WARNING]: '-ds-warning',
107
+ };
108
+ return colorMap[color];
109
+ });
92
110
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bethinkpl/design-system",
3
- "version": "35.2.3",
3
+ "version": "36.0.0",
4
4
  "description": "Bethink universe design-system",
5
5
  "repository": {
6
6
  "type": "git",