@sats-group/ui-lib 74.2.0 → 75.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sats-group/ui-lib",
3
- "version": "74.2.0",
3
+ "version": "75.0.0",
4
4
  "description": "SATS web user interface library",
5
5
  "engines": {
6
6
  "node": "^18 || ^20",
@@ -23,6 +23,7 @@
23
23
  "author": "developer@sats.no",
24
24
  "license": "UNLICENSED",
25
25
  "peerDependencies": {
26
+ "@sats-group/icons": "^8.0.0",
26
27
  "classnames": "^2.5.1",
27
28
  "react": "^18.0.0",
28
29
  "react-dom": "^18.0.0"
@@ -1,6 +1,7 @@
1
1
  @use '../../tokens/corner-radius';
2
2
  @use '../../tokens/light';
3
3
  @use '../../tokens/spacing';
4
+ @use '../../tokens/font-sizes';
4
5
 
5
6
  .select {
6
7
  display: flex;
@@ -35,44 +36,25 @@
35
36
  &__chevron {
36
37
  color: light.$on-surface-primary-default;
37
38
  position: absolute;
38
- right: 13px;
39
+ right: clamp(spacing.$s, 2vw, spacing.$m);
39
40
  top: 50%;
40
41
  transform: translateY(-50%);
41
42
  pointer-events: none;
42
- }
43
-
44
- &__icon {
45
- color: light.$on-surface-primary-default;
46
- position: absolute;
47
- left: 13px;
48
- top: 50%;
49
- width: 20px;
50
- transform: translateY(-50%);
51
-
52
- svg {
53
- display: block;
54
- max-width: 100%;
55
- height: auto;
56
- }
57
- }
58
-
59
- :root &--icon {
60
- select {
61
- padding-left: 40px; // NOTE: Space for icon
62
- }
43
+ display: flex;
44
+ align-items: center
63
45
  }
64
46
 
65
47
  select {
48
+ @include font-sizes.normal(basic);
66
49
  color: light.$on-surface-primary-default;
67
50
  appearance: none;
68
51
  background-color: transparent;
69
52
  border: 1px solid light.$ge-border-default;
70
53
  display: block;
71
- font-size: 16px;
72
- font-family: 'Inter', sans-serif;
73
- line-height: 1.25;
74
- padding: 13px 15px;
75
- padding-right: 35px; // NOTE: Space for chevron icon
54
+ padding-top: clamp(spacing.$xs, 2vw, spacing.$s);
55
+ padding-bottom: clamp(spacing.$xs, 2vw, spacing.$s);
56
+ padding-left: clamp(spacing.$s, 2vw, spacing.$m);
57
+ padding-right: spacing.$l; // NOTE: Space for chevron icon
76
58
  position: relative;
77
59
  width: 100%;
78
60
  border-radius: corner-radius.$s;
@@ -82,11 +64,6 @@
82
64
  &:not(:disabled) {
83
65
  background-color: light.$surface-primary-hover;
84
66
  border-color: light.$surface-primary-hover;
85
-
86
- ~ .select__chevron,
87
- ~ .select__icon {
88
- color: light.$on-surface-primary-default;
89
- }
90
67
  }
91
68
  }
92
69
  }
@@ -95,11 +72,6 @@
95
72
  &:not(:disabled) {
96
73
  background-color: light.$surface-primary-default;
97
74
  border-color: light.$ge-border-focused;
98
-
99
- ~ .select__chevron,
100
- ~ .select__icon {
101
- color: light.$on-surface-primary-default;
102
- }
103
75
  }
104
76
  }
105
77
 
@@ -111,8 +83,7 @@
111
83
  &:disabled {
112
84
  color: light.$on-surface-primary-disabled;
113
85
 
114
- ~ .select__chevron,
115
- ~ .select__icon {
86
+ ~ .select__native-wrapper {
116
87
  color: light.$on-surface-primary-disabled;
117
88
  }
118
89
  }
@@ -3,9 +3,9 @@ import * as React from 'react';
3
3
 
4
4
  import useInputValidation from '../use-input-validation';
5
5
 
6
- import ChevronDown from './chevron-down';
7
6
  import Option from '../select-option/select-option';
8
7
  import Text from '../text';
8
+ import SvgArrowDown from '@sats-group/icons/18/arrow-down';
9
9
 
10
10
  import { labelPositions, Select as Props } from './select.types';
11
11
 
@@ -18,7 +18,6 @@ const RefSelect = React.forwardRef<
18
18
  {
19
19
  children,
20
20
  className,
21
- icon,
22
21
  isLabelVisible = true,
23
22
  label,
24
23
  labelPosition = labelPositions.stacked,
@@ -43,7 +42,6 @@ const RefSelect = React.forwardRef<
43
42
  <label
44
43
  className={cn('select', className, {
45
44
  'select--error': error,
46
- 'select--icon': icon,
47
45
  [`select--label-position-${labelPosition}`]: labelPosition
48
46
  ? labelPositions[labelPosition]
49
47
  : undefined,
@@ -79,8 +77,9 @@ const RefSelect = React.forwardRef<
79
77
  <Option key={option.value} {...option} />
80
78
  ))}
81
79
  </select>
82
- {icon && <div className="select__icon">{icon}</div>}
83
- <ChevronDown className="select__chevron" />
80
+ <span className="select__chevron">
81
+ <SvgArrowDown />
82
+ </span>
84
83
  </div>
85
84
 
86
85
  {/* NOTE: This is aria-hidden because reporting of validation errors is handled by the browser */}
@@ -9,7 +9,6 @@ export const labelPositions = {
9
9
 
10
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
11
  export type Select<OptionExtra = any> = {
12
- icon?: React.ReactNode;
13
12
  isLabelVisible?: boolean;
14
13
  label?: string;
15
14
  labelPosition?: ObjectValues<typeof labelPositions>;
@@ -41,8 +41,8 @@ $headline: (
41
41
  font-weight: bold;
42
42
  text-transform: uppercase;
43
43
  @if map.has-key($headline, $size) {
44
- font-size: map-get(map-get($headline, $size), fallback);
45
- font-size: map-get(map-get($headline, $size), clamp);
44
+ font-size: map.get(map.get($headline, $size), fallback);
45
+ font-size: map.get(map.get($headline, $size), clamp);
46
46
  } @else {
47
47
  @error "Size #{$size} does not exist on Headline.";
48
48
  }
@@ -87,8 +87,8 @@ $normal: (
87
87
  @if map.has-key($normal, $size) {
88
88
  font-family: font-names.$brand, sans-serif;
89
89
  font-weight: normal;
90
- font-size: map-get(map-get($normal, $size), fallback);
91
- font-size: map-get(map-get($normal, $size), clamp);
90
+ font-size: map.get(map.get($normal, $size), fallback);
91
+ font-size: map.get(map.get($normal, $size), clamp);
92
92
  } @else {
93
93
  @error "Size #{$size} does not exist on Normal.";
94
94
  }
@@ -1,24 +0,0 @@
1
- import * as React from 'react';
2
-
3
- const ChevronDown: React.FunctionComponent<{ className?: string }> = ({
4
- className,
5
- }) => (
6
- <svg
7
- width="14"
8
- height="8"
9
- viewBox="0 0 14 8"
10
- fill="none"
11
- xmlns="http://www.w3.org/2000/svg"
12
- className={className}
13
- >
14
- <path
15
- d="M12 1.5L7 6.5L2 1.5"
16
- stroke="currentColor"
17
- strokeWidth="1.8"
18
- strokeMiterlimit="10"
19
- strokeLinecap="square"
20
- />
21
- </svg>
22
- );
23
-
24
- export default ChevronDown;
@@ -1,3 +0,0 @@
1
- # SelectOption
2
-
3
- This component is not intended to be used directly. It is used by `Select` internally but needs to live in a separate folder in order for a TypeScript file to be created for it.