no-frills-ui 0.0.14-alpha.4 → 0.0.14-alpha.5

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 (132) hide show
  1. package/dist/index.js +1335 -493
  2. package/dist/index.js.map +1 -1
  3. package/lib-esm/components/Accordion/AccordionStep.d.ts.map +1 -1
  4. package/lib-esm/components/Accordion/AccordionStep.js +11 -29
  5. package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
  6. package/lib-esm/components/Badge/Badge.js +7 -7
  7. package/lib-esm/components/Badge/Badge.js.map +1 -1
  8. package/lib-esm/components/Button/ActionButton.d.ts.map +1 -1
  9. package/lib-esm/components/Button/ActionButton.js +12 -11
  10. package/lib-esm/components/Button/ActionButton.js.map +1 -1
  11. package/lib-esm/components/Button/Button.d.ts.map +1 -1
  12. package/lib-esm/components/Button/Button.js +14 -13
  13. package/lib-esm/components/Button/Button.js.map +1 -1
  14. package/lib-esm/components/Button/IconButton.d.ts.map +1 -1
  15. package/lib-esm/components/Button/IconButton.js +15 -14
  16. package/lib-esm/components/Button/IconButton.js.map +1 -1
  17. package/lib-esm/components/Button/LinkButton.d.ts.map +1 -1
  18. package/lib-esm/components/Button/LinkButton.js +7 -6
  19. package/lib-esm/components/Button/LinkButton.js.map +1 -1
  20. package/lib-esm/components/Button/RaisedButton.d.ts.map +1 -1
  21. package/lib-esm/components/Button/RaisedButton.js +15 -14
  22. package/lib-esm/components/Button/RaisedButton.js.map +1 -1
  23. package/lib-esm/components/Card/Card.d.ts.map +1 -1
  24. package/lib-esm/components/Card/Card.js +4 -4
  25. package/lib-esm/components/Card/Card.js.map +1 -1
  26. package/lib-esm/components/Chip/Chip.js +8 -8
  27. package/lib-esm/components/Chip/Chip.js.map +1 -1
  28. package/lib-esm/components/ChipInput/ChipInput.js +20 -20
  29. package/lib-esm/components/ChipInput/ChipInput.js.map +1 -1
  30. package/lib-esm/components/Dialog/AlertDialog.d.ts.map +1 -1
  31. package/lib-esm/components/Dialog/AlertDialog.js +4 -1
  32. package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
  33. package/lib-esm/components/Dialog/Dialog.d.ts +26 -1
  34. package/lib-esm/components/Dialog/Dialog.d.ts.map +1 -1
  35. package/lib-esm/components/Dialog/Dialog.js +84 -1
  36. package/lib-esm/components/Dialog/Dialog.js.map +1 -1
  37. package/lib-esm/components/DragAndDrop/DragItem.js +8 -8
  38. package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
  39. package/lib-esm/components/Drawer/Drawer.d.ts +76 -1
  40. package/lib-esm/components/Drawer/Drawer.d.ts.map +1 -1
  41. package/lib-esm/components/Drawer/Drawer.js +158 -24
  42. package/lib-esm/components/Drawer/Drawer.js.map +1 -1
  43. package/lib-esm/components/Groups/Group.d.ts.map +1 -1
  44. package/lib-esm/components/Groups/Group.js +10 -8
  45. package/lib-esm/components/Groups/Group.js.map +1 -1
  46. package/lib-esm/components/Groups/GroupLabel.d.ts.map +1 -1
  47. package/lib-esm/components/Groups/GroupLabel.js +3 -3
  48. package/lib-esm/components/Groups/GroupLabel.js.map +1 -1
  49. package/lib-esm/components/Input/Checkbox.d.ts.map +1 -1
  50. package/lib-esm/components/Input/Checkbox.js +63 -58
  51. package/lib-esm/components/Input/Checkbox.js.map +1 -1
  52. package/lib-esm/components/Input/Dropdown.d.ts +8 -0
  53. package/lib-esm/components/Input/Dropdown.d.ts.map +1 -1
  54. package/lib-esm/components/Input/Dropdown.js +54 -31
  55. package/lib-esm/components/Input/Dropdown.js.map +1 -1
  56. package/lib-esm/components/Input/Input.d.ts.map +1 -1
  57. package/lib-esm/components/Input/Input.js +27 -21
  58. package/lib-esm/components/Input/Input.js.map +1 -1
  59. package/lib-esm/components/Input/Radio.d.ts.map +1 -1
  60. package/lib-esm/components/Input/Radio.js +58 -42
  61. package/lib-esm/components/Input/Radio.js.map +1 -1
  62. package/lib-esm/components/Input/RadioButton.d.ts.map +1 -1
  63. package/lib-esm/components/Input/RadioButton.js +12 -12
  64. package/lib-esm/components/Input/RadioButton.js.map +1 -1
  65. package/lib-esm/components/Input/Select.d.ts.map +1 -1
  66. package/lib-esm/components/Input/Select.js +27 -21
  67. package/lib-esm/components/Input/Select.js.map +1 -1
  68. package/lib-esm/components/Input/TextArea.d.ts.map +1 -1
  69. package/lib-esm/components/Input/TextArea.js +27 -21
  70. package/lib-esm/components/Input/TextArea.js.map +1 -1
  71. package/lib-esm/components/Input/Toggle.d.ts.map +1 -1
  72. package/lib-esm/components/Input/Toggle.js +17 -14
  73. package/lib-esm/components/Input/Toggle.js.map +1 -1
  74. package/lib-esm/components/Menu/Menu.d.ts +13 -1
  75. package/lib-esm/components/Menu/Menu.d.ts.map +1 -1
  76. package/lib-esm/components/Menu/Menu.js +98 -3
  77. package/lib-esm/components/Menu/Menu.js.map +1 -1
  78. package/lib-esm/components/Menu/MenuItem.d.ts +6 -3
  79. package/lib-esm/components/Menu/MenuItem.d.ts.map +1 -1
  80. package/lib-esm/components/Menu/MenuItem.js +10 -10
  81. package/lib-esm/components/Menu/MenuItem.js.map +1 -1
  82. package/lib-esm/components/Modal/Modal.d.ts +70 -1
  83. package/lib-esm/components/Modal/Modal.d.ts.map +1 -1
  84. package/lib-esm/components/Modal/Modal.js +145 -11
  85. package/lib-esm/components/Modal/Modal.js.map +1 -1
  86. package/lib-esm/components/Notification/Notification.d.ts +3 -1
  87. package/lib-esm/components/Notification/Notification.d.ts.map +1 -1
  88. package/lib-esm/components/Notification/Notification.js +4 -2
  89. package/lib-esm/components/Notification/Notification.js.map +1 -1
  90. package/lib-esm/components/Notification/NotificationManager.d.ts +11 -1
  91. package/lib-esm/components/Notification/NotificationManager.d.ts.map +1 -1
  92. package/lib-esm/components/Notification/NotificationManager.js +43 -8
  93. package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
  94. package/lib-esm/components/Notification/style.d.ts +4 -0
  95. package/lib-esm/components/Notification/style.d.ts.map +1 -1
  96. package/lib-esm/components/Notification/style.js +30 -15
  97. package/lib-esm/components/Notification/style.js.map +1 -1
  98. package/lib-esm/components/Notification/types.d.ts +2 -0
  99. package/lib-esm/components/Notification/types.d.ts.map +1 -1
  100. package/lib-esm/components/Notification/types.js.map +1 -1
  101. package/lib-esm/components/Popover/Popover.d.ts.map +1 -1
  102. package/lib-esm/components/Popover/Popover.js +17 -2
  103. package/lib-esm/components/Popover/Popover.js.map +1 -1
  104. package/lib-esm/components/Spinner/Spinner.d.ts +3 -0
  105. package/lib-esm/components/Spinner/Spinner.d.ts.map +1 -1
  106. package/lib-esm/components/Spinner/Spinner.js +19 -4
  107. package/lib-esm/components/Spinner/Spinner.js.map +1 -1
  108. package/lib-esm/components/Stepper/Stepper.d.ts.map +1 -1
  109. package/lib-esm/components/Stepper/Stepper.js +29 -10
  110. package/lib-esm/components/Stepper/Stepper.js.map +1 -1
  111. package/lib-esm/components/Tabs/Tabs.d.ts.map +1 -1
  112. package/lib-esm/components/Tabs/Tabs.js +45 -12
  113. package/lib-esm/components/Tabs/Tabs.js.map +1 -1
  114. package/lib-esm/components/Toast/Toast.d.ts +25 -4
  115. package/lib-esm/components/Toast/Toast.d.ts.map +1 -1
  116. package/lib-esm/components/Toast/Toast.js +114 -18
  117. package/lib-esm/components/Toast/Toast.js.map +1 -1
  118. package/lib-esm/components/Tooltip/Tooltip.d.ts.map +1 -1
  119. package/lib-esm/components/Tooltip/Tooltip.js +16 -5
  120. package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
  121. package/lib-esm/shared/LayerManager.d.ts.map +1 -1
  122. package/lib-esm/shared/LayerManager.js +63 -1
  123. package/lib-esm/shared/LayerManager.js.map +1 -1
  124. package/lib-esm/shared/constants.d.ts +58 -27
  125. package/lib-esm/shared/constants.d.ts.map +1 -1
  126. package/lib-esm/shared/constants.js +88 -25
  127. package/lib-esm/shared/constants.js.map +1 -1
  128. package/lib-esm/shared/styles.d.ts +1 -1
  129. package/lib-esm/shared/styles.d.ts.map +1 -1
  130. package/lib-esm/shared/styles.js +5 -3
  131. package/lib-esm/shared/styles.js.map +1 -1
  132. package/package.json +1 -1
@@ -12,29 +12,29 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
13
  import styled from '@emotion/styled';
14
14
  import { Close } from '../../icons';
15
- import constants from '../../shared/constants';
15
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
16
16
  const Container = styled.span `
17
17
  padding: 5px;
18
18
  padding-left: 15px;
19
19
  border-radius: 16px;
20
- background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
20
+ background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};
21
21
  display: inline-flex;
22
22
  margin: 5px;
23
23
  line-height: 20px;
24
24
  align-items: center;
25
-
26
- &:focus-within {
27
- outline: 2px solid var(--primary-light, ${constants.PRIMARY_LIGHT});
28
- }
29
25
  `;
30
26
  const Button = styled.button `
31
- color: var(--background-color, ${constants.BACKGROUND});
32
- background-color: var(--border-color, ${constants.DISABLED});
27
+ color: ${getThemeValue(THEME_NAME.BACKGROUND)};
28
+ background-color: ${getThemeValue(THEME_NAME.DISABLED)};
33
29
  border-radius: 50%;
34
30
  border: none;
35
31
  padding: 4px;
36
32
  display: inline-flex;
37
33
  margin-left: 5px;
34
+
35
+ &:focus-within {
36
+ outline: 4px solid ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
37
+ }
38
38
  `;
39
39
  export default function Chip(props) {
40
40
  const { label, onCloseClick, closeButtonAriaLabel } = props, rest = __rest(props, ["label", "onCloseClick", "closeButtonAriaLabel"]);
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAW/C,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react';\nimport styled from '@emotion/styled';\nimport { Close } from '../../icons';\nimport constants from '../../shared/constants';\n\ninterface ChipProps {\n /** Label for the chip */\n label: string;\n /** Callback when the close button is clicked */\n onCloseClick?: (e: React.KeyboardEvent | React.MouseEvent) => void;\n /** Aria label for the close button. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel?: string;\n}\n\nconst Container = styled.span`\n padding: 5px;\n padding-left: 15px;\n border-radius: 16px;\n background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});\n display: inline-flex;\n margin: 5px;\n line-height: 20px;\n align-items: center;\n\n &:focus-within {\n outline: 2px solid var(--primary-light, ${constants.PRIMARY_LIGHT});\n }\n`;\n\nconst Button = styled.button`\n color: var(--background-color, ${constants.BACKGROUND});\n background-color: var(--border-color, ${constants.DISABLED});\n border-radius: 50%;\n border: none;\n padding: 4px;\n display: inline-flex;\n margin-left: 5px;\n`;\n\nexport default function Chip(props: ChipProps & React.HTMLAttributes<HTMLSpanElement>) {\n const { label, onCloseClick, closeButtonAriaLabel, ...rest } = props;\n\n const keyUpHandler: React.KeyboardEventHandler<HTMLSpanElement> = (e) => {\n if (e.key === 'Backspace' || e.key === 'Delete') {\n onCloseClick?.(e);\n }\n };\n\n const buttonKeyDownHandler: React.KeyboardEventHandler<HTMLButtonElement> = (e) => {\n // Stop propagation to prevent DragAndDrop from capturing Space/Enter\n if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Enter') {\n e.stopPropagation();\n }\n };\n\n return (\n <Container {...rest} onKeyUp={keyUpHandler}>\n {label}\n <Button\n onClick={onCloseClick}\n onKeyDown={buttonKeyDownHandler}\n aria-label={closeButtonAriaLabel ?? `Remove ${label}`}\n >\n <Close height={16} width={16} />\n </Button>\n </Container>\n );\n}\n"]}
1
+ {"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,E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oB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,UAAU,KAAK,EAAE,YAErD,KAAC,KAAK,IAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,GAAI,GAC3B,KACD,CACf,CAAC;AACN,CAAC","sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { Close } from '../../icons';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\n\ninterface ChipProps {\n /** Label for the chip */\n label: string;\n /** Callback when the close button is clicked */\n onCloseClick?: (e: React.KeyboardEvent | React.MouseEvent) => void;\n /** Aria label for the close button. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel?: string;\n}\n\nconst Container = styled.span`\n padding: 5px;\n padding-left: 15px;\n border-radius: 16px;\n background-color: ${getThemeValue(THEME_NAME.BORDER_LIGHT_COLOR)};\n display: inline-flex;\n margin: 5px;\n line-height: 20px;\n align-items: center;\n`;\n\nconst Button = styled.button`\n color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED)};\n border-radius: 50%;\n border: none;\n padding: 4px;\n display: inline-flex;\n margin-left: 5px;\n\n &:focus-within {\n outline: 4px solid ${getThemeValue(THEME_NAME.ERROR_LIGHT)};\n }\n`;\n\nexport default function Chip(props: ChipProps & React.HTMLAttributes<HTMLSpanElement>) {\n const { label, onCloseClick, closeButtonAriaLabel, ...rest } = props;\n\n const keyUpHandler: React.KeyboardEventHandler<HTMLSpanElement> = (e) => {\n if (e.key === 'Backspace' || e.key === 'Delete') {\n onCloseClick?.(e);\n }\n };\n\n const buttonKeyDownHandler: React.KeyboardEventHandler<HTMLButtonElement> = (e) => {\n // Stop propagation to prevent DragAndDrop from capturing Space/Enter\n if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Enter') {\n e.stopPropagation();\n }\n };\n\n return (\n <Container {...rest} onKeyUp={keyUpHandler}>\n {label}\n <Button\n onClick={onCloseClick}\n onKeyDown={buttonKeyDownHandler}\n aria-label={closeButtonAriaLabel ?? `Remove ${label}`}\n >\n <Close height={16} width={16} />\n </Button>\n </Container>\n );\n}\n"]}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
2
2
  import React, { useEffect, useId, useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import styled from '@emotion/styled';
5
- import constants from '../../shared/constants';
5
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
6
6
  import Chip from '../Chip/Chip';
7
7
  import { DragAndDrop, ORIENTATION } from '../DragAndDrop';
8
8
  // Label component for the ChipInput
@@ -16,45 +16,45 @@ const Label = styled.label `
16
16
  padding: 0 8px;
17
17
  width: 250px;
18
18
  border-radius: 3px;
19
- border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
20
- background-color: var(--background, ${constants.BACKGROUND});
19
+ border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};
20
+ background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};
21
21
 
22
22
  /** Focused */
23
23
  &:has(:focus),
24
24
  &:has(:active) {
25
- border-color: var(--primary, ${constants.PRIMARY});
26
- box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});
25
+ border-color: ${getThemeValue(THEME_NAME.PRIMARY)};
26
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
27
27
  }
28
28
 
29
29
  &:has(:focus) > span,
30
30
  &:has(:active) > span {
31
- color: var(--primary, ${constants.PRIMARY});
31
+ color: ${getThemeValue(THEME_NAME.PRIMARY)};
32
32
  }
33
33
 
34
34
  /** Disabled */
35
35
  &:has(:disabled) {
36
- border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
37
- background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
36
+ border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};
37
+ background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};
38
38
  }
39
39
 
40
40
  &:has(:disabled) > span {
41
- color: #777;
41
+ color: ${getThemeValue(THEME_NAME.DISABLED)};
42
42
  }
43
43
 
44
44
  /** Invalid */
45
45
  &:has(:focus:invalid) {
46
- border-color: var(--error, ${constants.ERROR});
47
- box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
46
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
47
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};
48
48
  }
49
49
 
50
50
  ${(props) => props.touched
51
51
  ? `
52
52
  &:has(:invalid) {
53
- border-color: var(--error, ${constants.ERROR});
53
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
54
54
  }
55
55
 
56
56
  &:has(:invalid) > span {
57
- color: var(--error, ${constants.ERROR});
57
+ color: ${getThemeValue(THEME_NAME.ERROR)};
58
58
  }
59
59
  `
60
60
  : ''}
@@ -62,10 +62,10 @@ const Label = styled.label `
62
62
  /** Error */
63
63
  ${(props) => props.errorText
64
64
  ? `
65
- border-color: var(--error, ${constants.ERROR});
65
+ border-color: ${getThemeValue(THEME_NAME.ERROR)};
66
66
 
67
67
  & > span {
68
- color: var(--error, ${constants.ERROR});
68
+ color: ${getThemeValue(THEME_NAME.ERROR)};
69
69
  }
70
70
  `
71
71
  : ''}
@@ -74,15 +74,15 @@ const Label = styled.label `
74
74
  &:has(:required) > span:after {
75
75
  content: '*';
76
76
  margin-left: 2px;
77
- color: var(--error, ${constants.ERROR});
77
+ color: ${getThemeValue(THEME_NAME.ERROR)};
78
78
  }
79
79
 
80
80
  & > input {
81
81
  border: none;
82
82
  outline: none;
83
- width: 100%;
84
83
  line-height: 30px;
85
84
  min-height: 30px;
85
+ max-width: 95%;
86
86
  }
87
87
 
88
88
  /** Label Animation */
@@ -99,7 +99,7 @@ const Label = styled.label `
99
99
  &:has(:focus) > span,
100
100
  &:has(:placeholder-shown) > span {
101
101
  top: -8px;
102
- background: var(--background, ${constants.BACKGROUND});
102
+ background: ${getThemeValue(THEME_NAME.BACKGROUND)};
103
103
  font-size: 12px;
104
104
  line-height: 14px;
105
105
  }
@@ -108,7 +108,7 @@ const Label = styled.label `
108
108
  ? `
109
109
  & > span {
110
110
  top: -8px;
111
- background: var(--background, ${constants.BACKGROUND});
111
+ background: ${getThemeValue(THEME_NAME.BACKGROUND)};
112
112
  font-size: 12px;
113
113
  line-height: 14px;
114
114
  }
@@ -117,7 +117,7 @@ const Label = styled.label `
117
117
  `;
118
118
  // Error message container
119
119
  const ErrorContainer = styled.div `
120
- color: var(--error, ${constants.ERROR});
120
+ color: ${getThemeValue(THEME_NAME.ERROR)};
121
121
  padding-top: 3px;
122
122
  font-size: 12px;
123
123
  line-height: 14px;
@@ -1 +1 @@
1
- {"version":3,"file":"ChipInput.js","sourceRoot":"","sources":["../../../src/components/ChipInput/ChipInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK1D,oCAAoC;AACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAIxB;;;;;;;;;;4CAU0C,SAAS,CAAC,YAAY;0CACxB,SAAS,CAAC,UAAU;;;;;uCAKvB,SAAS,CAAC,OAAO;qDACH,SAAS,CAAC,aAAa;;;;;gCAK5C,SAAS,CAAC,OAAO;;;;;+CAKF,SAAS,CAAC,eAAe;uDACjB,SAAS,CAAC,mBAAmB;;;;;;;;;qCAS/C,SAAS,CAAC,KAAK;mDACD,SAAS,CAAC,WAAW;;;MAGlE,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,OAAO;IACT,CAA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oBAAoB,EAAE,SAAS,CAAC,MAAM;IACtC,8EAA8E;IAC9E,yBAAyB,EAAE,SAAS,CAAC,MAAM;IAC3C,kFAAkF;IAClF,2BAA2B,EAAE,SAAS,CAAC,MAAM;CAChD,CAAC;AAEF,SAAS,CAAC,YAAY,GAAG;IACrB,KAAK,EAAE,EAAE;IACT,oBAAoB,EAAE,iBAAiB;IACvC,yBAAyB,EAAE,oBAAoB;IAC/C,2BAA2B,EAAE,sBAAsB;CACtD,CAAC","sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport constants from '../../shared/constants';\nimport Chip from '../Chip/Chip';\nimport { DragAndDrop, ORIENTATION } from '../DragAndDrop';\n\n// Prop types definition\ntype ChipInputProps = PropTypes.InferProps<typeof ChipInput.propTypes>;\n\n// Label component for the ChipInput\nconst Label = styled.label<{\n text: string;\n touched?: boolean;\n errorText?: string;\n}>`\n display: inline-flex;\n flex-direction: column;\n flex: 1;\n position: relative;\n margin: 10px 5px;\n color: inherit;\n padding: 0 8px;\n width: 250px;\n border-radius: 3px;\n border: 1px solid var(--border-color, ${constants.BORDER_COLOR});\n background-color: var(--background, ${constants.BACKGROUND});\n\n /** Focused */\n &:has(:focus),\n &:has(:active) {\n border-color: var(--primary, ${constants.PRIMARY});\n box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});\n }\n\n &:has(:focus) > span,\n &:has(:active) > span {\n color: var(--primary, ${constants.PRIMARY});\n }\n\n /** Disabled */\n &:has(:disabled) {\n border-color: var(--disabled-border, ${constants.DISABLED_BORDER});\n background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});\n }\n\n &:has(:disabled) > span {\n color: #777;\n }\n\n /** Invalid */\n &:has(:focus:invalid) {\n border-color: var(--error, ${constants.ERROR});\n box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});\n }\n\n ${(props) =>\n props.touched\n ? `\n &:has(:invalid) {\n border-color: var(--error, ${constants.ERROR});\n }\n \n &:has(:invalid) > span {\n color: var(--error, ${constants.ERROR});\n }\n `\n : ''}\n\n /** Error */\n ${(props) =>\n props.errorText\n ? `\n border-color: var(--error, ${constants.ERROR});\n\n & > span {\n color: var(--error, ${constants.ERROR});\n }\n `\n : ''}\n\n /** Required */\n &:has(:required) > span:after {\n content: '*';\n margin-left: 2px;\n color: var(--error, ${constants.ERROR});\n }\n\n & > input {\n border: none;\n outline: none;\n width: 100%;\n line-height: 30px;\n min-height: 30px;\n }\n\n /** Label Animation */\n & > span {\n position: absolute;\n padding: 0 5px;\n top: 0px;\n left: 4px;\n font-size: 14px;\n line-height: 32px;\n transition: all 300ms ease;\n }\n\n &:has(:focus) > span,\n &:has(:placeholder-shown) > span {\n top: -8px;\n background: var(--background, ${constants.BACKGROUND});\n font-size: 12px;\n line-height: 14px;\n }\n\n ${(props) =>\n props.text !== ''\n ? `\n & > span {\n top: -8px;\n background: var(--background, ${constants.BACKGROUND});\n font-size: 12px;\n line-height: 14px;\n }\n `\n : ''}\n`;\n\n// Error message container\nconst ErrorContainer = styled.div`\n color: var(--error, ${constants.ERROR});\n padding-top: 3px;\n font-size: 12px;\n line-height: 14px;\n margin-left: 3px;\n`;\n\n// Visually hidden but accessible to screen readers\nconst VisuallyHidden = styled.ul`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n\n & li {\n list-style: none;\n }\n`;\n\n/**\n * A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.\n * @component\n * @example\n * ```tsx\n * <ChipInput\n * value={['tag1', 'tag2']}\n * onChange={(newTags) => console.log(newTags)}\n * label=\"Add tags\"\n * errorText=\"At least one tag is required\"\n * />\n * ```\n */\nexport default function ChipInput(\n props: ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>,\n) {\n const [text, setText] = useState('');\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState<string[]>(props.value);\n const InputRef = React.useRef<HTMLInputElement>(null);\n const [announcement, setAnnouncement] = useState('');\n const errorId = useId();\n\n /**\n * Replace {:label} placeholder in template string\n */\n const replacePlaceholder = (\n template: string | undefined,\n label: string,\n ): string | undefined => {\n if (!template) return undefined;\n return template.replace(/\\{:label\\}/g, label);\n };\n\n // Sync internal value with props.value\n useEffect(() => {\n if (Array.isArray(props.value)) {\n setValue(props.value);\n }\n }, [props.value]);\n\n /**\n * Update the chip values and notify changes.\n * @param newValue The new array of chip values\n */\n const updateValue = (newValue: string[]) => {\n const deduped = Array.from(new Set(newValue));\n setValue(deduped);\n props.onChange?.(deduped);\n };\n\n /**\n * Marks the input as touched on focus.\n * @param e React focus event\n */\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n /**\n * Change handler for the input field.\n * @param e React change event\n */\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n setText(e.target.value);\n };\n\n /**\n * Adds a new chip on Enter key press.\n * @param e React keyboard event\n */\n const handleKeyUp: React.KeyboardEventHandler<HTMLInputElement> = (e) => {\n if (e.key === 'Enter' && text.trim() !== '') {\n const newValue = [...value, text.trim()];\n updateValue(newValue);\n setText('');\n setAnnouncement(replacePlaceholder(props.addedAnnouncementTemplate, text.trim())!);\n }\n };\n\n /**\n * Removes a chip from the list.\n * @param chipToRemove The chip value to remove\n */\n const removeChip = (chipToRemove: string) => {\n const newValue = value.filter((chip) => chip !== chipToRemove);\n updateValue(newValue);\n setAnnouncement(replacePlaceholder(props.removedAnnouncementTemplate, chipToRemove)!);\n };\n\n /**\n * Moves a chip from one position to another.\n * @param start The starting index of the item to move\n * @param end The ending index where the item should be placed\n */\n const onDrop = (start: number, end: number) => {\n // Clone existing elements\n const newItems = [...value];\n // Remove the element to be moved\n const item = newItems.splice(start, 1);\n // Add it back at the required position\n newItems.splice(end, 0, item[0]);\n // Update\n updateValue(newItems);\n };\n\n // Render the component\n return (\n <>\n <Label text={text} touched={touched} errorText={props.errorText}>\n <input\n {...props}\n ref={InputRef}\n value={text}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n required={props.required && value.length === 0}\n aria-required={props.required}\n aria-invalid={!!props.errorText}\n aria-describedby={props.errorText ? errorId : undefined}\n />\n <div>\n {value?.length > 0 && (\n <DragAndDrop orientation={ORIENTATION.HORIZONTAL} onDrop={onDrop}>\n {value.map((chip) => (\n <Chip\n key={chip}\n label={chip}\n onCloseClick={() => removeChip(chip)}\n closeButtonAriaLabel={replacePlaceholder(\n props.closeButtonAriaLabel,\n chip,\n )}\n />\n ))}\n </DragAndDrop>\n )}\n </div>\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n <VisuallyHidden aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </VisuallyHidden>\n </>\n );\n}\n\nChipInput.propTypes = {\n /** Label for the field */\n label: PropTypes.string.isRequired,\n /** Error message for the field */\n errorText: PropTypes.string,\n /** Values to display as chips */\n value: PropTypes.arrayOf(PropTypes.string),\n /** Callback when chips change */\n onChange: PropTypes.func,\n /** Aria label for the close button on chip. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel: PropTypes.string,\n /** Announcement text when a chip is added. Defaults to \"{label} was added\" */\n addedAnnouncementTemplate: PropTypes.string,\n /** Announcement text when a chip is removed. Defaults to \"{label} was removed\" */\n removedAnnouncementTemplate: PropTypes.string,\n};\n\nChipInput.defaultProps = {\n value: [],\n closeButtonAriaLabel: 'Remove {:label}',\n addedAnnouncementTemplate: '{:label} was added',\n removedAnnouncementTemplate: '{:label} was removed',\n};\n"]}
1
+ {"version":3,"file":"ChipInput.js","sourceRoot":"","sources":["../../../src/components/ChipInput/ChipInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,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E,iBAAiB;IACvC,yBAAyB,EAAE,oBAAoB;IAC/C,2BAA2B,EAAE,sBAAsB;CACtD,CAAC","sourcesContent":["import React, { useEffect, useId, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport { getThemeValue, THEME_NAME } from '../../shared/constants';\nimport Chip from '../Chip/Chip';\nimport { DragAndDrop, ORIENTATION } from '../DragAndDrop';\n\n// Prop types definition\ntype ChipInputProps = PropTypes.InferProps<typeof ChipInput.propTypes>;\n\n// Label component for the ChipInput\nconst Label = styled.label<{\n text: string;\n touched?: boolean;\n errorText?: string;\n}>`\n display: inline-flex;\n flex-direction: column;\n flex: 1;\n position: relative;\n margin: 10px 5px;\n color: inherit;\n padding: 0 8px;\n width: 250px;\n border-radius: 3px;\n border: 1px solid ${getThemeValue(THEME_NAME.BORDER_COLOR)};\n background-color: ${getThemeValue(THEME_NAME.BACKGROUND)};\n\n /** Focused */\n &:has(:focus),\n &:has(:active) {\n border-color: ${getThemeValue(THEME_NAME.PRIMARY)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};\n }\n\n &:has(:focus) > span,\n &:has(:active) > span {\n color: ${getThemeValue(THEME_NAME.PRIMARY)};\n }\n\n /** Disabled */\n &:has(:disabled) {\n border-color: ${getThemeValue(THEME_NAME.DISABLED_BORDER)};\n background-color: ${getThemeValue(THEME_NAME.DISABLED_BACKGROUND)};\n }\n\n &:has(:disabled) > span {\n color: ${getThemeValue(THEME_NAME.DISABLED)};\n }\n\n /** Invalid */\n &:has(:focus:invalid) {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.ERROR_LIGHT)};\n }\n\n ${(props) =>\n props.touched\n ? `\n &:has(:invalid) {\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n \n &:has(:invalid) > span {\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n\n /** Error */\n ${(props) =>\n props.errorText\n ? `\n border-color: ${getThemeValue(THEME_NAME.ERROR)};\n\n & > span {\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n `\n : ''}\n\n /** Required */\n &:has(:required) > span:after {\n content: '*';\n margin-left: 2px;\n color: ${getThemeValue(THEME_NAME.ERROR)};\n }\n\n & > input {\n border: none;\n outline: none;\n line-height: 30px;\n min-height: 30px;\n max-width: 95%;\n }\n\n /** Label Animation */\n & > span {\n position: absolute;\n padding: 0 5px;\n top: 0px;\n left: 4px;\n font-size: 14px;\n line-height: 32px;\n transition: all 300ms ease;\n }\n\n &:has(:focus) > span,\n &:has(:placeholder-shown) > span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n\n ${(props) =>\n props.text !== ''\n ? `\n & > span {\n top: -8px;\n background: ${getThemeValue(THEME_NAME.BACKGROUND)};\n font-size: 12px;\n line-height: 14px;\n }\n `\n : ''}\n`;\n\n// Error message container\nconst ErrorContainer = styled.div`\n color: ${getThemeValue(THEME_NAME.ERROR)};\n padding-top: 3px;\n font-size: 12px;\n line-height: 14px;\n margin-left: 3px;\n`;\n\n// Visually hidden but accessible to screen readers\nconst VisuallyHidden = styled.ul`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n\n & li {\n list-style: none;\n }\n`;\n\n/**\n * A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.\n * @component\n * @example\n * ```tsx\n * <ChipInput\n * value={['tag1', 'tag2']}\n * onChange={(newTags) => console.log(newTags)}\n * label=\"Add tags\"\n * errorText=\"At least one tag is required\"\n * />\n * ```\n */\nexport default function ChipInput(\n props: ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>,\n) {\n const [text, setText] = useState('');\n const [touched, setTouched] = useState(false);\n const [value, setValue] = useState<string[]>(props.value);\n const InputRef = React.useRef<HTMLInputElement>(null);\n const [announcement, setAnnouncement] = useState('');\n const errorId = useId();\n\n /**\n * Replace {:label} placeholder in template string\n */\n const replacePlaceholder = (\n template: string | undefined,\n label: string,\n ): string | undefined => {\n if (!template) return undefined;\n return template.replace(/\\{:label\\}/g, label);\n };\n\n // Sync internal value with props.value\n useEffect(() => {\n if (Array.isArray(props.value)) {\n setValue(props.value);\n }\n }, [props.value]);\n\n /**\n * Update the chip values and notify changes.\n * @param newValue The new array of chip values\n */\n const updateValue = (newValue: string[]) => {\n const deduped = Array.from(new Set(newValue));\n setValue(deduped);\n props.onChange?.(deduped);\n };\n\n /**\n * Marks the input as touched on focus.\n * @param e React focus event\n */\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n setTouched(true);\n if (props.onFocus) {\n props.onFocus(e);\n }\n };\n\n /**\n * Change handler for the input field.\n * @param e React change event\n */\n const handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n setText(e.target.value);\n };\n\n /**\n * Adds a new chip on Enter key press.\n * @param e React keyboard event\n */\n const handleKeyUp: React.KeyboardEventHandler<HTMLInputElement> = (e) => {\n if (e.key === 'Enter' && text.trim() !== '') {\n const newValue = [...value, text.trim()];\n updateValue(newValue);\n setText('');\n setAnnouncement(replacePlaceholder(props.addedAnnouncementTemplate, text.trim())!);\n }\n };\n\n /**\n * Removes a chip from the list.\n * @param chipToRemove The chip value to remove\n */\n const removeChip = (chipToRemove: string) => {\n const newValue = value.filter((chip) => chip !== chipToRemove);\n updateValue(newValue);\n setAnnouncement(replacePlaceholder(props.removedAnnouncementTemplate, chipToRemove)!);\n };\n\n /**\n * Moves a chip from one position to another.\n * @param start The starting index of the item to move\n * @param end The ending index where the item should be placed\n */\n const onDrop = (start: number, end: number) => {\n // Clone existing elements\n const newItems = [...value];\n // Remove the element to be moved\n const item = newItems.splice(start, 1);\n // Add it back at the required position\n newItems.splice(end, 0, item[0]);\n // Update\n updateValue(newItems);\n };\n\n // Render the component\n return (\n <>\n <Label text={text} touched={touched} errorText={props.errorText}>\n <input\n {...props}\n ref={InputRef}\n value={text}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n required={props.required && value.length === 0}\n aria-required={props.required}\n aria-invalid={!!props.errorText}\n aria-describedby={props.errorText ? errorId : undefined}\n />\n <div>\n {value?.length > 0 && (\n <DragAndDrop orientation={ORIENTATION.HORIZONTAL} onDrop={onDrop}>\n {value.map((chip) => (\n <Chip\n key={chip}\n label={chip}\n onCloseClick={() => removeChip(chip)}\n closeButtonAriaLabel={replacePlaceholder(\n props.closeButtonAriaLabel,\n chip,\n )}\n />\n ))}\n </DragAndDrop>\n )}\n </div>\n <span>{props.label}</span>\n {props.errorText && <ErrorContainer id={errorId}>{props.errorText}</ErrorContainer>}\n </Label>\n <VisuallyHidden aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </VisuallyHidden>\n </>\n );\n}\n\nChipInput.propTypes = {\n /** Label for the field */\n label: PropTypes.string.isRequired,\n /** Error message for the field */\n errorText: PropTypes.string,\n /** Values to display as chips */\n value: PropTypes.arrayOf(PropTypes.string),\n /** Callback when chips change */\n onChange: PropTypes.func,\n /** Aria label for the close button on chip. Defaults to \"Remove {label}\" */\n closeButtonAriaLabel: PropTypes.string,\n /** Announcement text when a chip is added. Defaults to \"{label} was added\" */\n addedAnnouncementTemplate: PropTypes.string,\n /** Announcement text when a chip is removed. Defaults to \"{label} was removed\" */\n removedAnnouncementTemplate: PropTypes.string,\n};\n\nChipInput.defaultProps = {\n value: [],\n closeButtonAriaLabel: 'Remove {:label}',\n addedAnnouncementTemplate: '{:label} was added',\n removedAnnouncementTemplate: '{:label} was removed',\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/AlertDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,KAAK,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;AAEtE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACjE,OAAO,CAAC,MAAM,CAAuB;IAErC,MAAM,CAAC,SAAS;QACZ,oCAAoC;;QAEpC,4BAA4B;;QAE5B,gDAAgD;;QAEhD,2BAA2B;;MAE7B;IAEF,MAAM,CAAC,YAAY;;MAEjB;IAEK,IAAI,yBAKT;IAEF,OAAO,CAAC,KAAK,CAAqC;IAElD,MAAM;CAgBT"}
1
+ {"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/AlertDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC,KAAK,WAAW,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;AAItE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACjE,OAAO,CAAC,MAAM,CAAuB;IAErC,MAAM,CAAC,SAAS;QACZ,oCAAoC;;QAEpC,4BAA4B;;QAE5B,gDAAgD;;QAEhD,2BAA2B;;MAE7B;IAEF,MAAM,CAAC,YAAY;;MAEjB;IAEK,IAAI,yBAKT;IAEF,OAAO,CAAC,KAAK,CAAqC;IAElD,MAAM;CAsBT"}
@@ -3,6 +3,7 @@ import React, { createRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Button } from '../Button';
5
5
  import Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';
6
+ let dialogCounter = 0;
6
7
  class AlertDialog extends React.Component {
7
8
  constructor() {
8
9
  super(...arguments);
@@ -16,7 +17,9 @@ class AlertDialog extends React.Component {
16
17
  this.close = () => this.dialog.current.close();
17
18
  }
18
19
  render() {
19
- return (_jsxs(Dialog, Object.assign({}, this.props.dialogProps, { ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: [this.props.header && _jsx(DialogHeader, { children: this.props.header }), _jsx(DialogBody, { children: this.props.body }), _jsx(DialogFooter, { children: _jsx(Button, { onClick: this.close, children: this.props.buttonText }) })] })));
20
+ const titleId = `nfui-alert-dialog-${dialogCounter++}-title`;
21
+ const descriptionId = `nfui-alert-dialog-${dialogCounter++}-description`;
22
+ return (_jsxs(Dialog, Object.assign({}, this.props.dialogProps, { role: "alertdialog", "aria-labelledby": titleId, "aria-describedby": descriptionId, ref: this.dialog, closeOnEsc: false, closeOnOverlayClick: false, children: [this.props.header && _jsx(DialogHeader, { id: titleId, children: this.props.header }), _jsx(DialogBody, { id: descriptionId, children: this.props.body }), _jsx(DialogFooter, { children: _jsx(Button, { onClick: this.close, children: this.props.buttonText }) })] })));
20
23
  }
21
24
  }
22
25
  AlertDialog.propTypes = {
@@ -1 +1 @@
1
- {"version":3,"file":"AlertDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/AlertDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI1E,MAAqB,WAAY,SAAQ,KAAK,CAAC,SAAsB;IAArE;;QACY,WAAM,GAAG,SAAS,EAAU,CAAC;QAiB9B,SAAI,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEM,UAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAkBtD,CAAC;IAhBG,MAAM;QACF,OAAO,CACH,MAAC,MAAM,oBACC,IAAI,CAAC,KAAK,CAAC,WAAW,IAC1B,GAAG,EAAE,IAAI,CAAC,MAAM,EAChB,UAAU,EAAE,KAAK,EACjB,mBAAmB,EAAE,KAAK,aAEzB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAC,YAAY,cAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAgB,EACtE,KAAC,UAAU,cAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAc,EAC1C,KAAC,YAAY,cACT,KAAC,MAAM,IAAC,OAAO,EAAE,IAAI,CAAC,KAAK,YAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAU,GAClD,KACV,CACZ,CAAC;IACN,CAAC;;AAvCM,qBAAS,GAAG;IACf,oCAAoC;IACpC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,UAAU;IAC9B,gDAAgD;IAChD,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,2BAA2B;IAC3B,WAAW,EAAE,SAAS,CAAC,MAAM;CAChC,AATe,CASd;AAEK,wBAAY,GAAG;IAClB,UAAU,EAAE,IAAI;CACnB,AAFkB,CAEjB;eAhBe,WAAW","sourcesContent":["import React, { createRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { Button } from '../Button';\nimport Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';\n\ntype AlertOption = PropTypes.InferProps<typeof AlertDialog.propTypes>;\n\nexport default class AlertDialog extends React.Component<AlertOption> {\n private dialog = createRef<Dialog>();\n\n static propTypes = {\n /** Shown as header of the dialog */\n header: PropTypes.string,\n /** Rendered in the body. */\n body: PropTypes.any.isRequired,\n /** Accept button text, default value is `OK` */\n buttonText: PropTypes.string,\n /** props for the dialog */\n dialogProps: PropTypes.object,\n };\n\n static defaultProps = {\n buttonText: 'OK',\n };\n\n public show = () => {\n return new Promise((resolve) => {\n const onClose = () => resolve(null);\n this.dialog.current.open(onClose);\n });\n };\n\n private close = () => this.dialog.current.close();\n\n render() {\n return (\n <Dialog\n {...this.props.dialogProps}\n ref={this.dialog}\n closeOnEsc={false}\n closeOnOverlayClick={false}\n >\n {this.props.header && <DialogHeader>{this.props.header}</DialogHeader>}\n <DialogBody>{this.props.body}</DialogBody>\n <DialogFooter>\n <Button onClick={this.close}>{this.props.buttonText}</Button>\n </DialogFooter>\n </Dialog>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"AlertDialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/AlertDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI1E,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,MAAqB,WAAY,SAAQ,KAAK,CAAC,SAAsB;IAArE;;QACY,WAAM,GAAG,SAAS,EAAU,CAAC;QAiB9B,SAAI,GAAG,GAAG,EAAE;YACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAEM,UAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAwBtD,CAAC;IAtBG,MAAM;QACF,MAAM,OAAO,GAAG,qBAAqB,aAAa,EAAE,QAAQ,CAAC;QAC7D,MAAM,aAAa,GAAG,qBAAqB,aAAa,EAAE,cAAc,CAAC;QAEzE,OAAO,CACH,MAAC,MAAM,oBACC,IAAI,CAAC,KAAK,CAAC,WAAW,IAC1B,IAAI,EAAC,aAAa,qBACD,OAAO,sBACN,aAAa,EAC/B,GAAG,EAAE,IAAI,CAAC,MAAM,EAChB,UAAU,EAAE,KAAK,EACjB,mBAAmB,EAAE,KAAK,aAEzB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,KAAC,YAAY,IAAC,EAAE,EAAE,OAAO,YAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAgB,EACnF,KAAC,UAAU,IAAC,EAAE,EAAE,aAAa,YAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAc,EAC7D,KAAC,YAAY,cACT,KAAC,MAAM,IAAC,OAAO,EAAE,IAAI,CAAC,KAAK,YAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAU,GAClD,KACV,CACZ,CAAC;IACN,CAAC;;AA7CM,qBAAS,GAAG;IACf,oCAAoC;IACpC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,4BAA4B;IAC5B,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,UAAU;IAC9B,gDAAgD;IAChD,UAAU,EAAE,SAAS,CAAC,MAAM;IAC5B,2BAA2B;IAC3B,WAAW,EAAE,SAAS,CAAC,MAAM;CAChC,AATe,CASd;AAEK,wBAAY,GAAG;IAClB,UAAU,EAAE,IAAI;CACnB,AAFkB,CAEjB;eAhBe,WAAW","sourcesContent":["import React, { createRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { Button } from '../Button';\nimport Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';\n\ntype AlertOption = PropTypes.InferProps<typeof AlertDialog.propTypes>;\n\nlet dialogCounter = 0;\n\nexport default class AlertDialog extends React.Component<AlertOption> {\n private dialog = createRef<Dialog>();\n\n static propTypes = {\n /** Shown as header of the dialog */\n header: PropTypes.string,\n /** Rendered in the body. */\n body: PropTypes.any.isRequired,\n /** Accept button text, default value is `OK` */\n buttonText: PropTypes.string,\n /** props for the dialog */\n dialogProps: PropTypes.object,\n };\n\n static defaultProps = {\n buttonText: 'OK',\n };\n\n public show = () => {\n return new Promise((resolve) => {\n const onClose = () => resolve(null);\n this.dialog.current.open(onClose);\n });\n };\n\n private close = () => this.dialog.current.close();\n\n render() {\n const titleId = `nfui-alert-dialog-${dialogCounter++}-title`;\n const descriptionId = `nfui-alert-dialog-${dialogCounter++}-description`;\n\n return (\n <Dialog\n {...this.props.dialogProps}\n role=\"alertdialog\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n ref={this.dialog}\n closeOnEsc={false}\n closeOnOverlayClick={false}\n >\n {this.props.header && <DialogHeader id={titleId}>{this.props.header}</DialogHeader>}\n <DialogBody id={descriptionId}>{this.props.body}</DialogBody>\n <DialogFooter>\n <Button onClick={this.close}>{this.props.buttonText}</Button>\n </DialogFooter>\n </Dialog>\n );\n }\n}\n"]}
@@ -17,7 +17,7 @@ interface DialogState {
17
17
  show: boolean;
18
18
  LayerComponent?: () => React.ReactPortal | null;
19
19
  }
20
- declare class Dialog extends React.Component<React.PropsWithChildren<DialogOptions>, DialogState> {
20
+ declare class Dialog extends React.Component<React.PropsWithChildren<DialogOptions> & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'ref'>, DialogState> {
21
21
  static propTypes: {
22
22
  /** Flag to close dialog on `esc` click. Default value is true. */
23
23
  closeOnEsc: PropTypes.Requireable<boolean>;
@@ -30,7 +30,32 @@ declare class Dialog extends React.Component<React.PropsWithChildren<DialogOptio
30
30
  };
31
31
  private closeDialog;
32
32
  private onCloseFn;
33
+ private lastFocusedElement;
34
+ private dialogRef;
33
35
  state: DialogState;
36
+ /**
37
+ * Retrieves all focusable elements within the dialog.
38
+ */
39
+ private getFocusableElements;
40
+ /**
41
+ * Handles keydown events to implement the focus trap.
42
+ * Traps Tab and Shift+Tab within the dialog.
43
+ */
44
+ private handleKeyDown;
45
+ /**
46
+ * Restores focus to the element that was focused before the dialog opened.
47
+ */
48
+ private restoreFocus;
49
+ /**
50
+ * Callback ref to capture the Dialog DOM element.
51
+ * Triggers initial focus setting when the element mounts.
52
+ */
53
+ private setDialogRef;
54
+ /**
55
+ * Sets initial focus within the dialog.
56
+ * Tries to focus the header first, then the first interactive element, or falls back to the container.
57
+ */
58
+ private setInitialFocus;
34
59
  shouldComponentUpdate(nextProps: DialogOptions, nextState: DialogState): boolean;
35
60
  open: (closeCallback?: (resp: unknown) => void) => void;
36
61
  close: (resp?: unknown) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,eAAO,MAAM,eAAe;;SAqBL,MACrB,WAAW;;;UANZ,CAAC;AAEF,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,MAAM,IAAI,YAAY,GACzB,MAAM,qBAAqB,CAAC;AAE7B,UAAU,aAAa;IACnB,kEAAkE;IAClE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,UAAU,WAAW;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;CACnD;AAED,cAAM,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,WAAW,CAAC;IACrF,MAAM,CAAC,SAAS;QACZ,kEAAkE;;QAElE,6DAA6D;;MAE/D;I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,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,kBAAkB,CAA4B;IACtD,OAAO,CAAC,SAAS,CAAqC;IAEtD,KAAK,EAAE,WAAW,CAGhB;IAEF;;OAEG;IACH,OAAO,CAAC,oBAAoB,CAO1B;IAEF;;;OAGG;IACH,OAAO,CAAC,aAAa,CAoBnB;IAEF;;OAEG;IACH,OAAO,CAAC,YAAY,CAUlB;IAEF;;;OAGG;IACH,OAAO,CAAC,YAAY,CAMlB;IAEF;;;OAGG;IACH,OAAO,CAAC,eAAe,CAgBrB;IAEF,qBAAqB,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW;IAI/D,IAAI,mBAAoB,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,UAoCpD;IAEK,KAAK,UAAW,OAAO,UAE5B;IAEF,OAAO,CAAC,aAAa,CAOnB;IAEF,MAAM;CAST;AAED,eAAe,MAAM,CAAC"}
@@ -36,12 +36,94 @@ export { Header as DialogHeader, Body as DialogBody, Footer as DialogFooter, } f
36
36
  class Dialog extends React.Component {
37
37
  constructor() {
38
38
  super(...arguments);
39
+ this.lastFocusedElement = null;
40
+ this.dialogRef = React.createRef();
39
41
  this.state = {
40
42
  show: false,
41
43
  LayerComponent: undefined,
42
44
  };
45
+ /**
46
+ * Retrieves all focusable elements within the dialog.
47
+ */
48
+ this.getFocusableElements = () => {
49
+ if (!this.dialogRef.current)
50
+ return [];
51
+ return Array.from(this.dialogRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));
52
+ };
53
+ /**
54
+ * Handles keydown events to implement the focus trap.
55
+ * Traps Tab and Shift+Tab within the dialog.
56
+ */
57
+ this.handleKeyDown = (e) => {
58
+ if (e.key === 'Tab') {
59
+ const focusableElements = this.getFocusableElements();
60
+ if (focusableElements.length === 0)
61
+ return;
62
+ const firstElement = focusableElements[0];
63
+ const lastElement = focusableElements[focusableElements.length - 1];
64
+ if (e.shiftKey) {
65
+ if (document.activeElement === firstElement) {
66
+ lastElement.focus();
67
+ e.preventDefault();
68
+ }
69
+ }
70
+ else {
71
+ if (document.activeElement === lastElement) {
72
+ firstElement.focus();
73
+ e.preventDefault();
74
+ }
75
+ }
76
+ }
77
+ };
78
+ /**
79
+ * Restores focus to the element that was focused before the dialog opened.
80
+ */
81
+ this.restoreFocus = () => {
82
+ if (this.lastFocusedElement) {
83
+ const elementToBeFocused = this.lastFocusedElement;
84
+ this.lastFocusedElement = null;
85
+ setTimeout(() => {
86
+ if (document.body.contains(elementToBeFocused)) {
87
+ elementToBeFocused.focus();
88
+ }
89
+ }, 100);
90
+ }
91
+ };
92
+ /**
93
+ * Callback ref to capture the Dialog DOM element.
94
+ * Triggers initial focus setting when the element mounts.
95
+ */
96
+ this.setDialogRef = (node) => {
97
+ this.dialogRef.current = node;
98
+ if (node) {
99
+ this.setInitialFocus(node);
100
+ }
101
+ };
102
+ /**
103
+ * Sets initial focus within the dialog.
104
+ * Tries to focus the header first, then the first interactive element, or falls back to the container.
105
+ */
106
+ this.setInitialFocus = (root) => {
107
+ const firstChild = root.firstElementChild;
108
+ if (firstChild) {
109
+ if (firstChild.getAttribute('tabindex') === null) {
110
+ firstChild.setAttribute('tabindex', '-1');
111
+ }
112
+ firstChild.focus();
113
+ return;
114
+ }
115
+ const focusableElements = this.getFocusableElements();
116
+ if (focusableElements.length > 0) {
117
+ focusableElements[0].focus();
118
+ }
119
+ else {
120
+ root.focus();
121
+ }
122
+ };
43
123
  this.open = (closeCallback) => {
44
124
  const _a = this.props, { closeOnEsc, closeOnOverlayClick, children } = _a, rest = __rest(_a, ["closeOnEsc", "closeOnOverlayClick", "children"]);
125
+ // Save current focus
126
+ this.lastFocusedElement = document.activeElement;
45
127
  const [Component, closeFn] = LayerManager.renderLayer({
46
128
  exitDelay: 300,
47
129
  overlay: true,
@@ -49,7 +131,7 @@ class Dialog extends React.Component {
49
131
  closeCallback: this.closeCallback,
50
132
  closeOnOverlayClick,
51
133
  position: LAYER_POSITION.DIALOG,
52
- component: (_jsx(DialogContainer, Object.assign({}, rest, { onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
134
+ component: (_jsx(DialogContainer, Object.assign({}, rest, { ref: this.setDialogRef, role: "dialog", "aria-modal": "true", tabIndex: -1, onKeyDown: this.handleKeyDown, onClick: (e) => e.stopPropagation(), elevated: true, children: children }))),
53
135
  });
54
136
  this.closeDialog = closeFn;
55
137
  this.setState({
@@ -64,6 +146,7 @@ class Dialog extends React.Component {
64
146
  };
65
147
  this.closeCallback = (resp) => {
66
148
  var _a;
149
+ this.restoreFocus();
67
150
  this.setState({
68
151
  show: false,
69
152
  LayerComponent: undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;;;;;;;;;;CAgB1C,CAAC;AAEF,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,MAAM,IAAI,YAAY,GACzB,MAAM,qBAAqB,CAAC;AAc7B,MAAM,MAAO,SAAQ,KAAK,CAAC,SAA8D;IAAzF;;QAgBI,UAAK,GAAgB;YACjB,IAAI,EAAE,KAAK;YACX,cAAc,EAAE,SAAS;SAC5B,CAAC;QAMK,SAAI,GAAG,CAAC,aAAuC,EAAE,EAAE;YACtD,MAAM,KAAyD,IAAI,CAAC,KAAK,EAAnE,EAAE,UAAU,EAAE,mBAAmB,EAA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C,KAAK,CAAC,IAAI,IAAI,cAAc,EAAE,CAAC;YACpC,OAAO,KAAC,cAAc,KAAG,CAAC;QAC9B,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;;AAtEM,gBAAS,GAAG;IACf,kEAAkE;IAClE,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,6DAA6D;IAC7D,mBAAmB,EAAE,SAAS,CAAC,IAAI;CACtC,AALe,CAKd;AAEK,mBAAY,GAAG;IAClB,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,IAAI;CAC5B,AAHkB,CAGjB;AA+DN,eAAe,MAAM,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';\nimport { Card } from '../Card';\n\nexport const DialogContainer = styled(Card)`\n max-width: 768px;\n max-height: 80vh;\n transform: scale(0);\n opacity: 0;\n transition: all 0.3s ease;\n\n .nf-layer-enter & {\n opacity: 1;\n transform: scale(1);\n }\n\n .nf-layer-exit & {\n opacity: 0;\n transform: scale(0);\n }\n`;\n\nexport {\n Header as DialogHeader,\n Body as DialogBody,\n Footer as DialogFooter,\n} from '../../shared/styles';\n\ninterface DialogOptions {\n /** Flag to close dialog on `esc` click. Default value is true. */\n closeOnEsc?: boolean;\n /** Close layer overlay is clicked. Default value is true. */\n closeOnOverlayClick?: boolean;\n}\n\ninterface DialogState {\n show: boolean;\n LayerComponent?: () => React.ReactPortal | null;\n}\n\nclass Dialog extends React.Component<React.PropsWithChildren<DialogOptions>, DialogState> {\n static propTypes = {\n /** Flag to close dialog on `esc` click. Default value is true. */\n closeOnEsc: PropTypes.bool,\n /** Close layer overlay is clicked. Default value is true. */\n closeOnOverlayClick: PropTypes.bool,\n };\n\n static defaultProps = {\n closeOnEsc: true,\n closeOnOverlayClick: true,\n };\n\n private closeDialog: (resp?: unknown) => void;\n private onCloseFn: (resp?: unknown) => void;\n\n state: DialogState = {\n show: false,\n LayerComponent: undefined,\n };\n\n shouldComponentUpdate(nextProps: DialogOptions, nextState: DialogState) {\n return this.state.show !== nextState.show;\n }\n\n public open = (closeCallback?: (resp: unknown) => void) => {\n const { closeOnEsc, closeOnOverlayClick, children, ...rest } = this.props;\n\n const [Component, closeFn] = LayerManager.renderLayer({\n exitDelay: 300,\n overlay: true,\n closeOnEsc,\n closeCallback: this.closeCallback,\n closeOnOverlayClick,\n position: LAYER_POSITION.DIALOG,\n component: (\n <DialogContainer {...rest} onClick={(e) => e.stopPropagation()} elevated>\n {children}\n </DialogContainer>\n ),\n });\n\n this.closeDialog = closeFn;\n\n this.setState({\n show: true,\n LayerComponent: Component,\n });\n this.onCloseFn = closeCallback;\n };\n\n public close = (resp?: unknown) => {\n this.closeDialog?.(resp);\n };\n\n private closeCallback = (resp?: unknown) => {\n this.setState({\n show: false,\n LayerComponent: undefined,\n });\n this.onCloseFn?.(resp);\n };\n\n render() {\n const { LayerComponent } = this.state;\n\n if (this.state.show && LayerComponent) {\n return <LayerComponent />;\n } else {\n return null;\n }\n }\n}\n\nexport default Dialog;\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,YAAY,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;;;;;;;;;;CAgB1C,CAAC;AAEF,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,IAAI,IAAI,UAAU,EAClB,MAAM,IAAI,YAAY,GACzB,MAAM,qBAAqB,CAAC;A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pB,IAAI,CAAC,QAAQ,CAAC;gBACV,IAAI,EAAE,KAAK;gBACX,cAAc,EAAE,SAAS;aAC5B,CAAC,CAAC;YACH,MAAA,IAAI,CAAC,SAAS,qDAAG,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC;IAWN,CAAC;IAhEG,qBAAqB,CAAC,SAAwB,EAAE,SAAsB;QAClE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC;IAC9C,CAAC;IAqDD,MAAM;QACF,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEtC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAc,EAAE,CAAC;YACpC,OAAO,KAAC,cAAc,KAAG,CAAC;QAC9B,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;;AA5KM,gBAAS,GAAG;IACf,kEAAkE;IAClE,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,6DAA6D;IAC7D,mBAAmB,EAAE,SAAS,CAAC,IAAI;CACtC,AALe,CAKd;AAEK,mBAAY,GAAG;IAClB,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,IAAI;CAC5B,AAHkB,CAGjB;AAqKN,eAAe,MAAM,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport styled from '@emotion/styled';\nimport LayerManager, { LAYER_POSITION } from '../../shared/LayerManager';\nimport { Card } from '../Card';\n\nexport const DialogContainer = styled(Card)`\n max-width: 768px;\n max-height: 80vh;\n transform: scale(0);\n opacity: 0;\n transition: all 0.3s ease;\n\n .nf-layer-enter & {\n opacity: 1;\n transform: scale(1);\n }\n\n .nf-layer-exit & {\n opacity: 0;\n transform: scale(0);\n }\n`;\n\nexport {\n Header as DialogHeader,\n Body as DialogBody,\n Footer as DialogFooter,\n} from '../../shared/styles';\n\ninterface DialogOptions {\n /** Flag to close dialog on `esc` click. Default value is true. */\n closeOnEsc?: boolean;\n /** Close layer overlay is clicked. Default value is true. */\n closeOnOverlayClick?: boolean;\n}\n\ninterface DialogState {\n show: boolean;\n LayerComponent?: () => React.ReactPortal | null;\n}\n\nclass Dialog extends React.Component<\n React.PropsWithChildren<DialogOptions> & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'ref'>,\n DialogState\n> {\n static propTypes = {\n /** Flag to close dialog on `esc` click. Default value is true. */\n closeOnEsc: PropTypes.bool,\n /** Close layer overlay is clicked. Default value is true. */\n closeOnOverlayClick: PropTypes.bool,\n };\n\n static defaultProps = {\n closeOnEsc: true,\n closeOnOverlayClick: true,\n };\n\n private closeDialog: (resp?: unknown) => void;\n private onCloseFn: (resp?: unknown) => void;\n private lastFocusedElement: HTMLElement | null = null;\n private dialogRef = React.createRef<HTMLDivElement>();\n\n state: DialogState = {\n show: false,\n LayerComponent: undefined,\n };\n\n /**\n * Retrieves all focusable elements within the dialog.\n */\n private getFocusableElements = (): HTMLElement[] => {\n if (!this.dialogRef.current) return [];\n return Array.from(\n this.dialogRef.current.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n ),\n ) as HTMLElement[];\n };\n\n /**\n * Handles keydown events to implement the focus trap.\n * Traps Tab and Shift+Tab within the dialog.\n */\n private handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Tab') {\n const focusableElements = this.getFocusableElements();\n if (focusableElements.length === 0) return;\n\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n\n if (e.shiftKey) {\n if (document.activeElement === firstElement) {\n lastElement.focus();\n e.preventDefault();\n }\n } else {\n if (document.activeElement === lastElement) {\n firstElement.focus();\n e.preventDefault();\n }\n }\n }\n };\n\n /**\n * Restores focus to the element that was focused before the dialog opened.\n */\n private restoreFocus = () => {\n if (this.lastFocusedElement) {\n const elementToBeFocused = this.lastFocusedElement;\n this.lastFocusedElement = null;\n setTimeout(() => {\n if (document.body.contains(elementToBeFocused)) {\n elementToBeFocused.focus();\n }\n }, 100);\n }\n };\n\n /**\n * Callback ref to capture the Dialog DOM element.\n * Triggers initial focus setting when the element mounts.\n */\n private setDialogRef = (node: HTMLDivElement | null) => {\n (this.dialogRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n\n if (node) {\n this.setInitialFocus(node);\n }\n };\n\n /**\n * Sets initial focus within the dialog.\n * Tries to focus the header first, then the first interactive element, or falls back to the container.\n */\n private setInitialFocus = (root: HTMLElement) => {\n const firstChild = root.firstElementChild as HTMLElement;\n if (firstChild) {\n if (firstChild.getAttribute('tabindex') === null) {\n firstChild.setAttribute('tabindex', '-1');\n }\n firstChild.focus();\n return;\n }\n\n const focusableElements = this.getFocusableElements();\n if (focusableElements.length > 0) {\n focusableElements[0].focus();\n } else {\n root.focus();\n }\n };\n\n shouldComponentUpdate(nextProps: DialogOptions, nextState: DialogState) {\n return this.state.show !== nextState.show;\n }\n\n public open = (closeCallback?: (resp: unknown) => void) => {\n const { closeOnEsc, closeOnOverlayClick, children, ...rest } = this.props;\n\n // Save current focus\n this.lastFocusedElement = document.activeElement as HTMLElement;\n\n const [Component, closeFn] = LayerManager.renderLayer({\n exitDelay: 300,\n overlay: true,\n closeOnEsc,\n closeCallback: this.closeCallback,\n closeOnOverlayClick,\n position: LAYER_POSITION.DIALOG,\n component: (\n <DialogContainer\n {...rest}\n ref={this.setDialogRef}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n onKeyDown={this.handleKeyDown}\n onClick={(e) => e.stopPropagation()}\n elevated\n >\n {children}\n </DialogContainer>\n ),\n });\n\n this.closeDialog = closeFn;\n\n this.setState({\n show: true,\n LayerComponent: Component,\n });\n this.onCloseFn = closeCallback;\n };\n\n public close = (resp?: unknown) => {\n this.closeDialog?.(resp);\n };\n\n private closeCallback = (resp?: unknown) => {\n this.restoreFocus();\n this.setState({\n show: false,\n LayerComponent: undefined,\n });\n this.onCloseFn?.(resp);\n };\n\n render() {\n const { LayerComponent } = this.state;\n\n if (this.state.show && LayerComponent) {\n return <LayerComponent />;\n } else {\n return null;\n }\n }\n}\n\nexport default Dialog;\n"]}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import { useContext, useState, useEffect, } from 'react';
3
3
  import styled from '@emotion/styled';
4
4
  import { DragIndicator } from '../../icons';
5
- import constants from '../../shared/constants';
5
+ import { getThemeValue, THEME_NAME } from '../../shared/constants';
6
6
  import { ORIENTATION, DragContext } from './types';
7
7
  /** Styled component for the draggable item container */
8
8
  const Item = styled.div `
@@ -11,25 +11,25 @@ const Item = styled.div `
11
11
  user-select: ${(props) => (props.showIndicator ? 'auto' : 'none')};
12
12
  border-top: 2px dashed
13
13
  ${(props) => props.orientation === ORIENTATION.VERTICAL && props.active > 0
14
- ? constants.PRIMARY
14
+ ? getThemeValue(THEME_NAME.PRIMARY)
15
15
  : 'transparent'};
16
16
  border-bottom: 2px dashed
17
17
  ${(props) => props.orientation === ORIENTATION.VERTICAL && props.active < 0
18
- ? constants.PRIMARY
18
+ ? getThemeValue(THEME_NAME.PRIMARY)
19
19
  : 'transparent'};
20
20
  border-left: 2px dashed
21
21
  ${(props) => props.orientation === ORIENTATION.HORIZONTAL && props.active > 0
22
- ? constants.PRIMARY
22
+ ? getThemeValue(THEME_NAME.PRIMARY)
23
23
  : 'transparent'};
24
24
  border-right: 2px dashed
25
25
  ${(props) => props.orientation === ORIENTATION.HORIZONTAL && props.active < 0
26
- ? constants.PRIMARY
26
+ ? getThemeValue(THEME_NAME.PRIMARY)
27
27
  : 'transparent'};
28
28
  opacity: ${(props) => (props.dragging ? 0.5 : 1)};
29
29
  border-radius: 10px;
30
30
 
31
31
  &:focus {
32
- box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
32
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
33
33
  }
34
34
 
35
35
  &:focus:not(:focus-visible) {
@@ -37,7 +37,7 @@ const Item = styled.div `
37
37
  }
38
38
 
39
39
  &:focus-visible {
40
- box-shadow: 0 0 0 4px var(--primary, ${constants.PRIMARY_LIGHT});
40
+ box-shadow: 0 0 0 4px ${getThemeValue(THEME_NAME.PRIMARY_LIGHT)};
41
41
  }
42
42
  `;
43
43
  /** Styled component for the drag handle indicator */
@@ -45,7 +45,7 @@ const DragKnob = styled.div `
45
45
  padding-top: 8px;
46
46
  cursor: move;
47
47
  touch-action: none;
48
- color: var(--disabled, ${constants.DISABLED});
48
+ color: ${getThemeValue(THEME_NAME.DISABLED)};
49
49
  `;
50
50
  /** Container for the children */
51
51
  const Container = styled.div `