@dhis2/ui-constants 10.16.1 → 10.16.3-alpha.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/package.json +3 -2
- package/src/colors.js +75 -0
- package/src/elevations.js +8 -0
- package/src/index.js +7 -0
- package/src/layers.js +5 -0
- package/src/shared-prop-types.js +146 -0
- package/src/spacers.js +37 -0
- package/src/theme.js +38 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/ui-constants",
|
|
3
|
-
"version": "10.16.1",
|
|
3
|
+
"version": "10.16.3-alpha.1",
|
|
4
4
|
"description": "Constants used in the UI libs",
|
|
5
5
|
"main": "./build/cjs/index.js",
|
|
6
6
|
"module": "./build/es/index.js",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"build",
|
|
34
|
-
"types"
|
|
34
|
+
"types",
|
|
35
|
+
"src"
|
|
35
36
|
],
|
|
36
37
|
"types": "types"
|
|
37
38
|
}
|
package/src/colors.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
/*blue*/
|
|
3
|
+
blue900: '#093371',
|
|
4
|
+
blue800: '#0d47a1',
|
|
5
|
+
blue700: '#1565c0',
|
|
6
|
+
blue600: '#147cd7',
|
|
7
|
+
blue500: '#2196f3',
|
|
8
|
+
blue400: '#42a5f5',
|
|
9
|
+
blue300: '#90caf9',
|
|
10
|
+
blue200: '#c5e3fc',
|
|
11
|
+
blue100: '#e3f2fd',
|
|
12
|
+
blue050: '#f5fbff',
|
|
13
|
+
|
|
14
|
+
/*teal*/
|
|
15
|
+
teal900: '#00332b',
|
|
16
|
+
teal800: '#004d40',
|
|
17
|
+
teal700: '#00695c',
|
|
18
|
+
teal600: '#00796b',
|
|
19
|
+
teal500: '#00897b',
|
|
20
|
+
teal400: '#009688',
|
|
21
|
+
teal300: '#4db6ac',
|
|
22
|
+
teal200: '#b2dfdb',
|
|
23
|
+
teal100: '#e0f2f1',
|
|
24
|
+
teal050: '#f1f9f9',
|
|
25
|
+
|
|
26
|
+
/*red*/
|
|
27
|
+
red900: '#330202',
|
|
28
|
+
red800: '#891515',
|
|
29
|
+
red700: '#b71c1c',
|
|
30
|
+
red600: '#c62828',
|
|
31
|
+
red500: '#d32f2f',
|
|
32
|
+
red400: '#f44336',
|
|
33
|
+
red300: '#e57373',
|
|
34
|
+
red200: '#ffcdd2',
|
|
35
|
+
red100: '#ffe5e8',
|
|
36
|
+
red050: '#fff5f6',
|
|
37
|
+
|
|
38
|
+
/*yellow*/
|
|
39
|
+
yellow900: '#6f3205',
|
|
40
|
+
yellow800: '#bb460d',
|
|
41
|
+
yellow700: '#e56408',
|
|
42
|
+
yellow600: '#ff8302',
|
|
43
|
+
yellow500: '#ff9302',
|
|
44
|
+
yellow400: '#ffa902',
|
|
45
|
+
yellow300: '#ffc324',
|
|
46
|
+
yellow200: '#ffe082',
|
|
47
|
+
yellow100: '#ffecb3',
|
|
48
|
+
yellow050: '#fff8e1',
|
|
49
|
+
|
|
50
|
+
/*green*/
|
|
51
|
+
green900: '#103713',
|
|
52
|
+
green800: '#1b5e20',
|
|
53
|
+
green700: '#2e7d32',
|
|
54
|
+
green600: '#388e3c',
|
|
55
|
+
green500: '#43a047',
|
|
56
|
+
green400: '#4caf50',
|
|
57
|
+
green300: '#a5d6a7',
|
|
58
|
+
green200: '#c8e6c9',
|
|
59
|
+
green100: '#e8f5e9',
|
|
60
|
+
green050: '#f4fbf4',
|
|
61
|
+
|
|
62
|
+
/*grey*/
|
|
63
|
+
grey900: '#212934',
|
|
64
|
+
grey800: '#404b5a',
|
|
65
|
+
grey700: '#4a5768',
|
|
66
|
+
grey600: '#6C7787',
|
|
67
|
+
grey500: '#a0adba',
|
|
68
|
+
grey400: '#d5dde5',
|
|
69
|
+
grey300: '#e8edf2',
|
|
70
|
+
grey200: '#f3f5f7',
|
|
71
|
+
grey100: '#f8f9fa',
|
|
72
|
+
grey050: '#fbfcfd',
|
|
73
|
+
|
|
74
|
+
white: '#ffffff',
|
|
75
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const elevations = {
|
|
2
|
+
e100: '0px 1px 2px rgba(33,41,52,0.06), 0px 1px 3px rgba(33,41,52,0.1)',
|
|
3
|
+
e200: '0px 0px 1px rgba(33,41,52,0.1), 0px 4px 6px -1px rgba(33,41,52,0.1), 0px 2px 4px -1px rgba(33,41,52,0.06)',
|
|
4
|
+
e300: '0px 10px 15px -3px rgba(33,41,52,0.1), 0px 4px 6px -2px rgba(33,41,52,0.05)',
|
|
5
|
+
e400: '0px 25px 50px -12px rgba(33, 41, 52, 0.25)',
|
|
6
|
+
popover:
|
|
7
|
+
'0 4px 12px rgba(12, 14, 16, 0.15), 0 0 0 1px rgba(12, 14, 16, 0.05)',
|
|
8
|
+
}
|
package/src/index.js
ADDED
package/src/layers.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { mutuallyExclusive } from '@dhis2/prop-types'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Status propType
|
|
6
|
+
* @return {PropType} Mutually exclusive status: valid/warning/error
|
|
7
|
+
*/
|
|
8
|
+
export const statusPropType = mutuallyExclusive(
|
|
9
|
+
['valid', 'warning', 'error'],
|
|
10
|
+
PropTypes.bool
|
|
11
|
+
)
|
|
12
|
+
// Exported for storybook
|
|
13
|
+
export const statusArgType = {
|
|
14
|
+
table: {
|
|
15
|
+
type: {
|
|
16
|
+
summary: 'bool',
|
|
17
|
+
detail: "'valid', 'warning', and 'error' are mutually exclusive props",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
control: { type: 'boolean' },
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const buttonVariantArgType =
|
|
24
|
+
// No description because it should be set for the component description
|
|
25
|
+
{
|
|
26
|
+
table: { type: { summary: 'bool' } },
|
|
27
|
+
control: { type: 'boolean' },
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Size variant propType
|
|
32
|
+
* @return {PropType} Mutually exclusive variants:
|
|
33
|
+
* small/large
|
|
34
|
+
*/
|
|
35
|
+
export const sizePropType = mutuallyExclusive(
|
|
36
|
+
['small', 'large', 'extrasmall', 'fluid'],
|
|
37
|
+
PropTypes.bool
|
|
38
|
+
)
|
|
39
|
+
export const sizeArgType = {
|
|
40
|
+
// No description because it should be set in the component description
|
|
41
|
+
table: {
|
|
42
|
+
type: {
|
|
43
|
+
summary: 'bool',
|
|
44
|
+
detail: 'size props are mutually exclusive',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
control: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Inside alignment props
|
|
54
|
+
* @return {PropType} PropType that validates the inside alignment.
|
|
55
|
+
*/
|
|
56
|
+
export const insideAlignmentPropType = PropTypes.oneOf([
|
|
57
|
+
'top',
|
|
58
|
+
'middle',
|
|
59
|
+
'bottom',
|
|
60
|
+
])
|
|
61
|
+
export const insideAlignmentArgType = {
|
|
62
|
+
description: 'Inside alignment of the component',
|
|
63
|
+
table: {
|
|
64
|
+
type: {
|
|
65
|
+
summary: "'top' | 'middle' | 'bottom'",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
control: {
|
|
69
|
+
type: 'select',
|
|
70
|
+
options: ['top', 'middle', 'bottom'],
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Placement properties against reference element
|
|
76
|
+
* @return {PropType} PropType that validates placements.
|
|
77
|
+
*/
|
|
78
|
+
export const popperPlacementPropType = PropTypes.oneOf([
|
|
79
|
+
'auto',
|
|
80
|
+
'auto-start',
|
|
81
|
+
'auto-end',
|
|
82
|
+
'top',
|
|
83
|
+
'top-start',
|
|
84
|
+
'top-end',
|
|
85
|
+
'bottom',
|
|
86
|
+
'bottom-start',
|
|
87
|
+
'bottom-end',
|
|
88
|
+
'right',
|
|
89
|
+
'right-start',
|
|
90
|
+
'right-end',
|
|
91
|
+
'left',
|
|
92
|
+
'left-start',
|
|
93
|
+
'left-end',
|
|
94
|
+
])
|
|
95
|
+
export const popperPlacementArgType = {
|
|
96
|
+
description: 'Placement properties relative to reference element',
|
|
97
|
+
table: {
|
|
98
|
+
type: {
|
|
99
|
+
summary: 'string (one of several)',
|
|
100
|
+
detail: 'see options in menu',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
control: {
|
|
104
|
+
type: 'select',
|
|
105
|
+
options: [
|
|
106
|
+
'auto',
|
|
107
|
+
'auto-start',
|
|
108
|
+
'auto-end',
|
|
109
|
+
'top',
|
|
110
|
+
'top-start',
|
|
111
|
+
'top-end',
|
|
112
|
+
'bottom',
|
|
113
|
+
'bottom-start',
|
|
114
|
+
'bottom-end',
|
|
115
|
+
'right',
|
|
116
|
+
'right-start',
|
|
117
|
+
'right-end',
|
|
118
|
+
'left',
|
|
119
|
+
'left-start',
|
|
120
|
+
'left-end',
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Either a DOM node, React ref or a virtual element
|
|
127
|
+
* @return {PropType} Validate that prop is either a function or an
|
|
128
|
+
* instance of an Element.
|
|
129
|
+
*/
|
|
130
|
+
export const popperReferencePropType = PropTypes.oneOfType([
|
|
131
|
+
// DOM node
|
|
132
|
+
PropTypes.instanceOf(Element),
|
|
133
|
+
// React ref - React.useRef() or React.createRef()
|
|
134
|
+
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
|
135
|
+
// Virtual element
|
|
136
|
+
PropTypes.shape({ getBoundingClientRect: PropTypes.func }),
|
|
137
|
+
])
|
|
138
|
+
export const popperReferenceArgType = {
|
|
139
|
+
description:
|
|
140
|
+
'A reference to the element to position against: either a DOM node, React ref, \
|
|
141
|
+
or an instance of an element',
|
|
142
|
+
table: {
|
|
143
|
+
type: { summary: 'DOM node | React ref | Virtual element' },
|
|
144
|
+
},
|
|
145
|
+
control: { type: null },
|
|
146
|
+
}
|
package/src/spacers.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Number values of the spacer definitions */
|
|
2
|
+
export const spacersNum = {
|
|
3
|
+
dp4: 4,
|
|
4
|
+
dp8: 8,
|
|
5
|
+
dp12: 12,
|
|
6
|
+
dp16: 16,
|
|
7
|
+
dp24: 24,
|
|
8
|
+
dp32: 32,
|
|
9
|
+
dp48: 48,
|
|
10
|
+
dp64: 64,
|
|
11
|
+
dp96: 96,
|
|
12
|
+
dp128: 128,
|
|
13
|
+
dp192: 192,
|
|
14
|
+
dp256: 256,
|
|
15
|
+
dp384: 384,
|
|
16
|
+
dp512: 512,
|
|
17
|
+
dp640: 640,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Pixel values of the spacer definitions */
|
|
21
|
+
export const spacers = {
|
|
22
|
+
dp4: `${spacersNum.dp4}px`,
|
|
23
|
+
dp8: `${spacersNum.dp8}px`,
|
|
24
|
+
dp12: `${spacersNum.dp12}px`,
|
|
25
|
+
dp16: `${spacersNum.dp16}px`,
|
|
26
|
+
dp24: `${spacersNum.dp24}px`,
|
|
27
|
+
dp32: `${spacersNum.dp32}px`,
|
|
28
|
+
dp48: `${spacersNum.dp48}px`,
|
|
29
|
+
dp64: `${spacersNum.dp64}px`,
|
|
30
|
+
dp96: `${spacersNum.dp96}px`,
|
|
31
|
+
dp128: `${spacersNum.dp128}px`,
|
|
32
|
+
dp192: `${spacersNum.dp192}px`,
|
|
33
|
+
dp256: `${spacersNum.dp256}px`,
|
|
34
|
+
dp384: `${spacersNum.dp384}px`,
|
|
35
|
+
dp512: `${spacersNum.dp512}px`,
|
|
36
|
+
dp640: `${spacersNum.dp640}px`,
|
|
37
|
+
}
|
package/src/theme.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { colors } from './colors.js'
|
|
2
|
+
|
|
3
|
+
export const theme = {
|
|
4
|
+
/* theme */
|
|
5
|
+
fonts: 'Roboto, sans-serif',
|
|
6
|
+
|
|
7
|
+
/*primary*/
|
|
8
|
+
primary900: colors.blue900,
|
|
9
|
+
primary800: colors.blue800,
|
|
10
|
+
primary700: colors.blue700,
|
|
11
|
+
primary600: colors.blue600,
|
|
12
|
+
primary500: colors.blue500,
|
|
13
|
+
primary400: colors.blue400,
|
|
14
|
+
primary300: colors.blue300,
|
|
15
|
+
primary200: colors.blue200,
|
|
16
|
+
primary100: colors.blue100,
|
|
17
|
+
primary050: colors.blue050,
|
|
18
|
+
|
|
19
|
+
/*secondary*/
|
|
20
|
+
secondary900: colors.teal900,
|
|
21
|
+
secondary800: colors.teal800,
|
|
22
|
+
secondary700: colors.teal700,
|
|
23
|
+
secondary600: colors.teal600,
|
|
24
|
+
secondary500: colors.teal500,
|
|
25
|
+
secondary400: colors.teal400,
|
|
26
|
+
secondary300: colors.teal300,
|
|
27
|
+
secondary200: colors.teal200,
|
|
28
|
+
secondary100: colors.teal100,
|
|
29
|
+
secondary050: colors.teal050,
|
|
30
|
+
|
|
31
|
+
/*status*/
|
|
32
|
+
default: colors.grey700,
|
|
33
|
+
error: colors.red500,
|
|
34
|
+
valid: colors.blue600,
|
|
35
|
+
warning: colors.yellow500,
|
|
36
|
+
disabled: colors.grey600,
|
|
37
|
+
focus: colors.blue600,
|
|
38
|
+
}
|