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
package/dist/opui.css CHANGED
@@ -1431,6 +1431,28 @@
1431
1431
  scrollbar-width: thin;
1432
1432
  }
1433
1433
 
1434
+ html {
1435
+ --motion: 1;
1436
+ }
1437
+
1438
+ @media (prefers-reduced-motion: reduce) {
1439
+ html {
1440
+ --motion: 0;
1441
+ }
1442
+ }
1443
+
1444
+ .ui-motion-off {
1445
+ --motion: 0 !important;
1446
+ }
1447
+
1448
+ .ui-motion-on {
1449
+ --motion: 1 !important;
1450
+ }
1451
+
1452
+ .ui-motion-debug {
1453
+ --motion: 10 !important;
1454
+ }
1455
+
1434
1456
  :where(html) {
1435
1457
  --_page-bg-color: var(--surface-default);
1436
1458
 
@@ -1539,19 +1561,11 @@
1539
1561
  border-radius: var(--border-radius, 0px);
1540
1562
  outline: 2px solid var(--_focus-visible-color);
1541
1563
  outline-offset: 2px;
1542
- }
1543
-
1544
- @media (prefers-reduced-motion: no-preference) {
1545
- :where(:focus-visible) {
1546
- transition: outline-offset 0.15 var(--ease-2);
1547
- }
1548
-
1549
- :where(:not(:active):focus-visible) {
1550
- transition-duration: 0.15s;
1551
- }
1564
+ transition: outline-offset calc(0.15s * var(--motion)) var(--ease-2);
1552
1565
  }
1553
1566
 
1554
1567
  :where(:not(:active):focus-visible) {
1568
+ transition-duration: calc(0.15s * var(--motion));
1555
1569
  outline-offset: var(--outline-offset, 0px);
1556
1570
  }
1557
1571
 
@@ -1629,6 +1643,7 @@
1629
1643
 
1630
1644
  @layer components.root {
1631
1645
  :where(.ui-button) {
1646
+ --_motion: var(--motion, 1);
1632
1647
  --_color: light-dark(var(--color-16), var(--color-1));
1633
1648
  --_color-contrast: light-dark(var(--color-1), var(--color-16));
1634
1649
  --_color-tonal: var(--surface-tonal);
@@ -1683,10 +1698,10 @@
1683
1698
  text-align: center;
1684
1699
  text-decoration: none;
1685
1700
  transition:
1686
- background-color 0.1s ease,
1687
- color 0.1s ease,
1688
- border-color 0.1s ease,
1689
- box-shadow 0.1s ease;
1701
+ background-color calc(0.1s * var(--_motion)) ease,
1702
+ color calc(0.1s * var(--_motion)) ease,
1703
+ border-color calc(0.1s * var(--_motion)) ease,
1704
+ box-shadow calc(0.1s * var(--_motion)) ease;
1690
1705
  user-select: none;
1691
1706
 
1692
1707
  /* Colors — shared interaction model for critical and primary.
@@ -1970,6 +1985,7 @@
1970
1985
 
1971
1986
  @layer components.root {
1972
1987
  :where(.ui-icon-button) {
1988
+ --_motion: var(--motion, 1);
1973
1989
  --_color: light-dark(var(--color-16), var(--color-1));
1974
1990
  --_color-contrast: light-dark(var(--color-1), var(--color-16));
1975
1991
  --_color-tonal: var(--surface-tonal);
@@ -2014,10 +2030,10 @@
2014
2030
  padding: 0;
2015
2031
  transform-style: preserve-3d;
2016
2032
  transition:
2017
- background-color 0.1s ease,
2018
- color 0.1s ease,
2019
- border-color 0.1s ease,
2020
- box-shadow 0.1s ease;
2033
+ background-color calc(0.1s * var(--_motion)) ease,
2034
+ color calc(0.1s * var(--_motion)) ease,
2035
+ border-color calc(0.1s * var(--_motion)) ease,
2036
+ box-shadow calc(0.1s * var(--_motion)) ease;
2021
2037
 
2022
2038
  &:where([disabled]) {
2023
2039
  --_text-color: light-dark(rgb(0, 0, 0/0.3), rgb(255, 255, 255/0.26));
@@ -2037,12 +2053,9 @@
2037
2053
  &::before {
2038
2054
  --highlight-size: 130%;
2039
2055
  background-color: transparent;
2040
-
2041
- @media (prefers-reduced-motion: no-preference) {
2042
- transition:
2043
- transform 0.2s ease,
2044
- background-color 0.1s ease;
2045
- }
2056
+ transition:
2057
+ transform calc(0.2s * var(--_motion)) ease,
2058
+ background-color calc(0.1s * var(--_motion)) ease;
2046
2059
  }
2047
2060
 
2048
2061
  /* Colors — shared interaction model for critical and primary.
@@ -2966,6 +2979,7 @@
2966
2979
 
2967
2980
  @layer components.root {
2968
2981
  :where(.ui-progress) {
2982
+ --_motion: var(--motion, 1);
2969
2983
  --_accent-color: var(--primary);
2970
2984
  --_bg-color: var(--surface-tonal);
2971
2985
 
@@ -3006,11 +3020,8 @@
3006
3020
 
3007
3021
  &[value]::-webkit-progress-value {
3008
3022
  background-color: var(--_accent-color);
3009
-
3010
- @media (prefers-reduced-motion: no-preference) {
3011
- transition: inline-size 0.2s
3012
- var(--ease-out-4, cubic-bezier(0, 0, 0.1, 1));
3013
- }
3023
+ transition: inline-size calc(0.2s * var(--_motion))
3024
+ var(--ease-out-4, cubic-bezier(0, 0, 0.1, 1));
3014
3025
  }
3015
3026
 
3016
3027
  &::-moz-progress-bar {
@@ -3019,33 +3030,31 @@
3019
3030
  }
3020
3031
  }
3021
3032
 
3022
- @media (prefers-reduced-motion: no-preference) {
3023
- :where(.ui-progress):has(> progress:indeterminate) {
3024
- &::after {
3025
- animation: indeterminate 2s linear infinite;
3026
- background-color: var(--_accent-color);
3027
- content: "";
3028
- inset: 0 auto 0 0;
3029
- position: absolute;
3030
- will-change: inset-inline-start, inset-inline-end;
3031
- }
3033
+ :where(.ui-progress):has(> progress:indeterminate) {
3034
+ &::after {
3035
+ animation: indeterminate calc(2s * var(--motion, 1)) linear infinite;
3036
+ background-color: var(--_accent-color);
3037
+ content: "";
3038
+ inset: 0 auto 0 0;
3039
+ position: absolute;
3040
+ will-change: inset-inline-start, inset-inline-end;
3041
+ }
3032
3042
 
3033
- & > progress {
3034
- &::-webkit-progress-value {
3035
- background-color: transparent;
3036
- }
3043
+ & > progress {
3044
+ &::-webkit-progress-value {
3045
+ background-color: transparent;
3046
+ }
3037
3047
 
3038
- &::-moz-progress-bar {
3039
- background-color: transparent;
3040
- }
3048
+ &::-moz-progress-bar {
3049
+ background-color: transparent;
3041
3050
  }
3042
3051
  }
3052
+ }
3043
3053
 
3044
- [dir="rtl"] {
3045
- :where(.ui-progress):has(> progress:indeterminate) {
3046
- &::after {
3047
- animation-direction: reverse;
3048
- }
3054
+ [dir="rtl"] {
3055
+ :where(.ui-progress):has(> progress:indeterminate) {
3056
+ &::after {
3057
+ animation-direction: reverse;
3049
3058
  }
3050
3059
  }
3051
3060
  }
@@ -3492,6 +3501,7 @@
3492
3501
 
3493
3502
  @layer components.root {
3494
3503
  :where(.ui-range) {
3504
+ --_motion: var(--motion, 1);
3495
3505
  display: grid;
3496
3506
  gap: var(--size-1) 0;
3497
3507
  /* Two-column base so the optional .value cell can sit next to the
@@ -3765,9 +3775,7 @@
3765
3775
  inline-size: var(--_thumb-size);
3766
3776
  margin-block-start: var(--_thumb-offset);
3767
3777
 
3768
- @media (prefers-reduced-motion: no-preference) {
3769
- transition: box-shadow 0.1s ease;
3770
- }
3778
+ transition: box-shadow calc(0.1s * var(--_motion)) ease;
3771
3779
 
3772
3780
  .ui-fieldset-item:focus-within & {
3773
3781
  border-color: var(--gray-14);
@@ -3786,9 +3794,7 @@
3786
3794
  inline-size: var(--_thumb-size);
3787
3795
  margin-block-start: var(--_thumb-offset);
3788
3796
 
3789
- @media (prefers-reduced-motion: no-preference) {
3790
- transition: box-shadow 0.1s ease;
3791
- }
3797
+ transition: box-shadow calc(0.1s * var(--_motion)) ease;
3792
3798
 
3793
3799
  .ui-fieldset-item:focus-within & {
3794
3800
  border-color: var(--gray-14);
@@ -3835,6 +3841,7 @@
3835
3841
 
3836
3842
  @layer components.root {
3837
3843
  :where(.ui-switch) {
3844
+ --_motion: var(--motion, 1);
3838
3845
  --_accent-color: var(--primary);
3839
3846
  --_accent-contrast: var(--primary-contrast);
3840
3847
 
@@ -3847,7 +3854,7 @@
3847
3854
  --_track-height: var(--size-5);
3848
3855
  --_track-width: var(--size-8);
3849
3856
  --_transition-tf: var(--ease-4);
3850
- --_transition-time: 0.2s;
3857
+ --_transition-time: calc(0.2s * var(--_motion));
3851
3858
 
3852
3859
  align-items: center;
3853
3860
  color: var(--text-primary);
@@ -3919,28 +3926,26 @@
3919
3926
  }
3920
3927
 
3921
3928
  /* Animation */
3922
- @media (prefers-reduced-motion: no-preference) {
3923
- /* Track */
3924
- &::before {
3925
- transition:
3926
- background-color var(--_transition-time) var(--_transition-tf),
3927
- border-color var(--_transition-time) var(--_transition-tf);
3928
- }
3929
+ /* Track */
3930
+ &::before {
3931
+ transition:
3932
+ background-color var(--_transition-time) var(--_transition-tf),
3933
+ border-color var(--_transition-time) var(--_transition-tf);
3934
+ }
3929
3935
 
3930
- /* Dot */
3931
- &::after {
3932
- transition: all var(--_transition-time) var(--_transition-tf);
3933
- }
3936
+ /* Dot */
3937
+ &::after {
3938
+ transition: all var(--_transition-time) var(--_transition-tf);
3939
+ }
3934
3940
 
3941
+ &:active:after {
3942
+ --_dot-outline-size: calc(var(--size-1) + 1px);
3943
+ }
3944
+
3945
+ &:checked {
3935
3946
  &:active:after {
3936
3947
  --_dot-outline-size: calc(var(--size-1) + 1px);
3937
3948
  }
3938
-
3939
- &:checked {
3940
- &:active:after {
3941
- --_dot-outline-size: calc(var(--size-1) + 1px);
3942
- }
3943
- }
3944
3949
  }
3945
3950
  }
3946
3951
 
@@ -5159,6 +5164,7 @@
5159
5164
 
5160
5165
  @layer components.extended {
5161
5166
  :where(details.ui-accordion) {
5167
+ --_motion: var(--motion, 1);
5162
5168
  --_actions-gap: var(--size-1);
5163
5169
  --_actions-margin-block-start: var(--size-3);
5164
5170
  --_actions-padding-block-end: var(--size-1);
@@ -5174,8 +5180,8 @@
5174
5180
  --_shadow: none;
5175
5181
  --_summary-padding-block: var(--size-3);
5176
5182
  --_summary-padding-inline: var(--_padding-inline);
5177
- --_svg-transition: 0.2s var(--ease-1);
5178
- --_transition: 0.2s;
5183
+ --_svg-transition: calc(0.2s * var(--_motion)) var(--ease-1);
5184
+ --_transition: calc(0.2s * var(--_motion));
5179
5185
 
5180
5186
  background-color: var(--_bg-color);
5181
5187
  border: var(--_border-width) solid var(--_border-color);
@@ -5208,9 +5214,7 @@
5208
5214
 
5209
5215
  /* Accordion animation */
5210
5216
  /* https://nerdy.dev/open-and-close-transitions-for-the-details-element */
5211
- @media (prefers-reduced-motion: no-preference) {
5212
- interpolate-size: allow-keywords;
5213
- }
5217
+ interpolate-size: allow-keywords;
5214
5218
 
5215
5219
  &::details-content {
5216
5220
  block-size: 0;
@@ -5678,6 +5682,7 @@ Lists meant to be used stand-alone or as part of Select elements
5678
5682
 
5679
5683
  @layer components.extended {
5680
5684
  :where(.ui-dialog) {
5685
+ --_motion: var(--motion, 1);
5681
5686
  inline-size: 100%;
5682
5687
  inset: 0;
5683
5688
  margin: auto;
@@ -5698,10 +5703,6 @@ Lists meant to be used stand-alone or as part of Select elements
5698
5703
  &::backdrop {
5699
5704
  backdrop-filter: blur(1px);
5700
5705
  background-color: rgba(0, 0, 0, 0.5);
5701
-
5702
- @media (prefers-reduced-motion: reduce) {
5703
- backdrop-filter: none;
5704
- }
5705
5706
  }
5706
5707
 
5707
5708
  &:not([open]) {
@@ -5720,22 +5721,20 @@ Lists meant to be used stand-alone or as part of Select elements
5720
5721
  &[open] {
5721
5722
  opacity: 1;
5722
5723
  transition:
5723
- display 0.2s allow-discrete,
5724
- overlay 0.2s allow-discrete,
5725
- opacity 0.2s var(--ease-out-1);
5724
+ display calc(0.2s * var(--_motion)) allow-discrete,
5725
+ overlay calc(0.2s * var(--_motion)) allow-discrete,
5726
+ opacity calc(0.2s * var(--_motion)) var(--ease-out-1);
5726
5727
 
5727
5728
  @starting-style {
5728
5729
  opacity: 0;
5729
5730
  }
5730
5731
  }
5731
5732
 
5732
- @media (prefers-reduced-motion: no-preference) {
5733
- &[open] {
5734
- margin-block-start: 15%;
5733
+ &[open] {
5734
+ margin-block-start: 15%;
5735
5735
 
5736
- @starting-style {
5737
- opacity: 0;
5738
- }
5736
+ @starting-style {
5737
+ opacity: 0;
5739
5738
  }
5740
5739
  }
5741
5740
  }
@@ -5748,6 +5747,7 @@ Lists meant to be used stand-alone or as part of Select elements
5748
5747
 
5749
5748
  @layer components.root {
5750
5749
  :where(dialog.ui-drawer) {
5750
+ --_motion: var(--motion, 1);
5751
5751
  --_backdrop-bg-color: transparent;
5752
5752
  --_backdrop-blur: blur(2px);
5753
5753
  --_bg-color: var(--surface-default);
@@ -5762,7 +5762,7 @@ Lists meant to be used stand-alone or as part of Select elements
5762
5762
  --_header-padding: var(--size-3);
5763
5763
  --_inline-size: min(375px, 100vi);
5764
5764
  --_shadow: var(--shadow-2);
5765
- --_transition-duration: 0.2s;
5765
+ --_transition-duration: calc(0.2s * var(--_motion));
5766
5766
  --_transition-timing: var(--ease-out-3);
5767
5767
 
5768
5768
  background-color: var(--_bg-color);
@@ -6072,6 +6072,7 @@ Lists meant to be used stand-alone or as part of Select elements
6072
6072
  - Form related styles such as: label, supporting text, error handling
6073
6073
  */
6074
6074
  :where(.ui-text-field, .ui-textarea, .ui-select) {
6075
+ --_motion: var(--motion, 1);
6075
6076
  --_accent-color: var(--primary);
6076
6077
  --_bg-color: var(--surface-default);
6077
6078
  --_border-color: var(--field-border-color);
@@ -6101,9 +6102,8 @@ Lists meant to be used stand-alone or as part of Select elements
6101
6102
  "footer footer footer";
6102
6103
  min-block-size: var(--_height);
6103
6104
 
6104
- @media (prefers-reduced-motion: no-preference) {
6105
- transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
6106
- }
6105
+ transition: border-color calc(0.2s * var(--_motion))
6106
+ cubic-bezier(0.4, 0, 0.2, 1);
6107
6107
  }
6108
6108
 
6109
6109
  :where(.ui-field) :where(input, textarea, select) {
@@ -6518,6 +6518,7 @@ Lists meant to be used stand-alone or as part of Select elements
6518
6518
 
6519
6519
  @layer components.extended {
6520
6520
  :where(.ui-select select) {
6521
+ --_motion: var(--motion, 1);
6521
6522
  position: relative;
6522
6523
 
6523
6524
  /* Default arrow */
@@ -6555,13 +6556,11 @@ Lists meant to be used stand-alone or as part of Select elements
6555
6556
  transform: scale(0.9);
6556
6557
  }
6557
6558
 
6558
- @media (prefers-reduced-motion: no-preference) {
6559
- transition:
6560
- display 0.2s allow-discrete,
6561
- opacity 0.2s var(--ease-3),
6562
- overlay 0.2s allow-discrete,
6563
- scale 0.2s var(--ease-3);
6564
- }
6559
+ transition:
6560
+ display calc(0.2s * var(--_motion)) allow-discrete,
6561
+ opacity calc(0.2s * var(--_motion)) var(--ease-3),
6562
+ overlay calc(0.2s * var(--_motion)) allow-discrete,
6563
+ scale calc(0.2s * var(--_motion)) var(--ease-3);
6565
6564
  }
6566
6565
 
6567
6566
  /* Animation off-stage styles */
@@ -6922,9 +6921,7 @@ Add `.ui-scroll-lock` to any element that uses the [open] attribute (native <dia
6922
6921
  translateZ(-1px) scale(var(--thumb-scale));
6923
6922
  will-change: transform;
6924
6923
 
6925
- @media (prefers-reduced-motion: no-preference) {
6926
- transition: transform 0.2s ease;
6927
- }
6924
+ transition: transform calc(0.2s * var(--motion, 1)) ease;
6928
6925
  }
6929
6926
  }
6930
6927
  }