@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.
- package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.cjs +6 -4
- package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.module.scss.cjs +2 -0
- package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +4 -2
- package/dist/cjs/Modal/ContextModal/ContextModal.cjs +4 -2
- package/dist/cjs/Modal/GenericModal/GenericModal.cjs +12 -9
- package/dist/cjs/Modal/InputEditModal/InputEditModal.cjs +4 -2
- package/dist/cjs/RichTextEditor/utils/plugins/LinkManager/components/LinkModal/LinkModal.cjs +5 -1
- package/dist/cjs/index.css +3 -3
- package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.mjs +6 -4
- package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.module.scss.mjs +2 -0
- package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +4 -2
- package/dist/esm/Modal/ContextModal/ContextModal.mjs +4 -2
- package/dist/esm/Modal/GenericModal/GenericModal.mjs +12 -9
- package/dist/esm/Modal/InputEditModal/InputEditModal.mjs +4 -2
- package/dist/esm/RichTextEditor/utils/plugins/LinkManager/components/LinkModal/LinkModal.mjs +5 -1
- package/dist/esm/index.css +3 -3
- package/dist/styles.css +1 -1
- package/dist/types/LikertScaleLegacy/LikertScaleLegacy.d.ts +3 -2
- package/dist/types/LikertScaleLegacy/types.d.ts +1 -0
- package/dist/types/Modal/ConfirmationModal/ConfirmationModal.d.ts +4 -1
- package/dist/types/Modal/ContextModal/ContextModal.d.ts +4 -1
- package/dist/types/Modal/GenericModal/GenericModal.d.ts +4 -1
- package/dist/types/Modal/InputEditModal/InputEditModal.d.ts +4 -1
- package/package.json +3 -3
- package/src/LikertScaleLegacy/LikertScaleLegacy.module.scss +66 -17
- package/src/LikertScaleLegacy/LikertScaleLegacy.tsx +6 -1
- package/src/LikertScaleLegacy/_docs/LikertScaleLegacy.stickersheet.stories.tsx +26 -4
- package/src/LikertScaleLegacy/types.ts +2 -0
- package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +5 -0
- package/src/Modal/ContextModal/ContextModal.tsx +5 -0
- package/src/Modal/GenericModal/GenericModal.tsx +18 -10
- package/src/Modal/GenericModal/_docs/GenericModal.spec.stories.tsx +124 -0
- package/src/Modal/InputEditModal/InputEditModal.tsx +5 -0
- package/src/Modal/InputEditModal/_docs/InputEditModal.mdx +11 -0
- package/src/Modal/InputEditModal/_docs/InputEditModal.stories.tsx +63 -1
- 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
|
+
}
|