@pega/cosmos-react-core 7.0.0-build.22.8 → 7.0.0-build.23.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 (156) hide show
  1. package/lib/components/AIButton/AIButton.d.ts +30 -2
  2. package/lib/components/AIButton/AIButton.d.ts.map +1 -1
  3. package/lib/components/AIButton/AIButton.js +4 -3
  4. package/lib/components/AIButton/AIButton.js.map +1 -1
  5. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppHeader.js +4 -6
  7. package/lib/components/AppShell/AppHeader.js.map +1 -1
  8. package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppHeader.styles.js +6 -2
  10. package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
  11. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShell.js +2 -1
  13. package/lib/components/AppShell/AppShell.js.map +1 -1
  14. package/lib/components/AppShell/AppShell.styles.d.ts +3 -0
  15. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.styles.js +12 -0
  17. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  18. package/lib/components/AppShell/AppShell.types.d.ts +4 -0
  19. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  20. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  21. package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
  22. package/lib/components/AppShell/NavigationList.js +3 -3
  23. package/lib/components/AppShell/NavigationList.js.map +1 -1
  24. package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
  25. package/lib/components/AppShell/NavigationListItemWrapper.js +1 -0
  26. package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
  27. package/lib/components/Button/Button.d.ts.map +1 -1
  28. package/lib/components/Button/Button.js +67 -35
  29. package/lib/components/Button/Button.js.map +1 -1
  30. package/lib/components/Card/Card.d.ts.map +1 -1
  31. package/lib/components/Card/Card.js +8 -0
  32. package/lib/components/Card/Card.js.map +1 -1
  33. package/lib/components/ColorPicker/ColorPicker.js +1 -1
  34. package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
  35. package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
  36. package/lib/components/ComboBox/ComboBox.styles.js +4 -0
  37. package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
  38. package/lib/components/Configuration/Configuration.d.ts +1 -0
  39. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  40. package/lib/components/Configuration/Configuration.js +58 -30
  41. package/lib/components/Configuration/Configuration.js.map +1 -1
  42. package/lib/components/Configuration/connected-watcher.d.ts +17 -0
  43. package/lib/components/Configuration/connected-watcher.d.ts.map +1 -0
  44. package/lib/components/Configuration/connected-watcher.js +13 -0
  45. package/lib/components/Configuration/connected-watcher.js.map +1 -0
  46. package/lib/components/DateTime/Input/MonthInput.d.ts.map +1 -1
  47. package/lib/components/DateTime/Input/MonthInput.js +21 -10
  48. package/lib/components/DateTime/Input/MonthInput.js.map +1 -1
  49. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  50. package/lib/components/DateTime/Picker/DatePicker.js +5 -32
  51. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  52. package/lib/components/DateTime/Picker/utils.d.ts +9 -0
  53. package/lib/components/DateTime/Picker/utils.d.ts.map +1 -1
  54. package/lib/components/DateTime/Picker/utils.js +16 -0
  55. package/lib/components/DateTime/Picker/utils.js.map +1 -1
  56. package/lib/components/File/FileDisplayList.d.ts +2 -1
  57. package/lib/components/File/FileDisplayList.d.ts.map +1 -1
  58. package/lib/components/File/FileDisplayList.js +3 -2
  59. package/lib/components/File/FileDisplayList.js.map +1 -1
  60. package/lib/components/File/FileInput.d.ts +2 -2
  61. package/lib/components/File/FileInput.d.ts.map +1 -1
  62. package/lib/components/File/FileInput.js +20 -4
  63. package/lib/components/File/FileInput.js.map +1 -1
  64. package/lib/components/File/FileInput.styles.d.ts +1 -0
  65. package/lib/components/File/FileInput.styles.d.ts.map +1 -1
  66. package/lib/components/File/FileInput.styles.js +14 -1
  67. package/lib/components/File/FileInput.styles.js.map +1 -1
  68. package/lib/components/File/FileItem.d.ts.map +1 -1
  69. package/lib/components/File/FileItem.js +2 -3
  70. package/lib/components/File/FileItem.js.map +1 -1
  71. package/lib/components/File/FileList.d.ts +6 -3
  72. package/lib/components/File/FileList.d.ts.map +1 -1
  73. package/lib/components/File/FileList.js +25 -7
  74. package/lib/components/File/FileList.js.map +1 -1
  75. package/lib/components/Fullscreen/Fullscreen.d.ts +18 -0
  76. package/lib/components/Fullscreen/Fullscreen.d.ts.map +1 -0
  77. package/lib/components/Fullscreen/Fullscreen.js +51 -0
  78. package/lib/components/Fullscreen/Fullscreen.js.map +1 -0
  79. package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts +2 -0
  80. package/lib/components/Fullscreen/Fullscreen.test-ids.d.ts.map +1 -0
  81. package/lib/components/Fullscreen/Fullscreen.test-ids.js +3 -0
  82. package/lib/components/Fullscreen/Fullscreen.test-ids.js.map +1 -0
  83. package/lib/components/Fullscreen/FullscreenButton.d.ts +6 -0
  84. package/lib/components/Fullscreen/FullscreenButton.d.ts.map +1 -0
  85. package/lib/components/Fullscreen/FullscreenButton.js +33 -0
  86. package/lib/components/Fullscreen/FullscreenButton.js.map +1 -0
  87. package/lib/components/Fullscreen/index.d.ts +4 -0
  88. package/lib/components/Fullscreen/index.d.ts.map +1 -0
  89. package/lib/components/Fullscreen/index.js +4 -0
  90. package/lib/components/Fullscreen/index.js.map +1 -0
  91. package/lib/components/Icon/streamline-icons/dock.icon.d.ts +5 -0
  92. package/lib/components/Icon/streamline-icons/dock.icon.d.ts.map +1 -0
  93. package/lib/components/Icon/streamline-icons/dock.icon.js +7 -0
  94. package/lib/components/Icon/streamline-icons/dock.icon.js.map +1 -0
  95. package/lib/components/Icon/streamline-icons/undock.icon.d.ts +5 -0
  96. package/lib/components/Icon/streamline-icons/undock.icon.d.ts.map +1 -0
  97. package/lib/components/Icon/streamline-icons/undock.icon.js +7 -0
  98. package/lib/components/Icon/streamline-icons/undock.icon.js.map +1 -0
  99. package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
  100. package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
  101. package/lib/components/Icon/streamlineIconNames.js +2 -0
  102. package/lib/components/Icon/streamlineIconNames.js.map +1 -1
  103. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  104. package/lib/components/ListToolbar/ListToolbar.js +3 -2
  105. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  106. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  107. package/lib/components/Menu/Menu.styles.js +2 -1
  108. package/lib/components/Menu/Menu.styles.js.map +1 -1
  109. package/lib/components/PageTemplates/PageTemplates.d.ts +1 -0
  110. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  111. package/lib/components/PageTemplates/PageTemplates.js +82 -29
  112. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  113. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  114. package/lib/components/Tabs/Tab.js +4 -0
  115. package/lib/components/Tabs/Tab.js.map +1 -1
  116. package/lib/components/Toaster/Toaster.d.ts +1 -1
  117. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  118. package/lib/components/Toaster/Toaster.js +79 -19
  119. package/lib/components/Toaster/Toaster.js.map +1 -1
  120. package/lib/components/Toaster/Toaster.types.d.ts +17 -4
  121. package/lib/components/Toaster/Toaster.types.d.ts.map +1 -1
  122. package/lib/components/Toaster/Toaster.types.js.map +1 -1
  123. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  124. package/lib/components/Tooltip/Tooltip.js +3 -1
  125. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  126. package/lib/hooks/useArrows.d.ts.map +1 -1
  127. package/lib/hooks/useArrows.js +3 -1
  128. package/lib/hooks/useArrows.js.map +1 -1
  129. package/lib/hooks/useI18n.d.ts +25 -0
  130. package/lib/hooks/useI18n.d.ts.map +1 -1
  131. package/lib/hooks/useScrollToggle.d.ts.map +1 -1
  132. package/lib/hooks/useScrollToggle.js +1 -0
  133. package/lib/hooks/useScrollToggle.js.map +1 -1
  134. package/lib/i18n/default.d.ts +25 -0
  135. package/lib/i18n/default.d.ts.map +1 -1
  136. package/lib/i18n/default.js +29 -1
  137. package/lib/i18n/default.js.map +1 -1
  138. package/lib/i18n/i18n.d.ts +25 -0
  139. package/lib/i18n/i18n.d.ts.map +1 -1
  140. package/lib/index.d.ts +2 -0
  141. package/lib/index.d.ts.map +1 -1
  142. package/lib/index.js +2 -0
  143. package/lib/index.js.map +1 -1
  144. package/lib/theme/theme.d.ts +6 -0
  145. package/lib/theme/theme.d.ts.map +1 -1
  146. package/lib/theme/themeDefinition.json +5 -1
  147. package/lib/theme/themeOverrides.schema.json +3 -0
  148. package/lib/utils/index.d.ts +1 -0
  149. package/lib/utils/index.d.ts.map +1 -1
  150. package/lib/utils/index.js +1 -0
  151. package/lib/utils/index.js.map +1 -1
  152. package/lib/utils/isPositionWithinRect.d.ts +12 -0
  153. package/lib/utils/isPositionWithinRect.d.ts.map +1 -0
  154. package/lib/utils/isPositionWithinRect.js +11 -0
  155. package/lib/utils/isPositionWithinRect.js.map +1 -0
  156. package/package.json +4 -2
@@ -3,7 +3,7 @@ import { useRef, useEffect, forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { meetsContrastGuidelines, mix } from 'polished';
5
5
  import { defaultThemeProp } from '../../theme';
6
- import { tryCatch } from '../../utils';
6
+ import { isPositionWithinRect, tryCatch } from '../../utils';
7
7
  import { getActiveColors, getHoverColors, omitProps, readableColor, readableHue } from '../../styles';
8
8
  import { useElement, useConsolidatedRef } from '../../hooks';
9
9
  import Tooltip from '../Tooltip';
@@ -43,9 +43,26 @@ const baseStyles = (theme) => {
43
43
  }
44
44
  `;
45
45
  };
46
+ const getFilledButtonStyles = (color) => ({
47
+ contrastColor: tryCatch(() => readableColor(color)),
48
+ hoverColors: getHoverColors(color),
49
+ activeColors: getActiveColors(color)
50
+ });
51
+ const getOutlinedButtonStyles = (color, backgroundColor) => {
52
+ const backgroundUsable = meetsContrastGuidelines(color, backgroundColor).AA;
53
+ const usableColor = backgroundUsable ? color : readableHue(color, backgroundColor);
54
+ const hoverBackgroundColor = tryCatch(() => mix(0.9, backgroundColor, usableColor));
55
+ const activeBackgroundColor = tryCatch(() => mix(0.8, backgroundColor, usableColor));
56
+ return {
57
+ textColor: backgroundUsable ? color : readableColor(color),
58
+ hoverBg: hoverBackgroundColor,
59
+ hoverFg: readableHue(usableColor, hoverBackgroundColor ?? 'transparent'),
60
+ activeBg: tryCatch(() => mix(0.8, backgroundColor, usableColor)),
61
+ activeFg: readableHue(usableColor, activeBackgroundColor ?? 'transparent')
62
+ };
63
+ };
46
64
  export const StyledButton = styled.button.withConfig(omitProps('loading'))(({ variant, icon, loading, compact, theme }) => {
47
- const { base: { spacing, 'border-radius': baseBorderRadius, palette: { 'primary-background': backgroundColor }, 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger, 'compact-min': hitAreaCompact }, animation: { speed, timing: { ease } } }, components: { button: { color, 'secondary-color': secondaryColor, padding, 'border-radius': borderRadius, 'border-width': borderWidth, touch: { padding: touchPadding } } } } = theme;
48
- const contrastColor = tryCatch(() => readableColor(color));
65
+ const { base: { spacing, 'border-radius': baseBorderRadius, palette: { 'primary-background': backgroundColor }, 'hit-area': { 'mouse-min': hitAreaMouse, 'finger-min': hitAreaFinger, 'compact-min': hitAreaCompact }, animation: { speed, timing: { ease } } }, components: { button: { color, 'secondary-color': secondaryColor, 'secondary-fill-style': fillStyle, padding, 'border-radius': borderRadius, 'border-width': borderWidth, touch: { padding: touchPadding } } } } = theme;
49
66
  // Base
50
67
  const base = baseStyles(theme);
51
68
  // Non-text base
@@ -112,13 +129,12 @@ export const StyledButton = styled.button.withConfig(omitProps('loading'))(({ va
112
129
  translate: 0 -0.0625rem;
113
130
  }
114
131
  `;
115
- // Primary
116
- const hoverColors = getHoverColors(color);
117
- const activeColors = getActiveColors(color);
118
- const primary = css `
119
- --button-background-color: ${color};
132
+ // Primary and Secondary-filled
133
+ const { contrastColor, hoverColors, activeColors } = getFilledButtonStyles(variant === 'primary' ? color : secondaryColor);
134
+ const solidButtonStyles = css `
135
+ --button-background-color: ${variant === 'primary' ? color : secondaryColor};
120
136
  color: ${contrastColor};
121
- background-color: ${color};
137
+ background-color: ${variant === 'primary' ? color : secondaryColor};
122
138
 
123
139
  @media (hover: hover) {
124
140
  &:hover {
@@ -134,39 +150,35 @@ export const StyledButton = styled.button.withConfig(omitProps('loading'))(({ va
134
150
  text-decoration: none;
135
151
  }
136
152
  `;
137
- // Secondary
138
- const backgroundUsable = meetsContrastGuidelines(color, secondaryColor).AA;
139
- const usableColor = backgroundUsable ? color : readableHue(color, secondaryColor);
140
- const secondaryHoverBackgroundColor = tryCatch(() => mix(0.9, secondaryColor, usableColor));
141
- const secondaryHoverForegroundColor = readableHue(usableColor, secondaryHoverBackgroundColor ?? 'transparent');
142
- const secondaryActiveBackgroundColor = tryCatch(() => mix(0.8, secondaryColor, usableColor));
143
- const secondaryActiveForegroundColor = readableHue(usableColor, secondaryActiveBackgroundColor ?? 'transparent');
153
+ // Secondary-outline
154
+ const secondaryOutlineButtonStyles = getOutlinedButtonStyles(secondaryColor, backgroundColor);
144
155
  const secondary = css `
145
- --button-background-color: ${secondaryColor};
146
- color: ${usableColor};
147
- background-color: ${secondaryColor};
148
- border-color: ${usableColor};
156
+ --button-background-color: ${backgroundColor};
157
+ color: ${secondaryOutlineButtonStyles.textColor};
158
+ background-color: ${backgroundColor};
159
+ border-color: ${secondaryColor};
149
160
 
150
161
  @media (hover: hover) {
151
162
  &:hover {
152
- color: ${secondaryHoverForegroundColor};
153
- background-color: ${secondaryHoverBackgroundColor};
163
+ color: ${secondaryOutlineButtonStyles.hoverFg};
164
+ background-color: ${secondaryOutlineButtonStyles.hoverBg};
154
165
  text-decoration: none;
155
- border-color: ${secondaryHoverForegroundColor};
166
+ border-color: ${secondaryOutlineButtonStyles.hoverFg};
156
167
  }
157
168
  }
158
169
 
159
170
  &:active {
160
- color: ${secondaryActiveForegroundColor};
161
- background-color: ${secondaryActiveBackgroundColor};
162
- border-color: ${secondaryActiveForegroundColor};
171
+ color: ${secondaryOutlineButtonStyles.activeFg};
172
+ background-color: ${secondaryOutlineButtonStyles.activeBg};
173
+ border-color: ${secondaryOutlineButtonStyles.activeFg};
163
174
  text-decoration: none;
164
175
  }
165
176
  `;
166
177
  // Simple
178
+ const simpleButtonStyles = getOutlinedButtonStyles(fillStyle === 'outline' ? secondaryColor : color, backgroundColor);
167
179
  const simple = css `
168
180
  --button-background-color: ${icon ? 'transparent' : backgroundColor};
169
- color: ${icon ? 'currentColor' : usableColor};
181
+ color: ${icon ? 'currentColor' : simpleButtonStyles.textColor};
170
182
  background-color: ${icon ? 'transparent' : backgroundColor};
171
183
 
172
184
  @media (hover: hover) {
@@ -188,9 +200,9 @@ export const StyledButton = styled.button.withConfig(omitProps('loading'))(({ va
188
200
 
189
201
  ${!icon &&
190
202
  css `
191
- background-color: ${secondaryHoverBackgroundColor};
192
- color: ${secondaryHoverForegroundColor};
193
- border-color: ${secondaryHoverForegroundColor};
203
+ background-color: ${simpleButtonStyles.hoverBg};
204
+ color: ${simpleButtonStyles.hoverFg};
205
+ border-color: ${simpleButtonStyles.hoverFg};
194
206
  text-decoration: none;
195
207
  `}
196
208
  }
@@ -213,9 +225,9 @@ export const StyledButton = styled.button.withConfig(omitProps('loading'))(({ va
213
225
 
214
226
  ${!icon &&
215
227
  css `
216
- background-color: ${secondaryActiveBackgroundColor};
217
- color: ${secondaryActiveForegroundColor};
218
- border-color: ${secondaryActiveForegroundColor};
228
+ background-color: ${simpleButtonStyles.activeBg};
229
+ color: ${simpleButtonStyles.activeFg};
230
+ border-color: ${simpleButtonStyles.activeFg};
219
231
  text-decoration: none;
220
232
  `}
221
233
  }
@@ -224,8 +236,9 @@ export const StyledButton = styled.button.withConfig(omitProps('loading'))(({ va
224
236
  return css `
225
237
  ${base}
226
238
  ${nonTextual}
227
- ${variant === 'primary' && primary}
228
- ${variant === 'secondary' && secondary}
239
+ ${(variant === 'primary' || (variant === 'secondary' && fillStyle === 'fill')) &&
240
+ solidButtonStyles}
241
+ ${variant === 'secondary' && fillStyle === 'outline' && secondary}
229
242
  ${variant === 'simple' && simple}
230
243
 
231
244
  ${loading &&
@@ -293,22 +306,41 @@ StyledButtonLink.defaultProps = defaultThemeProp;
293
306
  const Button = forwardRef(function Button({ variant = 'secondary', type = 'button', disabled = false, icon = false, compact = false, href, as, forwardedAs, label, 'aria-label': ariaLabel, loading = false, children, ...restProps }, ref) {
294
307
  const [buttonEl, setButtonEl] = useElement();
295
308
  const mouseDownEvent = useRef();
309
+ const mouseDownPosition = useRef();
310
+ const mouseDownTimestamp = useRef();
296
311
  const buttonRef = useConsolidatedRef(ref, setButtonEl);
297
312
  const isTextual = ['link', 'text'].includes(variant);
298
313
  const showProgress = loading && !isTextual;
299
314
  const StyledComp = isTextual ? StyledButtonLink : StyledButton;
315
+ const handleClickWithElementShift = (e) => {
316
+ if (buttonRef.current &&
317
+ mouseDownPosition.current &&
318
+ mouseDownTimestamp.current &&
319
+ isPositionWithinRect({ x: e.clientX, y: e.clientY }, mouseDownPosition.current) &&
320
+ Date.now() - mouseDownTimestamp.current < 500) {
321
+ buttonRef.current.click();
322
+ }
323
+ };
300
324
  useEffect(() => {
325
+ document.addEventListener('mouseup', handleClickWithElementShift);
301
326
  return () => {
327
+ document.removeEventListener('mouseup', handleClickWithElementShift);
302
328
  mouseDownEvent.current = undefined;
329
+ mouseDownPosition.current = undefined;
330
+ mouseDownTimestamp.current = undefined;
303
331
  };
304
332
  }, []);
305
333
  return (_jsxs(_Fragment, { children: [_jsxs(StyledComp, { ...restProps, ref: buttonRef, as: as || (href ? 'a' : 'button'), forwardedAs: forwardedAs || (href ? 'a' : 'button'), variant: variant, icon: icon, compact: compact, type: href ? undefined : type, href: href, disabled: disabled && !href, loading: showProgress, "aria-label": ariaLabel || label, onMouseDown: (e) => {
306
334
  restProps.onMouseDown?.(e);
307
335
  e.persist();
308
336
  mouseDownEvent.current = e;
337
+ mouseDownPosition.current = e.currentTarget.getBoundingClientRect();
338
+ mouseDownTimestamp.current = Date.now();
309
339
  }, onMouseUp: (e) => {
310
340
  const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;
311
341
  mouseDownEvent.current = undefined;
342
+ mouseDownPosition.current = undefined;
343
+ mouseDownTimestamp.current = undefined;
312
344
  if (shouldFocus && buttonRef.current !== document.activeElement) {
313
345
  buttonRef.current?.focus();
314
346
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAStD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,QAAQ,EAAE,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAA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wardRef } from 'react';\nimport type {\n FunctionComponent,\n ReactNode,\n PropsWithoutRef,\n Ref,\n MouseEvent,\n MouseEventHandler\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { meetsContrastGuidelines, mix } from 'polished';\n\nimport type { BaseProps, ForwardProps, PropsWithDefaults, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport {\n getActiveColors,\n getHoverColors,\n omitProps,\n readableColor,\n readableHue\n} from '../../styles';\nimport { useElement, useConsolidatedRef } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport Progress, { StyledProgressRing } from '../Progress';\nimport { StyledBackdrop } from '../Backdrop';\nimport { StyledIcon } from '../Icon';\nimport { StyledPopover } from '../Popover';\n\nexport interface ButtonProps extends BaseProps, AsProp {\n /** Text or content for the Button. */\n children: ReactNode;\n /**\n * Determines if the Button will be disabled.\n * @default false\n */\n disabled?: boolean;\n /** A location to navigate to. Passing an href will render an anchor styled as a Button. */\n href?: string;\n /**\n * Controls the styling of the Button.\n * @default 'secondary'\n */\n variant?: 'primary' | 'secondary' | 'simple' | 'link' | 'text';\n /**\n * Controls the behavior of a Button within a Form.\n * @default 'button'\n */\n type?: 'button' | 'reset' | 'submit';\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Button. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: boolean;\n /**\n * Used for a smaller sized button.\n * @default false\n */\n compact?: boolean;\n /** The label text will be used inside a Tooltip. */\n label?: string;\n /** The aria label text will be inserted as the aria-label on the Button. */\n 'aria-label'?: string;\n /**\n * Optionally renders an indeterminate progress indicator in a button.\n * @default false\n */\n loading?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLButtonElement>;\n}\n\ntype ButtonPropsWithDefaults = PropsWithDefaults<\n ButtonProps,\n 'variant' | 'type' | 'disabled' | 'icon' | 'loading'\n>;\n\nconst baseStyles = (theme: DefaultTheme) => {\n const {\n base: {\n spacing,\n animation: {\n speed,\n timing: { ease }\n },\n 'disabled-opacity': disabledOpacity\n },\n components: {\n button: { 'focus-shadow': focusShadow }\n }\n } = theme;\n\n return css`\n outline: none;\n text-decoration: none;\n transition-property: background-color, color, border-color, box-shadow, translate;\n transition-duration: calc(0.5 * ${speed});\n transition-timing-function: ${ease};\n cursor: pointer;\n\n & + & {\n margin-inline-start: ${spacing};\n }\n\n /* Not able to combine with selector above. Stylis bug? */\n & + ${StyledPopover} + & {\n margin-inline-start: ${spacing};\n }\n\n &:disabled,\n &[disabled] {\n opacity: ${disabledOpacity};\n cursor: not-allowed;\n pointer-events: none;\n }\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${focusShadow};\n }\n `;\n};\n\nexport const StyledButton = styled.button.withConfig<ButtonPropsWithDefaults>(omitProps('loading'))(\n ({ variant, icon, loading, compact, theme }) => {\n const {\n base: {\n spacing,\n 'border-radius': baseBorderRadius,\n palette: { 'primary-background': backgroundColor },\n 'hit-area': {\n 'mouse-min': hitAreaMouse,\n 'finger-min': hitAreaFinger,\n 'compact-min': hitAreaCompact\n },\n animation: {\n speed,\n timing: { ease }\n }\n },\n components: {\n button: {\n color,\n 'secondary-color': secondaryColor,\n padding,\n 'border-radius': borderRadius,\n 'border-width': borderWidth,\n touch: { padding: touchPadding }\n }\n }\n } = theme;\n const contrastColor = tryCatch(() => readableColor(color));\n\n // Base\n const base = baseStyles(theme);\n\n // Non-text base\n const nonTextual = css`\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: ${hitAreaMouse};\n min-width: ${hitAreaMouse};\n border: ${borderWidth} solid transparent;\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n -webkit-user-select: none;\n user-select: none;\n\n ${!icon &&\n css`\n padding: ${padding};\n `}\n\n ${icon &&\n css`\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n > svg {\n display: block;\n }\n `}\n\n ${compact &&\n css`\n min-height: ${hitAreaCompact};\n min-width: ${hitAreaCompact};\n `}\n\n @media (pointer: coarse) {\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n ${!compact &&\n css`\n min-height: ${hitAreaFinger};\n min-width: ${hitAreaFinger};\n `}\n\n ${!icon &&\n css`\n padding: ${touchPadding};\n `}\n }\n\n &:active {\n translate: 0 0.0625rem;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * ${borderWidth});\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n transition: translate calc(0.5 * ${speed}) ${ease};\n }\n\n &:active::after {\n translate: 0 -0.0625rem;\n }\n `;\n\n // Primary\n const hoverColors = getHoverColors(color);\n const activeColors = getActiveColors(color);\n const primary = css`\n --button-background-color: ${color};\n color: ${contrastColor};\n background-color: ${color};\n\n @media (hover: hover) {\n &:hover {\n background-color: ${hoverColors.background};\n color: ${hoverColors.foreground};\n text-decoration: none;\n }\n }\n\n &:active {\n background-color: ${activeColors.background};\n color: ${activeColors.foreground};\n text-decoration: none;\n }\n `;\n\n // Secondary\n const backgroundUsable = meetsContrastGuidelines(color, secondaryColor).AA;\n const usableColor = backgroundUsable ? color : readableHue(color, secondaryColor);\n const secondaryHoverBackgroundColor = tryCatch(() => mix(0.9, secondaryColor, usableColor));\n const secondaryHoverForegroundColor = readableHue(\n usableColor,\n secondaryHoverBackgroundColor ?? 'transparent'\n );\n const secondaryActiveBackgroundColor = tryCatch(() => mix(0.8, secondaryColor, usableColor));\n const secondaryActiveForegroundColor = readableHue(\n usableColor,\n secondaryActiveBackgroundColor ?? 'transparent'\n );\n const secondary = css`\n --button-background-color: ${secondaryColor};\n color: ${usableColor};\n background-color: ${secondaryColor};\n border-color: ${usableColor};\n\n @media (hover: hover) {\n &:hover {\n color: ${secondaryHoverForegroundColor};\n background-color: ${secondaryHoverBackgroundColor};\n text-decoration: none;\n border-color: ${secondaryHoverForegroundColor};\n }\n }\n\n &:active {\n color: ${secondaryActiveForegroundColor};\n background-color: ${secondaryActiveBackgroundColor};\n border-color: ${secondaryActiveForegroundColor};\n text-decoration: none;\n }\n `;\n\n // Simple\n const simple = css`\n --button-background-color: ${icon ? 'transparent' : backgroundColor};\n color: ${icon ? 'currentColor' : usableColor};\n background-color: ${icon ? 'transparent' : backgroundColor};\n\n @media (hover: hover) {\n &:hover {\n ${icon &&\n css`\n ::before {\n content: '';\n position: absolute;\n top: calc(${borderWidth} * -1);\n bottom: calc(${borderWidth} * -1);\n left: calc(${borderWidth} * -1);\n right: calc(${borderWidth} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.1;\n }\n `}\n\n ${!icon &&\n css`\n background-color: ${secondaryHoverBackgroundColor};\n color: ${secondaryHoverForegroundColor};\n border-color: ${secondaryHoverForegroundColor};\n text-decoration: none;\n `}\n }\n\n &:active {\n ${icon &&\n css`\n ::before {\n content: '';\n position: absolute;\n top: calc(${borderWidth} * -1);\n bottom: calc(${borderWidth} * -1);\n left: calc(${borderWidth} * -1);\n right: calc(${borderWidth} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.2;\n }\n `}\n\n ${!icon &&\n css`\n background-color: ${secondaryActiveBackgroundColor};\n color: ${secondaryActiveForegroundColor};\n border-color: ${secondaryActiveForegroundColor};\n text-decoration: none;\n `}\n }\n }\n `;\n\n return css`\n ${base}\n ${nonTextual}\n ${variant === 'primary' && primary}\n ${variant === 'secondary' && secondary}\n ${variant === 'simple' && simple}\n\n ${loading &&\n css`\n ${StyledBackdrop} {\n background-color: var(--button-background-color);\n border-radius: inherit;\n }\n\n ${StyledProgressRing} {\n width: 1em;\n height: 1em;\n\n ${!icon &&\n css`\n margin-inline-end: calc(${spacing} / 2);\n `}\n\n circle:nth-child(2) {\n animation-duration: calc(${speed} * 2);\n }\n }\n `}\n `;\n }\n);\n\nStyledButton.defaultProps = defaultThemeProp;\n\nexport const StyledButtonLink = styled.a.withConfig<\n Pick<ButtonPropsWithDefaults, 'variant'> &\n // Needed for omitProps\n Pick<ButtonProps, 'loading'>\n>(omitProps('loading'))(({ theme, variant }) => {\n const {\n base: {\n palette: { 'foreground-color': textColor }\n },\n components: {\n link: { color: linkColor }\n }\n } = theme;\n\n const base = baseStyles(theme);\n\n const textual = css`\n background-color: transparent;\n display: inline;\n text-align: start;\n border: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n > ${StyledIcon} {\n vertical-align: bottom;\n }\n `;\n\n const { background: activeColor } = getActiveColors(linkColor);\n const link = css`\n color: ${linkColor};\n\n &:active {\n color: ${activeColor};\n }\n `;\n\n const text = css`\n color: ${textColor};\n `;\n\n return css`\n ${base}\n ${textual}\n ${variant === 'link' && link}\n ${variant === 'text' && text}\n `;\n});\n\nStyledButtonLink.defaultProps = defaultThemeProp;\n\nconst Button: FunctionComponent<ButtonProps & ForwardProps> = forwardRef(function Button(\n {\n variant = 'secondary',\n type = 'button',\n disabled = false,\n icon = false,\n compact = false,\n href,\n as,\n forwardedAs,\n label,\n 'aria-label': ariaLabel,\n loading = false,\n children,\n ...restProps\n }: PropsWithoutRef<ButtonProps> & ForwardProps,\n ref: Ref<HTMLButtonElement>\n) {\n const [buttonEl, setButtonEl] = useElement();\n const mouseDownEvent = useRef<MouseEvent>();\n const buttonRef = useConsolidatedRef<HTMLButtonElement>(ref, setButtonEl);\n const isTextual = ['link', 'text'].includes(variant);\n const showProgress = loading && !isTextual;\n const StyledComp: React.ElementType = isTextual ? StyledButtonLink : StyledButton;\n\n useEffect(() => {\n return () => {\n mouseDownEvent.current = undefined;\n };\n }, []);\n\n return (\n <>\n <StyledComp\n {...restProps}\n ref={buttonRef}\n as={as || (href ? 'a' : 'button')}\n forwardedAs={forwardedAs || (href ? 'a' : 'button')}\n variant={variant}\n icon={icon}\n compact={compact}\n type={href ? undefined : type}\n href={href}\n disabled={disabled && !href}\n loading={showProgress}\n aria-label={ariaLabel || label}\n onMouseDown={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n (restProps.onMouseDown as MouseEventHandler | undefined)?.(e);\n e.persist();\n mouseDownEvent.current = e;\n }}\n onMouseUp={(e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;\n mouseDownEvent.current = undefined;\n\n if (shouldFocus && buttonRef.current !== document.activeElement) {\n buttonRef.current?.focus();\n }\n\n return (restProps.onMouseUp as MouseEventHandler | undefined)?.(e);\n }}\n >\n {showProgress && <Progress variant='ring' placement='inline' />}\n {!icon || !showProgress ? children : null}\n </StyledComp>\n\n {buttonEl && label && (\n <Tooltip target={buttonEl} showDelay='none' hideDelay='none' describeTarget={false}>\n {label}\n </Tooltip>\n )}\n </>\n );\n});\n\nexport default Button;\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAStD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,QAAQ,EAAE,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY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CAAC,cAAc,CAAC,OAAO,CAAC,gBAAgB,CAAC;oBACvF,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC;oBACnC,iBAAiB,CAAC,OAAO,GAAG,SAAS,CAAC;oBACtC,kBAAkB,CAAC,OAAO,GAAG,SAAS,CAAC;oBAEvC,IAAI,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC,aAAa,EAAE;wBAC/D,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;qBAC5B;oBAED,OAAQ,SAAS,CAAC,SAA2C,EAAE,CAAC,CAAC,CAAC,CAAC;gBACrE,CAAC,aAEA,YAAY,IAAI,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,GAAG,EAC9D,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAC9B,EAEZ,QAAQ,IAAI,KAAK,IAAI,CACpB,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,cAAc,EAAE,KAAK,YAC/E,KAAK,GACE,CACX,IACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC","sourcesContent":["import { useRef, useEffect, forwardRef } from 'react';\nimport type {\n FunctionComponent,\n ReactNode,\n PropsWithoutRef,\n Ref,\n MouseEventHandler,\n MouseEvent as ReactMouseEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { meetsContrastGuidelines, mix } from 'polished';\n\nimport type { BaseProps, ForwardProps, PropsWithDefaults, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { isPositionWithinRect, tryCatch } from '../../utils';\nimport {\n getActiveColors,\n getHoverColors,\n omitProps,\n readableColor,\n readableHue\n} from '../../styles';\nimport { useElement, useConsolidatedRef } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport Progress, { StyledProgressRing } from '../Progress';\nimport { StyledBackdrop } from '../Backdrop';\nimport { StyledIcon } from '../Icon';\nimport { StyledPopover } from '../Popover';\n\nexport interface ButtonProps extends BaseProps, AsProp {\n /** Text or content for the Button. */\n children: ReactNode;\n /**\n * Determines if the Button will be disabled.\n * @default false\n */\n disabled?: boolean;\n /** A location to navigate to. Passing an href will render an anchor styled as a Button. */\n href?: string;\n /**\n * Controls the styling of the Button.\n * @default 'secondary'\n */\n variant?: 'primary' | 'secondary' | 'simple' | 'link' | 'text';\n /**\n * Controls the behavior of a Button within a Form.\n * @default 'button'\n */\n type?: 'button' | 'reset' | 'submit';\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Button. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: boolean;\n /**\n * Used for a smaller sized button.\n * @default false\n */\n compact?: boolean;\n /** The label text will be used inside a Tooltip. */\n label?: string;\n /** The aria label text will be inserted as the aria-label on the Button. */\n 'aria-label'?: string;\n /**\n * Optionally renders an indeterminate progress indicator in a button.\n * @default false\n */\n loading?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLButtonElement>;\n}\n\ntype ButtonPropsWithDefaults = PropsWithDefaults<\n ButtonProps,\n 'variant' | 'type' | 'disabled' | 'icon' | 'loading'\n>;\n\nconst baseStyles = (theme: DefaultTheme) => {\n const {\n base: {\n spacing,\n animation: {\n speed,\n timing: { ease }\n },\n 'disabled-opacity': disabledOpacity\n },\n components: {\n button: { 'focus-shadow': focusShadow }\n }\n } = theme;\n\n return css`\n outline: none;\n text-decoration: none;\n transition-property: background-color, color, border-color, box-shadow, translate;\n transition-duration: calc(0.5 * ${speed});\n transition-timing-function: ${ease};\n cursor: pointer;\n\n & + & {\n margin-inline-start: ${spacing};\n }\n\n /* Not able to combine with selector above. Stylis bug? */\n & + ${StyledPopover} + & {\n margin-inline-start: ${spacing};\n }\n\n &:disabled,\n &[disabled] {\n opacity: ${disabledOpacity};\n cursor: not-allowed;\n pointer-events: none;\n }\n\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: ${focusShadow};\n }\n `;\n};\n\nconst getFilledButtonStyles = (color: string) => ({\n contrastColor: tryCatch(() => readableColor(color)),\n hoverColors: getHoverColors(color),\n activeColors: getActiveColors(color)\n});\n\nconst getOutlinedButtonStyles = (color: string, backgroundColor: string) => {\n const backgroundUsable = meetsContrastGuidelines(color, backgroundColor).AA;\n const usableColor = backgroundUsable ? color : readableHue(color, backgroundColor);\n const hoverBackgroundColor = tryCatch(() => mix(0.9, backgroundColor, usableColor));\n const activeBackgroundColor = tryCatch(() => mix(0.8, backgroundColor, usableColor));\n\n return {\n textColor: backgroundUsable ? color : readableColor(color),\n hoverBg: hoverBackgroundColor,\n hoverFg: readableHue(usableColor, hoverBackgroundColor ?? 'transparent'),\n activeBg: tryCatch(() => mix(0.8, backgroundColor, usableColor)),\n activeFg: readableHue(usableColor, activeBackgroundColor ?? 'transparent')\n };\n};\n\nexport const StyledButton = styled.button.withConfig<ButtonPropsWithDefaults>(omitProps('loading'))(\n ({ variant, icon, loading, compact, theme }) => {\n const {\n base: {\n spacing,\n 'border-radius': baseBorderRadius,\n palette: { 'primary-background': backgroundColor },\n 'hit-area': {\n 'mouse-min': hitAreaMouse,\n 'finger-min': hitAreaFinger,\n 'compact-min': hitAreaCompact\n },\n animation: {\n speed,\n timing: { ease }\n }\n },\n components: {\n button: {\n color,\n 'secondary-color': secondaryColor,\n 'secondary-fill-style': fillStyle,\n padding,\n 'border-radius': borderRadius,\n 'border-width': borderWidth,\n touch: { padding: touchPadding }\n }\n }\n } = theme;\n\n // Base\n const base = baseStyles(theme);\n\n // Non-text base\n const nonTextual = css`\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: ${hitAreaMouse};\n min-width: ${hitAreaMouse};\n border: ${borderWidth} solid transparent;\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n -webkit-user-select: none;\n user-select: none;\n\n ${!icon &&\n css`\n padding: ${padding};\n `}\n\n ${icon &&\n css`\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n > svg {\n display: block;\n }\n `}\n\n ${compact &&\n css`\n min-height: ${hitAreaCompact};\n min-width: ${hitAreaCompact};\n `}\n\n @media (pointer: coarse) {\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n\n ${!compact &&\n css`\n min-height: ${hitAreaFinger};\n min-width: ${hitAreaFinger};\n `}\n\n ${!icon &&\n css`\n padding: ${touchPadding};\n `}\n }\n\n &:active {\n translate: 0 0.0625rem;\n }\n\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * ${borderWidth});\n border-radius: calc(${baseBorderRadius} * ${borderRadius});\n transition: translate calc(0.5 * ${speed}) ${ease};\n }\n\n &:active::after {\n translate: 0 -0.0625rem;\n }\n `;\n\n // Primary and Secondary-filled\n const { contrastColor, hoverColors, activeColors } = getFilledButtonStyles(\n variant === 'primary' ? color : secondaryColor\n );\n const solidButtonStyles = css`\n --button-background-color: ${variant === 'primary' ? color : secondaryColor};\n color: ${contrastColor};\n background-color: ${variant === 'primary' ? color : secondaryColor};\n\n @media (hover: hover) {\n &:hover {\n background-color: ${hoverColors.background};\n color: ${hoverColors.foreground};\n text-decoration: none;\n }\n }\n\n &:active {\n background-color: ${activeColors.background};\n color: ${activeColors.foreground};\n text-decoration: none;\n }\n `;\n\n // Secondary-outline\n const secondaryOutlineButtonStyles = getOutlinedButtonStyles(secondaryColor, backgroundColor);\n const secondary = css`\n --button-background-color: ${backgroundColor};\n color: ${secondaryOutlineButtonStyles.textColor};\n background-color: ${backgroundColor};\n border-color: ${secondaryColor};\n\n @media (hover: hover) {\n &:hover {\n color: ${secondaryOutlineButtonStyles.hoverFg};\n background-color: ${secondaryOutlineButtonStyles.hoverBg};\n text-decoration: none;\n border-color: ${secondaryOutlineButtonStyles.hoverFg};\n }\n }\n\n &:active {\n color: ${secondaryOutlineButtonStyles.activeFg};\n background-color: ${secondaryOutlineButtonStyles.activeBg};\n border-color: ${secondaryOutlineButtonStyles.activeFg};\n text-decoration: none;\n }\n `;\n\n // Simple\n const simpleButtonStyles = getOutlinedButtonStyles(\n fillStyle === 'outline' ? secondaryColor : color,\n backgroundColor\n );\n const simple = css`\n --button-background-color: ${icon ? 'transparent' : backgroundColor};\n color: ${icon ? 'currentColor' : simpleButtonStyles.textColor};\n background-color: ${icon ? 'transparent' : backgroundColor};\n\n @media (hover: hover) {\n &:hover {\n ${icon &&\n css`\n ::before {\n content: '';\n position: absolute;\n top: calc(${borderWidth} * -1);\n bottom: calc(${borderWidth} * -1);\n left: calc(${borderWidth} * -1);\n right: calc(${borderWidth} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.1;\n }\n `}\n\n ${!icon &&\n css`\n background-color: ${simpleButtonStyles.hoverBg};\n color: ${simpleButtonStyles.hoverFg};\n border-color: ${simpleButtonStyles.hoverFg};\n text-decoration: none;\n `}\n }\n\n &:active {\n ${icon &&\n css`\n ::before {\n content: '';\n position: absolute;\n top: calc(${borderWidth} * -1);\n bottom: calc(${borderWidth} * -1);\n left: calc(${borderWidth} * -1);\n right: calc(${borderWidth} * -1);\n border-radius: inherit;\n background-color: currentColor;\n opacity: 0.2;\n }\n `}\n\n ${!icon &&\n css`\n background-color: ${simpleButtonStyles.activeBg};\n color: ${simpleButtonStyles.activeFg};\n border-color: ${simpleButtonStyles.activeFg};\n text-decoration: none;\n `}\n }\n }\n `;\n\n return css`\n ${base}\n ${nonTextual}\n ${(variant === 'primary' || (variant === 'secondary' && fillStyle === 'fill')) &&\n solidButtonStyles}\n ${variant === 'secondary' && fillStyle === 'outline' && secondary}\n ${variant === 'simple' && simple}\n\n ${loading &&\n css`\n ${StyledBackdrop} {\n background-color: var(--button-background-color);\n border-radius: inherit;\n }\n\n ${StyledProgressRing} {\n width: 1em;\n height: 1em;\n\n ${!icon &&\n css`\n margin-inline-end: calc(${spacing} / 2);\n `}\n\n circle:nth-child(2) {\n animation-duration: calc(${speed} * 2);\n }\n }\n `}\n `;\n }\n);\n\nStyledButton.defaultProps = defaultThemeProp;\n\nexport const StyledButtonLink = styled.a.withConfig<\n Pick<ButtonPropsWithDefaults, 'variant'> &\n // Needed for omitProps\n Pick<ButtonProps, 'loading'>\n>(omitProps('loading'))(({ theme, variant }) => {\n const {\n base: {\n palette: { 'foreground-color': textColor }\n },\n components: {\n link: { color: linkColor }\n }\n } = theme;\n\n const base = baseStyles(theme);\n\n const textual = css`\n background-color: transparent;\n display: inline;\n text-align: start;\n border: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n > ${StyledIcon} {\n vertical-align: bottom;\n }\n `;\n\n const { background: activeColor } = getActiveColors(linkColor);\n const link = css`\n color: ${linkColor};\n\n &:active {\n color: ${activeColor};\n }\n `;\n\n const text = css`\n color: ${textColor};\n `;\n\n return css`\n ${base}\n ${textual}\n ${variant === 'link' && link}\n ${variant === 'text' && text}\n `;\n});\n\nStyledButtonLink.defaultProps = defaultThemeProp;\n\nconst Button: FunctionComponent<ButtonProps & ForwardProps> = forwardRef(function Button(\n {\n variant = 'secondary',\n type = 'button',\n disabled = false,\n icon = false,\n compact = false,\n href,\n as,\n forwardedAs,\n label,\n 'aria-label': ariaLabel,\n loading = false,\n children,\n ...restProps\n }: PropsWithoutRef<ButtonProps> & ForwardProps,\n ref: Ref<HTMLButtonElement>\n) {\n const [buttonEl, setButtonEl] = useElement();\n const mouseDownEvent = useRef<ReactMouseEvent>();\n const mouseDownPosition = useRef<DOMRect>();\n const mouseDownTimestamp = useRef<number>();\n const buttonRef = useConsolidatedRef<HTMLButtonElement>(ref, setButtonEl);\n const isTextual = ['link', 'text'].includes(variant);\n const showProgress = loading && !isTextual;\n const StyledComp: React.ElementType = isTextual ? StyledButtonLink : StyledButton;\n\n const handleClickWithElementShift = (e: MouseEvent) => {\n if (\n buttonRef.current &&\n mouseDownPosition.current &&\n mouseDownTimestamp.current &&\n isPositionWithinRect({ x: e.clientX, y: e.clientY }, mouseDownPosition.current) &&\n Date.now() - mouseDownTimestamp.current < 500\n ) {\n buttonRef.current.click();\n }\n };\n\n useEffect(() => {\n document.addEventListener('mouseup', handleClickWithElementShift);\n\n return () => {\n document.removeEventListener('mouseup', handleClickWithElementShift);\n mouseDownEvent.current = undefined;\n mouseDownPosition.current = undefined;\n mouseDownTimestamp.current = undefined;\n };\n }, []);\n\n return (\n <>\n <StyledComp\n {...restProps}\n ref={buttonRef}\n as={as || (href ? 'a' : 'button')}\n forwardedAs={forwardedAs || (href ? 'a' : 'button')}\n variant={variant}\n icon={icon}\n compact={compact}\n type={href ? undefined : type}\n href={href}\n disabled={disabled && !href}\n loading={showProgress}\n aria-label={ariaLabel || label}\n onMouseDown={(e: ReactMouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n (restProps.onMouseDown as MouseEventHandler | undefined)?.(e);\n e.persist();\n mouseDownEvent.current = e;\n mouseDownPosition.current = e.currentTarget.getBoundingClientRect();\n mouseDownTimestamp.current = Date.now();\n }}\n onMouseUp={(e: ReactMouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const shouldFocus = mouseDownEvent.current && !mouseDownEvent.current.defaultPrevented;\n mouseDownEvent.current = undefined;\n mouseDownPosition.current = undefined;\n mouseDownTimestamp.current = undefined;\n\n if (shouldFocus && buttonRef.current !== document.activeElement) {\n buttonRef.current?.focus();\n }\n\n return (restProps.onMouseUp as MouseEventHandler | undefined)?.(e);\n }}\n >\n {showProgress && <Progress variant='ring' placement='inline' />}\n {!icon || !showProgress ? children : null}\n </StyledComp>\n\n {buttonEl && label && (\n <Tooltip target={buttonEl} showDelay='none' hideDelay='none' describeTarget={false}>\n {label}\n </Tooltip>\n )}\n </>\n );\n});\n\nexport default Button;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAmB,SAAS,EA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eAAe,IAAI,CAAC"}
@@ -4,8 +4,10 @@ import styled, { css } from 'styled-components';
4
4
  import { defaultThemeProp } from '../../theme';
5
5
  import Flex from '../Flex';
6
6
  import { StyledPopover } from '../Popover';
7
+ import { useFullscreenContext } from '../Fullscreen';
7
8
  import { StyledCardMedia } from './CardMedia';
8
9
  export const StyledCard = styled.article(props => {
10
+ const fullscreen = useFullscreenContext();
9
11
  const { 'border-radius': borderRadius, 'border-color': borderColor, background } = props.theme.components.card;
10
12
  const interactive = props.interactive
11
13
  ? css `
@@ -35,6 +37,12 @@ export const StyledCard = styled.article(props => {
35
37
  border-radius: ${borderRadius} ${borderRadius} 0 0;
36
38
  }
37
39
  }
40
+
41
+ ${fullscreen?.[0] &&
42
+ css `
43
+ block-size: 100%;
44
+ border-radius: 0;
45
+ `}
38
46
  }
39
47
  `;
40
48
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAiB9C,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAqB,KAAK,CAAC,EAAE;IACnE,MAAM,EACJ,eAAe,EAAE,YAAY,EAC7B,cAAc,EAAE,WAAW,EAC3B,UAAU,EACX,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;IAChC,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW;QACnC,CAAC,CAAC,GAAG,CAAA;;;wCAG+B,WAAW;;;;uCAIZ,WAAW;;OAE3C;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,GAAG,CAAA;MACN,aAAa;0BACO,UAAU;uBACb,YAAY;;;;;;QAM3B,WAAW;;QAEX,eAAe;;2BAEI,YAAY,IAAI,YAAY;;;;GAIpD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAAC,SAAS,IAAI,CAChF,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,EAAE,GAAG,SAAS,EAA8B,EACxF,GAAqB;IAErB,MAAM,gBAAgB,GAAG;QACvB,GAAG,CAAC,OAAO,IAAI;YACb,OAAO;YACP,QAAQ,EAAE,CAAC;YACX,IAAI,EAAE,QAAQ;SACf,CAAC;QACF,GAAG,CAAC,WAAW,IAAI;YACjB,QAAQ,EAAE,CAAC;SACZ,CAAC;QACF,WAAW;KACZ,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,IACH,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,EAAE,EAAE,UAAU,EACd,WAAW,EAAE,EAAE,EACf,GAAG,EAAE,GAAG,KACJ,gBAAgB,KAChB,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, Ref, PropsWithoutRef, ReactNode, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport type { ForwardProps, BaseProps, AsProp } from '../../types';\nimport { StyledPopover } from '../Popover';\n\nimport { StyledCardMedia } from './CardMedia';\n\nexport interface CardProps extends BaseProps, AsProp {\n /** Components and content for the Card. */\n children?: ReactNode;\n /**\n * Enables the focus, hover, and active styles.\n * @default false\n * @deprecated\n */\n interactive?: boolean;\n /** Callback for onClick event. */\n onClick?: MouseEventHandler<HTMLElement>;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport const StyledCard = styled.article<Partial<CardProps>>(props => {\n const {\n 'border-radius': borderRadius,\n 'border-color': borderColor,\n background\n } = props.theme.components.card;\n const interactive = props.interactive\n ? css`\n &:hover {\n border: 0;\n box-shadow: 0 0 0 0.0625rem ${borderColor};\n }\n &:focus {\n border: 0;\n box-shadow: 0 0 0 0.125rem ${borderColor};\n }\n `\n : undefined;\n\n return css`\n ${StyledPopover} &, &:not(& &) {\n background-color: ${background};\n border-radius: ${borderRadius};\n\n &:focus {\n outline: none;\n }\n\n ${interactive}\n\n ${StyledCardMedia} {\n &:first-child img {\n border-radius: ${borderRadius} ${borderRadius} 0 0;\n }\n }\n }\n `;\n});\n\nStyledCard.defaultProps = defaultThemeProp;\n\nconst Card: FunctionComponent<CardProps & ForwardProps> = forwardRef(function Card(\n { children, as, onClick, interactive = false, ...restProps }: PropsWithoutRef<CardProps>,\n ref: CardProps['ref']\n) {\n const interactiveProps = {\n ...(onClick && {\n onClick,\n tabIndex: 0,\n role: 'button'\n }),\n ...(interactive && {\n tabIndex: 0\n }),\n interactive\n };\n\n return (\n <Flex\n role='none'\n container={{ direction: 'column' }}\n as={StyledCard}\n forwardedAs={as}\n ref={ref}\n {...interactiveProps}\n {...restProps}\n >\n {children}\n </Flex>\n );\n});\n\nexport default Card;\n"]}
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,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SAAS,EAAE,QAAQ,EAAE,EAClC,EAAE,EAAE,UAAU,EACd,WAAW,EAAE,EAAE,EACf,GAAG,EAAE,GAAG,KACJ,gBAAgB,KAChB,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { FunctionComponent, Ref, PropsWithoutRef, ReactNode, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport type { ForwardProps, BaseProps, AsProp } from '../../types';\nimport { StyledPopover } from '../Popover';\nimport { useFullscreenContext } from '../Fullscreen';\n\nimport { StyledCardMedia } from './CardMedia';\n\nexport interface CardProps extends BaseProps, AsProp {\n /** Components and content for the Card. */\n children?: ReactNode;\n /**\n * Enables the focus, hover, and active styles.\n * @default false\n * @deprecated\n */\n interactive?: boolean;\n /** Callback for onClick event. */\n onClick?: MouseEventHandler<HTMLElement>;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport const StyledCard = styled.article<Partial<CardProps>>(props => {\n const fullscreen = useFullscreenContext();\n\n const {\n 'border-radius': borderRadius,\n 'border-color': borderColor,\n background\n } = props.theme.components.card;\n const interactive = props.interactive\n ? css`\n &:hover {\n border: 0;\n box-shadow: 0 0 0 0.0625rem ${borderColor};\n }\n &:focus {\n border: 0;\n box-shadow: 0 0 0 0.125rem ${borderColor};\n }\n `\n : undefined;\n\n return css`\n ${StyledPopover} &, &:not(& &) {\n background-color: ${background};\n border-radius: ${borderRadius};\n\n &:focus {\n outline: none;\n }\n\n ${interactive}\n\n ${StyledCardMedia} {\n &:first-child img {\n border-radius: ${borderRadius} ${borderRadius} 0 0;\n }\n }\n\n ${fullscreen?.[0] &&\n css`\n block-size: 100%;\n border-radius: 0;\n `}\n }\n `;\n});\n\nStyledCard.defaultProps = defaultThemeProp;\n\nconst Card: FunctionComponent<CardProps & ForwardProps> = forwardRef(function Card(\n { children, as, onClick, interactive = false, ...restProps }: PropsWithoutRef<CardProps>,\n ref: CardProps['ref']\n) {\n const interactiveProps = {\n ...(onClick && {\n onClick,\n tabIndex: 0,\n role: 'button'\n }),\n ...(interactive && {\n tabIndex: 0\n }),\n interactive\n };\n\n return (\n <Flex\n role='none'\n container={{ direction: 'column' }}\n as={StyledCard}\n forwardedAs={as}\n ref={ref}\n {...interactiveProps}\n {...restProps}\n >\n {children}\n </Flex>\n );\n});\n\nexport default Card;\n"]}
@@ -103,6 +103,6 @@ export default withTestIds(forwardRef(function ColorPicker(props, ref) {
103
103
  hsl: { h, s, l }
104
104
  }, e);
105
105
  };
106
- return (_jsx(FormField, { testId: testIds, inline: inline, container: inline ? { justify: 'between' } : undefined, as: StyledColorPicker, id: id, label: label, labelHidden: labelHidden, swatchOnly: swatchOnly, info: info, disabled: disabled, status: status, required: required, additionalInfo: additionalInfo, children: _jsxs(Flex, { container: { alignItems: 'center' }, item: swatchOnly ? { alignSelf: 'start' } : undefined, as: StyledFormControl, disabled: disabled, status: status, required: required, readOnly: readOnly, onClick: readOnly || disabled ? undefined : () => setShowColorPicker(true), children: [_jsx("input", { "data-testid": testIds.control, ...restProps, id: id, type: readOnly ? undefined : 'color', ref: inputRef, defaultValue: value, disabled: disabled, required: required, readOnly: readOnly, onChange: onChangeHandler }), _jsx("div", { style: { backgroundColor: value } }), !swatchOnly && value] }) }));
106
+ return (_jsx(FormField, { testId: testIds, inline: inline, container: inline ? { justify: 'between' } : undefined, as: StyledColorPicker, id: id, label: label, labelHidden: labelHidden, swatchOnly: swatchOnly, info: info, disabled: disabled, status: status, required: required, additionalInfo: additionalInfo, children: _jsxs(Flex, { container: { alignItems: 'center' }, item: swatchOnly ? { alignSelf: 'start' } : undefined, as: StyledFormControl, disabled: disabled, status: status, required: required, readOnly: readOnly, onClick: readOnly || disabled ? undefined : () => setShowColorPicker(true), children: [_jsx("input", { "data-testid": testIds.control, ...restProps, id: id, type: readOnly ? undefined : 'color', ref: inputRef, value: value, disabled: disabled, required: required, readOnly: readOnly, onChange: onChangeHandler }), _jsx("div", { style: { backgroundColor: value } }), !swatchOnly && value] }) }));
107
107
  }), getColorPickerTestIds);
108
108
  //# sourceMappingURL=ColorPicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAShE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAyD/D,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAClC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IACxB,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,CAAC;IAErE,OAAO,GAAG,CAAA;QACN,iBAAiB;;;UAGf,CAAC,UAAU;QACb,GAAG,CAAA;;SAEF;;UAEC,CAAC,UAAU;QACb,GAAG,CAAA;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,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,cAAc,YAE9B,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EACnC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,EACrD,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAE1E,+BACe,OAAO,CAAC,OAAO,KACxB,SAAS,EACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EACpC,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,KAAK,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,eAAe,GACzB,EACF,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,GAAI,EACzC,CAAC,UAAU,IAAI,KAAK,IAChB,GACG,CACb,CAAC;AACJ,CAAC,CACF,EACD,qBAAqB,CACtB,CAAC","sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport type { PropsWithoutRef, ChangeEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually, parseToHsl, parseToRgb } from 'polished';\n\nimport type {\n NoChildrenProp,\n PropsWithDefaults,\n RefElement,\n TestIdProp,\n WithAttributes\n} from '../../types';\nimport { withTestIds } from '../../utils';\nimport FormField from '../FormField';\nimport type { FormFieldProps } from '../FormField';\nimport { defaultThemeProp } from '../../theme';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport Flex from '../Flex';\nimport { useConsolidatedRef, useUID, useOuterEvent, useTestIds } from '../../hooks';\n\nimport { getColorPickerTestIds } from './ColorPicker.test-ids';\n\nexport type ColorPickerProps = WithAttributes<\n 'input',\n TestIdProp &\n NoChildrenProp & {\n /** label for the color picker control */\n label: FormControlProps['label'];\n /**\n * Color picker value in hex\n * @default '#000000'\n */\n value?: FormControlProps['value'];\n /**\n * Show color swatch without hex value display.\n * @default false\n */\n swatchOnly?: boolean;\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Layout field elements inline in a row. */\n inline?: FormFieldProps['inline'];\n /** Button when clicked will show additional information on the color picker */\n additionalInfo?: FormFieldProps['additionalInfo'];\n /** onChange event handler that gets called on change of value. */\n onChange?: ColorChangeHandler;\n /** onBeforeClose of the color picker */\n onBeforeClose?: () => void;\n }\n>;\n\ntype RGBColor = {\n r: number;\n g: number;\n b: number;\n};\n\ntype HSLColor = {\n h: number;\n s: number;\n l: number;\n};\n\ntype ColorResult = {\n hex: string;\n rgb: RGBColor;\n hsl: HSLColor;\n};\n\ntype ColorChangeHandler = (color: ColorResult, event: ChangeEvent<HTMLInputElement>) => void;\n\ntype ColorPickerPropsWithDefaults = PropsWithDefaults<ColorPickerProps, 'value' | 'swatchOnly'>;\n\nconst StyledColorPicker = styled.div<Pick<ColorPickerPropsWithDefaults, 'swatchOnly'>>(\n ({ theme, swatchOnly }) => {\n const size = theme.components.input.height;\n const borderWidth = theme.components['form-control']['border-width'];\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n text-transform: uppercase;\n ${!swatchOnly &&\n css`\n min-width: 8rem;\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${theme.base.spacing};\n `}\n\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n border: none;\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${size} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${size} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${size} - ${borderWidth});\n margin-inline-end: ${theme.base.spacing};\n border-inline-end: ${borderWidth} solid\n ${theme.components['form-control']['border-color']};\n `}\n }\n\n &:focus + div {\n width: ${size};\n height: ${size};\n }\n }\n\n & input {\n height: 2rem !important;\n min-height: 2rem;\n color: #000000 !important;\n background-color: #ffffff !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6) !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n }\n }\n }\n `;\n }\n);\n\nStyledColorPicker.defaultProps = defaultThemeProp;\n\nexport default withTestIds(\n forwardRef<RefElement<ColorPickerProps>, PropsWithoutRef<ColorPickerProps>>(\n function ColorPicker(props, ref) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n value = '#000000',\n label,\n info,\n disabled,\n status,\n required,\n readOnly,\n labelHidden,\n swatchOnly = false,\n inline,\n onClick,\n onChange,\n onBeforeClose,\n additionalInfo,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getColorPickerTestIds);\n\n const inputRef = useConsolidatedRef(ref);\n const [showColorPicker, setShowColorPicker] = useState(false);\n\n const hideColorPicker = () => {\n if (showColorPicker) {\n onBeforeClose?.();\n }\n\n setShowColorPicker(false);\n };\n\n useOuterEvent('mousedown', [inputRef], hideColorPicker);\n\n useEffect(() => {\n if (showColorPicker) {\n inputRef?.current?.focus();\n inputRef?.current?.click();\n }\n }, [showColorPicker]);\n\n const onChangeHandler = (e: ChangeEvent<HTMLInputElement>) => {\n const color = e.target.value;\n const { red: r, green: g, blue: b } = parseToRgb(color);\n const { hue: h, saturation: s, lightness: l } = parseToHsl(color);\n onChange?.(\n {\n hex: color,\n rgb: { r, g, b },\n hsl: { h, s, l }\n },\n e\n );\n };\n\n return (\n <FormField\n testId={testIds}\n inline={inline}\n container={inline ? { justify: 'between' } : undefined}\n as={StyledColorPicker}\n id={id}\n label={label}\n labelHidden={labelHidden}\n swatchOnly={swatchOnly}\n info={info}\n disabled={disabled}\n status={status}\n required={required}\n additionalInfo={additionalInfo}\n >\n <Flex\n container={{ alignItems: 'center' }}\n item={swatchOnly ? { alignSelf: 'start' } : undefined}\n as={StyledFormControl}\n disabled={disabled}\n status={status}\n required={required}\n readOnly={readOnly}\n onClick={readOnly || disabled ? undefined : () => setShowColorPicker(true)}\n >\n <input\n data-testid={testIds.control}\n {...restProps}\n id={id}\n type={readOnly ? undefined : 'color'}\n ref={inputRef}\n defaultValue={value}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n onChange={onChangeHandler}\n />\n <div style={{ backgroundColor: value }} />\n {!swatchOnly && value}\n </Flex>\n </FormField>\n );\n }\n ),\n getColorPickerTestIds\n);\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAShE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,IAAI,MA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CAAC,CAAC,CAAC,OAAO,EACpC,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,eAAe,GACzB,EACF,cAAK,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,GAAI,EACzC,CAAC,UAAU,IAAI,KAAK,IAChB,GACG,CACb,CAAC;AACJ,CAAC,CACF,EACD,qBAAqB,CACtB,CAAC","sourcesContent":["import { forwardRef, useState, useEffect } from 'react';\nimport type { PropsWithoutRef, ChangeEvent } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually, parseToHsl, parseToRgb } from 'polished';\n\nimport type {\n NoChildrenProp,\n PropsWithDefaults,\n RefElement,\n TestIdProp,\n WithAttributes\n} from '../../types';\nimport { withTestIds } from '../../utils';\nimport FormField from '../FormField';\nimport type { FormFieldProps } from '../FormField';\nimport { defaultThemeProp } from '../../theme';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport Flex from '../Flex';\nimport { useConsolidatedRef, useUID, useOuterEvent, useTestIds } from '../../hooks';\n\nimport { getColorPickerTestIds } from './ColorPicker.test-ids';\n\nexport type ColorPickerProps = WithAttributes<\n 'input',\n TestIdProp &\n NoChildrenProp & {\n /** label for the color picker control */\n label: FormControlProps['label'];\n /**\n * Color picker value in hex\n * @default '#000000'\n */\n value?: FormControlProps['value'];\n /**\n * Show color swatch without hex value display.\n * @default false\n */\n swatchOnly?: boolean;\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Layout field elements inline in a row. */\n inline?: FormFieldProps['inline'];\n /** Button when clicked will show additional information on the color picker */\n additionalInfo?: FormFieldProps['additionalInfo'];\n /** onChange event handler that gets called on change of value. */\n onChange?: ColorChangeHandler;\n /** onBeforeClose of the color picker */\n onBeforeClose?: () => void;\n }\n>;\n\ntype RGBColor = {\n r: number;\n g: number;\n b: number;\n};\n\ntype HSLColor = {\n h: number;\n s: number;\n l: number;\n};\n\ntype ColorResult = {\n hex: string;\n rgb: RGBColor;\n hsl: HSLColor;\n};\n\ntype ColorChangeHandler = (color: ColorResult, event: ChangeEvent<HTMLInputElement>) => void;\n\ntype ColorPickerPropsWithDefaults = PropsWithDefaults<ColorPickerProps, 'value' | 'swatchOnly'>;\n\nconst StyledColorPicker = styled.div<Pick<ColorPickerPropsWithDefaults, 'swatchOnly'>>(\n ({ theme, swatchOnly }) => {\n const size = theme.components.input.height;\n const borderWidth = theme.components['form-control']['border-width'];\n\n return css`\n ${StyledFormControl} {\n overflow: hidden;\n text-transform: uppercase;\n ${!swatchOnly &&\n css`\n min-width: 8rem;\n `}\n\n ${!swatchOnly &&\n css`\n padding-inline-end: ${theme.base.spacing};\n `}\n\n &:focus-within {\n box-shadow: ${theme.base.shadow.focus};\n border: none;\n }\n\n & > input {\n ${hideVisually}\n\n & + div {\n height: calc(${size} - (2 * ${borderWidth}));\n\n ${swatchOnly\n ? css`\n width: calc(${size} - (2 * ${borderWidth}));\n `\n : css`\n min-width: calc(${size} - ${borderWidth});\n margin-inline-end: ${theme.base.spacing};\n border-inline-end: ${borderWidth} solid\n ${theme.components['form-control']['border-color']};\n `}\n }\n\n &:focus + div {\n width: ${size};\n height: ${size};\n }\n }\n\n & input {\n height: 2rem !important;\n min-height: 2rem;\n color: #000000 !important;\n background-color: #ffffff !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n\n & + label {\n font-weight: 600;\n color: rgba(0, 0, 0, 0.6) !important;\n font-size: 0.8125rem !important;\n font-family: ${theme.base['font-family']};\n }\n }\n }\n `;\n }\n);\n\nStyledColorPicker.defaultProps = defaultThemeProp;\n\nexport default withTestIds(\n forwardRef<RefElement<ColorPickerProps>, PropsWithoutRef<ColorPickerProps>>(\n function ColorPicker(props, ref) {\n const uid = useUID();\n const {\n testId,\n id = uid,\n value = '#000000',\n label,\n info,\n disabled,\n status,\n required,\n readOnly,\n labelHidden,\n swatchOnly = false,\n inline,\n onClick,\n onChange,\n onBeforeClose,\n additionalInfo,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getColorPickerTestIds);\n\n const inputRef = useConsolidatedRef(ref);\n const [showColorPicker, setShowColorPicker] = useState(false);\n\n const hideColorPicker = () => {\n if (showColorPicker) {\n onBeforeClose?.();\n }\n\n setShowColorPicker(false);\n };\n\n useOuterEvent('mousedown', [inputRef], hideColorPicker);\n\n useEffect(() => {\n if (showColorPicker) {\n inputRef?.current?.focus();\n inputRef?.current?.click();\n }\n }, [showColorPicker]);\n\n const onChangeHandler = (e: ChangeEvent<HTMLInputElement>) => {\n const color = e.target.value;\n const { red: r, green: g, blue: b } = parseToRgb(color);\n const { hue: h, saturation: s, lightness: l } = parseToHsl(color);\n onChange?.(\n {\n hex: color,\n rgb: { r, g, b },\n hsl: { h, s, l }\n },\n e\n );\n };\n\n return (\n <FormField\n testId={testIds}\n inline={inline}\n container={inline ? { justify: 'between' } : undefined}\n as={StyledColorPicker}\n id={id}\n label={label}\n labelHidden={labelHidden}\n swatchOnly={swatchOnly}\n info={info}\n disabled={disabled}\n status={status}\n required={required}\n additionalInfo={additionalInfo}\n >\n <Flex\n container={{ alignItems: 'center' }}\n item={swatchOnly ? { alignSelf: 'start' } : undefined}\n as={StyledFormControl}\n disabled={disabled}\n status={status}\n required={required}\n readOnly={readOnly}\n onClick={readOnly || disabled ? undefined : () => setShowColorPicker(true)}\n >\n <input\n data-testid={testIds.control}\n {...restProps}\n id={id}\n type={readOnly ? undefined : 'color'}\n ref={inputRef}\n value={value}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n onChange={onChangeHandler}\n />\n <div style={{ backgroundColor: value }} />\n {!swatchOnly && value}\n </Flex>\n </FormField>\n );\n }\n ),\n getColorPickerTestIds\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.styles.d.ts","sourceRoot":"","sources":["../../../src/components/ComboBox/ComboBox.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,yGAyD5B,CAAC;AAIH,eAAO,MAAM,cAAc;;SAczB,CAAC"}
1
+ {"version":3,"file":"ComboBox.styles.d.ts","sourceRoot":"","sources":["../../../src/components/ComboBox/ComboBox.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,yGAyD5B,CAAC;AAIH,eAAO,MAAM,cAAc;;SAkBzB,CAAC"}
@@ -67,6 +67,10 @@ export const StyledComboBox = styled(StyledFormControl)(() => {
67
67
  return css `
68
68
  border: 0;
69
69
 
70
+ &:focus {
71
+ z-index: 1;
72
+ }
73
+
70
74
  ${StyledPopover} {
71
75
  border-top-left-radius: 0;
72
76
  border-top-right-radius: 0;
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.styles.js","sourceRoot":"","sources":["../../../src/components/ComboBox/ComboBox.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;IAC9E,OAAO,GAAG,CAAA;;oBAEQ,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;;;;;UAKxC,UAAU,CAAC,KAAK,CAAC,MAAM,UAAU,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC;;;;;sBAK/D,UAAU,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC;oBACtD,UAAU,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC;;;;;;;;;;qBAUjD,UAAU,CAAC,KAAK,CAAC,MAAM,UAAU,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC;eACjF,UAAU,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAC;;uBAEtC,IAAI,CAAC,OAAO;;;;;;;;;;;;;;;UAezB,YAAY;;;;;;;UAOZ,IAAI,CAAC,eAAe,CAAC,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC;;;;UAItE,IAAI,CAAC,eAAe,CAAC,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC;;;GAG7E,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,EAAE;IAC3D,OAAO,GAAG,CAAA;;;MAGN,aAAa;;;;QAIX,UAAU;QACV,qBAAqB;;;;GAI1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledButton } from '../Button';\nimport { StyledFormControl } from '../FormControl';\nimport { StyledPopover } from '../Popover';\nimport { StyledMenu, StyledMenuListWrapper } from '../Menu/Menu.styles';\n\nexport const StyledSelectInput = styled.div(({ theme: { base, components } }) => {\n return css`\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n\n div {\n min-height: calc(\n ${components.input.height} - 2 * ${components['form-control']['border-width']}\n );\n }\n\n &:focus-within {\n border-color: ${components['form-control'][':focus']['border-color']};\n box-shadow: ${components['form-control'][':focus']['box-shadow']};\n }\n\n &:hover:not([readonly]):not([disabled]):focus-within {\n border-color: transparent;\n }\n\n input {\n min-width: 0;\n width: 100%;\n height: calc(${components.input.height} - 2 * ${components['form-control']['border-width']});\n color: ${components['form-control']['foreground-color']};\n text-overflow: ellipsis;\n margin-inline: ${base.spacing};\n }\n\n input,\n input:focus {\n border: none;\n outline: none;\n flex-grow: 1;\n background-color: transparent;\n\n &:read-only {\n cursor: default;\n }\n }\n\n & > ${StyledButton} {\n align-self: stretch;\n height: auto;\n margin-block: -0.0625rem;\n margin-inline-end: -0.0625rem;\n border-start-start-radius: 0;\n border-start-end-radius: calc(\n ${base['border-radius']} * ${components['form-control']['border-radius']}\n );\n border-end-start-radius: 0;\n border-end-end-radius: calc(\n ${base['border-radius']} * ${components['form-control']['border-radius']}\n );\n }\n `;\n});\n\nStyledSelectInput.defaultProps = defaultThemeProp;\n\nexport const StyledComboBox = styled(StyledFormControl)(() => {\n return css`\n border: 0;\n\n ${StyledPopover} {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n\n ${StyledMenu},\n ${StyledMenuListWrapper} {\n max-height: inherit;\n }\n }\n `;\n});\n\nStyledComboBox.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"ComboBox.styles.js","sourceRoot":"","sources":["../../../src/components/ComboBox/ComboBox.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;IAC9E,OAAO,GAAG,CAAA;;oBAEQ,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;;;;;UAKxC,UAAU,CAAC,KAAK,CAAC,MAAM,UAAU,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC;;;;;sBAK/D,UAAU,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC;oBACtD,UAAU,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC;;;;;;;;;;qBAUjD,UAAU,CAAC,KAAK,CAAC,MAAM,UAAU,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC;eACjF,UAAU,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAC;;uBAEtC,IAAI,CAAC,OAAO;;;;;;;;;;;;;;;UAezB,YAAY;;;;;;;UAOZ,IAAI,CAAC,eAAe,CAAC,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC;;;;UAItE,IAAI,CAAC,eAAe,CAAC,MAAM,UAAU,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC;;;GAG7E,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,EAAE;IAC3D,OAAO,GAAG,CAAA;;;;;;;MAON,aAAa;;;;QAIX,UAAU;QACV,qBAAqB;;;;GAI1B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledButton } from '../Button';\nimport { StyledFormControl } from '../FormControl';\nimport { StyledPopover } from '../Popover';\nimport { StyledMenu, StyledMenuListWrapper } from '../Menu/Menu.styles';\n\nexport const StyledSelectInput = styled.div(({ theme: { base, components } }) => {\n return css`\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n\n div {\n min-height: calc(\n ${components.input.height} - 2 * ${components['form-control']['border-width']}\n );\n }\n\n &:focus-within {\n border-color: ${components['form-control'][':focus']['border-color']};\n box-shadow: ${components['form-control'][':focus']['box-shadow']};\n }\n\n &:hover:not([readonly]):not([disabled]):focus-within {\n border-color: transparent;\n }\n\n input {\n min-width: 0;\n width: 100%;\n height: calc(${components.input.height} - 2 * ${components['form-control']['border-width']});\n color: ${components['form-control']['foreground-color']};\n text-overflow: ellipsis;\n margin-inline: ${base.spacing};\n }\n\n input,\n input:focus {\n border: none;\n outline: none;\n flex-grow: 1;\n background-color: transparent;\n\n &:read-only {\n cursor: default;\n }\n }\n\n & > ${StyledButton} {\n align-self: stretch;\n height: auto;\n margin-block: -0.0625rem;\n margin-inline-end: -0.0625rem;\n border-start-start-radius: 0;\n border-start-end-radius: calc(\n ${base['border-radius']} * ${components['form-control']['border-radius']}\n );\n border-end-start-radius: 0;\n border-end-end-radius: calc(\n ${base['border-radius']} * ${components['form-control']['border-radius']}\n );\n }\n `;\n});\n\nStyledSelectInput.defaultProps = defaultThemeProp;\n\nexport const StyledComboBox = styled(StyledFormControl)(() => {\n return css`\n border: 0;\n\n &:focus {\n z-index: 1;\n }\n\n ${StyledPopover} {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n\n ${StyledMenu},\n ${StyledMenuListWrapper} {\n max-height: inherit;\n }\n }\n `;\n});\n\nStyledComboBox.defaultProps = defaultThemeProp;\n"]}
@@ -5,6 +5,7 @@ import type { StyleSheetManagerProps } from 'styled-components';
5
5
  import '../../init';
6
6
  import type { ThemeMachineLike, DefaultSettableTheme, DefaultThemeDefinition } from '../../theme';
7
7
  import type { Translation, TranslationPack } from '../../i18n';
8
+ import './connected-watcher';
8
9
  export interface ConfigurationProps {
9
10
  /** Any components or nodes that should be impacted by the settings applied by this Configuration component. */
10
11
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../../src/components/Configuration/Configuration.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAiB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAMlG,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAK/D,MAAM,WAAW,kBAAkB;IACjC,+GAA+G;IAC/G,QAAQ,EAAE,SAAS,CAAC;IACpB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAC1B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,wEAAwE;IACxE,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,0GAA0G;IAC1G,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACpD;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD;;;OA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