@rolemodel/optics 1.13.1 → 2.0.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.
Files changed (50) hide show
  1. package/.github/workflows/linting.yml +0 -2
  2. package/.stylelintrc.json +9 -9
  3. package/.yarn/install-state.gz +0 -0
  4. package/LICENSE +1 -1
  5. package/NEW_COMPONENT.md +23 -33
  6. package/README.md +9 -11
  7. package/build_token_json.js +1 -6
  8. package/dist/{scss → css}/components/accordion.css +26 -0
  9. package/dist/{scss → css}/components/form.css +1 -1
  10. package/dist/{scss → css}/components/sidebar.css +1 -1
  11. package/dist/{scss → css}/core/tokens/base_tokens.css +1 -0
  12. package/dist/css/optics.css +10 -4612
  13. package/dist/css/optics.min.css +4934 -0
  14. package/package.json +20 -25
  15. package/postcss.config.js +3 -0
  16. package/dist/css/optics.css.map +0 -1
  17. package/dist/scss/optics.scss +0 -13
  18. package/public/design-tokens.source.json +0 -1
  19. /package/dist/{scss → css}/addons/panel.css +0 -0
  20. /package/dist/{scss → css}/addons/tom-select.css +0 -0
  21. /package/dist/{scss → css}/components/alert.css +0 -0
  22. /package/dist/{scss → css}/components/avatar.css +0 -0
  23. /package/dist/{scss → css}/components/badge.css +0 -0
  24. /package/dist/{scss → css}/components/breadcrumbs.css +0 -0
  25. /package/dist/{scss → css}/components/button.css +0 -0
  26. /package/dist/{scss → css}/components/button_group.css +0 -0
  27. /package/dist/{scss → css}/components/card.css +0 -0
  28. /package/dist/{scss → css}/components/confirm-dialog.css +0 -0
  29. /package/dist/{scss → css}/components/divider.css +0 -0
  30. /package/dist/{scss → css}/components/icon.css +0 -0
  31. /package/dist/{scss/components/index.scss → css/components/index.css} +0 -0
  32. /package/dist/{scss → css}/components/modal.css +0 -0
  33. /package/dist/{scss → css}/components/navbar.css +0 -0
  34. /package/dist/{scss → css}/components/pagination.css +0 -0
  35. /package/dist/{scss → css}/components/side_panel.css +0 -0
  36. /package/dist/{scss → css}/components/spinner.css +0 -0
  37. /package/dist/{scss → css}/components/switch.css +0 -0
  38. /package/dist/{scss → css}/components/tab.css +0 -0
  39. /package/dist/{scss → css}/components/table.css +0 -0
  40. /package/dist/{scss → css}/components/tag.css +0 -0
  41. /package/dist/{scss → css}/components/text_pair.css +0 -0
  42. /package/dist/{scss → css}/components/tooltip.css +0 -0
  43. /package/dist/{scss → css}/core/base.css +0 -0
  44. /package/dist/{scss → css}/core/layout.css +0 -0
  45. /package/dist/{scss/core/tokens/index.scss → css/core/tokens/index.css} +0 -0
  46. /package/dist/{scss → css}/core/tokens/scale_color_tokens.css +0 -0
  47. /package/dist/{scss → css}/core/utilities.css +0 -0
  48. /package/dist/{scss → css}/recipes/16six-sidebar.css +0 -0
  49. /package/dist/{scss → css}/recipes/aligned-header.css +0 -0
  50. /package/dist/{scss → css}/recipes/domains-sidebar.css +0 -0
@@ -30,8 +30,6 @@ jobs:
30
30
  run: yarn prettier-check
31
31
  - name: Build CSS
32
32
  run: yarn build:css
33
- - name: Build SCSS
34
- run: yarn build:scss
35
33
  - name: Build Tokens
36
34
  run: yarn build:tokens
37
35
  - name: Build Storybook
package/.stylelintrc.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
- "extends": ["stylelint-config-standard-scss", "stylelint-config-idiomatic-order", "stylelint-config-prettier-scss"],
3
- "plugins": ["stylelint-scss", "stylelint-prettier"],
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": ["(?<=op-)", { "message": "CSS variables should be prefixed with op-" }],
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
  }
Binary file
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 RoleModel Software
3
+ Copyright (c) 2025 RoleModel Software
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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 Sass `%{component-name}-global` placeholder for the component. This placeholder will serve as the base style for the component and all its variants.
6
- 2. Extend the default class and all variants of the component with the global placeholder you defined in the previous step. This ensures that the base style is applied consistently across all variations.
7
- 3. When creating variants of the component, use the following syntax: `.{component-name}-{variant}`. Variants are top-level components that have distinct styles or functionalities.
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
- ```scss
19
- // Define the global placeholder for the button component
20
- %button-global {
21
- // Base styles for the button
12
+ ```css
13
+ /* Define the main component */
14
+ .btn {
15
+ /* Base styles for the button */
22
16
 
23
- // Hover state
17
+ /* Hover state */
24
18
  &:hover {
25
- // Styles for the hovered button modifier
26
- // ...
19
+ /*
20
+ Styles for the hovered button modifier
21
+ ...
22
+ */
27
23
  }
28
24
 
29
- // Modifier: Large button
25
+ /* Modifier: Large button */
30
26
  &.btn--large {
31
- // Styles for the large button modifier
27
+ /* Styles for the large button modifier */
32
28
  }
33
29
 
34
- // Modifier: Disabled button
30
+ /* Modifier: Disabled button */
35
31
  &.btn--disabled,
36
32
  &:disabled {
37
- // Styles for the disabled button modifier
33
+ /* Styles for the disabled button modifier */
38
34
  }
39
35
  }
40
36
 
41
- // Default button class extending the global styles
42
- .btn {
43
- @extend %button-global;
44
- // Specific styles for the default button variant
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 scss package that provides base styles and components that can be integrated and customized in a variety of projects.
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
- If you are using webpack to compile, you can add this import to the top of your root level `scss` file.
33
+ You can add this import to the top of your root level `css` file.
34
34
 
35
- ```scss
36
- @import '@rolemodel/optics';
37
- ```
38
-
39
- If you are using a different compiler such as Dart Sass, you may need to reference the scss file directly.
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.MD)
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
 
@@ -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)
@@ -2,6 +2,11 @@
2
2
  /* Public API (customizable component options) */
3
3
  --_op-accordion-summary-min-height: calc(8 * var(--op-size-unit)); /* 32px */
4
4
 
5
+ overflow: hidden;
6
+ interpolate-size: allow-keywords;
7
+
8
+ /* Elements */
9
+
5
10
  summary {
6
11
  display: grid;
7
12
  min-height: var(--_op-accordion-summary-min-height);
@@ -32,9 +37,30 @@
32
37
  }
33
38
  }
34
39
 
40
+ &::details-content {
41
+ height: 0;
42
+ transition: var(--op-transition-accordion-content);
43
+ }
44
+
35
45
  &[open] {
36
46
  summary .accordion__marker {
37
47
  rotate: 0.25turn;
38
48
  }
49
+
50
+ &::details-content {
51
+ height: auto;
52
+ }
53
+ }
54
+
55
+ /* Modifiers */
56
+
57
+ &.accordion--disable-animation {
58
+ summary .accordion__marker {
59
+ transition: none;
60
+ }
61
+
62
+ &::details-content {
63
+ transition: none;
64
+ }
39
65
  }
40
66
  }
@@ -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) 0;
254
+ padding-block: var(--op-space-small);
255
255
  padding-inline: 0;
256
256
 
257
257
  /* Group Alignment */
@@ -131,7 +131,7 @@
131
131
  }
132
132
 
133
133
  /* Primary */
134
- .sidebar--primary {
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);
@@ -216,6 +216,7 @@ Noto Sans supports:
216
216
  * @tokens Transition
217
217
  */
218
218
  --op-transition-accordion: rotate 120ms ease-in;
219
+ --op-transition-accordion-content: height 300ms ease, content-visibility 300ms ease allow-discrete;
219
220
  --op-transition-input: all 120ms ease-in;
220
221
  --op-transition-sidebar: all 200ms ease-in-out;
221
222
  --op-transition-modal: all 300ms ease-in;