@kaizen/components 1.42.7 → 1.44.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 (36) hide show
  1. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.cjs +6 -4
  2. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.module.scss.cjs +2 -0
  3. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +4 -2
  4. package/dist/cjs/Modal/ContextModal/ContextModal.cjs +4 -2
  5. package/dist/cjs/Modal/GenericModal/GenericModal.cjs +12 -9
  6. package/dist/cjs/Modal/InputEditModal/InputEditModal.cjs +4 -2
  7. package/dist/cjs/RichTextEditor/utils/plugins/LinkManager/components/LinkModal/LinkModal.cjs +5 -1
  8. package/dist/cjs/index.css +3 -3
  9. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.mjs +6 -4
  10. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.module.scss.mjs +2 -0
  11. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +4 -2
  12. package/dist/esm/Modal/ContextModal/ContextModal.mjs +4 -2
  13. package/dist/esm/Modal/GenericModal/GenericModal.mjs +12 -9
  14. package/dist/esm/Modal/InputEditModal/InputEditModal.mjs +4 -2
  15. package/dist/esm/RichTextEditor/utils/plugins/LinkManager/components/LinkModal/LinkModal.mjs +5 -1
  16. package/dist/esm/index.css +3 -3
  17. package/dist/styles.css +1 -1
  18. package/dist/types/LikertScaleLegacy/LikertScaleLegacy.d.ts +3 -2
  19. package/dist/types/LikertScaleLegacy/types.d.ts +1 -0
  20. package/dist/types/Modal/ConfirmationModal/ConfirmationModal.d.ts +4 -1
  21. package/dist/types/Modal/ContextModal/ContextModal.d.ts +4 -1
  22. package/dist/types/Modal/GenericModal/GenericModal.d.ts +4 -1
  23. package/dist/types/Modal/InputEditModal/InputEditModal.d.ts +4 -1
  24. package/package.json +3 -3
  25. package/src/LikertScaleLegacy/LikertScaleLegacy.module.scss +66 -17
  26. package/src/LikertScaleLegacy/LikertScaleLegacy.tsx +6 -1
  27. package/src/LikertScaleLegacy/_docs/LikertScaleLegacy.stickersheet.stories.tsx +26 -4
  28. package/src/LikertScaleLegacy/types.ts +2 -0
  29. package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +5 -0
  30. package/src/Modal/ContextModal/ContextModal.tsx +5 -0
  31. package/src/Modal/GenericModal/GenericModal.tsx +18 -10
  32. package/src/Modal/GenericModal/_docs/GenericModal.spec.stories.tsx +124 -0
  33. package/src/Modal/InputEditModal/InputEditModal.tsx +5 -0
  34. package/src/Modal/InputEditModal/_docs/InputEditModal.mdx +11 -0
  35. package/src/Modal/InputEditModal/_docs/InputEditModal.stories.tsx +63 -1
  36. package/src/RichTextEditor/utils/plugins/LinkManager/components/LinkModal/LinkModal.tsx +1 -0
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react"
1
+ import React, { useRef, useState } from "react"
2
2
  import { Meta, StoryObj } from "@storybook/react"
3
3
  import { fn } from "@storybook/test"
4
4
  import isChromatic from "chromatic"
@@ -101,3 +101,65 @@ export const Unpadded: Story = {
101
101
  args: { unpadded: true },
102
102
  ...chromaticModalSettings,
103
103
  }
104
+
105
+ export const OnAfterEnter: Story = {
106
+ ...chromaticModalSettings,
107
+ args: {
108
+ title: "Create new link",
109
+ submitLabel: "Add link",
110
+ },
111
+ render: args => {
112
+ const [isOpen, setIsOpen] = useState(IS_CHROMATIC)
113
+ const inputRef = useRef<HTMLInputElement>(null)
114
+ const handleOpen = (): void => setIsOpen(true)
115
+ const handleClose = (): void => setIsOpen(false)
116
+
117
+ return (
118
+ <>
119
+ <button
120
+ type="button"
121
+ className="border border-gray-500"
122
+ onClick={handleOpen}
123
+ >
124
+ Create a link
125
+ </button>
126
+ <InputEditModal
127
+ {...args}
128
+ isOpen={isOpen}
129
+ onSubmit={handleClose}
130
+ onDismiss={handleClose}
131
+ onAfterEnter={() => inputRef.current?.focus()}
132
+ >
133
+ <form>
134
+ <TextField inputRef={inputRef} labelText="Link URL" />
135
+ </form>
136
+ </InputEditModal>
137
+ </>
138
+ )
139
+ },
140
+ parameters: {
141
+ docs: {
142
+ source: {
143
+ code: `
144
+ // The label of the button and the input it is focused to may provide enough context.
145
+ <button
146
+ onClick={handleOpen}
147
+ >
148
+ Create a link
149
+ </button>
150
+ <InputEditModal
151
+ {...args}
152
+ isOpen={isOpen}
153
+ onSubmit={handleClose}
154
+ onDismiss={handleClose}
155
+ onAfterEnter={() => inputRef.current?.focus()}
156
+ >
157
+ <form>
158
+ <TextField inputRef={inputRef} labelText="Link URL" />
159
+ </form>
160
+ </InputEditModal>
161
+ `,
162
+ },
163
+ },
164
+ },
165
+ }
@@ -44,6 +44,7 @@ export const LinkModal = ({
44
44
  onSubmit={handleSubmit}
45
45
  onDismiss={onDismiss}
46
46
  onAfterLeave={onAfterLeave}
47
+ onAfterEnter={() => inputRef.current?.focus()}
47
48
  >
48
49
  <TextField
49
50
  id="href"