@solexllc/usx 0.1.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 (76) hide show
  1. package/README.md +45 -0
  2. package/package.json +45 -0
  3. package/src/_utilities.scss +146 -0
  4. package/src/components/_accordion.scss +110 -0
  5. package/src/components/_alert.scss +156 -0
  6. package/src/components/_attribution.scss +40 -0
  7. package/src/components/_avatar-group.scss +50 -0
  8. package/src/components/_avatar.scss +63 -0
  9. package/src/components/_banner.scss +30 -0
  10. package/src/components/_block.scss +105 -0
  11. package/src/components/_branding.scss +89 -0
  12. package/src/components/_breadcrumb.scss +35 -0
  13. package/src/components/_button-group.scss +50 -0
  14. package/src/components/_button.scss +250 -0
  15. package/src/components/_calendar-date.scss +50 -0
  16. package/src/components/_carousel.scss +142 -0
  17. package/src/components/_character-count.scss +12 -0
  18. package/src/components/_checkbox.scss +68 -0
  19. package/src/components/_clickable.scss +81 -0
  20. package/src/components/_code.scss +76 -0
  21. package/src/components/_collection.scss +27 -0
  22. package/src/components/_combobox.scss +59 -0
  23. package/src/components/_copy-to-clipboard.scss +46 -0
  24. package/src/components/_date-picker.scss +58 -0
  25. package/src/components/_eyebrow.scss +10 -0
  26. package/src/components/_file-input.scss +254 -0
  27. package/src/components/_focus.scss +24 -0
  28. package/src/components/_footer.scss +185 -0
  29. package/src/components/_form-group.scss +32 -0
  30. package/src/components/_header.scss +441 -0
  31. package/src/components/_hero.scss +149 -0
  32. package/src/components/_icon-list.scss +23 -0
  33. package/src/components/_icon.scss +18 -0
  34. package/src/components/_image.scss +80 -0
  35. package/src/components/_in-page-nav.scss +74 -0
  36. package/src/components/_indicator.scss +73 -0
  37. package/src/components/_input.scss +135 -0
  38. package/src/components/_language-selector.scss +26 -0
  39. package/src/components/_layout.scss +115 -0
  40. package/src/components/_link.scss +63 -0
  41. package/src/components/_list.scss +4 -0
  42. package/src/components/_misc-banner.scss +143 -0
  43. package/src/components/_modal.scss +47 -0
  44. package/src/components/_page.scss +28 -0
  45. package/src/components/_pagination.scss +202 -0
  46. package/src/components/_process-list.scss +35 -0
  47. package/src/components/_prose.scss +1 -0
  48. package/src/components/_radio-buttons.scss +66 -0
  49. package/src/components/_range-slider.scss +117 -0
  50. package/src/components/_required.scss +7 -0
  51. package/src/components/_search.scss +10 -0
  52. package/src/components/_section.scss +26 -0
  53. package/src/components/_select.scss +112 -0
  54. package/src/components/_sidenav.scss +74 -0
  55. package/src/components/_site-alert.scss +75 -0
  56. package/src/components/_spinner.scss +25 -0
  57. package/src/components/_status.scss +46 -0
  58. package/src/components/_step-indicator.scss +130 -0
  59. package/src/components/_summary-box.scss +42 -0
  60. package/src/components/_swap.scss +151 -0
  61. package/src/components/_switch.scss +108 -0
  62. package/src/components/_table.scss +330 -0
  63. package/src/components/_tag-group.scss +9 -0
  64. package/src/components/_tag.scss +47 -0
  65. package/src/components/_task-list.scss +75 -0
  66. package/src/components/_text-area.scss +87 -0
  67. package/src/components/_theme-picker.scss +60 -0
  68. package/src/components/_time-picker.scss +1 -0
  69. package/src/components/_toggle.scss +34 -0
  70. package/src/components/_tooltip.scss +73 -0
  71. package/src/components/_typography.scss +145 -0
  72. package/src/icons/spinner.svg +14 -0
  73. package/src/img/usx-icons.json +5 -0
  74. package/src/img/usx-sprite.svg +24 -0
  75. package/src/index.scss +67 -0
  76. package/src/themed.scss +11 -0
@@ -0,0 +1,60 @@
1
+ @use 'pkg:@solexllc/usx-theme/variables' as *;
2
+
3
+ .usx-theme-picker {
4
+ display: inline-flex;
5
+ max-width: 20rem;
6
+ color: #fff;
7
+
8
+ @if $usx-theme-picker-trigger-text {
9
+ color: $usx-theme-picker-trigger-text;
10
+ }
11
+
12
+ &__panel {
13
+ display: none;
14
+ align-items: center;
15
+ gap: 0;
16
+ }
17
+
18
+ &--open &__panel {
19
+ display: flex;
20
+ }
21
+
22
+ &--open &__trigger {
23
+ display: none;
24
+ }
25
+
26
+ .usa-select.usx-select {
27
+ margin: 0;
28
+
29
+ // Place focus outline above the toggle button
30
+ z-index: 1;
31
+ }
32
+
33
+ &__toggle,
34
+ &__trigger {
35
+ display: inline-flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ height: 100%;
39
+ min-height: 2.5rem;
40
+ padding: 0.5rem;
41
+ }
42
+
43
+ &__toggle {
44
+ border-top-left-radius: 0 !important;
45
+ border-bottom-left-radius: 0 !important;
46
+ }
47
+
48
+ &__trigger {
49
+ color: #fff;
50
+
51
+ @if $usx-theme-picker-trigger-text {
52
+ color: $usx-theme-picker-trigger-text;
53
+ }
54
+ }
55
+
56
+ &__icon {
57
+ width: 1.25rem;
58
+ height: 1.25rem;
59
+ }
60
+ }
@@ -0,0 +1 @@
1
+ // See _combobox.scss for shared styles and error handling for the time picker component.
@@ -0,0 +1,34 @@
1
+ @use 'pkg:@solexllc/usx-theme/variables' as *;
2
+
3
+ /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
4
+ /* stylelint-disable no-descending-specificity -- Intentional cascade order for toggle states. */
5
+ .usx-toggle {
6
+ /* Radio input + label pattern for HTML-only example */
7
+ &__input {
8
+ position: absolute;
9
+ opacity: 0;
10
+ width: 0;
11
+ height: 0;
12
+ pointer-events: none;
13
+ }
14
+
15
+ &__input:checked + .usa-button.usx-button {
16
+ .usx-toggle__label {
17
+ color: $usx-text-inverse;
18
+ }
19
+ }
20
+
21
+ &__input:checked + .usa-button.usx-button.usa-button--outline {
22
+ background: $usx-color-primary-active;
23
+
24
+ @if $usx-color-primary-active {
25
+ outline: 2px solid $usx-color-primary-active inset;
26
+ }
27
+ }
28
+
29
+ &__input:disabled + .usa-button.usx-button,
30
+ &__item--disabled .usa-button.usx-button {
31
+ opacity: 0.5;
32
+ pointer-events: none;
33
+ }
34
+ }
@@ -0,0 +1,73 @@
1
+ /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
2
+
3
+ @use 'pkg:@solexllc/usx-theme/variables' as *;
4
+
5
+ $usx-triangle-size: 5px;
6
+
7
+ .usx-tooltip {
8
+ position: relative;
9
+ display: inline-block;
10
+
11
+ // Override USWDS default of display:none — we control visibility via CSS hover
12
+ .usa-tooltip__body {
13
+ display: block;
14
+ visibility: hidden;
15
+ opacity: 0;
16
+ margin: 0;
17
+
18
+ // Real USWDS bakes the background/font color as fixed values at build
19
+ // time (see _variables.scss's Tooltip section) — override them here so
20
+ // the tooltip follows the theme instead of staying a flat frozen black.
21
+ @if $usx-tooltip-bg {
22
+ background-color: $usx-tooltip-bg;
23
+
24
+ &::after {
25
+ border-right-color: $usx-tooltip-bg;
26
+ }
27
+ }
28
+
29
+ @if $usx-tooltip-text {
30
+ color: $usx-tooltip-text;
31
+ }
32
+
33
+ // Replace JS-injected inline positioning with CSS transforms
34
+ &--top {
35
+ bottom: calc(100% + #{$usx-triangle-size});
36
+ left: 50%;
37
+ transform: translateX(-50%);
38
+ top: auto;
39
+ }
40
+
41
+ &--bottom {
42
+ top: calc(100% + #{$usx-triangle-size});
43
+ left: 50%;
44
+ transform: translateX(-50%);
45
+ bottom: auto;
46
+ }
47
+
48
+ &--right {
49
+ left: calc(100% + #{$usx-triangle-size});
50
+ top: 50%;
51
+ transform: translateY(-50%);
52
+ }
53
+
54
+ &--left {
55
+ right: calc(100% + #{$usx-triangle-size});
56
+ left: auto;
57
+ top: 50%;
58
+ transform: translateY(-50%);
59
+ }
60
+ }
61
+
62
+ &:hover .usa-tooltip__body,
63
+ &:focus-within .usa-tooltip__body {
64
+ visibility: visible;
65
+ opacity: 1;
66
+ }
67
+
68
+ &:has(.usa-button) {
69
+ .usa-button {
70
+ margin-right: 0;
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,145 @@
1
+ @use 'pkg:@solexllc/usx-theme/variables' as *;
2
+
3
+ // Typography is a "component" like any other in this package: consumers
4
+ // assembling a custom entry file can leave this @forward out entirely to
5
+ // skip base/heading typography styling and rely on their own rules instead.
6
+ //
7
+ // Themeable via the `font-family-*`, `font-size-*`, `font-weight-*` and
8
+ // `line-height-*` tokens in @solexllc/usx-theme.
9
+ //
10
+ // Defaults reproduce today's rendered output exactly (16px/400/1.5, matching
11
+ // the implicit browser defaults already in effect) — this is additive
12
+ // theming capability, not a visual change.
13
+ body {
14
+ font-family: $usx-font-family;
15
+ font-size: $usx-font-size-base;
16
+ font-weight: $usx-font-weight-regular;
17
+ line-height: $usx-line-height-base;
18
+ }
19
+
20
+ .usa-prose {
21
+ h1, h2, h3, h4, h5, h6 {
22
+ font-family: $usx-font-family-heading;
23
+ font-weight: $usx-font-weight-bold;
24
+ line-height: $usx-line-height-heading;
25
+ }
26
+
27
+ h1 { font-size: $usx-font-size-h1; }
28
+ h2 { font-size: $usx-font-size-h2; }
29
+ h3 { font-size: $usx-font-size-h3; }
30
+ h4 { font-size: $usx-font-size-h4; }
31
+ h5 { font-size: $usx-font-size-h5; }
32
+ h6 { font-size: $usx-font-size-h6; }
33
+ }
34
+
35
+ // Native form controls (and USWDS's own wrapper classes around them) don't
36
+ // inherit font-family from `body` by default — browsers give them their own
37
+ // UA stylesheet font, and USWDS's compiled CSS explicitly resets them back
38
+ // to its own hardcoded stack at equal specificity. Matching that same set
39
+ // of selectors here (loaded after USWDS's CSS) is what lets these track
40
+ // `font-family` instead of staying stuck on the untheemable default.
41
+ button,
42
+ input,
43
+ optgroup,
44
+ select,
45
+ textarea,
46
+ .usa-button,
47
+ .usa-sidenav,
48
+ .usa-label,
49
+ .usa-checkbox__label,
50
+ .usa-combo-box__input,
51
+ .usa-combo-box__list,
52
+ .usa-fieldset,
53
+ .usa-hint,
54
+ .usa-input,
55
+ .usa-input-group,
56
+ .usa-radio__label,
57
+ .usa-range,
58
+ .usa-range__value,
59
+ .usa-select,
60
+ .usa-textarea,
61
+ .usa-prose,
62
+ .usa-table caption {
63
+ font-family: $usx-font-family;
64
+ }
65
+
66
+ // ── Component-specific overrides ──────────────────────────────────────────
67
+ // USWDS's compiled CSS also hardcodes font-family directly on several
68
+ // component selectors below (rather than relying on inheritance from
69
+ // `body`), each at its own specificity. Keeping every one of these
70
+ // overrides centralized here — instead of scattered across each
71
+ // component's own partial — means a custom entry file that omits this
72
+ // `typography` component disables ALL font-family theming in one place,
73
+ // leaving every component at USWDS's own default font stack.
74
+ .usx-header {
75
+ font-family: $usx-font-family;
76
+ }
77
+
78
+ .usa-nav.usx-nav {
79
+ font-family: $usx-font-family;
80
+
81
+ .usa-accordion {
82
+ font-family: $usx-font-family;
83
+ }
84
+ }
85
+
86
+ .usx-footer {
87
+ font-family: $usx-font-family;
88
+ }
89
+
90
+ .usx-footer__contact .usa-footer__contact-heading {
91
+ font-family: $usx-font-family-heading;
92
+ }
93
+
94
+ .usx-alert .usa-alert__body {
95
+ font-family: $usx-font-family;
96
+ }
97
+
98
+ .usx-alert .usa-alert__heading {
99
+ font-family: $usx-font-family-heading;
100
+ }
101
+
102
+ // USWDS hardcodes font-family on `.usa-site-alert .usa-alert .usa-alert__body`/
103
+ // `__heading` (0-3-0), which beats the plain `.usx-alert .usa-alert__body`/
104
+ // `__heading` rule above (0-2-0) regardless of load order.
105
+ .usa-site-alert.usx-site-alert .usa-alert.usx-alert {
106
+ .usa-alert__body {
107
+ font-family: $usx-font-family;
108
+ }
109
+
110
+ .usa-alert__heading {
111
+ font-family: $usx-font-family-heading;
112
+ }
113
+ }
114
+
115
+ .usx-table.usa-table {
116
+ font-family: $usx-font-family;
117
+ }
118
+
119
+ .usx-step-indicator {
120
+ font-family: $usx-font-family;
121
+
122
+ .usa-step-indicator__heading {
123
+ font-family: $usx-font-family-heading;
124
+ }
125
+ }
126
+
127
+ .usa-summary-box.usx-summary-box {
128
+ font-family: $usx-font-family;
129
+
130
+ .usa-summary-box__heading {
131
+ font-family: $usx-font-family-heading;
132
+ }
133
+ }
134
+
135
+ .usx-icon-list {
136
+ font-family: $usx-font-family;
137
+
138
+ .usa-icon-list__title {
139
+ font-family: $usx-font-family;
140
+ }
141
+ }
142
+
143
+ .usx-accordion {
144
+ font-family: $usx-font-family;
145
+ }
@@ -0,0 +1,14 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
2
+ <!-- Track: full circle at low opacity -->
3
+ <circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2.5" opacity="0.2" />
4
+ <!-- Head: 90° arc at full opacity -->
5
+ <circle
6
+ cx="12" cy="12" r="10"
7
+ fill="none"
8
+ stroke="currentColor"
9
+ stroke-width="2.5"
10
+ stroke-dasharray="15.71 47.12"
11
+ stroke-linecap="round"
12
+ transform="rotate(-90 12 12)"
13
+ />
14
+ </svg>
@@ -0,0 +1,5 @@
1
+ {
2
+ "items": [
3
+ { "name": "spinner", "meta": "loading spin progress busy wait" }
4
+ ]
5
+ }
@@ -0,0 +1,24 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg">
2
+ <!--
3
+ GENERATED by scripts/build-sprite.mjs from src/icons/*.svg — do not edit.
4
+ Add a new icon by creating src/icons/<name>.svg (a standalone <svg> with
5
+ a viewBox), then run `pnpm -F @solexllc/usx build`. Also add a matching
6
+ { name, meta } entry to usx-icons.json for the Documentation/Icons page's
7
+ search.
8
+ Reference icons with: <use href="./img/usx-sprite.svg#icon-name" />
9
+ -->
10
+ <symbol id="spinner" viewBox="0 0 24 24">
11
+ <!-- Track: full circle at low opacity -->
12
+ <circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2.5" opacity="0.2" />
13
+ <!-- Head: 90° arc at full opacity -->
14
+ <circle
15
+ cx="12" cy="12" r="10"
16
+ fill="none"
17
+ stroke="currentColor"
18
+ stroke-width="2.5"
19
+ stroke-dasharray="15.71 47.12"
20
+ stroke-linecap="round"
21
+ transform="rotate(-90 12 12)"
22
+ />
23
+ </symbol>
24
+ </svg>
package/src/index.scss ADDED
@@ -0,0 +1,67 @@
1
+ @forward './utilities';
2
+ @forward './components/typography';
3
+ @forward './components/accordion';
4
+ @forward './components/alert';
5
+ @forward './components/site-alert';
6
+ @forward './components/footer';
7
+ @forward './components/header';
8
+ @forward './components/branding';
9
+ @forward './components/link';
10
+ @forward './components/tag-group';
11
+ @forward './components/tag';
12
+ @forward './components/task-list';
13
+ @forward './components/hero';
14
+ @forward './components/icon';
15
+ @forward './components/spinner';
16
+ @forward './components/swap';
17
+ @forward './components/image';
18
+ @forward './components/eyebrow';
19
+ @forward './components/attribution';
20
+ @forward './components/block';
21
+ @forward './components/clickable';
22
+ @forward './components/section';
23
+ @forward './components/status';
24
+ @forward './components/code';
25
+ @forward './components/layout';
26
+ @forward './components/misc-banner';
27
+ @forward './components/switch';
28
+ @forward './components/copy-to-clipboard';
29
+ @forward './components/carousel';
30
+ @forward './components/collection';
31
+ @forward './components/avatar';
32
+ @forward './components/calendar-date';
33
+ @forward './components/indicator';
34
+ @forward './components/list';
35
+ @forward './components/required';
36
+ @forward './components/page';
37
+ @forward './components/pagination';
38
+ @forward './components/modal';
39
+ @forward './components/summary-box';
40
+ @forward './components/sidenav';
41
+ @forward './components/icon-list';
42
+ @forward './components/step-indicator';
43
+ @forward './components/form-group';
44
+ @forward './components/banner';
45
+ @forward './components/toggle';
46
+ @forward './components/avatar-group';
47
+ @forward './components/table';
48
+ @forward './components/button';
49
+ @forward './components/button-group';
50
+ @forward './components/checkbox';
51
+ @forward './components/radio-buttons';
52
+ @forward './components/input';
53
+ @forward './components/select';
54
+ @forward './components/file-input';
55
+ @forward './components/date-picker';
56
+ @forward './components/theme-picker';
57
+ @forward './components/text-area';
58
+ @forward './components/tooltip';
59
+ @forward './components/combobox';
60
+ @forward './components/search';
61
+ @forward './components/focus';
62
+ @forward './components/range-slider';
63
+ @forward './components/in-page-nav';
64
+ @forward './components/breadcrumb';
65
+ @forward './components/process-list';
66
+ @forward './components/language-selector';
67
+ @forward './components/character-count';
@@ -0,0 +1,11 @@
1
+ // themed.scss — runtime-themeable build of USX.
2
+ //
3
+ // Loads the generated hooks partial FIRST, which configures the shared
4
+ // variables module with every --usx-* CSS variable hook enabled. The
5
+ // component styles loaded afterwards then compile to
6
+ // var(--usx-*, <static default>) instead of plain static values.
7
+ //
8
+ // Pair the output with @solexllc/usx-theme's theme.css (:root defaults) or
9
+ // set --usx-* custom properties anywhere in the cascade.
10
+ @use 'pkg:@solexllc/usx-theme/hooks';
11
+ @use 'index';