@orioncactuscorp/ui 1.9.2 → 1.11.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 (99) hide show
  1. package/README.md +119 -54
  2. package/dist/components/Accordion/Accordion.css +1 -1
  3. package/dist/components/Accordion/Accordion.js +169 -177
  4. package/dist/components/ActionArea/ActionAreaLayout.js +20 -24
  5. package/dist/components/Cell/Cell.css +1 -1
  6. package/dist/components/Cell/Cell.js +57 -58
  7. package/dist/components/CheckMark/CheckMark.css +1 -1
  8. package/dist/components/Checkbox/Checkbox.css +1 -1
  9. package/dist/components/Checkbox/Checkbox.js +50 -51
  10. package/dist/components/Menu/Menu.css +1 -1
  11. package/dist/components/Menu/Menu.module.scss.js +20 -22
  12. package/dist/components/Modal/Modal.css +1 -1
  13. package/dist/components/Modal/Modal.js +585 -575
  14. package/dist/components/Modal/bottomSheetGeometry.js +46 -33
  15. package/dist/components/Modal/modalScrollArbitration.js +71 -49
  16. package/dist/components/Modal/snapPoints.js +42 -38
  17. package/dist/components/Modal/useModalContentBlockTransition.js +49 -44
  18. package/dist/components/Modal/useModalDrag.js +937 -854
  19. package/dist/components/Radio/Radio.css +1 -1
  20. package/dist/components/ScrollArea/ScrollArea.js +197 -200
  21. package/dist/components/Select/Select.js +31 -34
  22. package/dist/components/Switch/Switch.css +1 -1
  23. package/dist/components/Tabs/Tabs.css +1 -0
  24. package/dist/components/Tabs/Tabs.js +208 -0
  25. package/dist/components/Tabs/Tabs.module.scss.js +27 -0
  26. package/dist/components/Tabs.d.ts +6 -0
  27. package/dist/components/Tabs.js +8 -0
  28. package/dist/components/TextArea/TextArea.js +57 -58
  29. package/dist/components/TextInput/TextInput.js +30 -33
  30. package/dist/components/Tooltip/Tooltip.css +1 -1
  31. package/dist/foundations/color.theme.dark.css +1 -1
  32. package/dist/foundations/color.theme.light.css +1 -1
  33. package/dist/foundations/focus.css +1 -0
  34. package/dist/foundations/reset.css +1 -1
  35. package/dist/foundations.css +4 -3
  36. package/dist/index.js +69 -64
  37. package/dist/react/motion.js +31 -35
  38. package/dist/reset.css +1 -1
  39. package/dist/styles.css +14 -12
  40. package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -1
  41. package/dist/ui/src/components/ActionArea/ActionAreaLayout.d.ts.map +1 -1
  42. package/dist/ui/src/components/Cell/Cell.d.ts.map +1 -1
  43. package/dist/ui/src/components/CheckMark/types.d.ts +10 -0
  44. package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -1
  45. package/dist/ui/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  46. package/dist/ui/src/components/Checkbox/types.d.ts +16 -0
  47. package/dist/ui/src/components/Checkbox/types.d.ts.map +1 -1
  48. package/dist/ui/src/components/Modal/Modal.d.ts +1 -1
  49. package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -1
  50. package/dist/ui/src/components/Modal/bottomSheetGeometry.d.ts +13 -0
  51. package/dist/ui/src/components/Modal/bottomSheetGeometry.d.ts.map +1 -1
  52. package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts.map +1 -1
  53. package/dist/ui/src/components/Modal/snapPoints.d.ts +3 -1
  54. package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -1
  55. package/dist/ui/src/components/Modal/types.d.ts +8 -0
  56. package/dist/ui/src/components/Modal/types.d.ts.map +1 -1
  57. package/dist/ui/src/components/Modal/useModalContentBlockTransition.d.ts.map +1 -1
  58. package/dist/ui/src/components/Modal/useModalDrag.d.ts +27 -10
  59. package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -1
  60. package/dist/ui/src/components/Radio/types.d.ts +16 -0
  61. package/dist/ui/src/components/Radio/types.d.ts.map +1 -1
  62. package/dist/ui/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  63. package/dist/ui/src/components/Select/Select.d.ts.map +1 -1
  64. package/dist/ui/src/components/Switch/types.d.ts +10 -0
  65. package/dist/ui/src/components/Switch/types.d.ts.map +1 -1
  66. package/dist/ui/src/components/Tabs/Tabs.d.ts +7 -0
  67. package/dist/ui/src/components/Tabs/Tabs.d.ts.map +1 -0
  68. package/dist/ui/src/components/Tabs/index.d.ts +3 -0
  69. package/dist/ui/src/components/Tabs/index.d.ts.map +1 -0
  70. package/dist/ui/src/components/Tabs/types.d.ts +26 -0
  71. package/dist/ui/src/components/Tabs/types.d.ts.map +1 -0
  72. package/dist/ui/src/components/TextArea/TextArea.d.ts.map +1 -1
  73. package/dist/ui/src/components/TextInput/TextInput.d.ts.map +1 -1
  74. package/dist/ui/src/index.d.ts +2 -0
  75. package/dist/ui/src/index.d.ts.map +1 -1
  76. package/dist/ui/src/react/motion/index.d.ts.map +1 -1
  77. package/dist/ui/src/utils/mergeRefs.d.ts +13 -0
  78. package/dist/ui/src/utils/mergeRefs.d.ts.map +1 -0
  79. package/dist/utils/mergeRefs.js +24 -0
  80. package/dist/vscode/oc-ui-vars.css +13 -0
  81. package/docs/editor-setup.md +42 -0
  82. package/docs/motion.md +665 -0
  83. package/docs/responsive-foundation-profile.md +230 -0
  84. package/docs/scss-helpers.md +189 -0
  85. package/docs/selector-contract.md +260 -0
  86. package/docs/spring.md +382 -0
  87. package/docs/stability.md +62 -0
  88. package/docs/tokens.md +559 -0
  89. package/package.json +9 -4
  90. package/src/scss/foundations/color-theme.test.ts +14 -0
  91. package/src/scss/foundations/color.theme.dark.scss +1 -0
  92. package/src/scss/foundations/color.theme.light.scss +1 -0
  93. package/src/scss/foundations/focus.scss +4 -0
  94. package/src/scss/foundations/focus.test.ts +48 -0
  95. package/src/scss/foundations/reset.scss +9 -4
  96. package/src/scss/foundations/reset.test.ts +32 -0
  97. package/src/scss/index.scss +2 -0
  98. package/src/scss/mixins/_focus.scss +11 -0
  99. package/src/scss/mixins/_focus.test.ts +58 -0
@@ -7,6 +7,7 @@
7
7
  --oc-color-theme-static-black: var(--oc-color-global-common-0);
8
8
  --oc-color-theme-static-transparent: var(--oc-color-global-common-transparent);
9
9
  --oc-color-theme-primary-normal: var(--oc-color-global-redOrange-50);
10
+ --oc-color-theme-focus-ring: var(--oc-color-theme-primary-normal);
10
11
  --oc-color-theme-label-strong: var(--oc-color-global-common-0);
11
12
  --oc-color-theme-label-normal: var(--oc-color-global-coolNeutral-10);
12
13
  --oc-color-theme-label-neutral: #{oc-alpha(coolNeutral-22, 88)};
@@ -0,0 +1,4 @@
1
+ :root {
2
+ --oc-focus-ring-width: 2px;
3
+ --oc-focus-ring-offset: 2px;
4
+ }
@@ -0,0 +1,48 @@
1
+ import { compileString } from 'sass';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ describe('focus foundation', () => {
5
+ const compileFocus = () =>
6
+ compileString("@use 'foundations/focus' as *;", {
7
+ loadPaths: ['src/scss'],
8
+ });
9
+
10
+ it('exposes the focus ring size tokens', () => {
11
+ const result = compileFocus();
12
+
13
+ expect(result.css).toContain('--oc-focus-ring-width: 2px;');
14
+ expect(result.css).toContain('--oc-focus-ring-offset: 2px;');
15
+ });
16
+
17
+ // Protects the documented Full Foundation Rebuild composition
18
+ // (docs/responsive-foundation-profile.md): replacing foundations.css with
19
+ // the SCSS-source imports must still emit the focus ring tokens, or the
20
+ // reset-layer outline declarations become invalid at computed-value time.
21
+ it('keeps focus tokens in the full foundation rebuild composition', () => {
22
+ const result = compileString(
23
+ `
24
+ @use 'foundations/responsive.config' with (
25
+ $oc-responsive-mode: static,
26
+ $oc-responsive-static-stop: md
27
+ );
28
+ @use 'foundations/color.global' as *;
29
+ @use 'foundations/color.theme.light' as *;
30
+ @use 'foundations/color.theme.dark' as *;
31
+ @use 'foundations/breakpoint' as *;
32
+ @use 'foundations/typo' as *;
33
+ @use 'foundations/space' as *;
34
+ @use 'foundations/atomic' as *;
35
+ @use 'foundations/focus' as *;
36
+ @use 'foundations/motion' as *;
37
+ @use 'foundations/zindex' as *;
38
+ `,
39
+ { loadPaths: ['src/scss'] },
40
+ );
41
+
42
+ expect(result.css).toContain('--oc-focus-ring-width: 2px;');
43
+ expect(result.css).toContain('--oc-focus-ring-offset: 2px;');
44
+ expect(result.css).toContain(
45
+ '--oc-color-theme-focus-ring: var(--oc-color-theme-primary-normal);',
46
+ );
47
+ });
48
+ });
@@ -1,3 +1,5 @@
1
+ @use '../mixins/focus' as *;
2
+
1
3
  /* Box sizing rules */
2
4
  *,
3
5
  *::before,
@@ -106,10 +108,13 @@ button {
106
108
  appearance: none;
107
109
  }
108
110
 
109
- button {
110
- &:focus-visible {
111
- outline: none;
112
- }
111
+ /* Centralized keyboard focus ring. :where() keeps specificity at 0 so any
112
+ component-level outline declaration overrides it. Text-entry controls
113
+ (input/textarea/select) are excluded: they match :focus-visible on pointer
114
+ focus per spec, and the Field family owns focus presentation via its
115
+ :focus-within stroke. */
116
+ :where(button, a[href], summary, [tabindex]):where(:focus-visible) {
117
+ @include oc-focus-ring;
113
118
  }
114
119
 
115
120
  textarea,
@@ -0,0 +1,32 @@
1
+ import { compileString } from 'sass';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ describe('reset foundation', () => {
5
+ const compileReset = () =>
6
+ compileString("@use 'foundations/reset';", {
7
+ loadPaths: ['src/scss'],
8
+ });
9
+
10
+ it('provides the centralized keyboard focus ring for focusable elements', () => {
11
+ const result = compileReset();
12
+
13
+ // Both halves stay inside :where() so the whole selector is specificity 0
14
+ // and any local outline declaration wins.
15
+ expect(result.css).toContain(
16
+ ':where(button, a[href], summary, [tabindex]):where(:focus-visible)',
17
+ );
18
+ expect(result.css).toContain(
19
+ 'outline: var(--oc-focus-ring-width) solid var(--oc-color-theme-focus-ring);',
20
+ );
21
+ expect(result.css).toContain(
22
+ 'outline-offset: var(--oc-focus-ring-offset);',
23
+ );
24
+ });
25
+
26
+ it('no longer suppresses the native button focus outline', () => {
27
+ const result = compileReset();
28
+ const normalized = result.css.replace(/\s+/g, '');
29
+
30
+ expect(normalized).not.toContain('button:focus-visible{outline:none');
31
+ });
32
+ });
@@ -5,6 +5,7 @@
5
5
  @forward './foundations/typo';
6
6
  @forward './foundations/space';
7
7
  @forward './foundations/atomic';
8
+ @forward './foundations/focus';
8
9
  @forward './foundations/motion';
9
10
  @forward './foundations/zindex';
10
11
  @forward './foundations/reset';
@@ -14,6 +15,7 @@
14
15
  @forward './mixins/color';
15
16
  @forward './mixins/typo';
16
17
  @forward './mixins/element';
18
+ @forward './mixins/focus';
17
19
  @forward './mixins/radius';
18
20
  @forward './mixins/motion';
19
21
  @forward './spring';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Keyboard focus ring contract. The ring is drawn with `outline` so it
3
+ * follows the host element's own border-radius, stays out of layout, and
4
+ * survives forced-colors mode. The Interaction primitive keeps owning the
5
+ * surface tint; it cannot carry the ring because its element opacity (the
6
+ * tint mechanism) would multiply into anything painted in its subtree.
7
+ */
8
+ @mixin oc-focus-ring($color: var(--oc-color-theme-focus-ring), $width: var(--oc-focus-ring-width), $offset: var(--oc-focus-ring-offset)) {
9
+ outline: $width solid $color;
10
+ outline-offset: $offset;
11
+ }
@@ -0,0 +1,58 @@
1
+ import { compileString } from 'sass';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ describe('focus utilities', () => {
5
+ const compileFocus = (scss: string) =>
6
+ compileString(
7
+ `
8
+ @use 'mixins/focus' as *;
9
+
10
+ ${scss}
11
+ `,
12
+ {
13
+ loadPaths: ['src/scss'],
14
+ },
15
+ );
16
+
17
+ it('emits the token-based focus ring by default', () => {
18
+ const result = compileFocus(`
19
+ .target {
20
+ &:focus-visible {
21
+ @include oc-focus-ring;
22
+ }
23
+ }
24
+ `);
25
+
26
+ expect(result.css).toContain(
27
+ 'outline: var(--oc-focus-ring-width) solid var(--oc-color-theme-focus-ring);',
28
+ );
29
+ expect(result.css).toContain(
30
+ 'outline-offset: var(--oc-focus-ring-offset);',
31
+ );
32
+ });
33
+
34
+ it('accepts a custom color', () => {
35
+ const result = compileFocus(`
36
+ .target {
37
+ @include oc-focus-ring($color: var(--custom-ring-color));
38
+ }
39
+ `);
40
+
41
+ expect(result.css).toContain(
42
+ 'outline: var(--oc-focus-ring-width) solid var(--custom-ring-color);',
43
+ );
44
+ });
45
+
46
+ it('accepts custom width and offset', () => {
47
+ const result = compileFocus(`
48
+ .target {
49
+ @include oc-focus-ring($width: 3px, $offset: 1px);
50
+ }
51
+ `);
52
+
53
+ expect(result.css).toContain(
54
+ 'outline: 3px solid var(--oc-color-theme-focus-ring);',
55
+ );
56
+ expect(result.css).toContain('outline-offset: 1px;');
57
+ });
58
+ });