opui-css 5.2.0 → 5.4.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 (87) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components/Accordion/Accordion.vue +38 -0
  3. package/components/Anchor/Anchor.vue +41 -0
  4. package/components/Avatar/Avatar.vue +24 -0
  5. package/components/Avatar/types.d.vue.ts +2 -2
  6. package/components/Badge/Badge.vue +39 -0
  7. package/components/Button/Button.vue +27 -0
  8. package/components/Button/types.ts +0 -3
  9. package/components/ButtonGroup/ButtonGroup.vue +22 -0
  10. package/components/Callout/Callout.vue +63 -0
  11. package/components/Card/Card.vue +28 -0
  12. package/components/Card/types.ts +1 -0
  13. package/components/Checkbox/Checkbox.vue +43 -0
  14. package/components/Checkbox/CheckboxInput.vue +32 -0
  15. package/components/Checkbox/types.ts +0 -1
  16. package/components/Chip/Chip.vue +37 -0
  17. package/components/ClassicSelect/ClassicSelect.vue +54 -0
  18. package/components/ClassicSelect/types.ts +0 -4
  19. package/components/DescriptionList/Description.vue +12 -0
  20. package/components/DescriptionList/DescriptionList.vue +23 -0
  21. package/components/DescriptionList/Item.vue +12 -0
  22. package/components/DescriptionList/Term.vue +12 -0
  23. package/components/Dialog/Dialog.vue +35 -0
  24. package/components/Dialog/types.ts +1 -0
  25. package/components/Divider/Divider.vue +12 -0
  26. package/components/Drawer/Drawer.astro +9 -3
  27. package/components/Drawer/Drawer.vue +46 -0
  28. package/components/Drawer/DrawerFooter.vue +16 -0
  29. package/components/Drawer/DrawerHeader.vue +36 -0
  30. package/components/Drawer/types.d.vue.ts +3 -1
  31. package/components/Drawer/types.ts +1 -0
  32. package/components/FieldDescription/FieldDescription.vue +12 -0
  33. package/components/FieldGroup/FieldGroup.vue +25 -0
  34. package/components/FieldLegend/FieldLegend.vue +18 -0
  35. package/components/FieldSet/FieldSet.vue +18 -0
  36. package/components/Form/Form.vue +14 -0
  37. package/components/IconButton/IconButton.vue +24 -0
  38. package/components/List/List.vue +28 -0
  39. package/components/ListItem/ListItem.vue +98 -0
  40. package/components/Progress/Progress.vue +34 -0
  41. package/components/Radio/Radio.vue +41 -0
  42. package/components/Radio/RadioInput.vue +14 -0
  43. package/components/Radio/types.ts +0 -1
  44. package/components/Range/Range.vue +85 -0
  45. package/components/Range/types.ts +0 -5
  46. package/components/Select/Select.astro +0 -6
  47. package/components/Select/Select.vue +85 -0
  48. package/components/Switch/Switch.vue +63 -0
  49. package/components/Switch/SwitchInput.vue +14 -0
  50. package/components/Table/Body.vue +5 -0
  51. package/components/Table/Cell.vue +5 -0
  52. package/components/Table/Column.vue +19 -0
  53. package/components/Table/ColumnGroup.vue +5 -0
  54. package/components/Table/Head.vue +5 -0
  55. package/components/Table/HeaderCell.vue +5 -0
  56. package/components/Table/Row.vue +5 -0
  57. package/components/Table/Table.vue +19 -0
  58. package/components/Tabs/Tabs.vue +20 -0
  59. package/components/Tabs/TabsItem.vue +39 -0
  60. package/components/Tabs/TabsPanel.vue +31 -0
  61. package/components/Tabs/TabsTab.vue +24 -0
  62. package/components/TextField/TextField.vue +74 -0
  63. package/components/TextField/types.d.vue.ts +3 -1
  64. package/components/Textarea/Textarea.vue +64 -0
  65. package/components/Textarea/types.d.vue.ts +1 -0
  66. package/components/Toast/Toast.vue +48 -0
  67. package/components/ToggleButton/ToggleButton.vue +41 -0
  68. package/components/ToggleGroup/ToggleGroup.vue +36 -0
  69. package/components/Tooltip/Tooltip.vue +22 -0
  70. package/core/normalize.css +24 -10
  71. package/core/utils.css +1 -3
  72. package/css/components/accordion.css +4 -5
  73. package/css/components/button.css +5 -4
  74. package/css/components/dialog.css +8 -13
  75. package/css/components/drawer.css +2 -1
  76. package/css/components/icon-button.css +8 -10
  77. package/css/components/progress.css +23 -27
  78. package/css/components/range.css +3 -6
  79. package/css/components/select.css +6 -7
  80. package/css/components/switch.css +17 -18
  81. package/css/components/text-field.css +3 -3
  82. package/dist/opui.components.css +79 -94
  83. package/dist/opui.components.css.map +1 -1
  84. package/dist/opui.css +104 -107
  85. package/dist/opui.css.map +1 -1
  86. package/package.json +14 -3
  87. package/vue/index.ts +54 -0
@@ -6,6 +6,7 @@
6
6
 
7
7
  @layer components.root {
8
8
  :where(.ui-button) {
9
+ --_motion: var(--motion, 1);
9
10
  --_color: light-dark(var(--color-16), var(--color-1));
10
11
  --_color-contrast: light-dark(var(--color-1), var(--color-16));
11
12
  --_color-tonal: var(--surface-tonal);
@@ -60,10 +61,10 @@
60
61
  text-align: center;
61
62
  text-decoration: none;
62
63
  transition:
63
- background-color 0.1s ease,
64
- color 0.1s ease,
65
- border-color 0.1s ease,
66
- box-shadow 0.1s ease;
64
+ background-color calc(0.1s * var(--_motion)) ease,
65
+ color calc(0.1s * var(--_motion)) ease,
66
+ border-color calc(0.1s * var(--_motion)) ease,
67
+ box-shadow calc(0.1s * var(--_motion)) ease;
67
68
  user-select: none;
68
69
 
69
70
  /* Colors — shared interaction model for critical and primary.
@@ -347,6 +348,7 @@
347
348
 
348
349
  @layer components.root {
349
350
  :where(.ui-icon-button) {
351
+ --_motion: var(--motion, 1);
350
352
  --_color: light-dark(var(--color-16), var(--color-1));
351
353
  --_color-contrast: light-dark(var(--color-1), var(--color-16));
352
354
  --_color-tonal: var(--surface-tonal);
@@ -391,10 +393,10 @@
391
393
  padding: 0;
392
394
  transform-style: preserve-3d;
393
395
  transition:
394
- background-color 0.1s ease,
395
- color 0.1s ease,
396
- border-color 0.1s ease,
397
- box-shadow 0.1s ease;
396
+ background-color calc(0.1s * var(--_motion)) ease,
397
+ color calc(0.1s * var(--_motion)) ease,
398
+ border-color calc(0.1s * var(--_motion)) ease,
399
+ box-shadow calc(0.1s * var(--_motion)) ease;
398
400
 
399
401
  &:where([disabled]) {
400
402
  --_text-color: light-dark(rgb(0, 0, 0/0.3), rgb(255, 255, 255/0.26));
@@ -414,12 +416,9 @@
414
416
  &::before {
415
417
  --highlight-size: 130%;
416
418
  background-color: transparent;
417
-
418
- @media (prefers-reduced-motion: no-preference) {
419
- transition:
420
- transform 0.2s ease,
421
- background-color 0.1s ease;
422
- }
419
+ transition:
420
+ transform calc(0.2s * var(--_motion)) ease,
421
+ background-color calc(0.1s * var(--_motion)) ease;
423
422
  }
424
423
 
425
424
  /* Colors — shared interaction model for critical and primary.
@@ -1343,6 +1342,7 @@
1343
1342
 
1344
1343
  @layer components.root {
1345
1344
  :where(.ui-progress) {
1345
+ --_motion: var(--motion, 1);
1346
1346
  --_accent-color: var(--primary);
1347
1347
  --_bg-color: var(--surface-tonal);
1348
1348
 
@@ -1383,11 +1383,8 @@
1383
1383
 
1384
1384
  &[value]::-webkit-progress-value {
1385
1385
  background-color: var(--_accent-color);
1386
-
1387
- @media (prefers-reduced-motion: no-preference) {
1388
- transition: inline-size 0.2s
1389
- var(--ease-out-4, cubic-bezier(0, 0, 0.1, 1));
1390
- }
1386
+ transition: inline-size calc(0.2s * var(--_motion))
1387
+ var(--ease-out-4, cubic-bezier(0, 0, 0.1, 1));
1391
1388
  }
1392
1389
 
1393
1390
  &::-moz-progress-bar {
@@ -1396,33 +1393,31 @@
1396
1393
  }
1397
1394
  }
1398
1395
 
1399
- @media (prefers-reduced-motion: no-preference) {
1400
- :where(.ui-progress):has(> progress:indeterminate) {
1401
- &::after {
1402
- animation: indeterminate 2s linear infinite;
1403
- background-color: var(--_accent-color);
1404
- content: "";
1405
- inset: 0 auto 0 0;
1406
- position: absolute;
1407
- will-change: inset-inline-start, inset-inline-end;
1408
- }
1396
+ :where(.ui-progress):has(> progress:indeterminate) {
1397
+ &::after {
1398
+ animation: indeterminate calc(2s * var(--motion, 1)) linear infinite;
1399
+ background-color: var(--_accent-color);
1400
+ content: "";
1401
+ inset: 0 auto 0 0;
1402
+ position: absolute;
1403
+ will-change: inset-inline-start, inset-inline-end;
1404
+ }
1409
1405
 
1410
- & > progress {
1411
- &::-webkit-progress-value {
1412
- background-color: transparent;
1413
- }
1406
+ & > progress {
1407
+ &::-webkit-progress-value {
1408
+ background-color: transparent;
1409
+ }
1414
1410
 
1415
- &::-moz-progress-bar {
1416
- background-color: transparent;
1417
- }
1411
+ &::-moz-progress-bar {
1412
+ background-color: transparent;
1418
1413
  }
1419
1414
  }
1415
+ }
1420
1416
 
1421
- [dir="rtl"] {
1422
- :where(.ui-progress):has(> progress:indeterminate) {
1423
- &::after {
1424
- animation-direction: reverse;
1425
- }
1417
+ [dir="rtl"] {
1418
+ :where(.ui-progress):has(> progress:indeterminate) {
1419
+ &::after {
1420
+ animation-direction: reverse;
1426
1421
  }
1427
1422
  }
1428
1423
  }
@@ -1869,6 +1864,7 @@
1869
1864
 
1870
1865
  @layer components.root {
1871
1866
  :where(.ui-range) {
1867
+ --_motion: var(--motion, 1);
1872
1868
  display: grid;
1873
1869
  gap: var(--size-1) 0;
1874
1870
  /* Two-column base so the optional .value cell can sit next to the
@@ -2142,9 +2138,7 @@
2142
2138
  inline-size: var(--_thumb-size);
2143
2139
  margin-block-start: var(--_thumb-offset);
2144
2140
 
2145
- @media (prefers-reduced-motion: no-preference) {
2146
- transition: box-shadow 0.1s ease;
2147
- }
2141
+ transition: box-shadow calc(0.1s * var(--_motion)) ease;
2148
2142
 
2149
2143
  .ui-fieldset-item:focus-within & {
2150
2144
  border-color: var(--gray-14);
@@ -2163,9 +2157,7 @@
2163
2157
  inline-size: var(--_thumb-size);
2164
2158
  margin-block-start: var(--_thumb-offset);
2165
2159
 
2166
- @media (prefers-reduced-motion: no-preference) {
2167
- transition: box-shadow 0.1s ease;
2168
- }
2160
+ transition: box-shadow calc(0.1s * var(--_motion)) ease;
2169
2161
 
2170
2162
  .ui-fieldset-item:focus-within & {
2171
2163
  border-color: var(--gray-14);
@@ -2212,6 +2204,7 @@
2212
2204
 
2213
2205
  @layer components.root {
2214
2206
  :where(.ui-switch) {
2207
+ --_motion: var(--motion, 1);
2215
2208
  --_accent-color: var(--primary);
2216
2209
  --_accent-contrast: var(--primary-contrast);
2217
2210
 
@@ -2224,7 +2217,7 @@
2224
2217
  --_track-height: var(--size-5);
2225
2218
  --_track-width: var(--size-8);
2226
2219
  --_transition-tf: var(--ease-4);
2227
- --_transition-time: 0.2s;
2220
+ --_transition-time: calc(0.2s * var(--_motion));
2228
2221
 
2229
2222
  align-items: center;
2230
2223
  color: var(--text-primary);
@@ -2296,28 +2289,26 @@
2296
2289
  }
2297
2290
 
2298
2291
  /* Animation */
2299
- @media (prefers-reduced-motion: no-preference) {
2300
- /* Track */
2301
- &::before {
2302
- transition:
2303
- background-color var(--_transition-time) var(--_transition-tf),
2304
- border-color var(--_transition-time) var(--_transition-tf);
2305
- }
2292
+ /* Track */
2293
+ &::before {
2294
+ transition:
2295
+ background-color var(--_transition-time) var(--_transition-tf),
2296
+ border-color var(--_transition-time) var(--_transition-tf);
2297
+ }
2306
2298
 
2307
- /* Dot */
2308
- &::after {
2309
- transition: all var(--_transition-time) var(--_transition-tf);
2310
- }
2299
+ /* Dot */
2300
+ &::after {
2301
+ transition: all var(--_transition-time) var(--_transition-tf);
2302
+ }
2311
2303
 
2304
+ &:active:after {
2305
+ --_dot-outline-size: calc(var(--size-1) + 1px);
2306
+ }
2307
+
2308
+ &:checked {
2312
2309
  &:active:after {
2313
2310
  --_dot-outline-size: calc(var(--size-1) + 1px);
2314
2311
  }
2315
-
2316
- &:checked {
2317
- &:active:after {
2318
- --_dot-outline-size: calc(var(--size-1) + 1px);
2319
- }
2320
- }
2321
2312
  }
2322
2313
  }
2323
2314
 
@@ -3536,6 +3527,7 @@
3536
3527
 
3537
3528
  @layer components.extended {
3538
3529
  :where(details.ui-accordion) {
3530
+ --_motion: var(--motion, 1);
3539
3531
  --_actions-gap: var(--size-1);
3540
3532
  --_actions-margin-block-start: var(--size-3);
3541
3533
  --_actions-padding-block-end: var(--size-1);
@@ -3551,8 +3543,8 @@
3551
3543
  --_shadow: none;
3552
3544
  --_summary-padding-block: var(--size-3);
3553
3545
  --_summary-padding-inline: var(--_padding-inline);
3554
- --_svg-transition: 0.2s var(--ease-1);
3555
- --_transition: 0.2s;
3546
+ --_svg-transition: calc(0.2s * var(--_motion)) var(--ease-1);
3547
+ --_transition: calc(0.2s * var(--_motion));
3556
3548
 
3557
3549
  background-color: var(--_bg-color);
3558
3550
  border: var(--_border-width) solid var(--_border-color);
@@ -3585,9 +3577,7 @@
3585
3577
 
3586
3578
  /* Accordion animation */
3587
3579
  /* https://nerdy.dev/open-and-close-transitions-for-the-details-element */
3588
- @media (prefers-reduced-motion: no-preference) {
3589
- interpolate-size: allow-keywords;
3590
- }
3580
+ interpolate-size: allow-keywords;
3591
3581
 
3592
3582
  &::details-content {
3593
3583
  block-size: 0;
@@ -4055,6 +4045,7 @@ Lists meant to be used stand-alone or as part of Select elements
4055
4045
 
4056
4046
  @layer components.extended {
4057
4047
  :where(.ui-dialog) {
4048
+ --_motion: var(--motion, 1);
4058
4049
  inline-size: 100%;
4059
4050
  inset: 0;
4060
4051
  margin: auto;
@@ -4075,10 +4066,6 @@ Lists meant to be used stand-alone or as part of Select elements
4075
4066
  &::backdrop {
4076
4067
  backdrop-filter: blur(1px);
4077
4068
  background-color: rgba(0, 0, 0, 0.5);
4078
-
4079
- @media (prefers-reduced-motion: reduce) {
4080
- backdrop-filter: none;
4081
- }
4082
4069
  }
4083
4070
 
4084
4071
  &:not([open]) {
@@ -4097,22 +4084,20 @@ Lists meant to be used stand-alone or as part of Select elements
4097
4084
  &[open] {
4098
4085
  opacity: 1;
4099
4086
  transition:
4100
- display 0.2s allow-discrete,
4101
- overlay 0.2s allow-discrete,
4102
- opacity 0.2s var(--ease-out-1);
4087
+ display calc(0.2s * var(--_motion)) allow-discrete,
4088
+ overlay calc(0.2s * var(--_motion)) allow-discrete,
4089
+ opacity calc(0.2s * var(--_motion)) var(--ease-out-1);
4103
4090
 
4104
4091
  @starting-style {
4105
4092
  opacity: 0;
4106
4093
  }
4107
4094
  }
4108
4095
 
4109
- @media (prefers-reduced-motion: no-preference) {
4110
- &[open] {
4111
- margin-block-start: 15%;
4096
+ &[open] {
4097
+ margin-block-start: 15%;
4112
4098
 
4113
- @starting-style {
4114
- opacity: 0;
4115
- }
4099
+ @starting-style {
4100
+ opacity: 0;
4116
4101
  }
4117
4102
  }
4118
4103
  }
@@ -4125,6 +4110,7 @@ Lists meant to be used stand-alone or as part of Select elements
4125
4110
 
4126
4111
  @layer components.root {
4127
4112
  :where(dialog.ui-drawer) {
4113
+ --_motion: var(--motion, 1);
4128
4114
  --_backdrop-bg-color: transparent;
4129
4115
  --_backdrop-blur: blur(2px);
4130
4116
  --_bg-color: var(--surface-default);
@@ -4139,7 +4125,7 @@ Lists meant to be used stand-alone or as part of Select elements
4139
4125
  --_header-padding: var(--size-3);
4140
4126
  --_inline-size: min(375px, 100vi);
4141
4127
  --_shadow: var(--shadow-2);
4142
- --_transition-duration: 0.2s;
4128
+ --_transition-duration: calc(0.2s * var(--_motion));
4143
4129
  --_transition-timing: var(--ease-out-3);
4144
4130
 
4145
4131
  background-color: var(--_bg-color);
@@ -4449,6 +4435,7 @@ Lists meant to be used stand-alone or as part of Select elements
4449
4435
  - Form related styles such as: label, supporting text, error handling
4450
4436
  */
4451
4437
  :where(.ui-text-field, .ui-textarea, .ui-select) {
4438
+ --_motion: var(--motion, 1);
4452
4439
  --_accent-color: var(--primary);
4453
4440
  --_bg-color: var(--surface-default);
4454
4441
  --_border-color: var(--field-border-color);
@@ -4478,9 +4465,8 @@ Lists meant to be used stand-alone or as part of Select elements
4478
4465
  "footer footer footer";
4479
4466
  min-block-size: var(--_height);
4480
4467
 
4481
- @media (prefers-reduced-motion: no-preference) {
4482
- transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
4483
- }
4468
+ transition: border-color calc(0.2s * var(--_motion))
4469
+ cubic-bezier(0.4, 0, 0.2, 1);
4484
4470
  }
4485
4471
 
4486
4472
  :where(.ui-field) :where(input, textarea, select) {
@@ -4895,6 +4881,7 @@ Lists meant to be used stand-alone or as part of Select elements
4895
4881
 
4896
4882
  @layer components.extended {
4897
4883
  :where(.ui-select select) {
4884
+ --_motion: var(--motion, 1);
4898
4885
  position: relative;
4899
4886
 
4900
4887
  /* Default arrow */
@@ -4932,13 +4919,11 @@ Lists meant to be used stand-alone or as part of Select elements
4932
4919
  transform: scale(0.9);
4933
4920
  }
4934
4921
 
4935
- @media (prefers-reduced-motion: no-preference) {
4936
- transition:
4937
- display 0.2s allow-discrete,
4938
- opacity 0.2s var(--ease-3),
4939
- overlay 0.2s allow-discrete,
4940
- scale 0.2s var(--ease-3);
4941
- }
4922
+ transition:
4923
+ display calc(0.2s * var(--_motion)) allow-discrete,
4924
+ opacity calc(0.2s * var(--_motion)) var(--ease-3),
4925
+ overlay calc(0.2s * var(--_motion)) allow-discrete,
4926
+ scale calc(0.2s * var(--_motion)) var(--ease-3);
4942
4927
  }
4943
4928
 
4944
4929
  /* Animation off-stage styles */