uibee 2.13.3 → 2.15.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/src/components/index.d.ts +1 -0
- package/dist/src/components/index.js +2 -0
- package/dist/src/components/inputs/shared/fieldWrapper.js +2 -1
- package/dist/src/components/inputs/textarea.js +4 -6
- package/dist/src/components/markdownrender/markdownRender.d.ts +3 -0
- package/dist/src/components/markdownrender/markdownRender.js +6 -0
- package/dist/src/globals.css +118 -114
- package/package.json +2 -1
- package/src/components/index.ts +3 -0
- package/src/components/inputs/shared/fieldWrapper.tsx +4 -3
- package/src/components/inputs/textarea.tsx +5 -7
- package/src/components/markdownrender/markdownRender.tsx +17 -0
- package/src/globals.css +20 -0
|
@@ -24,4 +24,5 @@ export { default as Alert } from './alert/alert';
|
|
|
24
24
|
export { MenuButton } from './table/menu';
|
|
25
25
|
export { default as Table } from './table/table';
|
|
26
26
|
export { default as Pagination } from './table/pagination';
|
|
27
|
+
export { default as MarkdownRender } from './markdownrender/markdownRender';
|
|
27
28
|
export { default as ConfirmPopup } from './confirm/confirmPopup';
|
|
@@ -34,5 +34,7 @@ export { default as Alert } from './alert/alert';
|
|
|
34
34
|
export { MenuButton } from './table/menu';
|
|
35
35
|
export { default as Table } from './table/table';
|
|
36
36
|
export { default as Pagination } from './table/pagination';
|
|
37
|
+
// Markdown
|
|
38
|
+
export { default as MarkdownRender } from './markdownrender/markdownRender';
|
|
37
39
|
// Confirm
|
|
38
40
|
export { default as ConfirmPopup } from './confirm/confirmPopup';
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import InputLabel from './inputLabel';
|
|
3
3
|
import InputInfo from './inputInfo';
|
|
4
4
|
import InputError from './inputError';
|
|
5
|
+
import MarkdownRender from '../../markdownrender/markdownRender';
|
|
5
6
|
export default function FieldWrapper({ label, name, required, info, error, description, textSize = 'sm', children, className, }) {
|
|
6
|
-
return (_jsxs("div", { className: `flex flex-col gap-1 w-full relative ${className || ''}`, children: [(label || info) && (_jsxs("div", { className: 'flex items-center justify-between mb-1', children: [label && (_jsx(InputLabel, { label: label, name: name, required: required, className: `ml-1 ${textSize === 'sm' ? 'text-sm!' : 'text-base!'}` })), info && _jsx(InputInfo, { info: info })] })), description && (_jsx("
|
|
7
|
+
return (_jsxs("div", { className: `flex flex-col gap-1 w-full relative ${className || ''}`, children: [(label || info) && (_jsxs("div", { className: 'flex items-center justify-between mb-1', children: [label && (_jsx(InputLabel, { label: label, name: name, required: required, className: `ml-1 ${textSize === 'sm' ? 'text-sm!' : 'text-base!'}` })), info && _jsx(InputInfo, { info: info })] })), description && (_jsx("div", { className: 'text-login-100 **:text-xs! ml-1 mb-1', children: _jsx(MarkdownRender, { MDstr: String(description || '') }) })), children, _jsx(InputError, { error: error, id: `${name}-error` })] }));
|
|
7
8
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import ReactMarkdown from 'react-markdown';
|
|
4
3
|
import { Eye, Pencil } from 'lucide-react';
|
|
5
4
|
import { FieldWrapper } from './shared';
|
|
5
|
+
import MarkdownRender from '../markdownrender/markdownRender';
|
|
6
6
|
function isValidJson(str) {
|
|
7
7
|
try {
|
|
8
8
|
JSON.parse(str);
|
|
@@ -18,13 +18,11 @@ export default function Textarea(props) {
|
|
|
18
18
|
const [preview, setPreview] = useState(false);
|
|
19
19
|
const jsonError = type === 'json' && value ? isValidJson(value) : undefined;
|
|
20
20
|
const displayError = jsonError || error;
|
|
21
|
+
console.log(value);
|
|
21
22
|
return (_jsx(FieldWrapper, { label: label, name: name, required: textareaProps.required, info: info, description: description, error: displayError, textSize: textSize, className: className, children: _jsxs("div", { className: 'relative', children: [type === 'markdown' && (_jsx("div", { className: 'absolute right-2 top-2 z-10 flex gap-2', children: _jsx("button", { type: 'button', onClick: () => setPreview(!preview), className: 'p-1 rounded hover:bg-login-500/50 text-login-text transition-colors', title: preview ? 'Edit' : 'Preview', children: preview ? _jsx(Pencil, { size: 16 }) : _jsx(Eye, { size: 16 }) }) })), type === 'markdown' && preview && (_jsx("div", { className: `
|
|
22
23
|
w-full rounded-md bg-login-500/50 border border-login-500
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
prose prose-invert prose-base max-w-none overflow-y-auto
|
|
26
|
-
${error ? 'border-red-500' : ''}
|
|
27
|
-
`, style: { minHeight: `${rows * 1.5}rem` }, children: _jsx(ReactMarkdown, { children: String(value || '') }) })), _jsx("textarea", { ...textareaProps, id: name, name: name, rows: rows, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
|
|
24
|
+
p-3 overflow-y-auto ${error ? 'border-red-500' : ''}
|
|
25
|
+
`, children: _jsx(MarkdownRender, { MDstr: String(value || '') }) })), _jsx("textarea", { ...textareaProps, id: name, name: name, rows: rows, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
|
|
28
26
|
${type === 'markdown' && preview ? 'hidden' : ''}
|
|
29
27
|
w-full rounded-md bg-login-500/50 border border-login-500
|
|
30
28
|
text-login-text placeholder-login-200
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Markdown from 'react-markdown';
|
|
3
|
+
import remarkGfm from 'remark-gfm';
|
|
4
|
+
export default function MarkdownRender({ MDstr }) {
|
|
5
|
+
return (_jsx("div", { className: 'prose prose-sm prose-custom max-w-none', children: _jsx(Markdown, { components: { h1: ({ ...props }) => _jsx("h2", { ...props }) }, remarkPlugins: [remarkGfm], children: MDstr.replace(/\\n/g, '\n') }) }));
|
|
6
|
+
}
|
package/dist/src/globals.css
CHANGED
|
@@ -826,145 +826,145 @@
|
|
|
826
826
|
font-size: 1.2rem;
|
|
827
827
|
font-weight: 500;
|
|
828
828
|
}
|
|
829
|
-
.prose-
|
|
830
|
-
font-size:
|
|
831
|
-
line-height: 1.
|
|
829
|
+
.prose-sm {
|
|
830
|
+
font-size: 0.875rem;
|
|
831
|
+
line-height: 1.7142857;
|
|
832
832
|
:where(p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
833
|
-
margin-top: 1.
|
|
834
|
-
margin-bottom: 1.
|
|
833
|
+
margin-top: 1.1428571em;
|
|
834
|
+
margin-bottom: 1.1428571em;
|
|
835
835
|
}
|
|
836
836
|
:where([class~="lead"]):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
837
|
-
font-size: 1.
|
|
838
|
-
line-height: 1.
|
|
839
|
-
margin-top:
|
|
840
|
-
margin-bottom:
|
|
837
|
+
font-size: 1.2857143em;
|
|
838
|
+
line-height: 1.5555556;
|
|
839
|
+
margin-top: 0.8888889em;
|
|
840
|
+
margin-bottom: 0.8888889em;
|
|
841
841
|
}
|
|
842
842
|
:where(blockquote):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
843
|
-
margin-top: 1.
|
|
844
|
-
margin-bottom: 1.
|
|
845
|
-
padding-inline-start:
|
|
843
|
+
margin-top: 1.3333333em;
|
|
844
|
+
margin-bottom: 1.3333333em;
|
|
845
|
+
padding-inline-start: 1.1111111em;
|
|
846
846
|
}
|
|
847
847
|
:where(h1):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
848
|
-
font-size: 2.
|
|
848
|
+
font-size: 2.1428571em;
|
|
849
849
|
margin-top: 0;
|
|
850
|
-
margin-bottom: 0.
|
|
851
|
-
line-height: 1.
|
|
850
|
+
margin-bottom: 0.8em;
|
|
851
|
+
line-height: 1.2;
|
|
852
852
|
}
|
|
853
853
|
:where(h2):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
854
|
-
font-size: 1.
|
|
855
|
-
margin-top:
|
|
856
|
-
margin-bottom:
|
|
857
|
-
line-height: 1.
|
|
854
|
+
font-size: 1.4285714em;
|
|
855
|
+
margin-top: 1.6em;
|
|
856
|
+
margin-bottom: 0.8em;
|
|
857
|
+
line-height: 1.4;
|
|
858
858
|
}
|
|
859
859
|
:where(h3):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
860
|
-
font-size: 1.
|
|
861
|
-
margin-top: 1.
|
|
862
|
-
margin-bottom: 0.
|
|
863
|
-
line-height: 1.
|
|
860
|
+
font-size: 1.2857143em;
|
|
861
|
+
margin-top: 1.5555556em;
|
|
862
|
+
margin-bottom: 0.4444444em;
|
|
863
|
+
line-height: 1.5555556;
|
|
864
864
|
}
|
|
865
865
|
:where(h4):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
866
|
-
margin-top: 1.
|
|
867
|
-
margin-bottom: 0.
|
|
868
|
-
line-height: 1.
|
|
866
|
+
margin-top: 1.4285714em;
|
|
867
|
+
margin-bottom: 0.5714286em;
|
|
868
|
+
line-height: 1.4285714;
|
|
869
869
|
}
|
|
870
870
|
:where(img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
871
|
-
margin-top:
|
|
872
|
-
margin-bottom:
|
|
871
|
+
margin-top: 1.7142857em;
|
|
872
|
+
margin-bottom: 1.7142857em;
|
|
873
873
|
}
|
|
874
874
|
:where(picture):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
875
|
-
margin-top:
|
|
876
|
-
margin-bottom:
|
|
875
|
+
margin-top: 1.7142857em;
|
|
876
|
+
margin-bottom: 1.7142857em;
|
|
877
877
|
}
|
|
878
878
|
:where(picture > img):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
879
879
|
margin-top: 0;
|
|
880
880
|
margin-bottom: 0;
|
|
881
881
|
}
|
|
882
882
|
:where(video):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
883
|
-
margin-top:
|
|
884
|
-
margin-bottom:
|
|
883
|
+
margin-top: 1.7142857em;
|
|
884
|
+
margin-bottom: 1.7142857em;
|
|
885
885
|
}
|
|
886
886
|
:where(kbd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
887
|
-
font-size: 0.
|
|
887
|
+
font-size: 0.8571429em;
|
|
888
888
|
border-radius: 0.3125rem;
|
|
889
|
-
padding-top: 0.
|
|
890
|
-
padding-inline-end: 0.
|
|
891
|
-
padding-bottom: 0.
|
|
892
|
-
padding-inline-start: 0.
|
|
889
|
+
padding-top: 0.1428571em;
|
|
890
|
+
padding-inline-end: 0.3571429em;
|
|
891
|
+
padding-bottom: 0.1428571em;
|
|
892
|
+
padding-inline-start: 0.3571429em;
|
|
893
893
|
}
|
|
894
894
|
:where(code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
895
|
-
font-size: 0.
|
|
895
|
+
font-size: 0.8571429em;
|
|
896
896
|
}
|
|
897
897
|
:where(h2 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
898
|
-
font-size: 0.
|
|
898
|
+
font-size: 0.9em;
|
|
899
899
|
}
|
|
900
900
|
:where(h3 code):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
901
|
-
font-size: 0.
|
|
901
|
+
font-size: 0.8888889em;
|
|
902
902
|
}
|
|
903
903
|
:where(pre):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
904
|
-
font-size: 0.
|
|
905
|
-
line-height: 1.
|
|
906
|
-
margin-top: 1.
|
|
907
|
-
margin-bottom: 1.
|
|
908
|
-
border-radius: 0.
|
|
909
|
-
padding-top: 0.
|
|
910
|
-
padding-inline-end:
|
|
911
|
-
padding-bottom: 0.
|
|
912
|
-
padding-inline-start:
|
|
904
|
+
font-size: 0.8571429em;
|
|
905
|
+
line-height: 1.6666667;
|
|
906
|
+
margin-top: 1.6666667em;
|
|
907
|
+
margin-bottom: 1.6666667em;
|
|
908
|
+
border-radius: 0.25rem;
|
|
909
|
+
padding-top: 0.6666667em;
|
|
910
|
+
padding-inline-end: 1em;
|
|
911
|
+
padding-bottom: 0.6666667em;
|
|
912
|
+
padding-inline-start: 1em;
|
|
913
913
|
}
|
|
914
914
|
:where(ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
915
|
-
margin-top: 1.
|
|
916
|
-
margin-bottom: 1.
|
|
917
|
-
padding-inline-start: 1.
|
|
915
|
+
margin-top: 1.1428571em;
|
|
916
|
+
margin-bottom: 1.1428571em;
|
|
917
|
+
padding-inline-start: 1.5714286em;
|
|
918
918
|
}
|
|
919
919
|
:where(ul):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
920
|
-
margin-top: 1.
|
|
921
|
-
margin-bottom: 1.
|
|
922
|
-
padding-inline-start: 1.
|
|
920
|
+
margin-top: 1.1428571em;
|
|
921
|
+
margin-bottom: 1.1428571em;
|
|
922
|
+
padding-inline-start: 1.5714286em;
|
|
923
923
|
}
|
|
924
924
|
:where(li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
925
|
-
margin-top: 0.
|
|
926
|
-
margin-bottom: 0.
|
|
925
|
+
margin-top: 0.2857143em;
|
|
926
|
+
margin-bottom: 0.2857143em;
|
|
927
927
|
}
|
|
928
928
|
:where(ol > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
929
|
-
padding-inline-start: 0.
|
|
929
|
+
padding-inline-start: 0.4285714em;
|
|
930
930
|
}
|
|
931
931
|
:where(ul > li):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
932
|
-
padding-inline-start: 0.
|
|
932
|
+
padding-inline-start: 0.4285714em;
|
|
933
933
|
}
|
|
934
|
-
:where(.prose-
|
|
935
|
-
margin-top: 0.
|
|
936
|
-
margin-bottom: 0.
|
|
934
|
+
:where(.prose-sm > ul > li p):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
935
|
+
margin-top: 0.5714286em;
|
|
936
|
+
margin-bottom: 0.5714286em;
|
|
937
937
|
}
|
|
938
|
-
:where(.prose-
|
|
939
|
-
margin-top: 1.
|
|
938
|
+
:where(.prose-sm > ul > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
939
|
+
margin-top: 1.1428571em;
|
|
940
940
|
}
|
|
941
|
-
:where(.prose-
|
|
942
|
-
margin-bottom: 1.
|
|
941
|
+
:where(.prose-sm > ul > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
942
|
+
margin-bottom: 1.1428571em;
|
|
943
943
|
}
|
|
944
|
-
:where(.prose-
|
|
945
|
-
margin-top: 1.
|
|
944
|
+
:where(.prose-sm > ol > li > p:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
945
|
+
margin-top: 1.1428571em;
|
|
946
946
|
}
|
|
947
|
-
:where(.prose-
|
|
948
|
-
margin-bottom: 1.
|
|
947
|
+
:where(.prose-sm > ol > li > p:last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
948
|
+
margin-bottom: 1.1428571em;
|
|
949
949
|
}
|
|
950
950
|
:where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
951
|
-
margin-top: 0.
|
|
952
|
-
margin-bottom: 0.
|
|
951
|
+
margin-top: 0.5714286em;
|
|
952
|
+
margin-bottom: 0.5714286em;
|
|
953
953
|
}
|
|
954
954
|
:where(dl):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
955
|
-
margin-top: 1.
|
|
956
|
-
margin-bottom: 1.
|
|
955
|
+
margin-top: 1.1428571em;
|
|
956
|
+
margin-bottom: 1.1428571em;
|
|
957
957
|
}
|
|
958
958
|
:where(dt):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
959
|
-
margin-top: 1.
|
|
959
|
+
margin-top: 1.1428571em;
|
|
960
960
|
}
|
|
961
961
|
:where(dd):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
962
|
-
margin-top: 0.
|
|
963
|
-
padding-inline-start: 1.
|
|
962
|
+
margin-top: 0.2857143em;
|
|
963
|
+
padding-inline-start: 1.5714286em;
|
|
964
964
|
}
|
|
965
965
|
:where(hr):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
966
|
-
margin-top:
|
|
967
|
-
margin-bottom:
|
|
966
|
+
margin-top: 2.8571429em;
|
|
967
|
+
margin-bottom: 2.8571429em;
|
|
968
968
|
}
|
|
969
969
|
:where(hr + *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
970
970
|
margin-top: 0;
|
|
@@ -979,13 +979,13 @@
|
|
|
979
979
|
margin-top: 0;
|
|
980
980
|
}
|
|
981
981
|
:where(table):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
982
|
-
font-size: 0.
|
|
983
|
-
line-height: 1.
|
|
982
|
+
font-size: 0.8571429em;
|
|
983
|
+
line-height: 1.5;
|
|
984
984
|
}
|
|
985
985
|
:where(thead th):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
986
|
-
padding-inline-end:
|
|
987
|
-
padding-bottom: 0.
|
|
988
|
-
padding-inline-start:
|
|
986
|
+
padding-inline-end: 1em;
|
|
987
|
+
padding-bottom: 0.6666667em;
|
|
988
|
+
padding-inline-start: 1em;
|
|
989
989
|
}
|
|
990
990
|
:where(thead th:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
991
991
|
padding-inline-start: 0;
|
|
@@ -994,10 +994,10 @@
|
|
|
994
994
|
padding-inline-end: 0;
|
|
995
995
|
}
|
|
996
996
|
:where(tbody td, tfoot td):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
997
|
-
padding-top: 0.
|
|
998
|
-
padding-inline-end:
|
|
999
|
-
padding-bottom: 0.
|
|
1000
|
-
padding-inline-start:
|
|
997
|
+
padding-top: 0.6666667em;
|
|
998
|
+
padding-inline-end: 1em;
|
|
999
|
+
padding-bottom: 0.6666667em;
|
|
1000
|
+
padding-inline-start: 1em;
|
|
1001
1001
|
}
|
|
1002
1002
|
:where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
1003
1003
|
padding-inline-start: 0;
|
|
@@ -1006,22 +1006,22 @@
|
|
|
1006
1006
|
padding-inline-end: 0;
|
|
1007
1007
|
}
|
|
1008
1008
|
:where(figure):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
1009
|
-
margin-top:
|
|
1010
|
-
margin-bottom:
|
|
1009
|
+
margin-top: 1.7142857em;
|
|
1010
|
+
margin-bottom: 1.7142857em;
|
|
1011
1011
|
}
|
|
1012
1012
|
:where(figure > *):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
1013
1013
|
margin-top: 0;
|
|
1014
1014
|
margin-bottom: 0;
|
|
1015
1015
|
}
|
|
1016
1016
|
:where(figcaption):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
1017
|
-
font-size: 0.
|
|
1018
|
-
line-height: 1.
|
|
1019
|
-
margin-top: 0.
|
|
1017
|
+
font-size: 0.8571429em;
|
|
1018
|
+
line-height: 1.3333333;
|
|
1019
|
+
margin-top: 0.6666667em;
|
|
1020
1020
|
}
|
|
1021
|
-
:where(.prose-
|
|
1021
|
+
:where(.prose-sm > :first-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
1022
1022
|
margin-top: 0;
|
|
1023
1023
|
}
|
|
1024
|
-
:where(.prose-
|
|
1024
|
+
:where(.prose-sm > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
1025
1025
|
margin-bottom: 0;
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
@@ -2218,25 +2218,23 @@
|
|
|
2218
2218
|
--tw-ease: var(--ease-out);
|
|
2219
2219
|
transition-timing-function: var(--ease-out);
|
|
2220
2220
|
}
|
|
2221
|
-
.prose-
|
|
2222
|
-
--tw-prose-body: var(--
|
|
2223
|
-
--tw-prose-headings: var(--
|
|
2224
|
-
--tw-prose-lead: var(--
|
|
2225
|
-
--tw-prose-links: var(--
|
|
2226
|
-
--tw-prose-bold: var(--
|
|
2227
|
-
--tw-prose-counters: var(--
|
|
2228
|
-
--tw-prose-bullets: var(--
|
|
2229
|
-
--tw-prose-hr: var(--
|
|
2230
|
-
--tw-prose-quotes: var(--
|
|
2231
|
-
--tw-prose-quote-borders: var(--
|
|
2232
|
-
--tw-prose-captions: var(--
|
|
2233
|
-
--tw-prose-
|
|
2234
|
-
--tw-prose-
|
|
2235
|
-
--tw-prose-
|
|
2236
|
-
--tw-prose-
|
|
2237
|
-
--tw-prose-
|
|
2238
|
-
--tw-prose-th-borders: var(--tw-prose-invert-th-borders);
|
|
2239
|
-
--tw-prose-td-borders: var(--tw-prose-invert-td-borders);
|
|
2221
|
+
.prose-custom {
|
|
2222
|
+
--tw-prose-body: var(--color-login-text);
|
|
2223
|
+
--tw-prose-headings: var(--color-login-text);
|
|
2224
|
+
--tw-prose-lead: var(--color-login-300);
|
|
2225
|
+
--tw-prose-links: var(--color-login);
|
|
2226
|
+
--tw-prose-bold: var(--color-login-text);
|
|
2227
|
+
--tw-prose-counters: var(--color-login-400);
|
|
2228
|
+
--tw-prose-bullets: var(--color-login-400);
|
|
2229
|
+
--tw-prose-hr: var(--color-login-300);
|
|
2230
|
+
--tw-prose-quotes: var(--color-login-text);
|
|
2231
|
+
--tw-prose-quote-borders: var(--color-login-300);
|
|
2232
|
+
--tw-prose-captions: var(--color-login-300);
|
|
2233
|
+
--tw-prose-code: var(--color-login-text);
|
|
2234
|
+
--tw-prose-pre-code: var(--color-login-text);
|
|
2235
|
+
--tw-prose-pre-bg: var(--color-login-800);
|
|
2236
|
+
--tw-prose-th-borders: var(--color-login-500);
|
|
2237
|
+
--tw-prose-td-borders: var(--color-login-500);
|
|
2240
2238
|
}
|
|
2241
2239
|
.outline-none {
|
|
2242
2240
|
--tw-outline-style: none;
|
|
@@ -2249,6 +2247,12 @@
|
|
|
2249
2247
|
.ring-inset {
|
|
2250
2248
|
--tw-ring-inset: inset;
|
|
2251
2249
|
}
|
|
2250
|
+
.\*\*\:text-xs\! {
|
|
2251
|
+
:is(& *) {
|
|
2252
|
+
font-size: var(--text-xs) !important;
|
|
2253
|
+
line-height: var(--tw-leading, var(--text-xs--line-height)) !important;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2252
2256
|
.group-hover\:opacity-100 {
|
|
2253
2257
|
&:is(:where(.group):hover *) {
|
|
2254
2258
|
@media (hover: hover) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uibee",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Shared components, functions and hooks for reuse across Login projects",
|
|
5
5
|
"homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"lucide-react": "^0.577.0",
|
|
55
55
|
"react-dom": "19.2.4",
|
|
56
56
|
"react-markdown": "^10.1.0",
|
|
57
|
+
"remark-gfm": "^4.0.1",
|
|
57
58
|
"utilbee": "^1.4.1"
|
|
58
59
|
}
|
|
59
60
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -44,5 +44,8 @@ export { MenuButton } from './table/menu'
|
|
|
44
44
|
export { default as Table } from './table/table'
|
|
45
45
|
export { default as Pagination } from './table/pagination'
|
|
46
46
|
|
|
47
|
+
// Markdown
|
|
48
|
+
export { default as MarkdownRender } from './markdownrender/markdownRender'
|
|
49
|
+
|
|
47
50
|
// Confirm
|
|
48
51
|
export { default as ConfirmPopup } from './confirm/confirmPopup'
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react'
|
|
|
2
2
|
import InputLabel from './inputLabel'
|
|
3
3
|
import InputInfo from './inputInfo'
|
|
4
4
|
import InputError from './inputError'
|
|
5
|
+
import MarkdownRender from '@components/markdownrender/markdownRender'
|
|
5
6
|
|
|
6
7
|
interface FieldWrapperProps {
|
|
7
8
|
label?: string
|
|
@@ -42,9 +43,9 @@ export default function FieldWrapper({
|
|
|
42
43
|
</div>
|
|
43
44
|
)}
|
|
44
45
|
{description && (
|
|
45
|
-
<
|
|
46
|
-
{description}
|
|
47
|
-
</
|
|
46
|
+
<div className='text-login-100 **:text-xs! ml-1 mb-1'>
|
|
47
|
+
<MarkdownRender MDstr={String(description || '')} />
|
|
48
|
+
</div>
|
|
48
49
|
)}
|
|
49
50
|
{children}
|
|
50
51
|
<InputError error={error} id={`${name}-error`} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
-
import ReactMarkdown from 'react-markdown'
|
|
3
2
|
import { Eye, Pencil } from 'lucide-react'
|
|
4
3
|
import { FieldWrapper } from './shared'
|
|
4
|
+
import MarkdownRender from '@components/markdownrender/markdownRender'
|
|
5
5
|
|
|
6
6
|
export type TextareaProps = Omit<React.ComponentProps<'textarea'>, 'name'> & {
|
|
7
7
|
name: string
|
|
@@ -31,6 +31,8 @@ export default function Textarea(props: TextareaProps) {
|
|
|
31
31
|
const jsonError = type === 'json' && value ? isValidJson(value as string) : undefined
|
|
32
32
|
const displayError = jsonError || error
|
|
33
33
|
|
|
34
|
+
console.log(value)
|
|
35
|
+
|
|
34
36
|
return (
|
|
35
37
|
<FieldWrapper
|
|
36
38
|
label={label}
|
|
@@ -60,14 +62,10 @@ export default function Textarea(props: TextareaProps) {
|
|
|
60
62
|
<div
|
|
61
63
|
className={`
|
|
62
64
|
w-full rounded-md bg-login-500/50 border border-login-500
|
|
63
|
-
|
|
64
|
-
p-3
|
|
65
|
-
prose prose-invert prose-base max-w-none overflow-y-auto
|
|
66
|
-
${error ? 'border-red-500' : ''}
|
|
65
|
+
p-3 overflow-y-auto ${error ? 'border-red-500' : ''}
|
|
67
66
|
`}
|
|
68
|
-
style={{ minHeight: `${rows * 1.5}rem` }}
|
|
69
67
|
>
|
|
70
|
-
<
|
|
68
|
+
<MarkdownRender MDstr={String(value || '')} />
|
|
71
69
|
</div>
|
|
72
70
|
)}
|
|
73
71
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Markdown from 'react-markdown'
|
|
2
|
+
import remarkGfm from 'remark-gfm'
|
|
3
|
+
|
|
4
|
+
export default function MarkdownRender({MDstr}: {MDstr: string}) {
|
|
5
|
+
return (
|
|
6
|
+
<div className='prose prose-sm prose-custom max-w-none'>
|
|
7
|
+
<Markdown
|
|
8
|
+
components={{ h1: ({...props}) => <h2 {...props} /> }}
|
|
9
|
+
remarkPlugins={
|
|
10
|
+
[remarkGfm]
|
|
11
|
+
}
|
|
12
|
+
>
|
|
13
|
+
{MDstr.replace(/\\n/g, '\n')}
|
|
14
|
+
</Markdown>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
package/src/globals.css
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
--color-login-300: #5e5e5e;
|
|
34
34
|
--color-login-200: #727272;
|
|
35
35
|
--color-login-100: #b0b0b0;
|
|
36
|
+
--color-login-75: #e4e4e4;
|
|
36
37
|
--color-login-50: #ededed;
|
|
37
38
|
|
|
38
39
|
--color-login-text: #ededed;
|
|
@@ -98,6 +99,25 @@
|
|
|
98
99
|
--color-login-text: #0e0e0e;
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
@utility prose-custom {
|
|
103
|
+
--tw-prose-body: var(--color-login-text);
|
|
104
|
+
--tw-prose-headings: var(--color-login-text);
|
|
105
|
+
--tw-prose-lead: var(--color-login-300);
|
|
106
|
+
--tw-prose-links: var(--color-login);
|
|
107
|
+
--tw-prose-bold: var(--color-login-text);
|
|
108
|
+
--tw-prose-counters: var(--color-login-400);
|
|
109
|
+
--tw-prose-bullets: var(--color-login-400);
|
|
110
|
+
--tw-prose-hr: var(--color-login-300);
|
|
111
|
+
--tw-prose-quotes: var(--color-login-text);
|
|
112
|
+
--tw-prose-quote-borders: var(--color-login-300);
|
|
113
|
+
--tw-prose-captions: var(--color-login-300);
|
|
114
|
+
--tw-prose-code: var(--color-login-text);
|
|
115
|
+
--tw-prose-pre-code: var(--color-login-text);
|
|
116
|
+
--tw-prose-pre-bg: var(--color-login-800);
|
|
117
|
+
--tw-prose-th-borders: var(--color-login-500);
|
|
118
|
+
--tw-prose-td-borders: var(--color-login-500);
|
|
119
|
+
}
|
|
120
|
+
|
|
101
121
|
@keyframes jump {
|
|
102
122
|
40% {
|
|
103
123
|
transform: translateY(-0.3rem);
|