@expressivecss/expressive 0.7.0 → 0.8.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 (105) hide show
  1. package/CHANGELOG.md +1266 -1
  2. package/README.md +14 -11
  3. package/dist/css/expressive.css +4215 -1668
  4. package/dist/css/expressive.css.map +1 -1
  5. package/dist/css/expressive.min.css +1 -1
  6. package/dist/css/expressive.min.css.map +1 -1
  7. package/dist/js/expressive.cjs +1231 -1253
  8. package/dist/js/expressive.cjs.map +4 -4
  9. package/dist/js/expressive.js +1231 -1253
  10. package/dist/js/expressive.js.map +4 -4
  11. package/dist/js/expressive.min.js +12 -12
  12. package/dist/js/expressive.min.js.map +4 -4
  13. package/dist/js/expressive.mjs +1231 -1253
  14. package/dist/js/expressive.mjs.map +4 -4
  15. package/dist/types/behaviors/bottomSheets.d.ts +19 -11
  16. package/dist/types/behaviors/sheetDrag.d.ts +40 -0
  17. package/dist/types/behaviors/sideSheets.d.ts +2 -9
  18. package/dist/types/components/autocomplete.d.ts +15 -3
  19. package/dist/types/components/buttons.d.ts +5 -1
  20. package/dist/types/components/carousel.d.ts +87 -53
  21. package/dist/types/components/chips.d.ts +21 -1
  22. package/dist/types/components/expandingCard.d.ts +31 -0
  23. package/dist/types/components/index.d.ts +21 -20
  24. package/dist/types/components/lightbox.d.ts +1 -0
  25. package/dist/types/components/menu.d.ts +7 -1
  26. package/dist/types/components/{sidenav.d.ts → navigationDrawer.d.ts} +16 -16
  27. package/dist/types/components/registry.d.ts +8 -8
  28. package/dist/types/components/slider.d.ts +26 -85
  29. package/dist/types/components/snackbar.d.ts +20 -5
  30. package/dist/types/components/tabs.d.ts +12 -0
  31. package/dist/types/components/timepicker.d.ts +12 -9
  32. package/dist/types/core/utils.d.ts +64 -53
  33. package/dist/types/index.d.ts +8 -9
  34. package/package.json +15 -1
  35. package/src/sass/README.md +61 -11
  36. package/src/sass/abstracts/_breakpoints.scss +17 -19
  37. package/src/sass/abstracts/_mixins.scss +103 -21
  38. package/src/sass/abstracts/_variables.scss +50 -5
  39. package/src/sass/base/_global.scss +6 -24
  40. package/src/sass/base/_grid.scss +15 -12
  41. package/src/sass/base/_normalize.scss +34 -38
  42. package/src/sass/base/_typography.scss +4 -18
  43. package/src/sass/components/_badges.scss +2 -3
  44. package/src/sass/components/_banners.scss +298 -0
  45. package/src/sass/components/_bottom-app-bar.scss +180 -0
  46. package/src/sass/components/_bottom-sheet.scss +12 -4
  47. package/src/sass/components/_button-groups.scss +186 -0
  48. package/src/sass/components/_buttons.scss +245 -92
  49. package/src/sass/components/_cards.scss +494 -73
  50. package/src/sass/components/_carousel.scss +562 -68
  51. package/src/sass/components/_chips.scss +64 -5
  52. package/src/sass/components/_datepicker.scss +24 -24
  53. package/src/sass/components/_dialog.scss +17 -11
  54. package/src/sass/components/_drag-handle.scss +130 -0
  55. package/src/sass/components/_expanding-card.scss +260 -0
  56. package/src/sass/components/_fab-menu.scss +232 -0
  57. package/src/sass/components/_floating-sheet.scss +86 -0
  58. package/src/sass/components/_icon-buttons.scss +194 -0
  59. package/src/sass/components/_icons-material-design.scss +16 -4
  60. package/src/sass/components/_index.scss +22 -6
  61. package/src/sass/components/_list.scss +16 -13
  62. package/src/sass/components/_loading-indicator.scss +106 -0
  63. package/src/sass/components/_menu.scss +335 -61
  64. package/src/sass/components/_navbar.scss +71 -24
  65. package/src/sass/components/_navigation-bar.scss +13 -10
  66. package/src/sass/components/{_sidenav.scss → _navigation-drawer.scss} +123 -33
  67. package/src/sass/components/_navigation-rail.scss +22 -22
  68. package/src/sass/components/_page-footer.scss +19 -16
  69. package/src/sass/components/_pagination.scss +24 -6
  70. package/src/sass/components/_panes.scss +52 -11
  71. package/src/sass/components/{_preloader.scss → _progress.scss} +11 -3
  72. package/src/sass/components/_scrim.scss +37 -0
  73. package/src/sass/components/_search.scss +259 -0
  74. package/src/sass/components/_segmented-buttons.scss +188 -0
  75. package/src/sass/components/_side-sheet.scss +2 -2
  76. package/src/sass/components/_snackbar.scss +20 -15
  77. package/src/sass/components/_split-button.scss +196 -0
  78. package/src/sass/components/_tabs.scss +7 -8
  79. package/src/sass/components/_timepicker.scss +67 -58
  80. package/src/sass/components/_toolbar.scss +206 -80
  81. package/src/sass/components/forms/_checkboxes.scss +49 -12
  82. package/src/sass/components/forms/_fieldset.scss +4 -4
  83. package/src/sass/components/forms/_file-input.scss +8 -1
  84. package/src/sass/components/forms/_index.scss +1 -1
  85. package/src/sass/components/forms/_input-fields.scss +50 -44
  86. package/src/sass/components/forms/_radio-buttons.scss +42 -10
  87. package/src/sass/components/forms/_select.scss +0 -1
  88. package/src/sass/components/forms/{_range.scss → _slider.scss} +8 -9
  89. package/src/sass/components/forms/_switches.scss +6 -7
  90. package/src/sass/tokens/_index.scss +4 -1
  91. package/src/sass/tokens/_reference.scss +70 -61
  92. package/src/sass/tokens/_state.scss +24 -0
  93. package/src/sass/tokens/_theme.scss +6 -3
  94. package/src/sass/tokens/_vibrant.scss +76 -0
  95. package/src/sass/utilities/_colors.scss +14 -1
  96. package/src/sass/utilities/_helpers.scss +5 -5
  97. package/src/sass/utilities/_visibility.scss +48 -26
  98. package/dist/types/behaviors/waves.d.ts +0 -15
  99. package/dist/types/components/parallax.d.ts +0 -16
  100. package/dist/types/components/range.d.ts +0 -43
  101. package/dist/types/core/bounding.d.ts +0 -6
  102. package/dist/types/core/edges.d.ts +0 -6
  103. package/src/sass/components/_parallax.scss +0 -104
  104. package/src/sass/components/_pulse.scss +0 -37
  105. package/src/sass/components/_slider.scss +0 -129
@@ -0,0 +1,186 @@
1
+ @use "sass:map";
2
+ @use "../abstracts" as *;
3
+
4
+ // Button groups.
5
+ //
6
+ // Anatomy is the HTML. A <div class="button-group"> holding two or more
7
+ // buttons - related actions that read as one control without becoming one.
8
+ // The group is a container of independent buttons: each is its own Tab stop,
9
+ // each does its own thing, and nothing here is scripted.
10
+ //
11
+ // No composite role is declared. `role="toolbar"` and its nine siblings
12
+ // promise arrow-key navigation this component does not implement and does not
13
+ // want to - SEMANTICS rule 2. A group that needs a name takes `role="group"`
14
+ // with an `aria-label`, which promises no keyboard model at all.
15
+ //
16
+ // Two variants and five sizes, which M3 states as ten token families
17
+ // (md.comp.button-group.{standard,connected}.{xsmall…xlarge}, DSP 34.0.21).
18
+ // They collapse to one family here the way the button's own ladder does: the
19
+ // size class rewrites the tokens, and only the numbers that actually differ
20
+ // are named twice.
21
+ //
22
+ // standard items keep their own round shape; the gap closes as the
23
+ // buttons grow (18 / 12 / 8 / 8 / 8dp), and pressing one widens
24
+ // it by 15% of its width
25
+ // connected items sit 2dp apart at every size, the ends of the row are
26
+ // round and the joins are square-ish, and pressing an item
27
+ // squares its inner corners further
28
+ //
29
+ // Selection is deliberately absent. M3's connected group has a selected state
30
+ // with fully round corners, and holding it takes either script or a checked
31
+ // control - which is `.segmented-button`, a <fieldset> of radios that already
32
+ // does exactly that. A group of <button>s has no state to read.
33
+
34
+ // The items: common buttons, and `.circle` for an icon-only one - which is
35
+ // the shape M3 draws a group with most often, and which the group sizes like
36
+ // any other item.
37
+ //
38
+ // `.icon-button` is deliberately *not* an item. It is its own component with
39
+ // its own size ladder, its own insets and its own pressed shape, all set on
40
+ // the element by its own rule - so a group could not size it by handing its
41
+ // items tokens, and the corner morph here would fight the one it already
42
+ // draws. Write `<button class="button circle">` for an icon-only group.
43
+ //
44
+ // This is also not `_buttons.scss`'s `$_btn`, which excludes the widget chrome
45
+ // that happens to be a <button> (a datepicker day, a chip). Chrome cannot
46
+ // reach a group anyway: `button-group-items-are-controls` in semantics.json
47
+ // admits only a <button> or an <a href> as a direct child, so the buttons
48
+ // here are the ones an author put here.
49
+ $_item: ":is(button:not(.icon-button), a.button)";
50
+
51
+ // The size classes, as one `:not()` argument list - which takes the weight of
52
+ // a single class, not five. An item carrying its own size class sets the
53
+ // geometry tokens on itself and beats the group by inheritance; the type role
54
+ // has no such mechanism, so the group's rule has to step aside by selector or
55
+ // an `xlarge` item inside a `medium` group gets xlarge geometry and medium
56
+ // type.
57
+ $_sized: ".xsmall, .small, .medium, .large, .xlarge";
58
+
59
+ // md.comp.button-group.standard.<size>.between-space
60
+ $_standard-space: (
61
+ "xsmall": 18px,
62
+ "small": 12px,
63
+ "medium": 8px,
64
+ "large": 8px,
65
+ "xlarge": 8px,
66
+ );
67
+
68
+ // md.comp.button-group.connected.<size>.{inner-corner, pressed.inner-corner}.
69
+ // The three small sizes share corner.value.small / corner.value.extra-small,
70
+ // which is the group's default, so only the two that differ are listed.
71
+ $_connected-corners: (
72
+ "large": (inner: 16px, pressed: 12px),
73
+ "xlarge": (inner: 20px, pressed: 16px),
74
+ );
75
+
76
+ .button-group {
77
+ --md-comp-button-group-between-space: 12px;
78
+ // M3 states this as a percentage of the item's own width. CSS cannot
79
+ // multiply a length by one, so it is the same figure as a ratio.
80
+ --md-comp-button-group-pressed-item-width-multiplier: .15;
81
+
82
+ display: flex;
83
+ align-items: center;
84
+ gap: var(--md-comp-button-group-between-space);
85
+
86
+ // The size axis. A group sizes its own items by rewriting the button
87
+ // tokens, which the items inherit - so a size is written once, on the
88
+ // group, and a button that wants to differ still overrides it with its own
89
+ // size class. The type role cannot travel that way: `btn` states a
90
+ // font-size of its own, so it is set on the items.
91
+ @each $name, $s in $button-sizes {
92
+ &.#{$name} {
93
+ @include button-size($name);
94
+
95
+ --md-comp-button-group-between-space: #{map.get($_standard-space, $name)};
96
+
97
+ > #{$_item}:not(#{$_sized}) {
98
+ @include typescale(map.get($s, label));
99
+ }
100
+ }
101
+ }
102
+
103
+ > #{$_item} {
104
+ transition: padding .2s ease-out, width .2s ease-out,
105
+ border-radius .2s ease-out, background-color .2s ease-out;
106
+ }
107
+
108
+ // Pressing an item in a standard group widens it. M3 compresses the two
109
+ // neighbours by the same amount so the group's own width never changes;
110
+ // that needs each item's measured width, which is script.
111
+ //
112
+ // ponytail: the grow is 15% of the item's *height* - exact for a `.circle`,
113
+ // whose width is its height, and close for a label - and the items after it
114
+ // slide rather than compress. Measure and compress in JS if a group ever
115
+ // sits in a fixed-width row where the slide is visible.
116
+ &:not(.connected) > #{$_item}:active {
117
+ --_grow: calc(
118
+ var(--md-comp-filled-button-container-height) *
119
+ var(--md-comp-button-group-pressed-item-width-multiplier) / 2
120
+ );
121
+ }
122
+
123
+ // A label button is as wide as its insets make it, so it grows by them.
124
+ &:not(.connected) > #{$_item}:not(.circle):active {
125
+ padding-inline:
126
+ calc(var(--md-comp-filled-button-leading-space) + var(--_grow))
127
+ calc(var(--md-comp-filled-button-trailing-space) + var(--_grow));
128
+ }
129
+
130
+ // A `.circle` states its own width and has no insets to grow - padding would
131
+ // squeeze the icon inside the same box rather than widen it.
132
+ &:not(.connected) > #{$_item}.circle:active {
133
+ width: calc(
134
+ var(--md-comp-filled-button-container-height) + 2 * var(--_grow)
135
+ );
136
+ }
137
+
138
+ // Connected. Emitted after the size rules on purpose: `.button-group.medium`
139
+ // and `.button-group.connected` are both two classes, so source order is the
140
+ // only thing that keeps a connected group at 2dp.
141
+ &.connected {
142
+ --md-comp-button-group-between-space: 2px;
143
+ --md-comp-button-group-container-shape: 9999px;
144
+ --md-comp-button-group-inner-corner-corner-size: 8px;
145
+ --md-comp-button-group-pressed-inner-corner-corner-size: 4px;
146
+
147
+ @each $name, $c in $_connected-corners {
148
+ &.#{$name} {
149
+ --md-comp-button-group-inner-corner-corner-size: #{map.get($c, inner)};
150
+ --md-comp-button-group-pressed-inner-corner-corner-size: #{map.get($c, pressed)};
151
+ }
152
+ }
153
+
154
+ // The corner goes through a variable so that pressing an item changes one
155
+ // value rather than restating `border-radius`. A shorthand under `:active`
156
+ // would take the end items' round outer corners with it.
157
+ > #{$_item} {
158
+ --_corner: var(--md-comp-button-group-inner-corner-corner-size);
159
+
160
+ border-radius: var(--_corner);
161
+
162
+ &:active {
163
+ --_corner: var(--md-comp-button-group-pressed-inner-corner-corner-size);
164
+ }
165
+
166
+ // Logical, so the ends of the row are the ends of the row in RTL too.
167
+ &:first-child {
168
+ border-start-start-radius: var(--md-comp-button-group-container-shape);
169
+ border-end-start-radius: var(--md-comp-button-group-container-shape);
170
+ }
171
+
172
+ &:last-child {
173
+ border-start-end-radius: var(--md-comp-button-group-container-shape);
174
+ border-end-end-radius: var(--md-comp-button-group-container-shape);
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ // The press grow and the corner morph are both motion, and the only motion
181
+ // this component has.
182
+ @media (prefers-reduced-motion: reduce) {
183
+ .button-group > #{$_item} {
184
+ transition: none;
185
+ }
186
+ }