@orcestr/ui 0.0.3 → 0.1.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 (184) hide show
  1. package/dist/components/Alert/Alert.d.ts +5 -4
  2. package/dist/components/Alert/Alert.d.ts.map +1 -1
  3. package/dist/components/Alert/Alert.js +5 -2
  4. package/dist/components/AppShell/AppShell.d.ts +13 -0
  5. package/dist/components/AppShell/AppShell.d.ts.map +1 -1
  6. package/dist/components/AppShell/AppShell.js +14 -9
  7. package/dist/components/AppSidebar/AppSidebar.d.ts +36 -0
  8. package/dist/components/AppSidebar/AppSidebar.d.ts.map +1 -0
  9. package/dist/components/AppSidebar/AppSidebar.js +117 -0
  10. package/dist/components/Badge/Badge.d.ts +8 -6
  11. package/dist/components/Badge/Badge.d.ts.map +1 -1
  12. package/dist/components/Badge/Badge.js +4 -4
  13. package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts +22 -0
  14. package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts.map +1 -0
  15. package/dist/components/BadgeSelectMenu/BadgeSelectMenu.js +50 -0
  16. package/dist/components/Box/Box.d.ts +2 -0
  17. package/dist/components/Box/Box.d.ts.map +1 -1
  18. package/dist/components/Box/Box.js +15 -2
  19. package/dist/components/Button/Button.d.ts +7 -3
  20. package/dist/components/Button/Button.d.ts.map +1 -1
  21. package/dist/components/Button/Button.js +23 -3
  22. package/dist/components/Card/Card.d.ts +26 -0
  23. package/dist/components/Card/Card.d.ts.map +1 -0
  24. package/dist/components/Card/Card.js +25 -0
  25. package/dist/components/Checkbox/Checkbox.d.ts +6 -2
  26. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  27. package/dist/components/Checkbox/Checkbox.js +13 -4
  28. package/dist/components/Collapse/Collapse.d.ts.map +1 -1
  29. package/dist/components/Collapse/Collapse.js +5 -25
  30. package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
  31. package/dist/components/CommandPalette/CommandPalette.js +10 -9
  32. package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  33. package/dist/components/ConfirmDialog/ConfirmDialog.js +5 -2
  34. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  35. package/dist/components/ContextMenu/ContextMenu.js +2 -2
  36. package/dist/components/CopyButton/CopyButton.d.ts +24 -0
  37. package/dist/components/CopyButton/CopyButton.d.ts.map +1 -0
  38. package/dist/components/CopyButton/CopyButton.js +81 -0
  39. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  40. package/dist/components/DatePicker/DatePicker.js +9 -1
  41. package/dist/components/Dialog/Dialog.d.ts +69 -1
  42. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  43. package/dist/components/Dialog/Dialog.js +48 -1
  44. package/dist/components/Drawer/Drawer.d.ts +2 -1
  45. package/dist/components/Drawer/Drawer.d.ts.map +1 -1
  46. package/dist/components/Drawer/Drawer.js +4 -4
  47. package/dist/components/EntityPicker/EntityPicker.d.ts +2 -1
  48. package/dist/components/EntityPicker/EntityPicker.d.ts.map +1 -1
  49. package/dist/components/EntityPicker/EntityPicker.js +2 -2
  50. package/dist/components/Flex/Flex.d.ts +5 -1
  51. package/dist/components/Flex/Flex.d.ts.map +1 -1
  52. package/dist/components/Flex/Flex.js +16 -3
  53. package/dist/components/Grid/Grid.d.ts +9 -2
  54. package/dist/components/Grid/Grid.d.ts.map +1 -1
  55. package/dist/components/Grid/Grid.js +22 -1
  56. package/dist/components/IconButton/IconButton.d.ts +19 -7
  57. package/dist/components/IconButton/IconButton.d.ts.map +1 -1
  58. package/dist/components/IconButton/IconButton.js +40 -5
  59. package/dist/components/IconTextButton/IconTextButton.d.ts +20 -0
  60. package/dist/components/IconTextButton/IconTextButton.d.ts.map +1 -0
  61. package/dist/components/IconTextButton/IconTextButton.js +24 -0
  62. package/dist/components/InlineEdit/InlineEdit.d.ts +63 -0
  63. package/dist/components/InlineEdit/InlineEdit.d.ts.map +1 -0
  64. package/dist/components/InlineEdit/InlineEdit.js +98 -0
  65. package/dist/components/LinkButton/LinkButton.d.ts +25 -0
  66. package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
  67. package/dist/components/LinkButton/LinkButton.js +12 -0
  68. package/dist/components/Modal/Modal.d.ts +29 -6
  69. package/dist/components/Modal/Modal.d.ts.map +1 -1
  70. package/dist/components/Modal/Modal.js +37 -13
  71. package/dist/components/Overlay/OverlayProvider.d.ts +1 -0
  72. package/dist/components/Overlay/OverlayProvider.d.ts.map +1 -1
  73. package/dist/components/Overlay/OverlayProvider.js +18 -1
  74. package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts +2 -1
  75. package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts.map +1 -1
  76. package/dist/components/PaginatedCombobox/PaginatedCombobox.js +3 -3
  77. package/dist/components/Popover/Popover.d.ts +37 -3
  78. package/dist/components/Popover/Popover.d.ts.map +1 -1
  79. package/dist/components/Popover/Popover.js +56 -9
  80. package/dist/components/ScrollArea/ScrollArea.d.ts +4 -0
  81. package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  82. package/dist/components/ScrollArea/ScrollArea.js +30 -4
  83. package/dist/components/Section/Section.d.ts +2 -0
  84. package/dist/components/Section/Section.d.ts.map +1 -1
  85. package/dist/components/SegmentedControl/SegmentedControl.d.ts +24 -1
  86. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  87. package/dist/components/SegmentedControl/SegmentedControl.js +28 -2
  88. package/dist/components/Select/Select.d.ts +36 -4
  89. package/dist/components/Select/Select.d.ts.map +1 -1
  90. package/dist/components/Select/Select.js +70 -3
  91. package/dist/components/Separator/Separator.d.ts +3 -1
  92. package/dist/components/Separator/Separator.d.ts.map +1 -1
  93. package/dist/components/Separator/Separator.js +4 -2
  94. package/dist/components/SpecialModal/SpecialModal.d.ts +43 -0
  95. package/dist/components/SpecialModal/SpecialModal.d.ts.map +1 -0
  96. package/dist/components/SpecialModal/SpecialModal.js +34 -0
  97. package/dist/components/Spinner/Spinner.d.ts +3 -1
  98. package/dist/components/Spinner/Spinner.d.ts.map +1 -1
  99. package/dist/components/Spinner/Spinner.js +2 -2
  100. package/dist/components/State/State.d.ts +8 -1
  101. package/dist/components/State/State.d.ts.map +1 -1
  102. package/dist/components/State/State.js +2 -2
  103. package/dist/components/Switch/Switch.d.ts +2 -0
  104. package/dist/components/Switch/Switch.d.ts.map +1 -1
  105. package/dist/components/Switch/Switch.js +2 -1
  106. package/dist/components/Table/Table.d.ts +64 -0
  107. package/dist/components/Table/Table.d.ts.map +1 -0
  108. package/dist/components/Table/Table.js +38 -0
  109. package/dist/components/Tabs/Tabs.d.ts +33 -2
  110. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  111. package/dist/components/Tabs/Tabs.js +201 -5
  112. package/dist/components/Text/Text.d.ts +13 -3
  113. package/dist/components/Text/Text.d.ts.map +1 -1
  114. package/dist/components/Text/Text.js +16 -3
  115. package/dist/components/TextArea/TextArea.d.ts.map +1 -1
  116. package/dist/components/TextArea/TextArea.js +1 -1
  117. package/dist/components/TextField/TextField.d.ts.map +1 -1
  118. package/dist/components/TextField/TextField.js +1 -1
  119. package/dist/components/Toast/Toast.d.ts +1 -4
  120. package/dist/components/Toast/Toast.d.ts.map +1 -1
  121. package/dist/components/Toast/Toast.js +72 -37
  122. package/dist/components/Tooltip/Tooltip.d.ts +11 -3
  123. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  124. package/dist/components/Tooltip/Tooltip.js +58 -9
  125. package/dist/example/CodePreview.d.ts +2 -1
  126. package/dist/example/CodePreview.d.ts.map +1 -1
  127. package/dist/example/CodePreview.js +16 -51
  128. package/dist/example/ExampleActionsSection.d.ts.map +1 -1
  129. package/dist/example/ExampleActionsSection.js +3 -3
  130. package/dist/example/ExampleApplicationSection.d.ts +7 -0
  131. package/dist/example/ExampleApplicationSection.d.ts.map +1 -0
  132. package/dist/example/ExampleApplicationSection.js +88 -0
  133. package/dist/example/ExampleBasicsSections.d.ts +1 -1
  134. package/dist/example/ExampleBasicsSections.d.ts.map +1 -1
  135. package/dist/example/ExampleBasicsSections.js +15 -13
  136. package/dist/example/ExampleDataSection.d.ts.map +1 -1
  137. package/dist/example/ExampleDataSection.js +31 -30
  138. package/dist/example/ExampleFieldsSection.d.ts.map +1 -1
  139. package/dist/example/ExampleFieldsSection.js +51 -3
  140. package/dist/example/ExampleFoundationsSection.js +1 -1
  141. package/dist/example/ExampleOverlays.d.ts.map +1 -1
  142. package/dist/example/ExampleOverlays.js +7 -2
  143. package/dist/example/ExampleOverlaysSection.d.ts.map +1 -1
  144. package/dist/example/ExampleOverlaysSection.js +20 -30
  145. package/dist/example/ExampleSelectionSection.d.ts +3 -1
  146. package/dist/example/ExampleSelectionSection.d.ts.map +1 -1
  147. package/dist/example/ExampleSelectionSection.js +10 -3
  148. package/dist/example/ExampleStateSection.d.ts +3 -0
  149. package/dist/example/ExampleStateSection.d.ts.map +1 -1
  150. package/dist/example/ExampleStateSection.js +65 -9
  151. package/dist/example/ExampleThemePlayground.d.ts +84 -54
  152. package/dist/example/ExampleThemePlayground.d.ts.map +1 -1
  153. package/dist/example/ExampleThemePlayground.js +129 -63
  154. package/dist/example/UiExamplePage.d.ts.map +1 -1
  155. package/dist/example/UiExamplePage.js +39 -19
  156. package/dist/example/codeSamples.d.ts +8 -1
  157. package/dist/example/codeSamples.d.ts.map +1 -1
  158. package/dist/example/codeSamples.js +590 -119
  159. package/dist/example/exampleData.d.ts.map +1 -1
  160. package/dist/example/exampleData.js +18 -10
  161. package/dist/example/styles.css +277 -146
  162. package/dist/hooks/useFloatingPosition.js +1 -1
  163. package/dist/hooks/usePresence.d.ts.map +1 -1
  164. package/dist/hooks/usePresence.js +9 -7
  165. package/dist/index.d.ts +9 -1
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +9 -1
  168. package/dist/styles/orcestr-ui.css +3002 -872
  169. package/dist/theme/ThemeProvider.d.ts.map +1 -1
  170. package/dist/theme/ThemeProvider.js +109 -53
  171. package/dist/theme/defaultTheme.d.ts.map +1 -1
  172. package/dist/theme/defaultTheme.js +356 -223
  173. package/dist/theme/systemProps.d.ts +48 -28
  174. package/dist/theme/systemProps.d.ts.map +1 -1
  175. package/dist/theme/systemProps.js +103 -1
  176. package/dist/theme/themeTypes.d.ts +44 -35
  177. package/dist/theme/themeTypes.d.ts.map +1 -1
  178. package/dist/utils/slot.d.ts +11 -0
  179. package/dist/utils/slot.d.ts.map +1 -0
  180. package/dist/utils/slot.js +18 -0
  181. package/package.json +4 -1
  182. package/dist/components/Workflow/Workflow.d.ts +0 -82
  183. package/dist/components/Workflow/Workflow.d.ts.map +0 -1
  184. package/dist/components/Workflow/Workflow.js +0 -73
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGR,yBAAyB,EAE5B,MAAM,cAAc,CAAC;AAEtB,wBAAgB,oBAAoB,CAAC,EACjC,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,WAAoB,EACpB,cAA0B,EAC1B,OAAO,EACP,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,yBAAyB,2CA2N3B"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGR,yBAAyB,EAE5B,MAAM,cAAc,CAAC;AAEtB,wBAAgB,oBAAoB,CAAC,EACjC,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,WAAoB,EACpB,cAA0B,EAC1B,OAAO,EACP,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,yBAAyB,2CA+P3B"}
@@ -23,39 +23,53 @@ export function OrcestrThemeProvider({ children, mode: controlledMode, defaultMo
23
23
  const toggleMode = useCallback(() => {
24
24
  setMode(resolvedMode === 'dark' ? 'light' : 'dark');
25
25
  }, [resolvedMode, setMode]);
26
- const value = useMemo(() => ({
27
- mode: resolvedMode,
28
- surface: resolvedSurface,
29
- theme,
30
- setMode,
31
- setSurface,
32
- toggleMode,
33
- }), [resolvedMode, resolvedSurface, theme, setMode, setSurface, toggleMode]);
34
26
  const rootStyle = useMemo(() => ({
35
27
  '--oui-bg': theme.colors.bg,
36
28
  '--oui-panel': theme.colors.panel,
37
29
  '--oui-panel-2': theme.colors.panelSoft,
38
- '--oui-control-bg': theme.colors.control,
30
+ '--oui-control-bg': controlBackgroundForMode(theme),
39
31
  '--oui-control-hover-bg': theme.colors.controlHover,
40
32
  '--oui-border': theme.colors.border,
41
33
  '--oui-border-strong': theme.colors.borderStrong,
42
34
  '--oui-text': theme.colors.text,
43
35
  '--oui-muted': theme.colors.muted,
44
- '--oui-soft': theme.colors.brandSoft,
36
+ '--oui-soft': theme.colors.primary.surface,
45
37
  '--oui-soft-hover': theme.colors.selected,
46
- '--oui-brand': theme.colors.brand,
47
- '--oui-brand-strong': theme.colors.brandStrong,
48
- '--oui-brand-solid': theme.colors.brandSolid,
49
- '--oui-brand-solid-hover': theme.colors.brandSolidHover,
50
- '--oui-brand-soft': theme.colors.brandSoft,
51
- '--oui-success': theme.colors.success,
52
- '--oui-success-soft': theme.colors.successSoft,
53
- '--oui-warning': theme.colors.warning,
54
- '--oui-warning-soft': theme.colors.warningSoft,
55
- '--oui-danger': theme.colors.danger,
56
- '--oui-danger-soft': theme.colors.dangerSoft,
57
- '--oui-info': theme.colors.info,
58
- '--oui-info-soft': theme.colors.infoSoft,
38
+ '--oui-primary-base': theme.colors.primary.base,
39
+ '--oui-primary-text': theme.colors.primary.text,
40
+ '--oui-primary-surface': theme.colors.primary.surface,
41
+ '--oui-primary-border': theme.colors.primary.border,
42
+ '--oui-primary-contrast': theme.colors.primary.contrast,
43
+ '--oui-secondary-base': theme.colors.secondary.base,
44
+ '--oui-secondary-text': theme.colors.secondary.text,
45
+ '--oui-secondary-surface': theme.colors.secondary.surface,
46
+ '--oui-secondary-border': theme.colors.secondary.border,
47
+ '--oui-secondary-contrast': theme.colors.secondary.contrast,
48
+ '--oui-neutral-base': theme.colors.neutral.base,
49
+ '--oui-neutral-text': theme.colors.neutral.text,
50
+ '--oui-neutral-surface': theme.colors.neutral.surface,
51
+ '--oui-neutral-border': theme.colors.neutral.border,
52
+ '--oui-neutral-contrast': theme.colors.neutral.contrast,
53
+ '--oui-success-base': theme.colors.success.base,
54
+ '--oui-success-text': theme.colors.success.text,
55
+ '--oui-success-surface': theme.colors.success.surface,
56
+ '--oui-success-border': theme.colors.success.border,
57
+ '--oui-success-contrast': theme.colors.success.contrast,
58
+ '--oui-warning-base': theme.colors.warning.base,
59
+ '--oui-warning-text': theme.colors.warning.text,
60
+ '--oui-warning-surface': theme.colors.warning.surface,
61
+ '--oui-warning-border': theme.colors.warning.border,
62
+ '--oui-warning-contrast': theme.colors.warning.contrast,
63
+ '--oui-danger-base': theme.colors.danger.base,
64
+ '--oui-danger-text': theme.colors.danger.text,
65
+ '--oui-danger-surface': theme.colors.danger.surface,
66
+ '--oui-danger-border': theme.colors.danger.border,
67
+ '--oui-danger-contrast': theme.colors.danger.contrast,
68
+ '--oui-info-base': theme.colors.info.base,
69
+ '--oui-info-text': theme.colors.info.text,
70
+ '--oui-info-surface': theme.colors.info.surface,
71
+ '--oui-info-border': theme.colors.info.border,
72
+ '--oui-info-contrast': theme.colors.info.contrast,
59
73
  '--oui-selected-bg': theme.colors.selected,
60
74
  '--oui-disabled': theme.colors.disabled,
61
75
  '--oui-overlay-bg': theme.colors.overlay,
@@ -74,9 +88,9 @@ export function OrcestrThemeProvider({ children, mode: controlledMode, defaultMo
74
88
  '--oui-section-shadow': theme.shadows.section,
75
89
  '--oui-shadow-focus': theme.shadows.focus,
76
90
  '--oui-ring': theme.colors.focusRing,
77
- '--oui-radius': theme.radii.lg,
78
- '--oui-radius-sm': theme.radii.md,
79
- '--oui-radius-xl': theme.radii.xl,
91
+ '--oui-radius': theme.radius.lg,
92
+ '--oui-radius-sm': theme.radius.md,
93
+ '--oui-radius-xl': theme.radius.xl,
80
94
  '--oui-space-px': theme.spacing.px,
81
95
  '--oui-space-xs': theme.spacing.xs,
82
96
  '--oui-space-sm': theme.spacing.sm,
@@ -90,27 +104,31 @@ export function OrcestrThemeProvider({ children, mode: controlledMode, defaultMo
90
104
  '--oui-breakpoint-tablet': theme.breakpoints.tablet,
91
105
  '--oui-breakpoint-desktop': theme.breakpoints.desktop,
92
106
  '--oui-breakpoint-wide': theme.breakpoints.wide,
93
- '--oui-font-family': theme.typography.fontFamily,
94
- '--oui-font-family-mono': theme.typography.monoFontFamily,
95
- '--oui-title-size': theme.typography.titleSize,
96
- '--oui-heading-size': theme.typography.headingSize,
97
- '--oui-body-size': theme.typography.bodySize,
98
- '--oui-compact-size': theme.typography.compactSize,
99
- '--oui-label-size': theme.typography.labelSize,
100
- '--oui-line-height': theme.typography.lineHeight,
101
- '--oui-heading-line-height': theme.typography.headingLineHeight,
102
- '--oui-weight-regular': theme.typography.weightRegular,
103
- '--oui-weight-medium': theme.typography.weightMedium,
104
- '--oui-weight-bold': theme.typography.weightBold,
105
- '--oui-letter-spacing': theme.typography.letterSpacing,
107
+ '--oui-font-family': theme.text.family,
108
+ '--oui-font-family-mono': theme.text.mono,
109
+ '--oui-title-size': theme.text.title,
110
+ '--oui-heading-size': theme.text.heading,
111
+ '--oui-body-size': theme.text.body,
112
+ '--oui-compact-size': theme.text.compact,
113
+ '--oui-label-size': theme.text.label,
114
+ '--oui-line-height': theme.text.line,
115
+ '--oui-heading-line-height': theme.text.headingLine,
116
+ '--oui-weight-regular': theme.text.regular,
117
+ '--oui-weight-medium': theme.text.medium,
118
+ '--oui-weight-bold': theme.text.bold,
119
+ '--oui-letter-spacing': theme.text.letterSpacing,
106
120
  '--oui-status-neutral': theme.status.neutral.color,
107
121
  '--oui-status-neutral-text': theme.status.neutral.text,
108
122
  '--oui-status-neutral-soft': theme.status.neutral.soft,
109
123
  '--oui-status-neutral-border': theme.status.neutral.border,
110
- '--oui-status-brand': theme.status.brand.color,
111
- '--oui-status-brand-text': theme.status.brand.text,
112
- '--oui-status-brand-soft': theme.status.brand.soft,
113
- '--oui-status-brand-border': theme.status.brand.border,
124
+ '--oui-status-primary': theme.status.primary.color,
125
+ '--oui-status-primary-text': theme.status.primary.text,
126
+ '--oui-status-primary-soft': theme.status.primary.soft,
127
+ '--oui-status-primary-border': theme.status.primary.border,
128
+ '--oui-status-secondary': theme.status.secondary.color,
129
+ '--oui-status-secondary-text': theme.status.secondary.text,
130
+ '--oui-status-secondary-soft': theme.status.secondary.soft,
131
+ '--oui-status-secondary-border': theme.status.secondary.border,
114
132
  '--oui-status-success': theme.status.success.color,
115
133
  '--oui-status-success-text': theme.status.success.text,
116
134
  '--oui-status-success-soft': theme.status.success.soft,
@@ -138,11 +156,13 @@ export function OrcestrThemeProvider({ children, mode: controlledMode, defaultMo
138
156
  '--oui-z-toast': theme.zIndex.toast,
139
157
  '--oui-toast-bg': theme.toast.background,
140
158
  '--oui-toast-blur': cssBlur(theme.toast.blur),
141
- '--oui-toast-border-color': theme.toast.borderColor,
142
159
  '--oui-toast-shadow': theme.toast.shadow,
143
160
  '--oui-toast-animation-duration': theme.toast.animationDuration,
144
161
  '--oui-toast-exit-duration': theme.toast.exitDuration,
145
162
  '--oui-toast-progress-height': theme.toast.progressHeight,
163
+ '--oui-scrollbar-thumb': theme.scrollbar.thumb,
164
+ '--oui-scrollbar-thumb-hover': theme.scrollbar.thumbHover,
165
+ '--oui-scrollbar-track': theme.scrollbar.track,
146
166
  '--oui-state-hover-opacity': theme.states.hoverOpacity,
147
167
  '--oui-state-active-opacity': theme.states.activeOpacity,
148
168
  '--oui-state-disabled-opacity': theme.states.disabledOpacity,
@@ -160,9 +180,25 @@ export function OrcestrThemeProvider({ children, mode: controlledMode, defaultMo
160
180
  '--oui-table-header-height': theme.components.tableHeaderHeight,
161
181
  '--oui-field-gap': theme.components.fieldGap,
162
182
  '--oui-modal-max-width': theme.components.modalMaxWidth,
163
- '--oui-pipeline-step-min-width': theme.components.pipelineStepMinWidth,
164
183
  }), [theme]);
165
184
  const themeStyle = useMemo(() => ({ ...rootStyle, ...style }), [rootStyle, style]);
185
+ const value = useMemo(() => ({
186
+ mode: resolvedMode,
187
+ surface: resolvedSurface,
188
+ theme,
189
+ cssVariables: rootStyle,
190
+ setMode,
191
+ setSurface,
192
+ toggleMode,
193
+ }), [
194
+ resolvedMode,
195
+ resolvedSurface,
196
+ theme,
197
+ rootStyle,
198
+ setMode,
199
+ setSurface,
200
+ toggleMode,
201
+ ]);
166
202
  useEffect(() => {
167
203
  const root = document.documentElement;
168
204
  const previousTheme = root.getAttribute('data-oui-theme');
@@ -200,16 +236,36 @@ function compositeColor(foreground, background) {
200
236
  const bg = parseCssColor(background);
201
237
  if (!fg || !bg)
202
238
  return foreground;
203
- if (fg.a <= 0)
204
- return rgbColor(bg);
205
- if (fg.a >= 1)
206
- return rgbColor(fg);
207
- return rgbColor({
208
- r: Math.round(fg.r * fg.a + bg.r * (1 - fg.a)),
209
- g: Math.round(fg.g * fg.a + bg.g * (1 - fg.a)),
210
- b: Math.round(fg.b * fg.a + bg.b * (1 - fg.a)),
239
+ return rgbColor(blendColor(fg, bg));
240
+ }
241
+ function controlBackgroundForMode(theme) {
242
+ if (theme.mode !== 'light')
243
+ return theme.colors.control;
244
+ const control = parseCssColor(theme.colors.control);
245
+ const bg = parseCssColor(theme.colors.bg);
246
+ if (!control || !bg || control.a <= 0)
247
+ return theme.colors.control;
248
+ const visibleControl = blendColor(control, bg);
249
+ return relativeLuminance(visibleControl) < 0.52 ? 'transparent' : theme.colors.control;
250
+ }
251
+ function blendColor(foreground, background) {
252
+ if (foreground.a <= 0)
253
+ return { ...background, a: 1 };
254
+ if (foreground.a >= 1)
255
+ return { ...foreground, a: 1 };
256
+ return {
257
+ r: Math.round(foreground.r * foreground.a + background.r * (1 - foreground.a)),
258
+ g: Math.round(foreground.g * foreground.a + background.g * (1 - foreground.a)),
259
+ b: Math.round(foreground.b * foreground.a + background.b * (1 - foreground.a)),
211
260
  a: 1,
261
+ };
262
+ }
263
+ function relativeLuminance(color) {
264
+ const [r, g, b] = [color.r, color.g, color.b].map((channel) => {
265
+ const value = channel / 255;
266
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
212
267
  });
268
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
213
269
  }
214
270
  function rgbColor(color) {
215
271
  return `rgb(${color.r} ${color.g} ${color.b})`;
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,cAAc,CAAC;AAItB,MAAM,MAAM,6BAA6B,GAAG;IACxC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC5C,mBAAmB,EACnB,6BAA6B,CAsBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,6BAA6B,EAK/D,CAAC;AAgeF,wBAAgB,WAAW,CACvB,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,mBAA+B,EACxC,cAAc,CAAC,EAAE,qBAAqB,GACvC,YAAY,CASd;AAED,eAAO,MAAM,SAAS,EAAE,YAAkC,CAAC;AAC3D,eAAO,MAAM,UAAU,EAAE,YAAmC,CAAC"}
1
+ {"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,cAAc,CAAC;AAItB,MAAM,MAAM,6BAA6B,GAAG;IACxC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC5C,mBAAmB,EACnB,6BAA6B,CAsBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,6BAA6B,EAK/D,CAAC;AAqlBF,wBAAgB,WAAW,CACvB,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,mBAA+B,EACxC,cAAc,CAAC,EAAE,qBAAqB,GACvC,YAAY,CASd;AAED,eAAO,MAAM,SAAS,EAAE,YAAkC,CAAC;AAC3D,eAAO,MAAM,UAAU,EAAE,YAAmC,CAAC"}