@pega/cosmos-react-core 4.0.0-dev.6.1 → 4.0.0-dev.8.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 (217) hide show
  1. package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
  2. package/lib/components/Backdrop/Backdrop.js +22 -2
  3. package/lib/components/Backdrop/Backdrop.js.map +1 -1
  4. package/lib/components/Banner/Banner.d.ts +9 -1
  5. package/lib/components/Banner/Banner.d.ts.map +1 -1
  6. package/lib/components/Banner/Banner.js +21 -10
  7. package/lib/components/Banner/Banner.js.map +1 -1
  8. package/lib/components/Banner/index.d.ts +1 -1
  9. package/lib/components/Banner/index.d.ts.map +1 -1
  10. package/lib/components/Banner/index.js.map +1 -1
  11. package/lib/components/Card/Card.d.ts +4 -7
  12. package/lib/components/Card/Card.d.ts.map +1 -1
  13. package/lib/components/Card/Card.js +2 -9
  14. package/lib/components/Card/Card.js.map +1 -1
  15. package/lib/components/Configuration/Configuration.d.ts +4 -1
  16. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  17. package/lib/components/Configuration/Configuration.js +2 -0
  18. package/lib/components/Configuration/Configuration.js.map +1 -1
  19. package/lib/components/DateTime/DateTime.types.d.ts +4 -1
  20. package/lib/components/DateTime/DateTime.types.d.ts.map +1 -1
  21. package/lib/components/DateTime/DateTime.types.js.map +1 -1
  22. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  23. package/lib/components/DateTime/Input/DateInput.js +12 -1
  24. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  25. package/lib/components/DateTime/Input/DateRangeInput.d.ts +4 -2
  26. package/lib/components/DateTime/Input/DateRangeInput.d.ts.map +1 -1
  27. package/lib/components/DateTime/Input/DateRangeInput.js +71 -34
  28. package/lib/components/DateTime/Input/DateRangeInput.js.map +1 -1
  29. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  30. package/lib/components/DateTime/Input/DateTimeInput.js +19 -2
  31. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  32. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  33. package/lib/components/DateTime/Input/PartInput.js +2 -2
  34. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  35. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  36. package/lib/components/DateTime/Input/TimeInput.js +13 -2
  37. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  38. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +4 -2
  39. package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
  40. package/lib/components/DateTime/Input/TimeRangeInput.js +70 -27
  41. package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
  42. package/lib/components/Dialog/FormDialog.d.ts.map +1 -1
  43. package/lib/components/Dialog/FormDialog.js +2 -6
  44. package/lib/components/Dialog/FormDialog.js.map +1 -1
  45. package/lib/components/Dialog/InfoDialog.d.ts.map +1 -1
  46. package/lib/components/Dialog/InfoDialog.js +2 -6
  47. package/lib/components/Dialog/InfoDialog.js.map +1 -1
  48. package/lib/components/FormControl/FormControl.d.ts +4 -0
  49. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  50. package/lib/components/FormControl/FormControl.js.map +1 -1
  51. package/lib/components/FormControl/index.d.ts +1 -0
  52. package/lib/components/FormControl/index.d.ts.map +1 -1
  53. package/lib/components/FormControl/index.js.map +1 -1
  54. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  55. package/lib/components/ListToolbar/ListToolbar.js +84 -66
  56. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  57. package/lib/components/ListToolbar/ListToolbar.styles.d.ts +2 -0
  58. package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -1
  59. package/lib/components/ListToolbar/ListToolbar.styles.js +37 -5
  60. package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -1
  61. package/lib/components/ListToolbar/ListToolbar.types.d.ts +4 -4
  62. package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
  63. package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
  64. package/lib/components/LiveLog/Context.d.ts +3 -0
  65. package/lib/components/LiveLog/Context.d.ts.map +1 -0
  66. package/lib/components/LiveLog/Context.js +9 -0
  67. package/lib/components/LiveLog/Context.js.map +1 -0
  68. package/lib/components/LiveLog/LiveLog.d.ts +10 -0
  69. package/lib/components/LiveLog/LiveLog.d.ts.map +1 -0
  70. package/lib/components/LiveLog/LiveLog.js +99 -0
  71. package/lib/components/LiveLog/LiveLog.js.map +1 -0
  72. package/lib/components/LiveLog/LiveLog.styles.d.ts +3 -0
  73. package/lib/components/LiveLog/LiveLog.styles.d.ts.map +1 -0
  74. package/lib/components/LiveLog/LiveLog.styles.js +9 -0
  75. package/lib/components/LiveLog/LiveLog.styles.js.map +1 -0
  76. package/lib/components/LiveLog/LiveLog.types.d.ts +93 -0
  77. package/lib/components/LiveLog/LiveLog.types.d.ts.map +1 -0
  78. package/lib/components/LiveLog/LiveLog.types.js +2 -0
  79. package/lib/components/LiveLog/LiveLog.types.js.map +1 -0
  80. package/lib/components/LiveLog/index.d.ts +4 -0
  81. package/lib/components/LiveLog/index.d.ts.map +1 -0
  82. package/lib/components/LiveLog/index.js +3 -0
  83. package/lib/components/LiveLog/index.js.map +1 -0
  84. package/lib/components/Menu/Menu.d.ts.map +1 -1
  85. package/lib/components/Menu/Menu.js +2 -0
  86. package/lib/components/Menu/Menu.js.map +1 -1
  87. package/lib/components/Menu/MenuList.d.ts.map +1 -1
  88. package/lib/components/Menu/MenuList.js +4 -3
  89. package/lib/components/Menu/MenuList.js.map +1 -1
  90. package/lib/components/Modal/Modal.d.ts.map +1 -1
  91. package/lib/components/Modal/Modal.js +6 -8
  92. package/lib/components/Modal/Modal.js.map +1 -1
  93. package/lib/components/Modal/Modal.types.d.ts +1 -0
  94. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  95. package/lib/components/Modal/Modal.types.js.map +1 -1
  96. package/lib/components/Number/NumberInput.types.d.ts +3 -1
  97. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  98. package/lib/components/Number/NumberInput.types.js.map +1 -1
  99. package/lib/components/Number/NumberRangeInput.d.ts.map +1 -1
  100. package/lib/components/Number/NumberRangeInput.js +71 -4
  101. package/lib/components/Number/NumberRangeInput.js.map +1 -1
  102. package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
  103. package/lib/components/PageTemplates/CategorySubPage.js +14 -3
  104. package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
  105. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  106. package/lib/components/PageTemplates/CategorySubPage.styles.js +5 -0
  107. package/lib/components/PageTemplates/CategorySubPage.styles.js.map +1 -1
  108. package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
  109. package/lib/components/PageTemplates/DashboardPage.js +16 -2
  110. package/lib/components/PageTemplates/DashboardPage.js.map +1 -1
  111. package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
  112. package/lib/components/PageTemplates/PageTemplates.js +20 -3
  113. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  114. package/lib/components/Popover/Popover.d.ts.map +1 -1
  115. package/lib/components/Popover/Popover.js +2 -5
  116. package/lib/components/Popover/Popover.js.map +1 -1
  117. package/lib/components/Popover/Popover.styles.d.ts +0 -1
  118. package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
  119. package/lib/components/Popover/Popover.styles.js +0 -6
  120. package/lib/components/Popover/Popover.styles.js.map +1 -1
  121. package/lib/components/Popover/modifiers.d.ts +0 -2
  122. package/lib/components/Popover/modifiers.d.ts.map +1 -1
  123. package/lib/components/Popover/modifiers.js +1 -32
  124. package/lib/components/Popover/modifiers.js.map +1 -1
  125. package/lib/components/Progress/Progress.d.ts.map +1 -1
  126. package/lib/components/Progress/Progress.js +92 -50
  127. package/lib/components/Progress/Progress.js.map +1 -1
  128. package/lib/components/Progress/Progress.styles.d.ts.map +1 -1
  129. package/lib/components/Progress/Progress.styles.js +0 -1
  130. package/lib/components/Progress/Progress.styles.js.map +1 -1
  131. package/lib/components/Progress/Progress.types.d.ts +18 -6
  132. package/lib/components/Progress/Progress.types.d.ts.map +1 -1
  133. package/lib/components/Progress/Progress.types.js.map +1 -1
  134. package/lib/components/Progress/index.d.ts +1 -1
  135. package/lib/components/Progress/index.d.ts.map +1 -1
  136. package/lib/components/Progress/index.js.map +1 -1
  137. package/lib/components/QRCode/QRCode.d.ts +14 -0
  138. package/lib/components/QRCode/QRCode.d.ts.map +1 -0
  139. package/lib/components/QRCode/QRCode.js +39 -0
  140. package/lib/components/QRCode/QRCode.js.map +1 -0
  141. package/lib/components/QRCode/index.d.ts +3 -0
  142. package/lib/components/QRCode/index.d.ts.map +1 -0
  143. package/lib/components/QRCode/index.js +2 -0
  144. package/lib/components/QRCode/index.js.map +1 -0
  145. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  146. package/lib/components/SearchInput/SearchInput.js +27 -7
  147. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  148. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  149. package/lib/components/Tabs/Tabs.js +6 -0
  150. package/lib/components/Tabs/Tabs.js.map +1 -1
  151. package/lib/components/Toaster/Context.d.ts +1 -0
  152. package/lib/components/Toaster/Context.d.ts.map +1 -1
  153. package/lib/components/Toaster/Context.js.map +1 -1
  154. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  155. package/lib/components/Toaster/Toaster.js +5 -1
  156. package/lib/components/Toaster/Toaster.js.map +1 -1
  157. package/lib/components/Tree/StandardTree.d.ts.map +1 -1
  158. package/lib/components/Tree/StandardTree.js +70 -27
  159. package/lib/components/Tree/StandardTree.js.map +1 -1
  160. package/lib/components/Tree/StandardTree.styles.d.ts +1 -0
  161. package/lib/components/Tree/StandardTree.styles.d.ts.map +1 -1
  162. package/lib/components/Tree/StandardTree.styles.js +32 -18
  163. package/lib/components/Tree/StandardTree.styles.js.map +1 -1
  164. package/lib/components/Tree/StandardTree.types.d.ts +27 -0
  165. package/lib/components/Tree/StandardTree.types.d.ts.map +1 -1
  166. package/lib/components/Tree/StandardTree.types.js.map +1 -1
  167. package/lib/components/Tree/helpers.d.ts +11 -9
  168. package/lib/components/Tree/helpers.d.ts.map +1 -1
  169. package/lib/components/Tree/helpers.js +25 -5
  170. package/lib/components/Tree/helpers.js.map +1 -1
  171. package/lib/components/Tree/index.d.ts +1 -1
  172. package/lib/components/Tree/index.d.ts.map +1 -1
  173. package/lib/components/Tree/index.js.map +1 -1
  174. package/lib/components/URL/URLDisplay.d.ts +2 -2
  175. package/lib/components/URL/URLDisplay.d.ts.map +1 -1
  176. package/lib/components/URL/URLDisplay.js +8 -1
  177. package/lib/components/URL/URLDisplay.js.map +1 -1
  178. package/lib/hooks/index.d.ts +1 -0
  179. package/lib/hooks/index.d.ts.map +1 -1
  180. package/lib/hooks/index.js +1 -0
  181. package/lib/hooks/index.js.map +1 -1
  182. package/lib/hooks/useArrows.d.ts.map +1 -1
  183. package/lib/hooks/useArrows.js +3 -3
  184. package/lib/hooks/useArrows.js.map +1 -1
  185. package/lib/hooks/useBreakpoint.d.ts.map +1 -1
  186. package/lib/hooks/useBreakpoint.js +3 -2
  187. package/lib/hooks/useBreakpoint.js.map +1 -1
  188. package/lib/hooks/useI18n.d.ts +43 -0
  189. package/lib/hooks/useI18n.d.ts.map +1 -1
  190. package/lib/hooks/useLiveLog.d.ts +8 -0
  191. package/lib/hooks/useLiveLog.d.ts.map +1 -0
  192. package/lib/hooks/useLiveLog.js +16 -0
  193. package/lib/hooks/useLiveLog.js.map +1 -0
  194. package/lib/i18n/default.d.ts +43 -0
  195. package/lib/i18n/default.d.ts.map +1 -1
  196. package/lib/i18n/default.js +50 -6
  197. package/lib/i18n/default.js.map +1 -1
  198. package/lib/i18n/i18n.d.ts +43 -0
  199. package/lib/i18n/i18n.d.ts.map +1 -1
  200. package/lib/index.d.ts +4 -0
  201. package/lib/index.d.ts.map +1 -1
  202. package/lib/index.js +4 -0
  203. package/lib/index.js.map +1 -1
  204. package/lib/register-contexts.js +2 -0
  205. package/lib/register-contexts.js.map +1 -1
  206. package/lib/theme/theme.d.ts +12 -0
  207. package/lib/theme/theme.d.ts.map +1 -1
  208. package/lib/theme/themeDefinition.json +8 -0
  209. package/lib/theme/themes/darkTheme.json +3 -1
  210. package/lib/types/types.d.ts +3 -0
  211. package/lib/types/types.d.ts.map +1 -1
  212. package/lib/types/types.js.map +1 -1
  213. package/package.json +3 -1
  214. package/lib/components/ListToolbar/QueryOptionPopover.d.ts +0 -12
  215. package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +0 -1
  216. package/lib/components/ListToolbar/QueryOptionPopover.js +0 -36
  217. package/lib/components/ListToolbar/QueryOptionPopover.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TimeRangeInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/Input/TimeRangeInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA0B,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,IAAI,MAAM,YAAY,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAO7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAqC5C,MAAM,0BAA0B,GAAG,CAAC,CAAU,EAA6B,EAAE;IAC3E,OAAO;QACL,gBAAgB,EAAE,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,I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AAC,gBAAgB;gCAC/B,CAAC,CAAC,SAAS,CAAC;4BACd,QAAQ,CAAC;gCACP,KAAK,EAAE,0BAA0B,CAAC,YAAY,CAAC,OAAO,CAAC;gCACvD,GAAG,EAAE,YAAY;6BAClB,CAAC,CAAC;wBACL,CAAC,EACD,KAAK,EAAE,OAAO,gBACF,GAAG,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EACtE,cAAc,EAAE,gBAAgB,GAChC,IACD,CACJ,GACI,GACG,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AACF,eAAe,cAAc,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, Ref, useCallback, useRef } from 'react';\n\nimport Flex from '../../Flex';\nimport { FormControlProps } from '../../FormControl';\nimport { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport DateTimeProps, {\n DateRangeCallbackParameter,\n DateTimeCallbackParameter,\n DateTimeProperties\n} from '../DateTime.types';\nimport { ForwardProps } from '../../../types';\nimport { StyledRangeInputContainer } from '../../Input/Input.styles';\nimport { MinuteInterval } from '../Picker/TimePicker';\nimport FormField from '../../FormField';\n\nimport { ClockFormat, parseToDate } from './utils';\nimport TimeInput from './TimeInput';\nimport DateTimeInput from './DateTimeInput';\n\nexport interface TimeRangeInputProps extends DateTimeProperties {\n /** Object of range boundaries. */\n value?: { start?: DateTimeProps['value']; end?: DateTimeProps['value'] };\n /** Callback fired when inputs value changes. */\n onChange: (value: DateRangeCallbackParameter) => void;\n /** Callback fired when the component gets focused. */\n onFocus?: (value: DateRangeCallbackParameter) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: DateRangeCallbackParameter) => void;\n /** Pass a string or a fragment with an Icon and string for first part of TimeRangeInput. */\n fromLabel?: FormControlProps['label'];\n /** Pass a string or a fragment with an Icon and string for second part of TimeRangeInput. */\n toLabel?: FormControlProps['label'];\n /** Pass an object with \"heading\" and \"content\" properties to show AdditionalInfo for second part of DataRangeInput. */\n toAdditionalInfo?: FormControlProps['additionalInfo'];\n /** Pass an object with \"heading\" and \"content\" properties to show AdditionalInfo for first part of DataRangeInput. */\n fromAdditionalInfo?: FormControlProps['additionalInfo'];\n /** Controls which input is displayed */\n mode: 'time' | 'datetime';\n /**\n * Display the time with seconds.\n * @default false\n */\n withSeconds?: boolean;\n /**\n * Defines interval for time picker options (in minutes).\n * @default 30\n */\n pickerInterval?: MinuteInterval;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n}\n\nconst convertToCallbackParameter = (v?: number): DateTimeCallbackParameter => {\n return {\n valueAsISOString: v === undefined || Number.isNaN(v) ? '' : new Date(v).toISOString(),\n valueAsTimestamp: v\n };\n};\n\nconst TimeRangeInput: FunctionComponent<TimeRangeInputProps & ForwardProps> = forwardRef(\n (\n {\n value = {},\n onChange,\n onFocus,\n onBlur,\n label,\n fromLabel,\n toLabel,\n labelHidden,\n required,\n readOnly,\n disabled,\n min,\n max,\n withSeconds,\n pickerInterval,\n clockFormat,\n mode,\n status,\n fromAdditionalInfo,\n toAdditionalInfo,\n autoFocus,\n ...restProps\n }: TimeRangeInputProps,\n ref: Ref<HTMLDivElement>\n ) => {\n const t = useI18n();\n\n const startDateRef = useRef(value.start ? parseToDate(value.start).getTime() : undefined);\n const endDateRef = useRef(value.end ? parseToDate(value.end).getTime() : undefined);\n\n const onFocusChange = useCallback(\n (focused: boolean) => {\n (focused ? onFocus : onBlur)?.({\n start: convertToCallbackParameter(startDateRef.current),\n end: convertToCallbackParameter(endDateRef.current)\n });\n },\n [onFocus, onBlur]\n );\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const commonProps = {\n required,\n readOnly,\n disabled,\n min,\n max,\n status,\n withSeconds,\n pickerInterval,\n clockFormat\n };\n\n return (\n <FormField\n as='fieldset'\n {...restProps}\n container={{ wrap: 'nowrap' }}\n ref={containerRef}\n labelAs='legend'\n label={label}\n labelHidden={labelHidden}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n status={status}\n >\n <Flex container as={StyledRangeInputContainer}>\n {mode === 'time' ? (\n <>\n <TimeInput\n {...commonProps}\n value={value.start}\n onBlur={changedValue => {\n startDateRef.current = !changedValue.state\n ? changedValue.valueAsTimestamp\n : undefined;\n onChange({\n start: changedValue,\n end: convertToCallbackParameter(endDateRef.current)\n });\n }}\n label={fromLabel}\n aria-label={`${t('range_from_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={fromAdditionalInfo}\n autoFocus={autoFocus}\n />\n <TimeInput\n {...commonProps}\n value={value.end}\n onBlur={changedValue => {\n endDateRef.current = !changedValue.state\n ? changedValue.valueAsTimestamp\n : undefined;\n onChange({\n start: convertToCallbackParameter(startDateRef.current),\n end: changedValue\n });\n }}\n label={toLabel}\n aria-label={`${t('range_to_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={toAdditionalInfo}\n />\n </>\n ) : (\n <>\n <DateTimeInput\n {...commonProps}\n value={value.start}\n onBlur={changedValue => {\n startDateRef.current = !changedValue.state\n ? changedValue.valueAsTimestamp\n : undefined;\n onChange({\n start: changedValue,\n end: convertToCallbackParameter(endDateRef.current)\n });\n }}\n label={fromLabel}\n aria-label={`${t('range_from_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={fromAdditionalInfo}\n />\n <DateTimeInput\n {...commonProps}\n value={value.end}\n onBlur={changedValue => {\n endDateRef.current = !changedValue.state\n ? changedValue.valueAsTimestamp\n : undefined;\n onChange({\n start: convertToCallbackParameter(startDateRef.current),\n end: changedValue\n });\n }}\n label={toLabel}\n aria-label={`${t('range_to_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={toAdditionalInfo}\n />\n </>\n )}\n </Flex>\n </FormField>\n );\n }\n);\nexport default TimeRangeInput;\n"]}
1
+ {"version":3,"file":"TimeRangeInput.js","sourceRoot":"","sources":["../../../../src/components/DateTime/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E,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,gBAAgB;6BACtE,CAAC,CAAC;4BAEH,UAAU,CAAC,OAAO,GAAG,YAAY,CAAC;4BAClC,QAAQ,CAAC;gCACP,KAAK,EAAE,0BAA0B,CAAC,KAAK,CAAC,KAAK,CAAC;gCAC9C,GAAG,EAAE,YAAY;6BAClB,CAAC,CAAC;wBACL,CAAC,EACD,KAAK,EAAE,OAAO,gBACF,GAAG,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EACtE,cAAc,EAAE,gBAAgB,EAChC,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,kBAAkB,GAC1B,IACD,CACJ,GACI,GACG,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AACF,eAAe,cAAc,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n Ref,\n useCallback,\n useImperativeHandle,\n useReducer,\n useRef\n} from 'react';\n\nimport Flex from '../../Flex';\nimport { FormControlProps, HandleValue } from '../../FormControl';\nimport { useConsolidatedRef, useFocusWithin, useI18n } from '../../../hooks';\nimport DateTimeProps, {\n DateRangeCallbackParameter,\n DateTimeCallbackParameter,\n DateTimeProperties\n} from '../DateTime.types';\nimport { ForwardProps } from '../../../types';\nimport { StyledRangeInputContainer } from '../../Input/Input.styles';\nimport { MinuteInterval } from '../Picker/TimePicker';\nimport FormField from '../../FormField';\n\nimport { ClockFormat, parseToDate } from './utils';\nimport TimeInput from './TimeInput';\nimport DateTimeInput from './DateTimeInput';\n\nexport interface TimeRangeInputProps extends DateTimeProperties {\n /** Object of range boundaries. */\n value?: { start?: DateTimeProps['value']; end?: DateTimeProps['value'] };\n /** Callback fired when inputs value changes. */\n onChange: (value: DateRangeCallbackParameter) => void;\n /** Callback fired when the component gets focused. */\n onFocus?: (value: DateRangeCallbackParameter) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: DateRangeCallbackParameter) => void;\n /** Pass a string or a fragment with an Icon and string for first part of TimeRangeInput. */\n fromLabel?: FormControlProps['label'];\n /** Pass a string or a fragment with an Icon and string for second part of TimeRangeInput. */\n toLabel?: FormControlProps['label'];\n /** Pass an object with \"heading\" and \"content\" properties to show AdditionalInfo for second part of DataRangeInput. */\n toAdditionalInfo?: FormControlProps['additionalInfo'];\n /** Pass an object with \"heading\" and \"content\" properties to show AdditionalInfo for first part of DataRangeInput. */\n fromAdditionalInfo?: FormControlProps['additionalInfo'];\n /** Controls which input is displayed */\n mode: 'time' | 'datetime';\n /**\n * Display the time with seconds.\n * @default false\n */\n withSeconds?: boolean;\n /**\n * Defines interval for time picker options (in minutes).\n * @default 30\n */\n pickerInterval?: MinuteInterval;\n /**\n * Defines clock format that overrides locale based format\n */\n clockFormat?: ClockFormat;\n /** Imperative handle */\n handle?: Ref<HandleValue>;\n}\n\ntype DateRangeAction = { type: 'start' | 'end'; value?: number };\ntype State = { start?: number; end?: number };\n\nconst reducer = (prevState: State, { type, value }: DateRangeAction): State => {\n switch (type) {\n case 'start': {\n return { ...prevState, start: value };\n }\n case 'end': {\n return { ...prevState, end: value };\n }\n default:\n return prevState;\n }\n};\n\nconst convertToCallbackParameter = (v?: number): DateTimeCallbackParameter => {\n return {\n valueAsISOString: v === undefined || Number.isNaN(v) ? '' : new Date(v).toISOString(),\n valueAsTimestamp: v\n };\n};\n\nconst TimeRangeInput: FunctionComponent<TimeRangeInputProps & ForwardProps> = forwardRef(\n (\n {\n value = {},\n onChange,\n onFocus,\n onBlur,\n label,\n fromLabel,\n toLabel,\n labelHidden,\n required,\n readOnly,\n disabled,\n min,\n max,\n withSeconds,\n pickerInterval,\n clockFormat,\n mode,\n status,\n fromAdditionalInfo,\n toAdditionalInfo,\n autoFocus,\n handle,\n ...restProps\n }: TimeRangeInputProps,\n ref: Ref<HTMLDivElement>\n ) => {\n const t = useI18n();\n\n const startTimeInputRef = useRef<HTMLFieldSetElement>(null);\n const endTimeInputRef = useRef<HTMLFieldSetElement>(null);\n\n const startTimeClearHandle = useRef<HandleValue>(null);\n const endTimeClearHandle = useRef<HandleValue>(null);\n\n const [state, dispatch] = useReducer(reducer, {\n start: value.start ? parseToDate(value.start).getTime() : undefined,\n end: value.end ? parseToDate(value.end).getTime() : undefined\n });\n\n const startTimeRef = useRef<DateTimeCallbackParameter>(convertToCallbackParameter(state.start));\n const endTimeRef = useRef<DateTimeCallbackParameter>(convertToCallbackParameter(state.end));\n\n useImperativeHandle(\n handle,\n () => ({\n clear: () => {\n startTimeClearHandle.current?.clear();\n endTimeClearHandle.current?.clear();\n const emptyCallbackParameter = convertToCallbackParameter(undefined);\n startTimeRef.current = emptyCallbackParameter;\n endTimeRef.current = emptyCallbackParameter;\n dispatch({ type: 'start', value: undefined });\n dispatch({ type: 'end', value: undefined });\n onChange({\n start: emptyCallbackParameter,\n end: emptyCallbackParameter\n });\n }\n }),\n [onChange]\n );\n\n const onFocusChange = useCallback(\n (focused: boolean) => {\n (focused ? onFocus : onBlur)?.({\n start: startTimeRef.current,\n end: endTimeRef.current\n });\n },\n [onFocus, onBlur]\n );\n\n const containerRef = useConsolidatedRef(ref);\n useFocusWithin([containerRef], onFocusChange);\n\n const commonProps = {\n required,\n readOnly,\n disabled,\n min,\n max,\n status,\n withSeconds,\n pickerInterval,\n clockFormat\n };\n\n return (\n <FormField\n as='fieldset'\n {...restProps}\n container={{ wrap: 'nowrap' }}\n ref={containerRef}\n labelAs='legend'\n label={label}\n labelHidden={labelHidden}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n status={status}\n >\n <Flex container as={StyledRangeInputContainer}>\n {mode === 'time' ? (\n <>\n <TimeInput\n {...commonProps}\n value={state.start}\n onBlur={changedValue => {\n dispatch({\n type: 'start',\n value: changedValue.state ? undefined : changedValue.valueAsTimestamp\n });\n\n startTimeRef.current = changedValue;\n onChange({\n start: changedValue,\n end: convertToCallbackParameter(state.end)\n });\n }}\n label={fromLabel}\n aria-label={`${t('range_from_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={fromAdditionalInfo}\n autoFocus={autoFocus}\n ref={startTimeInputRef}\n handle={startTimeClearHandle}\n />\n <TimeInput\n {...commonProps}\n value={state.end}\n onBlur={changedValue => {\n dispatch({\n type: 'end',\n value: changedValue.state ? undefined : changedValue.valueAsTimestamp\n });\n\n endTimeRef.current = changedValue;\n onChange({\n start: convertToCallbackParameter(state.start),\n end: changedValue\n });\n }}\n label={toLabel}\n aria-label={`${t('range_to_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={toAdditionalInfo}\n ref={endTimeInputRef}\n handle={endTimeClearHandle}\n />\n </>\n ) : (\n <>\n <DateTimeInput\n {...commonProps}\n value={state.start}\n onBlur={changedValue => {\n dispatch({\n type: 'start',\n value: changedValue.state ? undefined : changedValue.valueAsTimestamp\n });\n\n startTimeRef.current = changedValue;\n onChange({\n start: changedValue,\n end: convertToCallbackParameter(state.end)\n });\n }}\n label={fromLabel}\n aria-label={`${t('range_from_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={fromAdditionalInfo}\n ref={startTimeInputRef}\n handle={startTimeClearHandle}\n />\n <DateTimeInput\n {...commonProps}\n value={state.end}\n onBlur={changedValue => {\n dispatch({\n type: 'end',\n value: changedValue.state ? undefined : changedValue.valueAsTimestamp\n });\n\n endTimeRef.current = changedValue;\n onChange({\n start: convertToCallbackParameter(state.start),\n end: changedValue\n });\n }}\n label={toLabel}\n aria-label={`${t('range_to_datetime') + (label ? ` - ${label}` : '')}`}\n additionalInfo={toAdditionalInfo}\n ref={endTimeInputRef}\n handle={endTimeClearHandle}\n />\n </>\n )}\n </Flex>\n </FormField>\n );\n }\n);\nexport default TimeRangeInput;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FormDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,EAAE,EAAa,cAAc,EAAE,MAAM,OAAO,CAAC;AAkB3F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,eAAO,MAAM,gBAAgB,6KAAmB,CAAC;AAEjD,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,GAAG,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAiH1F,CAAC;AAEJ,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"FormDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,EAAE,EAAa,cAAc,EAAE,MAAM,OAAO,CAAC;AAiB3F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,eAAO,MAAM,gBAAgB,6KAAmB,CAAC;AAEjD,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,GAAG,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CA6G1F,CAAC;AAEJ,eAAe,UAAU,CAAC"}
@@ -16,7 +16,6 @@ const FormDialog = forwardRef(({ target, heading, headingHidden = false, childre
16
16
  const headingId = useUID();
17
17
  const dialogRef = useConsolidatedRef(ref);
18
18
  const cancelButtonRef = useRef(null);
19
- const progressHandle = useRef(null);
20
19
  const onCancelHandler = typeof onCancel === 'function' ? onCancel : onCancel.handler;
21
20
  useEscape(() => {
22
21
  if (onDismiss) {
@@ -36,10 +35,7 @@ const FormDialog = forwardRef(({ target, heading, headingHidden = false, childre
36
35
  });
37
36
  useFocusTrap(dialogRef);
38
37
  useEffect(() => {
39
- if (progress) {
40
- progressHandle.current?.focus();
41
- }
42
- else {
38
+ if (!progress) {
43
39
  const focusables = getFocusables(dialogRef);
44
40
  if (focusables[0])
45
41
  focusables[0].focus();
@@ -52,7 +48,7 @@ const FormDialog = forwardRef(({ target, heading, headingHidden = false, childre
52
48
  }
53
49
  };
54
50
  }, []);
55
- return (_jsxs(StyledFormDialog, { ...restProps, target: target, labelledbyId: headingId, progress: progress, ref: dialogRef, children: [_jsx(CardHeader, { forwardedAs: 'div', children: headingHidden ? (_jsx(VisuallyHiddenText, { forwardedAs: 'h2', id: headingId, children: heading })) : (_jsx(Text, { id: headingId, variant: 'h2', children: heading })) }), _jsxs(CardContent, { children: [children && _jsx(StyledChildrenWrap, { children: children }), progress && (_jsx(Progress, { placement: children ? 'local' : 'block', message: typeof progress === 'string' ? progress : undefined, handle: progressHandle }))] }), _jsxs(CardFooter, { justify: 'between', forwardedAs: 'div', children: [_jsx(Button, { onClick: () => {
51
+ return (_jsxs(StyledFormDialog, { ...restProps, target: target, labelledbyId: headingId, progress: progress, ref: dialogRef, children: [_jsx(CardHeader, { forwardedAs: 'div', children: headingHidden ? (_jsx(VisuallyHiddenText, { forwardedAs: 'h2', id: headingId, children: heading })) : (_jsx(Text, { id: headingId, variant: 'h2', children: heading })) }), _jsxs(CardContent, { children: [children && _jsx(StyledChildrenWrap, { children: children }), _jsx(Progress, { visible: !!progress, focusOnVisible: true, placement: children ? 'local' : 'block', message: typeof progress === 'string' ? progress : undefined })] }), _jsxs(CardFooter, { justify: 'between', forwardedAs: 'div', children: [_jsx(Button, { onClick: () => {
56
52
  onCancelHandler();
57
53
  }, disabled: typeof onCancel !== 'function' ? onCancel.disabled : undefined, ref: cancelButtonRef, children: typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel') }), _jsx(Button, { variant: 'primary', onClick: () => {
58
54
  (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();
@@ -1 +1 @@
1
- {"version":3,"file":"FormDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,EAAM,SAAS,EAAkB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,CAAC,CACF,CAAC;AAEJ,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, useRef, FC, useEffect, HTMLAttributes } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport { getFocusables } from '../../utils';\nimport Button from '../Button';\nimport Text from '../Text';\nimport { CardContent, CardFooter, CardHeader } from '../Card';\nimport Progress from '../Progress';\nimport { ProgressHandleValue } from '../Progress/Progress.types';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { OmitStrict } from '../../types';\n\nimport { StyledChildrenWrap } from './Dialog.styles';\nimport { FormDialogProps } from './Dialog.types';\nimport Dialog from './Dialog';\n\nexport const StyledFormDialog = styled(Dialog)``;\n\nconst FormDialog: FC<FormDialogProps & OmitStrict<HTMLAttributes<HTMLDivElement>, 'onSubmit'>> =\n forwardRef(\n (\n {\n target,\n heading,\n headingHidden = false,\n children,\n progress,\n onDismiss,\n onCancel,\n onSubmit,\n ...restProps\n }: PropsWithoutRef<FormDialogProps>,\n ref: FormDialogProps['ref']\n ) => {\n const t = useI18n();\n const headingId = useUID();\n const dialogRef = useConsolidatedRef(ref);\n const cancelButtonRef = useRef<HTMLButtonElement>(null);\n const progressHandle = useRef<ProgressHandleValue>(null);\n const onCancelHandler = typeof onCancel === 'function' ? onCancel : onCancel.handler;\n\n useEscape(() => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n });\n\n useOuterEvent('mousedown', [target, dialogRef], () => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n });\n\n useFocusTrap(dialogRef);\n\n useEffect(() => {\n if (progress) {\n progressHandle.current?.focus();\n } else {\n const focusables = getFocusables(dialogRef);\n if (focusables[0]) focusables[0].focus();\n }\n }, [progress]);\n\n useEffect(() => {\n return () => {\n if (document.contains(target)) {\n target.focus();\n }\n };\n }, []);\n\n return (\n <StyledFormDialog\n {...restProps}\n target={target}\n labelledbyId={headingId}\n progress={progress}\n ref={dialogRef}\n >\n <CardHeader forwardedAs='div'>\n {headingHidden ? (\n <VisuallyHiddenText forwardedAs='h2' id={headingId}>\n {heading}\n </VisuallyHiddenText>\n ) : (\n <Text id={headingId} variant='h2'>\n {heading}\n </Text>\n )}\n </CardHeader>\n\n <CardContent>\n {children && <StyledChildrenWrap>{children}</StyledChildrenWrap>}\n {progress && (\n <Progress\n placement={children ? 'local' : 'block'}\n message={typeof progress === 'string' ? progress : undefined}\n handle={progressHandle}\n />\n )}\n </CardContent>\n\n <CardFooter justify='between' forwardedAs='div'>\n <Button\n onClick={() => {\n onCancelHandler();\n }}\n disabled={typeof onCancel !== 'function' ? onCancel.disabled : undefined}\n ref={cancelButtonRef}\n >\n {typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel')}\n </Button>\n\n <Button\n variant='primary'\n onClick={() => {\n (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();\n }}\n disabled={typeof onSubmit !== 'function' ? onSubmit.disabled : undefined}\n >\n {typeof onSubmit !== 'function' && onSubmit.text ? onSubmit.text : t('submit')}\n </Button>\n </CardFooter>\n </StyledFormDialog>\n );\n }\n );\n\nexport default FormDialog;\n"]}
1
+ {"version":3,"file":"FormDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/FormDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,EAAM,SAAS,EAAkB,MAAM,OAAO,CAAC;AAC3F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAa,EACb,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,W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AAO,EAAE,GAAG,EAAE;4BACZ,eAAe,EAAE,CAAC;wBACpB,CAAC,EACD,QAAQ,EAAE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACxE,GAAG,EAAE,eAAe,YAEnB,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GACvE,EAET,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE;4BACZ,CAAC,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACnE,CAAC,EACD,QAAQ,EAAE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,YAEvE,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GACvE,IACE,IACI,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, useRef, FC, useEffect, HTMLAttributes } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport { getFocusables } from '../../utils';\nimport Button from '../Button';\nimport Text from '../Text';\nimport { CardContent, CardFooter, CardHeader } from '../Card';\nimport Progress from '../Progress';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { OmitStrict } from '../../types';\n\nimport { StyledChildrenWrap } from './Dialog.styles';\nimport { FormDialogProps } from './Dialog.types';\nimport Dialog from './Dialog';\n\nexport const StyledFormDialog = styled(Dialog)``;\n\nconst FormDialog: FC<FormDialogProps & OmitStrict<HTMLAttributes<HTMLDivElement>, 'onSubmit'>> =\n forwardRef(\n (\n {\n target,\n heading,\n headingHidden = false,\n children,\n progress,\n onDismiss,\n onCancel,\n onSubmit,\n ...restProps\n }: PropsWithoutRef<FormDialogProps>,\n ref: FormDialogProps['ref']\n ) => {\n const t = useI18n();\n const headingId = useUID();\n const dialogRef = useConsolidatedRef(ref);\n const cancelButtonRef = useRef<HTMLButtonElement>(null);\n const onCancelHandler = typeof onCancel === 'function' ? onCancel : onCancel.handler;\n\n useEscape(() => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n });\n\n useOuterEvent('mousedown', [target, dialogRef], () => {\n if (onDismiss) {\n onDismiss();\n } else {\n onCancelHandler();\n }\n });\n\n useFocusTrap(dialogRef);\n\n useEffect(() => {\n if (!progress) {\n const focusables = getFocusables(dialogRef);\n if (focusables[0]) focusables[0].focus();\n }\n }, [progress]);\n\n useEffect(() => {\n return () => {\n if (document.contains(target)) {\n target.focus();\n }\n };\n }, []);\n\n return (\n <StyledFormDialog\n {...restProps}\n target={target}\n labelledbyId={headingId}\n progress={progress}\n ref={dialogRef}\n >\n <CardHeader forwardedAs='div'>\n {headingHidden ? (\n <VisuallyHiddenText forwardedAs='h2' id={headingId}>\n {heading}\n </VisuallyHiddenText>\n ) : (\n <Text id={headingId} variant='h2'>\n {heading}\n </Text>\n )}\n </CardHeader>\n\n <CardContent>\n {children && <StyledChildrenWrap>{children}</StyledChildrenWrap>}\n <Progress\n visible={!!progress}\n focusOnVisible\n placement={children ? 'local' : 'block'}\n message={typeof progress === 'string' ? progress : undefined}\n />\n </CardContent>\n\n <CardFooter justify='between' forwardedAs='div'>\n <Button\n onClick={() => {\n onCancelHandler();\n }}\n disabled={typeof onCancel !== 'function' ? onCancel.disabled : undefined}\n ref={cancelButtonRef}\n >\n {typeof onCancel !== 'function' && onCancel.text ? onCancel.text : t('cancel')}\n </Button>\n\n <Button\n variant='primary'\n onClick={() => {\n (typeof onSubmit !== 'function' ? onSubmit.handler : onSubmit)();\n }}\n disabled={typeof onSubmit !== 'function' ? onSubmit.disabled : undefined}\n >\n {typeof onSubmit !== 'function' && onSubmit.text ? onSubmit.text : t('submit')}\n </Button>\n </CardFooter>\n </StyledFormDialog>\n );\n }\n );\n\nexport default FormDialog;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"InfoDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,EAAE,EAAa,cAAc,EAAE,MAAM,OAAO,CAAC;AAoB3F,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,gBAAgB,6KAAmB,CAAC;AAEjD,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,GAAG,cAAc,CAAC,cAAc,CAAC,CA6FpE,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"InfoDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,EAAE,EAAa,cAAc,EAAE,MAAM,OAAO,CAAC;AAoB3F,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,gBAAgB,6KAAmB,CAAC;AAEjD,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,GAAG,cAAc,CAAC,cAAc,CAAC,CAyFpE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -16,7 +16,6 @@ const InfoDialog = forwardRef(({ target, heading, headingHidden = false, childre
16
16
  const headingId = useUID();
17
17
  const dialogRef = useConsolidatedRef(ref);
18
18
  const closeButtonRef = useRef(null);
19
- const progressHandle = useRef(null);
20
19
  useEscape(() => {
21
20
  onDismiss?.();
22
21
  });
@@ -25,10 +24,7 @@ const InfoDialog = forwardRef(({ target, heading, headingHidden = false, childre
25
24
  });
26
25
  useFocusTrap(dialogRef);
27
26
  useEffect(() => {
28
- if (progress) {
29
- progressHandle.current?.focus();
30
- }
31
- else {
27
+ if (!progress) {
32
28
  closeButtonRef.current?.focus();
33
29
  }
34
30
  }, [progress]);
@@ -41,7 +37,7 @@ const InfoDialog = forwardRef(({ target, heading, headingHidden = false, childre
41
37
  }, []);
42
38
  return (_jsxs(StyledInfoDialog, { ...restProps, target: target, labelledbyId: headingId, progress: progress, ref: dialogRef, children: [_jsx(CardHeader, { forwardedAs: 'div', actions: _jsx(Button, { icon: true, variant: 'simple', onClick: () => {
43
39
  onDismiss();
44
- }, label: t('close'), ref: closeButtonRef, children: _jsx(Icon, { name: 'times' }) }), children: headingHidden ? (_jsx(VisuallyHiddenText, { forwardedAs: 'h2', id: headingId, children: heading })) : (_jsx(Text, { id: headingId, variant: 'h2', children: heading })) }), _jsxs(CardContent, { children: [children && _jsx(StyledChildrenWrap, { children: children }), progress && (_jsx(Progress, { placement: children ? 'local' : 'block', message: typeof progress === 'string' ? progress : undefined, handle: progressHandle }))] })] }));
40
+ }, label: t('close'), ref: closeButtonRef, children: _jsx(Icon, { name: 'times' }) }), children: headingHidden ? (_jsx(VisuallyHiddenText, { forwardedAs: 'h2', id: headingId, children: heading })) : (_jsx(Text, { id: headingId, variant: 'h2', children: heading })) }), _jsxs(CardContent, { children: [children && _jsx(StyledChildrenWrap, { children: children }), _jsx(Progress, { visible: !!progress, focusOnVisible: true, placement: children ? 'local' : 'block', message: typeof progress === 'string' ? progress : undefined })] })] }));
45
41
  });
46
42
  export default InfoDialog;
47
43
  //# sourceMappingURL=InfoDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InfoDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,EAAM,SAAS,EAAkB,MAAM,OAAO,CAAC;AAC3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AC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACvC,OAAO,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAC5D,MAAM,EAAE,cAAc,GACtB,CACH,IACW,IACG,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, useRef, FC, useEffect, HTMLAttributes } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport Button from '../Button';\nimport Text from '../Text';\nimport { CardContent, CardHeader } from '../Card';\nimport Icon from '../Icon';\nimport Progress, { ProgressHandleValue } from '../Progress';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport Dialog from './Dialog';\nimport { StyledChildrenWrap } from './Dialog.styles';\nimport { InfoDialogProps } from './Dialog.types';\n\nexport const StyledInfoDialog = styled(Dialog)``;\n\nconst InfoDialog: FC<InfoDialogProps & HTMLAttributes<HTMLDivElement>> = forwardRef(\n (\n {\n target,\n heading,\n headingHidden = false,\n children,\n progress,\n onDismiss,\n ...restProps\n }: PropsWithoutRef<InfoDialogProps>,\n ref: InfoDialogProps['ref']\n ) => {\n const t = useI18n();\n const headingId = useUID();\n const dialogRef = useConsolidatedRef(ref);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n const progressHandle = useRef<ProgressHandleValue>(null);\n\n useEscape(() => {\n onDismiss?.();\n });\n\n useOuterEvent('mousedown', [target, dialogRef], () => {\n onDismiss?.();\n });\n\n useFocusTrap(dialogRef);\n\n useEffect(() => {\n if (progress) {\n progressHandle.current?.focus();\n } else {\n closeButtonRef.current?.focus();\n }\n }, [progress]);\n\n useEffect(() => {\n return () => {\n if (document.contains(target)) {\n target.focus();\n }\n };\n }, []);\n\n return (\n <StyledInfoDialog\n {...restProps}\n target={target}\n labelledbyId={headingId}\n progress={progress}\n ref={dialogRef}\n >\n <CardHeader\n forwardedAs='div'\n actions={\n <Button\n icon\n variant='simple'\n onClick={() => {\n onDismiss();\n }}\n label={t('close')}\n ref={closeButtonRef}\n >\n <Icon name='times' />\n </Button>\n }\n >\n {headingHidden ? (\n <VisuallyHiddenText forwardedAs='h2' id={headingId}>\n {heading}\n </VisuallyHiddenText>\n ) : (\n <Text id={headingId} variant='h2'>\n {heading}\n </Text>\n )}\n </CardHeader>\n\n <CardContent>\n {children && <StyledChildrenWrap>{children}</StyledChildrenWrap>}\n {progress && (\n <Progress\n placement={children ? 'local' : 'block'}\n message={typeof progress === 'string' ? progress : undefined}\n handle={progressHandle}\n />\n )}\n </CardContent>\n </StyledInfoDialog>\n );\n }\n);\n\nexport default InfoDialog;\n"]}
1
+ {"version":3,"file":"InfoDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/InfoDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,EAAM,SAAS,EAAkB,MAAM,OAAO,CAAC;AAC3F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAa,EACb,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAEvD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA,EAAE,CAAC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Q,EAChB,OAAO,EAAE,GAAG,EAAE;wBACZ,SAAS,EAAE,CAAC;oBACd,CAAC,EACD,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,EACjB,GAAG,EAAE,cAAc,YAEnB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,YAGV,aAAa,CAAC,CAAC,CAAC,CACf,KAAC,kBAAkB,IAAC,WAAW,EAAC,IAAI,EAAC,EAAE,EAAE,SAAS,YAC/C,OAAO,GACW,CACtB,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAC,IAAI,YAC9B,OAAO,GACH,CACR,GACU,EAEb,MAAC,WAAW,eACT,QAAQ,IAAI,KAAC,kBAAkB,cAAE,QAAQ,GAAsB,EAChE,KAAC,QAAQ,IACP,OAAO,EAAE,CAAC,CAAC,QAAQ,EACnB,cAAc,QACd,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACvC,OAAO,EAAE,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAC5D,IACU,IACG,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, useRef, FC, useEffect, HTMLAttributes } from 'react';\nimport styled from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent,\n useUID\n} from '../../hooks';\nimport Button from '../Button';\nimport Text from '../Text';\nimport { CardContent, CardHeader } from '../Card';\nimport Icon from '../Icon';\nimport Progress from '../Progress';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport Dialog from './Dialog';\nimport { StyledChildrenWrap } from './Dialog.styles';\nimport { InfoDialogProps } from './Dialog.types';\n\nexport const StyledInfoDialog = styled(Dialog)``;\n\nconst InfoDialog: FC<InfoDialogProps & HTMLAttributes<HTMLDivElement>> = forwardRef(\n (\n {\n target,\n heading,\n headingHidden = false,\n children,\n progress,\n onDismiss,\n ...restProps\n }: PropsWithoutRef<InfoDialogProps>,\n ref: InfoDialogProps['ref']\n ) => {\n const t = useI18n();\n const headingId = useUID();\n const dialogRef = useConsolidatedRef(ref);\n const closeButtonRef = useRef<HTMLButtonElement>(null);\n\n useEscape(() => {\n onDismiss?.();\n });\n\n useOuterEvent('mousedown', [target, dialogRef], () => {\n onDismiss?.();\n });\n\n useFocusTrap(dialogRef);\n\n useEffect(() => {\n if (!progress) {\n closeButtonRef.current?.focus();\n }\n }, [progress]);\n\n useEffect(() => {\n return () => {\n if (document.contains(target)) {\n target.focus();\n }\n };\n }, []);\n\n return (\n <StyledInfoDialog\n {...restProps}\n target={target}\n labelledbyId={headingId}\n progress={progress}\n ref={dialogRef}\n >\n <CardHeader\n forwardedAs='div'\n actions={\n <Button\n icon\n variant='simple'\n onClick={() => {\n onDismiss();\n }}\n label={t('close')}\n ref={closeButtonRef}\n >\n <Icon name='times' />\n </Button>\n }\n >\n {headingHidden ? (\n <VisuallyHiddenText forwardedAs='h2' id={headingId}>\n {heading}\n </VisuallyHiddenText>\n ) : (\n <Text id={headingId} variant='h2'>\n {heading}\n </Text>\n )}\n </CardHeader>\n\n <CardContent>\n {children && <StyledChildrenWrap>{children}</StyledChildrenWrap>}\n <Progress\n visible={!!progress}\n focusOnVisible\n placement={children ? 'local' : 'block'}\n message={typeof progress === 'string' ? progress : undefined}\n />\n </CardContent>\n </StyledInfoDialog>\n );\n }\n);\n\nexport default InfoDialog;\n"]}
@@ -42,6 +42,10 @@ export interface FormControlProps extends BaseProps {
42
42
  /** Callback fired when AI suggestion is accepted/rejected */
43
43
  onResolveSuggestion?: (accepted: boolean) => void;
44
44
  }
45
+ export interface HandleValue {
46
+ /** Used to clear component inputs with imperative handle */
47
+ clear: () => void;
48
+ }
45
49
  export declare const StyledFormControl: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../types").OmitStrict<FormControlProps, never> & Required<Pick<FormControlProps, never>> & {
46
50
  hasSuggestion?: boolean | undefined;
47
51
  }, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6GAA6G;IAC7G,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,cAAc,CAAC,EAAE;QACf,OAAO,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACxC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;KAC1C,CAAC;IACF;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,mB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AGqB,uBAAuB;wBAC3B,mBAAmB;;;;;yBAKlB,QAAQ,CAAC,CAAC;;KAE9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,UAAU,CAChF,CAAC,KAAwC,EAAE,GAAwB,EAAE,EAAE;IACrE,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC;AACpD,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, rgba } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport { AdditionalInfoProps } from '../AdditionalInfo';\n\nexport interface FormControlProps extends BaseProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: string;\n /** Set visual state based on a validation state. */\n status?: 'success' | 'warning' | 'error' | 'pending';\n /** Pass a string or a fragment with an Icon and string. */\n label?: ReactNode;\n /** Visually hides the label region. */\n labelHidden?: boolean;\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: ReactNode;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: boolean;\n /** Placeholder text. The browser defaults to an empty string. */\n placeholder?: string;\n /** Button when clicked will show additional information on a field */\n additionalInfo?: {\n heading: AdditionalInfoProps['heading'];\n content: AdditionalInfoProps['children'];\n };\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: string;\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: string;\n /** Disable the control. The browser defaults to false. */\n disabled?: boolean;\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: string;\n /** Callback fired when AI suggestion is accepted/rejected */\n onResolveSuggestion?: (accepted: boolean) => void;\n}\n\ntype FormControlPropsWithDefaults = PropsWithDefaults<FormControlProps>;\n\nexport const StyledFormControl = styled.div<\n FormControlPropsWithDefaults & { hasSuggestion?: boolean }\n>(\n ({\n theme: {\n base: {\n 'border-radius': baseRadius,\n 'font-size': baseFontSize,\n 'font-scale': baseFontScale,\n animation: { speed, timing },\n palette\n },\n components: {\n 'form-field': formField,\n 'form-control': {\n 'foreground-color': foreground,\n 'background-color': background,\n 'border-color': brd,\n 'border-radius': radius,\n 'border-width': borderWidth,\n ':hover': { 'border-color': hoverBorderColor },\n ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow },\n ':disabled': {\n 'border-color': disabledBorderColor,\n 'background-color': disabledBackgroundColor\n },\n ':read-only': {\n 'border-color': readOnlyBorderColor,\n 'background-color': readOnlyBackgroundColor\n }\n }\n }\n },\n status,\n hasSuggestion\n }) => {\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n const borderColor = status && formField[status] ? formField[status]['status-color'] : brd;\n const backgroundColor =\n hasSuggestion && status\n ? mix(0.1, formField[status]['status-color'], palette['primary-background'])\n : background;\n\n return css`\n color: ${foreground};\n background-color: ${backgroundColor};\n border-radius: calc(${baseRadius} * ${radius});\n border-color: ${borderColor};\n border-width: ${borderWidth};\n border-style: solid;\n transition-property: color, background-color, border-color;\n transition-duration: ${speed};\n transition-timing-function: ${timing.ease};\n &,\n & > select {\n outline: none;\n }\n\n &:disabled,\n &[disabled] {\n background-color: ${disabledBackgroundColor};\n border-color: ${disabledBorderColor};\n cursor: not-allowed;\n }\n\n &:focus:not([disabled]) {\n border-color: ${focusBorderColor};\n box-shadow: ${shadow};\n ${hasSuggestion &&\n css`\n background-color: ${background};\n `}\n }\n\n &:focus-within:not([disabled]) {\n ${hasSuggestion &&\n css`\n background-color: ${background};\n `}\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n ${!status &&\n css`\n border-color: ${hoverBorderColor};\n `}\n ${hasSuggestion &&\n css`\n background-color: ${background};\n box-shadow: 0 0 0 0.125rem ${rgba(borderColor, 0.2)};\n `}\n }\n\n ${hasSuggestion &&\n css`\n border-end-end-radius: 0;\n `}\n\n &[readonly] {\n background-color: ${readOnlyBackgroundColor};\n border-color: ${readOnlyBorderColor};\n }\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n font-size: max(${fontSize.s}, 16px);\n }\n `;\n }\n);\n\nStyledFormControl.defaultProps = defaultThemeProp;\n\nconst FormControl: FunctionComponent<FormControlProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormControlProps>, ref: Ref<HTMLDivElement>) => {\n return <StyledFormControl ref={ref} {...props} />;\n }\n);\n\nexport default FormControl;\n"]}
1
+ {"version":3,"file":"FormControl.js","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAoDjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAGzC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,eAAe,EAAE,UAAU,EAC3B,WAAW,EAAE,YAAY,EACzB,YAAY,EAAE,aAAa,EAC3B,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAC5B,OAAO,EACR,EACD,UAAU,EAAE,EACV,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SAC/B;;;;UAIC,CAAC,MAAM;QACT,GAAG,CAAA;0BACe,gBAAgB;SACjC;UACC,aAAa;QACf,GAAG,CAAA;8BACmB,UAAU;uCACD,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;SACpD;;;QAGD,aAAa;QACf,GAAG,CAAA;;OAEF;;;4BAGqB,uBAAuB;wBAC3B,mBAAmB;;;;;yBAKlB,QAAQ,CAAC,CAAC;;KAE9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,WAAW,GAAuD,UAAU,CAChF,CAAC,KAAwC,EAAE,GAAwB,EAAE,EAAE;IACrE,OAAO,KAAC,iBAAiB,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC;AACpD,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix, rgba } from 'polished';\n\nimport { BaseProps, ForwardProps, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport { AdditionalInfoProps } from '../AdditionalInfo';\n\nexport interface FormControlProps extends BaseProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: string;\n /** Set visual state based on a validation state. */\n status?: 'success' | 'warning' | 'error' | 'pending';\n /** Pass a string or a fragment with an Icon and string. */\n label?: ReactNode;\n /** Visually hides the label region. */\n labelHidden?: boolean;\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: ReactNode;\n /** Indicate if the field is required. The browser defaults to false. */\n required?: boolean;\n /** Placeholder text. The browser defaults to an empty string. */\n placeholder?: string;\n /** Button when clicked will show additional information on a field */\n additionalInfo?: {\n heading: AdditionalInfoProps['heading'];\n content: AdditionalInfoProps['children'];\n };\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: string;\n /**\n * If you wish to use an [uncontrolled input](https://reactjs.org/docs/uncontrolled-components.html), pass a defaultValue prop and a ref to access the input's native value prop or by other DOM ref means.\n */\n defaultValue?: string;\n /** Disable the control. The browser defaults to false. */\n disabled?: boolean;\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: string;\n /** Callback fired when AI suggestion is accepted/rejected */\n onResolveSuggestion?: (accepted: boolean) => void;\n}\n\ntype FormControlPropsWithDefaults = PropsWithDefaults<FormControlProps>;\n\nexport interface HandleValue {\n /** Used to clear component inputs with imperative handle */\n clear: () => void;\n}\n\nexport const StyledFormControl = styled.div<\n FormControlPropsWithDefaults & { hasSuggestion?: boolean }\n>(\n ({\n theme: {\n base: {\n 'border-radius': baseRadius,\n 'font-size': baseFontSize,\n 'font-scale': baseFontScale,\n animation: { speed, timing },\n palette\n },\n components: {\n 'form-field': formField,\n 'form-control': {\n 'foreground-color': foreground,\n 'background-color': background,\n 'border-color': brd,\n 'border-radius': radius,\n 'border-width': borderWidth,\n ':hover': { 'border-color': hoverBorderColor },\n ':focus': { 'border-color': focusBorderColor, 'box-shadow': shadow },\n ':disabled': {\n 'border-color': disabledBorderColor,\n 'background-color': disabledBackgroundColor\n },\n ':read-only': {\n 'border-color': readOnlyBorderColor,\n 'background-color': readOnlyBackgroundColor\n }\n }\n }\n },\n status,\n hasSuggestion\n }) => {\n const fontSize = calculateFontSize(baseFontSize, baseFontScale);\n const borderColor = status && formField[status] ? formField[status]['status-color'] : brd;\n const backgroundColor =\n hasSuggestion && status\n ? mix(0.1, formField[status]['status-color'], palette['primary-background'])\n : background;\n\n return css`\n color: ${foreground};\n background-color: ${backgroundColor};\n border-radius: calc(${baseRadius} * ${radius});\n border-color: ${borderColor};\n border-width: ${borderWidth};\n border-style: solid;\n transition-property: color, background-color, border-color;\n transition-duration: ${speed};\n transition-timing-function: ${timing.ease};\n &,\n & > select {\n outline: none;\n }\n\n &:disabled,\n &[disabled] {\n background-color: ${disabledBackgroundColor};\n border-color: ${disabledBorderColor};\n cursor: not-allowed;\n }\n\n &:focus:not([disabled]) {\n border-color: ${focusBorderColor};\n box-shadow: ${shadow};\n ${hasSuggestion &&\n css`\n background-color: ${background};\n `}\n }\n\n &:focus-within:not([disabled]) {\n ${hasSuggestion &&\n css`\n background-color: ${background};\n `}\n }\n\n &:hover:not([readonly]):not([disabled]):not(:focus, :focus-within) {\n ${!status &&\n css`\n border-color: ${hoverBorderColor};\n `}\n ${hasSuggestion &&\n css`\n background-color: ${background};\n box-shadow: 0 0 0 0.125rem ${rgba(borderColor, 0.2)};\n `}\n }\n\n ${hasSuggestion &&\n css`\n border-end-end-radius: 0;\n `}\n\n &[readonly] {\n background-color: ${readOnlyBackgroundColor};\n border-color: ${readOnlyBorderColor};\n }\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n font-size: max(${fontSize.s}, 16px);\n }\n `;\n }\n);\n\nStyledFormControl.defaultProps = defaultThemeProp;\n\nconst FormControl: FunctionComponent<FormControlProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormControlProps>, ref: Ref<HTMLDivElement>) => {\n return <StyledFormControl ref={ref} {...props} />;\n }\n);\n\nexport default FormControl;\n"]}
@@ -1,4 +1,5 @@
1
1
  export { default } from './FormControl';
2
2
  export { FormControlProps } from './FormControl';
3
3
  export { StyledFormControl } from './FormControl';
4
+ export { HandleValue } from './FormControl';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FormControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './FormControl';\nexport { FormControlProps } from './FormControl';\nexport { StyledFormControl } from './FormControl';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/FormControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './FormControl';\nexport { FormControlProps } from './FormControl';\nexport { StyledFormControl } from './FormControl';\nexport { HandleValue } from './FormControl';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ListToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AAqBnD,OAAO,EACL,gBAAgB,EAIjB,MAAM,qBAAqB,CAAC;AA2F7B,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAqRnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ListToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/ListToolbar/ListToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAQlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AA8BnD,OAAO,EACL,gBAAgB,EAIjB,MAAM,qBAAqB,CAAC;AAwB7B,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CA2TnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useCallback, useMemo, useRef, useState } from 'react';
2
+ import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import Actions from '../Actions';
4
- import Text from '../Text';
5
4
  import Button from '../Button';
6
- import { useBreakpoint, useConsolidatedRef, useI18n } from '../../hooks';
5
+ import { useArrows, useBreakpoint, useConsolidatedRef, useEscape, useFocusTrap, useFocusWithin, useI18n } from '../../hooks';
7
6
  import Flex from '../Flex';
8
7
  import SearchInput from '../SearchInput';
9
8
  import Icon, { registerIcon } from '../Icon';
@@ -13,55 +12,63 @@ import * as rowIcon from '../Icon/icons/row.icon';
13
12
  import * as plusIcon from '../Icon/icons/plus.icon';
14
13
  import * as moreIcon from '../Icon/icons/more.icon';
15
14
  import { hasProp } from '../../utils';
16
- import MenuButton from '../MenuButton';
17
- import { Count } from '../Badges';
15
+ import FormDialog from '../Dialog/FormDialog';
18
16
  import PresetMenuPopover from './PresetMenuPopover';
19
- import { StyledViewSelector, StyledSearchForm, StyledListToolbar, StyledHeadingText } from './ListToolbar.styles';
20
- import QueryOptionPopover from './QueryOptionPopover';
17
+ import { StyledViewSelector, StyledSearchForm, StyledListToolbar, StyledHeadingText, StyledCountMeta, StyledContainer } from './ListToolbar.styles';
21
18
  registerIcon(filterIcon, arrowUpDownIcon, rowIcon, plusIcon, moreIcon);
22
19
  const CountMeta = ({ count }) => {
23
20
  const t = useI18n();
24
- return (_jsxs(Text, { variant: 'secondary', children: [count.total !== undefined &&
21
+ return (_jsxs(StyledCountMeta, { variant: 'secondary', children: [count.total !== undefined &&
22
+ count.selected === undefined &&
25
23
  t('results_count', [count.totalHasMore ? `${count.total}+` : count.total], {
26
24
  count: count.total
27
- }), count.total !== undefined && count.selected !== undefined && ' ', count.selected !== undefined &&
28
- `(${t('selected_count', [count.selected], { count: count.selected })})`] }));
25
+ }), count.total !== undefined &&
26
+ count.selected !== undefined &&
27
+ t('selected_count', [count.selected, count.totalHasMore ? `${count.total}+` : count.total], { count: count.selected })] }));
29
28
  };
30
- const QueryOptionButton = ({ id, queryOptionProps, iconOnly, onClick }) => {
31
- const t = useI18n();
32
- let i18nKey;
33
- let icon;
34
- if (id === 'filter') {
35
- i18nKey = 'filter';
36
- icon = 'filter';
37
- }
38
- else if (id === 'sort') {
39
- i18nKey = 'sort';
40
- icon = 'arrow-up-down';
41
- }
42
- else {
43
- i18nKey = 'group';
44
- icon = 'row';
45
- }
46
- const text = t(i18nKey);
47
- const variant = iconOnly ? 'simple' : 'text';
48
- if (hasProp(queryOptionProps, 'renderer')) {
49
- return (_jsx("div", { children: _jsx(Button, { variant: variant, icon: iconOnly, label: iconOnly ? text : undefined, onClick: onClick, children: _jsxs(Flex, { container: { inline: true, alignItems: 'center', gap: 1 }, as: 'span', children: [_jsx(Icon, { name: icon }), !iconOnly && text, !iconOnly && queryOptionProps.count && _jsx(Count, { children: queryOptionProps.count })] }) }) }));
50
- }
51
- if (hasProp(queryOptionProps, 'items')) {
52
- return (_jsx("div", { children: _jsx(MenuButton, { variant: variant, text: text, icon: icon, iconOnly: iconOnly, count: queryOptionProps.count, onClick: onClick, menu: {
53
- mode: queryOptionProps.mode,
54
- items: queryOptionProps.items.map(item => ({ ...item, primary: item.text })),
55
- onItemClick: queryOptionProps.onItemClick
56
- } }) }));
57
- }
58
- return null;
59
- };
60
- const ListToolbar = forwardRef(({ heading, formControlProps, createNew, search, count, additionalActions, filter, sort, group, actions, actionsButtonRef, condensed }, ref) => {
29
+ const ListToolbar = forwardRef(({ name, viewSelector, formControlProps, createNew, search, count, additionalActions, filter, sort, group, actions, actionsButtonRef }, ref) => {
61
30
  const t = useI18n();
62
31
  const isSmallOrAbove = useBreakpoint('sm');
63
- const isMediumOrAbove = useBreakpoint('md');
64
32
  const consolidatedActionsButtonRef = useConsolidatedRef(actionsButtonRef);
33
+ const toolbarRef = useConsolidatedRef(ref);
34
+ const searchInputRef = useRef(null);
35
+ const searchWrapperRef = useRef(null);
36
+ const searchButtonRef = useRef(null);
37
+ const [isSearchOpen, setIsSearchOpen] = useState(!!search?.value);
38
+ const onSearchEscape = useCallback(() => {
39
+ if (!search?.value) {
40
+ setIsSearchOpen(false);
41
+ }
42
+ setTimeout(() => searchButtonRef.current?.focus());
43
+ }, [search?.value]);
44
+ useEffect(() => {
45
+ if (search?.value) {
46
+ setIsSearchOpen(true);
47
+ }
48
+ }, [search?.value]);
49
+ const hasFocus = useFocusWithin([searchWrapperRef]);
50
+ useArrows(hasFocus ? { current: null } : toolbarRef, {
51
+ dir: 'left-right',
52
+ selector: "button:enabled:first-child, :not(input) + button:enabled, div[role='button']"
53
+ });
54
+ useEffect(() => {
55
+ if (searchWrapperRef.current) {
56
+ const focusables = searchWrapperRef.current.querySelectorAll("button:enabled, input[type='search']:enabled");
57
+ if (!hasFocus) {
58
+ focusables.forEach(item => {
59
+ item.tabIndex = -1;
60
+ });
61
+ if (isSearchOpen && !search?.value) {
62
+ setIsSearchOpen(false);
63
+ }
64
+ }
65
+ else {
66
+ focusables.forEach(item => {
67
+ item.tabIndex = 0;
68
+ });
69
+ }
70
+ }
71
+ }, [hasFocus]);
65
72
  const [currentQueryOptionId, setCurrentQueryOptionId] = useState(null);
66
73
  const queryOptionPopoverTarget = useRef();
67
74
  const [actionsQueryOptionPreset, setActionsQueryOptionPreset] = useState();
@@ -70,25 +77,30 @@ const ListToolbar = forwardRef(({ heading, formControlProps, createNew, search,
70
77
  if (!createNew?.onClick)
71
78
  return null;
72
79
  const text = createNew.label ?? t('create_new');
73
- return (_jsx(Button, { variant: isSmallOrAbove ? 'secondary' : 'simple', icon: !isSmallOrAbove, label: isSmallOrAbove ? undefined : text, "aria-label": text, onClick: createNew.onClick, children: isSmallOrAbove ? text : _jsx(Icon, { name: 'plus' }) }));
80
+ return (_jsx(Button, { variant: 'simple', icon: true, label: text, "aria-label": text, onClick: createNew.onClick, children: _jsx(Icon, { name: 'plus' }) }));
74
81
  }, [t, createNew, isSmallOrAbove]);
75
- const filterButton = filter && (_jsx(QueryOptionButton, { id: 'filter', queryOptionProps: filter, iconOnly: !isMediumOrAbove, onClick: e => {
76
- setCurrentQueryOptionId('filter');
77
- queryOptionPopoverTarget.current = e.currentTarget;
78
- } }));
79
- const sortButton = sort && (_jsx(QueryOptionButton, { id: 'sort', queryOptionProps: sort, iconOnly: !isMediumOrAbove, onClick: e => {
80
- setCurrentQueryOptionId('sort');
81
- queryOptionPopoverTarget.current = e.currentTarget;
82
- } }));
83
- const groupButton = group && (_jsx(QueryOptionButton, { id: 'group', queryOptionProps: group, iconOnly: !isMediumOrAbove, onClick: e => {
84
- setCurrentQueryOptionId('group');
85
- queryOptionPopoverTarget.current = e.currentTarget;
86
- } }));
82
+ useFocusTrap(searchButtonRef);
83
+ useEscape(onSearchEscape, searchButtonRef);
84
+ const searchInputWrapper = useMemo(() => (_jsx("div", { role: 'dialog', ref: searchWrapperRef, children: _jsx(SearchInput, { ...search, ref: searchInputRef, tabIndex: '-1' }) })), [search]);
85
+ const searchLabel = t('search');
86
+ const searchButton = useMemo(() => {
87
+ return (_jsx(Button, { as: 'div', role: 'button', variant: 'simple', icon: true, label: searchLabel, "aria-label": searchLabel, onClick: () => {
88
+ setIsSearchOpen(true);
89
+ setTimeout(() => searchInputRef.current?.focus());
90
+ }, onKeyDown: (e) => {
91
+ if (e.key === 'Enter') {
92
+ setIsSearchOpen(true);
93
+ setTimeout(() => searchInputRef.current?.focus());
94
+ }
95
+ }, tabIndex: '-1', ref: searchButtonRef, children: isSearchOpen ? searchInputWrapper : _jsx(Icon, { name: 'search' }) }));
96
+ }, [searchLabel, setIsSearchOpen, isSearchOpen, searchInputWrapper]);
87
97
  let queryOptionPopover = null;
88
98
  if (currentQueryOptionId) {
89
99
  const queryOptionProps = { filter, sort, group }[currentQueryOptionId];
90
- if (queryOptionProps && hasProp(queryOptionProps, 'renderer')) {
91
- queryOptionPopover = (_jsx(QueryOptionPopover, { target: queryOptionPopoverTarget.current, heading: t(`${currentQueryOptionId}_by`), onCancel: () => {
100
+ if (queryOptionProps &&
101
+ hasProp(queryOptionProps, 'renderer') &&
102
+ queryOptionPopoverTarget.current) {
103
+ queryOptionPopover = (_jsx(FormDialog, { target: queryOptionPopoverTarget.current, heading: t(`${currentQueryOptionId}_by`), onCancel: () => {
92
104
  if (queryOptionProps.onCancel() === false)
93
105
  return;
94
106
  setCurrentQueryOptionId(null);
@@ -143,23 +155,29 @@ const ListToolbar = forwardRef(({ heading, formControlProps, createNew, search,
143
155
  }
144
156
  return basicActions.length ? basicActions : undefined;
145
157
  }, [actions, filter, sort, group, getQueryOptionAction]);
146
- return (_jsxs(Flex, { as: StyledListToolbar, container: { direction: 'column', gap: 2 }, item: { grow: 1 }, ref: ref, role: 'toolbar', children: [(heading ||
158
+ return (_jsxs(Flex, { as: StyledListToolbar, container: { direction: 'column', gap: 0.5 }, item: { grow: 1 }, ref: toolbarRef, role: 'toolbar', children: [(name ||
159
+ viewSelector ||
147
160
  createNewButton ||
148
- (condensed && (count || additionalActions || search || basicModeActions))) && (_jsxs(Flex, { container: { alignItems: 'start', justify: 'between', gap: 2 }, children: [_jsxs(Flex, { container: { alignItems: 'center', gap: 2, wrap: 'wrap' }, children: [heading &&
149
- (typeof heading === 'string' ? (_jsx(StyledHeadingText, { variant: 'h3', required: formControlProps?.required, children: heading })) : (_jsx(StyledViewSelector, { variant: 'text', text: heading.views.find(view => view.selected)?.text ?? heading.views[0].text, menu: {
161
+ count ||
162
+ additionalActions ||
163
+ search ||
164
+ basicModeActions) && (_jsxs(Flex, { container: { alignItems: 'start', justify: 'between', gap: 2 }, children: [_jsxs(StyledContainer, { container: { alignItems: 'center', gap: 0.5, wrap: 'wrap' }, children: [viewSelector &&
165
+ viewSelector.views.length > 0 &&
166
+ (viewSelector.views.length === 1 ? (_jsx(StyledHeadingText, { variant: 'h3', required: formControlProps?.required, children: `${name}: ${viewSelector.views[0].text}` })) : (_jsx(StyledViewSelector, { variant: 'text', text: `${name}: ${viewSelector.views.find(view => view.selected)?.text ??
167
+ viewSelector.views[0].text}`, menu: {
150
168
  mode: 'single-select',
151
- items: heading.views.map(view => ({
169
+ items: viewSelector.views.map(view => ({
152
170
  ...view,
153
- primary: `${view.text}${view.id === heading.defaultId ? ` (${t('default')})` : ''}${view.id === heading.appDefaultId ? ` (${t('app_default')})` : ''}`
171
+ primary: `${view.text}${view.id === viewSelector.defaultId ? ` (${t('default')})` : ''}${view.id === viewSelector.appDefaultId ? ` (${t('app_default')})` : ''}`
154
172
  })),
155
- onItemClick: heading.onViewSelect
156
- }, required: formControlProps?.required }))), isSmallOrAbove && condensed && (_jsxs(_Fragment, { children: [count && _jsx(CountMeta, { count: count }), additionalActions] }))] }), _jsxs(Flex, { container: { alignItems: 'center', gap: 2 }, children: [search && condensed && isSmallOrAbove && _jsx(SearchInput, { ...search }), createNewButton, condensed && basicModeActions && (_jsx("span", { children: _jsx(Actions, { items: basicModeActions.map(({ icon, ...restProps }) => ({
173
+ onItemClick: viewSelector.onViewSelect
174
+ }, required: formControlProps?.required }))), (!viewSelector || viewSelector.views.length === 0) && (_jsx(StyledHeadingText, { variant: 'h3', required: formControlProps?.required, children: name })), isSmallOrAbove && count && _jsx(CountMeta, { count: count })] }), _jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, item: { shrink: 0 }, children: [isSmallOrAbove && additionalActions, search && isSmallOrAbove && searchButton, isSmallOrAbove && createNewButton, isSmallOrAbove && basicModeActions && (_jsx("span", { children: _jsx(Actions, { items: basicModeActions.map(({ icon, ...restProps }) => ({
157
175
  visual: icon ? _jsx(Icon, { name: icon }) : undefined,
158
176
  ...restProps
159
- })), menuAt: 1, ref: consolidatedActionsButtonRef }) }))] })] })), (!condensed || !isSmallOrAbove) && (_jsxs(Flex, { container: { alignItems: 'start', justify: 'between', gap: 2 }, children: [_jsxs(Flex, { as: StyledSearchForm, container: { alignItems: 'center', wrap: 'wrap', gap: 2 }, item: { grow: 1 }, children: [search && _jsx(SearchInput, { ...search }), isSmallOrAbove && !condensed && (_jsxs(_Fragment, { children: [count && _jsx(CountMeta, { count: count }), additionalActions] }))] }), !condensed && (filterButton || sortButton || groupButton || actions) && (_jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, md: { container: { gap: 2 } }, children: [_jsxs(_Fragment, { children: [filterButton, sortButton, groupButton] }), actions && (_jsx(Actions, { items: actions.map(({ icon, ...restProps }) => ({
177
+ })), menuAt: 1, ref: consolidatedActionsButtonRef }) })), !isSmallOrAbove && count && _jsx(CountMeta, { count: count })] })] })), !isSmallOrAbove && (_jsx(_Fragment, { children: _jsxs(Flex, { container: { alignItems: 'start', justify: 'between', gap: 1 }, children: [additionalActions, _jsx(Flex, { as: StyledSearchForm, container: { alignItems: 'center', wrap: 'wrap', gap: 1 }, item: { grow: 1 }, children: search && searchInputWrapper }), createNewButton, basicModeActions && (_jsx("span", { children: _jsx(Actions, { items: basicModeActions.map(({ icon, ...restProps }) => ({
160
178
  visual: icon ? _jsx(Icon, { name: icon }) : undefined,
161
179
  ...restProps
162
- })), menuAt: 1, ref: consolidatedActionsButtonRef }))] }))] })), !isSmallOrAbove && (count || additionalActions) && (_jsxs(Flex, { container: { alignItems: 'center', wrap: 'wrap', gap: 2 }, children: [count && _jsx(CountMeta, { count: count }), additionalActions] })), queryOptionPopover, condensed && (_jsx(PresetMenuPopover, { buttonRef: consolidatedActionsButtonRef, heading: actionsQueryOptionPreset?.heading, menu: actionsQueryOptionPreset?.menu, isOpen: optionPresetMenuOpen, onClose: () => setOptionPresetMenuOpen(false) }))] }));
180
+ })), menuAt: 1, ref: consolidatedActionsButtonRef }) }))] }) })), queryOptionPopover, _jsx(PresetMenuPopover, { buttonRef: consolidatedActionsButtonRef, heading: actionsQueryOptionPreset?.heading, menu: actionsQueryOptionPreset?.menu, isOpen: optionPresetMenuOpen, onClose: () => setOptionPresetMenuOpen(false) })] }));
163
181
  });
164
182
  export default ListToolbar;
165
183
  //# sourceMappingURL=ListToolbar.js.map