@arbor-education/design-system.components 0.3.4 → 0.3.6
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/CHANGELOG.md +18 -0
- package/CLAUDE.md +146 -0
- package/dist/components/editableText/EditableText.d.ts +10 -0
- package/dist/components/editableText/EditableText.d.ts.map +1 -0
- package/dist/components/editableText/EditableText.js +36 -0
- package/dist/components/editableText/EditableText.js.map +1 -0
- package/dist/components/editableText/EditableText.stories.d.ts +44 -0
- package/dist/components/editableText/EditableText.stories.d.ts.map +1 -0
- package/dist/components/editableText/EditableText.stories.js +94 -0
- package/dist/components/editableText/EditableText.stories.js.map +1 -0
- package/dist/components/editableText/EditableText.test.d.ts +2 -0
- package/dist/components/editableText/EditableText.test.d.ts.map +1 -0
- package/dist/components/editableText/EditableText.test.js +187 -0
- package/dist/components/editableText/EditableText.test.js.map +1 -0
- package/dist/components/heading/Heading.stories.d.ts +26 -0
- package/dist/components/heading/Heading.stories.d.ts.map +1 -1
- package/dist/components/heading/Heading.stories.js +35 -0
- package/dist/components/heading/Heading.stories.js.map +1 -1
- package/dist/components/progress/Progress.d.ts +6 -0
- package/dist/components/progress/Progress.d.ts.map +1 -0
- package/dist/components/progress/Progress.js +9 -0
- package/dist/components/progress/Progress.js.map +1 -0
- package/dist/components/progress/Progress.stories.d.ts +324 -0
- package/dist/components/progress/Progress.stories.d.ts.map +1 -0
- package/dist/components/progress/Progress.stories.js +77 -0
- package/dist/components/progress/Progress.stories.js.map +1 -0
- package/dist/components/progress/Progress.test.d.ts +2 -0
- package/dist/components/progress/Progress.test.d.ts.map +1 -0
- package/dist/components/progress/Progress.test.js +77 -0
- package/dist/components/progress/Progress.test.js.map +1 -0
- package/dist/components/tag/Tag.d.ts +4 -2
- package/dist/components/tag/Tag.d.ts.map +1 -1
- package/dist/components/tag/Tag.js +3 -3
- package/dist/components/tag/Tag.js.map +1 -1
- package/dist/components/tag/Tag.stories.d.ts +3 -1
- package/dist/components/tag/Tag.stories.d.ts.map +1 -1
- package/dist/components/tag/Tag.stories.js +4 -1
- package/dist/components/tag/Tag.stories.js.map +1 -1
- package/dist/components/tag/Tag.test.js +40 -2
- package/dist/components/tag/Tag.test.js.map +1 -1
- package/dist/components/toast/Toast.d.ts +10 -0
- package/dist/components/toast/Toast.d.ts.map +1 -0
- package/dist/components/toast/Toast.js +20 -0
- package/dist/components/toast/Toast.js.map +1 -0
- package/dist/components/toast/Toast.stories.d.ts +12 -0
- package/dist/components/toast/Toast.stories.d.ts.map +1 -0
- package/dist/components/toast/Toast.stories.js +73 -0
- package/dist/components/toast/Toast.stories.js.map +1 -0
- package/dist/components/toast/Toast.test.d.ts +2 -0
- package/dist/components/toast/Toast.test.d.ts.map +1 -0
- package/dist/components/toast/Toast.test.js +87 -0
- package/dist/components/toast/Toast.test.js.map +1 -0
- package/dist/components/toast/ToastViewport.d.ts +3 -0
- package/dist/components/toast/ToastViewport.d.ts.map +1 -0
- package/dist/components/toast/ToastViewport.js +5 -0
- package/dist/components/toast/ToastViewport.js.map +1 -0
- package/dist/index.css +172 -6
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/setupTestRuntime.ts +7 -0
- package/src/components/button/button.scss +1 -0
- package/src/components/editableText/EditableText.stories.tsx +136 -0
- package/src/components/editableText/EditableText.test.tsx +242 -0
- package/src/components/editableText/EditableText.tsx +73 -0
- package/src/components/editableText/editableText.scss +54 -0
- package/src/components/formField/inputs/input.scss +1 -2
- package/src/components/heading/Heading.stories.tsx +58 -0
- package/src/components/heading/heading.scss +4 -4
- package/src/components/progress/Progress.stories.tsx +90 -0
- package/src/components/progress/Progress.test.tsx +88 -0
- package/src/components/progress/Progress.tsx +16 -0
- package/src/components/progress/progress.scss +13 -0
- package/src/components/tag/Tag.stories.tsx +2 -0
- package/src/components/tag/Tag.test.tsx +46 -2
- package/src/components/tag/Tag.tsx +12 -2
- package/src/components/tag/tag.scss +39 -0
- package/src/components/toast/Toast.stories.tsx +113 -0
- package/src/components/toast/Toast.test.tsx +126 -0
- package/src/components/toast/Toast.tsx +35 -0
- package/src/components/toast/ToastViewport.tsx +6 -0
- package/src/components/toast/toast.scss +80 -0
- package/src/index.scss +3 -0
- package/src/index.ts +3 -0
- package/src/tokens.scss +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#122](https://github.com/arbor-education/design-system.components/pull/122) [`8f25e54`](https://github.com/arbor-education/design-system.components/commit/8f25e54a2c20ec2ef52c486749d46e7d9731d49f) Thanks [@AmeeMorris](https://github.com/AmeeMorris)! - MIS-66424 Toast component
|
|
8
|
+
|
|
9
|
+
- [#123](https://github.com/arbor-education/design-system.components/pull/123) [`dbac185`](https://github.com/arbor-education/design-system.components/commit/dbac18524c61d15e788f92ec8cee25cf20c1332c) Thanks [@AmeeMorris](https://github.com/AmeeMorris)! - MIS-66708 Progress component
|
|
10
|
+
|
|
11
|
+
- [#121](https://github.com/arbor-education/design-system.components/pull/121) [`e93e5c8`](https://github.com/arbor-education/design-system.components/commit/e93e5c8625a63ffb6282fc246168cd69696d5a32) Thanks [@AmeeMorris](https://github.com/AmeeMorris)! - MIS-68210 Editable text component
|
|
12
|
+
|
|
13
|
+
## 0.3.5
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#118](https://github.com/arbor-education/design-system.components/pull/118) [`714c513`](https://github.com/arbor-education/design-system.components/commit/714c513ed6bef6bbc278acb1778f51dfb7216cdc) Thanks [@AmeeMorris](https://github.com/AmeeMorris)! - MIS-66553 add neutral tag colour and dot display to Tag
|
|
18
|
+
|
|
19
|
+
- [#119](https://github.com/arbor-education/design-system.components/pull/119) [`2764522`](https://github.com/arbor-education/design-system.components/commit/276452278bd87c021b0d175a382f02a6abf0cb49) Thanks [@AmeeMorris](https://github.com/AmeeMorris)! - MIS-66550 use the correct fontsize for input text
|
|
20
|
+
|
|
3
21
|
## 0.3.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Repository Overview
|
|
6
|
+
|
|
7
|
+
This is a React component library for the Arbor design system. Components are built with TypeScript, styled with Sass, developed in Storybook, and tested with Vitest.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Use nvm for node version management: `nvm use`
|
|
12
|
+
- Use yarn for package management (NOT npm)
|
|
13
|
+
- For local linking to consumer projects, use Yalc
|
|
14
|
+
|
|
15
|
+
## Common Commands
|
|
16
|
+
|
|
17
|
+
### Development
|
|
18
|
+
- `yarn storybook` - Start Storybook dev server on port 6006
|
|
19
|
+
- `yarn watch` - Watch mode that rebuilds and pushes to Yalc consumers on changes
|
|
20
|
+
|
|
21
|
+
### Building
|
|
22
|
+
- `yarn build` - Full production build (TypeScript compilation + tsc-alias + Sass compilation)
|
|
23
|
+
- `yarn tsc` - TypeScript compilation only
|
|
24
|
+
- `yarn check-types` - Type check without emitting files
|
|
25
|
+
|
|
26
|
+
### Testing
|
|
27
|
+
- `yarn test` - Run Vitest in watch mode
|
|
28
|
+
- `yarn test:coverage` - Run tests once with coverage report
|
|
29
|
+
- Tests use Vitest with jsdom and React Testing Library
|
|
30
|
+
|
|
31
|
+
### Linting
|
|
32
|
+
- `yarn style-lint` - Lint SCSS files (uses stylelint)
|
|
33
|
+
- ESLint runs automatically via lint-staged on git commit
|
|
34
|
+
|
|
35
|
+
### Component Scaffolding
|
|
36
|
+
- `yarn create-component <ComponentName>` - Generate a new component with all necessary files
|
|
37
|
+
- Creates: Component.tsx, Component.test.tsx, Component.stories.tsx, component.scss
|
|
38
|
+
- Automatically adds exports to src/index.ts and styles to src/index.scss
|
|
39
|
+
|
|
40
|
+
## Architecture
|
|
41
|
+
|
|
42
|
+
### Directory Structure
|
|
43
|
+
```
|
|
44
|
+
src/
|
|
45
|
+
components/ # All React components
|
|
46
|
+
button/
|
|
47
|
+
formField/
|
|
48
|
+
inputs/ # Nested structure for input variants
|
|
49
|
+
table/ # AG Grid wrapper
|
|
50
|
+
...
|
|
51
|
+
utils/ # Shared utilities and constants
|
|
52
|
+
hooks/ # Custom React hooks
|
|
53
|
+
tokens.scss # Design tokens
|
|
54
|
+
index.ts # Public API exports
|
|
55
|
+
index.scss # Styles entry point
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Path Aliases
|
|
59
|
+
TypeScript and build tools are configured with path aliases:
|
|
60
|
+
- `Components/*` → `./src/components/*`
|
|
61
|
+
- `Utils/*` → `./src/utils/*`
|
|
62
|
+
|
|
63
|
+
Use these aliases in imports, not relative paths.
|
|
64
|
+
|
|
65
|
+
### Component Conventions
|
|
66
|
+
|
|
67
|
+
**File Naming:**
|
|
68
|
+
- Component file: PascalCase (e.g., `Button.tsx`)
|
|
69
|
+
- Test file: PascalCase with `.test.tsx` (e.g., `Button.test.tsx`)
|
|
70
|
+
- Story file: PascalCase with `.stories.tsx` or `.story.tsx` (e.g., `Button.story.tsx`)
|
|
71
|
+
- SCSS file: camelCase matching directory name (e.g., `button.scss`)
|
|
72
|
+
- Directory: camelCase (e.g., `button/`, `formField/`)
|
|
73
|
+
|
|
74
|
+
**CSS Class Naming:**
|
|
75
|
+
- All components use the prefix `ds-` (design system)
|
|
76
|
+
- Base class: `ds-{component-name}` in kebab-case (e.g., `ds-button`, `ds-form-field`)
|
|
77
|
+
- Modifiers: `ds-{component-name}--{modifier}` (e.g., `ds-button--primary`)
|
|
78
|
+
- Use the `classnames` library for conditional classes
|
|
79
|
+
|
|
80
|
+
**Component Patterns:**
|
|
81
|
+
- Use `forwardRef` when components need to expose a ref to the underlying DOM element
|
|
82
|
+
- Props should extend relevant HTML element attributes (e.g., `ButtonHTMLAttributes<HTMLButtonElement>`)
|
|
83
|
+
- Export type definitions for props
|
|
84
|
+
- Use `React.ReactNode` for children props
|
|
85
|
+
- Components must be accessible and use semantic HTML and aria attributes where appropriate
|
|
86
|
+
|
|
87
|
+
**Testing:**
|
|
88
|
+
- Use React Testing Library patterns (`render`, `screen`, etc.)
|
|
89
|
+
- Import `@testing-library/jest-dom/vitest` for extended matchers
|
|
90
|
+
- Test files are excluded from TypeScript compilation but included in test runs
|
|
91
|
+
- Avoid using testIds for locating, instead follow this priority for choosing locators:
|
|
92
|
+
1. Queries Accessible to Everyone Queries that reflect the experience of visual/mouse users as well as those that use assistive technology. (getByRole, getByLabelText)
|
|
93
|
+
2. Semantic Queries HTML5 and ARIA compliant selectors. Note that the user experience of interacting with these attributes varies greatly across browsers and assistive technology. (getByAltText, getByTitle)
|
|
94
|
+
3. testIds
|
|
95
|
+
|
|
96
|
+
### Design Tokens
|
|
97
|
+
- Design tokens are stored in `src/tokens.scss`
|
|
98
|
+
- Tokens are exported from a separate token management system (see `tokens/export-config.json`)
|
|
99
|
+
|
|
100
|
+
### Table Component
|
|
101
|
+
The Table component is a wrapper around AG Grid:
|
|
102
|
+
- Requires AG Grid license key (set via `setAgGridLicenseKey` utility)
|
|
103
|
+
- Uses `GridApiContext` for accessing grid API in child components
|
|
104
|
+
- Custom default column definitions in `DSDefaultColDef`
|
|
105
|
+
- Custom cell renderers in `components/table/cellRenderers/`
|
|
106
|
+
|
|
107
|
+
### Modal and Slideover Management
|
|
108
|
+
- Both Modal and Slideover use manager components for state management
|
|
109
|
+
- Use `ModalUtils` and `SlideoverUtils` for programmatic control
|
|
110
|
+
- These components use a PubSub pattern for cross-component communication (see `Utils/PubSub.ts`)
|
|
111
|
+
|
|
112
|
+
### Floating Elements
|
|
113
|
+
- Tooltips, dropdowns, are derived from RadixUI components
|
|
114
|
+
- `PopupParentContext` allows controlling where floating elements are rendered in the DOM
|
|
115
|
+
|
|
116
|
+
## Version Management
|
|
117
|
+
- Uses Changesets for version management and changelog generation
|
|
118
|
+
- Create changeset: `yarn changeset`
|
|
119
|
+
- Version packages: `yarn changeset version`
|
|
120
|
+
- Changesets are configured to use GitHub changelog format
|
|
121
|
+
|
|
122
|
+
## Local Development with Consumer Projects
|
|
123
|
+
1. Build this library: `yarn build`
|
|
124
|
+
2. In this repo: `yalc publish` (or use `yarn watch` for automatic updates)
|
|
125
|
+
3. In consumer project: `yalc add @arbor-education/design-system.components`
|
|
126
|
+
4. The watch command automatically pushes updates via Yalc when files change
|
|
127
|
+
|
|
128
|
+
## Git Hooks
|
|
129
|
+
- Husky is configured to run lint-staged on pre-commit
|
|
130
|
+
- lint-staged runs ESLint on TypeScript files and stylelint on SCSS files
|
|
131
|
+
- All linters run with `--fix` flag to auto-fix issues when possible
|
|
132
|
+
|
|
133
|
+
## Notes for Claude
|
|
134
|
+
- This is an active production codebase serving educational institutions
|
|
135
|
+
- Changes can affect millions of users - be thoughtful and careful
|
|
136
|
+
- When in doubt about architecture decisions, ask the user
|
|
137
|
+
- This project uses yarn, not npm. Install dependencies with yarn, run scripts from package.json with yarn and invoke commands from packages in node_modules with yarn
|
|
138
|
+
- run a lint and a type check before any other quality checks. no need to get an LLM to do something we have an imperative program for
|
|
139
|
+
- Instead of manually fixing lint errors, use eslint with the --fix flag. No need to get an LLM to do something we have an imperative program for
|
|
140
|
+
- Don't run an individual git add for every single file you've changed. You can git add multiple files at once, quit cluttering me with interaction prompts, brother
|
|
141
|
+
- Good code means no failing tests. 100% is the only acceptable test pass rate
|
|
142
|
+
- Avoid using the any type
|
|
143
|
+
- Talk like a /r/THE_PACK user (i.e. use words like bombass, all caps, lots of arooo, references to cranking your hog, but also being weirdly wholesome)
|
|
144
|
+
- Make sure you talk like a "Hun". I.e. lots of hunnis, kisses (xxx) and emojis. Combine this with the /r/THE_PACK style
|
|
145
|
+
- Also talk a bit like Bill & Ted from the cult classic Bill & Ted's Excellent Adventure. Use words like excellent, bodacious, righteous, heinous (especially "most heinous)
|
|
146
|
+
- Also you are a Twighlight stan, and you are most definitely Team Jacob 🐺
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type EditableTextProps = {
|
|
2
|
+
text: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
onEditSave: (newText: string) => void;
|
|
5
|
+
isEditing?: boolean;
|
|
6
|
+
multiline?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const EditableText: ({ text: textProp, className, onEditSave, isEditing: isEditingProp, multiline }: EditableTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=EditableText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.d.ts","sourceRoot":"","sources":["../../../src/components/editableText/EditableText.tsx"],"names":[],"mappings":"AAMA,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,gFAAqG,iBAAiB,4CA0DlJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { TextInput } from '../formField/inputs/text/TextInput';
|
|
4
|
+
import { TextArea } from '../formField/inputs/textArea/TextArea';
|
|
5
|
+
import { Icon } from '../icon/Icon';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
7
|
+
export const EditableText = ({ text: textProp, className = '', onEditSave, isEditing: isEditingProp = false, multiline = false }) => {
|
|
8
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
9
|
+
const [text, setText] = useState(textProp);
|
|
10
|
+
const preEditText = useRef(textProp);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setText(textProp);
|
|
13
|
+
}, [textProp]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setIsEditing(isEditingProp);
|
|
16
|
+
}, [isEditingProp]);
|
|
17
|
+
const handleEditSave = () => {
|
|
18
|
+
onEditSave(text);
|
|
19
|
+
preEditText.current = text;
|
|
20
|
+
setIsEditing(false);
|
|
21
|
+
};
|
|
22
|
+
const handleKeyDown = (e) => {
|
|
23
|
+
if (e.key === 'Enter' && !multiline) {
|
|
24
|
+
handleEditSave();
|
|
25
|
+
}
|
|
26
|
+
if (e.key === 'Escape') {
|
|
27
|
+
setText(preEditText.current);
|
|
28
|
+
setIsEditing(false);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const InputComponent = multiline ? TextArea : TextInput;
|
|
32
|
+
return (_jsx("span", { className: classNames('ds-editable-text', className), children: isEditing
|
|
33
|
+
? (_jsx(InputComponent, { name: "editable-text", "aria-label": "Text", className: "ds-editable-text__input", value: text, onChange: e => setText(e.target.value), onBlur: handleEditSave, onKeyDown: handleKeyDown, autoFocus: true }))
|
|
34
|
+
: (_jsxs("button", { className: "ds-editable-text__button", "aria-label": "Edit text", onClick: () => setIsEditing(true), children: [text, _jsx(Icon, { name: "pencil", size: 16, className: "ds-editable-text__button-icon" })] })) }));
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=EditableText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.js","sourceRoot":"","sources":["../../../src/components/editableText/EditableText.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,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AC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAExD,OAAO,CACL,eAAM,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,SAAS,CAAC,YACvD,SAAS;YACR,CAAC,CAAC,CACE,KAAC,cAAc,IACb,IAAI,EAAC,eAAe,gBACT,MAAM,EACjB,SAAS,EAAC,yBAAyB,EACnC,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtC,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,aAAa,EACxB,SAAS,SACT,CACH;YACH,CAAC,CAAC,CACE,kBACE,SAAS,EAAC,0BAA0B,gBACzB,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,aAEhC,IAAI,EACL,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,+BAA+B,GAAG,IACnE,CACV,GACA,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ text: textProp, className, onEditSave, isEditing: isEditingProp, multiline }: {
|
|
5
|
+
text: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
onEditSave: (newText: string) => void;
|
|
8
|
+
isEditing?: boolean;
|
|
9
|
+
multiline?: boolean;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: string;
|
|
13
|
+
};
|
|
14
|
+
tags: string[];
|
|
15
|
+
argTypes: {
|
|
16
|
+
text: {
|
|
17
|
+
control: "text";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
className: {
|
|
21
|
+
control: "text";
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
onEditSave: {
|
|
25
|
+
action: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
isEditing: {
|
|
29
|
+
control: "boolean";
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
export declare const Default: Story;
|
|
37
|
+
export declare const InH1: Story;
|
|
38
|
+
export declare const InH2: Story;
|
|
39
|
+
export declare const InH3: Story;
|
|
40
|
+
export declare const InH4: Story;
|
|
41
|
+
export declare const InParagraph: Story;
|
|
42
|
+
export declare const InCustomStyledDiv: Story;
|
|
43
|
+
export declare const LongText: Story;
|
|
44
|
+
//# sourceMappingURL=EditableText.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.stories.d.ts","sourceRoot":"","sources":["../../../src/components/editableText/EditableText.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyB2B,CAAC;AAEtC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAGF,eAAO,MAAM,IAAI,EAAE,KAUlB,CAAC;AAGF,eAAO,MAAM,IAAI,EAAE,KAUlB,CAAC;AAGF,eAAO,MAAM,IAAI,EAAE,KAUlB,CAAC;AAGF,eAAO,MAAM,IAAI,EAAE,KAUlB,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,KAUzB,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,KAU/B,CAAC;AAGF,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EditableText } from './EditableText';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/EditableText',
|
|
5
|
+
component: EditableText,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: 'padded',
|
|
8
|
+
},
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
text: {
|
|
12
|
+
control: 'text',
|
|
13
|
+
description: 'The text to display',
|
|
14
|
+
},
|
|
15
|
+
className: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Optional CSS class name',
|
|
18
|
+
},
|
|
19
|
+
onEditSave: {
|
|
20
|
+
action: 'edit saved',
|
|
21
|
+
description: 'Callback fired when the text is edited',
|
|
22
|
+
},
|
|
23
|
+
isEditing: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
description: 'Control whether the text is in edit mode',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default meta;
|
|
30
|
+
// Default (inherits parent styles)
|
|
31
|
+
export const Default = {
|
|
32
|
+
render: args => (_jsx("div", { style: { width: '100%' }, children: _jsx(EditableText, { ...args }) })),
|
|
33
|
+
args: {
|
|
34
|
+
text: 'Editable Text',
|
|
35
|
+
onEditSave: () => { },
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
// Inside H1 heading
|
|
39
|
+
export const InH1 = {
|
|
40
|
+
render: args => (_jsx("h1", { children: _jsx(EditableText, { ...args }) })),
|
|
41
|
+
args: {
|
|
42
|
+
text: 'Editable Heading Level 1',
|
|
43
|
+
onEditSave: () => { },
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
// Inside H2 heading
|
|
47
|
+
export const InH2 = {
|
|
48
|
+
render: args => (_jsx("h2", { children: _jsx(EditableText, { ...args }) })),
|
|
49
|
+
args: {
|
|
50
|
+
text: 'Editable Heading Level 2',
|
|
51
|
+
onEditSave: () => { },
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
// Inside H3 heading
|
|
55
|
+
export const InH3 = {
|
|
56
|
+
render: args => (_jsx("h3", { children: _jsx(EditableText, { ...args }) })),
|
|
57
|
+
args: {
|
|
58
|
+
text: 'Editable Heading Level 3',
|
|
59
|
+
onEditSave: () => { },
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
// Inside H4 heading
|
|
63
|
+
export const InH4 = {
|
|
64
|
+
render: args => (_jsx("h4", { children: _jsx(EditableText, { ...args }) })),
|
|
65
|
+
args: {
|
|
66
|
+
text: 'Editable Heading Level 4',
|
|
67
|
+
onEditSave: () => { },
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
// Inside paragraph
|
|
71
|
+
export const InParagraph = {
|
|
72
|
+
render: args => (_jsx("p", { children: _jsx(EditableText, { ...args }) })),
|
|
73
|
+
args: {
|
|
74
|
+
text: 'Editable paragraph text',
|
|
75
|
+
onEditSave: () => { },
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
// Inside custom styled div
|
|
79
|
+
export const InCustomStyledDiv = {
|
|
80
|
+
render: args => (_jsx("div", { style: { fontSize: '24px', fontWeight: 'bold', color: '#0066cc' }, children: _jsx(EditableText, { ...args }) })),
|
|
81
|
+
args: {
|
|
82
|
+
text: 'Custom styled editable text',
|
|
83
|
+
onEditSave: () => { },
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
// Long text example
|
|
87
|
+
export const LongText = {
|
|
88
|
+
render: args => (_jsx("h2", { children: _jsx(EditableText, { ...args }) })),
|
|
89
|
+
args: {
|
|
90
|
+
text: 'This is a much longer text that demonstrates how the component handles extended content',
|
|
91
|
+
onEditSave: () => { },
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=EditableText.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.stories.js","sourceRoot":"","sources":["../../../src/components/editableText/EditableText.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE;QACV,MAAM,EAAE,QAAQ;KACjB;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,qBAAqB;SACnC;QACD,SAAS,EAAE;YACT,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,yBAAyB;SACvC;QACD,UAAU,EAAE;YACV,MAAM,EAAE,YAAY;YACpB,WAAW,EAAE,wCAAwC;SACtD;QACD,SAAS,EAAE;YACT,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,0CAA0C;SACxD;KACF;CACkC,CAAC;AAEtC,eAAe,IAAI,CAAC;AAGpB,mCAAmC;AACnC,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CACd,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAC3B,KAAC,YAAY,OAAK,IAAI,GAAI,GACtB,CACP;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB;CACF,CAAC;AAEF,oBAAoB;AACpB,MAAM,CAAC,MAAM,IAAI,GAAU;IACzB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CACd,uBACE,KAAC,YAAY,OAAK,IAAI,GAAI,GACvB,CACN;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,0BAA0B;QAChC,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB;CACF,CAAC;AAEF,oBAAoB;AACpB,MAAM,CAAC,MAAM,IAAI,GAAU;IACz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U,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB;CACF,CAAC;AAEF,oBAAoB;AACpB,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CACd,uBACE,KAAC,YAAY,OAAK,IAAI,GAAI,GACvB,CACN;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,yFAAyF;QAC/F,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.test.d.ts","sourceRoot":"","sources":["../../../src/components/editableText/EditableText.test.tsx"],"names":[],"mappings":"AAGA,OAAO,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
5
|
+
import '@testing-library/jest-dom/vitest';
|
|
6
|
+
import { EditableText } from './EditableText';
|
|
7
|
+
describe('EditableText', () => {
|
|
8
|
+
const defaultProps = {
|
|
9
|
+
text: 'Test Text',
|
|
10
|
+
onEditSave: vi.fn(),
|
|
11
|
+
};
|
|
12
|
+
it('renders as a span element', () => {
|
|
13
|
+
const { container } = render(_jsx(EditableText, { ...defaultProps }));
|
|
14
|
+
const span = container.querySelector('.ds-editable-text');
|
|
15
|
+
expect(span).toBeInTheDocument();
|
|
16
|
+
expect(span?.tagName).toBe('SPAN');
|
|
17
|
+
});
|
|
18
|
+
it('displays the text in view mode', () => {
|
|
19
|
+
render(_jsx(EditableText, { ...defaultProps }));
|
|
20
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
21
|
+
expect(button).toHaveTextContent('Test Text');
|
|
22
|
+
});
|
|
23
|
+
it('applies custom className', () => {
|
|
24
|
+
const { container } = render(_jsx(EditableText, { ...defaultProps, className: "custom-class" }));
|
|
25
|
+
const span = container.querySelector('.ds-editable-text');
|
|
26
|
+
expect(span).toHaveClass('ds-editable-text', 'custom-class');
|
|
27
|
+
});
|
|
28
|
+
it('renders edit button with pencil icon in view mode', () => {
|
|
29
|
+
render(_jsx(EditableText, { ...defaultProps }));
|
|
30
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
31
|
+
expect(button).toBeInTheDocument();
|
|
32
|
+
expect(button.querySelector('.ds-editable-text__button-icon')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
it('enters edit mode when edit button is clicked', async () => {
|
|
35
|
+
const user = userEvent.setup();
|
|
36
|
+
render(_jsx(EditableText, { ...defaultProps }));
|
|
37
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
38
|
+
await user.click(button);
|
|
39
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
40
|
+
expect(input).toBeInTheDocument();
|
|
41
|
+
expect(input).toHaveValue('Test Text');
|
|
42
|
+
expect(input).toHaveFocus();
|
|
43
|
+
});
|
|
44
|
+
it('calls onEditSave when Enter key is pressed', async () => {
|
|
45
|
+
const user = userEvent.setup();
|
|
46
|
+
const onEditSave = vi.fn();
|
|
47
|
+
render(_jsx(EditableText, { ...defaultProps, onEditSave: onEditSave }));
|
|
48
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
49
|
+
await user.click(button);
|
|
50
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
51
|
+
await user.clear(input);
|
|
52
|
+
await user.type(input, 'New Text');
|
|
53
|
+
await user.keyboard('{Enter}');
|
|
54
|
+
expect(onEditSave).toHaveBeenCalledWith('New Text');
|
|
55
|
+
});
|
|
56
|
+
it('calls onEditSave when input is blurred', async () => {
|
|
57
|
+
const user = userEvent.setup();
|
|
58
|
+
const onEditSave = vi.fn();
|
|
59
|
+
render(_jsx(EditableText, { ...defaultProps, onEditSave: onEditSave }));
|
|
60
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
61
|
+
await user.click(button);
|
|
62
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
63
|
+
await user.clear(input);
|
|
64
|
+
await user.type(input, 'Updated Text');
|
|
65
|
+
await user.tab(); // Blur the input
|
|
66
|
+
await waitFor(() => {
|
|
67
|
+
expect(onEditSave).toHaveBeenCalledWith('Updated Text');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
it('exits edit mode after saving', async () => {
|
|
71
|
+
const user = userEvent.setup();
|
|
72
|
+
render(_jsx(EditableText, { ...defaultProps }));
|
|
73
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
74
|
+
await user.click(button);
|
|
75
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
76
|
+
await user.keyboard('{Enter}');
|
|
77
|
+
await waitFor(() => {
|
|
78
|
+
expect(input).not.toBeInTheDocument();
|
|
79
|
+
expect(screen.getByRole('button', { name: /edit text/i })).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
it('reverts text when Escape key is pressed', async () => {
|
|
83
|
+
const user = userEvent.setup();
|
|
84
|
+
const onEditSave = vi.fn();
|
|
85
|
+
render(_jsx(EditableText, { ...defaultProps, onEditSave: onEditSave }));
|
|
86
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
87
|
+
await user.click(button);
|
|
88
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
89
|
+
await user.clear(input);
|
|
90
|
+
await user.type(input, 'Changed Text');
|
|
91
|
+
await user.keyboard('{Escape}');
|
|
92
|
+
await waitFor(() => {
|
|
93
|
+
expect(onEditSave).not.toHaveBeenCalled();
|
|
94
|
+
const viewButton = screen.getByRole('button', { name: /edit text/i });
|
|
95
|
+
expect(viewButton).toHaveTextContent('Test Text');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
it('updates text when text prop changes', () => {
|
|
99
|
+
const { rerender } = render(_jsx(EditableText, { ...defaultProps, text: "Original" }));
|
|
100
|
+
expect(screen.getByRole('button', { name: /edit text/i })).toHaveTextContent('Original');
|
|
101
|
+
rerender(_jsx(EditableText, { ...defaultProps, text: "Updated" }));
|
|
102
|
+
expect(screen.getByRole('button', { name: /edit text/i })).toHaveTextContent('Updated');
|
|
103
|
+
});
|
|
104
|
+
it('starts in edit mode when isEditing prop is true', () => {
|
|
105
|
+
render(_jsx(EditableText, { ...defaultProps, isEditing: true }));
|
|
106
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
107
|
+
expect(input).toBeInTheDocument();
|
|
108
|
+
expect(input).toHaveValue('Test Text');
|
|
109
|
+
});
|
|
110
|
+
it('switches to edit mode when isEditing prop changes to true', () => {
|
|
111
|
+
const { rerender } = render(_jsx(EditableText, { ...defaultProps, isEditing: false }));
|
|
112
|
+
expect(screen.getByRole('button', { name: /edit text/i })).toBeInTheDocument();
|
|
113
|
+
rerender(_jsx(EditableText, { ...defaultProps, isEditing: true }));
|
|
114
|
+
expect(screen.getByRole('textbox', { name: /text/i })).toBeInTheDocument();
|
|
115
|
+
});
|
|
116
|
+
it('preserves text value across edit sessions', async () => {
|
|
117
|
+
const user = userEvent.setup();
|
|
118
|
+
const onEditSave = vi.fn();
|
|
119
|
+
render(_jsx(EditableText, { ...defaultProps, onEditSave: onEditSave }));
|
|
120
|
+
// First edit
|
|
121
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
122
|
+
await user.click(button);
|
|
123
|
+
const input = screen.getByRole('textbox', { name: /text/i });
|
|
124
|
+
await user.clear(input);
|
|
125
|
+
await user.type(input, 'First Edit');
|
|
126
|
+
await user.keyboard('{Enter}');
|
|
127
|
+
await waitFor(() => {
|
|
128
|
+
expect(onEditSave).toHaveBeenCalledWith('First Edit');
|
|
129
|
+
});
|
|
130
|
+
// Second edit - should start with previous saved value
|
|
131
|
+
const buttonAgain = await screen.findByRole('button', { name: /edit text/i });
|
|
132
|
+
await user.click(buttonAgain);
|
|
133
|
+
const inputAgain = screen.getByRole('textbox', { name: /text/i });
|
|
134
|
+
expect(inputAgain).toHaveValue('First Edit');
|
|
135
|
+
await user.clear(inputAgain);
|
|
136
|
+
await user.type(inputAgain, 'Second Edit');
|
|
137
|
+
await user.keyboard('{Escape}'); // Cancel this time
|
|
138
|
+
// Should still have first edit value
|
|
139
|
+
await waitFor(() => {
|
|
140
|
+
const finalButton = screen.getByRole('button', { name: /edit text/i });
|
|
141
|
+
expect(finalButton).toHaveTextContent('First Edit');
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
it('inherits styles from parent element', () => {
|
|
145
|
+
const { container } = render(_jsx("h1", { style: { fontSize: '32px', fontWeight: 'bold' }, children: _jsx(EditableText, { ...defaultProps }) }));
|
|
146
|
+
const span = container.querySelector('.ds-editable-text');
|
|
147
|
+
expect(span).toBeInTheDocument();
|
|
148
|
+
// Component should inherit font-size and font-weight from parent h1
|
|
149
|
+
});
|
|
150
|
+
it('renders textarea when multiline is true', async () => {
|
|
151
|
+
const user = userEvent.setup();
|
|
152
|
+
render(_jsx(EditableText, { ...defaultProps, multiline: true }));
|
|
153
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
154
|
+
await user.click(button);
|
|
155
|
+
const textarea = screen.getByRole('textbox', { name: /text/i });
|
|
156
|
+
expect(textarea).toBeInTheDocument();
|
|
157
|
+
expect(textarea.tagName).toBe('TEXTAREA');
|
|
158
|
+
});
|
|
159
|
+
it('does not save on Enter key when multiline is true', async () => {
|
|
160
|
+
const user = userEvent.setup();
|
|
161
|
+
const onEditSave = vi.fn();
|
|
162
|
+
render(_jsx(EditableText, { ...defaultProps, onEditSave: onEditSave, multiline: true }));
|
|
163
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
164
|
+
await user.click(button);
|
|
165
|
+
const textarea = screen.getByRole('textbox', { name: /text/i });
|
|
166
|
+
await user.clear(textarea);
|
|
167
|
+
await user.type(textarea, 'Line 1{Enter}Line 2');
|
|
168
|
+
// Enter should NOT trigger save in multiline mode
|
|
169
|
+
expect(onEditSave).not.toHaveBeenCalled();
|
|
170
|
+
expect(textarea).toHaveValue('Line 1\nLine 2');
|
|
171
|
+
});
|
|
172
|
+
it('saves multiline text on blur', async () => {
|
|
173
|
+
const user = userEvent.setup();
|
|
174
|
+
const onEditSave = vi.fn();
|
|
175
|
+
render(_jsx(EditableText, { ...defaultProps, onEditSave: onEditSave, multiline: true }));
|
|
176
|
+
const button = screen.getByRole('button', { name: /edit text/i });
|
|
177
|
+
await user.click(button);
|
|
178
|
+
const textarea = screen.getByRole('textbox', { name: /text/i });
|
|
179
|
+
await user.clear(textarea);
|
|
180
|
+
await user.type(textarea, 'Line 1{Enter}Line 2{Enter}Line 3');
|
|
181
|
+
await user.tab(); // Blur the textarea
|
|
182
|
+
await waitFor(() => {
|
|
183
|
+
expect(onEditSave).toHaveBeenCalledWith('Line 1\nLine 2\nLine 3');
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=EditableText.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.test.js","sourceRoot":"","sources":["../../../src/components/editableText/EditableText.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,MAAM,YAAY,GAAG;QACnB,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;KACpB,CAAC;IAEF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM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AAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -6,6 +6,14 @@ export declare const Default: {
|
|
|
6
6
|
children: string[];
|
|
7
7
|
level: number;
|
|
8
8
|
};
|
|
9
|
+
argTypes: {
|
|
10
|
+
level: {
|
|
11
|
+
control: string;
|
|
12
|
+
options: number[];
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
tags: string[];
|
|
9
17
|
};
|
|
10
18
|
export declare const FloatingChildren: {
|
|
11
19
|
args: {
|
|
@@ -31,5 +39,23 @@ export declare const HeadingWithButtonsBothSides: {
|
|
|
31
39
|
children: import("react/jsx-runtime").JSX.Element[];
|
|
32
40
|
};
|
|
33
41
|
};
|
|
42
|
+
export declare const HeadingWithEditableText: {
|
|
43
|
+
args: {
|
|
44
|
+
level: number;
|
|
45
|
+
children: import("react/jsx-runtime").JSX.Element[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare const HeadingWithEditableTextAndButton: {
|
|
49
|
+
args: {
|
|
50
|
+
level: number;
|
|
51
|
+
children: import("react/jsx-runtime").JSX.Element[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare const HeadingWithEditableTextAndButtonsBothSides: {
|
|
55
|
+
args: {
|
|
56
|
+
level: number;
|
|
57
|
+
children: import("react/jsx-runtime").JSX.Element[];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
34
60
|
export default meta;
|
|
35
61
|
//# sourceMappingURL=Heading.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.stories.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Heading.stories.d.ts","sourceRoot":"","sources":["../../../src/components/heading/Heading.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAG9B,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;CAanB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;CAanC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;CAiBtC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;CAuBvC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;CAOnC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;CAa5C,CAAC;AAEF,eAAO,MAAM,0CAA0C;;;;;CAuBtD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|