@ostack.tech/ui 1.2.0 → 1.3.0-beta.1

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 (139) hide show
  1. package/dist/chunks/{en-DGLb7rrz.js → en-W4OWqPrv.js} +3 -4
  2. package/dist/chunks/en-W4OWqPrv.js.map +1 -0
  3. package/dist/chunks/{platformUtils-dLFQaWJG.js → platformUtils-Dm2Fkhni.js} +2 -3
  4. package/dist/chunks/{platformUtils-dLFQaWJG.js.map → platformUtils-Dm2Fkhni.js.map} +1 -1
  5. package/dist/locales/en-GB.js +2 -3
  6. package/dist/locales/en-GB.js.map +1 -1
  7. package/dist/locales/en-US.js +2 -3
  8. package/dist/locales/en-US.js.map +1 -1
  9. package/dist/locales/fr-FR.js +2 -3
  10. package/dist/locales/fr-FR.js.map +1 -1
  11. package/dist/locales/pt-PT.js +2 -3
  12. package/dist/locales/pt-PT.js.map +1 -1
  13. package/dist/ostack-ui.css +942 -255
  14. package/dist/ostack-ui.js +9889 -7842
  15. package/dist/ostack-ui.js.map +1 -1
  16. package/package.json +6 -6
  17. package/scss/_utils.scss +2 -1
  18. package/scss/components/ButtonGroup/_ButtonGroup.scss +7 -4
  19. package/scss/components/Calendar/_Calendar.scss +0 -1
  20. package/scss/components/Card/_Card.scss +16 -7
  21. package/scss/components/Code/_Code.scss +3 -3
  22. package/scss/components/Container/_Container.scss +3 -3
  23. package/scss/components/ControlCode/_ControlCode.scss +1 -1
  24. package/scss/components/DataTable/_DataTable.scss +8 -8
  25. package/scss/components/DescriptionList/_DescriptionList.scss +1 -1
  26. package/scss/components/DropdownMenu/_DropdownMenu.scss +8 -2
  27. package/scss/components/Feedback/_Feedback.scss +12 -9
  28. package/scss/components/Field/_Field.scss +3 -3
  29. package/scss/components/FieldGroup/_FieldGroup.scss +2 -1
  30. package/scss/components/Form/_Form.scss +2 -2
  31. package/scss/components/Grid/_Grid.scss +17 -11
  32. package/scss/components/Heading/_Heading-variables.scss +4 -1
  33. package/scss/components/Heading/_Heading.scss +22 -10
  34. package/scss/components/HelperText/_HelperText.scss +9 -7
  35. package/scss/components/Icon/_Icon-variables.scss +1 -0
  36. package/scss/components/Icon/_Icon.scss +2 -6
  37. package/scss/components/Keyboard/_Keyboard-variables.scss +4 -2
  38. package/scss/components/Keyboard/_Keyboard.scss +8 -4
  39. package/scss/components/Label/_Label-variables.scss +4 -0
  40. package/scss/components/Label/_Label.scss +13 -4
  41. package/scss/components/Link/_Link-variables.scss +1 -1
  42. package/scss/components/Link/_Link.scss +12 -3
  43. package/scss/components/Mark/_Mark.scss +2 -1
  44. package/scss/components/Spinner/_Spinner-variables.scss +1 -1
  45. package/scss/components/Spinner/_Spinner.scss +0 -7
  46. package/scss/components/Stack/_Stack.scss +22 -12
  47. package/scss/components/Stepper/_Stepper-variables.scss +0 -4
  48. package/scss/components/Stepper/_Stepper.scss +1 -6
  49. package/scss/components/Tabs/_Tabs-variables.scss +0 -1
  50. package/scss/components/Tabs/_Tabs.scss +4 -3
  51. package/scss/components/Tag/_Tag-variables.scss +1 -0
  52. package/scss/components/Tag/_Tag.scss +4 -3
  53. package/scss/components/Text/_Text-variables.scss +4 -0
  54. package/scss/components/Text/_Text.scss +19 -0
  55. package/scss/index.scss +5 -0
  56. package/scss/scss/helpers/_margin-utils.scss +35 -0
  57. package/scss/scss/helpers/_padding-utils.scss +35 -0
  58. package/scss/scss/helpers/_print-utils.scss +1 -1
  59. package/scss/scss/helpers/_sizing-utils.scss +45 -0
  60. package/scss/scss/helpers/_text-utils.scss +43 -0
  61. package/scss/scss/placeholders/checkable-group/_checkable-group.scss +2 -2
  62. package/scss/scss/placeholders/control/_control.scss +1 -9
  63. package/scss/scss/placeholders/menu/_menu.scss +2 -1
  64. package/scss/scss/placeholders/popover/_popover.scss +2 -2
  65. package/scss/scss/utils/_responsive-values.scss +7 -8
  66. package/types/components/Actions/Action.d.ts +1 -1
  67. package/types/components/Actions/Actions.d.ts +1 -1
  68. package/types/components/Alert/Alert.d.ts +3 -2
  69. package/types/components/Box/Box.d.ts +37 -0
  70. package/types/components/Box/index.d.ts +1 -0
  71. package/types/components/Button/Button.d.ts +3 -2
  72. package/types/components/ButtonGroup/ButtonGroup.d.ts +3 -2
  73. package/types/components/Calendar/Calendar.d.ts +3 -2
  74. package/types/components/Calendar/CalendarContext.d.ts +1 -0
  75. package/types/components/Card/Card.d.ts +3 -2
  76. package/types/components/Card/CardTitle.d.ts +3 -2
  77. package/types/components/Checkbox/Checkbox.d.ts +2 -1
  78. package/types/components/CheckboxGroup/CheckboxGroup.d.ts +3 -2
  79. package/types/components/Code/Code.d.ts +4 -2
  80. package/types/components/Container/Container.d.ts +3 -2
  81. package/types/components/Control/Control.d.ts +13 -13
  82. package/types/components/ControlCode/ControlCode.d.ts +3 -2
  83. package/types/components/DataTable/DataTableBody.d.ts +2 -3
  84. package/types/components/DataTable/DataTablePagination.d.ts +3 -2
  85. package/types/components/DataTable/DataTableRowsPerPage.d.ts +3 -2
  86. package/types/components/DataTable/ScrolledDataTableRows.d.ts +2 -2
  87. package/types/components/DataTable/useVirtualizerSnapshot.d.ts +13 -0
  88. package/types/components/DateRangeInput/DateRangeInput.d.ts +5 -6
  89. package/types/components/DropdownMenu/DropdownMenuContent.d.ts +3 -2
  90. package/types/components/Feedback/Feedback.d.ts +6 -4
  91. package/types/components/Feedback/FeedbackList.d.ts +3 -2
  92. package/types/components/Field/Field.d.ts +5 -10
  93. package/types/components/FieldGroup/FieldGroup.d.ts +3 -2
  94. package/types/components/FieldGroup/FieldGroupTitle.d.ts +3 -2
  95. package/types/components/Form/Form.d.ts +3 -8
  96. package/types/components/Grid/Grid.d.ts +11 -4
  97. package/types/components/Grid/GridContext.d.ts +1 -1
  98. package/types/components/Heading/Heading.d.ts +12 -3
  99. package/types/components/HelperText/HelperText.d.ts +4 -2
  100. package/types/components/Icon/Icon.d.ts +9 -4
  101. package/types/components/IconButton/IconButton.d.ts +3 -2
  102. package/types/components/Keybinds/Keybinds.d.ts +3 -2
  103. package/types/components/Keyboard/Keyboard.d.ts +17 -4
  104. package/types/components/Label/Label.d.ts +11 -2
  105. package/types/components/Link/Link.d.ts +4 -2
  106. package/types/components/Mark/Mark.d.ts +7 -5
  107. package/types/components/MenuList/MenuList.d.ts +3 -2
  108. package/types/components/Popover/Popover.d.ts +1 -1
  109. package/types/components/Popover/PopoverContent.d.ts +4 -2
  110. package/types/components/Printer/PrinterContent.d.ts +3 -9
  111. package/types/components/RadioGroup/Radio.d.ts +2 -1
  112. package/types/components/RadioGroup/RadioGroup.d.ts +3 -2
  113. package/types/components/Root/Root.d.ts +3 -8
  114. package/types/components/Root/RootElement.d.ts +2 -2
  115. package/types/components/Separator/Separator.d.ts +2 -1
  116. package/types/components/Slot/Slot.d.ts +1 -1
  117. package/types/components/Spinner/Spinner.d.ts +7 -4
  118. package/types/components/Stack/Stack.d.ts +10 -11
  119. package/types/components/Stack/StackContext.d.ts +1 -1
  120. package/types/components/Stepper/StepContent.d.ts +3 -8
  121. package/types/components/Stepper/StepList.d.ts +3 -2
  122. package/types/components/Stepper/Stepper.d.ts +9 -13
  123. package/types/components/Table/Table.d.ts +2 -1
  124. package/types/components/Tabs/TabContent.d.ts +3 -2
  125. package/types/components/Tabs/TabList.d.ts +2 -1
  126. package/types/components/Tabs/Tabs.d.ts +6 -4
  127. package/types/components/Tag/Tag.d.ts +4 -2
  128. package/types/components/Text/Text.d.ts +48 -0
  129. package/types/components/Text/index.d.ts +1 -0
  130. package/types/index.d.ts +10 -3
  131. package/types/utils/localeUtils.d.ts +8 -0
  132. package/types/utils/responsiveValues.d.ts +41 -0
  133. package/types/utils/useMarginProps.d.ts +46 -0
  134. package/types/utils/usePaddingProps.d.ts +46 -0
  135. package/types/utils/useSizingProps.d.ts +23 -0
  136. package/types/utils/useTextProps.d.ts +50 -0
  137. package/dist/chunks/en-DGLb7rrz.js.map +0 -1
  138. package/types/utils/changeCase.d.ts +0 -2
  139. package/types/utils/useResponsiveValues.d.ts +0 -41
@@ -1,9 +1,9 @@
1
1
  @use "Link-variables" as *;
2
2
  @use "../../scss/base-variables" as *;
3
+ @use "../../scss/utils/button-reset" as *;
3
4
 
4
5
  .#{$prefix}link {
5
6
  &:is(:any-link, button) {
6
- all: unset;
7
7
  box-sizing: border-box;
8
8
  cursor: $link-cursor;
9
9
 
@@ -13,7 +13,7 @@
13
13
  text-decoration-color: $link-text-decoration-color;
14
14
  text-decoration-thickness: $link-text-decoration-thickness;
15
15
  text-underline-offset: $link-text-underline-offset;
16
- font-weight: $link-font-weight;
16
+ font-weight: var(--#{prefix}font-weight, $link-font-weight);
17
17
 
18
18
  &:hover {
19
19
  color: $link-hover-color;
@@ -28,12 +28,21 @@
28
28
  }
29
29
  }
30
30
 
31
+ &:is(button) {
32
+ @include button-reset();
33
+
34
+ padding: 0;
35
+ background-color: transparent;
36
+ border: none;
37
+ font: inherit;
38
+ }
39
+
31
40
  // Alert variant
32
41
  &--alert:is(:any-link, button) {
33
42
  color: $link-alert-color;
34
43
  text-decoration-line: $link-alert-text-decoration-line;
35
44
  text-decoration-color: $link-alert-text-decoration-color;
36
- font-weight: $link-alert-font-weight;
45
+ font-weight: var(--#{prefix}font-weight, $link-alert-font-weight);
37
46
 
38
47
  &:hover {
39
48
  color: $link-alert-hover-color;
@@ -3,7 +3,8 @@
3
3
 
4
4
  .#{$prefix}mark {
5
5
  padding: $mark-padding-y $mark-padding-x;
6
- margin: 0 calc($mark-padding-x * -1);
6
+ margin: var(--#{$prefix}mt, 0) calc(var(--#{$prefix}mr, 0px) + $mark-padding-x * -1)
7
+ var(--#{$prefix}mb, 0) calc(var(--#{$prefix}ml, 0px) + $mark-padding-x * -1);
7
8
  border-radius: $mark-border-radius;
8
9
 
9
10
  background-color: $mark-background-color;
@@ -1,5 +1,5 @@
1
1
  @use "../../scss/base-variables" as *;
2
2
 
3
- // Accent
3
+ // Colour
4
4
  $spinner-accent-track-color: var(--#{$prefix}accent-a5) !default;
5
5
  $spinner-accent-indicator-color: var(--#{$prefix}accent-a11) !default;
@@ -11,11 +11,4 @@
11
11
  @include declare-var(--#{$prefix}spinner-track-color, $spinner-accent-track-color);
12
12
  @include declare-var(--#{$prefix}spinner-indicator-color, $spinner-accent-indicator-color);
13
13
  }
14
-
15
- // Sizes
16
- @each $size, $font-size in $font-size-by-size {
17
- &--#{$size} {
18
- font-size: $font-size;
19
- }
20
- }
21
14
  }
@@ -4,43 +4,53 @@
4
4
  @use "../../scss/utils/responsive-values" as *;
5
5
 
6
6
  .#{$prefix}stack {
7
- $stack: &;
8
-
9
7
  display: flex;
10
8
  flex-direction: var(--#{$prefix}stack-direction);
11
- justify-content: var(--#{$prefix}stack-justify-content);
12
9
  align-items: var(--#{$prefix}stack-align-items);
10
+ justify-content: var(--#{$prefix}stack-justify-content);
13
11
  align-content: var(--#{$prefix}stack-align-content);
14
12
  flex-wrap: var(--#{$prefix}stack-wrap);
15
13
 
16
14
  // Handle responsive values
17
15
  @include responsive-values(
18
- --#{$prefix}stack,
16
+ #{$prefix}stack-,
19
17
  (
20
18
  direction: column,
21
19
  gap: $stack-default-gap,
22
- child-margin: var(--#{$prefix}stack-gap) 0 0 0,
23
- justify-content: null,
20
+ child-mt: var(--#{$prefix}stack-gap),
21
+ child-mr: 0px,
22
+ child-mb: 0px,
23
+ child-ml: 0px,
24
24
  align-items: null,
25
+ justify-content: null,
25
26
  align-content: null,
26
27
  wrap: null,
27
28
  )
28
29
  );
29
30
 
30
31
  // Handle margins of non-stack children
31
- & > :not(style) + :not(style):not(#{$stack}) {
32
- margin: var(--#{$prefix}stack-child-margin);
32
+ & > :not(style) + :not(style):not(&) {
33
+ margin: calc(var(--#{$prefix}mt, 0px) + var(--#{$prefix}stack-child-mt))
34
+ calc(var(--#{$prefix}mr, 0px) + var(--#{$prefix}stack-child-mr))
35
+ calc(var(--#{$prefix}mb, 0px) + var(--#{$prefix}stack-child-mb))
36
+ calc(var(--#{$prefix}ml, 0px) + var(--#{$prefix}stack-child-ml));
33
37
  }
34
38
 
35
39
  // Handle margins of stack children
36
- & > :not(style) + #{$stack} {
37
- margin: var(--#{$prefix}stack-ancestor-child-margin);
40
+ & > :not(style) + & {
41
+ margin: calc(var(--#{$prefix}mt, 0px) + var(--#{$prefix}stack-ancestor-child-mt))
42
+ calc(var(--#{$prefix}mr, 0px) + var(--#{$prefix}stack-ancestor-child-mr))
43
+ calc(var(--#{$prefix}mb, 0px) + var(--#{$prefix}stack-ancestor-child-mb))
44
+ calc(var(--#{$prefix}ml, 0px) + var(--#{$prefix}stack-ancestor-child-ml));
38
45
 
39
46
  @include responsive-values(
40
- --#{$prefix}stack,
47
+ #{$prefix}stack-,
41
48
  (
42
49
  ancestor-gap: $stack-default-gap,
43
- ancestor-child-margin: var(--#{$prefix}stack-ancestor-gap) 0 0 0,
50
+ ancestor-child-mt: var(--#{$prefix}stack-ancestor-gap),
51
+ ancestor-child-mr: 0px,
52
+ ancestor-child-mb: 0px,
53
+ ancestor-child-ml: 0px,
44
54
  )
45
55
  );
46
56
  }
@@ -1,9 +1,6 @@
1
1
  @use "../../scss/base-variables" as *;
2
2
  @use "../../scss/utils/spacing" as *;
3
3
 
4
- // Step list
5
- $stepper-step-list-margin-y: spacing(2) !default;
6
-
7
4
  // Step
8
5
  $stepper-step-size: 30px !default;
9
6
  $stepper-step-border-radius: 50% !default;
@@ -29,7 +26,6 @@ $stepper-step-line-completed-background-color: var(--#{$prefix}primary-a9) !defa
29
26
  $stepper-step-line-completed-status-background-color: var(--#{$prefix}accent-a9) !default;
30
27
 
31
28
  // Step content label
32
- $stepper-step-content-label-margin-bottom: spacing(1.5) !default;
33
29
  $stepper-step-content-label-font-size: var(--#{$prefix}font-size-sm) !default;
34
30
  $stepper-step-content-label-line-height: var(--#{$prefix}font-size-sm) !default;
35
31
  $stepper-step-content-label-font-weight: $font-weight-medium !default;
@@ -14,10 +14,6 @@
14
14
  padding: 0;
15
15
  display: flex;
16
16
  justify-content: center;
17
-
18
- &:not(:last-child) {
19
- margin-bottom: $stepper-step-list-margin-y;
20
- }
21
17
  }
22
18
 
23
19
  &__step {
@@ -78,7 +74,6 @@
78
74
  display: inline-flex;
79
75
  align-items: center;
80
76
 
81
- margin-bottom: $stepper-step-content-label-margin-bottom;
82
77
  font-size: $stepper-step-content-label-font-size;
83
78
  line-height: $stepper-step-content-label-line-height;
84
79
  font-weight: $stepper-step-content-label-font-weight;
@@ -96,7 +91,7 @@
96
91
  }
97
92
 
98
93
  &__step-content {
99
- width: 100%;
94
+ width: var(--#{$prefix}w, 100%);
100
95
 
101
96
  &:focus-visible {
102
97
  outline: $stepper-step-content-focus-outline-width solid
@@ -182,7 +182,6 @@ $tabs-tab-content-label-padding-y: calc(
182
182
  $tabs-tab-content-label-padding-x: calc(
183
183
  $tabs-tab-default-padding-x + $tabs-tab-inner-default-padding-x
184
184
  ) !default;
185
- $tabs-tab-content-label-margin-bottom: spacing(1.5) !default;
186
185
  $tabs-tab-content-label-border-bottom: 2px solid var(--#{$prefix}primary-9) !default;
187
186
  $tabs-tab-content-label-font-size: var(--#{$prefix}font-size-sm) !default;
188
187
  $tabs-tab-content-label-line-height: var(--#{$prefix}font-size-sm) !default;
@@ -9,7 +9,7 @@
9
9
 
10
10
  .#{$prefix}tabs {
11
11
  display: block;
12
- min-width: 0;
12
+ min-width: var(--#{$prefix}min-w, 0);
13
13
 
14
14
  @each $variant in $tabs-variants {
15
15
  &--#{$variant} {
@@ -32,7 +32,9 @@
32
32
  // Tab list
33
33
  &__tab-list-root {
34
34
  display: flex;
35
- margin-bottom: var(--#{$prefix}tabs-tab-list-margin-bottom);
35
+ margin-bottom: calc(
36
+ var(--#{$prefix}mb, 0px) + var(--#{$prefix}tabs-tab-list-margin-bottom, 0px)
37
+ );
36
38
  box-shadow: var(--#{$prefix}tabs-tab-list-box-shadow);
37
39
  }
38
40
 
@@ -414,7 +416,6 @@
414
416
  &__tab-content-label {
415
417
  display: inline-flex;
416
418
 
417
- margin-bottom: $tabs-tab-content-label-margin-bottom;
418
419
  padding: $tabs-tab-content-label-padding-y $tabs-tab-content-label-padding-x;
419
420
  border-bottom: $tabs-tab-content-label-border-bottom;
420
421
  font-size: $tabs-tab-content-label-font-size;
@@ -8,6 +8,7 @@ $tag-font-size: 0.75em !default;
8
8
  $tag-line-height: 1.25 !default;
9
9
  $tag-font-weight: $font-weight-medium !default;
10
10
  $tag-text-transform: null !default;
11
+ $tag-text-align: center !default;
11
12
  $tag-animation-duration: 0.15s !default;
12
13
  $tag-animation-timing-function: ease !default;
13
14
 
@@ -15,10 +15,11 @@
15
15
  padding: $tag-padding-y $tag-padding-x;
16
16
  border-radius: $tag-border-radius;
17
17
 
18
- font-size: $tag-font-size;
19
- line-height: $tag-line-height;
20
- font-weight: $tag-font-weight;
18
+ font-size: var(--#{$prefix}font-size, $tag-font-size);
19
+ line-height: var(--#{$prefix}line-height, $tag-line-height);
20
+ font-weight: var(--#{$prefix}font-weight, $tag-font-weight);
21
21
  text-transform: $tag-text-transform;
22
+ text-align: var(--#{$prefix}text-align, $tag-text-align);
22
23
 
23
24
  background-color: var(--#{$prefix}tag-background-color);
24
25
  color: var(--#{$prefix}tag-color);
@@ -0,0 +1,4 @@
1
+ @use "../../scss/base-variables" as *;
2
+
3
+ $text-accent-color: var(--#{$prefix}accent-a11) !default;
4
+ $text-high-contrast-accent-color: var(--#{$prefix}accent-a12) !default;
@@ -0,0 +1,19 @@
1
+ @use "Text-variables" as *;
2
+ @use "../../scss/base-variables" as *;
3
+ @use "../../scss/utils/responsive-values" as *;
4
+
5
+ .#{$prefix}text {
6
+ // Accent
7
+ &[data-accent] {
8
+ color: $text-accent-color;
9
+ }
10
+ &--high-contrast[data-accent] {
11
+ color: $text-high-contrast-accent-color;
12
+ }
13
+
14
+ // Paragraph
15
+ &:is(p) {
16
+ margin-top: var(--#{$prefix}mt, 0);
17
+ margin-bottom: var(--#{$prefix}mb, 0);
18
+ }
19
+ }
package/scss/index.scss CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  // Helpers
4
4
  @forward "scss/helpers/keyframes";
5
+ @forward "scss/helpers/margin-utils";
6
+ @forward "scss/helpers/padding-utils";
5
7
  @forward "scss/helpers/print-utils";
8
+ @forward "scss/helpers/sizing-utils";
9
+ @forward "scss/helpers/text-utils";
6
10
  @forward "scss/helpers/visually-hidden";
7
11
 
8
12
  // Components
@@ -56,5 +60,6 @@
56
60
  @forward "components/Table/Table";
57
61
  @forward "components/Tabs/Tabs";
58
62
  @forward "components/Tag/Tag";
63
+ @forward "components/Text/Text";
59
64
  @forward "components/Toast/Toast";
60
65
  @forward "components/Tooltip/Tooltip";
@@ -0,0 +1,35 @@
1
+ @use "../base-variables" as *;
2
+ @use "../utils/responsive-values" as *;
3
+
4
+ @each $prop in (mt, mr, mb, ml) {
5
+ @property --#{$prefix}#{$prop} {
6
+ syntax: "*";
7
+ inherits: false;
8
+ }
9
+ }
10
+
11
+ @include responsive-values(
12
+ $prefix,
13
+ (
14
+ mt: null,
15
+ mr: null,
16
+ mb: null,
17
+ ml: null,
18
+ )
19
+ );
20
+
21
+ [data-has-mt] {
22
+ margin-top: var(--#{$prefix}mt);
23
+ }
24
+
25
+ [data-has-mr] {
26
+ margin-right: var(--#{$prefix}mr);
27
+ }
28
+
29
+ [data-has-mb] {
30
+ margin-bottom: var(--#{$prefix}mb);
31
+ }
32
+
33
+ [data-has-ml] {
34
+ margin-left: var(--#{$prefix}ml);
35
+ }
@@ -0,0 +1,35 @@
1
+ @use "../base-variables" as *;
2
+ @use "../utils/responsive-values" as *;
3
+
4
+ @each $prop in (pt, pr, pb, pl) {
5
+ @property --#{$prefix}#{$prop} {
6
+ syntax: "*";
7
+ inherits: false;
8
+ }
9
+ }
10
+
11
+ @include responsive-values(
12
+ $prefix,
13
+ (
14
+ pt: null,
15
+ pr: null,
16
+ pb: null,
17
+ pl: null,
18
+ )
19
+ );
20
+
21
+ [data-has-pt] {
22
+ padding-top: var(--#{$prefix}pt);
23
+ }
24
+
25
+ [data-has-pr] {
26
+ padding-right: var(--#{$prefix}pr);
27
+ }
28
+
29
+ [data-has-pb] {
30
+ padding-bottom: var(--#{$prefix}pb);
31
+ }
32
+
33
+ [data-has-pl] {
34
+ padding-left: var(--#{$prefix}pl);
35
+ }
@@ -1,4 +1,4 @@
1
- @use "../../scss/base-variables" as *;
1
+ @use "../base-variables" as *;
2
2
 
3
3
  @media print {
4
4
  .#{$prefix}print-hidden {
@@ -0,0 +1,45 @@
1
+ @use "../base-variables" as *;
2
+ @use "../utils/responsive-values" as *;
3
+
4
+ @each $prop in (w, min-w, max-w, h, min-h, max-h) {
5
+ @property --#{$prefix}#{$prop} {
6
+ syntax: "*";
7
+ inherits: false;
8
+ }
9
+ }
10
+
11
+ @include responsive-values(
12
+ $prefix,
13
+ (
14
+ w: null,
15
+ min-w: null,
16
+ max-w: null,
17
+ h: null,
18
+ min-h: null,
19
+ max-h: null,
20
+ )
21
+ );
22
+
23
+ [data-has-w] {
24
+ width: var(--#{$prefix}w);
25
+ }
26
+
27
+ [data-has-min-w] {
28
+ min-width: var(--#{$prefix}min-w);
29
+ }
30
+
31
+ [data-has-max-w] {
32
+ max-width: var(--#{$prefix}max-w);
33
+ }
34
+
35
+ [data-has-h] {
36
+ height: var(--#{$prefix}h);
37
+ }
38
+
39
+ [data-has-min-h] {
40
+ min-height: var(--#{$prefix}min-h);
41
+ }
42
+
43
+ [data-has-max-h] {
44
+ max-height: var(--#{$prefix}max-h);
45
+ }
@@ -0,0 +1,43 @@
1
+ @use "../base-variables" as *;
2
+ @use "../utils/responsive-values" as *;
3
+
4
+ @each $prop in (font-size, line-height, text-align, font-weight, text-wrap) {
5
+ @property --#{$prefix}#{$prop} {
6
+ syntax: "*";
7
+ inherits: false;
8
+ }
9
+ }
10
+
11
+ @include responsive-values(
12
+ $prefix,
13
+ (
14
+ font-size: null,
15
+ line-height: null,
16
+ text-align: null,
17
+ font-weight: null,
18
+ text-wrap: null,
19
+ )
20
+ );
21
+
22
+ [data-text-truncate] {
23
+ text-overflow: ellipsis;
24
+ white-space: nowrap;
25
+ overflow: hidden;
26
+ }
27
+
28
+ [data-has-text-size] {
29
+ font-size: var(--#{$prefix}font-size);
30
+ line-height: var(--#{$prefix}line-height);
31
+ }
32
+
33
+ [data-has-text-align] {
34
+ text-align: var(--#{$prefix}text-align);
35
+ }
36
+
37
+ [data-has-font-weight] {
38
+ font-weight: var(--#{$prefix}font-weight);
39
+ }
40
+
41
+ [data-has-text-wrap] {
42
+ text-wrap: var(--#{$prefix}text-wrap);
43
+ }
@@ -79,11 +79,11 @@
79
79
  // Add margin between checkables
80
80
  &__checkable--not-first {
81
81
  &--block {
82
- margin-top: $checkable-group-block-margin-y;
82
+ margin-top: var(--#{$prefix}mt, $checkable-group-block-margin-y);
83
83
  }
84
84
 
85
85
  &--inline {
86
- margin-left: $checkable-group-inline-margin-x;
86
+ margin-left: var(--#{$prefix}ml, $checkable-group-inline-margin-x);
87
87
  }
88
88
  }
89
89
 
@@ -23,20 +23,12 @@
23
23
  font-family: $control-font-family;
24
24
  font-size: inherit;
25
25
  line-height: inherit;
26
- text-align: var(--#{$prefix}control-align);
26
+ text-align: var(--#{$prefix}text-align, inherit);
27
27
  font-weight: $control-font-weight;
28
28
 
29
29
  color: inherit;
30
30
  background-color: transparent;
31
31
 
32
- // Handle responsive values
33
- @include responsive-values(
34
- --#{$prefix}control,
35
- (
36
- align: inherit,
37
- )
38
- );
39
-
40
32
  // Border radius
41
33
  &:first-child {
42
34
  border-top-left-radius: var(--#{$prefix}control-border-radius);
@@ -8,7 +8,8 @@
8
8
 
9
9
  %#{$prefix}menu {
10
10
  width: 100%;
11
- margin: 0;
11
+ margin-top: var(--#{$prefix}mt, 0);
12
+ margin-bottom: var(--#{$prefix}mb, 0);
12
13
  padding: $menu-padding-y $menu-padding-x;
13
14
  overflow: auto;
14
15
  scrollbar-width: $menu-scrollbar-width;
@@ -7,8 +7,8 @@
7
7
  %#{$prefix}popover {
8
8
  $popover: &;
9
9
 
10
- max-width: var(--radix-popover-content-available-width);
11
- max-height: var(--radix-popover-content-available-height);
10
+ max-width: min(var(--#{$prefix}max-w, 100dvw), var(--radix-popover-content-available-width));
11
+ max-height: min(var(--#{$prefix}max-h, 100dvh), var(--radix-popover-content-available-height));
12
12
 
13
13
  border: $popover-border-width solid $popover-border-color;
14
14
  border-radius: $popover-border-radius;
@@ -3,22 +3,21 @@
3
3
  @use "breakpoints" as *;
4
4
  @use "declare-var" as *;
5
5
 
6
- // Mixin that sets CSS variables for a component with the given name that
7
- // changes their value based on the current breakpoint. The currently "active"
8
- // CSS variable has name `#{$var-prefix}-#{$prop}`.
6
+ // Mixin that sets CSS variables for a component with the given name that changes their value based
7
+ // on the current breakpoint. The currently "active" CSS variable has name `#{$var-prefix}#{$prop}`.
9
8
  //
10
9
  // This mixin assumes the existence of css variables with names
11
- // `#{$var-prefix}-#{$prop}-#{$breakpoint}` and data attributes of name
10
+ // `#{$var-prefix}#{$prop}-#{$breakpoint}` and data attributes of name
12
11
  // `data-has-#{$prop}-#{breakpoint}`.
13
- @mixin responsive-values($var-prefix, $props) {
12
+ @mixin responsive-values($prefix, $props) {
14
13
  @each $prop, $default-value in $props {
15
- @include declare-var(#{$var-prefix}-#{$prop}, $default-value);
14
+ @include declare-var(--#{$prefix}#{$prop}, $default-value);
16
15
  }
17
16
 
18
17
  @include each-breakpoint-up using ($size) {
19
18
  @each $prop in map.keys($props) {
20
- &[data-has-#{$prop}-#{$size}] {
21
- @include declare-var(#{$var-prefix}-#{$prop}, var(#{$var-prefix}-#{$prop}-#{$size}));
19
+ @at-root #{if(sass(&): &; else: "")}[data-has-#{$prop}-#{$size}] {
20
+ @include declare-var(--#{$prefix}#{$prop}, var(--#{$prefix}#{$prop}-#{$size}));
22
21
  }
23
22
  }
24
23
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode, Ref } from "react";
2
- import { type Responsive } from "../../utils/useResponsiveValues.ts";
2
+ import { type Responsive } from "../../utils/responsiveValues.ts";
3
3
  import { type ButtonProps } from "../Button";
4
4
  import { type IconButtonProps } from "../IconButton";
5
5
  /** Supported action layouts. */
@@ -1,5 +1,5 @@
1
1
  import { type ComponentProps } from "react";
2
- import { type Responsive } from "../../utils/useResponsiveValues.ts";
2
+ import { type Responsive } from "../../utils/responsiveValues.ts";
3
3
  import { type StackProps } from "../Stack";
4
4
  import type { ActionLayout } from "./Action.tsx";
5
5
  /** Layout for primary actions. */
@@ -1,4 +1,5 @@
1
1
  import { type ComponentProps, type ReactNode } from "react";
2
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
2
3
  import { type CloseButtonProps } from "../CloseButton";
3
4
  import { type CollapsibleContentProps } from "../Collapsible";
4
5
  import { type IconProp, type IconProps } from "../Icon";
@@ -9,7 +10,7 @@ export type AlertSeverity = "neutral" | "info" | "success" | "danger" | "warning
9
10
  /** Alert type of announcement. */
10
11
  export type AlertAnnounce = "off" | "polite" | "assertive";
11
12
  /** Properties of the alert component. */
12
- export interface AlertProps extends ComponentProps<"div"> {
13
+ export interface AlertProps extends UseMarginPropsOptions, ComponentProps<"div"> {
13
14
  /**
14
15
  * Alert variant.
15
16
  *
@@ -92,4 +93,4 @@ export interface AlertProps extends ComponentProps<"div"> {
92
93
  * }
93
94
  * ```
94
95
  */
95
- export declare function Alert({ variant, severity, announce, defaultOpen, open, onOpenChange, icon, showCloseButton, action, containerProps, iconProps, contentProps, actionContainerProps, closeButtonProps, children, className, role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...otherProps }: AlertProps): import("react").JSX.Element;
96
+ export declare function Alert({ variant, severity, announce, defaultOpen, open, onOpenChange, icon, showCloseButton, action, containerProps, iconProps, contentProps, actionContainerProps, closeButtonProps, children, className, style, role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...otherProps }: AlertProps): import("react").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import type { PolymorphicProps } from "../../utils/polymorphicTypes.ts";
2
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
3
+ import { type UsePaddingPropsOptions } from "../../utils/usePaddingProps.ts";
4
+ import { type UseSizingPropsOptions } from "../../utils/useSizingProps.ts";
5
+ /** Elements a box can be rendered as. */
6
+ export type BoxAs = "div" | "span";
7
+ /** Properties of the box component. */
8
+ export type BoxProps<TAs extends BoxAs = "div"> = PolymorphicProps<BoxAs, TAs, "div", BoxOwnProps>;
9
+ /** Own properties of the box component. */
10
+ export interface BoxOwnProps extends UseMarginPropsOptions, UsePaddingPropsOptions, UseSizingPropsOptions {
11
+ /**
12
+ * Change the component to the HTML tag or custom component of the only child. This will merge the
13
+ * original component props with the props of the supplied element/component and change the
14
+ * underlying DOM node.
15
+ */
16
+ asChild?: boolean;
17
+ }
18
+ /**
19
+ * Basic layout component. Built on top of the browser's [`<div>`
20
+ * element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/div) with access to
21
+ * margin, padding, sizing, and other layout-related properties.
22
+ *
23
+ * Example usage:
24
+ *
25
+ * ```tsx
26
+ * import { Box } from "@ostack.tech/ui";
27
+ *
28
+ * function WrappedItem() {
29
+ * return (
30
+ * <Box width={64} height={64}>
31
+ * <Item />
32
+ * </Box>
33
+ * );
34
+ * }
35
+ * ```
36
+ */
37
+ export declare function Box<TAs extends BoxAs = "div">({ as, asChild, style, ...otherProps }: BoxProps<TAs>): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./Box.tsx";
@@ -2,6 +2,7 @@ import { type ReactElement, type ReactNode } from "react";
2
2
  import type { AccentColor } from "../../utils/accent.ts";
3
3
  import { type KeyboardShortcutKeybinds } from "../../utils/keyboardShortcut.ts";
4
4
  import type { PolymorphicProps } from "../../utils/polymorphicTypes.ts";
5
+ import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
5
6
  import { type IconProp, type IconProps } from "../Icon";
6
7
  import { type KeybindsProps } from "../Keybinds";
7
8
  import { type SpinnerProps } from "../Spinner";
@@ -19,7 +20,7 @@ export type ButtonIconPlacement = "start" | "end";
19
20
  /** Properties of the button component. */
20
21
  export type ButtonProps<TAs extends ButtonAs = "button"> = PolymorphicProps<ButtonAs, TAs, "button", ButtonOwnProps>;
21
22
  /** Own properties of the button component. */
22
- export interface ButtonOwnProps {
23
+ export interface ButtonOwnProps extends UseMarginPropsOptions {
23
24
  /**
24
25
  * Change the component to the HTML tag or custom component of the only child. This will merge the
25
26
  * original component props with the props of the supplied element/component and change the
@@ -151,4 +152,4 @@ export interface ButtonOwnProps {
151
152
  * }
152
153
  * ```
153
154
  */
154
- export declare function Button<TAs extends ButtonAs = "button">({ as, asChild, variant, color, size, vertical, icon, iconPlacement, active, disabled, loading, loadingContent, showSpinner, tooltipContent, keybinds, iconProps, spinnerProps, tooltipProps, keybindsProps, type, onClick, className, children, "aria-disabled": ariaDisabled, ...otherProps }: ButtonProps<TAs>): import("react").JSX.Element;
155
+ export declare function Button<TAs extends ButtonAs = "button">({ as, asChild, variant, color, size, vertical, icon, iconPlacement, active, disabled, loading, loadingContent, showSpinner, tooltipContent, keybinds, iconProps, spinnerProps, tooltipProps, keybindsProps, type, onClick, className, style, children, "aria-disabled": ariaDisabled, ...otherProps }: ButtonProps<TAs>): import("react").JSX.Element;