@capyx/components-library 0.0.15 → 0.0.17
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.
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.ql-rich-text-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
min-height: 0;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Override Quill snow's height:100% so the container grows with content
|
|
8
|
+
instead of collapsing when no ancestor has a fixed height.
|
|
9
|
+
Three-class specificity (0,3,0) beats Quill's own .ql-container.ql-snow (0,2,0). */
|
|
10
|
+
.ql-rich-text-wrapper .ql-container.ql-snow {
|
|
11
|
+
height: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* The editor is the scrollable unit; give it a sensible minimum. */
|
|
15
|
+
.ql-rich-text-wrapper .ql-editor {
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
min-height: 150px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* --constrained modifier: bridges the flex chain through ReactQuill's .quill node.
|
|
21
|
+
* Only activates when the constrainHeight prop is true.
|
|
22
|
+
* Requires the host to set an explicit height on the wrapper (via style prop):
|
|
23
|
+
* - flex fill: style={{ flex: 1, minHeight: 0 }}
|
|
24
|
+
* - fixed height: style={{ height: '40vh' }}
|
|
25
|
+
*/
|
|
26
|
+
.ql-rich-text-wrapper--constrained .quill {
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-height: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ql-rich-text-wrapper--constrained .ql-container {
|
|
34
|
+
flex: 1;
|
|
35
|
+
min-height: 0;
|
|
36
|
+
}
|
|
@@ -53,6 +53,15 @@ export type RichTextInputProps = {
|
|
|
53
53
|
style?: CSSProperties;
|
|
54
54
|
/** Extra CSS class names added to the outer wrapper `div`. */
|
|
55
55
|
wrapperClassName?: string;
|
|
56
|
+
/**
|
|
57
|
+
* When true, activates internal height-constraining / scrollable mode by adding the
|
|
58
|
+
* `ql-rich-text-wrapper--constrained` CSS modifier class.
|
|
59
|
+
*
|
|
60
|
+
* Pass alongside a `style` that sets the height:
|
|
61
|
+
* - Inside a flex column (e.g. a modal body): `style={{ flex: 1, minHeight: 0 }}`
|
|
62
|
+
* - Fixed-height inline placement: `style={{ height: '40vh' }}`
|
|
63
|
+
*/
|
|
64
|
+
constrainHeight?: boolean;
|
|
56
65
|
};
|
|
57
66
|
/**
|
|
58
67
|
* RichTextInput - A rich text editor component using ReactQuill
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextInput.d.ts","sourceRoot":"","sources":["../../lib/components/RichTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,EAAE,EAAwC,MAAM,OAAO,CAAC;AAG1F,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qBAAqB,CAAC;AAE7B,QAAA,MAAM,OAAO,qIAAsI,CAAC;AACpJ,KAAK,UAAU,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"RichTextInput.d.ts","sourceRoot":"","sources":["../../lib/components/RichTextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,EAAE,EAAwC,MAAM,OAAO,CAAC;AAG1F,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qBAAqB,CAAC;AAE7B,QAAA,MAAM,OAAO,qIAAsI,CAAC;AACpJ,KAAK,UAAU,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mFAAmF;IACnF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAkFhD,CAAC"}
|
|
@@ -37,7 +37,7 @@ const formats = ['header', 'bold', 'color', 'italic', 'link', 'strike', 'script'
|
|
|
37
37
|
* </Modal>
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export const RichTextInput = ({ readonly = false, maxLength, value = '', onChange, isInvalid = false, formats = ['header', 'bold', 'italic', 'underline', 'list'], style, wrapperClassName, }) => {
|
|
40
|
+
export const RichTextInput = ({ readonly = false, maxLength, value = '', onChange, isInvalid = false, formats = ['header', 'bold', 'italic', 'underline', 'list'], style, wrapperClassName, constrainHeight = false, }) => {
|
|
41
41
|
const reactQuillRef = useRef(null);
|
|
42
42
|
const [count, setCount] = useState(value.length);
|
|
43
43
|
const checkCharacterCount = (event) => {
|
|
@@ -72,5 +72,5 @@ export const RichTextInput = ({ readonly = false, maxLength, value = '', onChang
|
|
|
72
72
|
],
|
|
73
73
|
};
|
|
74
74
|
// const formats = ['header', 'bold', 'color', 'italic', 'link', 'strike', 'script', 'underline', 'list', 'code', 'blockquote', 'code-block'];
|
|
75
|
-
return (_jsxs("div", { className: `ql-rich-text-wrapper${wrapperClassName ? ` ${wrapperClassName}` : ''}`, style: style, children: [_jsx(ReactQuill, { ref: reactQuillRef, theme: "snow", onKeyDown: checkCharacterCount, onKeyUp: setContentLength, formats: formats, modules: modules, value: value, onChange: onChange, readOnly: readonly, className: isInvalid ? 'is-invalid' : '' }), maxLength && (_jsxs(Form.Text, { className: count > maxLength ? 'text-danger' : 'text-muted', children: [count, "/", maxLength, " characters"] }))] }));
|
|
75
|
+
return (_jsxs("div", { className: `ql-rich-text-wrapper${constrainHeight ? ' ql-rich-text-wrapper--constrained' : ''}${wrapperClassName ? ` ${wrapperClassName}` : ''}`, style: style, children: [_jsx(ReactQuill, { ref: reactQuillRef, theme: "snow", onKeyDown: checkCharacterCount, onKeyUp: setContentLength, formats: formats, modules: modules, value: value, onChange: onChange, readOnly: readonly, className: isInvalid ? 'is-invalid' : '' }), maxLength && (_jsxs(Form.Text, { className: count > maxLength ? 'text-danger' : 'text-muted', children: [count, "/", maxLength, " characters"] }))] }));
|
|
76
76
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyx/components-library",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Shared React component library for Capyx applications",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"lib": "lib"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "tsc && npm run build:cjs",
|
|
40
|
+
"build": "tsc && npm run build:css && npm run build:cjs",
|
|
41
|
+
"build:css": "node scripts/copy-css.js",
|
|
41
42
|
"build:cjs": "tsc --module commonjs --outDir dist-cjs && node scripts/rename-cjs.js",
|
|
42
43
|
"prepublishOnly": "npm run build",
|
|
43
44
|
"lint": "biome lint .",
|