agroptima-design-system 0.1.3 â 0.2.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.
- package/.github/workflows/design-system-deploy-production.yaml +1 -1
- package/.github/workflows/publish-package-to-npmjs.yml +21 -0
- package/.github/workflows/run-linters.yml +10 -10
- package/package.json +6 -3
- package/src/atoms/Button.scss +49 -23
- package/src/atoms/CardsTableList.scss +27 -1
- package/src/atoms/CardsTableList.tsx +66 -37
- package/src/atoms/CardsTableListHeader.tsx +32 -0
- package/src/atoms/CardsTableListRow.tsx +15 -0
- package/src/atoms/Input.scss +17 -8
- package/src/atoms/Multiselect.scss +14 -11
- package/src/atoms/Select.scss +9 -9
- package/src/settings/_typography.scss +2 -2
- package/src/stories/Button.stories.ts +7 -0
- package/src/stories/CardsTableList.stories.ts +70 -8
- package/src/stories/Changelog.stories.mdx +12 -0
- package/src/stories/Icons.stories.mdx +5 -0
- package/src/stories/ProgrammersStartingGuide.stories.mdx +33 -1
- package/src/stories/Select.stories.ts +3 -3
- package/src/stories/Welcome.stories.mdx +4 -0
- package/src/stories/Workflow.stories.mdx +8 -0
- package/src/utils/sort.ts +31 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Publish Package to npmjs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
# Setup .npmrc file to publish to npm
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: '20.x'
|
|
17
|
+
registry-url: 'https://registry.npmjs.org'
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm publish
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -12,16 +12,16 @@ jobs:
|
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
- name: Setup Node
|
|
18
|
+
uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: 18.x
|
|
21
|
+
cache: 'npm'
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: npm install
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: npm run lint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agroptima-design-system",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "npm run storybook",
|
|
6
6
|
"storybook": "storybook dev -p 6006 --ci",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"build-storybook": "storybook build",
|
|
9
9
|
"lint": "eslint",
|
|
10
10
|
"lint:fix": "eslint src --fix",
|
|
11
|
-
"publish-chromatic": "npx chromatic --exit-zero-on-changes"
|
|
11
|
+
"publish-chromatic": "npx chromatic --exit-zero-on-changes",
|
|
12
|
+
"chromatic": "npx chromatic --exit-zero-on-changes"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
15
|
"@storybook/addon-designs": "^7.0.5",
|
|
@@ -49,7 +50,9 @@
|
|
|
49
50
|
"keywords": [
|
|
50
51
|
"design-system"
|
|
51
52
|
],
|
|
52
|
-
"author":
|
|
53
|
+
"author": {
|
|
54
|
+
"name": "Isagri"
|
|
55
|
+
},
|
|
53
56
|
"license": "MPL-2.0",
|
|
54
57
|
"bugs": {
|
|
55
58
|
"url": "https://github.com/agroptima/design-system/issues"
|
package/src/atoms/Button.scss
CHANGED
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
&.primary,
|
|
7
7
|
&.primary-outlined,
|
|
8
8
|
&.primary-ghost {
|
|
9
|
-
--color-bg: #{color_alias.$primary-color-
|
|
10
|
-
--color-bg-hover: #{color_alias.$primary-color-
|
|
9
|
+
--color-bg: #{color_alias.$primary-color-600};
|
|
10
|
+
--color-bg-hover: #{color_alias.$primary-color-1000};
|
|
11
11
|
--color-bg-hover-outlined: #{color_alias.$primary-color-50};
|
|
12
12
|
--color-fg: #{color_alias.$neutral-white};
|
|
13
|
-
--color-fg-reversed: #{color_alias.$primary-color-
|
|
13
|
+
--color-fg-reversed: #{color_alias.$primary-color-600};
|
|
14
14
|
}
|
|
15
15
|
&.error,
|
|
16
16
|
&.error-outlined,
|
|
17
17
|
&.error-ghost {
|
|
18
|
-
--color-bg: #{color_alias.$error-color-
|
|
19
|
-
--color-bg-hover: #{color_alias.$error-color-
|
|
18
|
+
--color-bg: #{color_alias.$error-color-600};
|
|
19
|
+
--color-bg-hover: #{color_alias.$error-color-900};
|
|
20
20
|
--color-bg-hover-outlined: #{color_alias.$error-color-50};
|
|
21
21
|
--color-fg: #{color_alias.$neutral-white};
|
|
22
|
-
--color-fg-reversed: #{color_alias.$error-color-
|
|
22
|
+
--color-fg-reversed: #{color_alias.$error-color-600};
|
|
23
23
|
}
|
|
24
24
|
&.success,
|
|
25
25
|
&.success-outlined,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
--color-bg: #{color_alias.$success-color-1000};
|
|
28
28
|
--color-bg-hover: #{color_alias.$success-color-700};
|
|
29
29
|
--color-bg-hover-outlined: #{color_alias.$success-color-50};
|
|
30
|
-
--color-fg: #{color_alias.$neutral-
|
|
30
|
+
--color-fg: #{color_alias.$neutral-color-900};
|
|
31
31
|
--color-fg-reversed: #{color_alias.$success-color-1000};
|
|
32
32
|
}
|
|
33
33
|
&.warning,
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
--color-bg: #{color_alias.$warning-color-1000};
|
|
37
37
|
--color-bg-hover: #{color_alias.$warning-color-700};
|
|
38
38
|
--color-bg-hover-outlined: #{color_alias.$warning-color-50};
|
|
39
|
-
--color-fg: #{color_alias.$neutral-
|
|
39
|
+
--color-fg: #{color_alias.$neutral-color-900};
|
|
40
40
|
--color-fg-reversed: #{color_alias.$warning-color-1000};
|
|
41
41
|
}
|
|
42
42
|
&.info,
|
|
43
43
|
&.info-outlined,
|
|
44
44
|
&.info-ghost {
|
|
45
|
-
--color-bg: #{color_alias.$info-color-
|
|
46
|
-
--color-bg-hover: #{color_alias.$info-color-
|
|
45
|
+
--color-bg: #{color_alias.$info-color-600};
|
|
46
|
+
--color-bg-hover: #{color_alias.$info-color-900};
|
|
47
47
|
--color-bg-hover-outlined: #{color_alias.$info-color-50};
|
|
48
48
|
--color-fg: #{color_alias.$neutral-white};
|
|
49
|
-
--color-fg-reversed: #{color_alias.$info-color-
|
|
49
|
+
--color-fg-reversed: #{color_alias.$info-color-600};
|
|
50
50
|
}
|
|
51
51
|
&.neutral,
|
|
52
52
|
&.neutral-outlined,
|
|
@@ -87,41 +87,67 @@
|
|
|
87
87
|
&:not(:disabled):hover,
|
|
88
88
|
&:not(:disabled):active {
|
|
89
89
|
background: var(--color-bg-hover);
|
|
90
|
+
|
|
91
|
+
&.success,
|
|
92
|
+
&.warning {
|
|
93
|
+
color: color_alias.$neutral-white;
|
|
94
|
+
svg,
|
|
95
|
+
svg path {
|
|
96
|
+
fill: color_alias.$neutral-white;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
|
|
92
101
|
&:disabled {
|
|
93
|
-
background: color_alias.$neutral-color-
|
|
94
|
-
color:
|
|
102
|
+
background: color_alias.$neutral-color-50;
|
|
103
|
+
color: color_alias.$neutral-color-400;
|
|
95
104
|
svg,
|
|
96
105
|
svg path {
|
|
97
|
-
fill:
|
|
106
|
+
fill: color_alias.$neutral-color-400;
|
|
98
107
|
}
|
|
99
108
|
}
|
|
100
109
|
|
|
101
110
|
&.primary-outlined,
|
|
102
111
|
&.error-outlined,
|
|
103
|
-
&.success-outlined,
|
|
104
|
-
&.warning-outlined,
|
|
105
112
|
&.info-outlined,
|
|
106
113
|
&.neutral-outlined {
|
|
107
114
|
background: color_alias.$neutral-white;
|
|
108
|
-
color: var(--color-
|
|
115
|
+
color: var(--color-bg);
|
|
109
116
|
border: 1px solid var(--color-bg);
|
|
110
117
|
svg,
|
|
111
118
|
svg path {
|
|
112
|
-
fill: var(--color-
|
|
119
|
+
fill: var(--color-bg);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
&.success-outlined,
|
|
124
|
+
&.warning-outlined {
|
|
125
|
+
background: color_alias.$neutral-white;
|
|
126
|
+
color: var(--color-fg);
|
|
127
|
+
border: 1px solid var(--color-bg);
|
|
128
|
+
svg,
|
|
129
|
+
svg path {
|
|
130
|
+
fill: var(--color-fg);
|
|
113
131
|
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.primary-outlined,
|
|
135
|
+
&.error-outlined,
|
|
136
|
+
&.success-outlined,
|
|
137
|
+
&.warning-outlined,
|
|
138
|
+
&.info-outlined,
|
|
139
|
+
&.neutral-outlined {
|
|
114
140
|
&:not(:disabled):hover,
|
|
115
141
|
&:not(:disabled):active {
|
|
116
142
|
background: var(--color-bg-hover-outlined);
|
|
117
143
|
}
|
|
118
144
|
&:disabled {
|
|
119
145
|
background: color_alias.$neutral-color-50;
|
|
120
|
-
border: 1px solid color_alias.$neutral-color-
|
|
121
|
-
color: color_alias.$neutral-color-
|
|
146
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
147
|
+
color: color_alias.$neutral-color-400;
|
|
122
148
|
svg,
|
|
123
149
|
svg path {
|
|
124
|
-
fill: color_alias.$neutral-color-
|
|
150
|
+
fill: color_alias.$neutral-color-400;
|
|
125
151
|
}
|
|
126
152
|
}
|
|
127
153
|
}
|
|
@@ -144,10 +170,10 @@
|
|
|
144
170
|
border: 1px solid var(--color-bg);
|
|
145
171
|
}
|
|
146
172
|
&:disabled {
|
|
147
|
-
color: color_alias.$neutral-color-
|
|
173
|
+
color: color_alias.$neutral-color-400;
|
|
148
174
|
svg,
|
|
149
175
|
svg path {
|
|
150
|
-
fill: color_alias.$neutral-color-
|
|
176
|
+
fill: color_alias.$neutral-color-400;
|
|
151
177
|
}
|
|
152
178
|
}
|
|
153
179
|
}
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
white-space: nowrap;
|
|
30
30
|
text-align: left;
|
|
31
31
|
|
|
32
|
+
&.sortable {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
.icon {
|
|
33
37
|
width: config.$icon-size-3x;
|
|
34
38
|
height: config.$icon-size-3x;
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
th {
|
|
53
|
-
background: color_alias.$primary-color-
|
|
57
|
+
background: color_alias.$primary-color-1000;
|
|
54
58
|
|
|
55
59
|
.icon {
|
|
56
60
|
> svg {
|
|
@@ -59,6 +63,28 @@
|
|
|
59
63
|
fill: color_alias.$neutral-white;
|
|
60
64
|
}
|
|
61
65
|
}
|
|
66
|
+
|
|
67
|
+
&.ascending {
|
|
68
|
+
> svg {
|
|
69
|
+
.sorter_svg__up {
|
|
70
|
+
fill: color_alias.$primary-color-600;
|
|
71
|
+
}
|
|
72
|
+
.sorter_svg__down {
|
|
73
|
+
fill: color_alias.$neutral-white;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.descending {
|
|
79
|
+
> svg {
|
|
80
|
+
.sorter_svg__up {
|
|
81
|
+
fill: color_alias.$neutral-white;
|
|
82
|
+
}
|
|
83
|
+
.sorter_svg__down {
|
|
84
|
+
fill: color_alias.$primary-color-600;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
62
88
|
}
|
|
63
89
|
}
|
|
64
90
|
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
import './CardsTableList.scss'
|
|
2
|
-
import {
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import { sortBy } from '../utils/sort'
|
|
4
|
+
import { IconType } from './Icon'
|
|
5
|
+
import { CardsTableListHeader } from './CardsTableListHeader'
|
|
6
|
+
import { CardsTableListRow } from './CardsTableListRow'
|
|
3
7
|
|
|
4
8
|
export type Variant = 'primary'
|
|
5
|
-
|
|
6
|
-
export type
|
|
9
|
+
|
|
10
|
+
export type Header = {
|
|
11
|
+
label: string
|
|
12
|
+
icon?: IconType
|
|
13
|
+
columnId: string
|
|
14
|
+
isSortable?: boolean
|
|
15
|
+
}
|
|
16
|
+
export type Column = {
|
|
7
17
|
[key: string]: string
|
|
8
18
|
}
|
|
9
|
-
export type Row = { id: string; isDisabled
|
|
19
|
+
export type Row = { id: string; isDisabled?: boolean; columns: Column }
|
|
20
|
+
|
|
21
|
+
export enum Order {
|
|
22
|
+
Ascending = 'ascending',
|
|
23
|
+
Descending = 'descending',
|
|
24
|
+
None = 'none',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type SortState = { columnId: string; order: Order }
|
|
10
28
|
|
|
11
29
|
export interface CardsTableListProps
|
|
12
30
|
extends React.ComponentPropsWithoutRef<'table'> {
|
|
@@ -21,48 +39,59 @@ export function CardsTableList({
|
|
|
21
39
|
summary,
|
|
22
40
|
variant = 'primary',
|
|
23
41
|
}: CardsTableListProps): React.JSX.Element {
|
|
42
|
+
const [sortState, setSortState] = useState<SortState | null>(() => {
|
|
43
|
+
return headers[0]?.isSortable
|
|
44
|
+
? { columnId: headers[0].columnId, order: Order.Ascending }
|
|
45
|
+
: null
|
|
46
|
+
})
|
|
47
|
+
|
|
24
48
|
const cssClasses = ['cards-table-list', variant].join(' ')
|
|
25
49
|
|
|
50
|
+
function checkColumnOrder(columnId: string) {
|
|
51
|
+
if (sortState?.columnId === columnId) {
|
|
52
|
+
return sortState.order
|
|
53
|
+
}
|
|
54
|
+
return Order.None
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function applySort(columnId: string) {
|
|
58
|
+
if (!headers.find((header) => header.columnId === columnId)?.isSortable) {
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setSortState({
|
|
63
|
+
columnId,
|
|
64
|
+
order:
|
|
65
|
+
checkColumnOrder(columnId) === Order.Ascending
|
|
66
|
+
? Order.Descending
|
|
67
|
+
: Order.Ascending,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
const sortedRows = sortState?.columnId
|
|
71
|
+
? sortBy({
|
|
72
|
+
rows,
|
|
73
|
+
prop: sortState?.columnId,
|
|
74
|
+
order: sortState?.order,
|
|
75
|
+
})
|
|
76
|
+
: rows
|
|
26
77
|
return (
|
|
27
78
|
<table summary={summary} role="table" className={cssClasses}>
|
|
28
79
|
<thead role="rowgroup">
|
|
29
80
|
<tr role="row">
|
|
30
|
-
{headers.map((header) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
>
|
|
39
|
-
<div className="container">
|
|
40
|
-
<div className="title-container">
|
|
41
|
-
<span>{header.label}</span>
|
|
42
|
-
{icon && <Icon name={icon} />}
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</th>
|
|
46
|
-
)
|
|
47
|
-
})}
|
|
81
|
+
{headers.map((header) => (
|
|
82
|
+
<CardsTableListHeader
|
|
83
|
+
key={header.columnId}
|
|
84
|
+
header={header}
|
|
85
|
+
order={checkColumnOrder(header.columnId)}
|
|
86
|
+
onClick={() => applySort(header.columnId)}
|
|
87
|
+
/>
|
|
88
|
+
))}
|
|
48
89
|
</tr>
|
|
49
90
|
</thead>
|
|
50
91
|
<tbody role="rowgroup">
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<tr role="row" className={`row ${disabledClass}`} key={row.id}>
|
|
56
|
-
{Object.getOwnPropertyNames(data).map((property) => {
|
|
57
|
-
return (
|
|
58
|
-
<td role="cell" key={row.id + property} className="cell">
|
|
59
|
-
{data[property]}
|
|
60
|
-
</td>
|
|
61
|
-
)
|
|
62
|
-
})}
|
|
63
|
-
</tr>
|
|
64
|
-
)
|
|
65
|
-
})}
|
|
92
|
+
{sortedRows.map((row: Row) => (
|
|
93
|
+
<CardsTableListRow key={row.id} {...row} />
|
|
94
|
+
))}
|
|
66
95
|
</tbody>
|
|
67
96
|
</table>
|
|
68
97
|
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Icon } from './Icon'
|
|
2
|
+
import { Header, Order } from './CardsTableList'
|
|
3
|
+
|
|
4
|
+
export interface CardsTableListHeaderProps {
|
|
5
|
+
header: Header
|
|
6
|
+
order: Order
|
|
7
|
+
onClick: () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function CardsTableListHeader({
|
|
11
|
+
header,
|
|
12
|
+
order,
|
|
13
|
+
onClick,
|
|
14
|
+
}: CardsTableListHeaderProps) {
|
|
15
|
+
return (
|
|
16
|
+
<th
|
|
17
|
+
scope="col"
|
|
18
|
+
role="columnheader"
|
|
19
|
+
className={`header ${header.isSortable ? 'sortable' : ''}`}
|
|
20
|
+
aria-sort={order}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
>
|
|
23
|
+
<div className="container">
|
|
24
|
+
<div className="title-container">
|
|
25
|
+
<span>{header.label}</span>
|
|
26
|
+
{header.icon && <Icon name={header.icon} />}
|
|
27
|
+
</div>
|
|
28
|
+
{header.isSortable && <Icon name="Sorter" className={order} />}
|
|
29
|
+
</div>
|
|
30
|
+
</th>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Row } from './CardsTableList'
|
|
2
|
+
|
|
3
|
+
export function CardsTableListRow({ isDisabled, columns, id }: Row) {
|
|
4
|
+
const disabledClass = isDisabled ? 'disabled' : ''
|
|
5
|
+
const cells = Object.entries(columns)
|
|
6
|
+
return (
|
|
7
|
+
<tr role="row" className={`row ${disabledClass}`}>
|
|
8
|
+
{cells.map(([columnId, value]) => (
|
|
9
|
+
<td role="cell" key={`${id}${columnId}`} className="cell">
|
|
10
|
+
{value}
|
|
11
|
+
</td>
|
|
12
|
+
))}
|
|
13
|
+
</tr>
|
|
14
|
+
)
|
|
15
|
+
}
|
package/src/atoms/Input.scss
CHANGED
|
@@ -21,9 +21,18 @@
|
|
|
21
21
|
.input-container {
|
|
22
22
|
.icon {
|
|
23
23
|
> svg {
|
|
24
|
-
fill: color_alias.$neutral-color-
|
|
24
|
+
fill: color_alias.$neutral-color-400;
|
|
25
25
|
path {
|
|
26
|
-
fill: color_alias.$neutral-color-
|
|
26
|
+
fill: color_alias.$neutral-color-400;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.password-icon {
|
|
32
|
+
> svg {
|
|
33
|
+
fill: color_alias.$neutral-color-600;
|
|
34
|
+
path {
|
|
35
|
+
fill: color_alias.$neutral-color-600;
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
}
|
|
@@ -31,7 +40,7 @@
|
|
|
31
40
|
|
|
32
41
|
.input {
|
|
33
42
|
border-radius: config.$corner-radius-m;
|
|
34
|
-
border: 1px solid color_alias.$neutral-color-
|
|
43
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
35
44
|
background: color_alias.$neutral-white;
|
|
36
45
|
|
|
37
46
|
@include typography.input-text;
|
|
@@ -41,8 +50,8 @@
|
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
&:focus {
|
|
44
|
-
outline: color_alias.$primary-color-
|
|
45
|
-
border: 1px solid color_alias.$primary-color-
|
|
53
|
+
outline: color_alias.$primary-color-600;
|
|
54
|
+
border: 1px solid color_alias.$primary-color-600;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
&.invalid {
|
|
@@ -50,12 +59,12 @@
|
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
&:disabled {
|
|
53
|
-
border: 1px solid color_alias.$neutral-color-
|
|
62
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
54
63
|
background: color_alias.$neutral-color-50;
|
|
55
|
-
color: color_alias.$neutral-color-
|
|
64
|
+
color: color_alias.$neutral-color-400;
|
|
56
65
|
|
|
57
66
|
&::placeholder {
|
|
58
|
-
color: color_alias.$neutral-color-
|
|
67
|
+
color: color_alias.$neutral-color-400;
|
|
59
68
|
}
|
|
60
69
|
}
|
|
61
70
|
}
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
|
|
21
21
|
.selected-option {
|
|
22
22
|
border-radius: config.$corner-radius-m;
|
|
23
|
-
border: 1px solid color_alias.$neutral-color-
|
|
23
|
+
border: 1px solid color_alias.$neutral-color-600;
|
|
24
24
|
background: color_alias.$neutral-white;
|
|
25
25
|
@include typography.select-text;
|
|
26
26
|
|
|
27
27
|
> .icon {
|
|
28
28
|
> svg {
|
|
29
|
-
fill: color_alias.$primary-color-
|
|
29
|
+
fill: color_alias.$primary-color-600;
|
|
30
30
|
path {
|
|
31
|
-
fill: color_alias.$primary-color-
|
|
31
|
+
fill: color_alias.$primary-color-600;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
&:focus {
|
|
41
|
-
outline: color_alias.$primary-color-
|
|
42
|
-
border: 1px solid color_alias.$primary-color-
|
|
41
|
+
outline: color_alias.$primary-color-600;
|
|
42
|
+
border: 1px solid color_alias.$primary-color-600;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
&.invalid {
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
&.disabled {
|
|
50
|
-
border: 1px solid color_alias.$neutral-color-
|
|
50
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
51
51
|
background: color_alias.$neutral-color-50;
|
|
52
|
-
color: color_alias.$neutral-color-
|
|
52
|
+
color: color_alias.$neutral-color-400;
|
|
53
53
|
|
|
54
54
|
> .icon {
|
|
55
55
|
> svg {
|
|
56
|
-
fill: color_alias.$neutral-color-
|
|
56
|
+
fill: color_alias.$neutral-color-400;
|
|
57
57
|
path {
|
|
58
|
-
fill: color_alias.$neutral-color-
|
|
58
|
+
fill: color_alias.$neutral-color-400;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -82,10 +82,13 @@
|
|
|
82
82
|
> svg {
|
|
83
83
|
border-radius: config.$corner-radius-xxs;
|
|
84
84
|
.checkbox-active_svg__border {
|
|
85
|
-
fill: color_alias.$primary-color-
|
|
85
|
+
fill: color_alias.$primary-color-600;
|
|
86
|
+
}
|
|
87
|
+
.checkbox-active_svg__background {
|
|
88
|
+
fill: color_alias.$primary-color-600;
|
|
86
89
|
}
|
|
87
90
|
.checkbox-inactive_svg__border {
|
|
88
|
-
fill: color_alias.$neutral-color-
|
|
91
|
+
fill: color_alias.$neutral-color-600;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
}
|
package/src/atoms/Select.scss
CHANGED
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
|
|
21
21
|
.selected-option {
|
|
22
22
|
border-radius: config.$corner-radius-m;
|
|
23
|
-
border: 1px solid color_alias.$neutral-color-
|
|
23
|
+
border: 1px solid color_alias.$neutral-color-600;
|
|
24
24
|
background: color_alias.$neutral-white;
|
|
25
25
|
@include typography.select-text;
|
|
26
26
|
|
|
27
27
|
> .icon {
|
|
28
28
|
> svg {
|
|
29
|
-
fill: color_alias.$primary-color-
|
|
29
|
+
fill: color_alias.$primary-color-600;
|
|
30
30
|
path {
|
|
31
|
-
fill: color_alias.$primary-color-
|
|
31
|
+
fill: color_alias.$primary-color-600;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
&:focus {
|
|
41
|
-
outline: color_alias.$primary-color-
|
|
42
|
-
border: 1px solid color_alias.$primary-color-
|
|
41
|
+
outline: color_alias.$primary-color-600;
|
|
42
|
+
border: 1px solid color_alias.$primary-color-600;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
&.invalid {
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
&.disabled {
|
|
50
|
-
border: 1px solid color_alias.$neutral-color-
|
|
50
|
+
border: 1px solid color_alias.$neutral-color-400;
|
|
51
51
|
background: color_alias.$neutral-color-50;
|
|
52
|
-
color: color_alias.$neutral-color-
|
|
52
|
+
color: color_alias.$neutral-color-400;
|
|
53
53
|
|
|
54
54
|
> .icon {
|
|
55
55
|
> svg {
|
|
56
|
-
fill: color_alias.$neutral-color-
|
|
56
|
+
fill: color_alias.$neutral-color-400;
|
|
57
57
|
path {
|
|
58
|
-
fill: color_alias.$neutral-color-
|
|
58
|
+
fill: color_alias.$neutral-color-400;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -19,7 +19,7 @@ $font-primary: $font-base-stretch $text-base-style $font-base-weight #{$text-bas
|
|
|
19
19
|
font-variant: $text-base-style;
|
|
20
20
|
font-weight: 300;
|
|
21
21
|
font-family: $font-base-family;
|
|
22
|
-
color: color_alias.$neutral-color-
|
|
22
|
+
color: color_alias.$neutral-color-600;
|
|
23
23
|
// We need to apply a relation between font-size and line-height so the box envoloping the span
|
|
24
24
|
// is the most accurate in terms of top and bottom blank space.
|
|
25
25
|
font-size: 0.75rem;
|
|
@@ -37,7 +37,7 @@ $font-primary: $font-base-stretch $text-base-style $font-base-weight #{$text-bas
|
|
|
37
37
|
font-variant: $text-base-style;
|
|
38
38
|
font-weight: 400;
|
|
39
39
|
font-family: $font-base-family;
|
|
40
|
-
color: color_alias.$neutral-color-
|
|
40
|
+
color: color_alias.$neutral-color-400;
|
|
41
41
|
// We shouldn't define a font-size for the placeholder: https://stackoverflow.com/questions/30916387/placeholder-font-size-bigger-than-16px
|
|
42
42
|
}
|
|
43
43
|
@mixin select-text {
|
|
@@ -98,6 +98,7 @@ export const PrimaryWithLeftIcon: Story = {
|
|
|
98
98
|
export const PrimaryOutlined: Story = {
|
|
99
99
|
args: {
|
|
100
100
|
variant: 'primary-outlined',
|
|
101
|
+
disabled: false,
|
|
101
102
|
},
|
|
102
103
|
parameters: figmaPrimaryDesign,
|
|
103
104
|
}
|
|
@@ -105,6 +106,7 @@ export const PrimaryOutlined: Story = {
|
|
|
105
106
|
export const PrimaryGhost: Story = {
|
|
106
107
|
args: {
|
|
107
108
|
variant: 'primary-ghost',
|
|
109
|
+
disabled: false,
|
|
108
110
|
},
|
|
109
111
|
parameters: figmaPrimaryDesign,
|
|
110
112
|
}
|
|
@@ -112,6 +114,7 @@ export const PrimaryGhost: Story = {
|
|
|
112
114
|
export const Neutral: Story = {
|
|
113
115
|
args: {
|
|
114
116
|
variant: 'neutral',
|
|
117
|
+
disabled: false,
|
|
115
118
|
},
|
|
116
119
|
parameters: figmaNeutralDesign,
|
|
117
120
|
}
|
|
@@ -119,6 +122,7 @@ export const Neutral: Story = {
|
|
|
119
122
|
export const Error: Story = {
|
|
120
123
|
args: {
|
|
121
124
|
variant: 'error',
|
|
125
|
+
disabled: false,
|
|
122
126
|
},
|
|
123
127
|
parameters: figmaErrorDesign,
|
|
124
128
|
}
|
|
@@ -126,6 +130,7 @@ export const Error: Story = {
|
|
|
126
130
|
export const Success: Story = {
|
|
127
131
|
args: {
|
|
128
132
|
variant: 'success',
|
|
133
|
+
disabled: false,
|
|
129
134
|
},
|
|
130
135
|
parameters: figmaSuccessDesign,
|
|
131
136
|
}
|
|
@@ -133,6 +138,7 @@ export const Success: Story = {
|
|
|
133
138
|
export const Warning: Story = {
|
|
134
139
|
args: {
|
|
135
140
|
variant: 'warning',
|
|
141
|
+
disabled: false,
|
|
136
142
|
},
|
|
137
143
|
parameters: figmaWarningDesign,
|
|
138
144
|
}
|
|
@@ -140,6 +146,7 @@ export const Warning: Story = {
|
|
|
140
146
|
export const Info: Story = {
|
|
141
147
|
args: {
|
|
142
148
|
variant: 'info',
|
|
149
|
+
disabled: false,
|
|
143
150
|
},
|
|
144
151
|
parameters: figmaInfoDesign,
|
|
145
152
|
}
|
|
@@ -14,7 +14,8 @@ const meta = {
|
|
|
14
14
|
'Summary of the table purpose and structure for assistive technologies',
|
|
15
15
|
},
|
|
16
16
|
headers: {
|
|
17
|
-
description:
|
|
17
|
+
description:
|
|
18
|
+
'Array of values to be displayed on the headers. columnId value must match with rows columns ids.',
|
|
18
19
|
},
|
|
19
20
|
rows: {
|
|
20
21
|
description: 'Array of values to be displayed as the data',
|
|
@@ -32,7 +33,64 @@ const figmaPrimaryDesign = {
|
|
|
32
33
|
export default meta
|
|
33
34
|
type Story = StoryObj<typeof meta>
|
|
34
35
|
|
|
35
|
-
export const
|
|
36
|
+
export const WithSorting: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
variant: 'primary',
|
|
39
|
+
summary: 'Videogames companies contact information',
|
|
40
|
+
headers: [
|
|
41
|
+
{
|
|
42
|
+
label: 'Game title',
|
|
43
|
+
icon: 'Info',
|
|
44
|
+
columnId: 'name',
|
|
45
|
+
isSortable: true,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Company address',
|
|
49
|
+
icon: 'Info',
|
|
50
|
+
columnId: 'address',
|
|
51
|
+
isSortable: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'Customer service email',
|
|
55
|
+
columnId: 'email',
|
|
56
|
+
icon: 'Info',
|
|
57
|
+
isSortable: true,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
rows: [
|
|
61
|
+
{
|
|
62
|
+
id: '1',
|
|
63
|
+
columns: {
|
|
64
|
+
name: 'Metal Gear Solid 5: The Phantom Pain',
|
|
65
|
+
address:
|
|
66
|
+
'Konami Digital Entertainment Co., Ltd. 1-11-1, Ginza, Chuo-ku, Tokyo, 104-0061 Japan',
|
|
67
|
+
email: 'konami@fakemail.com',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: '2',
|
|
72
|
+
columns: {
|
|
73
|
+
name: 'The Witcher 3',
|
|
74
|
+
address: 'CD PROJEKT S.A. ul. JagielloÅska 74 03-301 Warszawa Poland',
|
|
75
|
+
email: 'cdprojekt@fakemail.com',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: '3',
|
|
80
|
+
isDisabled: true,
|
|
81
|
+
columns: {
|
|
82
|
+
name: 'Tekken 8',
|
|
83
|
+
address:
|
|
84
|
+
'Bandai Namco Studios Inc. ; Address: 2-37-25 Eitai, Koto-ku, Tokyo 135-0034, Japan',
|
|
85
|
+
email: 'namco@fakemail.com',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
parameters: figmaPrimaryDesign,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const NoSorting: Story = {
|
|
36
94
|
args: {
|
|
37
95
|
variant: 'primary',
|
|
38
96
|
summary: 'Videogames companies contact information',
|
|
@@ -40,18 +98,23 @@ export const Primary: Story = {
|
|
|
40
98
|
{
|
|
41
99
|
label: 'Game title',
|
|
42
100
|
icon: 'Info',
|
|
101
|
+
columnId: 'name',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: 'Company address',
|
|
105
|
+
icon: 'Info',
|
|
106
|
+
columnId: 'address',
|
|
43
107
|
},
|
|
44
|
-
{ label: 'Company address' },
|
|
45
108
|
{
|
|
46
109
|
label: 'Customer service email',
|
|
110
|
+
columnId: 'email',
|
|
47
111
|
icon: 'Info',
|
|
48
112
|
},
|
|
49
113
|
],
|
|
50
114
|
rows: [
|
|
51
115
|
{
|
|
52
116
|
id: '1',
|
|
53
|
-
|
|
54
|
-
data: {
|
|
117
|
+
columns: {
|
|
55
118
|
name: 'Metal Gear Solid 5: The Phantom Pain',
|
|
56
119
|
address:
|
|
57
120
|
'Konami Digital Entertainment Co., Ltd. 1-11-1, Ginza, Chuo-ku, Tokyo, 104-0061 Japan',
|
|
@@ -60,8 +123,7 @@ export const Primary: Story = {
|
|
|
60
123
|
},
|
|
61
124
|
{
|
|
62
125
|
id: '2',
|
|
63
|
-
|
|
64
|
-
data: {
|
|
126
|
+
columns: {
|
|
65
127
|
name: 'The Witcher 3',
|
|
66
128
|
address: 'CD PROJEKT S.A. ul. JagielloÅska 74 03-301 Warszawa Poland',
|
|
67
129
|
email: 'cdprojekt@fakemail.com',
|
|
@@ -70,7 +132,7 @@ export const Primary: Story = {
|
|
|
70
132
|
{
|
|
71
133
|
id: '3',
|
|
72
134
|
isDisabled: true,
|
|
73
|
-
|
|
135
|
+
columns: {
|
|
74
136
|
name: 'Tekken 8',
|
|
75
137
|
address:
|
|
76
138
|
'Bandai Namco Studios Inc. ; Address: 2-37-25 Eitai, Koto-ku, Tokyo 135-0034, Japan',
|
|
@@ -3,6 +3,18 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
3
3
|
<Meta title="Changelog" />
|
|
4
4
|
# Changelog
|
|
5
5
|
|
|
6
|
+
## 0.2.1
|
|
7
|
+
|
|
8
|
+
- Colors have been updated due to accessibility issues.
|
|
9
|
+
|
|
10
|
+
## 0.2.0
|
|
11
|
+
|
|
12
|
+
- Sorting has been added to the CardsTableList component.
|
|
13
|
+
|
|
14
|
+
BREAKING CHANGES
|
|
15
|
+
- `columnId` prop is required from this version.
|
|
16
|
+
- rows `data` prop has been renamed to `columns`.
|
|
17
|
+
|
|
6
18
|
## 0.1.3
|
|
7
19
|
|
|
8
20
|
Update left padding on the cells from CardsTableList component
|
|
@@ -5,6 +5,11 @@ import * as Icons from '../icons'
|
|
|
5
5
|
|
|
6
6
|
# Icons
|
|
7
7
|
|
|
8
|
+
đ You can find the source icons on this [link]( https://drive.google.com/drive/folders/16L5iR5KnDP9kfeCF-mDU0C0LiJZi0cwi).
|
|
9
|
+
|
|
10
|
+
âšī¸ If you need to edit the svgo default options, check this [link](https://stackoverflow.com/a/70360615).
|
|
11
|
+
|
|
12
|
+
|
|
8
13
|
<IconGallery>
|
|
9
14
|
{
|
|
10
15
|
Object.values(Icons).map((Icon) => {
|
|
@@ -3,4 +3,36 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
3
3
|
<Meta title="Programmers start guide" />
|
|
4
4
|
# Getting started guide for programmers
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Indigo Project
|
|
7
|
+
|
|
8
|
+
### Install agroptima-design-system dependency
|
|
9
|
+
|
|
10
|
+
On the frontend project's package.json, you can see the `agroptima-design-system` dependency.
|
|
11
|
+
|
|
12
|
+
After installing all the project dependencies, run `npm i agroptima-design-system@latest` to have the latest version
|
|
13
|
+
of the design sytem package.
|
|
14
|
+
|
|
15
|
+
### Import & use design system components
|
|
16
|
+
|
|
17
|
+
Import the desired component:
|
|
18
|
+
|
|
19
|
+
`import { Input } from 'agroptima-design-system/src/atoms/Button'`
|
|
20
|
+
|
|
21
|
+
Use the desired component:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
<Button
|
|
25
|
+
type="submit"
|
|
26
|
+
label="Login"
|
|
27
|
+
loading={isSubmitting}
|
|
28
|
+
variant="primary"
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Sioux Project
|
|
34
|
+
|
|
35
|
+
We have been focused on creating prioritized components, learning how Storybook works and behaves, making the Design System independent
|
|
36
|
+
from the Indigo project and checking the consumption of components from a single project.
|
|
37
|
+
|
|
38
|
+
Once we reach the needed checkpoint, we'll continue the integration of the Design System with Sioux project.
|
|
@@ -15,8 +15,8 @@ const meta = {
|
|
|
15
15
|
disabled: {
|
|
16
16
|
description: 'Is the select in disabled state?',
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
description: 'Is the select in
|
|
18
|
+
invalid: {
|
|
19
|
+
description: 'Is the select in disabled state?',
|
|
20
20
|
},
|
|
21
21
|
helpText: {
|
|
22
22
|
description: 'Optional help text',
|
|
@@ -47,7 +47,7 @@ export const Primary: Story = {
|
|
|
47
47
|
args: {
|
|
48
48
|
variant: 'primary',
|
|
49
49
|
disabled: false,
|
|
50
|
-
|
|
50
|
+
invalid: false,
|
|
51
51
|
helpText: 'This text can help you',
|
|
52
52
|
name: 'example',
|
|
53
53
|
label: 'Videogames',
|
|
@@ -31,3 +31,7 @@ If you have any questions, proposals, needs or issues, don't hesitate to contact
|
|
|
31
31
|
|
|
32
32
|
## How to report issues
|
|
33
33
|
|
|
34
|
+
You can report an issue on the [Issues section](https://github.com/agroptima/design-system/issues) of the design system repo.
|
|
35
|
+
|
|
36
|
+
Contact with the responsibles of the project to make them aware of the reported issue.
|
|
37
|
+
|
|
@@ -3,6 +3,14 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
3
3
|
<Meta title="Component creation workflow" />
|
|
4
4
|
# Component creation workflow
|
|
5
5
|
|
|
6
|
+
## Style properties conditioned by variants
|
|
7
|
+
|
|
8
|
+
The following properties are the ones which will change depending on the variant provided:
|
|
9
|
+
|
|
10
|
+
- Font family
|
|
11
|
+
- Border radius
|
|
12
|
+
- Colours: Except Error and Success variants colours which are common for all themes
|
|
13
|
+
|
|
6
14
|
## How does the Design Team work
|
|
7
15
|
|
|
8
16
|
đ <b>The Figma design system is the only source of truth and the collaboration, teamwork and regard among
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Order, Row } from '../atoms/CardsTableList'
|
|
2
|
+
|
|
3
|
+
interface Parse {
|
|
4
|
+
(x: string): string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Sort {
|
|
8
|
+
rows: Row[]
|
|
9
|
+
prop: string
|
|
10
|
+
order: string
|
|
11
|
+
parse?: Parse
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function sortBy({
|
|
15
|
+
rows,
|
|
16
|
+
prop,
|
|
17
|
+
order = Order.Ascending,
|
|
18
|
+
parse = (x) => x,
|
|
19
|
+
}: Sort) {
|
|
20
|
+
const sortOrder = order === Order.Descending ? -1 : 1
|
|
21
|
+
return rows.sort((a: Row, b: Row) => {
|
|
22
|
+
let result = 0
|
|
23
|
+
if (parse(a.columns[prop]) < parse(b.columns[prop])) {
|
|
24
|
+
result = -1
|
|
25
|
+
}
|
|
26
|
+
if (parse(a.columns[prop]) > parse(b.columns[prop])) {
|
|
27
|
+
result = 1
|
|
28
|
+
}
|
|
29
|
+
return result * sortOrder
|
|
30
|
+
})
|
|
31
|
+
}
|