@semanticus/semanticus-css 0.4.0 → 0.7.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.
Files changed (44) hide show
  1. package/README.md +4 -4
  2. package/dist/semanticus-semantics.css +1 -1
  3. package/dist/semanticus-utilities.css +2 -2
  4. package/dist/semanticus-variants.css +1 -1
  5. package/dist/semanticus.css +2 -2
  6. package/dist/semanticus.size.slim.css +1 -1
  7. package/package.json +5 -5
  8. package/src/index.css +4 -4
  9. package/src/semantics/_article.css +10 -4
  10. package/src/semantics/_aside.css +16 -0
  11. package/src/semantics/_body.css +5 -7
  12. package/src/semantics/_button.css +25 -1
  13. package/src/semantics/_details.css +7 -8
  14. package/src/semantics/_dialog.css +11 -17
  15. package/src/semantics/_footer.css +12 -0
  16. package/src/semantics/_header.css +12 -0
  17. package/src/semantics/_links.css +17 -0
  18. package/src/semantics/_main.css +8 -1
  19. package/src/semantics/_nav.css +55 -88
  20. package/src/semantics/_role-tooltip.css +1 -1
  21. package/src/semantics/_section.css +3 -0
  22. package/src/semantics/_typography.css +15 -6
  23. package/src/semantics/index.css +1 -1
  24. package/src/semantics/modules.css +3 -0
  25. package/src/sizes/slim.css +31 -2
  26. package/src/utilities/_variables.css +5 -0
  27. package/src/utilities/colors/_background-colors.css +39 -7
  28. package/src/utilities/colors/_text-colors.css +108 -18
  29. package/src/utilities/index.css +2 -2
  30. package/src/utilities/sizing/_height.css +4 -0
  31. package/src/utilities/sizing/_width.css +8 -0
  32. package/src/{_variables.css → variables/_all.css} +17 -145
  33. package/src/variables/_shared.css +121 -0
  34. package/src/variants/_card.css +4 -0
  35. package/src/variants/_contained.css +43 -0
  36. package/src/variants/_container.css +1 -1
  37. package/src/variants/_contrast.css +13 -16
  38. package/src/variants/_flow.css +15 -0
  39. package/src/variants/_ghost.css +36 -33
  40. package/src/variants/_panel.css +18 -0
  41. package/src/variants/_secondary.css +1 -4
  42. package/src/variants/_sidebar.css +11 -0
  43. package/src/variants/index.css +2 -2
  44. package/src/variants/modules.css +8 -2
@@ -0,0 +1,121 @@
1
+ :root {
2
+ --transparent: transparent;
3
+ }
4
+
5
+ /* ==========================================================================
6
+ Responsive Breakpoints (custom media queries)
7
+ Used consistently across semantics, variants, and utilities.
8
+ ========================================================================== */
9
+
10
+ @custom-media --breakpoint-sm (min-width: 576px);
11
+ @custom-media --breakpoint-md (min-width: 768px);
12
+ @custom-media --breakpoint-lg (min-width: 1024px);
13
+ @custom-media --breakpoint-xl (min-width: 1280px);
14
+ @custom-media --breakpoint-xxl (min-width: 1536px);
15
+
16
+ /* ==========================================================================
17
+ 2. Typography & Layout Variables (from Pico Theme)
18
+ ========================================================================== */
19
+
20
+ :root,
21
+ :host {
22
+ /* Font Families */
23
+ --font-family-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
24
+ --font-family-sans-serif: system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue", sans-serif, var(--font-family-emoji);
25
+ --font-family-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace, var(--font-family-emoji);
26
+ --font-family: var(--font-family-sans-serif);
27
+
28
+ /* Typography – base defaults inherited by all elements */
29
+ --line-height: 1.5;
30
+ --font-weight: 400;
31
+ --font-size: 100%; /* Root font-size; overridden per breakpoint below and per element in §6 */
32
+ --text-underline-offset: 0.1rem;
33
+
34
+ /* Borders & Effects – global defaults for border-radius, border-width, outline, and transition */
35
+ --border-radius: 0.25rem;
36
+ --border-width: 0.0625rem; /* 1px – base border width used by forms, tables, etc. */
37
+ --outline-width: 0.125rem; /* 2px – focus-ring width */
38
+ --transition: 0.2s ease-in-out; /* Default transition timing for interactive state changes */
39
+
40
+ /* Spacing – shared base unit used for padding, margins, and gaps throughout the layout */
41
+ --spacing: 1rem;
42
+ --responsive-multiplier: 1; /* Multiplier applied to spacing for responsive adjustments at wider breakpoints */
43
+ --typography-spacing-vertical: 1rem; /* Vertical margin below typographic elements (p, lists, etc.) */
44
+ --block-spacing-vertical: var(--spacing); /* Vertical padding inside block-level components (cards, modals, etc.) */
45
+ --block-spacing-horizontal: var(--spacing); /* Horizontal padding inside block-level components */
46
+ --grid-column-gap: var(--spacing); /* Column gap in CSS Grid layouts */
47
+ --grid-row-gap: var(--spacing); /* Row gap in CSS Grid layouts */
48
+ --form-element-spacing-vertical: 0.75rem; /* Vertical padding inside form inputs, selects, and textareas */
49
+ --form-element-spacing-horizontal: 1rem; /* Horizontal padding inside form inputs, selects, and textareas */
50
+
51
+ /* Shadows – used by [role="group"] and [role="search"] button/input combos */
52
+ --group-shadow: 0 0 0 rgba(0, 0, 0, 0); /* Default (no shadow) */
53
+ --group-shadow-focus-with-button: 0 0 0 var(--outline-width) var(--color-primary-focus); /* Focus ring when a button inside the group is focused */
54
+ --group-shadow-focus-with-input: 0 0 0 0.0625rem var(--form-border-color); /* Focus ring when an input inside the group is focused */
55
+
56
+ /* Modal – backdrop overlay settings */
57
+ --modal-overlay-backdrop-filter: blur(0.375rem); /* Applies a blur behind the modal overlay */
58
+
59
+ /* Navigation – spacing and breadcrumb configuration */
60
+ --nav-link-spacing-vertical: 0.5rem; /* Vertical padding inside nav links */
61
+ --nav-link-spacing-horizontal: 0.5rem; /* Horizontal padding inside nav links */
62
+ --nav-breadcrumb-divider: ">"; /* Character displayed between breadcrumb items */
63
+
64
+ /* Icons – inline SVG data-URIs used by form elements and UI components */
65
+ --icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); /* Checkmark for checked checkboxes */
66
+ --icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E"); /* Minus icon for indeterminate checkboxes */
67
+ --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); /* Dropdown arrow for <select> elements */
68
+ --icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E"); /* Calendar icon for date inputs */
69
+ --icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E"); /* Clock icon for time inputs */
70
+ --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E"); /* Magnifying glass for search inputs */
71
+ --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E"); /* X icon for close/dismiss actions (e.g. modal close button) */
72
+ --icon-loading: url("data:image/svg+xml,%3Csvg fill='none' height='24' width='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3E%3Cstyle%3E g %7B animation: rotate 2s linear infinite; transform-origin: center center; %7D circle %7B stroke-dasharray: 75,100; stroke-dashoffset: -5; animation: dash 1.5s ease-in-out infinite; stroke-linecap: round; %7D @keyframes rotate %7B 0%25 %7B transform: rotate(0deg); %7D 100%25 %7B transform: rotate(360deg); %7D %7D @keyframes dash %7B 0%25 %7B stroke-dasharray: 1,100; stroke-dashoffset: 0; %7D 50%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -17.5; %7D 100%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -62; %7D %7D %3C/style%3E%3Cg%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='rgb(136, 145, 164)' stroke-width='4' /%3E%3C/g%3E%3C/svg%3E"); /* Animated spinner for [aria-busy="true"] elements */
73
+
74
+ --sidebar-width: 25%; /* Sidebar width */
75
+ }
76
+
77
+ /* Responsive Font Sizes – progressively increase root font-size at wider viewports */
78
+ @media (--breakpoint-sm) {
79
+ :root,
80
+ :host {
81
+ --font-size: 106.25%;
82
+ --sidebar-width: max(25%, 150px);
83
+ --responsive-multiplier: 1.25;
84
+ }
85
+ }
86
+
87
+ @media (--breakpoint-md) {
88
+ :root,
89
+ :host {
90
+ --font-size: 112.5%;
91
+ --sidebar-width: max(22%, 180px);
92
+ --responsive-multiplier: 1.5;
93
+ }
94
+ }
95
+
96
+ @media (--breakpoint-lg) {
97
+ :root,
98
+ :host {
99
+ --font-size: 118.75%;
100
+ --sidebar-width: max(20%, 200px);
101
+ --responsive-multiplier: 1.75;
102
+ }
103
+ }
104
+
105
+ @media (--breakpoint-xl) {
106
+ :root,
107
+ :host {
108
+ --font-size: 125%;
109
+ --sidebar-width: max(18%, 220px);
110
+ --responsive-multiplier: 2;
111
+ }
112
+ }
113
+
114
+ @media (--breakpoint-xxl) {
115
+ :root,
116
+ :host {
117
+ --font-size: 131.25%;
118
+ --sidebar-width: clamp(240px, 16%, 300px);
119
+ --responsive-multiplier: 2.25;
120
+ }
121
+ }
@@ -4,6 +4,9 @@
4
4
  * Can be applied to any element (article, div, section, etc.)
5
5
  */
6
6
  .card {
7
+ --block-spacing-vertical: calc(var(--spacing) * var(--responsive-multiplier));
8
+ --block-spacing-horizontal: calc(var(--spacing) * var(--responsive-multiplier));
9
+
7
10
  margin-bottom: var(--block-spacing-vertical);
8
11
  padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);
9
12
  border-radius: var(--border-radius);
@@ -12,6 +15,7 @@
12
15
 
13
16
  & > header,
14
17
  & > footer {
18
+ width: calc(100% + var(--block-spacing-horizontal) * 2);
15
19
  margin-right: calc(var(--block-spacing-horizontal) * -1);
16
20
  margin-left: calc(var(--block-spacing-horizontal) * -1);
17
21
  padding: calc(var(--block-spacing-vertical) * 0.66) var(--block-spacing-horizontal);
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Contained
3
+ * Applies container constraints (max-width and horizontal margins) to all direct children
4
+ * instead of the container itself
5
+ */
6
+ .contained,
7
+ .contained-fluid {
8
+ width: 100%;
9
+
10
+ & > * {
11
+ margin-right: auto;
12
+ margin-left: auto;
13
+ padding-right: var(--spacing);
14
+ padding-left: var(--spacing);
15
+ width: 100%;
16
+ }
17
+ }
18
+
19
+ .contained {
20
+ & > * {
21
+ @media (--breakpoint-sm) {
22
+ max-width: 510px;
23
+ padding-right: 0;
24
+ padding-left: 0;
25
+ }
26
+
27
+ @media (--breakpoint-md) {
28
+ max-width: 700px;
29
+ }
30
+
31
+ @media (--breakpoint-lg) {
32
+ max-width: 950px;
33
+ }
34
+
35
+ @media (--breakpoint-xl) {
36
+ max-width: 1200px;
37
+ }
38
+
39
+ @media (--breakpoint-xxl) {
40
+ max-width: 1450px;
41
+ }
42
+ }
43
+ }
@@ -31,6 +31,6 @@
31
31
  }
32
32
 
33
33
  @media (--breakpoint-xxl) {
34
- max-width: 1450px;
34
+ max-width: 1440px;
35
35
  }
36
36
  }
@@ -17,24 +17,21 @@
17
17
  }
18
18
  }
19
19
 
20
- /* Buttons */
21
- :is(button, [type="submit"], [type="button"], [role="button"]) {
22
- &.contrast {
23
- --color-background: var(--color-contrast-bg);
24
- --border-color: var(--color-contrast-border);
25
- --color-text: var(--color-contrast-inverse);
20
+ :is(.panel, button, [type="submit"], [type="button"], [role="button"]).contrast {
21
+ --color-background: var(--color-contrast-bg);
22
+ --border-color: var(--color-contrast-border);
23
+ --color-text: var(--color-contrast-inverse);
24
+ }
26
25
 
27
- &:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
28
- --color-background: var(--color-contrast-hover-bg);
29
- --border-color: var(--color-contrast-hover-border);
30
- --color-text: var(--color-contrast-inverse);
31
- }
26
+ :is(button, [type="submit"], [type="button"], [role="button"]).contrast:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
27
+ --color-background: var(--color-contrast-hover-bg);
28
+ --border-color: var(--color-contrast-hover-border);
29
+ --color-text: var(--color-contrast-inverse);
30
+ }
32
31
 
33
- &:focus,
34
- &:is([aria-current]:not([aria-current="false"])):focus {
35
- --shadow-lg: var(--button-shadow-hover, 0 0 0 rgba(0, 0, 0, 0)), 0 0 0 var(--outline-width) var(--color-contrast-focus);
36
- }
37
- }
32
+ :is(button, [type="submit"], [type="button"], [role="button"]).contrast:focus,
33
+ :is(button, [type="submit"], [type="button"], [role="button"]).contrast:is([aria-current]:not([aria-current="false"])):focus {
34
+ --shadow-lg: var(--button-shadow-hover, 0 0 0 rgba(0, 0, 0, 0)), 0 0 0 var(--outline-width) var(--color-contrast-focus);
38
35
  }
39
36
 
40
37
  /* Accordion chevron dark mode override */
@@ -0,0 +1,15 @@
1
+ .flow-h {
2
+ align-items: flex-start;
3
+ display: flex;
4
+ flex-direction: row;
5
+ flex-grow: 1;
6
+ justify-content: stretch;
7
+ }
8
+
9
+ .flow-v {
10
+ align-items: stretch;
11
+ display: flex;
12
+ flex-direction: column;
13
+ width: 100%;
14
+ justify-content: flex-start;
15
+ }
@@ -4,39 +4,42 @@
4
4
  * Used on buttons and accordion elements
5
5
  */
6
6
 
7
- /* Buttons */
8
- :is(button, [type="submit"], [type="button"], [role="button"]) {
9
- &.ghost {
10
- --color-background: transparent;
11
- --color-text: var(--color-primary);
12
- --border-color: var(--color-primary);
13
-
14
- &:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
15
- --color-background: transparent;
16
- --color-text: var(--color-primary-hover);
17
- --border-color: var(--color-primary-hover);
18
- }
19
-
20
- &.secondary {
21
- --color-text: var(--color-secondary);
22
- --border-color: var(--color-secondary);
23
-
24
- &:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
25
- --color-text: var(--color-secondary-hover);
26
- --border-color: var(--color-secondary-hover);
27
- }
28
- }
29
-
30
- &.contrast {
31
- --color-text: var(--color-contrast);
32
- --border-color: var(--color-contrast);
33
-
34
- &:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
35
- --color-text: var(--color-contrast-hover);
36
- --border-color: var(--color-contrast-hover);
37
- }
38
- }
39
- }
7
+ .ghost {
8
+ --color-background: transparent;
9
+
10
+ background-color: var(--color-background) !important;
11
+ }
12
+
13
+ :is(button, [type="submit"], [type="button"], [role="button"]).ghost {
14
+ --color-background: transparent;
15
+ --color-text: var(--color-primary);
16
+ --border-color: var(--color-primary);
17
+ }
18
+
19
+ :is(button, [type="submit"], [type="button"], [role="button"]).ghost:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
20
+ --color-background: transparent;
21
+ --color-text: var(--color-primary-hover);
22
+ --border-color: var(--color-primary-hover);
23
+ }
24
+
25
+ :is(.panel, button, [type="submit"], [type="button"], [role="button"]).ghost.secondary {
26
+ --color-text: var(--color-secondary);
27
+ --border-color: var(--color-secondary);
28
+ }
29
+
30
+ :is(button, [type="submit"], [type="button"], [role="button"]).ghost.secondary:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
31
+ --color-text: var(--color-secondary-hover);
32
+ --border-color: var(--color-secondary-hover);
33
+ }
34
+
35
+ :is(.panel, button, [type="submit"], [type="button"], [role="button"]).ghost.contrast {
36
+ --color-text: var(--color-contrast);
37
+ --border-color: var(--color-contrast);
38
+ }
39
+
40
+ :is(button, [type="submit"], [type="button"], [role="button"]).ghost.contrast:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
41
+ --color-text: var(--color-contrast-hover);
42
+ --border-color: var(--color-contrast-hover);
40
43
  }
41
44
 
42
45
  /* Reset buttons */
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Panel akin to a flat card.
3
+ */
4
+ .panel {
5
+ --block-spacing-vertical: calc(var(--spacing) * var(--responsive-multiplier));
6
+ --block-spacing-horizontal: calc(var(--spacing) * var(--responsive-multiplier));
7
+
8
+ --color-background: var(--card-bg);
9
+ --border-color: var(--card-border);
10
+ --color-text: var(--color-text);
11
+
12
+ background-color: var(--color-background);
13
+ border-radius: var(--border-radius);
14
+ border: var(--border-width) solid var(--border-color);
15
+ color: var(--color-text);
16
+ margin-bottom: var(--block-spacing-vertical);
17
+ padding: var(--block-spacing-vertical) var(--block-spacing-horizontal);
18
+ }
@@ -17,13 +17,10 @@
17
17
  }
18
18
  }
19
19
 
20
- /* Buttons */
21
- :is(button, [type="submit"], [type="button"], [role="button"]).secondary {
20
+ :is(.panel, button, [type="submit"], [type="button"], [role="button"]).secondary {
22
21
  --color-background: var(--color-secondary-bg);
23
22
  --border-color: var(--color-secondary-border);
24
23
  --color-text: var(--color-secondary-inverse);
25
-
26
- cursor: pointer;
27
24
  }
28
25
 
29
26
  :is(button, [type="submit"], [type="button"], [role="button"]).secondary:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
@@ -0,0 +1,11 @@
1
+ aside {
2
+ &.sidebar {
3
+ z-index: 1020;
4
+ position: sticky;
5
+ top: 0;
6
+ max-height: 100svh;
7
+ align-self: stretch;
8
+ display: flex;
9
+ flex-direction: column;
10
+ }
11
+ }
@@ -3,7 +3,7 @@
3
3
  * Class-based variant styles that extend semantic
4
4
  */
5
5
 
6
- /* Global variables */
7
- @import '../_variables.css';
6
+ /* Shared variables */
7
+ @import '../variables/_shared.css';
8
8
 
9
9
  @import "./modules.css";
@@ -5,8 +5,14 @@
5
5
  */
6
6
 
7
7
  @import "./_card.css";
8
+ @import "./_contained.css";
8
9
  @import "./_container.css";
9
- @import "./_secondary.css";
10
+ @import "./_flow.css";
10
11
  @import "./_contrast.css";
11
- @import "./_ghost.css";
12
+ @import "./_panel.css";
13
+ @import "./_secondary.css";
14
+ @import "./_sidebar.css";
12
15
  @import "./_striped.css";
16
+
17
+ /* Needs to be imported after other variants to override colors */
18
+ @import "./_ghost.css";