@akad/design-system 1.1.2 → 1.1.4

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.
@@ -0,0 +1,43 @@
1
+ export declare enum ChipColor {
2
+ Primary = "primary",
3
+ Secondary = "secondary",
4
+ Info = "info",
5
+ Success = "success",
6
+ Danger = "danger",
7
+ Warning = "warning",
8
+ Neutral = "neutral"
9
+ }
10
+ export declare enum ChipVariant {
11
+ Solid = "solid",
12
+ Light = "light"
13
+ }
14
+ export declare enum ChipIconPosition {
15
+ Left = "left",
16
+ Right = "right"
17
+ }
18
+ export interface ChipColorProps {
19
+ type: StringConstructor;
20
+ default: ChipColor;
21
+ options: ChipColor[];
22
+ }
23
+ export interface ChipVariantProps {
24
+ type: StringConstructor;
25
+ default: ChipVariant;
26
+ options: ChipVariant[];
27
+ }
28
+ export interface ChipIconPositionProps {
29
+ type: StringConstructor;
30
+ default: ChipIconPosition;
31
+ options: ChipIconPosition[];
32
+ }
33
+ export interface ChipConfig {
34
+ name: string;
35
+ class: string;
36
+ props: {
37
+ color: ChipColorProps;
38
+ variant: ChipVariantProps;
39
+ iconPosition: ChipIconPositionProps;
40
+ };
41
+ }
42
+ declare const chipConfig: ChipConfig;
43
+ export default chipConfig;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { ChipColor, ChipIconPosition, ChipVariant } from './Chip.config';
3
+
4
+ export interface DsChipProps {
5
+ label: React.ReactNode;
6
+ color?: ChipColor;
7
+ variant?: ChipVariant;
8
+ icon?: React.ReactNode;
9
+ iconPosition?: ChipIconPosition;
10
+ className?: string;
11
+ title?: string;
12
+ testId?: string;
13
+ }
14
+ declare const DsChip: React.FC<DsChipProps>;
15
+ export default DsChip;
@@ -0,0 +1,33 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { DsChipProps } from './Chip';
3
+ import { ChipColor, ChipIconPosition, ChipVariant } from './Chip.config';
4
+
5
+ declare const componentProps: Meta;
6
+ export default componentProps;
7
+ export declare const Default: {
8
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsChipProps>;
9
+ args: {
10
+ label: string;
11
+ color: ChipColor;
12
+ variant: ChipVariant;
13
+ };
14
+ };
15
+ export declare const WithIconLeft: {
16
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsChipProps>;
17
+ args: {
18
+ label: string;
19
+ color: ChipColor;
20
+ icon: import("react/jsx-runtime").JSX.Element;
21
+ variant: ChipVariant;
22
+ };
23
+ };
24
+ export declare const WithIconRight: {
25
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsChipProps>;
26
+ args: {
27
+ label: string;
28
+ color: ChipColor;
29
+ variant: ChipVariant;
30
+ icon: import("react/jsx-runtime").JSX.Element;
31
+ iconPosition: ChipIconPosition;
32
+ };
33
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './Chip';
2
+ export * from './Chip.config';
3
+ export { default as chipConfig } from './Chip.config';
4
+ export { default as DsChip } from './Chip';
@@ -0,0 +1,21 @@
1
+ export declare enum RadioVariant {
2
+ Default = "default",
3
+ Card = "card"
4
+ }
5
+ export interface RadioConfig {
6
+ name: string;
7
+ class: string;
8
+ props: {
9
+ variant: {
10
+ type: StringConstructor;
11
+ default: RadioVariant;
12
+ options: RadioVariant[];
13
+ };
14
+ fullWidth: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ };
19
+ }
20
+ declare const radioConfig: RadioConfig;
21
+ export default radioConfig;
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { RadioVariant } from './Radio.config';
3
+
4
+ export interface DsRadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'children' | 'className' | 'size'> {
5
+ variant?: RadioVariant;
6
+ fullWidth?: boolean;
7
+ label?: React.ReactNode;
8
+ description?: React.ReactNode;
9
+ className?: string;
10
+ testId?: string;
11
+ }
12
+ declare const DsRadio: React.ForwardRefExoticComponent<DsRadioProps & React.RefAttributes<HTMLInputElement>>;
13
+ export default DsRadio;
@@ -0,0 +1,49 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { DsRadioProps } from './Radio';
3
+ import { RadioVariant } from './Radio.config';
4
+
5
+ declare const meta: Meta<DsRadioProps>;
6
+ export default meta;
7
+ export declare const Default: {
8
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
9
+ args: {
10
+ label: string;
11
+ name: string;
12
+ value: string;
13
+ };
14
+ };
15
+ export declare const WithDescription: {
16
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
17
+ args: {
18
+ label: string;
19
+ description: string;
20
+ name: string;
21
+ value: string;
22
+ };
23
+ };
24
+ export declare const Disabled: {
25
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
26
+ args: {
27
+ label: string;
28
+ description: string;
29
+ disabled: boolean;
30
+ name: string;
31
+ value: string;
32
+ };
33
+ };
34
+ export declare const Card: {
35
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
36
+ args: {
37
+ variant: RadioVariant;
38
+ label: string;
39
+ description: string;
40
+ name: string;
41
+ value: string;
42
+ };
43
+ };
44
+ export declare const CardGroupVertical: {
45
+ render: () => import("react/jsx-runtime").JSX.Element;
46
+ };
47
+ export declare const CardGroupHorizontal: {
48
+ render: () => import("react/jsx-runtime").JSX.Element;
49
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './Radio';
2
+ export * from './Radio.config';
3
+ export { default as radioConfig } from './Radio.config';
4
+ export { default as DsRadio } from './Radio';
@@ -2,6 +2,7 @@ export * from './atoms/Button';
2
2
  export * from './atoms/Caption';
3
3
  export * from './atoms/Card';
4
4
  export * from './atoms/Checkbox';
5
+ export * from './atoms/Chip';
5
6
  export * from './atoms/Heading';
6
7
  export * from './atoms/HorizontalRule';
7
8
  export * from './atoms/Icon';
@@ -10,6 +11,7 @@ export * from './atoms/Loading';
10
11
  export * from './atoms/Option';
11
12
  export * from './atoms/Paragraph';
12
13
  export * from './atoms/Progress';
14
+ export * from './atoms/Radio';
13
15
  export * from './atoms/Select';
14
16
  export * from './atoms/Subtitle';
15
17
  export * from './atoms/TextArea';
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { DsTabProps } from './Tabs';
2
+ import { DsTabRenderProps } from './types';
3
3
 
4
- declare const DsTab: React.FC<DsTabProps>;
4
+ declare const DsTab: React.FC<DsTabRenderProps>;
5
5
  export default DsTab;
@@ -8,6 +8,10 @@ export declare enum TabsColor {
8
8
  Danger = "danger",
9
9
  Info = "info"
10
10
  }
11
+ export declare enum TabsVariant {
12
+ Segmented = "segmented",
13
+ Navigation = "navigation"
14
+ }
11
15
  export interface TabsTabsProps {
12
16
  type: ArrayConstructor;
13
17
  required: boolean;
@@ -29,6 +33,11 @@ export interface TabsOnChangeProps {
29
33
  type: FunctionConstructor;
30
34
  default: () => void;
31
35
  }
36
+ export interface TabsVariantProps {
37
+ type: StringConstructor;
38
+ default: TabsVariant;
39
+ options: TabsVariant[];
40
+ }
32
41
  export interface TabsConfig {
33
42
  name: string;
34
43
  class: string;
@@ -36,6 +45,7 @@ export interface TabsConfig {
36
45
  tabs: TabsTabsProps;
37
46
  selectedTab: TabsSelectedTabProps;
38
47
  color: TabsColorProps;
48
+ variant: TabsVariantProps;
39
49
  className: TabsClassNameProps;
40
50
  onChange: TabsOnChangeProps;
41
51
  };
@@ -1,22 +1,18 @@
1
1
  import { default as React } from 'react';
2
+ import { TabsVariant } from './Tabs.config';
3
+ import { DsTabProps } from './types';
2
4
 
3
- export interface DsTabProps {
4
- active?: boolean;
5
- className?: string;
6
- color?: string;
7
- content: React.ReactNode | string;
8
- disabled?: boolean;
9
- name?: string;
10
- index: number;
11
- title: React.ReactNode | string;
12
- onClick?: (index: number) => void;
13
- }
5
+ export type { DsTabProps } from './types';
14
6
  export interface DsTabsProps {
15
7
  tabs: DsTabProps[];
16
8
  selectedTab?: number;
17
9
  color?: string;
18
10
  className?: string;
11
+ variant?: TabsVariant;
19
12
  onChange?: (index: number) => void;
13
+ 'aria-label'?: string;
14
+ 'aria-labelledby'?: string;
15
+ rootDataTestId?: string;
20
16
  }
21
17
  declare const DsTabs: React.FC<DsTabsProps>;
22
18
  export default DsTabs;
@@ -1,5 +1,6 @@
1
1
  import { Meta } from '@storybook/react';
2
2
  import { DsTabsProps } from './Tabs';
3
+ import { TabsVariant } from './Tabs.config';
3
4
 
4
5
  declare const componentProps: Meta;
5
6
  export default componentProps;
@@ -8,6 +9,7 @@ export declare const Default: {
8
9
  args: {
9
10
  color: import('../../../main').TabsColor;
10
11
  selectedTab: number;
12
+ variant: TabsVariant;
11
13
  tabs: ({
12
14
  name: string;
13
15
  title: import("react/jsx-runtime").JSX.Element;
@@ -22,3 +24,17 @@ export declare const Default: {
22
24
  onChange: import('@storybook/addon-actions').HandlerFunction;
23
25
  };
24
26
  };
27
+ export declare const Navigation: {
28
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsTabsProps>;
29
+ args: {
30
+ tabs: {
31
+ name: string;
32
+ title: string;
33
+ content: import("react/jsx-runtime").JSX.Element;
34
+ }[];
35
+ variant: TabsVariant;
36
+ color: import('../../../main').TabsColor;
37
+ selectedTab: number;
38
+ onChange: import('@storybook/addon-actions').HandlerFunction;
39
+ };
40
+ };
@@ -1,3 +1,4 @@
1
+ export * from './types';
1
2
  export * from './Tabs';
2
3
  export * from './Tabs.config';
3
4
  export { default as DsTabs } from './Tabs';
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { TabsVariant } from './Tabs.config';
3
+
4
+ export interface DsTabProps {
5
+ active?: boolean;
6
+ className?: string;
7
+ color?: string;
8
+ content?: ReactNode | string;
9
+ disabled?: boolean;
10
+ hidden?: boolean;
11
+ name?: string;
12
+ index: number;
13
+ title: ReactNode | string;
14
+ onClick?: (index: number) => void;
15
+ tabDataTestId?: string;
16
+ panelDataTestId?: string;
17
+ }
18
+ export type DsTabRenderProps = DsTabProps & {
19
+ variant: TabsVariant;
20
+ tabDomId: string;
21
+ panelDomId?: string;
22
+ hasPanel: boolean;
23
+ };
@@ -0,0 +1,101 @@
1
+ $chip__font--family: var(--font__family--base) !default;
2
+ $chip__font--weight: $font__weight--semibold !default;
3
+ $chip__font--size: $font__size--xs !default;
4
+ $chip__font--style: normal !default;
5
+ $chip__line-height: 1.25 !default;
6
+ $chip__letter-spacing: 0 !default;
7
+ $chip__padding--y: $spacing__inset--quark !default; // 4px
8
+ $chip__padding--x: $spacing__inset--quark + $spacing__inset--nano !default; // 4px + 8px = 12px
9
+ $chip__min-height: $spacing__inset--sm !default; // 24px
10
+ $chip__border-radius: $border__radius--sm !default;
11
+ $chip__border-width: $border__width--hairline !default;
12
+ $chip__icon--gap: 6px !default;
13
+ $chip__colors: primary, secondary, success, danger, warning, info, neutral;
14
+ $chip__solid: (
15
+ 'bg__primary': var(--color__primary),
16
+ 'text__primary': var(--color__neutral--00),
17
+ 'bg__secondary': var(--color__secondary),
18
+ 'text__secondary': var(--color__neutral--00),
19
+ 'bg__success': var(--color__success),
20
+ 'text__success': var(--color__neutral--00),
21
+ 'bg__danger': var(--color__danger),
22
+ 'text__danger': var(--color__neutral--00),
23
+ 'bg__warning': var(--color__warning),
24
+ 'text__warning': var(--color__neutral--90),
25
+ 'bg__info': var(--color__info),
26
+ 'text__info': var(--color__neutral--00),
27
+ 'bg__neutral': var(--color__neutral--80),
28
+ 'text__neutral': var(--color__neutral--00),
29
+ ) !default;
30
+ $chip__light: (
31
+ 'bg__primary': var(--color__primary--lighter),
32
+ 'text__primary': var(--color__primary--dark),
33
+ 'bg__secondary': var(--color__secondary--lighter),
34
+ 'text__secondary': var(--color__secondary--dark),
35
+ 'bg__success': var(--color__success--lighter),
36
+ 'text__success': var(--color__success--dark),
37
+ 'bg__danger': var(--color__danger--lighter),
38
+ 'text__danger': var(--color__danger--dark),
39
+ 'bg__warning': var(--color__warning--lighter),
40
+ 'text__warning': var(--color__warning--dark),
41
+ 'bg__info': var(--color__info--lighter),
42
+ 'text__info': var(--color__info--dark),
43
+ 'bg__neutral': var(--color__neutral--20),
44
+ 'text__neutral': var(--color__neutral--80),
45
+ ) !default;
46
+
47
+ .ds-chip {
48
+ --chip__border-radius: #{$chip__border-radius};
49
+ --chip__border-width: #{$chip__border-width};
50
+ --chip__min-height: #{$chip__min-height};
51
+ --chip__padding: #{$chip__padding--y} #{$chip__padding--x};
52
+ --chip__icon-gap: #{$chip__icon--gap};
53
+
54
+ align-items: center;
55
+ border: none;
56
+ border-radius: var(--chip__border-radius);
57
+ box-sizing: border-box;
58
+ display: inline-flex;
59
+ font-family: $chip__font--family;
60
+ font-size: $chip__font--size;
61
+ font-style: $chip__font--style;
62
+ font-weight: $chip__font--weight;
63
+ gap: var(--chip__icon-gap);
64
+ justify-content: center;
65
+ letter-spacing: $chip__letter-spacing;
66
+ line-height: $chip__line-height;
67
+ margin: 0;
68
+ max-width: 100%;
69
+ min-height: var(--chip__min-height);
70
+ padding: var(--chip__padding);
71
+ text-align: center;
72
+ vertical-align: middle;
73
+ white-space: nowrap;
74
+
75
+ &__label {
76
+ overflow: hidden;
77
+ text-overflow: ellipsis;
78
+ }
79
+
80
+ &__icon {
81
+ align-items: center;
82
+ display: inline-flex;
83
+ flex-shrink: 0;
84
+ justify-content: center;
85
+ line-height: 1;
86
+ }
87
+
88
+ @each $color in $chip__colors {
89
+ &__#{$color} {
90
+ &--solid {
91
+ background-color: get-token($chip__solid, 'bg__' + $color);
92
+ color: get-token($chip__solid, 'text__' + $color);
93
+ }
94
+
95
+ &--light {
96
+ background-color: get-token($chip__light, 'bg__' + $color);
97
+ color: get-token($chip__light, 'text__' + $color);
98
+ }
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,117 @@
1
+ $radio-card__padding: $spacing__inset--quark + $spacing__inset--nano !default;
2
+ $radio-card__gap: $spacing__inset--quark + $spacing__inset--nano !default;
3
+ $radio-card__min-height: $spacing--lg !default;
4
+ $radio-card__text-gap: $spacing--quark !default;
5
+ $radio-card__border-radius: $border__radius--sm !default;
6
+ $radio-card__border-width: $border__width--hairline !default;
7
+ $radio-card__outline-width: $border__width--thin !default;
8
+
9
+ // Tipografia
10
+ $radio-card__font--family: var(--font__family--base) !default;
11
+ $radio-card__font--size: $font__size--xs !default;
12
+ $radio-card__font--weight: $font__weight--semibold !default;
13
+ $radio-card__line-height: 1.5 !default;
14
+
15
+ // Cores (light)
16
+ $radio-card__bg: var(--color__neutral--00) !default;
17
+ $radio-card__border: var(--color__neutral--30) !default;
18
+ $radio-card__bg--checked: var(--color__neutral--05) !default;
19
+ $radio-card__border--checked: var(--color__neutral--80) !default;
20
+ $radio-card__text: var(--color__neutral--80) !default;
21
+
22
+ // Cores (dark)
23
+ $radio-card__bg--dark: var(--color__neutral--90) !default;
24
+ $radio-card__border--dark: var(--color__neutral--60) !default;
25
+ $radio-card__text--dark: var(--color__neutral--10) !default;
26
+ $radio-card__bg--checked-dark: var(--color__neutral--80) !default;
27
+ $radio-card__border--checked-dark: var(--color__neutral--30) !default;
28
+ $radio-card__disabled-opacity: 0.55 !default;
29
+
30
+ @mixin radio-card-wrapper {
31
+ align-items: center;
32
+ background-color: #{$radio-card__bg};
33
+ border: $radio-card__border-width solid #{$radio-card__border};
34
+ border-radius: $radio-card__border-radius;
35
+ box-sizing: border-box;
36
+ cursor: pointer;
37
+ display: inline-flex;
38
+ font-family: $radio-card__font--family;
39
+ -webkit-font-smoothing: antialiased;
40
+ -moz-osx-font-smoothing: grayscale;
41
+ gap: $radio-card__gap;
42
+ min-height: $radio-card__min-height;
43
+ padding: $radio-card__padding;
44
+ position: relative;
45
+ width: fit-content;
46
+ }
47
+
48
+ @mixin radio-card-wrapper-checked {
49
+ background-color: #{$radio-card__bg--checked};
50
+ border-color: #{$radio-card__border--checked};
51
+ }
52
+
53
+ @mixin radio-card-wrapper-focus-visible {
54
+ outline: $radio-card__outline-width solid #{$radio-card__border--checked};
55
+ outline-offset: $radio-card__outline-width;
56
+ }
57
+
58
+ @mixin radio-card-wrapper-disabled {
59
+ cursor: not-allowed;
60
+ opacity: $radio-card__disabled-opacity;
61
+ pointer-events: none;
62
+ }
63
+
64
+ @mixin radio-card-input-hidden {
65
+ cursor: pointer;
66
+ inset: 0;
67
+ margin: 0;
68
+ opacity: 0;
69
+ position: absolute;
70
+ z-index: 1;
71
+
72
+ &:disabled {
73
+ cursor: not-allowed;
74
+ }
75
+ }
76
+
77
+ @mixin radio-card-text-block {
78
+ display: flex;
79
+ flex: 1;
80
+ flex-direction: column;
81
+ gap: $radio-card__text-gap;
82
+ justify-content: center;
83
+ min-width: 0;
84
+ pointer-events: none;
85
+ z-index: 0;
86
+ }
87
+
88
+ @mixin radio-card-text-style {
89
+ color: #{$radio-card__text};
90
+ font-family: inherit;
91
+ font-size: $radio-card__font--size;
92
+ font-style: normal;
93
+ font-weight: $radio-card__font--weight;
94
+ letter-spacing: 0;
95
+ line-height: $radio-card__line-height;
96
+ vertical-align: middle;
97
+ }
98
+
99
+ @mixin radio-card-dark-mode {
100
+ background-color: #{$radio-card__bg--dark};
101
+ border-color: #{$radio-card__border--dark};
102
+ color: #{$radio-card__text--dark};
103
+
104
+ .ds-radio__label,
105
+ .ds-radio__description {
106
+ color: #{$radio-card__text--dark};
107
+ }
108
+ }
109
+
110
+ @mixin radio-card-dark-mode-checked {
111
+ background-color: #{$radio-card__bg--checked-dark};
112
+ border-color: #{$radio-card__border--checked-dark};
113
+ }
114
+
115
+ @mixin radio-card-dark-mode-focus-visible {
116
+ outline-color: #{$radio-card__border--checked-dark};
117
+ }