@rolemodel/optics 1.12.0 → 2.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/.github/workflows/linting.yml +0 -2
- package/.stylelintrc.json +9 -9
- package/.yarn/install-state.gz +0 -0
- package/NEW_COMPONENT.md +23 -33
- package/README.md +9 -11
- package/build_token_json.js +1 -6
- package/dist/css/addons/panel.css +65 -0
- package/dist/{scss/addons/tom-select.scss → css/addons/tom-select.css} +13 -15
- package/dist/{scss → css}/components/form.css +1 -1
- package/dist/{scss/components/icon.scss → css/components/icon.css} +10 -8
- package/dist/{scss → css}/components/sidebar.css +1 -1
- package/dist/{scss/core/base.scss → css/core/base.css} +3 -3
- package/dist/{scss/core/tokens/base_tokens.scss → css/core/tokens/base_tokens.css} +102 -160
- package/dist/{scss/core/tokens/index.scss → css/core/tokens/index.css} +0 -1
- package/dist/css/core/tokens/scale_color_tokens.css +1498 -0
- package/dist/{scss/core/utilities.scss → css/core/utilities.css} +20 -18
- package/dist/css/optics.css +10 -4223
- package/dist/css/optics.min.css +4907 -0
- package/dist/{scss/recipes/aligned-header.scss → css/recipes/aligned-header.css} +2 -6
- package/dist/tokens/tokens.json +14 -566
- package/package.json +9 -14
- package/postcss.config.js +3 -0
- package/dist/css/optics.css.map +0 -1
- package/dist/scss/addons/panel.scss +0 -61
- package/dist/scss/core/tokens/dark_mode_tokens.scss +0 -479
- package/dist/scss/core/tokens/scale_color_tokens.scss +0 -468
- package/dist/scss/optics.scss +0 -13
- /package/dist/{scss → css}/components/accordion.css +0 -0
- /package/dist/{scss → css}/components/alert.css +0 -0
- /package/dist/{scss → css}/components/avatar.css +0 -0
- /package/dist/{scss → css}/components/badge.css +0 -0
- /package/dist/{scss → css}/components/breadcrumbs.css +0 -0
- /package/dist/{scss → css}/components/button.css +0 -0
- /package/dist/{scss → css}/components/button_group.css +0 -0
- /package/dist/{scss → css}/components/card.css +0 -0
- /package/dist/{scss → css}/components/confirm-dialog.css +0 -0
- /package/dist/{scss → css}/components/divider.css +0 -0
- /package/dist/{scss/components/index.scss → css/components/index.css} +0 -0
- /package/dist/{scss → css}/components/modal.css +0 -0
- /package/dist/{scss → css}/components/navbar.css +0 -0
- /package/dist/{scss → css}/components/pagination.css +0 -0
- /package/dist/{scss → css}/components/side_panel.css +0 -0
- /package/dist/{scss → css}/components/spinner.css +0 -0
- /package/dist/{scss → css}/components/switch.css +0 -0
- /package/dist/{scss → css}/components/tab.css +0 -0
- /package/dist/{scss → css}/components/table.css +0 -0
- /package/dist/{scss → css}/components/tag.css +0 -0
- /package/dist/{scss → css}/components/text_pair.css +0 -0
- /package/dist/{scss → css}/components/tooltip.css +0 -0
- /package/dist/{scss/core/layout.scss → css/core/layout.css} +0 -0
- /package/dist/{scss → css}/recipes/16six-sidebar.css +0 -0
- /package/dist/{scss → css}/recipes/domains-sidebar.css +0 -0
package/.stylelintrc.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": ["stylelint-config-
|
|
3
|
-
"plugins": ["stylelint-
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["**/*.scss"],
|
|
7
|
-
"customSyntax": "postcss-scss"
|
|
8
|
-
}
|
|
9
|
-
],
|
|
2
|
+
"extends": ["stylelint-config-idiomatic-order"],
|
|
3
|
+
"plugins": ["stylelint-prettier"],
|
|
4
|
+
"overrides": [],
|
|
10
5
|
"rules": {
|
|
11
6
|
"prettier/prettier": true,
|
|
12
|
-
"custom-property-pattern": [
|
|
7
|
+
"custom-property-pattern": [
|
|
8
|
+
"(?<=op-)",
|
|
9
|
+
{
|
|
10
|
+
"message": "CSS variables should be prefixed with op-"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
13
|
"selector-class-pattern": null
|
|
14
14
|
}
|
|
15
15
|
}
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/NEW_COMPONENT.md
CHANGED
|
@@ -2,54 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
To create a new CSS component, follow these steps:
|
|
4
4
|
|
|
5
|
-
1. Start by defining a
|
|
6
|
-
2.
|
|
7
|
-
3. When creating variants of the component, use the following syntax: `.{component-name}
|
|
8
|
-
4. For stylistic tweaks that apply to all variants, use modifiers following the BEM (Block, Element, Modifier) syntax. The modifier class should be in the format: `.{component-name}--{modifier}
|
|
9
|
-
|
|
10
|
-
<!-- TODO: This distintion should exist in the main docs as well, not just in the dev instructions. Understanding how to consume components in your app and know the distinctions here is a good idea. -->
|
|
11
|
-
|
|
12
|
-
## Variant vs. Modifier
|
|
13
|
-
|
|
14
|
-
A variant is a top-level component that has distinct styles or functionalities. For example, a button component can have a primary variant that has a different color and hover state than the default button. A modifier is a class that modifies the style of a component. For example, a button component can have a disabled modifier that changes the color and cursor of the button. Modifiers apply to all Variants.
|
|
5
|
+
1. Start by defining a css `.{component-name}` selector for the component. This will serve as the base style for the component and all its variants.
|
|
6
|
+
2. Create modifiers for any all variants of the component you defined in the previous step. This ensures that the base style is shared consistently across all variations.
|
|
7
|
+
3. When creating variants of the component, use the following syntax: `.{component-name}--{variant}`. It can be helpful to nest these under the main class with a `&.{component-name}--{variant}` to ensure they only work with that component.
|
|
8
|
+
4. For stylistic tweaks that apply to all variants, use modifiers following the BEM (Block, Element, Modifier) syntax. The modifier class should be in the format: `.{component-name}--{modifier}` just like the other variants.
|
|
15
9
|
|
|
16
10
|
To illustrate these concepts, let's consider an example of a button. You can use the following template as a guide:
|
|
17
11
|
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
```css
|
|
13
|
+
/* Define the main component */
|
|
14
|
+
.btn {
|
|
15
|
+
/* Base styles for the button */
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
/* Hover state */
|
|
24
18
|
&:hover {
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
/*
|
|
20
|
+
Styles for the hovered button modifier
|
|
21
|
+
...
|
|
22
|
+
*/
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
/* Modifier: Large button */
|
|
30
26
|
&.btn--large {
|
|
31
|
-
|
|
27
|
+
/* Styles for the large button modifier */
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
/* Modifier: Disabled button */
|
|
35
31
|
&.btn--disabled,
|
|
36
32
|
&:disabled {
|
|
37
|
-
|
|
33
|
+
/* Styles for the disabled button modifier */
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
.btn {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Variant: Primary button
|
|
49
|
-
.btn-primary {
|
|
50
|
-
@extend %button-global;
|
|
51
|
-
// Specific styles for the primary button variant
|
|
52
|
-
// ...
|
|
37
|
+
/* Variant: Primary button */
|
|
38
|
+
.btn.btn--primary {
|
|
39
|
+
/*
|
|
40
|
+
Specific styles for the primary button variant
|
|
41
|
+
...
|
|
42
|
+
*/
|
|
53
43
|
}
|
|
54
44
|
```
|
|
55
45
|
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
Optics is an
|
|
15
|
+
Optics is an css package that provides base styles and components that can be integrated and customized in a variety of projects.
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
@@ -30,16 +30,14 @@ yarn add @rolemodel/optics
|
|
|
30
30
|
|
|
31
31
|
### Import
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
You can add this import to the top of your root level `css` file.
|
|
34
34
|
|
|
35
|
-
```
|
|
36
|
-
@import '@rolemodel/optics';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
```scss
|
|
42
|
-
@import '@rolemodel/optics/dist/scss/optics';
|
|
35
|
+
```css
|
|
36
|
+
@import '@rolemodel/optics'; /* Using webpack to compile */
|
|
37
|
+
/* Or */
|
|
38
|
+
@import '@rolemodel/optics/dist/css/optics'; /* Using a different compiler or no compiler */
|
|
39
|
+
/* Or */
|
|
40
|
+
@import '@rolemodel/optics/dist/css/optics.min.css'; /* If you want a single file with all the styles in it. */
|
|
43
41
|
```
|
|
44
42
|
|
|
45
43
|
## Documentation
|
|
@@ -65,7 +63,7 @@ Add the following above a group to categorize the tokens.
|
|
|
65
63
|
|
|
66
64
|
### Component Documentation
|
|
67
65
|
|
|
68
|
-
For instructions on how to create a new component, see [Process for Creating New Components](./NEW_COMPONENT.
|
|
66
|
+
For instructions on how to create a new component, see [Process for Creating New Components](./NEW_COMPONENT.md)
|
|
69
67
|
|
|
70
68
|
Additional stories can be added using the following command, or copying an existing story.
|
|
71
69
|
|
package/build_token_json.js
CHANGED
|
@@ -128,12 +128,7 @@ try {
|
|
|
128
128
|
fs.readdir(source, { withFileTypes: true }, (_errors, files) => {
|
|
129
129
|
let variables = {}
|
|
130
130
|
files
|
|
131
|
-
.filter(
|
|
132
|
-
(directoryEntry) =>
|
|
133
|
-
directoryEntry.isFile() &&
|
|
134
|
-
directoryEntry.name !== 'dark_mode_tokens.scss' &&
|
|
135
|
-
directoryEntry.name !== 'index.scss'
|
|
136
|
-
)
|
|
131
|
+
.filter((directoryEntry) => directoryEntry.isFile() && directoryEntry.name !== 'index.css')
|
|
137
132
|
.forEach((directoryEntry) => {
|
|
138
133
|
const fileContents = fs.readFileSync(`${source}/${directoryEntry.name}`)
|
|
139
134
|
const matches = fileContents.toString().match(/^\s*--.*?(?=;)/gm)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.panel {
|
|
2
|
+
--op-panel-width: 40%;
|
|
3
|
+
|
|
4
|
+
position: absolute;
|
|
5
|
+
z-index: var(--op-z-index-sidebar);
|
|
6
|
+
width: var(--op-panel-width);
|
|
7
|
+
height: 100vh;
|
|
8
|
+
background-color: var(--op-color-background);
|
|
9
|
+
color: var(--op-color-on-background);
|
|
10
|
+
inset-inline-end: calc(-1 * var(--op-panel-width)); /* this pushes the panel off the screen to the right */
|
|
11
|
+
overflow-y: scroll;
|
|
12
|
+
padding-block-end: var(--op-space-large);
|
|
13
|
+
transition: var(--op-transition-panel);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.panel--active {
|
|
17
|
+
box-shadow: var(--op-shadow-x-large);
|
|
18
|
+
inset-inline-end: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.panel__close {
|
|
22
|
+
display: flex;
|
|
23
|
+
padding: var(--op-space-medium);
|
|
24
|
+
border-radius: 100%;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
float: right;
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
background-color: var(--op-color-neutral-plus-seven);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#panel-content {
|
|
34
|
+
padding-block: var(--op-space-large);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Follow system preference unless forced to light */
|
|
38
|
+
@media (prefers-color-scheme: dark) {
|
|
39
|
+
:root:not([data-theme-mode='light']) {
|
|
40
|
+
.panel {
|
|
41
|
+
background-color: var(--op-color-neutral-plus-seven);
|
|
42
|
+
color: var(--op-color-neutral-on-plus-seven);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.panel__close {
|
|
46
|
+
&:hover {
|
|
47
|
+
background-color: var(--op-color-background);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Force design system to dark */
|
|
54
|
+
:root[data-theme-mode='dark'] {
|
|
55
|
+
.panel {
|
|
56
|
+
background-color: var(--op-color-neutral-plus-seven);
|
|
57
|
+
color: var(--op-color-neutral-on-plus-seven);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.panel__close {
|
|
61
|
+
&:hover {
|
|
62
|
+
background-color: var(--op-color-background);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// Control
|
|
6
|
-
.#{$select-ns}-control {
|
|
1
|
+
/* Design System Overrides */
|
|
2
|
+
.ts-wrapper {
|
|
3
|
+
/* Control */
|
|
4
|
+
.ts-control {
|
|
7
5
|
min-height: var(--op-input-height-large);
|
|
8
6
|
align-items: center;
|
|
9
7
|
border: none;
|
|
@@ -16,16 +14,16 @@
|
|
|
16
14
|
line-height: var(--op-line-height-base);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
/* Active control */
|
|
20
18
|
&.dropdown-active {
|
|
21
|
-
|
|
19
|
+
.ts-control {
|
|
22
20
|
border-bottom-left-radius: 0;
|
|
23
21
|
border-bottom-right-radius: 0;
|
|
24
22
|
}
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
/* Dropdown */
|
|
26
|
+
.ts-dropdown {
|
|
29
27
|
border: none;
|
|
30
28
|
margin: 0;
|
|
31
29
|
border-bottom-left-radius: var(--op-radius-large);
|
|
@@ -42,9 +40,9 @@
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
/* Item */
|
|
46
44
|
&.multi {
|
|
47
|
-
|
|
45
|
+
.ts-control > div {
|
|
48
46
|
padding: var(--op-space-3x-small) var(--op-space-x-small);
|
|
49
47
|
border-radius: var(--op-radius-medium);
|
|
50
48
|
margin: 0 var(--op-space-3x-small) var(--op-space-3x-small) 0;
|
|
@@ -58,13 +56,13 @@
|
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
/* Dropdown Arrow */
|
|
62
60
|
&.single,
|
|
63
61
|
&.multi,
|
|
64
62
|
&.single.input-active,
|
|
65
63
|
&.multi.input-active {
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
.ts-control {
|
|
65
|
+
/* Highly specific SVG data image for the dropdown arrow. */
|
|
68
66
|
background-image: var(--op-encoded-images-dropdown-arrow);
|
|
69
67
|
background-position-x: calc(100% - var(--op-space-small));
|
|
70
68
|
background-position-y: center;
|
|
@@ -251,7 +251,7 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
|
|
|
251
251
|
gap: var(--op-space-x-small);
|
|
252
252
|
grid-auto-rows: auto;
|
|
253
253
|
grid-template-columns: auto 1fr;
|
|
254
|
-
padding-block: var(--op-space-small)
|
|
254
|
+
padding-block: var(--op-space-small);
|
|
255
255
|
padding-inline: 0;
|
|
256
256
|
|
|
257
257
|
/* Group Alignment */
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*
|
|
2
|
+
Look up icons at: https://fonts.google.com/icons?icon.set=Material+Symbols
|
|
3
|
+
Instead of hosting the font files locally which requires the compiler to handle them, we pull the icons
|
|
4
|
+
from Googles CDN like we do for our other fonts
|
|
5
|
+
https://developers.google.com/fonts/docs/material_symbols#variable_font_with_google_fonts
|
|
6
|
+
*/
|
|
5
7
|
|
|
6
8
|
@import 'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block';
|
|
7
9
|
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
vertical-align: middle;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
/* Fill */
|
|
26
28
|
.icon--outlined {
|
|
27
29
|
--op-mso-fill: 0;
|
|
28
30
|
}
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
--op-mso-fill: 1;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
/* Weight */
|
|
35
37
|
.icon--weight-light {
|
|
36
38
|
--op-mso-weight: var(--op-font-weight-light);
|
|
37
39
|
}
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
--op-mso-weight: var(--op-font-weight-bold);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
/* Emphasis */
|
|
52
54
|
.icon--low-emphasis {
|
|
53
55
|
--op-mso-grade: -20;
|
|
54
56
|
}
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
--op-mso-grade: 200;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
/* Size */
|
|
65
67
|
.icon--medium {
|
|
66
68
|
font-size: var(--op-font-medium);
|
|
67
69
|
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/* Primary */
|
|
134
|
-
|
|
134
|
+
&.sidebar--primary {
|
|
135
135
|
--_op-sidebar-background-color: var(--op-color-primary-plus-six);
|
|
136
136
|
--_op-sidebar-text-color: var(--op-color-primary-on-plus-six);
|
|
137
137
|
--_op-sidebar-border-color: var(--op-color-primary-plus-four);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/* After a reset, introduce base element styles specific to this system */
|
|
2
2
|
|
|
3
3
|
html {
|
|
4
|
-
overflow: hidden;
|
|
4
|
+
overflow: hidden; /* Needed to prevent flash messages and panels from causing overflow */
|
|
5
5
|
font-family: var(--op-font-family);
|
|
6
|
-
font-size: 62.5%;
|
|
6
|
+
font-size: 62.5%; /* 1rem = 10px */
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
body {
|