@rolemodel/optics 2.1.5 → 2.2.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.
@@ -1,6 +1,6 @@
1
- ## Task
1
+ # Task
2
2
 
3
- [TR #XXX]()
3
+ [OP-XXX](link to ticket)
4
4
 
5
5
  ## Why?
6
6
 
@@ -15,15 +15,24 @@ What changed in this PR?
15
15
  - [ ] Change 2
16
16
  - [ ] ...
17
17
 
18
- ## Sanity Check
18
+ ## Quality Assurance
19
19
 
20
+ Add an X to all that apply like this: [X]
21
+ Cross out all that don't apply with ~~ ~~ around it like ~~this~~
22
+
23
+ - [ ] Have you tagged the PR with the correct labels?
24
+ - [ ] Have you validated the changes?
25
+ - [ ] Have you run linters? (yarn sanity-check)
26
+ - [ ] Have you run prettier?
27
+ - [ ] Have you tried building the css?
28
+ - [ ] Have you tried building storybook?
20
29
  - [ ] Have you updated any usage of changed tokens?
21
- - [ ] Have you updated the docs with any component changes?
22
- - [ ] Have you updated the dependency graph with any component changes?
23
- - [ ] Have you run linters?
24
- - [ ] Have you run prettier?
25
- - [ ] Have you tried building the css?
26
- - [ ] Have you tried building storybook?
30
+ - [ ] Did you add a component?
31
+ - [ ] Have you added it to the dependency graph?
32
+ - [ ] Have you added it to the docs?
33
+ - [ ] Did you update a component?
34
+ - [ ] Have you updated the dependency graph?
35
+ - [ ] Have you updated the docs?
27
36
  - [ ] Do you need to update the package version?
28
37
 
29
38
  ## Screenshots
@@ -18,7 +18,7 @@ jobs:
18
18
  - name: Use Node.js
19
19
  uses: actions/setup-node@v3
20
20
  with:
21
- node-version: '18.x'
21
+ node-version: '24.x'
22
22
  cache: 'npm'
23
23
  - name: Install
24
24
  run: yarn install
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Setup Node
17
17
  uses: actions/setup-node@v3
18
18
  with:
19
- node-version: '18.x'
19
+ node-version: '24.x'
20
20
  registry-url: 'https://registry.npmjs.org'
21
21
  - name: Install 🔧
22
22
  run: | # Install npm packages
@@ -11,7 +11,7 @@ jobs:
11
11
  - uses: actions/checkout@v3
12
12
  - uses: actions/setup-node@v3
13
13
  with:
14
- node-version: '18.x'
14
+ node-version: '24.x'
15
15
  registry-url: 'https://registry.npmjs.org'
16
16
  - run: yarn install --immutable
17
17
  - run: yarn build
@@ -24,7 +24,7 @@ jobs:
24
24
  - uses: actions/checkout@v3
25
25
  - uses: actions/setup-node@v3
26
26
  with:
27
- node-version: '18.x'
27
+ node-version: '24.x'
28
28
  registry-url: https://npm.pkg.github.com/
29
29
  - run: yarn install --immutable
30
30
  - run: yarn build
package/.node-version ADDED
@@ -0,0 +1 @@
1
+ 22.14.0
package/.prettierignore CHANGED
@@ -1,3 +1,4 @@
1
1
  # Tools
2
2
  tools/templates
3
3
  .yarn/*
4
+ optics-design-system.code-workspace
Binary file
@@ -259,7 +259,8 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
259
259
  .form-label,
260
260
  .form-error,
261
261
  .form-hint,
262
- .form-control:not([type='radio'], [type='checkbox']) {
262
+ .form-control:not([type='radio'], [type='checkbox']),
263
+ .segmented-control {
263
264
  grid-column: 1 / 3;
264
265
  }
265
266
  /* stylelint-enable no-descending-specificity */
@@ -14,6 +14,7 @@
14
14
  @import 'modal';
15
15
  @import 'navbar';
16
16
  @import 'pagination';
17
+ @import 'segmented-control';
17
18
  @import 'sidebar';
18
19
  @import 'side_panel';
19
20
  @import 'spinner';
@@ -0,0 +1,135 @@
1
+ .segmented-control {
2
+ --op-input-inner-focus: 0 0 0 var(--op-border-width-large);
3
+ --op-input-focus-primary:
4
+ var(--op-input-inner-focus) var(--op-color-primary-plus-two),
5
+ var(--op-input-outer-focus) var(--op-color-primary-plus-five);
6
+
7
+ /* Public API (customizable component options) */
8
+ --_op-segmented-control-height-small: var(--op-input-height-small);
9
+ --_op-segmented-control-height-medium: var(--op-input-height-medium);
10
+ --_op-segmented-control-height-large: var(--op-input-height-large);
11
+
12
+ --_op-segmented-control-font-small: var(--op-font-x-small);
13
+ --_op-segmented-control-font-medium: var(--op-font-small);
14
+ --_op-segmented-control-font-large: var(--op-font-small);
15
+
16
+ --_op-segmented-control-label-padding-small: var(--op-space-x-small);
17
+ --_op-segmented-control-label-padding-medium: var(--op-space-small);
18
+ --_op-segmented-control-label-padding-large: var(--op-space-small);
19
+
20
+ --_op-segmented-control-label-gap-small: var(--op-space-3x-small);
21
+ --_op-segmented-control-label-gap-medium: var(--op-space-2x-small);
22
+ --_op-segmented-control-label-gap-large: var(--op-space-2x-small);
23
+
24
+ --_op-segmented-control-color-icon-default: var(--op-color-neutral-on-plus-eight-alt);
25
+ --_op-segmented-control-color-icon-active: light-dark(
26
+ var(--op-color-primary-plus-four),
27
+ var(--op-color-primary-minus-six)
28
+ );
29
+
30
+ /* Private API (component option defaults) */
31
+ --__op-segmented-control-height: var(--_op-segmented-control-height-large);
32
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-large);
33
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-large);
34
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-large);
35
+ --__op-segmented-control-color-icon: var(--_op-segmented-control-color-icon-default);
36
+
37
+ position: relative;
38
+ display: grid;
39
+ width: fit-content;
40
+ height: var(--__op-segmented-control-height);
41
+ padding: var(--op-space-2x-small);
42
+ border-radius: var(--op-radius-medium);
43
+ background-color: var(--op-color-neutral-plus-eight);
44
+ box-shadow: var(--op-border-all) var(--op-color-border);
45
+ color: var(--op-color-neutral-on-plus-eight);
46
+ font-size: var(--__op-segmented-control-font-size);
47
+ gap: var(--op-space-2x-small);
48
+ grid-auto-flow: column;
49
+
50
+ &.segmented-control--full-width {
51
+ width: 100%;
52
+ }
53
+
54
+ .icon {
55
+ color: var(--__op-segmented-control-color-icon);
56
+ }
57
+
58
+ .segmented-control__input {
59
+ position: absolute;
60
+ overflow: hidden;
61
+ width: 1px;
62
+ height: 1px;
63
+ padding: 0;
64
+ border-width: 0;
65
+ margin: -1px;
66
+ clip: rect(0, 0, 0, 0);
67
+ white-space: nowrap;
68
+
69
+ /* Selected Option */
70
+ &:checked + .segmented-control__label {
71
+ --__op-segmented-control-color-icon: var(--_op-segmented-control-color-icon-active);
72
+
73
+ background-color: var(--op-color-primary-plus-one);
74
+ color: var(--op-color-primary-on-plus-one);
75
+ }
76
+
77
+ &:focus-visible {
78
+ + .segmented-control__label {
79
+ box-shadow: var(--op-input-focus-primary);
80
+ }
81
+ }
82
+ }
83
+
84
+ .segmented-control__label {
85
+ display: inline-flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ border-radius: var(--op-radius-small);
89
+ gap: var(--__op-segmented-control-label-gap);
90
+ padding-inline: var(--__op-segmented-control-label-padding);
91
+ white-space: nowrap;
92
+
93
+ &:hover {
94
+ background-color: var(--op-color-neutral-plus-five);
95
+ color: var(--op-color-neutral-on-plus-five);
96
+ }
97
+ }
98
+
99
+ /* Size Modifiers */
100
+ &.segmented-control--small {
101
+ --__op-segmented-control-height: var(--_op-segmented-control-height-small);
102
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-small);
103
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-small);
104
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-small);
105
+
106
+ .icon {
107
+ --__op-icon-font-size: var(--_op-icon-font-size-small);
108
+ --__op-icon-optical-size: var(--_op-icon-optical-size-small);
109
+ }
110
+ }
111
+
112
+ &.segmented-control--medium {
113
+ --__op-segmented-control-height: var(--_op-segmented-control-height-medium);
114
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-medium);
115
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-medium);
116
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-medium);
117
+
118
+ .icon {
119
+ --__op-icon-font-size: var(--_op-icon-font-size-medium);
120
+ --__op-icon-optical-size: var(--_op-icon-optical-size-medium);
121
+ }
122
+ }
123
+
124
+ &.segmented-control--large {
125
+ --__op-segmented-control-height: var(--_op-segmented-control-height-large);
126
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-large);
127
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-large);
128
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-large);
129
+
130
+ .icon {
131
+ --__op-icon-font-size: var(--_op-icon-font-size-medium);
132
+ --__op-icon-optical-size: var(--_op-icon-optical-size-medium);
133
+ }
134
+ }
135
+ }
@@ -297,17 +297,23 @@
297
297
  */
298
298
  --op-input-inner-focus: inset 0 0 0 var(--op-border-width-large);
299
299
  --op-input-outer-focus: 0 0 0 var(--op-border-width-x-large);
300
- --op-input-focus-primary: var(--op-input-inner-focus) var(--op-color-primary-plus-two),
300
+ --op-input-focus-primary:
301
+ var(--op-input-inner-focus) var(--op-color-primary-plus-two),
301
302
  var(--op-input-outer-focus) var(--op-color-primary-plus-five);
302
- --op-input-focus-neutral: var(--op-input-inner-focus) var(--op-color-neutral-plus-two),
303
+ --op-input-focus-neutral:
304
+ var(--op-input-inner-focus) var(--op-color-neutral-plus-two),
303
305
  var(--op-input-outer-focus) var(--op-color-neutral-plus-five);
304
- --op-input-focus-danger: var(--op-input-inner-focus) var(--op-color-alerts-danger-plus-two),
306
+ --op-input-focus-danger:
307
+ var(--op-input-inner-focus) var(--op-color-alerts-danger-plus-two),
305
308
  var(--op-input-outer-focus) var(--op-color-alerts-danger-plus-five);
306
- --op-input-focus-warning: var(--op-input-inner-focus) var(--op-color-alerts-warning-plus-two),
309
+ --op-input-focus-warning:
310
+ var(--op-input-inner-focus) var(--op-color-alerts-warning-plus-two),
307
311
  var(--op-input-outer-focus) var(--op-color-alerts-warning-plus-five);
308
- --op-input-focus-info: var(--op-input-inner-focus) var(--op-color-alerts-info-plus-two),
312
+ --op-input-focus-info:
313
+ var(--op-input-inner-focus) var(--op-color-alerts-info-plus-two),
309
314
  var(--op-input-outer-focus) var(--op-color-alerts-info-plus-five);
310
- --op-input-focus-notice: var(--op-input-inner-focus) var(--op-color-alerts-notice-plus-two),
315
+ --op-input-focus-notice:
316
+ var(--op-input-inner-focus) var(--op-color-alerts-notice-plus-two),
311
317
  var(--op-input-outer-focus) var(--op-color-alerts-notice-plus-five);
312
318
  }
313
319
 
@@ -392,17 +392,23 @@ Noto Sans supports:
392
392
  */
393
393
  --op-input-inner-focus: inset 0 0 0 var(--op-border-width-large);
394
394
  --op-input-outer-focus: 0 0 0 var(--op-border-width-x-large);
395
- --op-input-focus-primary: var(--op-input-inner-focus) var(--op-color-primary-plus-two),
395
+ --op-input-focus-primary:
396
+ var(--op-input-inner-focus) var(--op-color-primary-plus-two),
396
397
  var(--op-input-outer-focus) var(--op-color-primary-plus-five);
397
- --op-input-focus-neutral: var(--op-input-inner-focus) var(--op-color-neutral-plus-two),
398
+ --op-input-focus-neutral:
399
+ var(--op-input-inner-focus) var(--op-color-neutral-plus-two),
398
400
  var(--op-input-outer-focus) var(--op-color-neutral-plus-five);
399
- --op-input-focus-danger: var(--op-input-inner-focus) var(--op-color-alerts-danger-plus-two),
401
+ --op-input-focus-danger:
402
+ var(--op-input-inner-focus) var(--op-color-alerts-danger-plus-two),
400
403
  var(--op-input-outer-focus) var(--op-color-alerts-danger-plus-five);
401
- --op-input-focus-warning: var(--op-input-inner-focus) var(--op-color-alerts-warning-plus-two),
404
+ --op-input-focus-warning:
405
+ var(--op-input-inner-focus) var(--op-color-alerts-warning-plus-two),
402
406
  var(--op-input-outer-focus) var(--op-color-alerts-warning-plus-five);
403
- --op-input-focus-info: var(--op-input-inner-focus) var(--op-color-alerts-info-plus-two),
407
+ --op-input-focus-info:
408
+ var(--op-input-inner-focus) var(--op-color-alerts-info-plus-two),
404
409
  var(--op-input-outer-focus) var(--op-color-alerts-info-plus-five);
405
- --op-input-focus-notice: var(--op-input-inner-focus) var(--op-color-alerts-notice-plus-two),
410
+ --op-input-focus-notice:
411
+ var(--op-input-inner-focus) var(--op-color-alerts-notice-plus-two),
406
412
  var(--op-input-outer-focus) var(--op-color-alerts-notice-plus-five);
407
413
  }
408
414
  /* Animations */
@@ -3621,7 +3627,8 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
3621
3627
  .form-label,
3622
3628
  .form-error,
3623
3629
  .form-hint,
3624
- .form-control:not([type='radio'], [type='checkbox']) {
3630
+ .form-control:not([type='radio'], [type='checkbox']),
3631
+ .segmented-control {
3625
3632
  grid-column: 1 / 3;
3626
3633
  }
3627
3634
  /* stylelint-enable no-descending-specificity */
@@ -4064,6 +4071,141 @@ dialog.modal {
4064
4071
  padding-inline: var(--op-space-x-small);
4065
4072
  }
4066
4073
  }
4074
+ .segmented-control {
4075
+ --op-input-inner-focus: 0 0 0 var(--op-border-width-large);
4076
+ --op-input-focus-primary:
4077
+ var(--op-input-inner-focus) var(--op-color-primary-plus-two),
4078
+ var(--op-input-outer-focus) var(--op-color-primary-plus-five);
4079
+
4080
+ /* Public API (customizable component options) */
4081
+ --_op-segmented-control-height-small: var(--op-input-height-small);
4082
+ --_op-segmented-control-height-medium: var(--op-input-height-medium);
4083
+ --_op-segmented-control-height-large: var(--op-input-height-large);
4084
+
4085
+ --_op-segmented-control-font-small: var(--op-font-x-small);
4086
+ --_op-segmented-control-font-medium: var(--op-font-small);
4087
+ --_op-segmented-control-font-large: var(--op-font-small);
4088
+
4089
+ --_op-segmented-control-label-padding-small: var(--op-space-x-small);
4090
+ --_op-segmented-control-label-padding-medium: var(--op-space-small);
4091
+ --_op-segmented-control-label-padding-large: var(--op-space-small);
4092
+
4093
+ --_op-segmented-control-label-gap-small: var(--op-space-3x-small);
4094
+ --_op-segmented-control-label-gap-medium: var(--op-space-2x-small);
4095
+ --_op-segmented-control-label-gap-large: var(--op-space-2x-small);
4096
+
4097
+ --_op-segmented-control-color-icon-default: var(--op-color-neutral-on-plus-eight-alt);
4098
+ --_op-segmented-control-color-icon-active: light-dark(
4099
+ var(--op-color-primary-plus-four),
4100
+ var(--op-color-primary-minus-six)
4101
+ );
4102
+
4103
+ /* Private API (component option defaults) */
4104
+ --__op-segmented-control-height: var(--_op-segmented-control-height-large);
4105
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-large);
4106
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-large);
4107
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-large);
4108
+ --__op-segmented-control-color-icon: var(--_op-segmented-control-color-icon-default);
4109
+
4110
+ position: relative;
4111
+ display: grid;
4112
+ width: fit-content;
4113
+ height: var(--__op-segmented-control-height);
4114
+ padding: var(--op-space-2x-small);
4115
+ border-radius: var(--op-radius-medium);
4116
+ background-color: var(--op-color-neutral-plus-eight);
4117
+ box-shadow: var(--op-border-all) var(--op-color-border);
4118
+ color: var(--op-color-neutral-on-plus-eight);
4119
+ font-size: var(--__op-segmented-control-font-size);
4120
+ gap: var(--op-space-2x-small);
4121
+ grid-auto-flow: column;
4122
+
4123
+ &.segmented-control--full-width {
4124
+ width: 100%;
4125
+ }
4126
+
4127
+ .icon {
4128
+ color: var(--__op-segmented-control-color-icon);
4129
+ }
4130
+
4131
+ .segmented-control__input {
4132
+ position: absolute;
4133
+ overflow: hidden;
4134
+ width: 1px;
4135
+ height: 1px;
4136
+ padding: 0;
4137
+ border-width: 0;
4138
+ margin: -1px;
4139
+ clip: rect(0, 0, 0, 0);
4140
+ white-space: nowrap;
4141
+
4142
+ /* Selected Option */
4143
+ &:checked + .segmented-control__label {
4144
+ --__op-segmented-control-color-icon: var(--_op-segmented-control-color-icon-active);
4145
+
4146
+ background-color: var(--op-color-primary-plus-one);
4147
+ color: var(--op-color-primary-on-plus-one);
4148
+ }
4149
+
4150
+ &:focus-visible {
4151
+ + .segmented-control__label {
4152
+ box-shadow: var(--op-input-focus-primary);
4153
+ }
4154
+ }
4155
+ }
4156
+
4157
+ .segmented-control__label {
4158
+ display: inline-flex;
4159
+ align-items: center;
4160
+ justify-content: center;
4161
+ border-radius: var(--op-radius-small);
4162
+ gap: var(--__op-segmented-control-label-gap);
4163
+ padding-inline: var(--__op-segmented-control-label-padding);
4164
+ white-space: nowrap;
4165
+
4166
+ &:hover {
4167
+ background-color: var(--op-color-neutral-plus-five);
4168
+ color: var(--op-color-neutral-on-plus-five);
4169
+ }
4170
+ }
4171
+
4172
+ /* Size Modifiers */
4173
+ &.segmented-control--small {
4174
+ --__op-segmented-control-height: var(--_op-segmented-control-height-small);
4175
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-small);
4176
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-small);
4177
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-small);
4178
+
4179
+ .icon {
4180
+ --__op-icon-font-size: var(--_op-icon-font-size-small);
4181
+ --__op-icon-optical-size: var(--_op-icon-optical-size-small);
4182
+ }
4183
+ }
4184
+
4185
+ &.segmented-control--medium {
4186
+ --__op-segmented-control-height: var(--_op-segmented-control-height-medium);
4187
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-medium);
4188
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-medium);
4189
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-medium);
4190
+
4191
+ .icon {
4192
+ --__op-icon-font-size: var(--_op-icon-font-size-medium);
4193
+ --__op-icon-optical-size: var(--_op-icon-optical-size-medium);
4194
+ }
4195
+ }
4196
+
4197
+ &.segmented-control--large {
4198
+ --__op-segmented-control-height: var(--_op-segmented-control-height-large);
4199
+ --__op-segmented-control-font-size: var(--_op-segmented-control-font-large);
4200
+ --__op-segmented-control-label-padding: var(--_op-segmented-control-label-padding-large);
4201
+ --__op-segmented-control-label-gap: var(--_op-segmented-control-label-gap-large);
4202
+
4203
+ .icon {
4204
+ --__op-icon-font-size: var(--_op-icon-font-size-medium);
4205
+ --__op-icon-optical-size: var(--_op-icon-optical-size-medium);
4206
+ }
4207
+ }
4208
+ }
4067
4209
  .sidebar {
4068
4210
  /* Public API (customizable component options) */
4069
4211