@sats-group/ui-lib 79.1.0 → 80.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.
- package/package.json +3 -3
- package/react/banner/banner.tsx +5 -5
- package/react/icons/16/add.tsx +13 -0
- package/react/icons/16/error.tsx +23 -0
- package/react/icons/16/fistbump.tsx +13 -0
- package/react/icons/16/info.tsx +17 -0
- package/react/icons/16/send.tsx +13 -0
- package/react/icons/18/arrow-down.tsx +13 -0
- package/react/icons/18/confirm.tsx +19 -0
- package/react/icons/18/error.tsx +23 -0
- package/react/icons/18/info.tsx +17 -0
- package/react/icons/18/warning-sign.tsx +23 -0
- package/react/message-field/message-field.tsx +2 -2
- package/react/select/select.scss +14 -13
- package/react/select/select.tsx +64 -57
- package/react/select/select.types.ts +2 -1
- package/react/style.scss +33 -0
- package/react/text-input/text-input.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sats-group/ui-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "80.0.0",
|
|
4
4
|
"description": "SATS web user interface library",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18 || ^20",
|
|
7
7
|
"npm": "^8 || ^9 || ^10"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "run-s clean logos typecheck colour components",
|
|
10
|
+
"build": "run-s clean logos typecheck colour components style-imports",
|
|
11
11
|
"clean": "node rimraf.mjs",
|
|
12
12
|
"colour": "node codegen/colours.mjs",
|
|
13
13
|
"components": "node codegen/components.mjs",
|
|
14
|
+
"style-imports": "node codegen/style-imports.mjs",
|
|
14
15
|
"dev": "npm run dev --workspace=site",
|
|
15
16
|
"lint": "eslint",
|
|
16
17
|
"lint:ci": "eslint --max-warnings 0",
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
"author": "developer@sats.no",
|
|
25
26
|
"license": "UNLICENSED",
|
|
26
27
|
"peerDependencies": {
|
|
27
|
-
"@sats-group/icons": "^10.0.0",
|
|
28
28
|
"classnames": "^2.5.1",
|
|
29
29
|
"react": "^18.0.0 || ^19.0.0",
|
|
30
30
|
"react-dom": "^18.0.0 || ^19.0.0"
|
package/react/banner/banner.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import Close from '@sats-group/icons/18/close';
|
|
2
|
-
import Confirm from '@sats-group/icons/18/confirm';
|
|
3
|
-
import Error from '@sats-group/icons/18/error';
|
|
4
|
-
import Info from '@sats-group/icons/18/info';
|
|
5
|
-
import WarningSign from '@sats-group/icons/18/warning-sign';
|
|
6
1
|
import cn from 'classnames';
|
|
7
2
|
import React, { useState } from 'react';
|
|
8
3
|
|
|
9
4
|
import Text from '../text';
|
|
10
5
|
import VisuallyHidden from '../visually-hidden';
|
|
6
|
+
import Error from '../icons/18/error';
|
|
7
|
+
import Info from '../icons/18/info';
|
|
8
|
+
import Confirm from '../icons/18/confirm';
|
|
9
|
+
import WarningSign from '../icons/18/warning-sign';
|
|
10
|
+
import Close from '../icons/18/close';
|
|
11
11
|
|
|
12
12
|
import type { Banner as Props } from './banner.types';
|
|
13
13
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgAdd = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 16, height: 16, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M8 2.833a.5.5 0 0 1 .5.5V7.5h4.167a.5.5 0 0 1 0 1H8.5v4.167a.5.5 0 0 1-1 0V8.5H3.333a.5.5 0 0 1 0-1H7.5V3.333a.5.5 0 0 1 .5-.5',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
export default SvgAdd;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgError = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 16, height: 16, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M4.885.98A.5.5 0 0 1 5.24.833h5.522a.5.5 0 0 1 .354.147l3.905 3.905a.5.5 0 0 1 .147.354v5.522a.5.5 0 0 1-.147.354l-3.905 3.905a.5.5 0 0 1-.354.147H5.24a.5.5 0 0 1-.354-.147L.98 11.115a.5.5 0 0 1-.147-.354V5.24a.5.5 0 0 1 .147-.354zm.561.853L1.834 5.447v5.108l3.612 3.613h5.108l3.613-3.613V5.446l-3.613-3.612z',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
13
|
+
fill: 'currentColor',
|
|
14
|
+
fillRule: 'evenodd',
|
|
15
|
+
d: 'M8.007 4.5c.507.005.9.444.848.948l-.33 3.16a.528.528 0 0 1-1.05 0l-.328-3.16a.86.86 0 0 1 .86-.947',
|
|
16
|
+
clipRule: 'evenodd',
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
19
|
+
fill: 'currentColor',
|
|
20
|
+
d: 'M8 11.637a.606.606 0 1 0 0-1.213.606.606 0 0 0 0 1.213',
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
export default SvgError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgFistbump = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 16, height: 16, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M2.29 2.934a2.7 2.7 0 0 1 1.892-.767h7.636c.708 0 1.389.274 1.893.767A2.6 2.6 0 0 1 14.5 4.8v6.933c0 .561-.228 1.096-.63 1.49a2.15 2.15 0 0 1-1.506.61H9.09a2.7 2.7 0 0 1-1.892-.767 2.6 2.6 0 0 1-.79-1.866v-.047a1.88 1.88 0 0 1-1.21-.654 2.15 2.15 0 0 1-1.563.668 2.16 2.16 0 0 1-1.506-.611 2.08 2.08 0 0 1-.63-1.49V4.8c0-.702.285-1.373.79-1.866m3.483 6.141v.258c0 .218.088.428.249.586a.88.88 0 0 0 .948.183.9.9 0 0 0 .281-.183.83.83 0 0 0 .249-.586v-2.32a.5.5 0 0 1 1 0v2.32c0 .218.088.428.249.586a.88.88 0 0 0 .615.248.88.88 0 0 0 .614-.248.82.82 0 0 0 .25-.586v-2.4a.5.5 0 1 1 1 0v2.134c0 .288.116.566.328.774.212.207.503.326.808.326s.595-.119.807-.326.329-.486.329-.774V4.8c0-.43-.174-.844-.489-1.151a1.7 1.7 0 0 0-1.193-.482H4.182c-.45 0-.879.174-1.193.482A1.6 1.6 0 0 0 2.5 4.8v4.267c0 .288.117.566.329.774.212.207.502.326.807.326s.596-.119.808-.326c.21-.206.327-.483.329-.769V6.933a.5.5 0 1 1 1 0v2.142m7.727 1.77a2.164 2.164 0 0 1-2.698-.346q-.059.07-.125.135a1.88 1.88 0 0 1-1.313.533A1.88 1.88 0 0 1 8 10.583a1.9 1.9 0 0 1-.59.419v.198c0 .43.173.844.488 1.151.314.308.743.482 1.193.482h3.273c.305 0 .595-.118.807-.326.212-.207.329-.486.329-.774z',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
export default SvgFistbump;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgInfo = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 16, height: 16, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M1.926 8a6.074 6.074 0 1 0 12.148 0A6.074 6.074 0 0 0 1.926 8M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
13
|
+
fill: 'currentColor',
|
|
14
|
+
d: 'M8.523 11.038v-3.61a.588.588 0 1 0-1.176 0v3.61a.588.588 0 0 0 1.176 0M7.935 5.854a.74.74 0 1 0 0-1.48.74.74 0 0 0 0 1.48',
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
17
|
+
export default SvgInfo;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgSend = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 16, height: 16, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M13.834 2.107c.13.108.19.279.157.445L11.776 13.63a.46.46 0 0 1-.73.279L7.37 11.15l-1.784 2.13a.462.462 0 0 1-.816-.295V9.2L2.185 7.262a.462.462 0 0 1 .105-.798l11.077-4.431a.46.46 0 0 1 .467.074M5.692 9.892v1.822l.937-1.119zm.382-.868 6.763-5.41-1.823 9.116zm4.744-4.977L5.311 8.452 3.395 7.016z',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
export default SvgSend;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgArrowDown = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 18, height: 18, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M4.826 6.7a.6.6 0 0 1 .848 0L9 10.028 12.326 6.7a.6.6 0 1 1 .848.848l-3.75 3.75a.6.6 0 0 1-.848 0l-3.75-3.75a.6.6 0 0 1 0-.848',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
);
|
|
13
|
+
export default SvgArrowDown;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgConfirm = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 18, height: 18, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M12.712 6.682a.525.525 0 0 1 0 .743L7.886 12.25 5.288 9.652a.525.525 0 0 1 .742-.742l1.856 1.856 4.084-4.084a.525.525 0 0 1 .742 0',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
13
|
+
fill: 'currentColor',
|
|
14
|
+
fillRule: 'evenodd',
|
|
15
|
+
d: 'M2.926 9a6.074 6.074 0 1 0 12.148 0A6.074 6.074 0 0 0 2.926 9M9 2a7 7 0 1 0 0 14A7 7 0 0 0 9 2',
|
|
16
|
+
clipRule: 'evenodd',
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
export default SvgConfirm;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgError = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 18, height: 18, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M5.496 1.102a.56.56 0 0 1 .398-.165h6.212c.15 0 .293.06.398.165l4.394 4.394a.56.56 0 0 1 .165.398v6.212c0 .15-.06.293-.165.398l-4.394 4.394a.56.56 0 0 1-.398.165H5.894a.56.56 0 0 1-.398-.165l-4.394-4.394a.56.56 0 0 1-.165-.398V5.894c0-.15.06-.293.165-.398zm.63.96L2.063 6.128v5.746l4.065 4.065h5.746l4.065-4.065V6.127l-4.065-4.064z',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
13
|
+
fill: 'currentColor',
|
|
14
|
+
fillRule: 'evenodd',
|
|
15
|
+
d: 'M9.008 5.063a.966.966 0 0 1 .953 1.066l-.37 3.556a.594.594 0 0 1-1.182 0L8.04 6.129a.966.966 0 0 1 .968-1.066',
|
|
16
|
+
clipRule: 'evenodd',
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
19
|
+
fill: 'currentColor',
|
|
20
|
+
d: 'M9 13.09a.682.682 0 1 0 0-1.363.682.682 0 0 0 0 1.364',
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
export default SvgError;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgInfo = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 18, height: 18, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
fillRule: 'evenodd',
|
|
9
|
+
d: 'M2.059 9A6.941 6.941 0 1 0 15.94 9 6.941 6.941 0 0 0 2.06 9M9 1a8 8 0 1 0 0 16A8 8 0 0 0 9 1',
|
|
10
|
+
clipRule: 'evenodd',
|
|
11
|
+
}),
|
|
12
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
13
|
+
fill: 'currentColor',
|
|
14
|
+
d: 'M9.598 12.472V8.347a.672.672 0 0 0-1.344 0v4.125a.672.672 0 0 0 1.344 0M8.926 6.547a.846.846 0 1 0 0-1.691.846.846 0 0 0 0 1.691',
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
17
|
+
export default SvgInfo;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
const SvgWarningSign = () =>
|
|
3
|
+
/* @__PURE__ */ React.createElement(
|
|
4
|
+
'svg',
|
|
5
|
+
{ width: 18, height: 18, fill: 'none' },
|
|
6
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
7
|
+
fill: 'currentColor',
|
|
8
|
+
d: 'M9.002 13.896c.377 0 .682-.32.682-.714 0-.395-.305-.715-.682-.715s-.682.32-.682.715.305.714.682.714',
|
|
9
|
+
}),
|
|
10
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
11
|
+
fill: 'currentColor',
|
|
12
|
+
fillRule: 'evenodd',
|
|
13
|
+
d: 'M9.247 6.565a.75.75 0 0 1 .74.828l-.394 3.792a.594.594 0 0 1-1.182 0l-.394-3.796a.75.75 0 0 1 .752-.827z',
|
|
14
|
+
clipRule: 'evenodd',
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ React.createElement('path', {
|
|
17
|
+
fill: 'currentColor',
|
|
18
|
+
fillRule: 'evenodd',
|
|
19
|
+
d: 'M15.513 17.041c.263.002.522-.068.75-.202.23-.134.422-.328.559-.563a1.65 1.65 0 0 0 .046-1.568L10.355 1.812a1.6 1.6 0 0 0-.564-.623 1.48 1.48 0 0 0-1.578 0c-.239.15-.434.366-.564.623L1.136 14.708a1.65 1.65 0 0 0 .045 1.567c.137.235.328.429.557.563s.487.204.75.203zM2.141 15.213a.53.53 0 0 0 .014.498.43.43 0 0 0 .152.157.34.34 0 0 0 .175.048h13.039a.34.34 0 0 0 .175-.048.43.43 0 0 0 .153-.157.52.52 0 0 0 .014-.497v-.001L9.35 2.319a.45.45 0 0 0-.159-.179.35.35 0 0 0-.189-.056.35.35 0 0 0-.19.056.45.45 0 0 0-.158.18z',
|
|
20
|
+
clipRule: 'evenodd',
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
export default SvgWarningSign;
|
|
@@ -3,8 +3,8 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import { MessageField as Props, variants, sizes } from './message-field.types';
|
|
4
4
|
import Button from '../button';
|
|
5
5
|
import TextArea from '../text-area';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import Add from '../icons/16/add';
|
|
7
|
+
import Send from '../icons/16/send';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
|
|
10
10
|
const MessageField: React.FunctionComponent<Props> & {
|
package/react/select/select.scss
CHANGED
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
@use '../../tokens/font-sizes';
|
|
5
5
|
|
|
6
6
|
.select {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
&__content {
|
|
8
|
+
&--position-inline {
|
|
9
|
+
align-items: center;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
gap: spacing.$xs;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
&--position-stacked {
|
|
17
|
+
display: grid;
|
|
18
|
+
gap: spacing.$xxs;
|
|
19
|
+
justify-items: start;
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
// NOTE: Specificity hack
|
|
@@ -53,7 +55,6 @@
|
|
|
53
55
|
border: 1px solid light.$ge-border-default;
|
|
54
56
|
display: block;
|
|
55
57
|
position: relative;
|
|
56
|
-
width: 100%;
|
|
57
58
|
border-radius: corner-radius.$s;
|
|
58
59
|
padding-right: 36px; // NOTE: custom spacing to offset chevron overlap
|
|
59
60
|
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
margin-left: spacing.$xs;
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
&__label {
|
|
113
|
+
&__label-text {
|
|
113
114
|
display: flex;
|
|
114
115
|
flex-direction: row;
|
|
115
116
|
}
|
package/react/select/select.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import useInputValidation from '../use-input-validation';
|
|
|
5
5
|
|
|
6
6
|
import Option from '../select-option/select-option';
|
|
7
7
|
import Text from '../text';
|
|
8
|
-
import SvgArrowDown from '
|
|
8
|
+
import SvgArrowDown from '../icons/18/arrow-down';
|
|
9
9
|
|
|
10
10
|
import { labelPositions, Select as Props, variants } from './select.types';
|
|
11
11
|
|
|
@@ -18,6 +18,7 @@ const RefSelect = React.forwardRef<
|
|
|
18
18
|
{
|
|
19
19
|
children,
|
|
20
20
|
className,
|
|
21
|
+
id,
|
|
21
22
|
isLabelVisible = true,
|
|
22
23
|
label,
|
|
23
24
|
labelPosition = labelPositions.stacked,
|
|
@@ -39,66 +40,71 @@ const RefSelect = React.forwardRef<
|
|
|
39
40
|
validationOnChange(e);
|
|
40
41
|
};
|
|
41
42
|
|
|
43
|
+
const asterix = required ? (
|
|
44
|
+
<span className="select__asterisk">*</span>
|
|
45
|
+
) : null;
|
|
46
|
+
|
|
42
47
|
return (
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
<div className={cn('select', className, { 'select--error': error })}>
|
|
49
|
+
<div
|
|
50
|
+
className={`select__content select__content--position-${labelPosition}`}
|
|
51
|
+
>
|
|
52
|
+
{isLabelVisible ? (
|
|
53
|
+
<label className="select__label" htmlFor={id}>
|
|
54
|
+
{label || children ? (
|
|
55
|
+
<div className="select__label-text">
|
|
56
|
+
<Text
|
|
57
|
+
size={
|
|
58
|
+
variant === variants.small
|
|
59
|
+
? Text.sizes.small
|
|
60
|
+
: Text.sizes.basic
|
|
61
|
+
}
|
|
62
|
+
theme={Text.themes.emphasis}
|
|
63
|
+
>
|
|
64
|
+
{label}
|
|
65
|
+
</Text>
|
|
66
|
+
{asterix}
|
|
67
|
+
{children}
|
|
68
|
+
</div>
|
|
69
|
+
) : required ? (
|
|
70
|
+
asterix
|
|
71
|
+
) : null}
|
|
72
|
+
</label>
|
|
73
|
+
) : null}
|
|
74
|
+
|
|
75
|
+
<div className="select__native-wrapper">
|
|
76
|
+
<select
|
|
77
|
+
aria-label={isLabelVisible ? undefined : label}
|
|
78
|
+
className={`select__select select__select--variant-${variant}`}
|
|
79
|
+
id={id}
|
|
80
|
+
name={name}
|
|
81
|
+
onChange={onInputChange}
|
|
82
|
+
onInvalid={e => {
|
|
83
|
+
// NOTE: To not break compatibility
|
|
84
|
+
if (restProps.onInvalid) restProps.onInvalid(e);
|
|
85
|
+
onInvalid(e);
|
|
86
|
+
}}
|
|
87
|
+
ref={ref}
|
|
88
|
+
required={required}
|
|
89
|
+
{...restProps}
|
|
58
90
|
>
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
91
|
+
{options.map(option => (
|
|
92
|
+
<Option key={option.value} {...option} />
|
|
93
|
+
))}
|
|
94
|
+
</select>
|
|
95
|
+
<span className="select__chevron">
|
|
96
|
+
<SvgArrowDown />
|
|
97
|
+
</span>
|
|
63
98
|
</div>
|
|
64
|
-
) : required ? (
|
|
65
|
-
<span className="select__asterisk">*</span>
|
|
66
|
-
) : null}
|
|
67
99
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
className=
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
name={name}
|
|
75
|
-
ref={ref}
|
|
76
|
-
onChange={onInputChange}
|
|
77
|
-
required={required}
|
|
78
|
-
onInvalid={e => {
|
|
79
|
-
// NOTE: To not break compatibility
|
|
80
|
-
if (restProps.onInvalid) restProps.onInvalid(e);
|
|
81
|
-
onInvalid(e);
|
|
82
|
-
}}
|
|
83
|
-
aria-label={isLabelVisible ? undefined : label}
|
|
84
|
-
{...restProps}
|
|
85
|
-
>
|
|
86
|
-
{options.map(option => (
|
|
87
|
-
<Option key={option.value} {...option} />
|
|
88
|
-
))}
|
|
89
|
-
</select>
|
|
90
|
-
<span className="select__chevron">
|
|
91
|
-
<SvgArrowDown />
|
|
92
|
-
</span>
|
|
100
|
+
{/* NOTE: This is aria-hidden because reporting of validation errors is handled by the browser */}
|
|
101
|
+
{error ? (
|
|
102
|
+
<div aria-hidden="true" className="select__error">
|
|
103
|
+
{error}
|
|
104
|
+
</div>
|
|
105
|
+
) : null}
|
|
93
106
|
</div>
|
|
94
|
-
|
|
95
|
-
{/* NOTE: This is aria-hidden because reporting of validation errors is handled by the browser */}
|
|
96
|
-
{error && (
|
|
97
|
-
<div aria-hidden="true" className="select__error">
|
|
98
|
-
{error}
|
|
99
|
-
</div>
|
|
100
|
-
)}
|
|
101
|
-
</label>
|
|
107
|
+
</div>
|
|
102
108
|
);
|
|
103
109
|
},
|
|
104
110
|
);
|
|
@@ -114,7 +120,8 @@ const SelectComponent = RefSelect as <OptionExtra>(
|
|
|
114
120
|
) => React.ReactElement;
|
|
115
121
|
|
|
116
122
|
const Select: typeof SelectComponent & {
|
|
123
|
+
labelPositions: typeof labelPositions;
|
|
117
124
|
variants: typeof variants;
|
|
118
|
-
} = Object.assign(SelectComponent, { variants });
|
|
125
|
+
} = Object.assign(SelectComponent, { labelPositions, variants });
|
|
119
126
|
|
|
120
127
|
export default Select;
|
|
@@ -10,10 +10,11 @@ export const labelPositions = {
|
|
|
10
10
|
export const variants = {
|
|
11
11
|
small: 'small',
|
|
12
12
|
large: 'large',
|
|
13
|
-
};
|
|
13
|
+
} as const;
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
export type Select<OptionExtra = any> = {
|
|
17
|
+
id: string;
|
|
17
18
|
isLabelVisible?: boolean;
|
|
18
19
|
label?: string;
|
|
19
20
|
labelPosition?: ObjectValues<typeof labelPositions>;
|
package/react/style.scss
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@use "./badge/badge.scss";
|
|
2
|
+
@use "./banner/banner.scss";
|
|
3
|
+
@use "./bomb/bomb.scss";
|
|
4
|
+
@use "./checkbox/checkbox.scss";
|
|
5
|
+
@use "./chip/chip.scss";
|
|
6
|
+
@use "./chip-selected/chip-selected.scss";
|
|
7
|
+
@use "./confirmation/confirmation.scss";
|
|
8
|
+
@use "./context-menu/context-menu.scss";
|
|
9
|
+
@use "./cropped-image/cropped-image.scss";
|
|
10
|
+
@use "./dropdown-list/dropdown-list.scss";
|
|
11
|
+
@use "./expander/expander.scss";
|
|
12
|
+
@use "./filter/filter.scss";
|
|
13
|
+
@use "./filter-wrapper/filter-wrapper.scss";
|
|
14
|
+
@use "./flag/flag.scss";
|
|
15
|
+
@use "./form-content/form-content.scss";
|
|
16
|
+
@use "./link/link.scss";
|
|
17
|
+
@use "./link-card/link-card.scss";
|
|
18
|
+
@use "./message/message.scss";
|
|
19
|
+
@use "./message-field/message-field.scss";
|
|
20
|
+
@use "./modal/modal.scss";
|
|
21
|
+
@use "./progress-bar/progress-bar.scss";
|
|
22
|
+
@use "./radio/radio.scss";
|
|
23
|
+
@use "./scale-bar/scale-bar.scss";
|
|
24
|
+
@use "./search/search.scss";
|
|
25
|
+
@use "./select/select.scss";
|
|
26
|
+
@use "./tag/tag.scss";
|
|
27
|
+
@use "./text/text.scss";
|
|
28
|
+
@use "./text-area/text-area.scss";
|
|
29
|
+
@use "./text-input/text-input.scss";
|
|
30
|
+
@use "./toggle/toggle.scss";
|
|
31
|
+
@use "./toolbox/toolbox.scss";
|
|
32
|
+
@use "./visually-button/visually-button.scss";
|
|
33
|
+
@use "./visually-hidden/visually-hidden.scss";
|
|
@@ -3,11 +3,11 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import Text from '../text';
|
|
5
5
|
import useInputValidation from '../use-input-validation';
|
|
6
|
+
import SvgInfo from '../icons/16/info';
|
|
7
|
+
import SvgError from '../icons/16/error';
|
|
6
8
|
|
|
7
9
|
import { themes, variants, TextInput as Props } from './text-input.types';
|
|
8
10
|
import { useEffect } from 'react';
|
|
9
|
-
import SvgError from '@sats-group/icons/16/error';
|
|
10
|
-
import SvgInfo from '@sats-group/icons/16/info';
|
|
11
11
|
|
|
12
12
|
const RefTextInput = React.forwardRef<HTMLInputElement, Props>(
|
|
13
13
|
(
|