@pega/cosmos-react-core 3.0.0-dev.12.0 → 3.0.0-dev.15.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 (153) hide show
  1. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js +13 -3
  3. package/lib/components/AppShell/AppHeader.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppShell.js +8 -4
  6. package/lib/components/AppShell/AppShell.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.styles.d.ts +1 -0
  8. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.styles.js +62 -77
  10. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  11. package/lib/components/AppShell/AppShell.types.d.ts +3 -0
  12. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  14. package/lib/components/AppShell/AppShellContext.d.ts +3 -1
  15. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShellContext.js +3 -1
  17. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  18. package/lib/components/Banner/Banner.d.ts.map +1 -1
  19. package/lib/components/Banner/Banner.js +6 -2
  20. package/lib/components/Banner/Banner.js.map +1 -1
  21. package/lib/components/Boolean/BooleanDisplay.d.ts.map +1 -1
  22. package/lib/components/Boolean/BooleanDisplay.js +4 -12
  23. package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
  24. package/lib/components/CompositeInput/CompositeInput.d.ts +5 -0
  25. package/lib/components/CompositeInput/CompositeInput.d.ts.map +1 -0
  26. package/lib/components/CompositeInput/CompositeInput.js +59 -0
  27. package/lib/components/CompositeInput/CompositeInput.js.map +1 -0
  28. package/lib/components/CompositeInput/CompositeInput.styles.d.ts +5 -0
  29. package/lib/components/CompositeInput/CompositeInput.styles.d.ts.map +1 -0
  30. package/lib/components/CompositeInput/CompositeInput.styles.js +54 -0
  31. package/lib/components/CompositeInput/CompositeInput.styles.js.map +1 -0
  32. package/lib/components/CompositeInput/CompositeInput.types.d.ts +50 -0
  33. package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -0
  34. package/lib/components/CompositeInput/CompositeInput.types.js +2 -0
  35. package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -0
  36. package/lib/components/CompositeInput/index.d.ts +3 -0
  37. package/lib/components/CompositeInput/index.d.ts.map +1 -0
  38. package/lib/components/CompositeInput/index.js +2 -0
  39. package/lib/components/CompositeInput/index.js.map +1 -0
  40. package/lib/components/Configuration/Configuration.d.ts +14 -13
  41. package/lib/components/Configuration/Configuration.d.ts.map +1 -1
  42. package/lib/components/Configuration/Configuration.js +24 -14
  43. package/lib/components/Configuration/Configuration.js.map +1 -1
  44. package/lib/components/Currency/utils.js +2 -2
  45. package/lib/components/Currency/utils.js.map +1 -1
  46. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  47. package/lib/components/FieldGroup/FieldGroup.js +3 -2
  48. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  49. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  50. package/lib/components/FieldGroup/FieldGroupList.js +6 -2
  51. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  52. package/lib/components/Form/Form.d.ts +5 -16
  53. package/lib/components/Form/Form.d.ts.map +1 -1
  54. package/lib/components/Form/Form.js +14 -11
  55. package/lib/components/Form/Form.js.map +1 -1
  56. package/lib/components/FormField/FormField.d.ts.map +1 -1
  57. package/lib/components/FormField/FormField.js +6 -2
  58. package/lib/components/FormField/FormField.js.map +1 -1
  59. package/lib/components/Icon/Icon.d.ts.map +1 -1
  60. package/lib/components/Icon/Icon.js +1 -1
  61. package/lib/components/Icon/Icon.js.map +1 -1
  62. package/lib/components/Link/Link.d.ts.map +1 -1
  63. package/lib/components/Link/Link.js +1 -2
  64. package/lib/components/Link/Link.js.map +1 -1
  65. package/lib/components/List/CommaSeparatedList.d.ts.map +1 -1
  66. package/lib/components/List/CommaSeparatedList.js +6 -14
  67. package/lib/components/List/CommaSeparatedList.js.map +1 -1
  68. package/lib/components/Modal/Contexts.d.ts.map +1 -1
  69. package/lib/components/Modal/Contexts.js +2 -3
  70. package/lib/components/Modal/Contexts.js.map +1 -1
  71. package/lib/components/Modal/Modal.types.d.ts +2 -6
  72. package/lib/components/Modal/Modal.types.d.ts.map +1 -1
  73. package/lib/components/Modal/Modal.types.js +1 -2
  74. package/lib/components/Modal/Modal.types.js.map +1 -1
  75. package/lib/components/Modal/ModalManager.d.ts +8 -2
  76. package/lib/components/Modal/ModalManager.d.ts.map +1 -1
  77. package/lib/components/Modal/ModalManager.js +13 -10
  78. package/lib/components/Modal/ModalManager.js.map +1 -1
  79. package/lib/components/MultiStepForm/FormProgress.d.ts +10 -0
  80. package/lib/components/MultiStepForm/FormProgress.d.ts.map +1 -0
  81. package/lib/components/{MultiStep/MultiStep.js → MultiStepForm/FormProgress.js} +8 -22
  82. package/lib/components/MultiStepForm/FormProgress.js.map +1 -0
  83. package/lib/components/{MultiStep/MultiStep.styles.d.ts → MultiStepForm/FormProgress.styles.d.ts} +2 -4
  84. package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -0
  85. package/lib/components/{MultiStep/MultiStep.styles.js → MultiStepForm/FormProgress.styles.js} +2 -4
  86. package/lib/components/MultiStepForm/FormProgress.styles.js.map +1 -0
  87. package/lib/components/MultiStepForm/MultiStepForm.d.ts +9 -0
  88. package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -0
  89. package/lib/components/MultiStepForm/MultiStepForm.js +50 -0
  90. package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -0
  91. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +49 -0
  92. package/lib/components/MultiStepForm/MultiStepForm.types.d.ts.map +1 -0
  93. package/lib/components/MultiStepForm/MultiStepForm.types.js +2 -0
  94. package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -0
  95. package/lib/components/MultiStepForm/index.d.ts +2 -0
  96. package/lib/components/MultiStepForm/index.d.ts.map +1 -0
  97. package/lib/components/MultiStepForm/index.js +2 -0
  98. package/lib/components/MultiStepForm/index.js.map +1 -0
  99. package/lib/components/Number/NumberDisplay.d.ts +0 -5
  100. package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
  101. package/lib/components/Number/NumberDisplay.js +8 -12
  102. package/lib/components/Number/NumberDisplay.js.map +1 -1
  103. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  104. package/lib/components/Number/NumberInput.js +8 -5
  105. package/lib/components/Number/NumberInput.js.map +1 -1
  106. package/lib/components/Number/utils.d.ts +1 -4
  107. package/lib/components/Number/utils.d.ts.map +1 -1
  108. package/lib/components/Number/utils.js +5 -3
  109. package/lib/components/Number/utils.js.map +1 -1
  110. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  111. package/lib/components/SearchInput/SearchInput.js +5 -1
  112. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  113. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  114. package/lib/components/Tabs/Tab.js +0 -1
  115. package/lib/components/Tabs/Tab.js.map +1 -1
  116. package/lib/components/Toaster/Toaster.d.ts +7 -2
  117. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  118. package/lib/components/Toaster/Toaster.js +7 -7
  119. package/lib/components/Toaster/Toaster.js.map +1 -1
  120. package/lib/hooks/useI18n.d.ts +20 -9
  121. package/lib/hooks/useI18n.d.ts.map +1 -1
  122. package/lib/i18n/default.d.ts +20 -9
  123. package/lib/i18n/default.d.ts.map +1 -1
  124. package/lib/i18n/default.js +23 -9
  125. package/lib/i18n/default.js.map +1 -1
  126. package/lib/i18n/i18n.d.ts +40 -18
  127. package/lib/i18n/i18n.d.ts.map +1 -1
  128. package/lib/index.d.ts +3 -2
  129. package/lib/index.d.ts.map +1 -1
  130. package/lib/index.js +3 -2
  131. package/lib/index.js.map +1 -1
  132. package/lib/init.d.ts +8 -0
  133. package/lib/init.d.ts.map +1 -0
  134. package/lib/init.js +5 -0
  135. package/lib/init.js.map +1 -0
  136. package/lib/theme/ThemeMachine.d.ts +11 -3
  137. package/lib/theme/ThemeMachine.d.ts.map +1 -1
  138. package/lib/theme/ThemeMachine.js +28 -26
  139. package/lib/theme/ThemeMachine.js.map +1 -1
  140. package/package.json +5 -2
  141. package/lib/components/MultiStep/MultiStep.d.ts +0 -6
  142. package/lib/components/MultiStep/MultiStep.d.ts.map +0 -1
  143. package/lib/components/MultiStep/MultiStep.js.map +0 -1
  144. package/lib/components/MultiStep/MultiStep.styles.d.ts.map +0 -1
  145. package/lib/components/MultiStep/MultiStep.styles.js.map +0 -1
  146. package/lib/components/MultiStep/MultiStep.types.d.ts +0 -36
  147. package/lib/components/MultiStep/MultiStep.types.d.ts.map +0 -1
  148. package/lib/components/MultiStep/MultiStep.types.js +0 -2
  149. package/lib/components/MultiStep/MultiStep.types.js.map +0 -1
  150. package/lib/components/MultiStep/index.d.ts +0 -3
  151. package/lib/components/MultiStep/index.d.ts.map +0 -1
  152. package/lib/components/MultiStep/index.js +0 -2
  153. package/lib/components/MultiStep/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FieldGroupList.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE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,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,aAAa,EAA2B,EAAE,EAAE;gBAC/E,OAAO,CACL,KAAC,cAAc,IAEb,IAAI,EAAE,IAAI,KACN,aAAa,EACjB,OAAO,EACL,QAAQ;wBACN,CAAC,CAAC;4BACE;gCACE,EAAE,EAAE,QAAQ;gCACZ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;gCACjB,IAAI,EAAE,OAAO;gCACb,QAAQ,EAAE,IAAI;gCACd,OAAO,EAAE,QAAQ;oCACf,CAAC,CAAC,GAAG,EAAE;wCACH,QAAQ,CAAC,EAAE,CAAC,CAAC;oCACf,CAAC;oCACH,CAAC,CAAC,SAAS;6BACd;yBACF;wBACH,CAAC,CAAC,SAAS,YAGd,QAAQ,IArBJ,EAAE,CAsBQ,CAClB,CAAC;YACJ,CAAC,CAAC,EACD,KAAK,IAAI,CACR,MAAC,eAAe,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,aAC5C,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,OAAE,CAAC,CAAC,KAAK,CAAC,IACd,CACnB,IACoB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nimport FieldGroup, { FieldGroupProps } from './FieldGroup';\n\nregisterIcon(plusIcon);\n\nexport interface FieldGroupListItemProps extends FieldGroupProps {\n /** The ID of the field group list item */\n id: string;\n}\n\nexport interface FieldGroupListProps {\n items: FieldGroupListItemProps[];\n onAdd?: () => void;\n onDelete?: (id: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledFieldGroupList = styled.div(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledFieldGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledListItem = styled(FieldGroup)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0 calc(2 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-bottom: calc(2 * ${theme.base.spacing});\n\n legend {\n margin-bottom: -${theme.base.spacing};\n }\n\n & > * {\n margin: ${theme.base.spacing} 0;\n }\n `\n);\n\nStyledListItem.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst FieldGroupList: FunctionComponent<FieldGroupListProps & ForwardProps> = forwardRef(\n (\n { items, onAdd, onDelete, ...restProps }: PropsWithoutRef<FieldGroupListProps>,\n ref: FieldGroupListProps['ref']\n ) => {\n const t = useI18n();\n\n return (\n <StyledFieldGroupList ref={ref} {...restProps}>\n {items.map(({ id, children, name, ...restItemProps }: FieldGroupListItemProps) => {\n return (\n <StyledListItem\n key={id}\n name={name}\n {...restItemProps}\n actions={\n onDelete\n ? [\n {\n id: 'delete',\n text: t('delete'),\n icon: 'trash',\n iconOnly: true,\n onClick: onDelete\n ? () => {\n onDelete(id);\n }\n : undefined\n }\n ]\n : undefined\n }\n >\n {children}\n </StyledListItem>\n );\n })}\n {onAdd && (\n <StyledAddButton variant='link' onClick={onAdd}>\n <Icon name='plus' /> {t('add')}\n </StyledAddButton>\n )}\n </StyledFieldGroupList>\n );\n }\n);\n\nexport default FieldGroupList;\n"]}
1
+ {"version":3,"file":"FieldGroupList.js","sourceRoot":"","sources":["../../../src/components/FieldGroup/FieldGroupList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM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AC;AAEhD,MAAM,cAAc,GAA0D,UAAU,CACtF,CACE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAwC,EAC9E,GAA+B,EAC/B,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,MAAC,oBAAoB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,aAC1C,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,aAAa,EAA2B,EAAE,EAAE;gBAC/E,OAAO,CACL,KAAC,cAAc,IAEb,IAAI,EAAE,IAAI,KACN,aAAa,EACjB,OAAO,EACL,QAAQ;wBACN,CAAC,CAAC;4BACE;gCACE,EAAE,EAAE,QAAQ;gCACZ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;gCACjB,IAAI,EAAE,OAAO;gCACb,QAAQ,EAAE,IAAI;gCACd,OAAO,EAAE,QAAQ;oCACf,CAAC,CAAC,GAAG,EAAE;wCACH,QAAQ,CAAC,EAAE,CAAC,CAAC;oCACf,CAAC;oCACH,CAAC,CAAC,SAAS;6BACd;yBACF;wBACH,CAAC,CAAC,SAAS,YAGd,QAAQ,IArBJ,EAAE,CAsBQ,CAClB,CAAC;YACJ,CAAC,CAAC,EACD,KAAK,IAAI,CACR,MAAC,eAAe,IAAC,OAAO,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,aAC5C,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,OAAE,CAAC,CAAC,KAAK,CAAC,IACd,CACnB,IACoB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as plusIcon from '../Icon/icons/plus.icon';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nimport FieldGroup, { FieldGroupProps, StyledFieldGroup } from './FieldGroup';\n\nregisterIcon(plusIcon);\n\nexport interface FieldGroupListItemProps extends FieldGroupProps {\n /** The ID of the field group list item */\n id: string;\n}\n\nexport interface FieldGroupListProps {\n items: FieldGroupListItemProps[];\n onAdd?: () => void;\n onDelete?: (id: string) => void;\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledFieldGroupList = styled.div(\n ({ theme }) =>\n css`\n margin-block-start: ${theme.base.spacing};\n\n ${StyledFieldGroup} {\n margin-block-start: 0;\n }\n `\n);\n\nStyledFieldGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledListItem = styled(FieldGroup)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0 calc(2 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n margin-bottom: calc(2 * ${theme.base.spacing});\n\n legend {\n margin-bottom: -${theme.base.spacing};\n }\n\n & > * {\n margin: ${theme.base.spacing} 0;\n }\n `\n);\n\nStyledListItem.defaultProps = defaultThemeProp;\n\nconst StyledAddButton = styled(Button)(\n ({ theme }) =>\n css`\n margin-top: ${theme.base.spacing};\n `\n);\n\nStyledAddButton.defaultProps = defaultThemeProp;\n\nconst FieldGroupList: FunctionComponent<FieldGroupListProps & ForwardProps> = forwardRef(\n (\n { items, onAdd, onDelete, ...restProps }: PropsWithoutRef<FieldGroupListProps>,\n ref: FieldGroupListProps['ref']\n ) => {\n const t = useI18n();\n\n return (\n <StyledFieldGroupList ref={ref} {...restProps}>\n {items.map(({ id, children, name, ...restItemProps }: FieldGroupListItemProps) => {\n return (\n <StyledListItem\n key={id}\n name={name}\n {...restItemProps}\n actions={\n onDelete\n ? [\n {\n id: 'delete',\n text: t('delete'),\n icon: 'trash',\n iconOnly: true,\n onClick: onDelete\n ? () => {\n onDelete(id);\n }\n : undefined\n }\n ]\n : undefined\n }\n >\n {children}\n </StyledListItem>\n );\n })}\n {onAdd && (\n <StyledAddButton variant='link' onClick={onAdd}>\n <Icon name='plus' /> {t('add')}\n </StyledAddButton>\n )}\n </StyledFieldGroupList>\n );\n }\n);\n\nexport default FieldGroupList;\n"]}
@@ -1,21 +1,10 @@
1
- import { FC, ReactNode, Ref } from 'react';
2
- import { BaseProps, ForwardProps } from '../../types';
3
- export interface FormProps extends BaseProps {
1
+ import { FC } from 'react';
2
+ import { ForwardProps, OmitStrict } from '../../types';
3
+ import { type BaseFormProps } from '../MultiStepForm/MultiStepForm.types';
4
+ export interface FormProps extends OmitStrict<BaseFormProps, 'content'> {
4
5
  /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */
5
- children: ReactNode;
6
- /** Region for Form Actions. */
7
- actions?: ReactNode;
8
- /** The heading of the form. */
9
- heading?: string;
10
- /** A description of the form to be displayed above the controls. */
11
- description?: string;
12
- /** Region for Banners above the Form. */
13
- banners?: ReactNode;
14
- /** Ref forwarded to the wrapping element. */
15
- ref?: Ref<HTMLFormElement>;
6
+ children: BaseFormProps['content'];
16
7
  }
17
- export declare const StyledForm: import("styled-components").StyledComponent<"form", import("styled-components").DefaultTheme, {}, never>;
18
- export declare const StyledFormContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
19
8
  declare const Form: FC<FormProps & ForwardProps>;
20
9
  export default Form;
21
10
  //# sourceMappingURL=Form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKtD,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,6HAA6H;IAC7H,QAAQ,EAAE,SAAS,CAAC;IACpB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,UAAU,0GAAgB,CAAC;AACxC,eAAO,MAAM,iBAAiB,yGAAe,CAAC;AAE9C,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,GAAG,YAAY,CAkCtC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,EAAE,EAAmB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,MAAM,WAAW,SAAU,SAAQ,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC;IACrE,6HAA6H;IAC7H,QAAQ,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,GAAG,YAAY,CA0BtC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,16 +1,19 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import styled from 'styled-components';
4
3
  import { useUID } from '../../hooks';
5
- import Flex from '../Flex';
6
- import Text from '../Text';
7
- import HTML from '../HTML';
8
- export const StyledForm = styled.form ``;
9
- export const StyledFormContent = styled.div ``;
10
- const Form = forwardRef((props, ref) => {
11
- const { children, actions, heading, description, banners, ...restProps } = props;
12
- const uid = useUID();
13
- return (_jsxs(Flex, { container: { direction: 'column', gap: 3 }, as: StyledForm, ref: ref, ...restProps, "aria-labelledby": heading ? `${uid}-heading` : undefined, "aria-describedby": description ? `${uid}-description` : undefined, children: [banners, (heading || description) && (_jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [heading && (_jsx(Text, { id: `${uid}-heading`, variant: 'h3', children: heading })), description && _jsx(HTML, { id: `${uid}-description`, as: 'p', content: description })] })), _jsx(Flex, { as: StyledFormContent, container: { direction: 'column', gap: 3 }, children: children }), actions && _jsx(Flex, { container: { justify: 'between', alignItems: 'center' }, children: actions })] }));
4
+ import MultiStepForm from '../MultiStepForm';
5
+ const Form = forwardRef(({ children, actions, heading, description, banners, ...restProps }, ref) => {
6
+ const stepId = useUID();
7
+ return (_jsx(MultiStepForm, { ...restProps, heading: heading, steps: [
8
+ {
9
+ id: stepId,
10
+ name: '',
11
+ actions,
12
+ content: children,
13
+ description,
14
+ banners
15
+ }
16
+ ], currentStepId: stepId, ref: ref }));
14
17
  });
15
18
  export default Form;
16
19
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACxE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAiB3B,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAA,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE9C,MAAM,IAAI,GAAiC,UAAU,CACnD,CAAC,KAAiC,EAAE,GAAqB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, PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport { useUID } from '../../hooks';\nimport { BaseProps, ForwardProps } from '../../types';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport HTML from '../HTML';\n\nexport interface FormProps extends BaseProps {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: ReactNode;\n /** Region for Form Actions. */\n actions?: ReactNode;\n /** The heading of the form. */\n heading?: string;\n /** A description of the form to be displayed above the controls. */\n description?: string;\n /** Region for Banners above the Form. */\n banners?: ReactNode;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLFormElement>;\n}\n\nexport const StyledForm = styled.form``;\nexport const StyledFormContent = styled.div``;\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormProps>, ref: FormProps['ref']) => {\n const { children, actions, heading, description, banners, ...restProps } = props;\n\n const uid = useUID();\n\n return (\n <Flex\n container={{ direction: 'column', gap: 3 }}\n as={StyledForm}\n ref={ref}\n {...restProps}\n aria-labelledby={heading ? `${uid}-heading` : undefined}\n aria-describedby={description ? `${uid}-description` : undefined}\n >\n {banners}\n {(heading || description) && (\n <Flex container={{ direction: 'column', gap: 1 }}>\n {heading && (\n <Text id={`${uid}-heading`} variant='h3'>\n {heading}\n </Text>\n )}\n {description && <HTML id={`${uid}-description`} as='p' content={description} />}\n </Flex>\n )}\n <Flex as={StyledFormContent} container={{ direction: 'column', gap: 3 }}>\n {children}\n </Flex>\n\n {actions && <Flex container={{ justify: 'between', alignItems: 'center' }}>{actions}</Flex>}\n </Flex>\n );\n }\n);\n\nexport default Form;\n"]}
1
+ {"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAQ7C,MAAM,IAAI,GAAiC,UAAU,CACnD,CACE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,SAAS,EAA8B,EAC9F,GAAqB,EACrB,EAAE;IACF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IAExB,OAAO,CACL,KAAC,aAAa,OACR,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,EAAE;gBACR,OAAO;gBACP,OAAO,EAAE,QAAQ;gBACjB,WAAW;gBACX,OAAO;aACR;SACF,EACD,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef, FC, PropsWithoutRef } from 'react';\n\nimport { ForwardProps, OmitStrict } from '../../types';\nimport { useUID } from '../../hooks';\nimport MultiStepForm from '../MultiStepForm';\nimport { type BaseFormProps } from '../MultiStepForm/MultiStepForm.types';\n\nexport interface FormProps extends OmitStrict<BaseFormProps, 'content'> {\n /** The Form content. Recommended composing form elements within a layout template such as Grid or Flex as the only child. */\n children: BaseFormProps['content'];\n}\n\nconst Form: FC<FormProps & ForwardProps> = forwardRef(\n (\n { children, actions, heading, description, banners, ...restProps }: PropsWithoutRef<FormProps>,\n ref: FormProps['ref']\n ) => {\n const stepId = useUID();\n\n return (\n <MultiStepForm\n {...restProps}\n heading={heading}\n steps={[\n {\n id: stepId,\n name: '',\n actions,\n content: children,\n description,\n banners\n }\n ]}\n currentStepId={stepId}\n ref={ref}\n />\n );\n }\n);\n\nexport default Form;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,SAAS,EACT,aAAa,EAEb,YAAY,EAMb,MAAM,OAAO,CAAC;AAIf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OAAO,CAAC,CAAC;IACrD,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAgBD,eAAO,MAAM,mBAAmB,uIAsB/B,CAAC;AAIF,eAAO,MAAM,eAAe,qHAsC1B,CAAC;AAMH,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,GAAG,YAAY,CA4HhD,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -7,7 +7,11 @@ import Actions from '../Actions';
7
7
  import { useUID } from '../../hooks';
8
8
  import Label, { StyledLabel } from '../Label';
9
9
  import { calculateFontSize } from '../../styles';
10
- import Icon from '../Icon';
10
+ import Icon, { registerIcon } from '../Icon';
11
+ import * as warnSolidIcon from '../Icon/icons/warn-solid.icon';
12
+ import * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';
13
+ import * as checkIcon from '../Icon/icons/check.icon';
14
+ registerIcon(warnSolidIcon, flagWaveSolidIcon, checkIcon);
11
15
  const StyledStatusIcon = styled(Icon)(({ theme, status }) => {
12
16
  return css `
13
17
  height: 1em;
@@ -62,7 +66,7 @@ export const StyledFormField = styled.div(props => {
62
66
  `;
63
67
  });
64
68
  StyledFormField.defaultProps = defaultThemeProp;
65
- const statusIconMap = { error: 'warn-solid', warning: 'warn', success: 'check' };
69
+ const statusIconMap = { error: 'warn-solid', warning: 'flag-wave-solid', success: 'check' };
66
70
  const FormField = forwardRef((props, ref) => {
67
71
  const uid = useUID();
68
72
  const { children: controlElement, id = uid, as = 'div', label, labelAs = 'label', labelFor = id, labelId, labelHidden = false, labelAfter = false, info, status, charLimitDisplay, required = false, disabled = false, readOnly = false, inline = false, actions, container, ...restProps } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,YAAY,EAEZ,SAAS,EACT,QAAQ,EAER,UAAU,EAEX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE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Content":["import {\n FC,\n ReactNode,\n ComponentType,\n cloneElement,\n ReactElement,\n useEffect,\n useState,\n PropsWithoutRef,\n forwardRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize } from '../../styles';\nimport Icon from '../Icon';\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default \"label\"\n */\n labelAs?: LabelProps['as'];\n /**\n * Overrides the for attribute on the label. If this is not set it will default to the forms id.\n * @default undefined\n */\n labelFor?: LabelProps['htmlFor'];\n /**\n * Sets the id of the label.\n * @default undefined\n */\n labelId?: LabelProps['id'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default \"div\"\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: Exclude<FlexProps['container'], boolean>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(\n ({ theme, status }) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${theme.components['form-field'][status]['status-color']};\n vertical-align: baseline;\n margin-inline-end: 0.5ch;\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<Pick<FormControlProps, 'status'>>(\n ({\n status,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n }\n }) => {\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n max-width: max-content;\n margin-top: calc(0.25 * ${spacing});\n font-size: ${infoFontSize};\n word-break: break-word;\n ${status &&\n formField[status] &&\n css`\n color: ${formField[status]['status-color']};\n `}\n `;\n }\n);\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledFormField = styled.div<FormFieldProps>(props => {\n const {\n disabled,\n required,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n > ${StyledLabel} {\n margin-bottom: calc(0.25 * ${spacing});\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'warn', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormFieldProps>, ref: Ref<HTMLElement>) => {\n const uid = useUID();\n const {\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs = 'label',\n labelFor = id,\n labelId,\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n ...restProps\n } = props;\n\n const labelAsLegend: boolean = labelAs === 'legend';\n\n const styledLabel = (\n <Label\n id={labelId}\n as={labelAs}\n htmlFor={labelAs === 'label' ? labelFor : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={inline}\n >\n {status && !labelHidden && (\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n )}\n {label}\n </Label>\n );\n\n /*\n We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.\n This is to ensure screen readers will announce info on errors when role is set to alert.\n Needs testing to confirm. Currently the expected sequence would be:\n - FormField renders with no error and no info\n - user input triggers an error status\n - props passed set error status and provide info text\n - effect runs and sets live region state which renders and is announced\n */\n const [liveRegionInfo, setLiveRegionInfo] = useState<ReactNode>(null);\n\n useEffect(() => {\n setLiveRegionInfo(info);\n }, [info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'] = labelAsLegend\n ? controlElement\n : cloneElement(controlElement as ReactElement, {\n 'aria-describedby': info && `${id}-info`\n });\n\n if (actions) {\n content = (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = info ? (\n /*\n Region for additional info, help or error message.\n Withholding aria-live=\"assertive\" to avoid iOS issue. See below.\n https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles\n */\n <StyledFormFieldInfo\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n id={`${id}-info`}\n >\n {liveRegionInfo}\n </StyledFormFieldInfo>\n ) : undefined;\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: inline ? 'row' : 'column',\n alignItems: inline ? 'center' : undefined,\n ...container\n }}\n as={StyledFormField}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={ref}\n >\n {(labelAsLegend || !labelAfter) && styledLabel}\n {content}\n {!labelAsLegend && labelAfter && styledLabel}\n {infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
1
+ {"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../src/components/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,YAAY,EAEZ,SAAS,EACT,QAAQ,EAER,UAAU,EAEX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAmB,MAAM,SAAS,CAAC;AAC1C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,EAAc,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,iBAAiB,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AAEtD,YAAY,CAAC,aAAa,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;AA2D1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CACnC,CAAC,EAAE,KAAK,EAAE,MAAM,E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AI,IAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,YAAG,gBAAgB,GAAQ,IAC/C,CACR,CAAC;KACH;IAED,OAAO,CACL,MAAC,IAAI,OACC,SAAS,EACb,SAAS,EAAE;YACT,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;YACpC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACzC,GAAG,SAAS;SACb,EACD,EAAE,EAAE,eAAe,EACnB,EAAE,EAAE,GAAG,EAAE,QAAQ,EACjB,WAAW,EAAE,EAAE,EACf,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,sBACA,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,EAClE,GAAG,EAAE,GAAG,aAEP,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,IAAI,WAAW,EAC7C,OAAO,EACP,CAAC,aAAa,IAAI,UAAU,IAAI,WAAW,EAC3C,WAAW,IACP,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n FC,\n ReactNode,\n ComponentType,\n cloneElement,\n ReactElement,\n useEffect,\n useState,\n PropsWithoutRef,\n forwardRef,\n Ref\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { Action, ForwardProps, OmitStrict } from '../../types';\nimport Flex, { FlexProps } from '../Flex';\nimport Actions from '../Actions';\nimport { FormControlProps } from '../FormControl';\nimport { useUID } from '../../hooks';\nimport Label, { LabelProps, StyledLabel } from '../Label';\nimport { calculateFontSize } from '../../styles';\nimport Icon, { registerIcon } from '../Icon';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport * as flagWaveSolidIcon from '../Icon/icons/flag-wave-solid.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\n\nregisterIcon(warnSolidIcon, flagWaveSolidIcon, checkIcon);\n\nexport interface FormFieldProps\n extends OmitStrict<FormControlProps, 'placeholder' | 'value' | 'defaultValue'> {\n /** Pass a single form control component i.e. Input | TextArea | Select | etc.. */\n children: ReactElement | ReactElement[];\n /**\n * An id is required to connect a FormField's wrapping element, control element and info(aria-describedby) live region.\n * A random id will be generated if none is provided.\n * Since MOST FormControls should possess an id(excl. i.e RadioCheckGroup and others) this can be used.\n * The id prop will be used to generate the following:\n * - FormControl <-> Label association via a Label's htmlFor prop.\n * - FormField's wrapping element id {id}-field.\n * - FormField info element id ${id}-info.\n */\n id?: string;\n /**\n * Determines how the wrapping label should be rendered.\n * @default \"label\"\n */\n labelAs?: LabelProps['as'];\n /**\n * Overrides the for attribute on the label. If this is not set it will default to the forms id.\n * @default undefined\n */\n labelFor?: LabelProps['htmlFor'];\n /**\n * Sets the id of the label.\n * @default undefined\n */\n labelId?: LabelProps['id'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: boolean;\n /**\n * Visually places the label after the input.\n * @default false\n */\n labelAfter?: boolean;\n /**\n * Wrapping HTML element tag. Renders as a fieldset for grouped elements i.e. RadioButtons/CheckboxGroup\n * @default \"div\"\n */\n as?: 'div' | 'fieldset' | ComponentType<any>;\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: boolean;\n /** Optionally utilized by Input or Select. */\n actions?: Action[];\n /** Enables Flex container prop pass through. */\n container?: Exclude<FlexProps['container'], boolean>;\n /** Character remaining count. Typically used on Textareas only */\n charLimitDisplay?: ReactNode;\n}\n\nconst StyledStatusIcon = styled(Icon)<{ status: NonNullable<FormFieldProps['status']> }>(\n ({ theme, status }) => {\n return css`\n height: 1em;\n width: 1em;\n color: ${theme.components['form-field'][status]['status-color']};\n vertical-align: baseline;\n margin-inline-end: 0.5ch;\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledFormFieldInfo = styled.div<Pick<FormControlProps, 'status'>>(\n ({\n status,\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale, spacing },\n components: { 'form-field': formField }\n }\n }) => {\n const { xxs: infoFontSize } = calculateFontSize(fontSize, fontScale);\n\n return css`\n max-width: max-content;\n margin-top: calc(0.25 * ${spacing});\n font-size: ${infoFontSize};\n word-break: break-word;\n ${status &&\n formField[status] &&\n css`\n color: ${formField[status]['status-color']};\n `}\n `;\n }\n);\n\nStyledFormFieldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledFormField = styled.div<FormFieldProps>(props => {\n const {\n disabled,\n required,\n theme: {\n base: {\n palette: { urgent },\n 'disabled-opacity': disabledOpacity,\n spacing\n }\n }\n } = props;\n\n return css`\n ${disabled &&\n css`\n opacity: ${disabledOpacity};\n -webkit-user-select: none;\n user-select: none;\n `}\n position: relative;\n border: 0;\n\n > ${StyledLabel} {\n margin-bottom: calc(0.25 * ${spacing});\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n\n &::after {\n display: ${required ? 'inline' : 'none'};\n content: '\\\\00a0*';\n vertical-align: top;\n color: ${urgent};\n }\n }\n `;\n});\n\nStyledFormField.defaultProps = defaultThemeProp;\n\nconst statusIconMap = { error: 'warn-solid', warning: 'flag-wave-solid', success: 'check' };\n\nconst FormField: FC<FormFieldProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FormFieldProps>, ref: Ref<HTMLElement>) => {\n const uid = useUID();\n const {\n children: controlElement,\n id = uid,\n as = 'div',\n label,\n labelAs = 'label',\n labelFor = id,\n labelId,\n labelHidden = false,\n labelAfter = false,\n info,\n status,\n charLimitDisplay,\n required = false,\n disabled = false,\n readOnly = false,\n inline = false,\n actions,\n container,\n ...restProps\n } = props;\n\n const labelAsLegend: boolean = labelAs === 'legend';\n\n const styledLabel = (\n <Label\n id={labelId}\n as={labelAs}\n htmlFor={labelAs === 'label' ? labelFor : undefined}\n labelHidden={labelHidden}\n onClick={(e: MouseEvent) => {\n if (readOnly) e.preventDefault();\n }}\n inline={inline}\n >\n {status && !labelHidden && (\n <StyledStatusIcon status={status} name={statusIconMap[status]} />\n )}\n {label}\n </Label>\n );\n\n /*\n We have to use an internal state and an effect to set the text value of info after the DOM element is rendered.\n This is to ensure screen readers will announce info on errors when role is set to alert.\n Needs testing to confirm. Currently the expected sequence would be:\n - FormField renders with no error and no info\n - user input triggers an error status\n - props passed set error status and provide info text\n - effect runs and sets live region state which renders and is announced\n */\n const [liveRegionInfo, setLiveRegionInfo] = useState<ReactNode>(null);\n\n useEffect(() => {\n setLiveRegionInfo(info);\n }, [info]);\n\n // fieldset or single form control element\n let content: FormFieldProps['children'] = labelAsLegend\n ? controlElement\n : cloneElement(controlElement as ReactElement, {\n 'aria-describedby': info && `${id}-info`\n });\n\n if (actions) {\n content = (\n <Flex container={{ alignItems: 'center', gap: 0.5 }}>\n {content}\n <Actions items={actions} menuAt={3} />\n </Flex>\n );\n }\n\n let infoContent = info ? (\n /*\n Region for additional info, help or error message.\n Withholding aria-live=\"assertive\" to avoid iOS issue. See below.\n https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions#Preferring_specialized_live_region_roles\n */\n <StyledFormFieldInfo\n status={status}\n role={status === 'error' || status === 'warning' ? 'alert' : undefined}\n id={`${id}-info`}\n >\n {liveRegionInfo}\n </StyledFormFieldInfo>\n ) : undefined;\n\n if (charLimitDisplay) {\n infoContent = (\n <Flex container={{ justify: infoContent ? 'between' : 'end', gap: 1 }}>\n {infoContent}\n <Flex item={{ shrink: 0 }}>{charLimitDisplay}</Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: inline ? 'row' : 'column',\n alignItems: inline ? 'center' : undefined,\n ...container\n }}\n as={StyledFormField}\n id={`${id}-field`}\n forwardedAs={as}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n aria-describedby={labelAsLegend && info ? `${id}-info` : undefined}\n ref={ref}\n >\n {(labelAsLegend || !labelAfter) && styledLabel}\n {content}\n {!labelAsLegend && labelAfter && styledLabel}\n {infoContent}\n </Flex>\n );\n }\n);\n\nexport default FormField;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EACjB,GAAG,EAEH,aAAa,EACd,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,cAAc;IAC1D,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CAC1B;AAID,eAAO,MAAM,YAAY,aAAc,UAAU,EAAE,SAIlD,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,UAAU,EAAE,SAIvD,CAAC;AAEF,eAAO,MAAM,UAAU,yGAMtB,CAAC;AAIF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAwCrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EACjB,GAAG,EAEH,aAAa,EACd,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,cAAc;IAC1D,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC;CAC1B;AAID,eAAO,MAAM,YAAY,aAAc,UAAU,EAAE,SAIlD,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,UAAU,EAAE,SAIvD,CAAC;AAEF,eAAO,MAAM,UAAU,yGAMtB,CAAC;AAIF,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAkCrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -45,7 +45,7 @@ const Icon = forwardRef(({ name, ...restProps }, ref) => {
45
45
  controller.abort();
46
46
  };
47
47
  }, [name]);
48
- return (_jsx(StyledIcon, { ...restProps, role: 'img', ref: ref, xmlns: 'http://www.w3.org/2000/svg', viewBox: iconDef.viewBox, children: _jsx(iconDef.Component, {}) }));
48
+ return (_jsx(StyledIcon, { role: 'presentation', ...restProps, viewBox: iconDef.viewBox, ref: ref, children: _jsx(iconDef.Component, {}) }));
49
49
  });
50
50
  export default Icon;
51
51
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAoBvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,G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AAC,MAAM,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAEpF,YAAY,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAC5B,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,UAAU,OACL,SAAS,EACb,IAAI,EAAC,KAAK,EACV,GAAG,EAAE,GAAG,EACR,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAE,OAAO,CAAC,OAAO,YAExB,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useEffect,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n name: string;\n}\n\nexport interface IconProps extends BaseProps, NoChildrenProp {\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /** Ref for the wrapping element. */\n ref?: Ref<SVGSVGElement>;\n}\n\nconst iconRegistry = new Map<string, IconDefinition>();\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n if (!iconRegistry.has(name)) iconRegistry.set(name, iconDef);\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n iconRegistry.set(name, iconDef);\n });\n};\n\nexport const StyledIcon = styled.svg`\n display: inline-block;\n fill: currentColor;\n height: 1.125rem;\n width: 1.125rem;\n vertical-align: middle;\n`;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon: FunctionComponent<IconProps & ForwardProps> = forwardRef(\n ({ name, ...restProps }: PropsWithoutRef<IconProps>, ref: IconProps['ref']) => {\n const [iconDef, setIconDef] = useState(iconRegistry.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.has(name)) {\n setIconDef(iconRegistry.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n import(`./icons/${encodeURIComponent(name)}.icon`)\n .then((module: IconModule) => {\n if (!module.name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n if (!controller.signal.aborted)\n setIconDef(iconRegistry.get(module.name) ?? emptyIconDefinition);\n })\n .catch(() => {\n if (!controller.signal.aborted) setIconDef(emptyIconDefinition);\n });\n\n return () => {\n controller.abort();\n };\n }, [name]);\n\n return (\n <StyledIcon\n {...restProps}\n role='img'\n ref={ref}\n xmlns='http://www.w3.org/2000/svg'\n viewBox={iconDef.viewBox}\n >\n <iconDef.Component />\n </StyledIcon>\n );\n }\n);\n\nexport default Icon;\n"]}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAoBvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAmB,EAAE,EAAE;IACrD,K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AE;YAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAEpF,YAAY,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAC5B,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO;gBAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,UAAU,IAAC,IAAI,EAAC,cAAc,KAAK,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,YAC/E,KAAC,OAAO,CAAC,SAAS,KAAG,GACV,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n useEffect,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n ComponentType\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\n\nexport interface IconDefinition {\n Component: ComponentType;\n viewBox?: string;\n}\n\nexport interface IconModule extends IconDefinition {\n name: string;\n}\n\nexport interface IconProps extends BaseProps, NoChildrenProp {\n /** The name indicating the Cosmos Icon. Reference the catalog above for the available names. */\n name: string;\n /** Ref for the wrapping element. */\n ref?: Ref<SVGSVGElement>;\n}\n\nconst iconRegistry = new Map<string, IconDefinition>();\n\nexport const registerIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n if (!iconRegistry.has(name)) iconRegistry.set(name, iconDef);\n });\n};\n\nexport const forceRegisterIcon = (...icons: IconModule[]) => {\n icons.forEach(({ name, ...iconDef }) => {\n iconRegistry.set(name, iconDef);\n });\n};\n\nexport const StyledIcon = styled.svg`\n display: inline-block;\n fill: currentColor;\n height: 1.125rem;\n width: 1.125rem;\n vertical-align: middle;\n`;\n\nconst emptyIconDefinition: Readonly<IconDefinition> = Object.freeze({ Component: () => null });\n\nconst Icon: FunctionComponent<IconProps & ForwardProps> = forwardRef(\n ({ name, ...restProps }: PropsWithoutRef<IconProps>, ref: IconProps['ref']) => {\n const [iconDef, setIconDef] = useState(iconRegistry.get(name) ?? emptyIconDefinition);\n\n useEffect(() => {\n if (iconRegistry.has(name)) {\n setIconDef(iconRegistry.get(name)!);\n return;\n }\n\n const controller = new AbortController();\n import(`./icons/${encodeURIComponent(name)}.icon`)\n .then((module: IconModule) => {\n if (!module.name || !module.Component) throw new Error('Malformed icon definition');\n\n registerIcon(module);\n if (!controller.signal.aborted)\n setIconDef(iconRegistry.get(module.name) ?? emptyIconDefinition);\n })\n .catch(() => {\n if (!controller.signal.aborted) setIconDef(emptyIconDefinition);\n });\n\n return () => {\n controller.abort();\n };\n }, [name]);\n\n return (\n <StyledIcon role='presentation' {...restProps} viewBox={iconDef.viewBox} ref={ref}>\n <iconDef.Component />\n </StyledIcon>\n );\n }\n);\n\nexport default Icon;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,iBAAiB,EACjB,GAAG,EAMJ,MAAM,OAAO,CAAC;AAIf,OAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAStD,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C,o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AW,CAAC,MAAM,CAAC,CAAC;IAC3B,mFAAmF;IACnF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1C,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,yGAE7B,CAAC;AAIF,eAAO,MAAM,oBAAoB,oLAyC/B,CAAC;AAIH,eAAO,MAAM,UAAU,iJAAmB,CAAC;AAI3C,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAmHrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -10,7 +10,6 @@ import { useBreakpoint, useConsolidatedRef, useI18n, useUID } from '../../hooks'
10
10
  import { tryCatch } from '../../utils';
11
11
  import { calculateFontSize } from '../../styles';
12
12
  import { ModalManagerContext } from '../Modal';
13
- import { modalInitializedKey } from '../Modal/Modal.types';
14
13
  import AppShellContext from '../AppShell/AppShellContext';
15
14
  export const StyledLinkPopover = styled.div `
16
15
  background-color: ${props => props.theme.components.tooltip['background-color']};
@@ -62,7 +61,7 @@ export const StyledLink = styled(Button) ``;
62
61
  StyledLink.defaultProps = defaultThemeProp;
63
62
  const Link = forwardRef(({ href, variant = 'link', previewable, onPreview, ...restProps }, ref) => {
64
63
  const { ModalContext } = useContext(ModalManagerContext);
65
- const { [modalInitializedKey]: inModal } = useContext(ModalContext);
64
+ const { initialized: inModal } = useContext(ModalContext);
66
65
  const { previewTriggerRef } = useContext(AppShellContext);
67
66
  const uid = useUID();
68
67
  const linkRef = useConsolidatedRef(ref);
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":";AAA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State,\n useRef,\n KeyboardEvent,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport Button, { ButtonProps } from '../Button';\nimport Popover from '../Popover';\nimport BareButton from '../Button/BareButton';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useBreakpoint, useConsolidatedRef, useI18n, useUID } from '../../hooks';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize } from '../../styles';\nimport { ModalManagerContext } from '../Modal';\nimport { modalInitializedKey } from '../Modal/Modal.types';\nimport AppShellContext from '../AppShell/AppShellContext';\n\nexport interface LinkProps extends BaseProps {\n /** Text or content for the Link. */\n children: ReactNode;\n /** URL or DOM id to navigate to. */\n href: string;\n /**\n * Controls the styling of the Link.\n * @default \"link\"\n */\n variant?: ButtonProps['variant'];\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Link. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: ButtonProps['icon'];\n /** Determines if the Link should render a popover when focused or hovered over. */\n previewable?: boolean;\n /** Callback function that is run when the preview popover is interacted with. */\n onPreview?: (e: { href: string }) => void;\n /** Specifies where to open the link href. */\n target?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\nexport const StyledLinkPopover = styled.div`\n background-color: ${props => props.theme.components.tooltip['background-color']};\n`;\n\nStyledLinkPopover.defaultProps = defaultThemeProp;\n\nexport const StyledLinkPopoverBtn = styled(BareButton)(({ theme }) => {\n const contrastColor = tryCatch(() => readableColor(theme.base.palette.interactive));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n position: relative;\n display: inline-flex;\n align-items: center;\n z-index: 1;\n padding: 0 ${theme.base.spacing};\n min-height: 1.5rem;\n line-height: 1;\n color: ${contrastColor};\n font-size: ${fontSize.xs};\n text-decoration: none;\n\n /* FIXME: Button selector specificity... */\n & + & {\n margin: 0;\n }\n\n & + &::before {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block: 0;\n width: 1px; /* stylelint-disable-line unit-allowed-list */\n background-color: ${contrastColor};\n opacity: ${theme.base.transparency['transparent-3']};\n }\n\n &:hover,\n &:active {\n text-decoration: underline;\n }\n\n &:focus {\n box-shadow: inset 0 0 0 0.0625rem ${theme.base.palette.light},\n 0 0 0.125rem 0.0625rem ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledLinkPopoverBtn.defaultProps = defaultThemeProp;\n\nexport const StyledLink = styled(Button)``;\n\nStyledLink.defaultProps = defaultThemeProp;\n\nconst Link: FunctionComponent<LinkProps & ForwardProps> = forwardRef(\n (\n { href, variant = 'link', previewable, onPreview, ...restProps }: PropsWithoutRef<LinkProps>,\n ref: LinkProps['ref']\n ) => {\n const { ModalContext } = useContext(ModalManagerContext);\n const { [modalInitializedKey]: inModal } = useContext(ModalContext);\n const { previewTriggerRef } = useContext(AppShellContext);\n const uid = useUID();\n const linkRef = useConsolidatedRef(ref);\n const [popover, setPopover] = useState(false);\n const previewBtnRef = useRef<HTMLButtonElement>(null);\n const openInTabBtnRef = useRef<HTMLAnchorElement>(null);\n const isSmallOrAbove = useBreakpoint('sm');\n const t = useI18n();\n\n const openPopover = () => {\n if (isSmallOrAbove) setPopover(true);\n };\n\n const closePopover = () => {\n setPopover(false);\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (event.keyCode === 27) {\n closePopover();\n }\n\n if (event.keyCode === 38 || event.keyCode === 40) {\n previewBtnRef?.current?.focus();\n }\n\n if (event.keyCode === 37 || event.keyCode === 39) {\n if (previewBtnRef.current === document.activeElement) {\n openInTabBtnRef?.current?.focus();\n } else {\n previewBtnRef?.current?.focus();\n }\n }\n };\n\n const onEnterLink = () => {\n if (previewable) openPopover();\n };\n\n const onPreviewClick = () => {\n previewTriggerRef.current = linkRef.current;\n onPreview?.({ href });\n };\n\n return (\n <>\n <StyledLink\n href={href}\n variant={variant}\n ref={linkRef as any}\n {...restProps}\n onMouseEnter={onEnterLink}\n onMouseLeave={closePopover}\n onFocus={onEnterLink}\n onKeyUp={onKeyUp}\n onBlur={closePopover}\n aria-describedby={previewable ? `${uid}-preview-instructions` : undefined}\n />\n\n <Popover\n show={popover}\n groupId='link_preview'\n showDelay='short'\n hideDelay='short'\n placement='bottom'\n target={linkRef.current}\n onMouseEnter={openPopover}\n onMouseLeave={closePopover}\n as={StyledLinkPopover}\n arrow\n >\n {!inModal && (\n <StyledLinkPopoverBtn\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n onFocus={openPopover}\n onBlur={closePopover}\n onKeyUp={onKeyUp}\n >\n {t('preview')}\n </StyledLinkPopoverBtn>\n )}\n <StyledLinkPopoverBtn\n forwardedAs='a'\n href={href}\n ref={openInTabBtnRef}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n onFocus={openPopover}\n onBlur={closePopover}\n onKeyUp={onKeyUp}\n >\n {t('link_open_in_tab_text')}\n </StyledLinkPopoverBtn>\n </Popover>\n\n {previewable && (\n <span id={`${uid}-preview-instructions`} hidden>\n {t('preview_link_arrow_navigation')}\n </span>\n )}\n </>\n );\n }\n);\n\nexport default Link;\n"]}
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../src/components/Link/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,QAAQ,EACR,MAAM,EAEN,UAAU,EACX,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,MAAuB,MAAM,WAAW,CAAC;AAChD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,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IACnB,OAAO,QACP,IAAI,EAAC,QAAQ,EACb,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAC,IAAI,EACb,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,YAEf,CAAC,CAAC,SAAS,CAAC,GACQ,CACxB,EACD,KAAC,oBAAoB,IACnB,WAAW,EAAC,GAAG,EACf,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,eAAe,EACpB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,YAAY,EAChB,QAAQ,EAAC,IAAI,EACb,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,OAAO,YAEf,CAAC,CAAC,uBAAuB,CAAC,GACN,IACf,EAET,WAAW,IAAI,CACd,eAAM,EAAE,EAAE,GAAG,GAAG,uBAAuB,EAAE,MAAM,kBAC5C,CAAC,CAAC,+BAA+B,CAAC,GAC9B,CACR,IACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import {\n forwardRef,\n ReactNode,\n FunctionComponent,\n Ref,\n PropsWithoutRef,\n useState,\n useRef,\n KeyboardEvent,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport Button, { ButtonProps } from '../Button';\nimport Popover from '../Popover';\nimport BareButton from '../Button/BareButton';\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useBreakpoint, useConsolidatedRef, useI18n, useUID } from '../../hooks';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize } from '../../styles';\nimport { ModalManagerContext } from '../Modal';\nimport AppShellContext from '../AppShell/AppShellContext';\n\nexport interface LinkProps extends BaseProps {\n /** Text or content for the Link. */\n children: ReactNode;\n /** URL or DOM id to navigate to. */\n href: string;\n /**\n * Controls the styling of the Link.\n * @default \"link\"\n */\n variant?: ButtonProps['variant'];\n /**\n * Set the Icon prop to `true` if you're using just an Icon in your Link. Make sure to pass an Icon as children if `true`.\n * @default false\n */\n icon?: ButtonProps['icon'];\n /** Determines if the Link should render a popover when focused or hovered over. */\n previewable?: boolean;\n /** Callback function that is run when the preview popover is interacted with. */\n onPreview?: (e: { href: string }) => void;\n /** Specifies where to open the link href. */\n target?: string;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement>;\n}\n\nexport const StyledLinkPopover = styled.div`\n background-color: ${props => props.theme.components.tooltip['background-color']};\n`;\n\nStyledLinkPopover.defaultProps = defaultThemeProp;\n\nexport const StyledLinkPopoverBtn = styled(BareButton)(({ theme }) => {\n const contrastColor = tryCatch(() => readableColor(theme.base.palette.interactive));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n position: relative;\n display: inline-flex;\n align-items: center;\n z-index: 1;\n padding: 0 ${theme.base.spacing};\n min-height: 1.5rem;\n line-height: 1;\n color: ${contrastColor};\n font-size: ${fontSize.xs};\n text-decoration: none;\n\n /* FIXME: Button selector specificity... */\n & + & {\n margin: 0;\n }\n\n & + &::before {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block: 0;\n width: 1px; /* stylelint-disable-line unit-allowed-list */\n background-color: ${contrastColor};\n opacity: ${theme.base.transparency['transparent-3']};\n }\n\n &:hover,\n &:active {\n text-decoration: underline;\n }\n\n &:focus {\n box-shadow: inset 0 0 0 0.0625rem ${theme.base.palette.light},\n 0 0 0.125rem 0.0625rem ${theme.base.palette.interactive};\n }\n `;\n});\n\nStyledLinkPopoverBtn.defaultProps = defaultThemeProp;\n\nexport const StyledLink = styled(Button)``;\n\nStyledLink.defaultProps = defaultThemeProp;\n\nconst Link: FunctionComponent<LinkProps & ForwardProps> = forwardRef(\n (\n { href, variant = 'link', previewable, onPreview, ...restProps }: PropsWithoutRef<LinkProps>,\n ref: LinkProps['ref']\n ) => {\n const { ModalContext } = useContext(ModalManagerContext);\n const { initialized: inModal } = useContext(ModalContext);\n const { previewTriggerRef } = useContext(AppShellContext);\n const uid = useUID();\n const linkRef = useConsolidatedRef(ref);\n const [popover, setPopover] = useState(false);\n const previewBtnRef = useRef<HTMLButtonElement>(null);\n const openInTabBtnRef = useRef<HTMLAnchorElement>(null);\n const isSmallOrAbove = useBreakpoint('sm');\n const t = useI18n();\n\n const openPopover = () => {\n if (isSmallOrAbove) setPopover(true);\n };\n\n const closePopover = () => {\n setPopover(false);\n };\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (event.keyCode === 27) {\n closePopover();\n }\n\n if (event.keyCode === 38 || event.keyCode === 40) {\n previewBtnRef?.current?.focus();\n }\n\n if (event.keyCode === 37 || event.keyCode === 39) {\n if (previewBtnRef.current === document.activeElement) {\n openInTabBtnRef?.current?.focus();\n } else {\n previewBtnRef?.current?.focus();\n }\n }\n };\n\n const onEnterLink = () => {\n if (previewable) openPopover();\n };\n\n const onPreviewClick = () => {\n previewTriggerRef.current = linkRef.current;\n onPreview?.({ href });\n };\n\n return (\n <>\n <StyledLink\n href={href}\n variant={variant}\n ref={linkRef as any}\n {...restProps}\n onMouseEnter={onEnterLink}\n onMouseLeave={closePopover}\n onFocus={onEnterLink}\n onKeyUp={onKeyUp}\n onBlur={closePopover}\n aria-describedby={previewable ? `${uid}-preview-instructions` : undefined}\n />\n\n <Popover\n show={popover}\n groupId='link_preview'\n showDelay='short'\n hideDelay='short'\n placement='bottom'\n target={linkRef.current}\n onMouseEnter={openPopover}\n onMouseLeave={closePopover}\n as={StyledLinkPopover}\n arrow\n >\n {!inModal && (\n <StyledLinkPopoverBtn\n preview\n type='button'\n ref={previewBtnRef}\n onClick={onPreviewClick}\n tabIndex='-1'\n onFocus={openPopover}\n onBlur={closePopover}\n onKeyUp={onKeyUp}\n >\n {t('preview')}\n </StyledLinkPopoverBtn>\n )}\n <StyledLinkPopoverBtn\n forwardedAs='a'\n href={href}\n ref={openInTabBtnRef}\n target='_blank'\n rel='noreferrer'\n tabIndex='-1'\n onFocus={openPopover}\n onBlur={closePopover}\n onKeyUp={onKeyUp}\n >\n {t('link_open_in_tab_text')}\n </StyledLinkPopoverBtn>\n </Popover>\n\n {previewable && (\n <span id={`${uid}-preview-instructions`} hidden>\n {t('preview_link_arrow_navigation')}\n </span>\n )}\n </>\n );\n }\n);\n\nexport default Link;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CommaSeparatedList.d.ts","sourceRoot":"","sources":["../../../src/components/List/CommaSeparatedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAIT,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQtD,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,oBAAoB;IACpB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,wBAAwB,yGAOnC,CAAC;AAIH,eAAO,MAAM,4BAA4B,wGAMxC,CAAC;AAyDF,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAmBjF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"CommaSeparatedList.d.ts","sourceRoot":"","sources":["../../../src/components/List/CommaSeparatedList.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EAIT,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQtD,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,oBAAoB;IACpB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,wBAAwB,yGAAe,CAAC;AAErD,eAAO,MAAM,4BAA4B,wGAMxC,CAAC;AAyDF,QAAA,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAuBjF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,21 +1,13 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useState, useLayoutEffect, useMemo, useRef } from 'react';
3
- import styled, { css } from 'styled-components';
4
- import { defaultThemeProp } from '../../theme';
3
+ import styled from 'styled-components';
5
4
  import { useI18n } from '../../hooks';
6
5
  import Button from '../Button';
7
6
  import Text from '../Text';
8
7
  import ExpandCollapse from '../ExpandCollapse';
9
8
  import { windowIsAvailable } from '../../utils';
10
- export const StyledCommaSeparatedList = styled.div(({ theme }) => {
11
- return css `
12
- padding: ${theme.base.spacing};
13
- h3 {
14
- padding-block-end: calc(2 * ${theme.base.spacing});
15
- }
16
- `;
17
- });
18
- StyledCommaSeparatedList.defaultProps = defaultThemeProp;
9
+ import Flex from '../Flex';
10
+ export const StyledCommaSeparatedList = styled.div ``;
19
11
  export const StyledCommaSeparatedListItem = styled.li `
20
12
  display: inline;
21
13
 
@@ -50,10 +42,10 @@ const DynamicHeightValue = ({ children }) => {
50
42
  observer.disconnect();
51
43
  };
52
44
  }, [textRef.current, maxTextHeight]);
53
- return (_jsxs(_Fragment, { children: [_jsx(ExpandCollapse, { collapsed: collapsed, min: exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content', children: _jsx("div", { ref: textRef, children: children }) }), exceedsMaxHeight && (_jsx(Button, { variant: 'link', onClick: () => setCollapsed(current => !current), children: collapsed ? t('show_more') : t('show_less') }))] }));
45
+ return (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start', gap: 0.25 }, children: [_jsx(ExpandCollapse, { collapsed: collapsed, min: exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content', children: _jsx("div", { ref: textRef, children: children }) }), exceedsMaxHeight && (_jsx(Button, { variant: 'link', onClick: () => setCollapsed(current => !current), children: collapsed ? t('show_more') : t('show_less') }))] }));
54
46
  };
55
47
  const CommaSeparatedList = forwardRef(({ items, heading }, ref) => {
56
- return (_jsxs(StyledCommaSeparatedList, { ref: ref, children: [heading && _jsx(Text, { variant: 'h3', children: heading }), _jsx(DynamicHeightValue, { children: _jsx("ul", { style: { listStyle: 'none' }, children: items.map((value, i) => (
48
+ return (_jsxs(Flex, { container: { direction: 'column', wrap: 'wrap', gap: 2 }, as: StyledCommaSeparatedList, ref: ref, children: [heading && _jsx(Text, { variant: 'h3', children: heading }), _jsx(DynamicHeightValue, { children: _jsx("ul", { children: items.map((value, i) => (
57
49
  // eslint-disable-next-line react/no-array-index-key
58
50
  _jsx(StyledCommaSeparatedListItem, { children: value }, i))) }) })] }));
59
51
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CommaSeparatedList.js","sourceRoot":"","sources":["../../../src/components/List/CommaSeparatedList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EACV,QAAQ,EAGR,eAAe,EACf,OAAO,EACP,MAAM,EACP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAWhD,MAAM,CAAC,MAAM,wBAAwB,G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AAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;oBACvB,oDAAoD;oBACpD,KAAC,4BAA4B,cAAU,KAAK,IAAT,CAAC,CAAwC,CAC7E,CAAC,GACC,GACc,IACI,CAC5B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n forwardRef,\n useState,\n PropsWithoutRef,\n Ref,\n useLayoutEffect,\n useMemo,\n useRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useI18n } from '../../hooks';\nimport Button from '../Button';\nimport Text from '../Text';\nimport ExpandCollapse from '../ExpandCollapse';\nimport { windowIsAvailable } from '../../utils';\n\nexport interface CommaSeparatedListProps extends BaseProps {\n /** List content. */\n items: ReactNode[];\n /** List Heading. */\n heading?: string;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledCommaSeparatedList = styled.div(({ theme }) => {\n return css`\n padding: ${theme.base.spacing};\n h3 {\n padding-block-end: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledCommaSeparatedList.defaultProps = defaultThemeProp;\n\nexport const StyledCommaSeparatedListItem = styled.li`\n display: inline;\n\n &:not(:last-child)::after {\n content: ', ';\n }\n`;\n\nconst DynamicHeightValue = ({ children }: { children: ReactNode }): JSX.Element => {\n const [collapsed, setCollapsed] = useState(true);\n const [exceedsMaxHeight, setExceedsMaxHeight] = useState(false);\n const textRef = useRef<HTMLDivElement>(null);\n const t = useI18n();\n\n const maxTextHeight = useMemo(() => {\n if (!windowIsAvailable) return Infinity;\n\n const computedLineHeight =\n Number.parseInt(\n window.getComputedStyle(document.documentElement).getPropertyValue('font-size'),\n 10\n ) * 1.25;\n\n return 3 * computedLineHeight;\n }, []);\n\n useLayoutEffect(() => {\n if (!textRef.current) return;\n\n const observer = new ResizeObserver(entries => {\n const exceedsHeight = entries.some(({ target, contentRect }) => {\n if (target !== textRef.current) return;\n\n return contentRect.height > maxTextHeight;\n });\n\n setExceedsMaxHeight(exceedsHeight);\n });\n\n observer.observe(textRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [textRef.current, maxTextHeight]);\n\n return (\n <>\n <ExpandCollapse\n collapsed={collapsed}\n min={exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content'}\n >\n <div ref={textRef}>{children}</div>\n </ExpandCollapse>\n {exceedsMaxHeight && (\n <Button variant='link' onClick={() => setCollapsed(current => !current)}>\n {collapsed ? t('show_more') : t('show_less')}\n </Button>\n )}\n </>\n );\n};\n\nconst CommaSeparatedList: FunctionComponent<CommaSeparatedListProps & ForwardProps> = forwardRef(\n (\n { items, heading }: PropsWithoutRef<CommaSeparatedListProps>,\n ref: CommaSeparatedListProps['ref']\n ) => {\n return (\n <StyledCommaSeparatedList ref={ref}>\n {heading && <Text variant='h3'>{heading}</Text>}\n <DynamicHeightValue>\n <ul style={{ listStyle: 'none' }}>\n {items.map((value, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <StyledCommaSeparatedListItem key={i}>{value}</StyledCommaSeparatedListItem>\n ))}\n </ul>\n </DynamicHeightValue>\n </StyledCommaSeparatedList>\n );\n }\n);\n\nexport default CommaSeparatedList;\n"]}
1
+ {"version":3,"file":"CommaSeparatedList.js","sourceRoot":"","sources":["../../../src/components/List/CommaSeparatedList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,EACV,QAAQ,EAGR,eAAe,EACf,OAAO,EACP,MAAM,EACP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OA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AAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,GAAQ,EAC/C,KAAC,kBAAkB,cACjB,uBACG,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;oBACvB,oDAAoD;oBACpD,KAAC,4BAA4B,cAAU,KAAK,IAAT,CAAC,CAAwC,CAC7E,CAAC,GACC,GACc,IAChB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n forwardRef,\n useState,\n PropsWithoutRef,\n Ref,\n useLayoutEffect,\n useMemo,\n useRef\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { useI18n } from '../../hooks';\nimport Button from '../Button';\nimport Text from '../Text';\nimport ExpandCollapse from '../ExpandCollapse';\nimport { windowIsAvailable } from '../../utils';\nimport Flex from '../Flex';\n\nexport interface CommaSeparatedListProps extends BaseProps {\n /** List content. */\n items: ReactNode[];\n /** List Heading. */\n heading?: string;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledCommaSeparatedList = styled.div``;\n\nexport const StyledCommaSeparatedListItem = styled.li`\n display: inline;\n\n &:not(:last-child)::after {\n content: ', ';\n }\n`;\n\nconst DynamicHeightValue = ({ children }: { children: ReactNode }): JSX.Element => {\n const [collapsed, setCollapsed] = useState(true);\n const [exceedsMaxHeight, setExceedsMaxHeight] = useState(false);\n const textRef = useRef<HTMLDivElement>(null);\n const t = useI18n();\n\n const maxTextHeight = useMemo(() => {\n if (!windowIsAvailable) return Infinity;\n\n const computedLineHeight =\n Number.parseInt(\n window.getComputedStyle(document.documentElement).getPropertyValue('font-size'),\n 10\n ) * 1.25;\n\n return 3 * computedLineHeight;\n }, []);\n\n useLayoutEffect(() => {\n if (!textRef.current) return;\n\n const observer = new ResizeObserver(entries => {\n const exceedsHeight = entries.some(({ target, contentRect }) => {\n if (target !== textRef.current) return;\n\n return contentRect.height > maxTextHeight;\n });\n\n setExceedsMaxHeight(exceedsHeight);\n });\n\n observer.observe(textRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, [textRef.current, maxTextHeight]);\n\n return (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 0.25 }}>\n <ExpandCollapse\n collapsed={collapsed}\n min={exceedsMaxHeight ? `${maxTextHeight}px` : 'max-content'}\n >\n <div ref={textRef}>{children}</div>\n </ExpandCollapse>\n {exceedsMaxHeight && (\n <Button variant='link' onClick={() => setCollapsed(current => !current)}>\n {collapsed ? t('show_more') : t('show_less')}\n </Button>\n )}\n </Flex>\n );\n};\n\nconst CommaSeparatedList: FunctionComponent<CommaSeparatedListProps & ForwardProps> = forwardRef(\n (\n { items, heading }: PropsWithoutRef<CommaSeparatedListProps>,\n ref: CommaSeparatedListProps['ref']\n ) => {\n return (\n <Flex\n container={{ direction: 'column', wrap: 'wrap', gap: 2 }}\n as={StyledCommaSeparatedList}\n ref={ref}\n >\n {heading && <Text variant='h3'>{heading}</Text>}\n <DynamicHeightValue>\n <ul>\n {items.map((value, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <StyledCommaSeparatedListItem key={i}>{value}</StyledCommaSeparatedListItem>\n ))}\n </ul>\n </DynamicHeightValue>\n </Flex>\n );\n }\n);\n\nexport default CommaSeparatedList;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Contexts.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Contexts.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,EAEjB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAYvB,eAAO,MAAM,mBAAmB,EAAE,iBAYjC,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAwD,CAAC;AAElF,eAAO,MAAM,mBAAmB,mDAI9B,CAAC"}
1
+ {"version":3,"file":"Contexts.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Contexts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAY5E,eAAO,MAAM,mBAAmB,EAAE,iBAYjC,CAAC;AAEF,eAAO,MAAM,YAAY,4CAAwD,CAAC;AAElF,eAAO,MAAM,mBAAmB,mDAI9B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { createContext } from 'react';
2
- import { modalInitializedKey, managerInitializedKey } from './Modal.types';
3
2
  const initialMethods = {
4
3
  update: () => { },
5
4
  dismiss: () => { },
@@ -19,13 +18,13 @@ export const initialModalContext = {
19
18
  unmountWhenMinimized: true,
20
19
  state: 'open',
21
20
  top: false,
22
- [modalInitializedKey]: false,
21
+ initialized: false,
23
22
  ...initialMethods
24
23
  };
25
24
  export const ModalContext = createContext(initialModalContext);
26
25
  export const ModalManagerContext = createContext({
27
26
  create: () => initialMethods,
28
27
  ModalContext,
29
- [managerInitializedKey]: false
28
+ initialized: false
30
29
  });
31
30
  //# sourceMappingURL=Contexts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Contexts.js","sourceRoot":"","sources":["../../../src/components/Modal/Contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,mBAAmB,EAEnB,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAEvB,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,IAAI;IAC1B,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,KAAK;IACV,CAAC,mBAAmB,CAAC,EAAE,KAAK;IAC5B,GAAG,cAAc;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,mBAAmB,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IACzE,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc;IAC5B,YAAY;IACZ,CAAC,qBAAqB,CAAC,EAAE,KAAK;CAC/B,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport {\n modalInitializedKey,\n ModalContextValue,\n managerInitializedKey,\n ModalManagerContextValue\n} from './Modal.types';\n\nconst initialMethods = {\n update: () => {},\n dismiss: () => {},\n activate: () => {},\n minimize: () => {},\n maximize: () => {},\n dock: () => {},\n unmount: () => {}\n};\n\nexport const initialModalContext: ModalContextValue = {\n alert: false,\n dismissible: true,\n minimizable: false,\n maximizable: false,\n dockable: false,\n defaultMinimized: false,\n unmountWhenMinimized: true,\n state: 'open',\n top: false,\n [modalInitializedKey]: false,\n ...initialMethods\n};\n\nexport const ModalContext = createContext<ModalContextValue>(initialModalContext);\n\nexport const ModalManagerContext = createContext<ModalManagerContextValue>({\n create: () => initialMethods,\n ModalContext,\n [managerInitializedKey]: false\n});\n"]}
1
+ {"version":3,"file":"Contexts.js","sourceRoot":"","sources":["../../../src/components/Modal/Contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,KAAK;IAClB,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,KAAK;IACvB,oBAAoB,EAAE,IAAI;IAC1B,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,KAAK;IACV,WAAW,EAAE,KAAK;IAClB,GAAG,cAAc;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB,mBAAmB,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAA2B;IACzE,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc;IAC5B,YAAY;IACZ,WAAW,EAAE,KAAK;CACnB,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport { ModalContextValue, ModalManagerContextValue } from './Modal.types';\n\nconst initialMethods = {\n update: () => {},\n dismiss: () => {},\n activate: () => {},\n minimize: () => {},\n maximize: () => {},\n dock: () => {},\n unmount: () => {}\n};\n\nexport const initialModalContext: ModalContextValue = {\n alert: false,\n dismissible: true,\n minimizable: false,\n maximizable: false,\n dockable: false,\n defaultMinimized: false,\n unmountWhenMinimized: true,\n state: 'open',\n top: false,\n initialized: false,\n ...initialMethods\n};\n\nexport const ModalContext = createContext<ModalContextValue>(initialModalContext);\n\nexport const ModalManagerContext = createContext<ModalManagerContextValue>({\n create: () => initialMethods,\n ModalContext,\n initialized: false\n});\n"]}
@@ -4,8 +4,6 @@ import type { BaseProps, AsProp, DeferInfer } from '../../types';
4
4
  export interface ModalManagerProps {
5
5
  /** Content that will be provided modal manager context. */
6
6
  children: ReactNode;
7
- /** Context to read previous values from. */
8
- context?: Context<ModalManagerContextValue>;
9
7
  }
10
8
  export interface ModalOptions {
11
9
  /**
@@ -184,20 +182,18 @@ export interface ModalMethods<P extends object = object> {
184
182
  */
185
183
  unmount: () => void;
186
184
  }
187
- export declare const managerInitializedKey: unique symbol;
188
185
  export interface ModalManagerContextValue {
189
186
  /**
190
187
  * The function that will create the Modal. This function accepts the component to render a Modal, props for that component, and options for that Modal.
191
188
  */
192
189
  create: <P extends object>(component: ComponentType<P>, props?: DeferInfer<P>, options?: ModalOptions) => ModalMethods<P>;
193
190
  ModalContext: Context<ModalContextValue>;
194
- [managerInitializedKey]: boolean;
191
+ initialized: boolean;
195
192
  }
196
- export declare const modalInitializedKey: unique symbol;
197
193
  export interface ModalContextValue extends ModalMethods, ModalOptions {
198
194
  state: ModalState;
199
195
  top: boolean;
200
- [modalInitializedKey]: boolean;
196
+ initialized: boolean;
201
197
  }
202
198
  export interface ModalObject<P extends object = object> {
203
199
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.types.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,QAAQ,EAAE,SAAS,CAAC;IACpB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;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O,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC,SAAS,MAAM,EACvB,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,EAAE,YAAY,KACnB,YAAY,CAAC,CAAC,CAAC,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACzC,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY,EAAE,YAAY;IACnE,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,OAAO,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,EAAE,YAAY,CAAC;CACvB"}
@@ -1,3 +1,2 @@
1
- export const managerInitializedKey = Symbol.for('@pega/cosmos-react-core.modal-manager.initialized');
2
- export const modalInitializedKey = Symbol.for('@pega/cosmos-react-core.modal.initialized');
1
+ export {};
3
2
  //# sourceMappingURL=Modal.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.types.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.types.ts"],"names":[],"mappings":"AAkMA,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAC7C,mDAAmD,CACpD,CAAC;AAeF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC","sourcesContent":["import type { ComponentType, ReactNode, RefObject, Context } from 'react';\n\nimport type { ProgressProps } from '@pega/cosmos-react-core';\n\nimport type { BaseProps, AsProp, DeferInfer } from '../../types';\n\nexport interface ModalManagerProps {\n /** Content that will be provided modal manager context. */\n children: ReactNode;\n /** Context to read previous values from. */\n context?: Context<ModalManagerContextValue>;\n}\n\nexport interface ModalOptions {\n /**\n * If true, the Modal will render as an alert that is not dismissible.\n * @default false\n */\n alert?: boolean;\n /**\n * Toggle Esc keypress action or clicking backdrop to dismiss Modal. Also displays dismiss button on Modal header.\n * Not valid for Modals of type alert.\n * @default alert ? false : true\n */\n dismissible?: boolean;\n /**\n * Toggle minimize button in header thereby helping in rendering minimizable/non-minimizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n minimizable?: boolean;\n /**\n * Toggle maximize button in header thereby helping in rendering maximizable/non-maximizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n maximizable?: boolean;\n /** Positions the modal in the right corner without backdrop\n * @default false\n */\n dockable?: boolean;\n /**\n * If true, the Modal will initially render in a minimized state.\n * @default false\n */\n defaultMinimized?: boolean;\n /**\n * If true, the Modal content will be removed from the DOM when in a minimized state.\n * @default true\n */\n unmountWhenMinimized?: boolean;\n /**\n * Used to identify the modal. Will be passed back as an argument in life cycle functions.\n */\n id?: string;\n /**\n * Life cycle function that will be run when the modal is minimized.\n */\n onMinimize?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is maximized.\n */\n onMaximize?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is maximized.\n */\n onDock?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is activated (un minimized).\n */\n onActivate?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is dismissed.\n */\n onDismiss?: (id: string) => void;\n}\n\nexport interface ModalProps extends BaseProps, AsProp {\n /**\n * Place a modal into a loading state by way of a bool or an object which allows for a custom message and determinate progress.\n */\n progress?: boolean | Pick<ProgressProps, 'message' | 'minValue' | 'maxValue' | 'value'>;\n /**\n * Heading for the Modal.\n */\n heading: ReactNode;\n /**\n * Count for list data presented in the Modal.\n */\n count?: number;\n /**\n /**\n * Content for the Modal.\n */\n children: ReactNode;\n /**\n * Actions for the Modal.\n */\n actions?: ReactNode;\n /**\n * Render the modal in full width and height.\n * @default false\n */\n stretch?: boolean;\n /**\n * Toggle to position the Modal vertically centered or not.\n * @default false\n */\n center?: boolean;\n /**\n * Automatically compute the width of the Modal based on the content.\n * @default false\n */\n autoWidth?: boolean;\n /**\n * Takes a React Ref of the element to be focused initially on mounting Modal.\n */\n defaultFocus?: RefObject<HTMLElement>;\n /**\n * Accepts a callback function that gets invoked before opening a Modal.\n */\n onBeforeOpen?: () => void;\n /**\n * Accepts a callback function that gets invoked after opening a Modal.\n */\n onAfterOpen?: () => void;\n /**\n * Accepts a callback function that gets invoked before closing a Modal.\n */\n onBeforeClose?: () => void;\n /**\n * Accepts a callback function that gets invoked after closing a Modal.\n */\n onAfterClose?: () => void;\n /**\n * Accepts a callback function that returns a boolean before dismissing a modal.\n * If the boolean is false, the modal will not be dismissed.\n */\n onRequestDismiss?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before minimizing a modal.\n * If the boolean is false, the modal will not be minimized.\n */\n onRequestMinimize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before maximizing a modal.\n * If the boolean is false, the modal will not be maximized.\n */\n onRequestMaximize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before docking a modal.\n * If the boolean is false, the modal will not be dockable.\n */\n onRequestDock?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before activating a modal.\n * If the boolean is false, the modal will not be activated.\n */\n onRequestActivate?: () => boolean | void;\n}\n\nexport type ModalState = 'open' | 'closed' | 'minimized' | 'maximized' | 'docked';\n\nexport interface ModalMethods<P extends object = object> {\n /**\n * Closes the referenced Modal when called.\n */\n dismiss: () => void;\n /**\n * Updates the referenced Modal with a set of props.\n */\n update: (props: Partial<P>) => void;\n /**\n * Minimizes the referenced Modal.\n */\n minimize: () => void;\n /**\n * Maximizes the referenced Modal.\n */\n maximize: () => void;\n /**\n * docks the referenced Modal.\n */\n dock: () => void;\n /**\n * Will reopen the referenced Modal if minimized, and minimize any open Modals that are minimizable.\n */\n activate: () => void;\n /**\n * Removes the referenced Modal from the DOM.\n */\n unmount: () => void;\n}\n\nexport const managerInitializedKey = Symbol.for(\n '@pega/cosmos-react-core.modal-manager.initialized'\n);\n\nexport interface ModalManagerContextValue {\n /**\n * The function that will create the Modal. This function accepts the component to render a Modal, props for that component, and options for that Modal.\n */\n create: <P extends object>(\n component: ComponentType<P>,\n props?: DeferInfer<P>,\n options?: ModalOptions\n ) => ModalMethods<P>;\n ModalContext: Context<ModalContextValue>;\n [managerInitializedKey]: boolean;\n}\n\nexport const modalInitializedKey = Symbol.for('@pega/cosmos-react-core.modal.initialized');\n\nexport interface ModalContextValue extends ModalMethods, ModalOptions {\n state: ModalState;\n top: boolean;\n [modalInitializedKey]: boolean;\n}\n\nexport interface ModalObject<P extends object = object> {\n id: string;\n state: ModalState;\n methods: ModalMethods<P>;\n props?: P;\n Component: ComponentType<P>;\n options: ModalOptions;\n}\n"]}
1
+ {"version":3,"file":"Modal.types.js","sourceRoot":"","sources":["../../../src/components/Modal/Modal.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType, ReactNode, RefObject, Context } from 'react';\n\nimport type { ProgressProps } from '@pega/cosmos-react-core';\n\nimport type { BaseProps, AsProp, DeferInfer } from '../../types';\n\nexport interface ModalManagerProps {\n /** Content that will be provided modal manager context. */\n children: ReactNode;\n}\n\nexport interface ModalOptions {\n /**\n * If true, the Modal will render as an alert that is not dismissible.\n * @default false\n */\n alert?: boolean;\n /**\n * Toggle Esc keypress action or clicking backdrop to dismiss Modal. Also displays dismiss button on Modal header.\n * Not valid for Modals of type alert.\n * @default alert ? false : true\n */\n dismissible?: boolean;\n /**\n * Toggle minimize button in header thereby helping in rendering minimizable/non-minimizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n minimizable?: boolean;\n /**\n * Toggle maximize button in header thereby helping in rendering maximizable/non-maximizable Modals.\n * Not valid for Modals of type alert.\n * @default false\n */\n maximizable?: boolean;\n /** Positions the modal in the right corner without backdrop\n * @default false\n */\n dockable?: boolean;\n /**\n * If true, the Modal will initially render in a minimized state.\n * @default false\n */\n defaultMinimized?: boolean;\n /**\n * If true, the Modal content will be removed from the DOM when in a minimized state.\n * @default true\n */\n unmountWhenMinimized?: boolean;\n /**\n * Used to identify the modal. Will be passed back as an argument in life cycle functions.\n */\n id?: string;\n /**\n * Life cycle function that will be run when the modal is minimized.\n */\n onMinimize?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is maximized.\n */\n onMaximize?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is maximized.\n */\n onDock?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is activated (un minimized).\n */\n onActivate?: (id: string) => void;\n /**\n * Life cycle function that will be run when the modal is dismissed.\n */\n onDismiss?: (id: string) => void;\n}\n\nexport interface ModalProps extends BaseProps, AsProp {\n /**\n * Place a modal into a loading state by way of a bool or an object which allows for a custom message and determinate progress.\n */\n progress?: boolean | Pick<ProgressProps, 'message' | 'minValue' | 'maxValue' | 'value'>;\n /**\n * Heading for the Modal.\n */\n heading: ReactNode;\n /**\n * Count for list data presented in the Modal.\n */\n count?: number;\n /**\n /**\n * Content for the Modal.\n */\n children: ReactNode;\n /**\n * Actions for the Modal.\n */\n actions?: ReactNode;\n /**\n * Render the modal in full width and height.\n * @default false\n */\n stretch?: boolean;\n /**\n * Toggle to position the Modal vertically centered or not.\n * @default false\n */\n center?: boolean;\n /**\n * Automatically compute the width of the Modal based on the content.\n * @default false\n */\n autoWidth?: boolean;\n /**\n * Takes a React Ref of the element to be focused initially on mounting Modal.\n */\n defaultFocus?: RefObject<HTMLElement>;\n /**\n * Accepts a callback function that gets invoked before opening a Modal.\n */\n onBeforeOpen?: () => void;\n /**\n * Accepts a callback function that gets invoked after opening a Modal.\n */\n onAfterOpen?: () => void;\n /**\n * Accepts a callback function that gets invoked before closing a Modal.\n */\n onBeforeClose?: () => void;\n /**\n * Accepts a callback function that gets invoked after closing a Modal.\n */\n onAfterClose?: () => void;\n /**\n * Accepts a callback function that returns a boolean before dismissing a modal.\n * If the boolean is false, the modal will not be dismissed.\n */\n onRequestDismiss?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before minimizing a modal.\n * If the boolean is false, the modal will not be minimized.\n */\n onRequestMinimize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before maximizing a modal.\n * If the boolean is false, the modal will not be maximized.\n */\n onRequestMaximize?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before docking a modal.\n * If the boolean is false, the modal will not be dockable.\n */\n onRequestDock?: () => boolean | void;\n /**\n * Accepts a callback function that returns a boolean before activating a modal.\n * If the boolean is false, the modal will not be activated.\n */\n onRequestActivate?: () => boolean | void;\n}\n\nexport type ModalState = 'open' | 'closed' | 'minimized' | 'maximized' | 'docked';\n\nexport interface ModalMethods<P extends object = object> {\n /**\n * Closes the referenced Modal when called.\n */\n dismiss: () => void;\n /**\n * Updates the referenced Modal with a set of props.\n */\n update: (props: Partial<P>) => void;\n /**\n * Minimizes the referenced Modal.\n */\n minimize: () => void;\n /**\n * Maximizes the referenced Modal.\n */\n maximize: () => void;\n /**\n * docks the referenced Modal.\n */\n dock: () => void;\n /**\n * Will reopen the referenced Modal if minimized, and minimize any open Modals that are minimizable.\n */\n activate: () => void;\n /**\n * Removes the referenced Modal from the DOM.\n */\n unmount: () => void;\n}\n\nexport interface ModalManagerContextValue {\n /**\n * The function that will create the Modal. This function accepts the component to render a Modal, props for that component, and options for that Modal.\n */\n create: <P extends object>(\n component: ComponentType<P>,\n props?: DeferInfer<P>,\n options?: ModalOptions\n ) => ModalMethods<P>;\n ModalContext: Context<ModalContextValue>;\n initialized: boolean;\n}\n\nexport interface ModalContextValue extends ModalMethods, ModalOptions {\n state: ModalState;\n top: boolean;\n initialized: boolean;\n}\n\nexport interface ModalObject<P extends object = object> {\n id: string;\n state: ModalState;\n methods: ModalMethods<P>;\n props?: P;\n Component: ComponentType<P>;\n options: ModalOptions;\n}\n"]}
@@ -1,5 +1,11 @@
1
- import { FunctionComponent } from 'react';
2
- import { ModalManagerProps } from './Modal.types';
1
+ import { FunctionComponent, Context } from 'react';
2
+ import '../../init';
3
+ import { ModalManagerProps, ModalManagerContextValue } from './Modal.types';
4
+ declare module '../../init' {
5
+ interface CosmosGlobals {
6
+ modalManagerContext?: Context<ModalManagerContextValue>;
7
+ }
8
+ }
3
9
  declare const ModalManager: FunctionComponent<ModalManagerProps>;
4
10
  export default ModalManager;
5
11
  //# sourceMappingURL=ModalManager.d.ts.map